Merge remote-tracking branch 'upstream/develop' into neckbeard

This commit is contained in:
Your New SJW Waifu 2022-11-22 18:04:59 -06:00
commit 42cf148a81
6 changed files with 33 additions and 27 deletions

View File

@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+ - Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+
- Set timeout values for Oban queues. The default is infinity and some operations may not time out on their own. - Set timeout values for Oban queues. The default is infinity and some operations may not time out on their own.
- Delete activities are federated at lowest priority - Delete activities are federated at lowest priority
- CSP now includes wasm-unsafe-eval
### Added ### Added
- `activeMonth` and `activeHalfyear` fields in NodeInfo usage.users object - `activeMonth` and `activeHalfyear` fields in NodeInfo usage.users object
@ -57,6 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed account deletion API - Fixed account deletion API
- Fixed lowercase HTTP HEAD method in the Media Proxy Preview code - Fixed lowercase HTTP HEAD method in the Media Proxy Preview code
- Removed useless notification call on Delete activities - Removed useless notification call on Delete activities
- Improved performance for filtering out deactivated and invisible users
### Removed ### Removed
- Quack, the logging backend that pushes to Slack channels - Quack, the logging backend that pushes to Slack channels

View File

@ -778,7 +778,7 @@ Web Push Notifications configuration. You can use the mix task `mix web_push.gen
* ``private_key``: VAPID private key * ``private_key``: VAPID private key
## :logger ## :logger
* `backends`: `:console` is used to send logs to stdout, `{ExSyslogger, :ex_syslogger}` to log to syslog, and `Quack.Logger` to log to Slack * `backends`: `:console` is used to send logs to stdout, `{ExSyslogger, :ex_syslogger}` to log to syslog
An example to enable ONLY ExSyslogger (f/ex in ``prod.secret.exs``) with info and debug suppressed: An example to enable ONLY ExSyslogger (f/ex in ``prod.secret.exs``) with info and debug suppressed:
```elixir ```elixir
@ -801,10 +801,10 @@ config :logger, :ex_syslogger,
See: [loggers documentation](https://hexdocs.pm/logger/Logger.html) and [ex_sysloggers documentation](https://hexdocs.pm/ex_syslogger/) See: [loggers documentation](https://hexdocs.pm/logger/Logger.html) and [ex_sysloggers documentation](https://hexdocs.pm/ex_syslogger/)
An example of logging info to local syslog, but warn to a Slack channel: An example of logging info to local syslog, but debug to console:
```elixir ```elixir
config :logger, config :logger,
backends: [ {ExSyslogger, :ex_syslogger}, Quack.Logger ], backends: [ {ExSyslogger, :ex_syslogger}, :console ],
level: :info level: :info
config :logger, :ex_syslogger, config :logger, :ex_syslogger,
@ -812,14 +812,12 @@ config :logger, :ex_syslogger,
ident: "pleroma", ident: "pleroma",
format: "$metadata[$level] $message" format: "$metadata[$level] $message"
config :quack, config :logger, :console,
level: :warn, level: :debug,
meta: [:all], format: "\n$time $metadata[$level] $message\n",
webhook_url: "https://hooks.slack.com/services/YOUR-API-KEY-HERE" metadata: [:request_id]
``` ```
See the [Quack Github](https://github.com/azohra/quack) for more details
## Database options ## Database options

View File

@ -1064,7 +1064,6 @@ List of settings which support only full update by key:
```elixir ```elixir
@full_key_update [ @full_key_update [
{:pleroma, :ecto_repos}, {:pleroma, :ecto_repos},
{:quack, :meta},
{:mime, :types}, {:mime, :types},
{:cors_plug, [:max_age, :methods, :expose, :headers]}, {:cors_plug, [:max_age, :methods, :expose, :headers]},
{:auto_linker, :opts}, {:auto_linker, :opts},
@ -1084,18 +1083,18 @@ List of settings which support only full update by subkey:
] ]
``` ```
*Settings without explicit key must be sended in separate config object params.* *Settings without explicit key must be sent in separate config object params.*
```elixir ```elixir
config :quack, config :foo,
level: :debug, bar: :baz,
meta: [:all], meta: [:data],
... ...
``` ```
```json ```json
{ {
"configs": [ "configs": [
{"group": ":quack", "key": ":level", "value": ":debug"}, {"group": ":foo", "key": ":bar", "value": ":baz"},
{"group": ":quack", "key": ":meta", "value": [":all"]}, {"group": ":foo", "key": ":meta", "value": [":data"]},
... ...
] ]
} }

View File

@ -361,9 +361,11 @@ defmodule Pleroma.Activity do
end end
def restrict_deactivated_users(query) do def restrict_deactivated_users(query) do
deactivated_users_query = from(u in User.Query.build(%{deactivated: true}), select: u.ap_id) query
|> join(:inner, [activity], user in User,
from(activity in query, where: activity.actor not in subquery(deactivated_users_query)) as: :user,
on: activity.actor == user.ap_id and user.is_active == true
)
end end
defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search

View File

@ -1239,15 +1239,15 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end end
end end
defp exclude_invisible_actors(query, %{type: "Flag"}), do: query
defp exclude_invisible_actors(query, %{invisible_actors: true}), do: query defp exclude_invisible_actors(query, %{invisible_actors: true}), do: query
defp exclude_invisible_actors(query, _opts) do defp exclude_invisible_actors(query, _opts) do
invisible_ap_ids = query
User.Query.build(%{invisible: true, select: [:ap_id]}) |> join(:inner, [activity], u in User,
|> Repo.all() as: :u,
|> Enum.map(fn %{ap_id: ap_id} -> ap_id end) on: activity.actor == u.ap_id and u.invisible == false
)
from([activity] in query, where: activity.actor not in ^invisible_ap_ids)
end end
defp exclude_id(query, %{exclude_id: id}) when is_binary(id) do defp exclude_id(query, %{exclude_id: id}) when is_binary(id) do
@ -1377,7 +1377,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|> restrict_instance(opts) |> restrict_instance(opts)
|> restrict_announce_object_actor(opts) |> restrict_announce_object_actor(opts)
|> restrict_filtered(opts) |> restrict_filtered(opts)
|> Activity.restrict_deactivated_users() |> maybe_restrict_deactivated_users(opts)
|> exclude_poll_votes(opts) |> exclude_poll_votes(opts)
|> exclude_chat_messages(opts) |> exclude_chat_messages(opts)
|> exclude_invisible_actors(opts) |> exclude_invisible_actors(opts)
@ -1789,4 +1789,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|> restrict_visibility(%{visibility: "direct"}) |> restrict_visibility(%{visibility: "direct"})
|> order_by([activity], asc: activity.id) |> order_by([activity], asc: activity.id)
end end
defp maybe_restrict_deactivated_users(activity, %{type: "Flag"}), do: activity
defp maybe_restrict_deactivated_users(activity, _opts),
do: Activity.restrict_deactivated_users(activity)
end end

View File

@ -117,7 +117,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
if Config.get(:env) == :dev do if Config.get(:env) == :dev do
"script-src 'self' 'unsafe-eval'" "script-src 'self' 'unsafe-eval'"
else else
"script-src 'self'" "script-src 'self' 'wasm-unsafe-eval'"
end end
report = if report_uri, do: ["report-uri ", report_uri, ";report-to csp-endpoint"] report = if report_uri, do: ["report-uri ", report_uri, ";report-to csp-endpoint"]