forked from AkkomaGang/akkoma
Merge branch 'develop' of https://akkoma.dev/AkkomaGang/akkoma into akko.wtf
This commit is contained in:
commit
e934cd4ca5
9 changed files with 172 additions and 34 deletions
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -6,8 +6,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
## UNRELEASED
|
||||
|
||||
## Added
|
||||
- New config option `:instance, :cleanup_attachments_delay`
|
||||
- It is now possible to display custom source URLs in akkoma-fe;
|
||||
the settings are part of the frontend configuration
|
||||
|
||||
## Fixed
|
||||
- Media proxy no longer attempts to proxy embedded images
|
||||
- Fix significant uneccessary overhead of attachment cleanup;
|
||||
it no longer attempts to cleanup attachments of deleted remote posts
|
||||
- Fix “Delete & Redraft” often losing attachments if attachment cleanup was enabled
|
||||
- ObjectAge policy no longer lets unlisted posts slip through
|
||||
- ObjectAge policy no longer leaks belated DMs and follower-only posts
|
||||
- the NodeINfo endpoint now uses the correct content type
|
||||
|
||||
## Changed
|
||||
- Anonymous objects now federate completely without an id
|
||||
adopting a proposed AP spec errata and restoring federation
|
||||
with e.g. IceShrimp.NET and fedify-based implementations
|
||||
|
||||
## 3.13.3
|
||||
|
||||
|
|
|
@ -303,6 +303,7 @@
|
|||
allow_headings: false,
|
||||
allow_tables: false,
|
||||
allow_fonts: false,
|
||||
allow_math: true,
|
||||
scrub_policy: [
|
||||
Pleroma.HTML.Scrubber.Default,
|
||||
Pleroma.HTML.Transform.MediaProxy
|
||||
|
|
|
@ -35,32 +35,24 @@ sudo useradd -r -s /bin/false -m -d /var/lib/akkoma -U akkoma
|
|||
|
||||
### Install Elixir and Erlang
|
||||
|
||||
#### Using `apt`
|
||||
If your distribution packages a recent enough version of Elixir, you can install it directly from the distro repositories and skip to the next section of the guide:
|
||||
|
||||
```shell
|
||||
sudo apt install elixir erlang-dev erlang-nox
|
||||
```
|
||||
|
||||
Otherwise use [asdf](https://github.com/asdf-vm/asdf) to install the latest versions of Elixir and Erlang.
|
||||
#### Using `asdf`
|
||||
If your distribution does not have a recent version of Elxir in their repositories, you can use [asdf](https://asdf-vm.com/) to install a newer version of Elixir and Erlang.
|
||||
|
||||
First, install some dependencies needed to build Elixir and Erlang:
|
||||
```shell
|
||||
sudo apt install curl unzip build-essential autoconf m4 libncurses5-dev libssh-dev unixodbc-dev xsltproc libxml2-utils libncurses-dev
|
||||
```
|
||||
|
||||
Then login to the `akkoma` user and install asdf:
|
||||
```shell
|
||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3
|
||||
```
|
||||
Then login to the `akkoma` user.
|
||||
|
||||
Add the following lines to `~/.bashrc`:
|
||||
```shell
|
||||
. "$HOME/.asdf/asdf.sh"
|
||||
# asdf completions
|
||||
. "$HOME/.asdf/completions/asdf.bash"
|
||||
```
|
||||
|
||||
Restart the shell:
|
||||
Install asdf by following steps 1 to 3 on [their website](https://asdf-vm.com/guide/getting-started.html), then restart the shell to load asdf:
|
||||
```shell
|
||||
exec $SHELL
|
||||
```
|
||||
|
@ -69,15 +61,15 @@ Next install Erlang:
|
|||
```shell
|
||||
asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
|
||||
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
|
||||
asdf install erlang 25.3.2.5
|
||||
asdf global erlang 25.3.2.5
|
||||
asdf install erlang 26.2.5.4
|
||||
asdf global erlang 26.2.5.4
|
||||
```
|
||||
|
||||
Now install Elixir:
|
||||
```shell
|
||||
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
|
||||
asdf install elixir 1.15.4-otp-25
|
||||
asdf global elixir 1.15.4-otp-25
|
||||
asdf install elixir 1.17.3-otp-26
|
||||
asdf global elixir 1.17.3-otp-26
|
||||
```
|
||||
|
||||
Confirm that Elixir is installed correctly by checking the version:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## Required dependencies
|
||||
|
||||
* PostgreSQL 12+
|
||||
* Elixir 1.14+ (currently tested up to 1.16)
|
||||
* Elixir 1.14+ (currently tested up to 1.17)
|
||||
* Erlang OTP 25+ (currently tested up to OTP27)
|
||||
* git
|
||||
* file / libmagic
|
||||
|
|
|
@ -11,11 +11,13 @@
|
|||
#
|
||||
|
||||
daemon="/usr/local/bin/elixir"
|
||||
daemon_flags="--detached -S /usr/local/bin/mix phx.server"
|
||||
daemon_flags="-S /usr/local/bin/mix phx.server"
|
||||
daemon_user="_akkoma"
|
||||
daemon_execdir="/home/_akkoma/akkoma"
|
||||
|
||||
. /etc/rc.d/rc.subr
|
||||
|
||||
rc_bg="YES"
|
||||
rc_reload=NO
|
||||
pexp="phx.server"
|
||||
|
||||
|
@ -24,7 +26,7 @@ rc_check() {
|
|||
}
|
||||
|
||||
rc_start() {
|
||||
${rcexec} "cd akkoma; ${daemon} ${daemon_flags}"
|
||||
rc_exec "${daemon} ${daemon_flags}"
|
||||
}
|
||||
|
||||
rc_stop() {
|
||||
|
|
|
@ -343,13 +343,16 @@ def run(["prune_objects" | args]) do
|
|||
|
||||
%{:num_rows => del_hashtags} =
|
||||
"""
|
||||
DELETE FROM hashtags AS ht
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM hashtags_objects hto
|
||||
WHERE ht.id = hto.hashtag_id
|
||||
UNION
|
||||
SELECT 1 FROM user_follows_hashtag ufht
|
||||
WHERE ht.id = ufht.hashtag_id)
|
||||
DELETE FROM hashtags
|
||||
USING hashtags AS ht
|
||||
LEFT JOIN hashtags_objects hto
|
||||
ON ht.id = hto.hashtag_id
|
||||
LEFT JOIN user_follows_hashtag ufht
|
||||
ON ht.id = ufht.hashtag_id
|
||||
WHERE
|
||||
hashtags.id = ht.id
|
||||
AND hto.hashtag_id is NULL
|
||||
AND ufht.hashtag_id is NULL
|
||||
"""
|
||||
|> Repo.query!()
|
||||
|
||||
|
|
|
@ -84,8 +84,11 @@ defp default_config(Swoosh.Adapters.SMTP, conf, _) do
|
|||
cacerts: os_cacerts,
|
||||
versions: [:"tlsv1.2", :"tlsv1.3"],
|
||||
verify: :verify_peer,
|
||||
# some versions have supposedly issues verifying wildcard certs without this
|
||||
server_name_indication: relay,
|
||||
# This allows wildcard ceritifcates to be verified properly.
|
||||
# The :https parameter simply means to use the HTTPS wildcard format
|
||||
# (as opposed to say LDAP). SMTP servers tend to use the same type of
|
||||
# certs as HTTPS ones so this should work for most.
|
||||
customize_hostname_check: [
|
||||
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
|
||||
],
|
||||
|
|
|
@ -95,21 +95,29 @@ defp query_with(q, :rum, search_query) do
|
|||
)
|
||||
end
|
||||
|
||||
def maybe_restrict_local(q, user) do
|
||||
def should_restrict_local(user) do
|
||||
limit = Pleroma.Config.get([:instance, :limit_to_local_content], :unauthenticated)
|
||||
|
||||
case {limit, user} do
|
||||
{:all, _} -> restrict_local(q)
|
||||
{:unauthenticated, %User{}} -> q
|
||||
{:unauthenticated, _} -> restrict_local(q)
|
||||
{false, _} -> q
|
||||
{:all, _} -> true
|
||||
{:unauthenticated, %User{}} -> false
|
||||
{:unauthenticated, _} -> true
|
||||
{false, _} -> false
|
||||
end
|
||||
end
|
||||
|
||||
def maybe_restrict_local(q, user) do
|
||||
case should_restrict_local(user) do
|
||||
true -> restrict_local(q)
|
||||
false -> q
|
||||
end
|
||||
end
|
||||
|
||||
defp restrict_local(q), do: where(q, local: true)
|
||||
|
||||
def maybe_fetch(activities, user, search_query) do
|
||||
with true <- Regex.match?(~r/https?:/, search_query),
|
||||
with false <- should_restrict_local(user),
|
||||
true <- Regex.match?(~r/https?:/, search_query),
|
||||
{:ok, object} <- Fetcher.fetch_object_from_id(search_query),
|
||||
%Activity{} = activity <- Activity.get_create_by_object_ap_id(object.data["id"]),
|
||||
true <- Visibility.visible_for_user?(activity, user) do
|
||||
|
|
|
@ -124,6 +124,119 @@ defmodule Pleroma.HTML.Scrubber.Default do
|
|||
Meta.allow_tag_with_these_attributes(:font, ["face"])
|
||||
end
|
||||
|
||||
if Pleroma.Config.get!([:markup, :allow_math]) do
|
||||
Meta.allow_tag_with_these_attributes("annotation", ["encoding"])
|
||||
Meta.allow_tag_with_these_attributes(:"annotation-xml", ["encoding"])
|
||||
|
||||
Meta.allow_tag_with_these_attributes(:math, [
|
||||
"display",
|
||||
"displaystyle",
|
||||
"mathvariant",
|
||||
"scriptlevel"
|
||||
])
|
||||
|
||||
basic_math_tags = [
|
||||
"maction",
|
||||
"merror",
|
||||
:mi,
|
||||
"mmultiscripts",
|
||||
:mn,
|
||||
"mphantom",
|
||||
"mprescripts",
|
||||
"mroot",
|
||||
"mrow",
|
||||
"ms",
|
||||
"msqrt",
|
||||
"mstyle",
|
||||
"msub",
|
||||
"msubsup",
|
||||
"msup",
|
||||
"mtable",
|
||||
"mtext",
|
||||
"mtr",
|
||||
"semantics"
|
||||
]
|
||||
|
||||
for tag <- basic_math_tags do
|
||||
Meta.allow_tag_with_these_attributes(unquote(tag), [
|
||||
"mathvariant",
|
||||
"displaystyle",
|
||||
"scriptlevel"
|
||||
])
|
||||
end
|
||||
|
||||
Meta.allow_tag_with_these_attributes("mfrac", [
|
||||
"displaystyle",
|
||||
"linethickness",
|
||||
"mathvariant",
|
||||
"scriptlevel"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes(:mo, [
|
||||
"displaystyle",
|
||||
"form",
|
||||
"largeop",
|
||||
"lspace",
|
||||
"mathvariant",
|
||||
"minsize",
|
||||
"movablelimits",
|
||||
"rspace",
|
||||
"scriptlevel",
|
||||
"stretchy",
|
||||
"symmetric"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes("mover", [
|
||||
"accent",
|
||||
"displaystyle",
|
||||
"mathvariant",
|
||||
"scriptlevel"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes("mpadded", [
|
||||
"depth",
|
||||
"displaystyle",
|
||||
"height",
|
||||
"lspace",
|
||||
"mathvariant",
|
||||
"scriptlevel",
|
||||
"voffset",
|
||||
"width"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes("mspace", [
|
||||
"depth",
|
||||
"displaystyle",
|
||||
"height",
|
||||
"mathvariant",
|
||||
"scriptlevel",
|
||||
"width"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes("mtd", [
|
||||
"columnspan",
|
||||
"displaystyle",
|
||||
"mathvariant",
|
||||
"rowspan",
|
||||
"scriptlevel"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes("munder", [
|
||||
"accentunder",
|
||||
"displaystyle",
|
||||
"mathvariant",
|
||||
"scriptlevel"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes("munderover", [
|
||||
"accent",
|
||||
"accentunder",
|
||||
"displaystyle",
|
||||
"mathvariant",
|
||||
"scriptlevel"
|
||||
])
|
||||
end
|
||||
|
||||
Meta.allow_tag_with_these_attributes(:center, [])
|
||||
Meta.allow_tag_with_these_attributes(:small, [])
|
||||
|
||||
|
|
Loading…
Reference in a new issue