forked from YokaiRick/akkoma
Compare commits
1 commit
develop
...
ensure-scr
Author | SHA1 | Date | |
---|---|---|---|
|
2fdfed50f0 |
12 changed files with 16 additions and 35 deletions
|
@ -16,7 +16,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
- Documentation issue in which a non-existing nginx file was referenced
|
- Documentation issue in which a non-existing nginx file was referenced
|
||||||
- Issue where a bad inbox URL could break federation
|
|
||||||
|
|
||||||
## 2023.08
|
## 2023.08
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ def start_pleroma do
|
||||||
|
|
||||||
Enum.each(@apps, &Application.ensure_all_started/1)
|
Enum.each(@apps, &Application.ensure_all_started/1)
|
||||||
|
|
||||||
|
Pleroma.Application.load_all_pleroma_modules()
|
||||||
|
|
||||||
oban_config = [
|
oban_config = [
|
||||||
crontab: [],
|
crontab: [],
|
||||||
repo: Pleroma.Repo,
|
repo: Pleroma.Repo,
|
||||||
|
|
|
@ -17,6 +17,13 @@ def run(["http", url]) do
|
||||||
|> IO.inspect()
|
|> IO.inspect()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def run(["get_object", url]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
Pleroma.Object.Fetcher.fetch_object_from_id(url)
|
||||||
|
|> IO.inspect()
|
||||||
|
end
|
||||||
|
|
||||||
def run(["home_timeline", nickname]) do
|
def run(["home_timeline", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
user = Repo.get_by!(User, nickname: nickname)
|
user = Repo.get_by!(User, nickname: nickname)
|
||||||
|
|
|
@ -48,7 +48,6 @@ def start(_type, _args) do
|
||||||
# due to protocol consolidation warnings
|
# due to protocol consolidation warnings
|
||||||
Code.compiler_options(warnings_as_errors: false)
|
Code.compiler_options(warnings_as_errors: false)
|
||||||
Config.Holder.save_default()
|
Config.Holder.save_default()
|
||||||
Pleroma.HTML.compile_scrubbers()
|
|
||||||
Pleroma.Config.Oban.warn()
|
Pleroma.Config.Oban.warn()
|
||||||
Config.DeprecationWarnings.warn()
|
Config.DeprecationWarnings.warn()
|
||||||
Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled()
|
Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled()
|
||||||
|
|
|
@ -8,20 +8,6 @@ defmodule Pleroma.HTML do
|
||||||
|
|
||||||
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
||||||
|
|
||||||
def compile_scrubbers do
|
|
||||||
dir = Path.join(:code.priv_dir(:pleroma), "scrubbers")
|
|
||||||
|
|
||||||
dir
|
|
||||||
|> Pleroma.Utils.compile_dir()
|
|
||||||
|> case do
|
|
||||||
{:error, _errors, _warnings} ->
|
|
||||||
raise "Compiling scrubbers failed"
|
|
||||||
|
|
||||||
{:ok, _modules, _warnings} ->
|
|
||||||
:ok
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_scrubbers(scrubber) when is_atom(scrubber), do: [scrubber]
|
defp get_scrubbers(scrubber) when is_atom(scrubber), do: [scrubber]
|
||||||
defp get_scrubbers(scrubbers) when is_list(scrubbers), do: scrubbers
|
defp get_scrubbers(scrubbers) when is_list(scrubbers), do: scrubbers
|
||||||
defp get_scrubbers(_), do: [Pleroma.HTML.Scrubber.Default]
|
defp get_scrubbers(_), do: [Pleroma.HTML.Scrubber.Default]
|
||||||
|
|
|
@ -115,18 +115,13 @@ defp allowed_instances do
|
||||||
def should_federate?(url) do
|
def should_federate?(url) do
|
||||||
%{host: host} = URI.parse(url)
|
%{host: host} = URI.parse(url)
|
||||||
|
|
||||||
with {nil, false} <- {nil, is_nil(host)},
|
with allowed <- allowed_instances(),
|
||||||
allowed <- allowed_instances(),
|
|
||||||
false <- Enum.empty?(allowed) do
|
false <- Enum.empty?(allowed) do
|
||||||
allowed
|
allowed
|
||||||
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|
||||||
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
|
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
|
||||||
|> Pleroma.Web.ActivityPub.MRF.subdomain_match?(host)
|
|> Pleroma.Web.ActivityPub.MRF.subdomain_match?(host)
|
||||||
else
|
else
|
||||||
# oi!
|
|
||||||
{nil, true} ->
|
|
||||||
false
|
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
quarantined_instances =
|
quarantined_instances =
|
||||||
blocked_instances()
|
blocked_instances()
|
||||||
|
|
|
@ -18,16 +18,16 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
def render("endpoints.json", %{user: %User{nickname: nil, local: true} = _user}) do
|
def render("endpoints.json", %{user: %User{nickname: nil, local: true} = _user}) do
|
||||||
%{"sharedInbox" => url(~p"/inbox")}
|
%{"sharedInbox" => ~p"/inbox"}
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("endpoints.json", %{user: %User{local: true} = _user}) do
|
def render("endpoints.json", %{user: %User{local: true} = _user}) do
|
||||||
%{
|
%{
|
||||||
"oauthAuthorizationEndpoint" => url(~p"/oauth/authorize"),
|
"oauthAuthorizationEndpoint" => ~p"/oauth/authorize",
|
||||||
"oauthRegistrationEndpoint" => url(~p"/api/v1/apps"),
|
"oauthRegistrationEndpoint" => ~p"/api/v1/apps",
|
||||||
"oauthTokenEndpoint" => url(~p"/oauth/token"),
|
"oauthTokenEndpoint" => ~p"/oauth/token",
|
||||||
"sharedInbox" => url(~p"/inbox"),
|
"sharedInbox" => ~p"/inbox",
|
||||||
"uploadMedia" => url(~p"/api/ap/upload_media")
|
"uploadMedia" => ~p"/api/ap/upload_media"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -487,11 +487,4 @@ test "publish to url with with different ports" do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue