mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 02:05:12 +00:00
Merge develop
This commit is contained in:
commit
c5830ac037
31
CHANGELOG.md
31
CHANGELOG.md
|
@ -12,22 +12,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- **Breaking:** Removed `Pleroma.Workers.Cron.StatsWorker` setting from Oban `:crontab`.
|
- **Breaking:** `Pleroma.Workers.Cron.StatsWorker` setting from Oban `:crontab` (moved to a simpler implementation).
|
||||||
|
- **Breaking:** `Pleroma.Workers.Cron.ClearOauthTokenWorker` setting from Oban `:crontab` (moved to scheduled jobs).
|
||||||
|
- **Breaking:** `Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker` setting from Oban `:crontab` (moved to scheduled jobs).
|
||||||
|
|
||||||
## unreleased-patch - ???
|
### Changed
|
||||||
|
- Minimum lifetime for ephmeral activities changed to 10 minutes and made configurable (`:min_lifetime` option).
|
||||||
|
|
||||||
|
## [2.1.1] - 2020-09-08
|
||||||
|
|
||||||
|
### Security
|
||||||
|
- Fix possible DoS in Mastodon API user search due to an error in match clauses, leading to an infinite recursion and subsequent OOM with certain inputs.
|
||||||
|
- Fix metadata leak for accounts and statuses on private instances.
|
||||||
|
- Fix possible DoS in Admin API search using an atom leak vulnerability. Authentication with admin rights was required to exploit.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **Breaking:** The metadata providers RelMe and Feed are no longer configurable. RelMe should always be activated and Feed only provides a <link> header tag for the actual RSS/Atom feed when the instance is public.
|
||||||
|
- Improved error message when cmake is not available at build stage.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- Rich media failure tracking (along with `:failure_backoff` option).
|
||||||
- Rich media failure tracking (along with `:failure_backoff` option)
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Default HTTP adapter not respecting pool setting, leading to possible OOM.
|
||||||
- Possible OOM errors with the default HTTP adapter
|
- Fixed uploading webp images when the Exiftool Upload Filter is enabled by skipping them
|
||||||
- Mastodon API: Search parameter `following` now correctly returns the followings rather than the followers
|
- Mastodon API: Search parameter `following` now correctly returns the followings rather than the followers
|
||||||
- Mastodon API: Timelines hanging for (`number of posts with links * rich media timeout`) in the worst case.
|
- Mastodon API: Timelines hanging for (`number of posts with links * rich media timeout`) in the worst case.
|
||||||
Reduced to just rich media timeout.
|
Reduced to just rich media timeout.
|
||||||
- Mastodon API: Cards being wrong for preview statuses due to cache key collision
|
- Mastodon API: Cards being wrong for preview statuses due to cache key collision.
|
||||||
- Password resets no longer processed for deactivated accounts
|
- Password resets no longer processed for deactivated accounts.
|
||||||
|
- Favicon scraper raising exceptions on URLs longer than 255 characters.
|
||||||
|
|
||||||
## [2.1.0] - 2020-08-28
|
## [2.1.0] - 2020-08-28
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ Currently, Pleroma offers bugfixes and security patches only for the latest mino
|
||||||
|
|
||||||
| Version | Support
|
| Version | Support
|
||||||
|---------| --------
|
|---------| --------
|
||||||
| 2.0 | Bugfixes and security patches
|
| 2.1 | Bugfixes and security patches
|
||||||
|
|
||||||
## Reporting a vulnerability
|
## Reporting a vulnerability
|
||||||
|
|
||||||
|
|
|
@ -454,9 +454,7 @@ config :pleroma, :gopher,
|
||||||
config :pleroma, Pleroma.Web.Metadata,
|
config :pleroma, Pleroma.Web.Metadata,
|
||||||
providers: [
|
providers: [
|
||||||
Pleroma.Web.Metadata.Providers.OpenGraph,
|
Pleroma.Web.Metadata.Providers.OpenGraph,
|
||||||
Pleroma.Web.Metadata.Providers.TwitterCard,
|
Pleroma.Web.Metadata.Providers.TwitterCard
|
||||||
Pleroma.Web.Metadata.Providers.RelMe,
|
|
||||||
Pleroma.Web.Metadata.Providers.Feed
|
|
||||||
],
|
],
|
||||||
unfurl_nsfw: false
|
unfurl_nsfw: false
|
||||||
|
|
||||||
|
@ -532,6 +530,7 @@ config :pleroma, Oban,
|
||||||
log: false,
|
log: false,
|
||||||
queues: [
|
queues: [
|
||||||
activity_expiration: 10,
|
activity_expiration: 10,
|
||||||
|
token_expiration: 5,
|
||||||
federator_incoming: 50,
|
federator_incoming: 50,
|
||||||
federator_outgoing: 50,
|
federator_outgoing: 50,
|
||||||
web_push: 50,
|
web_push: 50,
|
||||||
|
@ -546,8 +545,6 @@ config :pleroma, Oban,
|
||||||
],
|
],
|
||||||
plugins: [Oban.Plugins.Pruner],
|
plugins: [Oban.Plugins.Pruner],
|
||||||
crontab: [
|
crontab: [
|
||||||
{"0 0 * * *", Pleroma.Workers.Cron.ClearOauthTokenWorker},
|
|
||||||
{"* * * * *", Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker},
|
|
||||||
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
|
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
|
||||||
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}
|
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}
|
||||||
]
|
]
|
||||||
|
@ -658,7 +655,7 @@ config :pleroma, :rate_limit,
|
||||||
account_confirmation_resend: {8_640_000, 5},
|
account_confirmation_resend: {8_640_000, 5},
|
||||||
ap_routes: {60_000, 15}
|
ap_routes: {60_000, 15}
|
||||||
|
|
||||||
config :pleroma, Pleroma.ActivityExpiration, enabled: true
|
config :pleroma, Pleroma.Workers.PurgeExpiredActivity, enabled: true, min_lifetime: 600
|
||||||
|
|
||||||
config :pleroma, Pleroma.Plugs.RemoteIp, enabled: true
|
config :pleroma, Pleroma.Plugs.RemoteIp, enabled: true
|
||||||
|
|
||||||
|
|
|
@ -2290,8 +2290,6 @@ config :pleroma, :config_description, [
|
||||||
type: {:list, :tuple},
|
type: {:list, :tuple},
|
||||||
description: "Settings for cron background jobs",
|
description: "Settings for cron background jobs",
|
||||||
suggestions: [
|
suggestions: [
|
||||||
{"0 0 * * *", Pleroma.Workers.Cron.ClearOauthTokenWorker},
|
|
||||||
{"* * * * *", Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker},
|
|
||||||
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
|
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
|
||||||
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}
|
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}
|
||||||
]
|
]
|
||||||
|
@ -2474,14 +2472,20 @@ config :pleroma, :config_description, [
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: Pleroma.ActivityExpiration,
|
key: Pleroma.Workers.PurgeExpiredActivity,
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Expired activity settings",
|
description: "Expired activities settings",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :enabled,
|
key: :enabled,
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Whether expired activities will be sent to the job queue to be deleted"
|
description: "Enables expired activities addition & deletion"
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :min_lifetime,
|
||||||
|
type: :integer,
|
||||||
|
description: "Minimum lifetime for ephemeral activity (in seconds)",
|
||||||
|
suggestions: [600]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -114,8 +114,6 @@ config :pleroma, Pleroma.Plugs.RemoteIp, enabled: false
|
||||||
|
|
||||||
config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true
|
config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true
|
||||||
|
|
||||||
config :pleroma, :instances_favicons, enabled: false
|
|
||||||
|
|
||||||
config :pleroma, Pleroma.Uploaders.S3,
|
config :pleroma, Pleroma.Uploaders.S3,
|
||||||
bucket: nil,
|
bucket: nil,
|
||||||
streaming_enabled: true,
|
streaming_enabled: true,
|
||||||
|
|
|
@ -18,7 +18,7 @@ To add configuration to your config file, you can copy it from the base config.
|
||||||
* `notify_email`: Email used for notifications.
|
* `notify_email`: Email used for notifications.
|
||||||
* `description`: The instance’s description, can be seen in nodeinfo and ``/api/v1/instance``.
|
* `description`: The instance’s description, can be seen in nodeinfo and ``/api/v1/instance``.
|
||||||
* `limit`: Posts character limit (CW/Subject included in the counter).
|
* `limit`: Posts character limit (CW/Subject included in the counter).
|
||||||
* `discription_limit`: The character limit for image descriptions.
|
* `description_limit`: The character limit for image descriptions.
|
||||||
* `chat_limit`: Character limit of the instance chat messages.
|
* `chat_limit`: Character limit of the instance chat messages.
|
||||||
* `remote_limit`: Hard character limit beyond which remote posts will be dropped.
|
* `remote_limit`: Hard character limit beyond which remote posts will be dropped.
|
||||||
* `upload_limit`: File size limit of uploads (except for avatar, background, banner).
|
* `upload_limit`: File size limit of uploads (except for avatar, background, banner).
|
||||||
|
@ -115,6 +115,7 @@ To add configuration to your config file, you can copy it from the base config.
|
||||||
* `Pleroma.Web.ActivityPub.MRF.VocabularyPolicy`: Restricts activities to a configured set of vocabulary. (See [`:mrf_vocabulary`](#mrf_vocabulary)).
|
* `Pleroma.Web.ActivityPub.MRF.VocabularyPolicy`: Restricts activities to a configured set of vocabulary. (See [`:mrf_vocabulary`](#mrf_vocabulary)).
|
||||||
* `Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy`: Rejects or delists posts based on their age when received. (See [`:mrf_object_age`](#mrf_object_age)).
|
* `Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy`: Rejects or delists posts based on their age when received. (See [`:mrf_object_age`](#mrf_object_age)).
|
||||||
* `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.ActivityExpiration` to be enabled for processing the scheduled delections.
|
* `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.ActivityExpiration` to be enabled for processing the scheduled delections.
|
||||||
|
* `Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy`: Makes all bot posts to disappear from public timelines.
|
||||||
* `transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo).
|
* `transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo).
|
||||||
* `transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value.
|
* `transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value.
|
||||||
|
|
||||||
|
@ -352,8 +353,6 @@ config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Http,
|
||||||
* `providers`: a list of metadata providers to enable. Providers available:
|
* `providers`: a list of metadata providers to enable. Providers available:
|
||||||
* `Pleroma.Web.Metadata.Providers.OpenGraph`
|
* `Pleroma.Web.Metadata.Providers.OpenGraph`
|
||||||
* `Pleroma.Web.Metadata.Providers.TwitterCard`
|
* `Pleroma.Web.Metadata.Providers.TwitterCard`
|
||||||
* `Pleroma.Web.Metadata.Providers.RelMe` - add links from user bio with rel=me into the `<header>` as `<link rel=me>`.
|
|
||||||
* `Pleroma.Web.Metadata.Providers.Feed` - add a link to a user's Atom feed into the `<header>` as `<link rel=alternate>`.
|
|
||||||
* `unfurl_nsfw`: If set to `true` nsfw attachments will be shown in previews.
|
* `unfurl_nsfw`: If set to `true` nsfw attachments will be shown in previews.
|
||||||
|
|
||||||
### :rich_media (consumer)
|
### :rich_media (consumer)
|
||||||
|
@ -692,9 +691,8 @@ Pleroma has the following queues:
|
||||||
|
|
||||||
Pleroma has these periodic job workers:
|
Pleroma has these periodic job workers:
|
||||||
|
|
||||||
`Pleroma.Workers.Cron.ClearOauthTokenWorker` - a job worker to cleanup expired oauth tokens.
|
* `Pleroma.Workers.Cron.DigestEmailsWorker` - digest emails for users with new mentions and follows
|
||||||
|
* `Pleroma.Workers.Cron.NewUsersDigestWorker` - digest emails for admins with new registrations
|
||||||
Example:
|
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
config :pleroma, Oban,
|
config :pleroma, Oban,
|
||||||
|
@ -706,7 +704,8 @@ config :pleroma, Oban,
|
||||||
federator_outgoing: 50
|
federator_outgoing: 50
|
||||||
],
|
],
|
||||||
crontab: [
|
crontab: [
|
||||||
{"0 0 * * *", Pleroma.Workers.Cron.ClearOauthTokenWorker}
|
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
|
||||||
|
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -973,7 +972,7 @@ Configure OAuth 2 provider capabilities:
|
||||||
|
|
||||||
* `token_expires_in` - The lifetime in seconds of the access token.
|
* `token_expires_in` - The lifetime in seconds of the access token.
|
||||||
* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token.
|
* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token.
|
||||||
* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`. Interval settings sets in configuration periodic jobs [`Oban.Cron`](#obancron)
|
* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`.
|
||||||
|
|
||||||
## Link parsing
|
## Link parsing
|
||||||
|
|
||||||
|
@ -1092,3 +1091,10 @@ config :pleroma, :frontends,
|
||||||
```
|
```
|
||||||
|
|
||||||
This would serve the frontend from the the folder at `$instance_static/frontends/pleroma/stable`. You have to copy the frontend into this folder yourself. You can choose the name and ref any way you like, but they will be used by mix tasks to automate installation in the future, the name referring to the project and the ref referring to a commit.
|
This would serve the frontend from the the folder at `$instance_static/frontends/pleroma/stable`. You have to copy the frontend into this folder yourself. You can choose the name and ref any way you like, but they will be used by mix tasks to automate installation in the future, the name referring to the project and the ref referring to a commit.
|
||||||
|
|
||||||
|
## Ephemeral activities (Pleroma.Workers.PurgeExpiredActivity)
|
||||||
|
|
||||||
|
Settings to enable and configure expiration for ephemeral activities
|
||||||
|
|
||||||
|
* `:enabled` - enables ephemeral activities creation
|
||||||
|
* `:min_lifetime` - minimum lifetime for ephemeral activities (in seconds). Default: 10 minutes.
|
||||||
|
|
|
@ -133,8 +133,7 @@ defmodule Mix.Tasks.Pleroma.Database do
|
||||||
days = Pleroma.Config.get([:mrf_activity_expiration, :days], 365)
|
days = Pleroma.Config.get([:mrf_activity_expiration, :days], 365)
|
||||||
|
|
||||||
Pleroma.Activity
|
Pleroma.Activity
|
||||||
|> join(:left, [a], u in assoc(a, :expiration))
|
|> join(:inner, [a], o in Object,
|
||||||
|> join(:inner, [a, _u], o in Object,
|
|
||||||
on:
|
on:
|
||||||
fragment(
|
fragment(
|
||||||
"(?->>'id') = COALESCE((?)->'object'->> 'id', (?)->>'object')",
|
"(?->>'id') = COALESCE((?)->'object'->> 'id', (?)->>'object')",
|
||||||
|
@ -144,14 +143,20 @@ defmodule Mix.Tasks.Pleroma.Database do
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|> where(local: true)
|
|> where(local: true)
|
||||||
|> where([a, u], is_nil(u))
|
|
||||||
|> where([a], fragment("(? ->> 'type'::text) = 'Create'", a.data))
|
|> where([a], fragment("(? ->> 'type'::text) = 'Create'", a.data))
|
||||||
|> where([_a, _u, o], fragment("?->>'type' = 'Note'", o.data))
|
|> where([_a, o], fragment("?->>'type' = 'Note'", o.data))
|
||||||
|> Pleroma.RepoStreamer.chunk_stream(100)
|
|> Pleroma.RepoStreamer.chunk_stream(100)
|
||||||
|> Stream.each(fn activities ->
|
|> Stream.each(fn activities ->
|
||||||
Enum.each(activities, fn activity ->
|
Enum.each(activities, fn activity ->
|
||||||
expires_at = Timex.shift(activity.inserted_at, days: days)
|
expires_at =
|
||||||
Pleroma.ActivityExpiration.create(activity, expires_at, false)
|
activity.inserted_at
|
||||||
|
|> DateTime.from_naive!("Etc/UTC")
|
||||||
|
|> Timex.shift(days: days)
|
||||||
|
|
||||||
|
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
||||||
|
activity_id: activity.id,
|
||||||
|
expires_at: expires_at
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
|
|
|
@ -183,7 +183,7 @@ defmodule Mix.Tasks.Pleroma.Emoji do
|
||||||
|
|
||||||
IO.puts("Downloading the pack and generating SHA256")
|
IO.puts("Downloading the pack and generating SHA256")
|
||||||
|
|
||||||
binary_archive = Tesla.get!(client(), src).body
|
{:ok, %{body: binary_archive}} = Pleroma.HTTP.get(src)
|
||||||
archive_sha = :crypto.hash(:sha256, binary_archive) |> Base.encode16()
|
archive_sha = :crypto.hash(:sha256, binary_archive) |> Base.encode16()
|
||||||
|
|
||||||
IO.puts("SHA256 is #{archive_sha}")
|
IO.puts("SHA256 is #{archive_sha}")
|
||||||
|
@ -252,7 +252,7 @@ defmodule Mix.Tasks.Pleroma.Emoji do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp fetch("http" <> _ = from) do
|
defp fetch("http" <> _ = from) do
|
||||||
with {:ok, %{body: body}} <- Tesla.get(client(), from) do
|
with {:ok, %{body: body}} <- Pleroma.HTTP.get(from) do
|
||||||
{:ok, body}
|
{:ok, body}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -271,13 +271,5 @@ defmodule Mix.Tasks.Pleroma.Emoji do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp client do
|
|
||||||
middleware = [
|
|
||||||
{Tesla.Middleware.FollowRedirects, [max_redirects: 3]}
|
|
||||||
]
|
|
||||||
|
|
||||||
Tesla.client(middleware)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp default_manifest, do: Pleroma.Config.get!([:emoji, :default_manifest])
|
defp default_manifest, do: Pleroma.Config.get!([:emoji, :default_manifest])
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,6 @@ defmodule Pleroma.Activity do
|
||||||
|
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.Activity.Queries
|
alias Pleroma.Activity.Queries
|
||||||
alias Pleroma.ActivityExpiration
|
|
||||||
alias Pleroma.Bookmark
|
alias Pleroma.Bookmark
|
||||||
alias Pleroma.Notification
|
alias Pleroma.Notification
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
|
@ -60,8 +59,6 @@ defmodule Pleroma.Activity do
|
||||||
# typical case.
|
# typical case.
|
||||||
has_one(:object, Object, on_delete: :nothing, foreign_key: :id)
|
has_one(:object, Object, on_delete: :nothing, foreign_key: :id)
|
||||||
|
|
||||||
has_one(:expiration, ActivityExpiration, on_delete: :delete_all)
|
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -304,14 +301,14 @@ defmodule Pleroma.Activity do
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
def follow_requests_for_actor(%Pleroma.User{ap_id: ap_id}) do
|
def follow_requests_for_actor(%User{ap_id: ap_id}) do
|
||||||
ap_id
|
ap_id
|
||||||
|> Queries.by_object_id()
|
|> Queries.by_object_id()
|
||||||
|> Queries.by_type("Follow")
|
|> Queries.by_type("Follow")
|
||||||
|> where([a], fragment("? ->> 'state' = 'pending'", a.data))
|
|> where([a], fragment("? ->> 'state' = 'pending'", a.data))
|
||||||
end
|
end
|
||||||
|
|
||||||
def following_requests_for_actor(%Pleroma.User{ap_id: ap_id}) do
|
def following_requests_for_actor(%User{ap_id: ap_id}) do
|
||||||
Queries.by_type("Follow")
|
Queries.by_type("Follow")
|
||||||
|> where([a], fragment("?->>'state' = 'pending'", a.data))
|
|> where([a], fragment("?->>'state' = 'pending'", a.data))
|
||||||
|> where([a], a.actor == ^ap_id)
|
|> where([a], a.actor == ^ap_id)
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
defmodule Pleroma.ActivityExpiration do
|
|
||||||
use Ecto.Schema
|
|
||||||
|
|
||||||
alias Pleroma.Activity
|
|
||||||
alias Pleroma.ActivityExpiration
|
|
||||||
alias Pleroma.Repo
|
|
||||||
|
|
||||||
import Ecto.Changeset
|
|
||||||
import Ecto.Query
|
|
||||||
|
|
||||||
@type t :: %__MODULE__{}
|
|
||||||
@min_activity_lifetime :timer.hours(1)
|
|
||||||
|
|
||||||
schema "activity_expirations" do
|
|
||||||
belongs_to(:activity, Activity, type: FlakeId.Ecto.CompatType)
|
|
||||||
field(:scheduled_at, :naive_datetime)
|
|
||||||
end
|
|
||||||
|
|
||||||
def changeset(%ActivityExpiration{} = expiration, attrs, validate_scheduled_at) do
|
|
||||||
expiration
|
|
||||||
|> cast(attrs, [:scheduled_at])
|
|
||||||
|> validate_required([:scheduled_at])
|
|
||||||
|> validate_scheduled_at(validate_scheduled_at)
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_by_activity_id(activity_id) do
|
|
||||||
ActivityExpiration
|
|
||||||
|> where([exp], exp.activity_id == ^activity_id)
|
|
||||||
|> Repo.one()
|
|
||||||
end
|
|
||||||
|
|
||||||
def create(%Activity{} = activity, scheduled_at, validate_scheduled_at \\ true) do
|
|
||||||
%ActivityExpiration{activity_id: activity.id}
|
|
||||||
|> changeset(%{scheduled_at: scheduled_at}, validate_scheduled_at)
|
|
||||||
|> Repo.insert()
|
|
||||||
end
|
|
||||||
|
|
||||||
def due_expirations(offset \\ 0) do
|
|
||||||
naive_datetime =
|
|
||||||
NaiveDateTime.utc_now()
|
|
||||||
|> NaiveDateTime.add(offset, :millisecond)
|
|
||||||
|
|
||||||
ActivityExpiration
|
|
||||||
|> where([exp], exp.scheduled_at < ^naive_datetime)
|
|
||||||
|> limit(50)
|
|
||||||
|> preload(:activity)
|
|
||||||
|> Repo.all()
|
|
||||||
|> Enum.reject(fn %{activity: activity} ->
|
|
||||||
Activity.pinned_by_actor?(activity)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
def validate_scheduled_at(changeset, false), do: changeset
|
|
||||||
|
|
||||||
def validate_scheduled_at(changeset, true) do
|
|
||||||
validate_change(changeset, :scheduled_at, fn _, scheduled_at ->
|
|
||||||
if not expires_late_enough?(scheduled_at) do
|
|
||||||
[scheduled_at: "an ephemeral activity must live for at least one hour"]
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
def expires_late_enough?(scheduled_at) do
|
|
||||||
now = NaiveDateTime.utc_now()
|
|
||||||
diff = NaiveDateTime.diff(scheduled_at, now, :millisecond)
|
|
||||||
diff > @min_activity_lifetime
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -8,7 +8,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||||
require Logger
|
require Logger
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
|
|
||||||
@type config_namespace() :: [atom()]
|
@type config_namespace() :: atom() | [atom()]
|
||||||
@type config_map() :: {config_namespace(), config_namespace(), String.t()}
|
@type config_map() :: {config_namespace(), config_namespace(), String.t()}
|
||||||
|
|
||||||
@mrf_config_map [
|
@mrf_config_map [
|
||||||
|
@ -57,6 +57,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||||
check_media_proxy_whitelist_config()
|
check_media_proxy_whitelist_config()
|
||||||
check_welcome_message_config()
|
check_welcome_message_config()
|
||||||
check_gun_pool_options()
|
check_gun_pool_options()
|
||||||
|
check_activity_expiration_config()
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_welcome_message_config do
|
def check_welcome_message_config do
|
||||||
|
@ -158,4 +159,20 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||||
Config.put(:pools, updated_config)
|
Config.put(:pools, updated_config)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec check_activity_expiration_config() :: :ok | nil
|
||||||
|
def check_activity_expiration_config do
|
||||||
|
warning_preface = """
|
||||||
|
!!!DEPRECATION WARNING!!!
|
||||||
|
Your config is using old namespace for activity expiration configuration. Setting should work for now, but you are advised to change to new namespace to prevent possible issues later:
|
||||||
|
"""
|
||||||
|
|
||||||
|
move_namespace_and_warn(
|
||||||
|
[
|
||||||
|
{Pleroma.ActivityExpiration, Pleroma.Workers.PurgeExpiredActivity,
|
||||||
|
"\n* `config :pleroma, Pleroma.ActivityExpiration` is now `config :pleroma, Pleroma.Workers.PurgeExpiredActivity`"}
|
||||||
|
],
|
||||||
|
warning_preface
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,11 @@ defmodule Pleroma.Config.Oban do
|
||||||
oban_config = Pleroma.Config.get(Oban)
|
oban_config = Pleroma.Config.get(Oban)
|
||||||
|
|
||||||
crontab =
|
crontab =
|
||||||
[Pleroma.Workers.Cron.StatsWorker]
|
[
|
||||||
|
Pleroma.Workers.Cron.StatsWorker,
|
||||||
|
Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker,
|
||||||
|
Pleroma.Workers.Cron.ClearOauthTokenWorker
|
||||||
|
]
|
||||||
|> Enum.reduce(oban_config[:crontab], fn removed_worker, acc ->
|
|> Enum.reduce(oban_config[:crontab], fn removed_worker, acc ->
|
||||||
with acc when is_list(acc) <- acc,
|
with acc when is_list(acc) <- acc,
|
||||||
setting when is_tuple(setting) <-
|
setting when is_tuple(setting) <-
|
||||||
|
|
|
@ -50,10 +50,10 @@ defmodule Pleroma.Gun.Conn do
|
||||||
|
|
||||||
with open_opts <- Map.delete(opts, :tls_opts),
|
with open_opts <- Map.delete(opts, :tls_opts),
|
||||||
{:ok, conn} <- Gun.open(proxy_host, proxy_port, open_opts),
|
{:ok, conn} <- Gun.open(proxy_host, proxy_port, open_opts),
|
||||||
{:ok, _} <- Gun.await_up(conn, opts[:connect_timeout]),
|
{:ok, protocol} <- Gun.await_up(conn, opts[:connect_timeout]),
|
||||||
stream <- Gun.connect(conn, connect_opts),
|
stream <- Gun.connect(conn, connect_opts),
|
||||||
{:response, :fin, 200, _} <- Gun.await(conn, stream) do
|
{:response, :fin, 200, _} <- Gun.await(conn, stream) do
|
||||||
{:ok, conn}
|
{:ok, conn, protocol}
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
|
@ -88,8 +88,8 @@ defmodule Pleroma.Gun.Conn do
|
||||||
|> Map.put(:socks_opts, socks_opts)
|
|> Map.put(:socks_opts, socks_opts)
|
||||||
|
|
||||||
with {:ok, conn} <- Gun.open(proxy_host, proxy_port, opts),
|
with {:ok, conn} <- Gun.open(proxy_host, proxy_port, opts),
|
||||||
{:ok, _} <- Gun.await_up(conn, opts[:connect_timeout]) do
|
{:ok, protocol} <- Gun.await_up(conn, opts[:connect_timeout]) do
|
||||||
{:ok, conn}
|
{:ok, conn, protocol}
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
|
@ -106,8 +106,8 @@ defmodule Pleroma.Gun.Conn do
|
||||||
host = Pleroma.HTTP.AdapterHelper.parse_host(host)
|
host = Pleroma.HTTP.AdapterHelper.parse_host(host)
|
||||||
|
|
||||||
with {:ok, conn} <- Gun.open(host, port, opts),
|
with {:ok, conn} <- Gun.open(host, port, opts),
|
||||||
{:ok, _} <- Gun.await_up(conn, opts[:connect_timeout]) do
|
{:ok, protocol} <- Gun.await_up(conn, opts[:connect_timeout]) do
|
||||||
{:ok, conn}
|
{:ok, conn, protocol}
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
|
|
|
@ -15,7 +15,7 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_continue({:connect, [key, uri, opts, client_pid]}, _) do
|
def handle_continue({:connect, [key, uri, opts, client_pid]}, _) do
|
||||||
with {:ok, conn_pid} <- Gun.Conn.open(uri, opts),
|
with {:ok, conn_pid, protocol} <- Gun.Conn.open(uri, opts),
|
||||||
Process.link(conn_pid) do
|
Process.link(conn_pid) do
|
||||||
time = :erlang.monotonic_time(:millisecond)
|
time = :erlang.monotonic_time(:millisecond)
|
||||||
|
|
||||||
|
@ -27,8 +27,12 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
|
||||||
send(client_pid, {:conn_pid, conn_pid})
|
send(client_pid, {:conn_pid, conn_pid})
|
||||||
|
|
||||||
{:noreply,
|
{:noreply,
|
||||||
%{key: key, timer: nil, client_monitors: %{client_pid => Process.monitor(client_pid)}},
|
%{
|
||||||
:hibernate}
|
key: key,
|
||||||
|
timer: nil,
|
||||||
|
client_monitors: %{client_pid => Process.monitor(client_pid)},
|
||||||
|
protocol: protocol
|
||||||
|
}, :hibernate}
|
||||||
else
|
else
|
||||||
err ->
|
err ->
|
||||||
{:stop, {:shutdown, err}, nil}
|
{:stop, {:shutdown, err}, nil}
|
||||||
|
@ -53,14 +57,20 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def handle_call(:add_client, {client_pid, _}, %{key: key} = state) do
|
def handle_call(:add_client, {client_pid, _}, %{key: key, protocol: protocol} = state) do
|
||||||
time = :erlang.monotonic_time(:millisecond)
|
time = :erlang.monotonic_time(:millisecond)
|
||||||
|
|
||||||
{{conn_pid, _, _, _}, _} =
|
{{conn_pid, used_by, _, _}, _} =
|
||||||
Registry.update_value(@registry, key, fn {conn_pid, used_by, crf, last_reference} ->
|
Registry.update_value(@registry, key, fn {conn_pid, used_by, crf, last_reference} ->
|
||||||
{conn_pid, [client_pid | used_by], crf(time - last_reference, crf), time}
|
{conn_pid, [client_pid | used_by], crf(time - last_reference, crf), time}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
:telemetry.execute(
|
||||||
|
[:pleroma, :connection_pool, :client, :add],
|
||||||
|
%{client_pid: client_pid, clients: used_by},
|
||||||
|
%{key: state.key, protocol: protocol}
|
||||||
|
)
|
||||||
|
|
||||||
state =
|
state =
|
||||||
if state.timer != nil do
|
if state.timer != nil do
|
||||||
Process.cancel_timer(state[:timer])
|
Process.cancel_timer(state[:timer])
|
||||||
|
@ -131,7 +141,7 @@ defmodule Pleroma.Gun.ConnectionPool.Worker do
|
||||||
@impl true
|
@impl true
|
||||||
def handle_info({:DOWN, _ref, :process, pid, reason}, state) do
|
def handle_info({:DOWN, _ref, :process, pid, reason}, state) do
|
||||||
:telemetry.execute(
|
:telemetry.execute(
|
||||||
[:pleroma, :connection_pool, :client_death],
|
[:pleroma, :connection_pool, :client, :dead],
|
||||||
%{client_pid: pid, reason: reason},
|
%{client_pid: pid, reason: reason},
|
||||||
%{key: state.key}
|
%{key: state.key}
|
||||||
)
|
)
|
||||||
|
|
|
@ -159,13 +159,11 @@ defmodule Pleroma.Instances.Instance do
|
||||||
Pleroma.HTTP.get(to_string(instance_uri), [{"accept", "text/html"}],
|
Pleroma.HTTP.get(to_string(instance_uri), [{"accept", "text/html"}],
|
||||||
adapter: [pool: :media]
|
adapter: [pool: :media]
|
||||||
),
|
),
|
||||||
favicon_rel <-
|
{_, [favicon_rel | _]} when is_binary(favicon_rel) <-
|
||||||
html
|
{:parse,
|
||||||
|> Floki.parse_document!()
|
html |> Floki.parse_document!() |> Floki.attribute("link[rel=icon]", "href")},
|
||||||
|> Floki.attribute("link[rel=icon]", "href")
|
{_, favicon} when is_binary(favicon) <-
|
||||||
|> List.first(),
|
{:merge, URI.merge(instance_uri, favicon_rel) |> to_string()} do
|
||||||
favicon <- URI.merge(instance_uri, favicon_rel) |> to_string(),
|
|
||||||
true <- is_binary(favicon) do
|
|
||||||
favicon
|
favicon
|
||||||
else
|
else
|
||||||
_ -> nil
|
_ -> nil
|
||||||
|
|
|
@ -10,10 +10,11 @@ defmodule Pleroma.MFA.Token do
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.OAuth.Authorization
|
alias Pleroma.Web.OAuth.Authorization
|
||||||
alias Pleroma.Web.OAuth.Token, as: OAuthToken
|
|
||||||
|
|
||||||
@expires 300
|
@expires 300
|
||||||
|
|
||||||
|
@type t() :: %__MODULE__{}
|
||||||
|
|
||||||
schema "mfa_tokens" do
|
schema "mfa_tokens" do
|
||||||
field(:token, :string)
|
field(:token, :string)
|
||||||
field(:valid_until, :naive_datetime_usec)
|
field(:valid_until, :naive_datetime_usec)
|
||||||
|
@ -24,6 +25,7 @@ defmodule Pleroma.MFA.Token do
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec get_by_token(String.t()) :: {:ok, t()} | {:error, :not_found}
|
||||||
def get_by_token(token) do
|
def get_by_token(token) do
|
||||||
from(
|
from(
|
||||||
t in __MODULE__,
|
t in __MODULE__,
|
||||||
|
@ -33,33 +35,40 @@ defmodule Pleroma.MFA.Token do
|
||||||
|> Repo.find_resource()
|
|> Repo.find_resource()
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate(token) do
|
@spec validate(String.t()) :: {:ok, t()} | {:error, :not_found} | {:error, :expired_token}
|
||||||
with {:fetch_token, {:ok, token}} <- {:fetch_token, get_by_token(token)},
|
def validate(token_str) do
|
||||||
{:expired, false} <- {:expired, is_expired?(token)} do
|
with {:ok, token} <- get_by_token(token_str),
|
||||||
|
false <- expired?(token) do
|
||||||
{:ok, token}
|
{:ok, token}
|
||||||
else
|
|
||||||
{:expired, _} -> {:error, :expired_token}
|
|
||||||
{:fetch_token, _} -> {:error, :not_found}
|
|
||||||
error -> {:error, error}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_token(%User{} = user) do
|
defp expired?(%__MODULE__{valid_until: valid_until}) do
|
||||||
%__MODULE__{}
|
with true <- NaiveDateTime.diff(NaiveDateTime.utc_now(), valid_until) > 0 do
|
||||||
|> change
|
{:error, :expired_token}
|
||||||
|> assign_user(user)
|
end
|
||||||
|> put_token
|
|
||||||
|> put_valid_until
|
|
||||||
|> Repo.insert()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_token(user, authorization) do
|
@spec create(User.t(), Authorization.t() | nil) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
|
||||||
|
def create(user, authorization \\ nil) do
|
||||||
|
with {:ok, token} <- do_create(user, authorization) do
|
||||||
|
Pleroma.Workers.PurgeExpiredToken.enqueue(%{
|
||||||
|
token_id: token.id,
|
||||||
|
valid_until: DateTime.from_naive!(token.valid_until, "Etc/UTC"),
|
||||||
|
mod: __MODULE__
|
||||||
|
})
|
||||||
|
|
||||||
|
{:ok, token}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp do_create(user, authorization) do
|
||||||
%__MODULE__{}
|
%__MODULE__{}
|
||||||
|> change
|
|> change()
|
||||||
|> assign_user(user)
|
|> assign_user(user)
|
||||||
|> assign_authorization(authorization)
|
|> maybe_assign_authorization(authorization)
|
||||||
|> put_token
|
|> put_token()
|
||||||
|> put_valid_until
|
|> put_valid_until()
|
||||||
|> Repo.insert()
|
|> Repo.insert()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,15 +78,19 @@ defmodule Pleroma.MFA.Token do
|
||||||
|> validate_required([:user])
|
|> validate_required([:user])
|
||||||
end
|
end
|
||||||
|
|
||||||
defp assign_authorization(changeset, authorization) do
|
defp maybe_assign_authorization(changeset, %Authorization{} = authorization) do
|
||||||
changeset
|
changeset
|
||||||
|> put_assoc(:authorization, authorization)
|
|> put_assoc(:authorization, authorization)
|
||||||
|> validate_required([:authorization])
|
|> validate_required([:authorization])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp maybe_assign_authorization(changeset, _), do: changeset
|
||||||
|
|
||||||
defp put_token(changeset) do
|
defp put_token(changeset) do
|
||||||
|
token = Pleroma.Web.OAuth.Token.Utils.generate_token()
|
||||||
|
|
||||||
changeset
|
changeset
|
||||||
|> change(%{token: OAuthToken.Utils.generate_token()})
|
|> change(%{token: token})
|
||||||
|> validate_required([:token])
|
|> validate_required([:token])
|
||||||
|> unique_constraint(:token)
|
|> unique_constraint(:token)
|
||||||
end
|
end
|
||||||
|
@ -89,18 +102,4 @@ defmodule Pleroma.MFA.Token do
|
||||||
|> change(%{valid_until: expires_in})
|
|> change(%{valid_until: expires_in})
|
||||||
|> validate_required([:valid_until])
|
|> validate_required([:valid_until])
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_expired?(%__MODULE__{valid_until: valid_until}) do
|
|
||||||
NaiveDateTime.diff(NaiveDateTime.utc_now(), valid_until) > 0
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_expired?(_), do: false
|
|
||||||
|
|
||||||
def delete_expired_tokens do
|
|
||||||
from(
|
|
||||||
q in __MODULE__,
|
|
||||||
where: fragment("?", q.valid_until) < ^Timex.now()
|
|
||||||
)
|
|
||||||
|> Repo.delete_all()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,13 +44,6 @@ defmodule Pleroma.Object.Containment do
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: We explicitly allow 'tag' URIs through, due to references to legacy OStatus
|
|
||||||
# objects being present in the test suite environment. Once these objects are
|
|
||||||
# removed, please also remove this.
|
|
||||||
if Mix.env() == :test do
|
|
||||||
defp compare_uris(_, %URI{scheme: "tag"}), do: :ok
|
|
||||||
end
|
|
||||||
|
|
||||||
defp compare_uris(%URI{host: host} = _id_uri, %URI{host: host} = _other_uri), do: :ok
|
defp compare_uris(%URI{host: host} = _id_uri, %URI{host: host} = _other_uri), do: :ok
|
||||||
defp compare_uris(_id_uri, _other_uri), do: :error
|
defp compare_uris(_id_uri, _other_uri), do: :error
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
|
||||||
url,
|
url,
|
||||||
body,
|
body,
|
||||||
headers,
|
headers,
|
||||||
Keyword.put(opts, :adapter, opts)
|
opts
|
||||||
) do
|
) do
|
||||||
if is_map(response.body) and method != :head do
|
if is_map(response.body) and method != :head do
|
||||||
{:ok, response.status, response.headers, response.body}
|
{:ok, response.status, response.headers, response.body}
|
||||||
|
|
|
@ -23,6 +23,7 @@ defmodule Pleroma.Stats do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def init(_args) do
|
def init(_args) do
|
||||||
|
if Pleroma.Config.get(:env) == :test, do: :ok = Ecto.Adapters.SQL.Sandbox.checkout(Repo)
|
||||||
{:ok, nil, {:continue, :calculate_stats}}
|
{:ok, nil, {:continue, :calculate_stats}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ defmodule Pleroma.Telemetry.Logger do
|
||||||
[:pleroma, :connection_pool, :reclaim, :start],
|
[:pleroma, :connection_pool, :reclaim, :start],
|
||||||
[:pleroma, :connection_pool, :reclaim, :stop],
|
[:pleroma, :connection_pool, :reclaim, :stop],
|
||||||
[:pleroma, :connection_pool, :provision_failure],
|
[:pleroma, :connection_pool, :provision_failure],
|
||||||
[:pleroma, :connection_pool, :client_death]
|
[:pleroma, :connection_pool, :client, :dead],
|
||||||
|
[:pleroma, :connection_pool, :client, :add]
|
||||||
]
|
]
|
||||||
def attach do
|
def attach do
|
||||||
:telemetry.attach_many("pleroma-logger", @events, &handle_event/4, [])
|
:telemetry.attach_many("pleroma-logger", @events, &handle_event/4, [])
|
||||||
|
@ -62,7 +63,7 @@ defmodule Pleroma.Telemetry.Logger do
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_event(
|
def handle_event(
|
||||||
[:pleroma, :connection_pool, :client_death],
|
[:pleroma, :connection_pool, :client, :dead],
|
||||||
%{client_pid: client_pid, reason: reason},
|
%{client_pid: client_pid, reason: reason},
|
||||||
%{key: key},
|
%{key: key},
|
||||||
_
|
_
|
||||||
|
@ -73,4 +74,17 @@ defmodule Pleroma.Telemetry.Logger do
|
||||||
}"
|
}"
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_event(
|
||||||
|
[:pleroma, :connection_pool, :client, :add],
|
||||||
|
%{clients: [_, _ | _] = clients},
|
||||||
|
%{key: key, protocol: :http},
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
Logger.info(fn ->
|
||||||
|
"Pool worker for #{key}: #{length(clients)} clients are using an HTTP1 connection at the same time, head-of-line blocking might occur."
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event([:pleroma, :connection_pool, :client, :add], _, _, _), do: :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,11 @@ defmodule Pleroma.Upload.Filter do
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@callback filter(Pleroma.Upload.t()) :: :ok | {:ok, Pleroma.Upload.t()} | {:error, any()}
|
@callback filter(Pleroma.Upload.t()) ::
|
||||||
|
{:ok, :filtered}
|
||||||
|
| {:ok, :noop}
|
||||||
|
| {:ok, :filtered, Pleroma.Upload.t()}
|
||||||
|
| {:error, any()}
|
||||||
|
|
||||||
@spec filter([module()], Pleroma.Upload.t()) :: {:ok, Pleroma.Upload.t()} | {:error, any()}
|
@spec filter([module()], Pleroma.Upload.t()) :: {:ok, Pleroma.Upload.t()} | {:error, any()}
|
||||||
|
|
||||||
|
@ -25,10 +29,13 @@ defmodule Pleroma.Upload.Filter do
|
||||||
|
|
||||||
def filter([filter | rest], upload) do
|
def filter([filter | rest], upload) do
|
||||||
case filter.filter(upload) do
|
case filter.filter(upload) do
|
||||||
:ok ->
|
{:ok, :filtered} ->
|
||||||
filter(rest, upload)
|
filter(rest, upload)
|
||||||
|
|
||||||
{:ok, upload} ->
|
{:ok, :filtered, upload} ->
|
||||||
|
filter(rest, upload)
|
||||||
|
|
||||||
|
{:ok, :noop} ->
|
||||||
filter(rest, upload)
|
filter(rest, upload)
|
||||||
|
|
||||||
error ->
|
error ->
|
||||||
|
|
|
@ -16,9 +16,11 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilename do
|
||||||
def filter(%Upload{name: name} = upload) do
|
def filter(%Upload{name: name} = upload) do
|
||||||
extension = List.last(String.split(name, "."))
|
extension = List.last(String.split(name, "."))
|
||||||
name = predefined_name(extension) || random(extension)
|
name = predefined_name(extension) || random(extension)
|
||||||
{:ok, %Upload{upload | name: name}}
|
{:ok, :filtered, %Upload{upload | name: name}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def filter(_), do: {:ok, :noop}
|
||||||
|
|
||||||
@spec predefined_name(String.t()) :: String.t() | nil
|
@spec predefined_name(String.t()) :: String.t() | nil
|
||||||
defp predefined_name(extension) do
|
defp predefined_name(extension) do
|
||||||
with name when not is_nil(name) <- Config.get([__MODULE__, :text]),
|
with name when not is_nil(name) <- Config.get([__MODULE__, :text]),
|
||||||
|
|
|
@ -17,8 +17,8 @@ defmodule Pleroma.Upload.Filter.Dedupe do
|
||||||
|> Base.encode16(case: :lower)
|
|> Base.encode16(case: :lower)
|
||||||
|
|
||||||
filename = shasum <> "." <> extension
|
filename = shasum <> "." <> extension
|
||||||
{:ok, %Upload{upload | id: shasum, path: filename}}
|
{:ok, :filtered, %Upload{upload | id: shasum, path: filename}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter(_), do: :ok
|
def filter(_), do: {:ok, :noop}
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,11 +9,15 @@ defmodule Pleroma.Upload.Filter.Exiftool do
|
||||||
"""
|
"""
|
||||||
@behaviour Pleroma.Upload.Filter
|
@behaviour Pleroma.Upload.Filter
|
||||||
|
|
||||||
@spec filter(Pleroma.Upload.t()) :: :ok | {:error, String.t()}
|
@spec filter(Pleroma.Upload.t()) :: {:ok, any()} | {:error, String.t()}
|
||||||
|
|
||||||
|
# webp is not compatible with exiftool at this time
|
||||||
|
def filter(%Pleroma.Upload{content_type: "image/webp"}), do: {:ok, :noop}
|
||||||
|
|
||||||
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
||||||
try do
|
try do
|
||||||
case System.cmd("exiftool", ["-overwrite_original", "-gps:all=", file], parallelism: true) do
|
case System.cmd("exiftool", ["-overwrite_original", "-gps:all=", file], parallelism: true) do
|
||||||
{_response, 0} -> :ok
|
{_response, 0} -> {:ok, :filtered}
|
||||||
{error, 1} -> {:error, error}
|
{error, 1} -> {:error, error}
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
|
@ -22,5 +26,5 @@ defmodule Pleroma.Upload.Filter.Exiftool do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter(_), do: :ok
|
def filter(_), do: {:ok, :noop}
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,16 +38,16 @@ defmodule Pleroma.Upload.Filter.Mogrifun do
|
||||||
[{"fill", "yellow"}, {"tint", "40"}]
|
[{"fill", "yellow"}, {"tint", "40"}]
|
||||||
]
|
]
|
||||||
|
|
||||||
@spec filter(Pleroma.Upload.t()) :: :ok | {:error, String.t()}
|
@spec filter(Pleroma.Upload.t()) :: {:ok, atom()} | {:error, String.t()}
|
||||||
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
||||||
try do
|
try do
|
||||||
Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
|
Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
|
||||||
:ok
|
{:ok, :filtered}
|
||||||
rescue
|
rescue
|
||||||
_e in ErlangError ->
|
_e in ErlangError ->
|
||||||
{:error, "mogrify command not found"}
|
{:error, "mogrify command not found"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter(_), do: :ok
|
def filter(_), do: {:ok, :noop}
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,18 +8,18 @@ defmodule Pleroma.Upload.Filter.Mogrify do
|
||||||
@type conversion :: action :: String.t() | {action :: String.t(), opts :: String.t()}
|
@type conversion :: action :: String.t() | {action :: String.t(), opts :: String.t()}
|
||||||
@type conversions :: conversion() | [conversion()]
|
@type conversions :: conversion() | [conversion()]
|
||||||
|
|
||||||
@spec filter(Pleroma.Upload.t()) :: :ok | {:error, String.t()}
|
@spec filter(Pleroma.Upload.t()) :: {:ok, :atom} | {:error, String.t()}
|
||||||
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
||||||
try do
|
try do
|
||||||
do_filter(file, Pleroma.Config.get!([__MODULE__, :args]))
|
do_filter(file, Pleroma.Config.get!([__MODULE__, :args]))
|
||||||
:ok
|
{:ok, :filtered}
|
||||||
rescue
|
rescue
|
||||||
_e in ErlangError ->
|
_e in ErlangError ->
|
||||||
{:error, "mogrify command not found"}
|
{:error, "mogrify command not found"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter(_), do: :ok
|
def filter(_), do: {:ok, :noop}
|
||||||
|
|
||||||
def do_filter(file, filters) do
|
def do_filter(file, filters) do
|
||||||
file
|
file
|
||||||
|
|
|
@ -1125,31 +1125,31 @@ defmodule Pleroma.User do
|
||||||
User.Query.build(%{followers: user, deactivated: false})
|
User.Query.build(%{followers: user, deactivated: false})
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_followers_query(user, page) do
|
def get_followers_query(%User{} = user, page) do
|
||||||
user
|
user
|
||||||
|> get_followers_query(nil)
|
|> get_followers_query(nil)
|
||||||
|> User.Query.paginate(page, 20)
|
|> User.Query.paginate(page, 20)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec get_followers_query(User.t()) :: Ecto.Query.t()
|
@spec get_followers_query(User.t()) :: Ecto.Query.t()
|
||||||
def get_followers_query(user), do: get_followers_query(user, nil)
|
def get_followers_query(%User{} = user), do: get_followers_query(user, nil)
|
||||||
|
|
||||||
@spec get_followers(User.t(), pos_integer() | nil) :: {:ok, list(User.t())}
|
@spec get_followers(User.t(), pos_integer() | nil) :: {:ok, list(User.t())}
|
||||||
def get_followers(user, page \\ nil) do
|
def get_followers(%User{} = user, page \\ nil) do
|
||||||
user
|
user
|
||||||
|> get_followers_query(page)
|
|> get_followers_query(page)
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec get_external_followers(User.t(), pos_integer() | nil) :: {:ok, list(User.t())}
|
@spec get_external_followers(User.t(), pos_integer() | nil) :: {:ok, list(User.t())}
|
||||||
def get_external_followers(user, page \\ nil) do
|
def get_external_followers(%User{} = user, page \\ nil) do
|
||||||
user
|
user
|
||||||
|> get_followers_query(page)
|
|> get_followers_query(page)
|
||||||
|> User.Query.build(%{external: true})
|
|> User.Query.build(%{external: true})
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_followers_ids(user, page \\ nil) do
|
def get_followers_ids(%User{} = user, page \\ nil) do
|
||||||
user
|
user
|
||||||
|> get_followers_query(page)
|
|> get_followers_query(page)
|
||||||
|> select([u], u.id)
|
|> select([u], u.id)
|
||||||
|
@ -1161,29 +1161,29 @@ defmodule Pleroma.User do
|
||||||
User.Query.build(%{friends: user, deactivated: false})
|
User.Query.build(%{friends: user, deactivated: false})
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_friends_query(user, page) do
|
def get_friends_query(%User{} = user, page) do
|
||||||
user
|
user
|
||||||
|> get_friends_query(nil)
|
|> get_friends_query(nil)
|
||||||
|> User.Query.paginate(page, 20)
|
|> User.Query.paginate(page, 20)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec get_friends_query(User.t()) :: Ecto.Query.t()
|
@spec get_friends_query(User.t()) :: Ecto.Query.t()
|
||||||
def get_friends_query(user), do: get_friends_query(user, nil)
|
def get_friends_query(%User{} = user), do: get_friends_query(user, nil)
|
||||||
|
|
||||||
def get_friends(user, page \\ nil) do
|
def get_friends(%User{} = user, page \\ nil) do
|
||||||
user
|
user
|
||||||
|> get_friends_query(page)
|
|> get_friends_query(page)
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_friends_ap_ids(user) do
|
def get_friends_ap_ids(%User{} = user) do
|
||||||
user
|
user
|
||||||
|> get_friends_query(nil)
|
|> get_friends_query(nil)
|
||||||
|> select([u], u.ap_id)
|
|> select([u], u.ap_id)
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_friends_ids(user, page \\ nil) do
|
def get_friends_ids(%User{} = user, page \\ nil) do
|
||||||
user
|
user
|
||||||
|> get_friends_query(page)
|
|> get_friends_query(page)
|
||||||
|> select([u], u.id)
|
|> select([u], u.id)
|
||||||
|
@ -2335,6 +2335,11 @@ defmodule Pleroma.User do
|
||||||
max_pinned_statuses = Config.get([:instance, :max_pinned_statuses], 0)
|
max_pinned_statuses = Config.get([:instance, :max_pinned_statuses], 0)
|
||||||
params = %{pinned_activities: user.pinned_activities ++ [id]}
|
params = %{pinned_activities: user.pinned_activities ++ [id]}
|
||||||
|
|
||||||
|
# if pinned activity was scheduled for deletion, we remove job
|
||||||
|
if expiration = Pleroma.Workers.PurgeExpiredActivity.get_expiration(id) do
|
||||||
|
Oban.cancel_job(expiration.id)
|
||||||
|
end
|
||||||
|
|
||||||
user
|
user
|
||||||
|> cast(params, [:pinned_activities])
|
|> cast(params, [:pinned_activities])
|
||||||
|> validate_length(:pinned_activities,
|
|> validate_length(:pinned_activities,
|
||||||
|
@ -2347,9 +2352,19 @@ defmodule Pleroma.User do
|
||||||
|> update_and_set_cache()
|
|> update_and_set_cache()
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_pinnned_activity(user, %Pleroma.Activity{id: id}) do
|
def remove_pinnned_activity(user, %Pleroma.Activity{id: id, data: data}) do
|
||||||
params = %{pinned_activities: List.delete(user.pinned_activities, id)}
|
params = %{pinned_activities: List.delete(user.pinned_activities, id)}
|
||||||
|
|
||||||
|
# if pinned activity was scheduled for deletion, we reschedule it for deletion
|
||||||
|
if data["expires_at"] do
|
||||||
|
{:ok, expires_at, _} = DateTime.from_iso8601(data["expires_at"])
|
||||||
|
|
||||||
|
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
||||||
|
activity_id: id,
|
||||||
|
expires_at: expires_at
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
user
|
user
|
||||||
|> cast(params, [:pinned_activities])
|
|> cast(params, [:pinned_activities])
|
||||||
|> update_and_set_cache()
|
|> update_and_set_cache()
|
||||||
|
|
|
@ -115,8 +115,8 @@ defmodule Pleroma.User.Search do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp base_query(_user, false), do: User
|
defp base_query(%User{} = user, true), do: User.get_friends_query(user)
|
||||||
defp base_query(user, true), do: User.get_friends_query(user)
|
defp base_query(_user, _following), do: User
|
||||||
|
|
||||||
defp filter_invisible_users(query) do
|
defp filter_invisible_users(query) do
|
||||||
from(q in query, where: q.invisible == false)
|
from(q in query, where: q.invisible == false)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.Activity.Ir.Topics
|
alias Pleroma.Activity.Ir.Topics
|
||||||
alias Pleroma.ActivityExpiration
|
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
alias Pleroma.Constants
|
alias Pleroma.Constants
|
||||||
alias Pleroma.Conversation
|
alias Pleroma.Conversation
|
||||||
|
@ -102,7 +101,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
local: local,
|
local: local,
|
||||||
recipients: recipients,
|
recipients: recipients,
|
||||||
actor: object["actor"]
|
actor: object["actor"]
|
||||||
}) do
|
}),
|
||||||
|
# TODO: add tests for expired activities, when Note type will be supported in new pipeline
|
||||||
|
{:ok, _} <- maybe_create_activity_expiration(activity) do
|
||||||
{:ok, activity, meta}
|
{:ok, activity, meta}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -111,23 +112,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
def insert(map, local \\ true, fake \\ false, bypass_actor_check \\ false) when is_map(map) do
|
def insert(map, local \\ true, fake \\ false, bypass_actor_check \\ false) when is_map(map) do
|
||||||
with nil <- Activity.normalize(map),
|
with nil <- Activity.normalize(map),
|
||||||
map <- lazy_put_activity_defaults(map, fake),
|
map <- lazy_put_activity_defaults(map, fake),
|
||||||
true <- bypass_actor_check || check_actor_is_active(map["actor"]),
|
{_, true} <- {:actor_check, bypass_actor_check || check_actor_is_active(map["actor"])},
|
||||||
{_, true} <- {:remote_limit_error, check_remote_limit(map)},
|
{_, true} <- {:remote_limit_pass, check_remote_limit(map)},
|
||||||
{:ok, map} <- MRF.filter(map),
|
{:ok, map} <- MRF.filter(map),
|
||||||
{recipients, _, _} = get_recipients(map),
|
{recipients, _, _} = get_recipients(map),
|
||||||
{:fake, false, map, recipients} <- {:fake, fake, map, recipients},
|
{:fake, false, map, recipients} <- {:fake, fake, map, recipients},
|
||||||
{:containment, :ok} <- {:containment, Containment.contain_child(map)},
|
{:containment, :ok} <- {:containment, Containment.contain_child(map)},
|
||||||
{:ok, map, object} <- insert_full_object(map) do
|
{:ok, map, object} <- insert_full_object(map),
|
||||||
{:ok, activity} =
|
{:ok, activity} <- insert_activity_with_expiration(map, local, recipients) do
|
||||||
%Activity{
|
|
||||||
data: map,
|
|
||||||
local: local,
|
|
||||||
actor: map["actor"],
|
|
||||||
recipients: recipients
|
|
||||||
}
|
|
||||||
|> Repo.insert()
|
|
||||||
|> maybe_create_activity_expiration()
|
|
||||||
|
|
||||||
# Splice in the child object if we have one.
|
# Splice in the child object if we have one.
|
||||||
activity = Maps.put_if_present(activity, :object, object)
|
activity = Maps.put_if_present(activity, :object, object)
|
||||||
|
|
||||||
|
@ -138,6 +130,15 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
%Activity{} = activity ->
|
%Activity{} = activity ->
|
||||||
{:ok, activity}
|
{:ok, activity}
|
||||||
|
|
||||||
|
{:actor_check, _} ->
|
||||||
|
{:error, false}
|
||||||
|
|
||||||
|
{:containment, _} = error ->
|
||||||
|
error
|
||||||
|
|
||||||
|
{:error, _} = error ->
|
||||||
|
error
|
||||||
|
|
||||||
{:fake, true, map, recipients} ->
|
{:fake, true, map, recipients} ->
|
||||||
activity = %Activity{
|
activity = %Activity{
|
||||||
data: map,
|
data: map,
|
||||||
|
@ -150,8 +151,24 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
|
Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
|
||||||
{:ok, activity}
|
{:ok, activity}
|
||||||
|
|
||||||
error ->
|
{:remote_limit_pass, _} ->
|
||||||
{:error, error}
|
{:error, :remote_limit}
|
||||||
|
|
||||||
|
{:reject, reason} ->
|
||||||
|
{:error, reason}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp insert_activity_with_expiration(data, local, recipients) do
|
||||||
|
struct = %Activity{
|
||||||
|
data: data,
|
||||||
|
local: local,
|
||||||
|
actor: data["actor"],
|
||||||
|
recipients: recipients
|
||||||
|
}
|
||||||
|
|
||||||
|
with {:ok, activity} <- Repo.insert(struct) do
|
||||||
|
maybe_create_activity_expiration(activity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -164,13 +181,19 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
stream_out_participations(participations)
|
stream_out_participations(participations)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_create_activity_expiration({:ok, %{data: %{"expires_at" => expires_at}} = activity}) do
|
defp maybe_create_activity_expiration(
|
||||||
with {:ok, _} <- ActivityExpiration.create(activity, expires_at) do
|
%{data: %{"expires_at" => %DateTime{} = expires_at}} = activity
|
||||||
|
) do
|
||||||
|
with {:ok, _job} <-
|
||||||
|
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
||||||
|
activity_id: activity.id,
|
||||||
|
expires_at: expires_at
|
||||||
|
}) do
|
||||||
{:ok, activity}
|
{:ok, activity}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_create_activity_expiration(result), do: result
|
defp maybe_create_activity_expiration(activity), do: {:ok, activity}
|
||||||
|
|
||||||
defp create_or_bump_conversation(activity, actor) do
|
defp create_or_bump_conversation(activity, actor) do
|
||||||
with {:ok, conversation} <- Conversation.create_or_bump_for(activity),
|
with {:ok, conversation} <- Conversation.create_or_bump_for(activity),
|
||||||
|
|
|
@ -399,10 +399,18 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
|
|
||||||
defp handle_user_activity(
|
defp handle_user_activity(
|
||||||
%User{} = user,
|
%User{} = user,
|
||||||
%{"type" => "Create", "object" => %{"type" => "Note"}} = params
|
%{"type" => "Create", "object" => %{"type" => "Note"} = object} = params
|
||||||
) do
|
) do
|
||||||
|
content = if is_binary(object["content"]), do: object["content"], else: ""
|
||||||
|
name = if is_binary(object["name"]), do: object["name"], else: ""
|
||||||
|
summary = if is_binary(object["summary"]), do: object["summary"], else: ""
|
||||||
|
length = String.length(content <> name <> summary)
|
||||||
|
|
||||||
|
if length > Pleroma.Config.get([:instance, :limit]) do
|
||||||
|
{:error, dgettext("errors", "Note is over the character limit")}
|
||||||
|
else
|
||||||
object =
|
object =
|
||||||
params["object"]
|
object
|
||||||
|> Map.merge(Map.take(params, ["to", "cc"]))
|
|> Map.merge(Map.take(params, ["to", "cc"]))
|
||||||
|> Map.put("attributedTo", user.ap_id())
|
|> Map.put("attributedTo", user.ap_id())
|
||||||
|> Transmogrifier.fix_object()
|
|> Transmogrifier.fix_object()
|
||||||
|
@ -415,6 +423,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
additional: Map.take(params, ["cc"])
|
additional: Map.take(params, ["cc"])
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp handle_user_activity(%User{} = user, %{"type" => "Delete"} = params) do
|
defp handle_user_activity(%User{} = user, %{"type" => "Delete"} = params) do
|
||||||
with %Object{} = object <- Object.normalize(params["object"]),
|
with %Object{} = object <- Object.normalize(params["object"]),
|
||||||
|
|
|
@ -31,10 +31,10 @@ defmodule Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy do
|
||||||
|
|
||||||
defp maybe_add_expiration(activity) do
|
defp maybe_add_expiration(activity) do
|
||||||
days = Pleroma.Config.get([:mrf_activity_expiration, :days], 365)
|
days = Pleroma.Config.get([:mrf_activity_expiration, :days], 365)
|
||||||
expires_at = NaiveDateTime.utc_now() |> Timex.shift(days: days)
|
expires_at = DateTime.utc_now() |> Timex.shift(days: days)
|
||||||
|
|
||||||
with %{"expires_at" => existing_expires_at} <- activity,
|
with %{"expires_at" => existing_expires_at} <- activity,
|
||||||
:lt <- NaiveDateTime.compare(existing_expires_at, expires_at) do
|
:lt <- DateTime.compare(existing_expires_at, expires_at) do
|
||||||
activity
|
activity
|
||||||
else
|
else
|
||||||
_ -> Map.put(activity, "expires_at", expires_at)
|
_ -> Map.put(activity, "expires_at", expires_at)
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy do
|
||||||
|
alias Pleroma.User
|
||||||
|
@behaviour Pleroma.Web.ActivityPub.MRF
|
||||||
|
@moduledoc "Remove bot posts from federated timeline"
|
||||||
|
|
||||||
|
require Pleroma.Constants
|
||||||
|
|
||||||
|
defp check_by_actor_type(user), do: user.actor_type in ["Application", "Service"]
|
||||||
|
defp check_by_nickname(user), do: Regex.match?(~r/bot@|ebooks@/i, user.nickname)
|
||||||
|
|
||||||
|
defp check_if_bot(user), do: check_by_actor_type(user) or check_by_nickname(user)
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def filter(
|
||||||
|
%{
|
||||||
|
"type" => "Create",
|
||||||
|
"to" => to,
|
||||||
|
"cc" => cc,
|
||||||
|
"actor" => actor,
|
||||||
|
"object" => object
|
||||||
|
} = message
|
||||||
|
) do
|
||||||
|
user = User.get_cached_by_ap_id(actor)
|
||||||
|
isbot = check_if_bot(user)
|
||||||
|
|
||||||
|
if isbot 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
|
|
@ -7,7 +7,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
||||||
"""
|
"""
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.Activity.Ir.Topics
|
alias Pleroma.Activity.Ir.Topics
|
||||||
alias Pleroma.ActivityExpiration
|
|
||||||
alias Pleroma.Chat
|
alias Pleroma.Chat
|
||||||
alias Pleroma.Chat.MessageReference
|
alias Pleroma.Chat.MessageReference
|
||||||
alias Pleroma.FollowingRelationship
|
alias Pleroma.FollowingRelationship
|
||||||
|
@ -188,10 +187,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
||||||
Object.increase_replies_count(in_reply_to)
|
Object.increase_replies_count(in_reply_to)
|
||||||
end
|
end
|
||||||
|
|
||||||
if expires_at = activity.data["expires_at"] do
|
|
||||||
ActivityExpiration.create(activity, expires_at)
|
|
||||||
end
|
|
||||||
|
|
||||||
BackgroundWorker.enqueue("fetch_data_for_activity", %{"activity_id" => activity.id})
|
BackgroundWorker.enqueue("fetch_data_for_activity", %{"activity_id" => activity.id})
|
||||||
|
|
||||||
meta =
|
meta =
|
||||||
|
|
|
@ -168,7 +168,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object, options)
|
def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object, options)
|
||||||
when not is_nil(in_reply_to) do
|
when not is_nil(in_reply_to) do
|
||||||
in_reply_to_id = prepare_in_reply_to(in_reply_to)
|
in_reply_to_id = prepare_in_reply_to(in_reply_to)
|
||||||
object = Map.put(object, "inReplyToAtomUri", in_reply_to_id)
|
|
||||||
depth = (options[:depth] || 0) + 1
|
depth = (options[:depth] || 0) + 1
|
||||||
|
|
||||||
if Federator.allowed_thread_distance?(depth) do
|
if Federator.allowed_thread_distance?(depth) do
|
||||||
|
@ -176,9 +175,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
%Activity{} <- Activity.get_create_by_object_ap_id(replied_object.data["id"]) do
|
%Activity{} <- Activity.get_create_by_object_ap_id(replied_object.data["id"]) do
|
||||||
object
|
object
|
||||||
|> Map.put("inReplyTo", replied_object.data["id"])
|
|> Map.put("inReplyTo", replied_object.data["id"])
|
||||||
|> Map.put("inReplyToAtomUri", object["inReplyToAtomUri"] || in_reply_to_id)
|
|
||||||
|> Map.put("context", replied_object.data["context"] || object["conversation"])
|
|> Map.put("context", replied_object.data["context"] || object["conversation"])
|
||||||
|> Map.drop(["conversation"])
|
|> Map.drop(["conversation", "inReplyToAtomUri"])
|
||||||
else
|
else
|
||||||
e ->
|
e ->
|
||||||
Logger.warn("Couldn't fetch #{inspect(in_reply_to_id)}, error: #{inspect(e)}")
|
Logger.warn("Couldn't fetch #{inspect(in_reply_to_id)}, error: #{inspect(e)}")
|
||||||
|
|
|
@ -379,8 +379,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
||||||
filters
|
filters
|
||||||
|> String.split(",")
|
|> String.split(",")
|
||||||
|> Enum.filter(&Enum.member?(@filters, &1))
|
|> Enum.filter(&Enum.member?(@filters, &1))
|
||||||
|> Enum.map(&String.to_atom/1)
|
|> Map.new(&{String.to_existing_atom(&1), true})
|
||||||
|> Map.new(&{&1, true})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def right_add_multiple(%{assigns: %{user: admin}} = conn, %{
|
def right_add_multiple(%{assigns: %{user: admin}} = conn, %{
|
||||||
|
|
|
@ -202,7 +202,7 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do
|
||||||
|
|
||||||
additional =
|
additional =
|
||||||
case draft.expires_at do
|
case draft.expires_at do
|
||||||
%NaiveDateTime{} = expires_at -> Map.put(additional, "expires_at", expires_at)
|
%DateTime{} = expires_at -> Map.put(additional, "expires_at", expires_at)
|
||||||
_ -> additional
|
_ -> additional
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
defmodule Pleroma.Web.CommonAPI do
|
defmodule Pleroma.Web.CommonAPI do
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.ActivityExpiration
|
|
||||||
alias Pleroma.Conversation.Participation
|
alias Pleroma.Conversation.Participation
|
||||||
alias Pleroma.Formatter
|
alias Pleroma.Formatter
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
|
@ -381,9 +380,9 @@ defmodule Pleroma.Web.CommonAPI do
|
||||||
def check_expiry_date({:ok, nil} = res), do: res
|
def check_expiry_date({:ok, nil} = res), do: res
|
||||||
|
|
||||||
def check_expiry_date({:ok, in_seconds}) do
|
def check_expiry_date({:ok, in_seconds}) do
|
||||||
expiry = NaiveDateTime.utc_now() |> NaiveDateTime.add(in_seconds)
|
expiry = DateTime.add(DateTime.utc_now(), in_seconds)
|
||||||
|
|
||||||
if ActivityExpiration.expires_late_enough?(expiry) do
|
if Pleroma.Workers.PurgeExpiredActivity.expires_late_enough?(expiry) do
|
||||||
{:ok, expiry}
|
{:ok, expiry}
|
||||||
else
|
else
|
||||||
{:error, "Expiry date is too soon"}
|
{:error, "Expiry date is too soon"}
|
||||||
|
|
|
@ -9,7 +9,15 @@ defmodule Pleroma.Web.Feed.TagController do
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
alias Pleroma.Web.Feed.FeedView
|
alias Pleroma.Web.Feed.FeedView
|
||||||
|
|
||||||
def feed(conn, %{"tag" => raw_tag} = params) do
|
def feed(conn, params) do
|
||||||
|
unless Pleroma.Config.restrict_unauthenticated_access?(:activities, :local) do
|
||||||
|
render_feed(conn, params)
|
||||||
|
else
|
||||||
|
render_error(conn, :not_found, "Not found")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_feed(conn, %{"tag" => raw_tag} = params) do
|
||||||
{format, tag} = parse_tag(raw_tag)
|
{format, tag} = parse_tag(raw_tag)
|
||||||
|
|
||||||
activities =
|
activities =
|
||||||
|
|
|
@ -37,7 +37,15 @@ defmodule Pleroma.Web.Feed.UserController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def feed(conn, %{"nickname" => nickname} = params) do
|
def feed(conn, params) do
|
||||||
|
unless Pleroma.Config.restrict_unauthenticated_access?(:profiles, :local) do
|
||||||
|
render_feed(conn, params)
|
||||||
|
else
|
||||||
|
errors(conn, {:error, :not_found})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_feed(conn, %{"nickname" => nickname} = params) do
|
||||||
format = get_format(conn)
|
format = get_format(conn)
|
||||||
|
|
||||||
format =
|
format =
|
||||||
|
|
|
@ -8,7 +8,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
require Pleroma.Constants
|
require Pleroma.Constants
|
||||||
|
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.ActivityExpiration
|
|
||||||
alias Pleroma.HTML
|
alias Pleroma.HTML
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
|
@ -245,8 +244,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
|
|
||||||
expires_at =
|
expires_at =
|
||||||
with true <- client_posted_this_activity,
|
with true <- client_posted_this_activity,
|
||||||
%ActivityExpiration{scheduled_at: scheduled_at} <-
|
%Oban.Job{scheduled_at: scheduled_at} <-
|
||||||
ActivityExpiration.get_by_activity_id(activity.id) do
|
Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity.id) do
|
||||||
scheduled_at
|
scheduled_at
|
||||||
else
|
else
|
||||||
_ -> nil
|
_ -> nil
|
||||||
|
|
|
@ -37,12 +37,12 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
|
||||||
else
|
else
|
||||||
{:error, :bad_topic} ->
|
{:error, :bad_topic} ->
|
||||||
Logger.debug("#{__MODULE__} bad topic #{inspect(req)}")
|
Logger.debug("#{__MODULE__} bad topic #{inspect(req)}")
|
||||||
{:ok, req} = :cowboy_req.reply(404, req)
|
req = :cowboy_req.reply(404, req)
|
||||||
{:ok, req, state}
|
{:ok, req, state}
|
||||||
|
|
||||||
{:error, :unauthorized} ->
|
{:error, :unauthorized} ->
|
||||||
Logger.debug("#{__MODULE__} authentication error: #{inspect(req)}")
|
Logger.debug("#{__MODULE__} authentication error: #{inspect(req)}")
|
||||||
{:ok, req} = :cowboy_req.reply(401, req)
|
req = :cowboy_req.reply(401, req)
|
||||||
{:ok, req, state}
|
{:ok, req, state}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -64,7 +64,9 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
|
||||||
{:ok, %{state | timer: timer()}}
|
{:ok, %{state | timer: timer()}}
|
||||||
end
|
end
|
||||||
|
|
||||||
# We never receive messages.
|
# We only receive pings for now
|
||||||
|
def websocket_handle(:ping, state), do: {:ok, state}
|
||||||
|
|
||||||
def websocket_handle(frame, state) do
|
def websocket_handle(frame, state) do
|
||||||
Logger.error("#{__MODULE__} received frame: #{inspect(frame)}")
|
Logger.error("#{__MODULE__} received frame: #{inspect(frame)}")
|
||||||
{:ok, state}
|
{:ok, state}
|
||||||
|
@ -98,6 +100,10 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
|
||||||
{:reply, :ping, %{state | timer: nil, count: 0}, :hibernate}
|
{:reply, :ping, %{state | timer: nil, count: 0}, :hibernate}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# State can be `[]` only in case we terminate before switching to websocket,
|
||||||
|
# we already log errors for these cases in `init/1`, so just do nothing here
|
||||||
|
def terminate(_reason, _req, []), do: :ok
|
||||||
|
|
||||||
def terminate(reason, _req, state) do
|
def terminate(reason, _req, state) do
|
||||||
Logger.debug(
|
Logger.debug(
|
||||||
"#{__MODULE__} terminating websocket connection for user #{
|
"#{__MODULE__} terminating websocket connection for user #{
|
||||||
|
|
|
@ -7,8 +7,9 @@ defmodule Pleroma.Web.Metadata do
|
||||||
|
|
||||||
def build_tags(params) do
|
def build_tags(params) do
|
||||||
providers = [
|
providers = [
|
||||||
|
Pleroma.Web.Metadata.Providers.RelMe,
|
||||||
Pleroma.Web.Metadata.Providers.RestrictIndexing
|
Pleroma.Web.Metadata.Providers.RestrictIndexing
|
||||||
| Pleroma.Config.get([__MODULE__, :providers], [])
|
| activated_providers()
|
||||||
]
|
]
|
||||||
|
|
||||||
Enum.reduce(providers, "", fn parser, acc ->
|
Enum.reduce(providers, "", fn parser, acc ->
|
||||||
|
@ -42,4 +43,12 @@ defmodule Pleroma.Web.Metadata do
|
||||||
def activity_nsfw?(_) do
|
def activity_nsfw?(_) do
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp activated_providers do
|
||||||
|
unless Pleroma.Config.restrict_unauthenticated_access?(:activities, :local) do
|
||||||
|
[Pleroma.Web.Metadata.Providers.Feed | Pleroma.Config.get([__MODULE__, :providers], [])]
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -145,7 +145,10 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|
||||||
def after_create_authorization(%Plug.Conn{} = conn, %Authorization{} = auth, %{
|
def after_create_authorization(%Plug.Conn{} = conn, %Authorization{} = auth, %{
|
||||||
"authorization" => %{"redirect_uri" => @oob_token_redirect_uri}
|
"authorization" => %{"redirect_uri" => @oob_token_redirect_uri}
|
||||||
}) do
|
}) do
|
||||||
render(conn, "oob_authorization_created.html", %{auth: auth})
|
# Enforcing the view to reuse the template when calling from other controllers
|
||||||
|
conn
|
||||||
|
|> put_view(OAuthView)
|
||||||
|
|> render("oob_authorization_created.html", %{auth: auth})
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_create_authorization(%Plug.Conn{} = conn, %Authorization{} = auth, %{
|
def after_create_authorization(%Plug.Conn{} = conn, %Authorization{} = auth, %{
|
||||||
|
@ -197,7 +200,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|
||||||
{:mfa_required, user, auth, _},
|
{:mfa_required, user, auth, _},
|
||||||
params
|
params
|
||||||
) do
|
) do
|
||||||
{:ok, token} = MFA.Token.create_token(user, auth)
|
{:ok, token} = MFA.Token.create(user, auth)
|
||||||
|
|
||||||
data = %{
|
data = %{
|
||||||
"mfa_token" => token.token,
|
"mfa_token" => token.token,
|
||||||
|
@ -579,7 +582,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
|
||||||
do: put_session(conn, :registration_id, registration_id)
|
do: put_session(conn, :registration_id, registration_id)
|
||||||
|
|
||||||
defp build_and_response_mfa_token(user, auth) do
|
defp build_and_response_mfa_token(user, auth) do
|
||||||
with {:ok, token} <- MFA.Token.create_token(user, auth) do
|
with {:ok, token} <- MFA.Token.create(user, auth) do
|
||||||
MFAView.render("mfa_response.json", %{token: token, user: user})
|
MFAView.render("mfa_response.json", %{token: token, user: user})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,7 +50,7 @@ defmodule Pleroma.Web.OAuth.Token do
|
||||||
true <- auth.app_id == app.id do
|
true <- auth.app_id == app.id do
|
||||||
user = if auth.user_id, do: User.get_cached_by_id(auth.user_id), else: %User{}
|
user = if auth.user_id, do: User.get_cached_by_id(auth.user_id), else: %User{}
|
||||||
|
|
||||||
create_token(
|
create(
|
||||||
app,
|
app,
|
||||||
user,
|
user,
|
||||||
%{scopes: auth.scopes}
|
%{scopes: auth.scopes}
|
||||||
|
@ -83,8 +83,22 @@ defmodule Pleroma.Web.OAuth.Token do
|
||||||
|> validate_required([:valid_until])
|
|> validate_required([:valid_until])
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec create_token(App.t(), User.t(), map()) :: {:ok, Token} | {:error, Changeset.t()}
|
@spec create(App.t(), User.t(), map()) :: {:ok, Token} | {:error, Changeset.t()}
|
||||||
def create_token(%App{} = app, %User{} = user, attrs \\ %{}) do
|
def create(%App{} = app, %User{} = user, attrs \\ %{}) do
|
||||||
|
with {:ok, token} <- do_create(app, user, attrs) do
|
||||||
|
if Pleroma.Config.get([:oauth2, :clean_expired_tokens]) do
|
||||||
|
Pleroma.Workers.PurgeExpiredToken.enqueue(%{
|
||||||
|
token_id: token.id,
|
||||||
|
valid_until: DateTime.from_naive!(token.valid_until, "Etc/UTC"),
|
||||||
|
mod: __MODULE__
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
{:ok, token}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp do_create(app, user, attrs) do
|
||||||
%__MODULE__{user_id: user.id, app_id: app.id}
|
%__MODULE__{user_id: user.id, app_id: app.id}
|
||||||
|> cast(%{scopes: attrs[:scopes] || app.scopes}, [:scopes])
|
|> cast(%{scopes: attrs[:scopes] || app.scopes}, [:scopes])
|
||||||
|> validate_required([:scopes, :app_id])
|
|> validate_required([:scopes, :app_id])
|
||||||
|
@ -105,11 +119,6 @@ defmodule Pleroma.Web.OAuth.Token do
|
||||||
|> Repo.delete_all()
|
|> Repo.delete_all()
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_expired_tokens do
|
|
||||||
Query.get_expired_tokens()
|
|
||||||
|> Repo.delete_all()
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_user_tokens(%User{id: user_id}) do
|
def get_user_tokens(%User{id: user_id}) do
|
||||||
Query.get_by_user(user_id)
|
Query.get_by_user(user_id)
|
||||||
|> Query.preload([:app])
|
|> Query.preload([:app])
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
defmodule Pleroma.Web.OAuth.Token.CleanWorker do
|
|
||||||
@moduledoc """
|
|
||||||
The module represents functions to clean an expired OAuth and MFA tokens.
|
|
||||||
"""
|
|
||||||
use GenServer
|
|
||||||
|
|
||||||
@ten_seconds 10_000
|
|
||||||
@one_day 86_400_000
|
|
||||||
|
|
||||||
alias Pleroma.MFA
|
|
||||||
alias Pleroma.Web.OAuth
|
|
||||||
alias Pleroma.Workers.BackgroundWorker
|
|
||||||
|
|
||||||
def start_link(_), do: GenServer.start_link(__MODULE__, %{})
|
|
||||||
|
|
||||||
def init(_) do
|
|
||||||
Process.send_after(self(), :perform, @ten_seconds)
|
|
||||||
{:ok, nil}
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc false
|
|
||||||
def handle_info(:perform, state) do
|
|
||||||
BackgroundWorker.enqueue("clean_expired_tokens", %{})
|
|
||||||
interval = Pleroma.Config.get([:oauth2, :clean_expired_tokens_interval], @one_day)
|
|
||||||
|
|
||||||
Process.send_after(self(), :perform, interval)
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
def perform(:clean) do
|
|
||||||
OAuth.Token.delete_expired_tokens()
|
|
||||||
MFA.Token.delete_expired_tokens()
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -33,12 +33,6 @@ defmodule Pleroma.Web.OAuth.Token.Query do
|
||||||
from(q in query, where: q.id == ^id)
|
from(q in query, where: q.id == ^id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec get_expired_tokens(query, DateTime.t() | nil) :: query
|
|
||||||
def get_expired_tokens(query \\ Token, date \\ nil) do
|
|
||||||
expired_date = date || Timex.now()
|
|
||||||
from(q in query, where: fragment("?", q.valid_until) < ^expired_date)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec get_by_user(query, String.t()) :: query
|
@spec get_by_user(query, String.t()) :: query
|
||||||
def get_by_user(query \\ Token, user_id) do
|
def get_by_user(query \\ Token, user_id) do
|
||||||
from(q in query, where: q.user_id == ^user_id)
|
from(q in query, where: q.user_id == ^user_id)
|
||||||
|
|
|
@ -46,7 +46,7 @@ defmodule Pleroma.Web.OAuth.Token.Strategy.RefreshToken do
|
||||||
defp create_access_token({:error, error}, _), do: {:error, error}
|
defp create_access_token({:error, error}, _), do: {:error, error}
|
||||||
|
|
||||||
defp create_access_token({:ok, token}, %{app: app, user: user} = token_params) do
|
defp create_access_token({:ok, token}, %{app: app, user: user} = token_params) do
|
||||||
Token.create_token(app, user, add_refresh_token(token_params, token.refresh_token))
|
Token.create(app, user, add_refresh_token(token_params, token.refresh_token))
|
||||||
end
|
end
|
||||||
|
|
||||||
defp add_refresh_token(params, token) do
|
defp add_refresh_token(params, token) do
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<h1>Successfully authorized</h1>
|
<h1>Successfully authorized</h1>
|
||||||
<h2>Token code is <%= @auth.token %></h2>
|
<h2>Token code is <br><%= @auth.token %></h2>
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<h1>Authorization exists</h1>
|
<h1>Authorization exists</h1>
|
||||||
<h2>Access token is <%= @token.token %></h2>
|
<h2>Access token is <br><%= @token.token %></h2>
|
||||||
|
|
|
@ -135,7 +135,7 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp handle_follow_error(conn, {:mfa_required, followee, user, _} = _) do
|
defp handle_follow_error(conn, {:mfa_required, followee, user, _} = _) do
|
||||||
{:ok, %{token: token}} = MFA.Token.create_token(user)
|
{:ok, %{token: token}} = MFA.Token.create(user)
|
||||||
render(conn, "follow_mfa.html", %{followee: followee, mfa_token: token, error: false})
|
render(conn, "follow_mfa.html", %{followee: followee, mfa_token: token, error: false})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
defmodule Pleroma.Workers.Cron.ClearOauthTokenWorker do
|
|
||||||
@moduledoc """
|
|
||||||
The worker to cleanup expired oAuth tokens.
|
|
||||||
"""
|
|
||||||
|
|
||||||
use Oban.Worker, queue: "background"
|
|
||||||
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.Web.OAuth.Token
|
|
||||||
|
|
||||||
@impl Oban.Worker
|
|
||||||
def perform(_job) do
|
|
||||||
if Config.get([:oauth2, :clean_expired_tokens], false) do
|
|
||||||
Token.delete_expired_tokens()
|
|
||||||
end
|
|
||||||
|
|
||||||
:ok
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,48 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
defmodule Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker do
|
|
||||||
@moduledoc """
|
|
||||||
The worker to purge expired activities.
|
|
||||||
"""
|
|
||||||
|
|
||||||
use Oban.Worker, queue: "activity_expiration"
|
|
||||||
|
|
||||||
alias Pleroma.Activity
|
|
||||||
alias Pleroma.ActivityExpiration
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.User
|
|
||||||
alias Pleroma.Web.CommonAPI
|
|
||||||
|
|
||||||
require Logger
|
|
||||||
|
|
||||||
@interval :timer.minutes(1)
|
|
||||||
|
|
||||||
@impl Oban.Worker
|
|
||||||
def perform(_job) do
|
|
||||||
if Config.get([ActivityExpiration, :enabled]) do
|
|
||||||
Enum.each(ActivityExpiration.due_expirations(@interval), &delete_activity/1)
|
|
||||||
end
|
|
||||||
after
|
|
||||||
:ok
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete_activity(%ActivityExpiration{activity_id: activity_id}) do
|
|
||||||
with {:activity, %Activity{} = activity} <-
|
|
||||||
{:activity, Activity.get_by_id_with_object(activity_id)},
|
|
||||||
{:user, %User{} = user} <- {:user, User.get_by_ap_id(activity.object.data["actor"])} do
|
|
||||||
CommonAPI.delete(activity.id, user)
|
|
||||||
else
|
|
||||||
{:activity, _} ->
|
|
||||||
Logger.error(
|
|
||||||
"#{__MODULE__} Couldn't delete expired activity: not found activity ##{activity_id}"
|
|
||||||
)
|
|
||||||
|
|
||||||
{:user, _} ->
|
|
||||||
Logger.error(
|
|
||||||
"#{__MODULE__} Couldn't delete expired activity: not found actor of ##{activity_id}"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
72
lib/pleroma/workers/purge_expired_activity.ex
Normal file
72
lib/pleroma/workers/purge_expired_activity.ex
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.Workers.PurgeExpiredActivity do
|
||||||
|
@moduledoc """
|
||||||
|
Worker which purges expired activity.
|
||||||
|
"""
|
||||||
|
|
||||||
|
use Oban.Worker, queue: :activity_expiration, max_attempts: 1
|
||||||
|
|
||||||
|
import Ecto.Query
|
||||||
|
|
||||||
|
alias Pleroma.Activity
|
||||||
|
|
||||||
|
@spec enqueue(map()) ::
|
||||||
|
{:ok, Oban.Job.t()}
|
||||||
|
| {:error, :expired_activities_disabled}
|
||||||
|
| {:error, :expiration_too_close}
|
||||||
|
def enqueue(args) do
|
||||||
|
with true <- enabled?() do
|
||||||
|
{scheduled_at, args} = Map.pop(args, :expires_at)
|
||||||
|
|
||||||
|
args
|
||||||
|
|> new(scheduled_at: scheduled_at)
|
||||||
|
|> Oban.insert()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def perform(%Oban.Job{args: %{"activity_id" => id}}) do
|
||||||
|
with %Activity{} = activity <- find_activity(id),
|
||||||
|
%Pleroma.User{} = user <- find_user(activity.object.data["actor"]) do
|
||||||
|
Pleroma.Web.CommonAPI.delete(activity.id, user)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp enabled? do
|
||||||
|
with false <- Pleroma.Config.get([__MODULE__, :enabled], false) do
|
||||||
|
{:error, :expired_activities_disabled}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp find_activity(id) do
|
||||||
|
with nil <- Activity.get_by_id_with_object(id) do
|
||||||
|
{:error, :activity_not_found}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp find_user(ap_id) do
|
||||||
|
with nil <- Pleroma.User.get_by_ap_id(ap_id) do
|
||||||
|
{:error, :user_not_found}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_expiration(id) do
|
||||||
|
from(j in Oban.Job,
|
||||||
|
where: j.state == "scheduled",
|
||||||
|
where: j.queue == "activity_expiration",
|
||||||
|
where: fragment("?->>'activity_id' = ?", j.args, ^id)
|
||||||
|
)
|
||||||
|
|> Pleroma.Repo.one()
|
||||||
|
end
|
||||||
|
|
||||||
|
@spec expires_late_enough?(DateTime.t()) :: boolean()
|
||||||
|
def expires_late_enough?(scheduled_at) do
|
||||||
|
now = DateTime.utc_now()
|
||||||
|
diff = DateTime.diff(scheduled_at, now, :millisecond)
|
||||||
|
min_lifetime = Pleroma.Config.get([__MODULE__, :min_lifetime], 600)
|
||||||
|
diff > :timer.seconds(min_lifetime)
|
||||||
|
end
|
||||||
|
end
|
29
lib/pleroma/workers/purge_expired_token.ex
Normal file
29
lib/pleroma/workers/purge_expired_token.ex
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.Workers.PurgeExpiredToken do
|
||||||
|
@moduledoc """
|
||||||
|
Worker which purges expired OAuth tokens
|
||||||
|
"""
|
||||||
|
|
||||||
|
use Oban.Worker, queue: :token_expiration, max_attempts: 1
|
||||||
|
|
||||||
|
@spec enqueue(%{token_id: integer(), valid_until: DateTime.t(), mod: module()}) ::
|
||||||
|
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}
|
||||||
|
def enqueue(args) do
|
||||||
|
{scheduled_at, args} = Map.pop(args, :valid_until)
|
||||||
|
|
||||||
|
args
|
||||||
|
|> __MODULE__.new(scheduled_at: scheduled_at)
|
||||||
|
|> Oban.insert()
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def perform(%Oban.Job{args: %{"token_id" => id, "mod" => module}}) do
|
||||||
|
module
|
||||||
|
|> String.to_existing_atom()
|
||||||
|
|> Pleroma.Repo.get(id)
|
||||||
|
|> Pleroma.Repo.delete()
|
||||||
|
end
|
||||||
|
end
|
2
mix.exs
2
mix.exs
|
@ -180,7 +180,7 @@ defmodule Pleroma.Mixfile do
|
||||||
{:flake_id, "~> 0.1.0"},
|
{:flake_id, "~> 0.1.0"},
|
||||||
{:concurrent_limiter,
|
{:concurrent_limiter,
|
||||||
git: "https://git.pleroma.social/pleroma/elixir-libraries/concurrent_limiter.git",
|
git: "https://git.pleroma.social/pleroma/elixir-libraries/concurrent_limiter.git",
|
||||||
ref: "55e92f84b4ed531bd487952a71040a9c69dc2807"},
|
ref: "d81be41024569330f296fc472e24198d7499ba78"},
|
||||||
{:remote_ip,
|
{:remote_ip,
|
||||||
git: "https://git.pleroma.social/pleroma/remote_ip.git",
|
git: "https://git.pleroma.social/pleroma/remote_ip.git",
|
||||||
ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"},
|
ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"},
|
||||||
|
|
2
mix.lock
2
mix.lock
|
@ -14,7 +14,7 @@
|
||||||
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
|
"certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
|
||||||
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
|
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
|
||||||
"comeonin": {:hex, :comeonin, "5.3.1", "7fe612b739c78c9c1a75186ef2d322ce4d25032d119823269d0aa1e2f1e20025", [:mix], [], "hexpm", "d6222483060c17f0977fad1b7401ef0c5863c985a64352755f366aee3799c245"},
|
"comeonin": {:hex, :comeonin, "5.3.1", "7fe612b739c78c9c1a75186ef2d322ce4d25032d119823269d0aa1e2f1e20025", [:mix], [], "hexpm", "d6222483060c17f0977fad1b7401ef0c5863c985a64352755f366aee3799c245"},
|
||||||
"concurrent_limiter": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/concurrent_limiter.git", "55e92f84b4ed531bd487952a71040a9c69dc2807", [ref: "55e92f84b4ed531bd487952a71040a9c69dc2807"]},
|
"concurrent_limiter": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/concurrent_limiter.git", "d81be41024569330f296fc472e24198d7499ba78", [ref: "d81be41024569330f296fc472e24198d7499ba78"]},
|
||||||
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"},
|
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"},
|
||||||
"cors_plug": {:hex, :cors_plug, "2.0.2", "2b46083af45e4bc79632bd951550509395935d3e7973275b2b743bd63cc942ce", [:mix], [{:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f0d0e13f71c51fd4ef8b2c7e051388e4dfb267522a83a22392c856de7e46465f"},
|
"cors_plug": {:hex, :cors_plug, "2.0.2", "2b46083af45e4bc79632bd951550509395935d3e7973275b2b743bd63cc942ce", [:mix], [{:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f0d0e13f71c51fd4ef8b2c7e051388e4dfb267522a83a22392c856de7e46465f"},
|
||||||
"cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"},
|
"cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"},
|
||||||
|
|
586
priv/gettext/es/LC_MESSAGES/errors.po
Normal file
586
priv/gettext/es/LC_MESSAGES/errors.po
Normal file
|
@ -0,0 +1,586 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2020-09-09 09:49+0000\n"
|
||||||
|
"PO-Revision-Date: 2020-09-11 21:26+0000\n"
|
||||||
|
"Last-Translator: tarteka <info@tarteka.net>\n"
|
||||||
|
"Language-Team: Spanish <https://translate.pleroma.social/projects/pleroma/"
|
||||||
|
"pleroma/es/>\n"
|
||||||
|
"Language: es\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
|
"X-Generator: Weblate 4.0.4\n"
|
||||||
|
|
||||||
|
## This file is a PO Template file.
|
||||||
|
##
|
||||||
|
## `msgid`s here are often extracted from source code.
|
||||||
|
## Add new translations manually only if they're dynamic
|
||||||
|
## translations that can't be statically extracted.
|
||||||
|
##
|
||||||
|
## Run `mix gettext.extract` to bring this file up to
|
||||||
|
## date. Leave `msgstr`s empty as changing them here as no
|
||||||
|
## effect: edit them in PO (`.po`) files instead.
|
||||||
|
## From Ecto.Changeset.cast/4
|
||||||
|
msgid "can't be blank"
|
||||||
|
msgstr "no puede estar en blanco"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.unique_constraint/3
|
||||||
|
msgid "has already been taken"
|
||||||
|
msgstr "ya está en uso"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.put_change/3
|
||||||
|
msgid "is invalid"
|
||||||
|
msgstr "es inválido"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.validate_format/3
|
||||||
|
msgid "has invalid format"
|
||||||
|
msgstr "el formato no es válido"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.validate_subset/3
|
||||||
|
msgid "has an invalid entry"
|
||||||
|
msgstr "tiene una entrada inválida"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.validate_exclusion/3
|
||||||
|
msgid "is reserved"
|
||||||
|
msgstr "está reservado"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.validate_confirmation/3
|
||||||
|
msgid "does not match confirmation"
|
||||||
|
msgstr "la confirmación no coincide"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.no_assoc_constraint/3
|
||||||
|
msgid "is still associated with this entry"
|
||||||
|
msgstr "todavía está asociado con esta entrada"
|
||||||
|
|
||||||
|
msgid "are still associated with this entry"
|
||||||
|
msgstr "todavía están asociados con esta entrada"
|
||||||
|
|
||||||
|
## From Ecto.Changeset.validate_length/3
|
||||||
|
msgid "should be %{count} character(s)"
|
||||||
|
msgid_plural "should be %{count} character(s)"
|
||||||
|
msgstr[0] "debe tener %{count} carácter"
|
||||||
|
msgstr[1] "debe tener %{count} caracteres"
|
||||||
|
|
||||||
|
msgid "should have %{count} item(s)"
|
||||||
|
msgid_plural "should have %{count} item(s)"
|
||||||
|
msgstr[0] ""
|
||||||
|
msgstr[1] ""
|
||||||
|
|
||||||
|
msgid "should be at least %{count} character(s)"
|
||||||
|
msgid_plural "should be at least %{count} character(s)"
|
||||||
|
msgstr[0] ""
|
||||||
|
msgstr[1] ""
|
||||||
|
|
||||||
|
msgid "should have at least %{count} item(s)"
|
||||||
|
msgid_plural "should have at least %{count} item(s)"
|
||||||
|
msgstr[0] ""
|
||||||
|
msgstr[1] ""
|
||||||
|
|
||||||
|
msgid "should be at most %{count} character(s)"
|
||||||
|
msgid_plural "should be at most %{count} character(s)"
|
||||||
|
msgstr[0] ""
|
||||||
|
msgstr[1] ""
|
||||||
|
|
||||||
|
msgid "should have at most %{count} item(s)"
|
||||||
|
msgid_plural "should have at most %{count} item(s)"
|
||||||
|
msgstr[0] ""
|
||||||
|
msgstr[1] ""
|
||||||
|
|
||||||
|
## From Ecto.Changeset.validate_number/3
|
||||||
|
msgid "must be less than %{number}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "must be greater than %{number}"
|
||||||
|
msgstr "debe ser mayor que %{number}"
|
||||||
|
|
||||||
|
msgid "must be less than or equal to %{number}"
|
||||||
|
msgstr "debe ser menor o igual que %{number}"
|
||||||
|
|
||||||
|
msgid "must be greater than or equal to %{number}"
|
||||||
|
msgstr "deber ser mayor o igual que %{number}"
|
||||||
|
|
||||||
|
msgid "must be equal to %{number}"
|
||||||
|
msgstr "deber ser igual a %{number}"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:505
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Account not found"
|
||||||
|
msgstr "Cuenta no encontrada"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:339
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Already voted"
|
||||||
|
msgstr "Ya has votado"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:359
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Bad request"
|
||||||
|
msgstr "Solicitud incorrecta"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:426
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Can't delete object"
|
||||||
|
msgstr "No se puede eliminar el objeto"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/controller_helper.ex:105
|
||||||
|
#: lib/pleroma/web/controller_helper.ex:111
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Can't display this activity"
|
||||||
|
msgstr "No se puede mostrar esta actividad"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:285
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Can't find user"
|
||||||
|
msgstr "No se puede encontrar al usuario"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/account_controller.ex:61
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Can't get favorites"
|
||||||
|
msgstr "No se puede obtener los favoritos"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:438
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Can't like object"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/utils.ex:563
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Cannot post an empty status without attachments"
|
||||||
|
msgstr "No se puede publicar un estado vacío y sin archivos adjuntos"
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/utils.ex:511
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Comment must be up to %{max_size} characters"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/config/config_db.ex:191
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Config with params %{params} not found"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:181
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:185
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not delete"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:231
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not favorite"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:453
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not pin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:278
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not unfavorite"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:463
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not unpin"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:216
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not unrepeat"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:512
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:521
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not update state"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:207
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Error."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/twitter_api/twitter_api.ex:106
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid CAPTCHA"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:116
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:568
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/ensure_authenticated_plug.ex:38
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid credentials."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:355
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid indices"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:29
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid parameters"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/utils.ex:414
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid password."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:220
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid request"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/twitter_api/twitter_api.ex:109
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Kocaptcha service unavailable"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:112
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Missing parameters"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/utils.ex:547
|
||||||
|
#, elixir-format
|
||||||
|
msgid "No such conversation"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:388
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:414 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:456
|
||||||
|
#, elixir-format
|
||||||
|
msgid "No such permission_group"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/uploaded_media.ex:84
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:486 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:11
|
||||||
|
#: lib/pleroma/web/feed/user_controller.ex:71 lib/pleroma/web/ostatus/ostatus_controller.ex:143
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Not found"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:331
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Poll's author can't vote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:20
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:37 lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:49
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:50 lib/pleroma/web/mastodon_api/controllers/status_controller.ex:306
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:71
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Record not found"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:35
|
||||||
|
#: lib/pleroma/web/feed/user_controller.ex:77 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:36
|
||||||
|
#: lib/pleroma/web/ostatus/ostatus_controller.ex:149
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Something went wrong"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/activity_draft.ex:107
|
||||||
|
#, elixir-format
|
||||||
|
msgid "The message visibility must be direct"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/utils.ex:573
|
||||||
|
#, elixir-format
|
||||||
|
msgid "The status is over the character limit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31
|
||||||
|
#, elixir-format
|
||||||
|
msgid "This resource requires authentication."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Throttled"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:356
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Too many choices"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:443
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unhandled activity type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:485
|
||||||
|
#, elixir-format
|
||||||
|
msgid "You can't revoke your own admin status."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:221
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:308
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Your account is currently disabled"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:183
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:331
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Your login is missing a confirmed e-mail address"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:390
|
||||||
|
#, elixir-format
|
||||||
|
msgid "can't read inbox of %{nickname} as %{as_nickname}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:473
|
||||||
|
#, elixir-format
|
||||||
|
msgid "can't update outbox of %{nickname} as %{as_nickname}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:471
|
||||||
|
#, elixir-format
|
||||||
|
msgid "conversation is already muted"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:314
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:492
|
||||||
|
#, elixir-format
|
||||||
|
msgid "error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:32
|
||||||
|
#, elixir-format
|
||||||
|
msgid "mascots can only be images"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:62
|
||||||
|
#, elixir-format
|
||||||
|
msgid "not found"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:394
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Bad OAuth request."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/twitter_api/twitter_api.ex:115
|
||||||
|
#, elixir-format
|
||||||
|
msgid "CAPTCHA already used"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/twitter_api/twitter_api.ex:112
|
||||||
|
#, elixir-format
|
||||||
|
msgid "CAPTCHA expired"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/uploaded_media.ex:57
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Failed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:410
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Failed to authenticate: %{message}."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:441
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Failed to set up user account."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/oauth_scopes_plug.ex:38
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Insufficient permissions: %{permissions}."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/uploaded_media.ex:104
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Internal Error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/fallback_controller.ex:22
|
||||||
|
#: lib/pleroma/web/oauth/fallback_controller.ex:29
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid Username/Password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/twitter_api/twitter_api.ex:118
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid answer data"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:33
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Nodeinfo schema version not handled"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:172
|
||||||
|
#, elixir-format
|
||||||
|
msgid "This action is outside the authorized scopes"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/fallback_controller.ex:14
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unknown error, please check the details and try again."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:119
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:158
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unlisted redirect_uri."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:390
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unsupported OAuth provider: %{provider}."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/uploaders/uploader.ex:72
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Uploader callback timeout"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/uploader_controller.ex:23
|
||||||
|
#, elixir-format
|
||||||
|
msgid "bad request"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/twitter_api/twitter_api.ex:103
|
||||||
|
#, elixir-format
|
||||||
|
msgid "CAPTCHA Error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:290
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not add reaction emoji"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/common_api/common_api.ex:301
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Could not remove reaction emoji"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/twitter_api/twitter_api.ex:129
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Invalid CAPTCHA (Missing parameter: %{name})"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/list_controller.ex:92
|
||||||
|
#, elixir-format
|
||||||
|
msgid "List not found"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:123
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Missing parameter: %{name}"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:210
|
||||||
|
#: lib/pleroma/web/oauth/oauth_controller.ex:321
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Password reset is required"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/tests/auth_test_controller.ex:9
|
||||||
|
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:6 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:6
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/config_controller.ex:6 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:6
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/invite_controller.ex:6 lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex:6
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/oauth_app_controller.ex:6 lib/pleroma/web/admin_api/controllers/relay_controller.ex:6
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/report_controller.ex:6 lib/pleroma/web/admin_api/controllers/status_controller.ex:6
|
||||||
|
#: lib/pleroma/web/controller_helper.ex:6 lib/pleroma/web/embed_controller.ex:6
|
||||||
|
#: lib/pleroma/web/fallback_redirect_controller.ex:6 lib/pleroma/web/feed/tag_controller.ex:6
|
||||||
|
#: lib/pleroma/web/feed/user_controller.ex:6 lib/pleroma/web/mailer/subscription_controller.ex:2
|
||||||
|
#: lib/pleroma/web/masto_fe_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/account_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/app_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/auth_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/filter_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/instance_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/list_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/marker_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex:14
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/media_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/notification_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/report_controller.ex:8
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/search_controller.ex:6
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/status_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:7
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:6
|
||||||
|
#: lib/pleroma/web/media_proxy/media_proxy_controller.ex:6 lib/pleroma/web/mongooseim/mongoose_im_controller.ex:6
|
||||||
|
#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:6 lib/pleroma/web/oauth/fallback_controller.ex:6
|
||||||
|
#: lib/pleroma/web/oauth/mfa_controller.ex:10 lib/pleroma/web/oauth/oauth_controller.ex:6
|
||||||
|
#: lib/pleroma/web/ostatus/ostatus_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/account_controller.ex:6
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:5 lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex:6
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:2 lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex:6
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/notification_controller.ex:6
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex:6
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex:7 lib/pleroma/web/static_fe/static_fe_controller.ex:6
|
||||||
|
#: lib/pleroma/web/twitter_api/controllers/password_controller.ex:10 lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex:6
|
||||||
|
#: lib/pleroma/web/twitter_api/controllers/util_controller.ex:6 lib/pleroma/web/twitter_api/twitter_api_controller.ex:6
|
||||||
|
#: lib/pleroma/web/uploader_controller.ex:6 lib/pleroma/web/web_finger/web_finger_controller.ex:6
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Security violation: OAuth scopes check was neither handled nor explicitly skipped."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/ensure_authenticated_plug.ex:28
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Two-factor authentication enabled, you must use a access token."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:210
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unexpected error occurred while adding file to pack."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:138
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unexpected error occurred while creating pack."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:278
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unexpected error occurred while removing file from pack."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:250
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unexpected error occurred while updating file in pack."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:179
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Unexpected error occurred while updating pack metadata."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Web push subscription is disabled on this Pleroma instance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:451
|
||||||
|
#, elixir-format
|
||||||
|
msgid "You can't revoke your own admin/moderator status."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:126
|
||||||
|
#, elixir-format
|
||||||
|
msgid "authorization required for timeline view"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:24
|
||||||
|
#, elixir-format
|
||||||
|
msgid "Access denied"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:282
|
||||||
|
#, elixir-format
|
||||||
|
msgid "This API requires an authenticated user"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/pleroma/plugs/user_is_admin_plug.ex:21
|
||||||
|
#, elixir-format
|
||||||
|
msgid "User is not an admin."
|
||||||
|
msgstr ""
|
|
@ -0,0 +1,13 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.RenameActivityExpirationSetting do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
config = Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.ActivityExpiration})
|
||||||
|
|
||||||
|
if config do
|
||||||
|
config
|
||||||
|
|> Ecto.Changeset.change(key: Pleroma.Workers.PurgeExpiredActivity)
|
||||||
|
|> Pleroma.Repo.update()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
import Ecto.Query, only: [from: 2]
|
||||||
|
|
||||||
|
def change do
|
||||||
|
Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}],
|
||||||
|
strategy: :one_for_one,
|
||||||
|
name: Pleroma.Supervisor
|
||||||
|
)
|
||||||
|
|
||||||
|
from(e in "activity_expirations",
|
||||||
|
select: %{id: e.id, activity_id: e.activity_id, scheduled_at: e.scheduled_at}
|
||||||
|
)
|
||||||
|
|> Pleroma.Repo.stream()
|
||||||
|
|> Stream.each(fn expiration ->
|
||||||
|
with {:ok, expires_at} <- DateTime.from_naive(expiration.scheduled_at, "Etc/UTC") do
|
||||||
|
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
||||||
|
activity_id: FlakeId.to_string(expiration.activity_id),
|
||||||
|
expires_at: expires_at
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|> Stream.run()
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.DropActivityExpirationsTable do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
drop(table("activity_expirations"))
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,19 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.RemoveCronClearOauthTokenWorkerFromObanConfig do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
with %Pleroma.ConfigDB{} = config <-
|
||||||
|
Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Oban}),
|
||||||
|
crontab when is_list(crontab) <- config.value[:crontab],
|
||||||
|
index when is_integer(index) <-
|
||||||
|
Enum.find_index(crontab, fn {_, worker} ->
|
||||||
|
worker == Pleroma.Workers.Cron.ClearOauthTokenWorker
|
||||||
|
end) do
|
||||||
|
updated_value = Keyword.put(config.value, :crontab, List.delete_at(crontab, index))
|
||||||
|
|
||||||
|
config
|
||||||
|
|> Ecto.Changeset.change(value: updated_value)
|
||||||
|
|> Pleroma.Repo.update()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,36 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.MoveTokensExpirationIntoOban do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
import Ecto.Query, only: [from: 2]
|
||||||
|
|
||||||
|
def change do
|
||||||
|
Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}],
|
||||||
|
strategy: :one_for_one,
|
||||||
|
name: Pleroma.Supervisor
|
||||||
|
)
|
||||||
|
|
||||||
|
if Pleroma.Config.get([:oauth2, :clean_expired_tokens]) do
|
||||||
|
from(t in Pleroma.Web.OAuth.Token, where: t.valid_until > ^NaiveDateTime.utc_now())
|
||||||
|
|> Pleroma.Repo.stream()
|
||||||
|
|> Stream.each(fn token ->
|
||||||
|
Pleroma.Workers.PurgeExpiredToken.enqueue(%{
|
||||||
|
token_id: token.id,
|
||||||
|
valid_until: DateTime.from_naive!(token.valid_until, "Etc/UTC"),
|
||||||
|
mod: Pleroma.Web.OAuth.Token
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
|> Stream.run()
|
||||||
|
end
|
||||||
|
|
||||||
|
from(t in Pleroma.MFA.Token, where: t.valid_until > ^NaiveDateTime.utc_now())
|
||||||
|
|> Pleroma.Repo.stream()
|
||||||
|
|> Stream.each(fn token ->
|
||||||
|
Pleroma.Workers.PurgeExpiredToken.enqueue(%{
|
||||||
|
token_id: token.id,
|
||||||
|
valid_until: DateTime.from_naive!(token.valid_until, "Etc/UTC"),
|
||||||
|
mod: Pleroma.MFA.Token
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
|> Stream.run()
|
||||||
|
end
|
||||||
|
end
|
20
priv/repo/migrations/20200911055909_remove_cron_jobs.exs
Normal file
20
priv/repo/migrations/20200911055909_remove_cron_jobs.exs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.RemoveCronJobs do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
import Ecto.Query, only: [from: 2]
|
||||||
|
|
||||||
|
def up do
|
||||||
|
from(j in "oban_jobs",
|
||||||
|
where:
|
||||||
|
j.worker in ^[
|
||||||
|
"Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker",
|
||||||
|
"Pleroma.Workers.Cron.StatsWorker",
|
||||||
|
"Pleroma.Workers.Cron.ClearOauthTokenWorker"
|
||||||
|
],
|
||||||
|
select: [:id]
|
||||||
|
)
|
||||||
|
|> Pleroma.Repo.delete_all()
|
||||||
|
end
|
||||||
|
|
||||||
|
def down, do: :ok
|
||||||
|
end
|
|
@ -1 +1 @@
|
||||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no"><title>Pleroma</title><!--server-generated-meta--><link rel=icon type=image/png href=/favicon.png><link href=/static/css/app.77b1644622e3bae24b6b.css rel=stylesheet><link href=/static/fontello.1598361006087.css rel=stylesheet></head><body class=hidden><noscript>To use Pleroma, please enable JavaScript.</noscript><div id=app></div><script type=text/javascript src=/static/js/vendors~app.bc5812c087f5dbcb914d.js></script><script type=text/javascript src=/static/js/app.154c25316542278028a6.js></script></body></html>
|
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no"><title>Pleroma</title><!--server-generated-meta--><link rel=icon type=image/png href=/favicon.png><link href=/static/css/app.77b1644622e3bae24b6b.css rel=stylesheet><link href=/static/fontello.1599568314856.css rel=stylesheet></head><body class=hidden><noscript>To use Pleroma, please enable JavaScript.</noscript><div id=app></div><script type=text/javascript src=/static/js/vendors~app.90c4af83c1ae68f4cd95.js></script><script type=text/javascript src=/static/js/app.55d173dc5e39519aa518.js></script></body></html>
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/font/fontello.1599568314856.woff2
Normal file
BIN
priv/static/static/font/fontello.1599568314856.woff2
Normal file
Binary file not shown.
|
@ -1,11 +1,11 @@
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Icons";
|
font-family: "Icons";
|
||||||
src: url("./font/fontello.1598361006087.eot");
|
src: url("./font/fontello.1599568314856.eot");
|
||||||
src: url("./font/fontello.1598361006087.eot") format("embedded-opentype"),
|
src: url("./font/fontello.1599568314856.eot") format("embedded-opentype"),
|
||||||
url("./font/fontello.1598361006087.woff2") format("woff2"),
|
url("./font/fontello.1599568314856.woff2") format("woff2"),
|
||||||
url("./font/fontello.1598361006087.woff") format("woff"),
|
url("./font/fontello.1599568314856.woff") format("woff"),
|
||||||
url("./font/fontello.1598361006087.ttf") format("truetype"),
|
url("./font/fontello.1599568314856.ttf") format("truetype"),
|
||||||
url("./font/fontello.1598361006087.svg") format("svg");
|
url("./font/fontello.1599568314856.svg") format("svg");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
2
priv/static/static/js/10.46fbbdfaf0d4800f349b.js
Normal file
2
priv/static/static/js/10.46fbbdfaf0d4800f349b.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/10.1c5cd5fbe554eca63dfe.js","sourceRoot":""}
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/10.46fbbdfaf0d4800f349b.js","sourceRoot":""}
|
File diff suppressed because one or more lines are too long
2
priv/static/static/js/12.b3bf0bc313861d6ec36b.js
Normal file
2
priv/static/static/js/12.b3bf0bc313861d6ec36b.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/12.6619e0b2f854637e76d4.js","sourceRoot":""}
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/12.b3bf0bc313861d6ec36b.js","sourceRoot":""}
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/13.c843797f3e374f0e3e1a.js","sourceRoot":""}
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/13.adb8a942514d735722c4.js","sourceRoot":""}
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/14.71f8caca49093a99e871.js","sourceRoot":""}
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/14.d015d9b2ea16407e389c.js","sourceRoot":""}
|
File diff suppressed because one or more lines are too long
1
priv/static/static/js/18.94946caca48930c224c7.js.map
Normal file
1
priv/static/static/js/18.94946caca48930c224c7.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/18.94946caca48930c224c7.js","sourceRoot":""}
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/18.b29eedabe76445fe94b8.js","sourceRoot":""}
|
|
File diff suppressed because one or more lines are too long
1
priv/static/static/js/19.233c81ac2c28d55e9f13.js.map
Normal file
1
priv/static/static/js/19.233c81ac2c28d55e9f13.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/19.233c81ac2c28d55e9f13.js","sourceRoot":""}
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/19.ed1cd5db596618779f03.js","sourceRoot":""}
|
|
File diff suppressed because one or more lines are too long
1
priv/static/static/js/2.c92f4803ff24726cea58.js.map
Normal file
1
priv/static/static/js/2.c92f4803ff24726cea58.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/20.6d311b830d8ac672729f.js","sourceRoot":""}
|
|
File diff suppressed because one or more lines are too long
1
priv/static/static/js/20.818c38d27369c3a4d677.js.map
Normal file
1
priv/static/static/js/20.818c38d27369c3a4d677.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/20.818c38d27369c3a4d677.js","sourceRoot":""}
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/23.2c5f0fd2f2acd04592e8.js","sourceRoot":""}
|
|
File diff suppressed because one or more lines are too long
1
priv/static/static/js/23.a57a7845cc20fafd06d1.js.map
Normal file
1
priv/static/static/js/23.a57a7845cc20fafd06d1.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/23.a57a7845cc20fafd06d1.js","sourceRoot":""}
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/25.365514e44606a895ab50.js","sourceRoot":""}
|
|
File diff suppressed because one or more lines are too long
1
priv/static/static/js/25.5a9efe20e3ae1352e6d2.js.map
Normal file
1
priv/static/static/js/25.5a9efe20e3ae1352e6d2.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/25.5a9efe20e3ae1352e6d2.js","sourceRoot":""}
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/28.9eb3e783aeba24c84f0a.js","sourceRoot":""}
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue