Compare commits

...

18 commits

Author SHA1 Message Date
beefox
ccb7973b8b guppie 2023-01-05 00:33:14 +11:00
beefox
21765150ad Add That Thing 2022-11-16 13:28:24 +11:00
beefox
7624ea5f93 Merge branch 'develop' of http://akkoma.dev/AkkomaGang/akkoma into develop 2022-11-15 21:51:33 +11:00
beefox
f6422461b3 Merge branch 'develop' of http://akkoma.dev/AkkomaGang/akkoma into develop 2022-10-11 18:03:15 +11:00
beefox
6a20f59a42 Merge branch 'develop' of http://akkoma.dev/AkkomaGang/akkoma into develop 2022-09-22 11:16:06 +10:00
beefox
baf3725d92 Merge branch 'develop' of akkoma.dev:Beefox/akkoma into develop 2022-09-05 10:15:40 +10:00
beefox
f940c646c6 Merge branch 'develop' of http://akkoma.dev/AkkomaGang/akkoma into develop 2022-08-12 00:49:11 +10:00
beefox
eccc12ac92 Merge branch 'develop' of http://akkoma.dev/AkkomaGang/akkoma into develop 2022-07-27 17:07:06 +10:00
beefox
3fc0ed8f66 Merge branch 'develop' of http://akkoma.dev/AkkomaGang/akkoma into develop 2022-07-07 11:39:29 +10:00
2ca025147a mix format 2022-07-05 23:39:18 +10:00
c19a5f8582 Use finch everywhere (#33)
Reviewed-on: #33
2022-07-05 23:39:18 +10:00
sfr
717b370809 implement Move activities (#45)
Reviewed-on: #45
Co-authored-by: sfr <sol@solfisher.com>
Co-committed-by: sfr <sol@solfisher.com>
2022-07-05 23:39:18 +10:00
4ec12d7668 Update development docs 2022-07-05 23:39:17 +10:00
8b7f850ea2 Use Akkoma modification for collections 2022-07-05 23:39:17 +10:00
65058232c4 Add collection fetching module 2022-07-05 23:39:17 +10:00
2700294693 Add support for a first reference in pinned objects 2022-07-05 23:39:17 +10:00
79e5bae71a Add test for friendica featured collection 2022-07-05 23:39:17 +10:00
root
74ea422ebf Add unlist_undescribed_media.ex to mrf policies folder 2022-07-05 23:37:06 +10:00
3 changed files with 106 additions and 27 deletions

View file

@ -36,33 +36,6 @@ config :logger, :console,
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
1. Create a `test.secret.exs` file with the content as shown below

View file

@ -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

View file

@ -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