Compare commits
18 Commits
Author | SHA1 | Date |
---|---|---|
beefox | ccb7973b8b | |
beefox | 21765150ad | |
beefox | 7624ea5f93 | |
beefox | f6422461b3 | |
beefox | 6a20f59a42 | |
beefox | baf3725d92 | |
beefox | f940c646c6 | |
beefox | eccc12ac92 | |
beefox | 3fc0ed8f66 | |
FloatingGhost | 2ca025147a | |
floatingghost | c19a5f8582 | |
sfr | 717b370809 | |
Norm | 4ec12d7668 | |
FloatingGhost | 8b7f850ea2 | |
FloatingGhost | 65058232c4 | |
FloatingGhost | 2700294693 | |
FloatingGhost | 79e5bae71a | |
root | 74ea422ebf |
|
@ -36,33 +36,6 @@ config :logger, :console,
|
||||||
level: :info
|
level: :info
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing with HTTPS
|
|
||||||
|
|
||||||
If you end up developing alongside other software like misskey,
|
|
||||||
you will not be able to federate without an SSL certificate. You should
|
|
||||||
be able to use the snakeoil certificate that comes standard with most
|
|
||||||
distributions or generate one from scratch, then force elixir to accept it.
|
|
||||||
|
|
||||||
HTTP clients are none too keen to accept self-signed certs, but we can do
|
|
||||||
this:
|
|
||||||
|
|
||||||
```elixir
|
|
||||||
config :pleroma, :http,
|
|
||||||
adapter: [
|
|
||||||
pools: %{
|
|
||||||
default: [
|
|
||||||
conn_opts: [
|
|
||||||
transport_opts: [
|
|
||||||
verify: :verify_none
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
Now your SSL requests will work. Hooray.
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
1. Create a `test.secret.exs` file with the content as shown below
|
1. Create a `test.secret.exs` file with the content as shown below
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
|
||||||
|
defmodule Pleroma.Web.ActivityPub.MRF.DontBoostGuppeReplies do
|
||||||
|
alias Pleroma.User
|
||||||
|
@moduledoc "Ignores boosts that have a reply to a guppe account, written by foxes@myfriendsare.gay"
|
||||||
|
@behaviour Pleroma.Web.ActivityPub.MRF.Policy
|
||||||
|
|
||||||
|
alias Pleroma.Object
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
|
def history_awareness, do: :auto
|
||||||
|
|
||||||
|
def filter(
|
||||||
|
%{
|
||||||
|
"type" => "Announce",
|
||||||
|
"actor" => actor,
|
||||||
|
"object" => object
|
||||||
|
} = message
|
||||||
|
) do
|
||||||
|
|
||||||
|
Logger.debug("GUPPE ACTOR #{inspect(actor)}")
|
||||||
|
if actor =~ "https://a.gup.pe/u/" do
|
||||||
|
child = Object.get_by_ap_id(object).data
|
||||||
|
Logger.debug("GUPPE OBJECT #{inspect(child)}")
|
||||||
|
if child["inReplyTo"] != nil do
|
||||||
|
Logger.debug("GUPPE REJECT #{object}")
|
||||||
|
{:reject, message}
|
||||||
|
else
|
||||||
|
Logger.debug("GUPPE ALLOW #{object}")
|
||||||
|
{:ok, message}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
{:ok, message}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def filter(message), do: {:ok, message}
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def describe, do: {:ok, %{}}
|
||||||
|
end
|
|
@ -0,0 +1,58 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.Web.ActivityPub.MRF.UnlistUndescribedMedia do
|
||||||
|
alias Pleroma.User
|
||||||
|
@moduledoc "Unlists posts with media that does not have a description, written by foxes@myfriendsare.gay"
|
||||||
|
@behaviour Pleroma.Web.ActivityPub.MRF.Policy
|
||||||
|
|
||||||
|
require Pleroma.Constants
|
||||||
|
|
||||||
|
defp check_media(%{"attachment" => attachments}),
|
||||||
|
do: not Enum.all?(attachments, fn x -> x["name"] != nil && x["name"] |> String.trim() != "" end)
|
||||||
|
defp check_media(_),
|
||||||
|
do: false
|
||||||
|
|
||||||
|
def filter(
|
||||||
|
%{
|
||||||
|
"type" => "Create",
|
||||||
|
"to" => to,
|
||||||
|
"cc" => cc,
|
||||||
|
"actor" => actor,
|
||||||
|
"object" => object
|
||||||
|
} = message
|
||||||
|
) do
|
||||||
|
user = User.get_cached_by_ap_id(actor)
|
||||||
|
undescribed = check_media(object)
|
||||||
|
|
||||||
|
# unlist
|
||||||
|
if undescribed and Enum.member?(to, Pleroma.Constants.as_public()) do
|
||||||
|
to = List.delete(to, Pleroma.Constants.as_public()) ++ [user.follower_address]
|
||||||
|
cc = List.delete(cc, user.follower_address) ++ [Pleroma.Constants.as_public()]
|
||||||
|
|
||||||
|
object =
|
||||||
|
object
|
||||||
|
|> Map.put("to", to)
|
||||||
|
|> Map.put("cc", cc)
|
||||||
|
|
||||||
|
message =
|
||||||
|
message
|
||||||
|
|> Map.put("to", to)
|
||||||
|
|> Map.put("cc", cc)
|
||||||
|
|> Map.put("object", object)
|
||||||
|
|
||||||
|
{:ok, message}
|
||||||
|
else
|
||||||
|
{:ok, message}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def filter(message), do: {:ok, message}
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def describe, do: {:ok, %{}}
|
||||||
|
end
|
Loading…
Reference in New Issue