forked from AkkomaGang/akkoma
Merge branch 'develop' into config-db-keys
This commit is contained in:
commit
a5bc622970
9 changed files with 126 additions and 9 deletions
|
@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
## Fixed
|
||||
- Documentation issue in which a non-existing nginx file was referenced
|
||||
- Issue where a bad inbox URL could break federation
|
||||
|
||||
## 2023.08
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
* PostgreSQL 9.6+
|
||||
* Elixir 1.14+
|
||||
* Erlang OTP 24+
|
||||
* Erlang OTP 25+
|
||||
* git
|
||||
* file / libmagic
|
||||
* gcc (clang might also work)
|
||||
|
|
|
@ -40,7 +40,7 @@ If you are on pleroma develop, and have updated since 2022-08, you may have issu
|
|||
Please roll back the given migrations:
|
||||
|
||||
```bash
|
||||
MIX_ENV=prod mix ecto.rollback --migrations-path priv/repo/optional_migrations/pleroma_develop_rollbacks -n3
|
||||
MIX_ENV=prod mix ecto.rollback --migrations-path priv/repo/optional_migrations/pleroma_develop_rollbacks -n5
|
||||
```
|
||||
|
||||
Then compile, migrate and restart as usual.
|
||||
|
|
|
@ -115,13 +115,18 @@ defp allowed_instances do
|
|||
def should_federate?(url) do
|
||||
%{host: host} = URI.parse(url)
|
||||
|
||||
with allowed <- allowed_instances(),
|
||||
with {nil, false} <- {nil, is_nil(host)},
|
||||
allowed <- allowed_instances(),
|
||||
false <- Enum.empty?(allowed) do
|
||||
allowed
|
||||
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|
||||
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
|
||||
|> Pleroma.Web.ActivityPub.MRF.subdomain_match?(host)
|
||||
else
|
||||
# oi!
|
||||
{nil, true} ->
|
||||
false
|
||||
|
||||
_ ->
|
||||
quarantined_instances =
|
||||
blocked_instances()
|
||||
|
|
|
@ -18,16 +18,16 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||
import Ecto.Query
|
||||
|
||||
def render("endpoints.json", %{user: %User{nickname: nil, local: true} = _user}) do
|
||||
%{"sharedInbox" => ~p"/inbox"}
|
||||
%{"sharedInbox" => url(~p"/inbox")}
|
||||
end
|
||||
|
||||
def render("endpoints.json", %{user: %User{local: true} = _user}) do
|
||||
%{
|
||||
"oauthAuthorizationEndpoint" => ~p"/oauth/authorize",
|
||||
"oauthRegistrationEndpoint" => ~p"/api/v1/apps",
|
||||
"oauthTokenEndpoint" => ~p"/oauth/token",
|
||||
"sharedInbox" => ~p"/inbox",
|
||||
"uploadMedia" => ~p"/api/ap/upload_media"
|
||||
"oauthAuthorizationEndpoint" => url(~p"/oauth/authorize"),
|
||||
"oauthRegistrationEndpoint" => url(~p"/api/v1/apps"),
|
||||
"oauthTokenEndpoint" => url(~p"/oauth/token"),
|
||||
"sharedInbox" => url(~p"/inbox"),
|
||||
"uploadMedia" => url(~p"/api/ap/upload_media")
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
defmodule Pleroma.Repo.Migrations.DropUnusedIndexes do
|
||||
use Ecto.Migration
|
||||
|
||||
@disable_ddl_transaction true
|
||||
|
||||
@disable_migration_lock true
|
||||
|
||||
def up do
|
||||
drop_if_exists(
|
||||
index(:activities, ["(data->>'actor')", "inserted_at desc"], name: :activities_actor_index)
|
||||
)
|
||||
|
||||
drop_if_exists(index(:activities, ["(data->'to')"], name: :activities_to_index))
|
||||
|
||||
drop_if_exists(index(:activities, ["(data->'cc')"], name: :activities_cc_index))
|
||||
|
||||
drop_if_exists(index(:activities, ["(split_part(actor, '/', 3))"], name: :activities_hosts))
|
||||
|
||||
drop_if_exists(
|
||||
index(:activities, ["(data->'object'->>'inReplyTo')"], name: :activities_in_reply_to)
|
||||
)
|
||||
|
||||
drop_if_exists(
|
||||
index(:activities, ["((data #> '{\"object\",\"likes\"}'))"], name: :activities_likes)
|
||||
)
|
||||
end
|
||||
|
||||
def down do
|
||||
create_if_not_exists(
|
||||
index(:activities, ["(data->>'actor')", "inserted_at desc"],
|
||||
name: :activities_actor_index,
|
||||
concurrently: true
|
||||
)
|
||||
)
|
||||
|
||||
create_if_not_exists(
|
||||
index(:activities, ["(data->'to')"],
|
||||
name: :activities_to_index,
|
||||
using: :gin,
|
||||
concurrently: true
|
||||
)
|
||||
)
|
||||
|
||||
create_if_not_exists(
|
||||
index(:activities, ["(data->'cc')"],
|
||||
name: :activities_cc_index,
|
||||
using: :gin,
|
||||
concurrently: true
|
||||
)
|
||||
)
|
||||
|
||||
create_if_not_exists(
|
||||
index(:activities, ["(split_part(actor, '/', 3))"],
|
||||
name: :activities_hosts,
|
||||
concurrently: true
|
||||
)
|
||||
)
|
||||
|
||||
create_if_not_exists(
|
||||
index(:activities, ["(data->'object'->>'inReplyTo')"],
|
||||
name: :activities_in_reply_to,
|
||||
concurrently: true
|
||||
)
|
||||
)
|
||||
|
||||
create_if_not_exists(
|
||||
index(:activities, ["((data #> '{\"object\",\"likes\"}'))"],
|
||||
name: :activities_likes,
|
||||
using: :gin,
|
||||
concurrently: true
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
defmodule Pleroma.Repo.Migrations.InstancesAddMetadata do
|
||||
use Ecto.Migration
|
||||
|
||||
def down do
|
||||
alter table(:instances) do
|
||||
remove_if_exists(:metadata, :map)
|
||||
end
|
||||
end
|
||||
|
||||
def up do
|
||||
alter table(:instances) do
|
||||
add_if_not_exists(:metadata, :map)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
defmodule Pleroma.Repo.Migrations.RemoveUserApEnabled do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
alter table(:users) do
|
||||
remove_if_exists(:ap_enabled, :boolean)
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
alter table(:users) do
|
||||
add_if_not_exists(:ap_enabled, :boolean, default: true, null: false)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -487,4 +487,11 @@ test "publish to url with with different ports" do
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "should_federate/1" do
|
||||
test "should not obliterate itself if the inbox URL is bad" do
|
||||
url = "/inbox"
|
||||
refute Pleroma.Web.ActivityPub.Publisher.should_federate?(url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue