mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-18 07:48:19 +00:00
Merge remote-tracking branch 'upstream/develop' into by-approval
This commit is contained in:
commit
6931dbfa58
|
@ -8,9 +8,7 @@
|
||||||
|
|
||||||
### Environment
|
### Environment
|
||||||
|
|
||||||
* Installation type:
|
* Installation type (OTP or From Source):
|
||||||
- [ ] OTP
|
|
||||||
- [ ] From source
|
|
||||||
* Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE):
|
* Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE):
|
||||||
* Elixir version (`elixir -v` for from source installations, N/A for OTP):
|
* Elixir version (`elixir -v` for from source installations, N/A for OTP):
|
||||||
* Operating system:
|
* Operating system:
|
||||||
|
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- **Breaking:** Elixir >=1.9 is now required (was >= 1.8)
|
- **Breaking:** Elixir >=1.9 is now required (was >= 1.8)
|
||||||
|
- **Breaking:** Configuration: `:auto_linker, :opts` moved to `:pleroma, Pleroma.Formatter`. Old config namespace is deprecated.
|
||||||
- In Conversations, return only direct messages as `last_status`
|
- In Conversations, return only direct messages as `last_status`
|
||||||
- Using the `only_media` filter on timelines will now exclude reblog media
|
- Using the `only_media` filter on timelines will now exclude reblog media
|
||||||
- MFR policy to set global expiration for all local Create activities
|
- MFR policy to set global expiration for all local Create activities
|
||||||
|
@ -25,6 +26,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Mastodon API: Added `pleroma.metadata.fields_limits` to /api/v1/instance
|
- Mastodon API: Added `pleroma.metadata.fields_limits` to /api/v1/instance
|
||||||
- Mastodon API: On deletion, returns the original post text.
|
- Mastodon API: On deletion, returns the original post text.
|
||||||
- Mastodon API: Add `pleroma.unread_count` to the Marker entity.
|
- Mastodon API: Add `pleroma.unread_count` to the Marker entity.
|
||||||
|
- **Breaking:** Notification Settings API for suppressing notifications
|
||||||
|
has been simplified down to `block_from_strangers`.
|
||||||
|
- **Breaking:** Notification Settings API option for hiding push notification
|
||||||
|
contents has been renamed to `hide_notification_contents`
|
||||||
|
- Mastodon API: Added `pleroma.metadata.post_formats` to /api/v1/instance
|
||||||
|
- Mastodon API (legacy): Allow query parameters for `/api/v1/domain_blocks`, e.g. `/api/v1/domain_blocks?domain=badposters.zone`
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
@ -63,7 +70,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>API Changes</summary>
|
<summary>API Changes</summary>
|
||||||
- Mastodon API: Add pleroma.parents_visible field to statuses.
|
|
||||||
|
- Mastodon API: Add pleroma.parent_visible field to statuses.
|
||||||
- Mastodon API: Extended `/api/v1/instance`.
|
- Mastodon API: Extended `/api/v1/instance`.
|
||||||
- Mastodon API: Support for `include_types` in `/api/v1/notifications`.
|
- Mastodon API: Support for `include_types` in `/api/v1/notifications`.
|
||||||
- Mastodon API: Added `/api/v1/notifications/:id/dismiss` endpoint.
|
- Mastodon API: Added `/api/v1/notifications/:id/dismiss` endpoint.
|
||||||
|
@ -88,6 +96,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Admin API: fix `GET /api/pleroma/admin/users/:nickname/credentials` returning 404 when getting the credentials of a remote user while `:instance, :limit_to_local_content` is set to `:unauthenticated`
|
- Admin API: fix `GET /api/pleroma/admin/users/:nickname/credentials` returning 404 when getting the credentials of a remote user while `:instance, :limit_to_local_content` is set to `:unauthenticated`
|
||||||
- Fix CSP policy generation to include remote Captcha services
|
- Fix CSP policy generation to include remote Captcha services
|
||||||
- Fix edge case where MediaProxy truncates media, usually caused when Caddy is serving content for the other Federated instance.
|
- Fix edge case where MediaProxy truncates media, usually caused when Caddy is serving content for the other Federated instance.
|
||||||
|
- Emoji Packs could not be listed when instance was set to `public: false`
|
||||||
|
|
||||||
## [Unreleased (patch)]
|
## [Unreleased (patch)]
|
||||||
|
|
||||||
|
@ -117,6 +126,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Follow request notifications
|
- Follow request notifications
|
||||||
<details>
|
<details>
|
||||||
<summary>API Changes</summary>
|
<summary>API Changes</summary>
|
||||||
|
|
||||||
- Admin API: `GET /api/pleroma/admin/need_reboot`.
|
- Admin API: `GET /api/pleroma/admin/need_reboot`.
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
@ -184,6 +194,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- **Breaking**: Using third party engines for user recommendation
|
- **Breaking**: Using third party engines for user recommendation
|
||||||
<details>
|
<details>
|
||||||
<summary>API Changes</summary>
|
<summary>API Changes</summary>
|
||||||
|
|
||||||
- **Breaking**: AdminAPI: migrate_from_db endpoint
|
- **Breaking**: AdminAPI: migrate_from_db endpoint
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ config :mime, :types, %{
|
||||||
"application/ld+json" => ["activity+json"]
|
"application/ld+json" => ["activity+json"]
|
||||||
}
|
}
|
||||||
|
|
||||||
config :tesla, adapter: Tesla.Adapter.Hackney
|
config :tesla, adapter: Tesla.Adapter.Gun
|
||||||
|
|
||||||
# Configures http settings, upstream proxy etc.
|
# Configures http settings, upstream proxy etc.
|
||||||
config :pleroma, :http,
|
config :pleroma, :http,
|
||||||
|
@ -513,6 +513,7 @@ config :pleroma, Oban,
|
||||||
attachments_cleanup: 5,
|
attachments_cleanup: 5,
|
||||||
new_users_digest: 1
|
new_users_digest: 1
|
||||||
],
|
],
|
||||||
|
plugins: [Oban.Plugins.Pruner],
|
||||||
crontab: [
|
crontab: [
|
||||||
{"0 0 * * *", Pleroma.Workers.Cron.ClearOauthTokenWorker},
|
{"0 0 * * *", Pleroma.Workers.Cron.ClearOauthTokenWorker},
|
||||||
{"0 * * * *", Pleroma.Workers.Cron.StatsWorker},
|
{"0 * * * *", Pleroma.Workers.Cron.StatsWorker},
|
||||||
|
@ -527,16 +528,14 @@ config :pleroma, :workers,
|
||||||
federator_outgoing: 5
|
federator_outgoing: 5
|
||||||
]
|
]
|
||||||
|
|
||||||
config :auto_linker,
|
config :pleroma, Pleroma.Formatter,
|
||||||
opts: [
|
class: false,
|
||||||
extra: true,
|
rel: "ugc",
|
||||||
# TODO: Set to :no_scheme when it works properly
|
new_window: false,
|
||||||
validate_tld: true,
|
truncate: false,
|
||||||
class: false,
|
strip_prefix: false,
|
||||||
strip_prefix: false,
|
extra: true,
|
||||||
new_window: false,
|
validate_tld: :no_scheme
|
||||||
rel: "ugc"
|
|
||||||
]
|
|
||||||
|
|
||||||
config :pleroma, :ldap,
|
config :pleroma, :ldap,
|
||||||
enabled: System.get_env("LDAP_ENABLED") == "true",
|
enabled: System.get_env("LDAP_ENABLED") == "true",
|
||||||
|
@ -648,32 +647,30 @@ config :pleroma, Pleroma.Repo,
|
||||||
prepare: :unnamed
|
prepare: :unnamed
|
||||||
|
|
||||||
config :pleroma, :connections_pool,
|
config :pleroma, :connections_pool,
|
||||||
checkin_timeout: 250,
|
reclaim_multiplier: 0.1,
|
||||||
|
connection_acquisition_wait: 250,
|
||||||
|
connection_acquisition_retries: 5,
|
||||||
max_connections: 250,
|
max_connections: 250,
|
||||||
retry: 1,
|
max_idle_time: 30_000,
|
||||||
retry_timeout: 1000,
|
retry: 0,
|
||||||
await_up_timeout: 5_000
|
await_up_timeout: 5_000
|
||||||
|
|
||||||
config :pleroma, :pools,
|
config :pleroma, :pools,
|
||||||
federation: [
|
federation: [
|
||||||
size: 50,
|
size: 50,
|
||||||
max_overflow: 10,
|
max_waiting: 10
|
||||||
timeout: 150_000
|
|
||||||
],
|
],
|
||||||
media: [
|
media: [
|
||||||
size: 50,
|
size: 50,
|
||||||
max_overflow: 10,
|
max_waiting: 10
|
||||||
timeout: 150_000
|
|
||||||
],
|
],
|
||||||
upload: [
|
upload: [
|
||||||
size: 25,
|
size: 25,
|
||||||
max_overflow: 5,
|
max_waiting: 5
|
||||||
timeout: 300_000
|
|
||||||
],
|
],
|
||||||
default: [
|
default: [
|
||||||
size: 10,
|
size: 10,
|
||||||
max_overflow: 2,
|
max_waiting: 2
|
||||||
timeout: 10_000
|
|
||||||
]
|
]
|
||||||
|
|
||||||
config :pleroma, :hackney_pools,
|
config :pleroma, :hackney_pools,
|
||||||
|
|
|
@ -1431,6 +1431,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_simple,
|
key: :mrf_simple,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.SimplePolicy",
|
||||||
label: "MRF Simple",
|
label: "MRF Simple",
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Simple ingress policies",
|
description: "Simple ingress policies",
|
||||||
|
@ -1497,6 +1498,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_activity_expiration,
|
key: :mrf_activity_expiration,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy",
|
||||||
label: "MRF Activity Expiration Policy",
|
label: "MRF Activity Expiration Policy",
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Adds automatic expiration to all local activities",
|
description: "Adds automatic expiration to all local activities",
|
||||||
|
@ -1513,6 +1515,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_subchain,
|
key: :mrf_subchain,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.SubchainPolicy",
|
||||||
label: "MRF Subchain",
|
label: "MRF Subchain",
|
||||||
type: :group,
|
type: :group,
|
||||||
description:
|
description:
|
||||||
|
@ -1535,6 +1538,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_rejectnonpublic,
|
key: :mrf_rejectnonpublic,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.RejectNonPublic",
|
||||||
description: "RejectNonPublic drops posts with non-public visibility settings.",
|
description: "RejectNonPublic drops posts with non-public visibility settings.",
|
||||||
label: "MRF Reject Non Public",
|
label: "MRF Reject Non Public",
|
||||||
type: :group,
|
type: :group,
|
||||||
|
@ -1556,6 +1560,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_hellthread,
|
key: :mrf_hellthread,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.HellthreadPolicy",
|
||||||
label: "MRF Hellthread",
|
label: "MRF Hellthread",
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Block messages with excessive user mentions",
|
description: "Block messages with excessive user mentions",
|
||||||
|
@ -1581,6 +1586,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_keyword,
|
key: :mrf_keyword,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.KeywordPolicy",
|
||||||
label: "MRF Keyword",
|
label: "MRF Keyword",
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Reject or Word-Replace messages with a keyword or regex",
|
description: "Reject or Word-Replace messages with a keyword or regex",
|
||||||
|
@ -1612,6 +1618,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_mention,
|
key: :mrf_mention,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.MentionPolicy",
|
||||||
label: "MRF Mention",
|
label: "MRF Mention",
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Block messages which mention a specific user",
|
description: "Block messages which mention a specific user",
|
||||||
|
@ -1628,6 +1635,7 @@ config :pleroma, :config_description, [
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_vocabulary,
|
key: :mrf_vocabulary,
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.VocabularyPolicy",
|
||||||
label: "MRF Vocabulary",
|
label: "MRF Vocabulary",
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Filter messages which belong to certain activity vocabularies",
|
description: "Filter messages which belong to certain activity vocabularies",
|
||||||
|
@ -1651,6 +1659,8 @@ config :pleroma, :config_description, [
|
||||||
# %{
|
# %{
|
||||||
# group: :pleroma,
|
# group: :pleroma,
|
||||||
# key: :mrf_user_allowlist,
|
# key: :mrf_user_allowlist,
|
||||||
|
# tab: :mrf,
|
||||||
|
# related_policy: "Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy",
|
||||||
# type: :map,
|
# type: :map,
|
||||||
# description:
|
# description:
|
||||||
# "The keys in this section are the domain names that the policy should apply to." <>
|
# "The keys in this section are the domain names that the policy should apply to." <>
|
||||||
|
@ -2221,11 +2231,12 @@ config :pleroma, :config_description, [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
group: :auto_linker,
|
group: :pleroma,
|
||||||
key: :opts,
|
key: Pleroma.Formatter,
|
||||||
label: "Auto Linker",
|
label: "Auto Linker",
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Configuration for the auto_linker library",
|
description:
|
||||||
|
"Configuration for Pleroma's link formatter which parses mentions, hashtags, and URLs.",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :class,
|
key: :class,
|
||||||
|
@ -2242,24 +2253,31 @@ config :pleroma, :config_description, [
|
||||||
%{
|
%{
|
||||||
key: :new_window,
|
key: :new_window,
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Link URLs will open in new window/tab"
|
description: "Link URLs will open in a new window/tab."
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :truncate,
|
key: :truncate,
|
||||||
type: [:integer, false],
|
type: [:integer, false],
|
||||||
description:
|
description:
|
||||||
"Set to a number to truncate URLs longer then the number. Truncated URLs will end in `..`",
|
"Set to a number to truncate URLs longer than the number. Truncated URLs will end in `...`",
|
||||||
suggestions: [15, false]
|
suggestions: [15, false]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :strip_prefix,
|
key: :strip_prefix,
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Strip the scheme prefix"
|
description: "Strip the scheme prefix."
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :extra,
|
key: :extra,
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
description: "Link URLs with rarely used schemes (magnet, ipfs, irc, etc.)"
|
description: "Link URLs with rarely used schemes (magnet, ipfs, irc, etc.)"
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :validate_tld,
|
||||||
|
type: [:atom, :boolean],
|
||||||
|
description:
|
||||||
|
"Set to false to disable TLD validation for URLs/emails. Can be set to :no_scheme to validate TLDs only for URLs without a scheme (e.g `example.com` will be validated, but `http://example.loki` won't)",
|
||||||
|
suggestions: [:no_scheme, true]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -2907,8 +2925,9 @@ config :pleroma, :config_description, [
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
tab: :mrf,
|
|
||||||
key: :mrf_normalize_markup,
|
key: :mrf_normalize_markup,
|
||||||
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.NormalizeMarkup",
|
||||||
label: "MRF Normalize Markup",
|
label: "MRF Normalize Markup",
|
||||||
description: "MRF NormalizeMarkup settings. Scrub configured hypertext markup.",
|
description: "MRF NormalizeMarkup settings. Scrub configured hypertext markup.",
|
||||||
type: :group,
|
type: :group,
|
||||||
|
@ -3103,8 +3122,9 @@ config :pleroma, :config_description, [
|
||||||
%{
|
%{
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
key: :mrf_object_age,
|
key: :mrf_object_age,
|
||||||
label: "MRF Object Age",
|
|
||||||
tab: :mrf,
|
tab: :mrf,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy",
|
||||||
|
label: "MRF Object Age",
|
||||||
type: :group,
|
type: :group,
|
||||||
description:
|
description:
|
||||||
"Rejects or delists posts based on their timestamp deviance from your server's clock.",
|
"Rejects or delists posts based on their timestamp deviance from your server's clock.",
|
||||||
|
@ -3166,36 +3186,37 @@ config :pleroma, :config_description, [
|
||||||
description: "Advanced settings for `gun` connections pool",
|
description: "Advanced settings for `gun` connections pool",
|
||||||
children: [
|
children: [
|
||||||
%{
|
%{
|
||||||
key: :checkin_timeout,
|
key: :connection_acquisition_wait,
|
||||||
type: :integer,
|
type: :integer,
|
||||||
description: "Timeout to checkin connection from pool. Default: 250ms.",
|
description:
|
||||||
|
"Timeout to acquire a connection from pool.The total max time is this value multiplied by the number of retries. Default: 250ms.",
|
||||||
suggestions: [250]
|
suggestions: [250]
|
||||||
},
|
},
|
||||||
|
%{
|
||||||
|
key: :connection_acquisition_retries,
|
||||||
|
type: :integer,
|
||||||
|
description:
|
||||||
|
"Number of attempts to acquire the connection from the pool if it is overloaded. Default: 5",
|
||||||
|
suggestions: [5]
|
||||||
|
},
|
||||||
%{
|
%{
|
||||||
key: :max_connections,
|
key: :max_connections,
|
||||||
type: :integer,
|
type: :integer,
|
||||||
description: "Maximum number of connections in the pool. Default: 250 connections.",
|
description: "Maximum number of connections in the pool. Default: 250 connections.",
|
||||||
suggestions: [250]
|
suggestions: [250]
|
||||||
},
|
},
|
||||||
%{
|
|
||||||
key: :retry,
|
|
||||||
type: :integer,
|
|
||||||
description:
|
|
||||||
"Number of retries, while `gun` will try to reconnect if connection goes down. Default: 1.",
|
|
||||||
suggestions: [1]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :retry_timeout,
|
|
||||||
type: :integer,
|
|
||||||
description:
|
|
||||||
"Time between retries when `gun` will try to reconnect in milliseconds. Default: 1000ms.",
|
|
||||||
suggestions: [1000]
|
|
||||||
},
|
|
||||||
%{
|
%{
|
||||||
key: :await_up_timeout,
|
key: :await_up_timeout,
|
||||||
type: :integer,
|
type: :integer,
|
||||||
description: "Timeout while `gun` will wait until connection is up. Default: 5000ms.",
|
description: "Timeout while `gun` will wait until connection is up. Default: 5000ms.",
|
||||||
suggestions: [5000]
|
suggestions: [5000]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :reclaim_multiplier,
|
||||||
|
type: :integer,
|
||||||
|
description:
|
||||||
|
"Multiplier for the number of idle connection to be reclaimed if the pool is full. For example if the pool maxes out at 250 connections and this setting is set to 0.3, the pool will reclaim at most 75 idle connections if it's overloaded. Default: 0.1",
|
||||||
|
suggestions: [0.1]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -3204,108 +3225,29 @@ config :pleroma, :config_description, [
|
||||||
key: :pools,
|
key: :pools,
|
||||||
type: :group,
|
type: :group,
|
||||||
description: "Advanced settings for `gun` workers pools",
|
description: "Advanced settings for `gun` workers pools",
|
||||||
children: [
|
children:
|
||||||
%{
|
Enum.map([:federation, :media, :upload, :default], fn pool_name ->
|
||||||
key: :federation,
|
%{
|
||||||
type: :keyword,
|
key: pool_name,
|
||||||
description: "Settings for federation pool.",
|
type: :keyword,
|
||||||
children: [
|
description: "Settings for #{pool_name} pool.",
|
||||||
%{
|
children: [
|
||||||
key: :size,
|
%{
|
||||||
type: :integer,
|
key: :size,
|
||||||
description: "Number workers in the pool.",
|
type: :integer,
|
||||||
suggestions: [50]
|
description: "Maximum number of concurrent requests in the pool.",
|
||||||
},
|
suggestions: [50]
|
||||||
%{
|
},
|
||||||
key: :max_overflow,
|
%{
|
||||||
type: :integer,
|
key: :max_waiting,
|
||||||
description: "Number of additional workers if pool is under load.",
|
type: :integer,
|
||||||
suggestions: [10]
|
description:
|
||||||
},
|
"Maximum number of requests waiting for other requests to finish. After this number is reached, the pool will start returning errrors when a new request is made",
|
||||||
%{
|
suggestions: [10]
|
||||||
key: :timeout,
|
}
|
||||||
type: :integer,
|
]
|
||||||
description: "Timeout while `gun` will wait for response.",
|
}
|
||||||
suggestions: [150_000]
|
end)
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :media,
|
|
||||||
type: :keyword,
|
|
||||||
description: "Settings for media pool.",
|
|
||||||
children: [
|
|
||||||
%{
|
|
||||||
key: :size,
|
|
||||||
type: :integer,
|
|
||||||
description: "Number workers in the pool.",
|
|
||||||
suggestions: [50]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :max_overflow,
|
|
||||||
type: :integer,
|
|
||||||
description: "Number of additional workers if pool is under load.",
|
|
||||||
suggestions: [10]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :timeout,
|
|
||||||
type: :integer,
|
|
||||||
description: "Timeout while `gun` will wait for response.",
|
|
||||||
suggestions: [150_000]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :upload,
|
|
||||||
type: :keyword,
|
|
||||||
description: "Settings for upload pool.",
|
|
||||||
children: [
|
|
||||||
%{
|
|
||||||
key: :size,
|
|
||||||
type: :integer,
|
|
||||||
description: "Number workers in the pool.",
|
|
||||||
suggestions: [25]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :max_overflow,
|
|
||||||
type: :integer,
|
|
||||||
description: "Number of additional workers if pool is under load.",
|
|
||||||
suggestions: [5]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :timeout,
|
|
||||||
type: :integer,
|
|
||||||
description: "Timeout while `gun` will wait for response.",
|
|
||||||
suggestions: [300_000]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :default,
|
|
||||||
type: :keyword,
|
|
||||||
description: "Settings for default pool.",
|
|
||||||
children: [
|
|
||||||
%{
|
|
||||||
key: :size,
|
|
||||||
type: :integer,
|
|
||||||
description: "Number workers in the pool.",
|
|
||||||
suggestions: [10]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :max_overflow,
|
|
||||||
type: :integer,
|
|
||||||
description: "Number of additional workers if pool is under load.",
|
|
||||||
suggestions: [2]
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
key: :timeout,
|
|
||||||
type: :integer,
|
|
||||||
description: "Timeout while `gun` will wait for response.",
|
|
||||||
suggestions: [10_000]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
group: :pleroma,
|
group: :pleroma,
|
||||||
|
|
|
@ -236,6 +236,7 @@ Has theses additional parameters (which are the same as in Pleroma-API):
|
||||||
- `pleroma.metadata.features`: A list of supported features
|
- `pleroma.metadata.features`: A list of supported features
|
||||||
- `pleroma.metadata.federation`: The federation restrictions of this instance
|
- `pleroma.metadata.federation`: The federation restrictions of this instance
|
||||||
- `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields.
|
- `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields.
|
||||||
|
- `pleroma.metadata.post_formats`: A list of the allowed post format types
|
||||||
- `vapid_public_key`: The public key needed for push messages
|
- `vapid_public_key`: The public key needed for push messages
|
||||||
|
|
||||||
## Markers
|
## Markers
|
||||||
|
|
|
@ -287,11 +287,8 @@ See [Admin-API](admin_api.md)
|
||||||
* Method `PUT`
|
* Method `PUT`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
* Params:
|
* Params:
|
||||||
* `followers`: BOOLEAN field, receives notifications from followers
|
* `block_from_strangers`: BOOLEAN field, blocks notifications from accounts you do not follow
|
||||||
* `follows`: BOOLEAN field, receives notifications from people the user follows
|
* `hide_notification_contents`: BOOLEAN field. When set to true, it removes the contents of a message from the push notification.
|
||||||
* `remote`: BOOLEAN field, receives notifications from people on remote instances
|
|
||||||
* `local`: BOOLEAN field, receives notifications from people on the local instance
|
|
||||||
* `privacy_option`: BOOLEAN field. When set to true, it removes the contents of a message from the push notification.
|
|
||||||
* Response: JSON. Returns `{"status": "success"}` if the update was successful, otherwise returns `{"error": "error_msg"}`
|
* Response: JSON. Returns `{"status": "success"}` if the update was successful, otherwise returns `{"error": "error_msg"}`
|
||||||
|
|
||||||
## `/api/pleroma/healthcheck`
|
## `/api/pleroma/healthcheck`
|
||||||
|
|
|
@ -449,36 +449,32 @@ For each pool, the options are:
|
||||||
|
|
||||||
*For `gun` adapter*
|
*For `gun` adapter*
|
||||||
|
|
||||||
Advanced settings for connections pool. Pool with opened connections. These connections can be reused in worker pools.
|
Settings for HTTP connection pool.
|
||||||
|
|
||||||
For big instances it's recommended to increase `config :pleroma, :connections_pool, max_connections: 500` up to 500-1000.
|
* `:connection_acquisition_wait` - Timeout to acquire a connection from pool.The total max time is this value multiplied by the number of retries.
|
||||||
It will increase memory usage, but federation would work faster.
|
* `connection_acquisition_retries` - Number of attempts to acquire the connection from the pool if it is overloaded. Each attempt is timed `:connection_acquisition_wait` apart.
|
||||||
|
* `:max_connections` - Maximum number of connections in the pool.
|
||||||
* `:checkin_timeout` - timeout to checkin connection from pool. Default: 250ms.
|
* `:await_up_timeout` - Timeout to connect to the host.
|
||||||
* `:max_connections` - maximum number of connections in the pool. Default: 250 connections.
|
* `:reclaim_multiplier` - Multiplied by `:max_connections` this will be the maximum number of idle connections that will be reclaimed in case the pool is overloaded.
|
||||||
* `:retry` - number of retries, while `gun` will try to reconnect if connection goes down. Default: 1.
|
|
||||||
* `:retry_timeout` - time between retries when `gun` will try to reconnect in milliseconds. Default: 1000ms.
|
|
||||||
* `:await_up_timeout` - timeout while `gun` will wait until connection is up. Default: 5000ms.
|
|
||||||
|
|
||||||
### :pools
|
### :pools
|
||||||
|
|
||||||
*For `gun` adapter*
|
*For `gun` adapter*
|
||||||
|
|
||||||
Advanced settings for workers pools.
|
Settings for request pools. These pools are limited on top of `:connections_pool`.
|
||||||
|
|
||||||
There are four pools used:
|
There are four pools used:
|
||||||
|
|
||||||
* `:federation` for the federation jobs.
|
* `:federation` for the federation jobs. You may want this pool's max_connections to be at least equal to the number of federator jobs + retry queue jobs.
|
||||||
You may want this pool max_connections to be at least equal to the number of federator jobs + retry queue jobs.
|
* `:media` - for rich media, media proxy.
|
||||||
* `:media` for rich media, media proxy
|
* `:upload` - for proxying media when a remote uploader is used and `proxy_remote: true`.
|
||||||
* `:upload` for uploaded media (if using a remote uploader and `proxy_remote: true`)
|
* `:default` - for other requests.
|
||||||
* `:default` for other requests
|
|
||||||
|
|
||||||
For each pool, the options are:
|
For each pool, the options are:
|
||||||
|
|
||||||
* `:size` - how much workers the pool can hold
|
* `:size` - limit to how much requests can be concurrently executed.
|
||||||
* `:timeout` - timeout while `gun` will wait for response
|
* `:timeout` - timeout while `gun` will wait for response
|
||||||
* `:max_overflow` - additional workers if pool is under load
|
* `:max_waiting` - limit to how much requests can be waiting for others to finish, after this is reached, subsequent requests will be dropped.
|
||||||
|
|
||||||
## Captcha
|
## Captcha
|
||||||
|
|
||||||
|
@ -939,30 +935,29 @@ Configure OAuth 2 provider capabilities:
|
||||||
### :uri_schemes
|
### :uri_schemes
|
||||||
* `valid_schemes`: List of the scheme part that is considered valid to be an URL.
|
* `valid_schemes`: List of the scheme part that is considered valid to be an URL.
|
||||||
|
|
||||||
### :auto_linker
|
### Pleroma.Formatter
|
||||||
|
|
||||||
Configuration for the `auto_linker` library:
|
Configuration for Pleroma's link formatter which parses mentions, hashtags, and URLs.
|
||||||
|
|
||||||
* `class: "auto-linker"` - specify the class to be added to the generated link. false to clear.
|
* `class` - specify the class to be added to the generated link (default: `false`)
|
||||||
* `rel: "noopener noreferrer"` - override the rel attribute. false to clear.
|
* `rel` - specify the rel attribute (default: `ugc`)
|
||||||
* `new_window: true` - set to false to remove `target='_blank'` attribute.
|
* `new_window` - adds `target="_blank"` attribute (default: `false`)
|
||||||
* `scheme: false` - Set to true to link urls with schema `http://google.com`.
|
* `truncate` - Set to a number to truncate URLs longer then the number. Truncated URLs will end in `...` (default: `false`)
|
||||||
* `truncate: false` - Set to a number to truncate urls longer then the number. Truncated urls will end in `..`.
|
* `strip_prefix` - Strip the scheme prefix (default: `false`)
|
||||||
* `strip_prefix: true` - Strip the scheme prefix.
|
* `extra` - link URLs with rarely used schemes (magnet, ipfs, irc, etc.) (default: `true`)
|
||||||
* `extra: false` - link urls with rarely used schemes (magnet, ipfs, irc, etc.).
|
* `validate_tld` - Set to false to disable TLD validation for URLs/emails. Can be set to :no_scheme to validate TLDs only for urls without a scheme (e.g `example.com` will be validated, but `http://example.loki` won't) (default: `:no_scheme`)
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
config :auto_linker,
|
config :pleroma, Pleroma.Formatter,
|
||||||
opts: [
|
class: false,
|
||||||
scheme: true,
|
rel: "ugc",
|
||||||
extra: true,
|
new_window: false,
|
||||||
class: false,
|
truncate: false,
|
||||||
strip_prefix: false,
|
strip_prefix: false,
|
||||||
new_window: false,
|
extra: true,
|
||||||
rel: "ugc"
|
validate_tld: :no_scheme
|
||||||
]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Custom Runtime Modules (`:modules`)
|
## Custom Runtime Modules (`:modules`)
|
||||||
|
|
|
@ -24,8 +24,10 @@ defmodule Mix.Pleroma do
|
||||||
Application.put_env(:logger, :console, level: :debug)
|
Application.put_env(:logger, :console, level: :debug)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
adapter = Application.get_env(:tesla, :adapter)
|
||||||
|
|
||||||
apps =
|
apps =
|
||||||
if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Gun do
|
if adapter == Tesla.Adapter.Gun do
|
||||||
[:gun | @apps]
|
[:gun | @apps]
|
||||||
else
|
else
|
||||||
[:hackney | @apps]
|
[:hackney | @apps]
|
||||||
|
@ -33,11 +35,14 @@ defmodule Mix.Pleroma do
|
||||||
|
|
||||||
Enum.each(apps, &Application.ensure_all_started/1)
|
Enum.each(apps, &Application.ensure_all_started/1)
|
||||||
|
|
||||||
children = [
|
children =
|
||||||
Pleroma.Repo,
|
[
|
||||||
{Pleroma.Config.TransferTask, false},
|
Pleroma.Repo,
|
||||||
Pleroma.Web.Endpoint
|
{Pleroma.Config.TransferTask, false},
|
||||||
]
|
Pleroma.Web.Endpoint,
|
||||||
|
{Oban, Pleroma.Config.get(Oban)}
|
||||||
|
] ++
|
||||||
|
http_children(adapter)
|
||||||
|
|
||||||
cachex_children = Enum.map(@cachex_children, &Pleroma.Application.build_cachex(&1, []))
|
cachex_children = Enum.map(@cachex_children, &Pleroma.Application.build_cachex(&1, []))
|
||||||
|
|
||||||
|
@ -115,4 +120,11 @@ defmodule Mix.Pleroma do
|
||||||
def escape_sh_path(path) do
|
def escape_sh_path(path) do
|
||||||
~S(') <> String.replace(path, ~S('), ~S(\')) <> ~S(')
|
~S(') <> String.replace(path, ~S('), ~S(\')) <> ~S(')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp http_children(Tesla.Adapter.Gun) do
|
||||||
|
Pleroma.Gun.ConnectionPool.children() ++
|
||||||
|
[{Task, &Pleroma.HTTP.AdapterHelper.Gun.limiter_setup/0}]
|
||||||
|
end
|
||||||
|
|
||||||
|
defp http_children(_), do: []
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,8 +3,8 @@ defmodule Mix.Tasks.Pleroma.NotificationSettings do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
> mix pleroma.notification_settings --privacy-option=false --nickname-users="parallel588" # set false only for parallel588 user
|
> mix pleroma.notification_settings --hide-notification-contents=false --nickname-users="parallel588" # set false only for parallel588 user
|
||||||
> mix pleroma.notification_settings --privacy-option=true # set true for all users
|
> mix pleroma.notification_settings --hide-notification-contents=true # set true for all users
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -19,16 +19,16 @@ defmodule Mix.Tasks.Pleroma.NotificationSettings do
|
||||||
OptionParser.parse(
|
OptionParser.parse(
|
||||||
args,
|
args,
|
||||||
strict: [
|
strict: [
|
||||||
privacy_option: :boolean,
|
hide_notification_contents: :boolean,
|
||||||
email_users: :string,
|
email_users: :string,
|
||||||
nickname_users: :string
|
nickname_users: :string
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
privacy_option = Keyword.get(options, :privacy_option)
|
hide_notification_contents = Keyword.get(options, :hide_notification_contents)
|
||||||
|
|
||||||
if not is_nil(privacy_option) do
|
if not is_nil(hide_notification_contents) do
|
||||||
privacy_option
|
hide_notification_contents
|
||||||
|> build_query(options)
|
|> build_query(options)
|
||||||
|> Pleroma.Repo.update_all([])
|
|> Pleroma.Repo.update_all([])
|
||||||
end
|
end
|
||||||
|
@ -36,15 +36,15 @@ defmodule Mix.Tasks.Pleroma.NotificationSettings do
|
||||||
shell_info("Done")
|
shell_info("Done")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp build_query(privacy_option, options) do
|
defp build_query(hide_notification_contents, options) do
|
||||||
query =
|
query =
|
||||||
from(u in Pleroma.User,
|
from(u in Pleroma.User,
|
||||||
update: [
|
update: [
|
||||||
set: [
|
set: [
|
||||||
notification_settings:
|
notification_settings:
|
||||||
fragment(
|
fragment(
|
||||||
"jsonb_set(notification_settings, '{privacy_option}', ?)",
|
"jsonb_set(notification_settings, '{hide_notification_contents}', ?)",
|
||||||
^privacy_option
|
^hide_notification_contents
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
@ -39,6 +39,7 @@ defmodule Pleroma.Application do
|
||||||
# every time the application is restarted, so we disable module
|
# every time the application is restarted, so we disable module
|
||||||
# conflicts at runtime
|
# conflicts at runtime
|
||||||
Code.compiler_options(ignore_module_conflict: true)
|
Code.compiler_options(ignore_module_conflict: true)
|
||||||
|
Pleroma.Telemetry.Logger.attach()
|
||||||
Config.Holder.save_default()
|
Config.Holder.save_default()
|
||||||
Pleroma.HTML.compile_scrubbers()
|
Pleroma.HTML.compile_scrubbers()
|
||||||
Config.DeprecationWarnings.warn()
|
Config.DeprecationWarnings.warn()
|
||||||
|
@ -223,9 +224,7 @@ defmodule Pleroma.Application do
|
||||||
|
|
||||||
# start hackney and gun pools in tests
|
# start hackney and gun pools in tests
|
||||||
defp http_children(_, :test) do
|
defp http_children(_, :test) do
|
||||||
hackney_options = Config.get([:hackney_pools, :federation])
|
http_children(Tesla.Adapter.Hackney, nil) ++ http_children(Tesla.Adapter.Gun, nil)
|
||||||
hackney_pool = :hackney_pool.child_spec(:federation, hackney_options)
|
|
||||||
[hackney_pool, Pleroma.Pool.Supervisor]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp http_children(Tesla.Adapter.Hackney, _) do
|
defp http_children(Tesla.Adapter.Hackney, _) do
|
||||||
|
@ -244,7 +243,10 @@ defmodule Pleroma.Application do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp http_children(Tesla.Adapter.Gun, _), do: [Pleroma.Pool.Supervisor]
|
defp http_children(Tesla.Adapter.Gun, _) do
|
||||||
|
Pleroma.Gun.ConnectionPool.children() ++
|
||||||
|
[{Task, &Pleroma.HTTP.AdapterHelper.Gun.limiter_setup/0}]
|
||||||
|
end
|
||||||
|
|
||||||
defp http_children(_, _), do: []
|
defp http_children(_, _), do: []
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,6 +16,7 @@ defmodule Pleroma.ApplicationRequirements do
|
||||||
@spec verify!() :: :ok | VerifyError.t()
|
@spec verify!() :: :ok | VerifyError.t()
|
||||||
def verify! do
|
def verify! do
|
||||||
:ok
|
:ok
|
||||||
|
|> check_confirmation_accounts!
|
||||||
|> check_migrations_applied!()
|
|> check_migrations_applied!()
|
||||||
|> check_rum!()
|
|> check_rum!()
|
||||||
|> handle_result()
|
|> handle_result()
|
||||||
|
@ -24,6 +25,24 @@ defmodule Pleroma.ApplicationRequirements do
|
||||||
defp handle_result(:ok), do: :ok
|
defp handle_result(:ok), do: :ok
|
||||||
defp handle_result({:error, message}), do: raise(VerifyError, message: message)
|
defp handle_result({:error, message}), do: raise(VerifyError, message: message)
|
||||||
|
|
||||||
|
# Checks account confirmation email
|
||||||
|
#
|
||||||
|
def check_confirmation_accounts!(:ok) do
|
||||||
|
if Pleroma.Config.get([:instance, :account_activation_required]) &&
|
||||||
|
not Pleroma.Config.get([Pleroma.Emails.Mailer, :enabled]) do
|
||||||
|
Logger.error(
|
||||||
|
"Account activation enabled, but no Mailer settings enabled.\nPlease set config :pleroma, :instance, account_activation_required: false\nOtherwise setup and enable Mailer."
|
||||||
|
)
|
||||||
|
|
||||||
|
{:error,
|
||||||
|
"Account activation enabled, but Mailer is disabled. Cannot send confirmation emails."}
|
||||||
|
else
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_confirmation_accounts!(result), do: result
|
||||||
|
|
||||||
# Checks for pending migrations.
|
# Checks for pending migrations.
|
||||||
#
|
#
|
||||||
def check_migrations_applied!(:ok) do
|
def check_migrations_applied!(:ok) do
|
||||||
|
|
|
@ -156,7 +156,6 @@ defmodule Pleroma.ConfigDB do
|
||||||
{:quack, :meta},
|
{:quack, :meta},
|
||||||
{:mime, :types},
|
{:mime, :types},
|
||||||
{:cors_plug, [:max_age, :methods, :expose, :headers]},
|
{:cors_plug, [:max_age, :methods, :expose, :headers]},
|
||||||
{:auto_linker, :opts},
|
|
||||||
{:swarm, :node_blacklist},
|
{:swarm, :node_blacklist},
|
||||||
{:logger, :backends}
|
{:logger, :backends}
|
||||||
]
|
]
|
||||||
|
|
|
@ -10,11 +10,15 @@ defmodule Pleroma.Formatter do
|
||||||
@link_regex ~r"((?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~%:/?#[\]@!\$&'\(\)\*\+,;=.]+)|[0-9a-z+\-\.]+:[0-9a-z$-_.+!*'(),]+"ui
|
@link_regex ~r"((?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~%:/?#[\]@!\$&'\(\)\*\+,;=.]+)|[0-9a-z+\-\.]+:[0-9a-z$-_.+!*'(),]+"ui
|
||||||
@markdown_characters_regex ~r/(`|\*|_|{|}|[|]|\(|\)|#|\+|-|\.|!)/
|
@markdown_characters_regex ~r/(`|\*|_|{|}|[|]|\(|\)|#|\+|-|\.|!)/
|
||||||
|
|
||||||
@auto_linker_config hashtag: true,
|
defp linkify_opts do
|
||||||
hashtag_handler: &Pleroma.Formatter.hashtag_handler/4,
|
Pleroma.Config.get(Pleroma.Formatter) ++
|
||||||
mention: true,
|
[
|
||||||
mention_handler: &Pleroma.Formatter.mention_handler/4,
|
hashtag: true,
|
||||||
scheme: true
|
hashtag_handler: &Pleroma.Formatter.hashtag_handler/4,
|
||||||
|
mention: true,
|
||||||
|
mention_handler: &Pleroma.Formatter.mention_handler/4
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
def escape_mention_handler("@" <> nickname = mention, buffer, _, _) do
|
def escape_mention_handler("@" <> nickname = mention, buffer, _, _) do
|
||||||
case User.get_cached_by_nickname(nickname) do
|
case User.get_cached_by_nickname(nickname) do
|
||||||
|
@ -80,19 +84,19 @@ defmodule Pleroma.Formatter do
|
||||||
@spec linkify(String.t(), keyword()) ::
|
@spec linkify(String.t(), keyword()) ::
|
||||||
{String.t(), [{String.t(), User.t()}], [{String.t(), String.t()}]}
|
{String.t(), [{String.t(), User.t()}], [{String.t(), String.t()}]}
|
||||||
def linkify(text, options \\ []) do
|
def linkify(text, options \\ []) do
|
||||||
options = options ++ @auto_linker_config
|
options = linkify_opts() ++ options
|
||||||
|
|
||||||
if options[:safe_mention] && Regex.named_captures(@safe_mention_regex, text) do
|
if options[:safe_mention] && Regex.named_captures(@safe_mention_regex, text) do
|
||||||
%{"mentions" => mentions, "rest" => rest} = Regex.named_captures(@safe_mention_regex, text)
|
%{"mentions" => mentions, "rest" => rest} = Regex.named_captures(@safe_mention_regex, text)
|
||||||
acc = %{mentions: MapSet.new(), tags: MapSet.new()}
|
acc = %{mentions: MapSet.new(), tags: MapSet.new()}
|
||||||
|
|
||||||
{text_mentions, %{mentions: mentions}} = AutoLinker.link_map(mentions, acc, options)
|
{text_mentions, %{mentions: mentions}} = Linkify.link_map(mentions, acc, options)
|
||||||
{text_rest, %{tags: tags}} = AutoLinker.link_map(rest, acc, options)
|
{text_rest, %{tags: tags}} = Linkify.link_map(rest, acc, options)
|
||||||
|
|
||||||
{text_mentions <> text_rest, MapSet.to_list(mentions), MapSet.to_list(tags)}
|
{text_mentions <> text_rest, MapSet.to_list(mentions), MapSet.to_list(tags)}
|
||||||
else
|
else
|
||||||
acc = %{mentions: MapSet.new(), tags: MapSet.new()}
|
acc = %{mentions: MapSet.new(), tags: MapSet.new()}
|
||||||
{text, %{mentions: mentions, tags: tags}} = AutoLinker.link_map(text, acc, options)
|
{text, %{mentions: mentions, tags: tags}} = Linkify.link_map(text, acc, options)
|
||||||
|
|
||||||
{text, MapSet.to_list(mentions), MapSet.to_list(tags)}
|
{text, MapSet.to_list(mentions), MapSet.to_list(tags)}
|
||||||
end
|
end
|
||||||
|
@ -111,9 +115,9 @@ defmodule Pleroma.Formatter do
|
||||||
|
|
||||||
if options[:safe_mention] && Regex.named_captures(@safe_mention_regex, text) do
|
if options[:safe_mention] && Regex.named_captures(@safe_mention_regex, text) do
|
||||||
%{"mentions" => mentions, "rest" => rest} = Regex.named_captures(@safe_mention_regex, text)
|
%{"mentions" => mentions, "rest" => rest} = Regex.named_captures(@safe_mention_regex, text)
|
||||||
AutoLinker.link(mentions, options) <> AutoLinker.link(rest, options)
|
Linkify.link(mentions, options) <> Linkify.link(rest, options)
|
||||||
else
|
else
|
||||||
AutoLinker.link(text, options)
|
Linkify.link(text, options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -96,16 +96,18 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
|
||||||
|
|
||||||
def response("/main/public") do
|
def response("/main/public") do
|
||||||
posts =
|
posts =
|
||||||
ActivityPub.fetch_public_activities(%{"type" => ["Create"], "local_only" => true})
|
%{type: ["Create"], local_only: true}
|
||||||
|> render_activities
|
|> ActivityPub.fetch_public_activities()
|
||||||
|
|> render_activities()
|
||||||
|
|
||||||
info("Welcome to the Public Timeline!") <> posts <> ".\r\n"
|
info("Welcome to the Public Timeline!") <> posts <> ".\r\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def response("/main/all") do
|
def response("/main/all") do
|
||||||
posts =
|
posts =
|
||||||
ActivityPub.fetch_public_activities(%{"type" => ["Create"]})
|
%{type: ["Create"]}
|
||||||
|> render_activities
|
|> ActivityPub.fetch_public_activities()
|
||||||
|
|> render_activities()
|
||||||
|
|
||||||
info("Welcome to the Federated Timeline!") <> posts <> ".\r\n"
|
info("Welcome to the Federated Timeline!") <> posts <> ".\r\n"
|
||||||
end
|
end
|
||||||
|
@ -130,13 +132,14 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
|
||||||
def response("/users/" <> nickname) do
|
def response("/users/" <> nickname) do
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
||||||
params = %{
|
params = %{
|
||||||
"type" => ["Create"],
|
type: ["Create"],
|
||||||
"actor_id" => user.ap_id
|
actor_id: user.ap_id
|
||||||
}
|
}
|
||||||
|
|
||||||
activities =
|
activities =
|
||||||
ActivityPub.fetch_public_activities(params)
|
params
|
||||||
|> render_activities
|
|> ActivityPub.fetch_public_activities()
|
||||||
|
|> render_activities()
|
||||||
|
|
||||||
info("Posts by #{user.nickname}") <> activities <> ".\r\n"
|
info("Posts by #{user.nickname}") <> activities <> ".\r\n"
|
||||||
else
|
else
|
||||||
|
|
|
@ -19,7 +19,8 @@ defmodule Pleroma.Gun.API do
|
||||||
:tls_opts,
|
:tls_opts,
|
||||||
:tcp_opts,
|
:tcp_opts,
|
||||||
:socks_opts,
|
:socks_opts,
|
||||||
:ws_opts
|
:ws_opts,
|
||||||
|
:supervise
|
||||||
]
|
]
|
||||||
|
|
||||||
@impl Gun
|
@impl Gun
|
||||||
|
|
|
@ -3,85 +3,33 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Gun.Conn do
|
defmodule Pleroma.Gun.Conn do
|
||||||
@moduledoc """
|
|
||||||
Struct for gun connection data
|
|
||||||
"""
|
|
||||||
alias Pleroma.Gun
|
alias Pleroma.Gun
|
||||||
alias Pleroma.Pool.Connections
|
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@type gun_state :: :up | :down
|
def open(%URI{} = uri, opts) do
|
||||||
@type conn_state :: :active | :idle
|
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
|
||||||
conn: pid(),
|
|
||||||
gun_state: gun_state(),
|
|
||||||
conn_state: conn_state(),
|
|
||||||
used_by: [pid()],
|
|
||||||
last_reference: pos_integer(),
|
|
||||||
crf: float(),
|
|
||||||
retries: pos_integer()
|
|
||||||
}
|
|
||||||
|
|
||||||
defstruct conn: nil,
|
|
||||||
gun_state: :open,
|
|
||||||
conn_state: :init,
|
|
||||||
used_by: [],
|
|
||||||
last_reference: 0,
|
|
||||||
crf: 1,
|
|
||||||
retries: 0
|
|
||||||
|
|
||||||
@spec open(String.t() | URI.t(), atom(), keyword()) :: :ok | nil
|
|
||||||
def open(url, name, opts \\ [])
|
|
||||||
def open(url, name, opts) when is_binary(url), do: open(URI.parse(url), name, opts)
|
|
||||||
|
|
||||||
def open(%URI{} = uri, name, opts) do
|
|
||||||
pool_opts = Pleroma.Config.get([:connections_pool], [])
|
pool_opts = Pleroma.Config.get([:connections_pool], [])
|
||||||
|
|
||||||
opts =
|
opts =
|
||||||
opts
|
opts
|
||||||
|> Enum.into(%{})
|
|> Enum.into(%{})
|
||||||
|> Map.put_new(:retry, pool_opts[:retry] || 1)
|
|
||||||
|> Map.put_new(:retry_timeout, pool_opts[:retry_timeout] || 1000)
|
|
||||||
|> Map.put_new(:await_up_timeout, pool_opts[:await_up_timeout] || 5_000)
|
|> Map.put_new(:await_up_timeout, pool_opts[:await_up_timeout] || 5_000)
|
||||||
|
|> Map.put_new(:supervise, false)
|
||||||
|> maybe_add_tls_opts(uri)
|
|> maybe_add_tls_opts(uri)
|
||||||
|
|
||||||
key = "#{uri.scheme}:#{uri.host}:#{uri.port}"
|
do_open(uri, opts)
|
||||||
|
|
||||||
max_connections = pool_opts[:max_connections] || 250
|
|
||||||
|
|
||||||
conn_pid =
|
|
||||||
if Connections.count(name) < max_connections do
|
|
||||||
do_open(uri, opts)
|
|
||||||
else
|
|
||||||
close_least_used_and_do_open(name, uri, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
if is_pid(conn_pid) do
|
|
||||||
conn = %Pleroma.Gun.Conn{
|
|
||||||
conn: conn_pid,
|
|
||||||
gun_state: :up,
|
|
||||||
conn_state: :active,
|
|
||||||
last_reference: :os.system_time(:second)
|
|
||||||
}
|
|
||||||
|
|
||||||
:ok = Gun.set_owner(conn_pid, Process.whereis(name))
|
|
||||||
Connections.add_conn(name, key, conn)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_add_tls_opts(opts, %URI{scheme: "http"}), do: opts
|
defp maybe_add_tls_opts(opts, %URI{scheme: "http"}), do: opts
|
||||||
|
|
||||||
defp maybe_add_tls_opts(opts, %URI{scheme: "https", host: host}) do
|
defp maybe_add_tls_opts(opts, %URI{scheme: "https"}) do
|
||||||
tls_opts = [
|
tls_opts = [
|
||||||
verify: :verify_peer,
|
verify: :verify_peer,
|
||||||
cacertfile: CAStore.file_path(),
|
cacertfile: CAStore.file_path(),
|
||||||
depth: 20,
|
depth: 20,
|
||||||
reuse_sessions: false,
|
reuse_sessions: false,
|
||||||
verify_fun:
|
log_level: :warning,
|
||||||
{&:ssl_verify_hostname.verify_fun/3,
|
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]
|
||||||
[check_hostname: Pleroma.HTTP.Connection.format_host(host)]}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
tls_opts =
|
tls_opts =
|
||||||
|
@ -105,7 +53,7 @@ defmodule Pleroma.Gun.Conn do
|
||||||
{:ok, _} <- Gun.await_up(conn, opts[:await_up_timeout]),
|
{:ok, _} <- Gun.await_up(conn, opts[:await_up_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
|
||||||
conn
|
{:ok, conn}
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
|
@ -141,7 +89,7 @@ defmodule Pleroma.Gun.Conn do
|
||||||
|
|
||||||
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[:await_up_timeout]) do
|
{:ok, _} <- Gun.await_up(conn, opts[:await_up_timeout]) do
|
||||||
conn
|
{:ok, conn}
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
|
@ -155,11 +103,11 @@ defmodule Pleroma.Gun.Conn do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_open(%URI{host: host, port: port} = uri, opts) do
|
defp do_open(%URI{host: host, port: port} = uri, opts) do
|
||||||
host = Pleroma.HTTP.Connection.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[:await_up_timeout]) do
|
{:ok, _} <- Gun.await_up(conn, opts[:await_up_timeout]) do
|
||||||
conn
|
{:ok, conn}
|
||||||
else
|
else
|
||||||
error ->
|
error ->
|
||||||
Logger.warn(
|
Logger.warn(
|
||||||
|
@ -171,7 +119,7 @@ defmodule Pleroma.Gun.Conn do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp destination_opts(%URI{host: host, port: port}) do
|
defp destination_opts(%URI{host: host, port: port}) do
|
||||||
host = Pleroma.HTTP.Connection.parse_host(host)
|
host = Pleroma.HTTP.AdapterHelper.parse_host(host)
|
||||||
%{host: host, port: port}
|
%{host: host, port: port}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -181,17 +129,6 @@ defmodule Pleroma.Gun.Conn do
|
||||||
|
|
||||||
defp add_http2_opts(opts, _, _), do: opts
|
defp add_http2_opts(opts, _, _), do: opts
|
||||||
|
|
||||||
defp close_least_used_and_do_open(name, uri, opts) do
|
|
||||||
with [{key, conn} | _conns] <- Connections.get_unused_conns(name),
|
|
||||||
:ok <- Gun.close(conn.conn) do
|
|
||||||
Connections.remove_conn(name, key)
|
|
||||||
|
|
||||||
do_open(uri, opts)
|
|
||||||
else
|
|
||||||
[] -> {:error, :pool_overflowed}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def compose_uri_log(%URI{scheme: scheme, host: host, path: path}) do
|
def compose_uri_log(%URI{scheme: scheme, host: host, path: path}) do
|
||||||
"#{scheme}://#{host}#{path}"
|
"#{scheme}://#{host}#{path}"
|
||||||
end
|
end
|
||||||
|
|
79
lib/pleroma/gun/connection_pool.ex
Normal file
79
lib/pleroma/gun/connection_pool.ex
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
defmodule Pleroma.Gun.ConnectionPool do
|
||||||
|
@registry __MODULE__
|
||||||
|
|
||||||
|
alias Pleroma.Gun.ConnectionPool.WorkerSupervisor
|
||||||
|
|
||||||
|
def children do
|
||||||
|
[
|
||||||
|
{Registry, keys: :unique, name: @registry},
|
||||||
|
Pleroma.Gun.ConnectionPool.WorkerSupervisor
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_conn(uri, opts) do
|
||||||
|
key = "#{uri.scheme}:#{uri.host}:#{uri.port}"
|
||||||
|
|
||||||
|
case Registry.lookup(@registry, key) do
|
||||||
|
# The key has already been registered, but connection is not up yet
|
||||||
|
[{worker_pid, nil}] ->
|
||||||
|
get_gun_pid_from_worker(worker_pid, true)
|
||||||
|
|
||||||
|
[{worker_pid, {gun_pid, _used_by, _crf, _last_reference}}] ->
|
||||||
|
GenServer.cast(worker_pid, {:add_client, self(), false})
|
||||||
|
{:ok, gun_pid}
|
||||||
|
|
||||||
|
[] ->
|
||||||
|
# :gun.set_owner fails in :connected state for whatevever reason,
|
||||||
|
# so we open the connection in the process directly and send it's pid back
|
||||||
|
# We trust gun to handle timeouts by itself
|
||||||
|
case WorkerSupervisor.start_worker([key, uri, opts, self()]) do
|
||||||
|
{:ok, worker_pid} ->
|
||||||
|
get_gun_pid_from_worker(worker_pid, false)
|
||||||
|
|
||||||
|
{:error, {:already_started, worker_pid}} ->
|
||||||
|
get_gun_pid_from_worker(worker_pid, true)
|
||||||
|
|
||||||
|
err ->
|
||||||
|
err
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp get_gun_pid_from_worker(worker_pid, register) do
|
||||||
|
# GenServer.call will block the process for timeout length if
|
||||||
|
# the server crashes on startup (which will happen if gun fails to connect)
|
||||||
|
# so instead we use cast + monitor
|
||||||
|
|
||||||
|
ref = Process.monitor(worker_pid)
|
||||||
|
if register, do: GenServer.cast(worker_pid, {:add_client, self(), true})
|
||||||
|
|
||||||
|
receive do
|
||||||
|
{:conn_pid, pid} ->
|
||||||
|
Process.demonitor(ref)
|
||||||
|
{:ok, pid}
|
||||||
|
|
||||||
|
{:DOWN, ^ref, :process, ^worker_pid, reason} ->
|
||||||
|
case reason do
|
||||||
|
{:shutdown, error} -> error
|
||||||
|
_ -> {:error, reason}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def release_conn(conn_pid) do
|
||||||
|
# :ets.fun2ms(fn {_, {worker_pid, {gun_pid, _, _, _}}} when gun_pid == conn_pid ->
|
||||||
|
# worker_pid end)
|
||||||
|
query_result =
|
||||||
|
Registry.select(@registry, [
|
||||||
|
{{:_, :"$1", {:"$2", :_, :_, :_}}, [{:==, :"$2", conn_pid}], [:"$1"]}
|
||||||
|
])
|
||||||
|
|
||||||
|
case query_result do
|
||||||
|
[worker_pid] ->
|
||||||
|
GenServer.cast(worker_pid, {:remove_client, self()})
|
||||||
|
|
||||||
|
[] ->
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
85
lib/pleroma/gun/connection_pool/reclaimer.ex
Normal file
85
lib/pleroma/gun/connection_pool/reclaimer.ex
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
defmodule Pleroma.Gun.ConnectionPool.Reclaimer do
|
||||||
|
use GenServer, restart: :temporary
|
||||||
|
|
||||||
|
@registry Pleroma.Gun.ConnectionPool
|
||||||
|
|
||||||
|
def start_monitor do
|
||||||
|
pid =
|
||||||
|
case :gen_server.start(__MODULE__, [], name: {:via, Registry, {@registry, "reclaimer"}}) do
|
||||||
|
{:ok, pid} ->
|
||||||
|
pid
|
||||||
|
|
||||||
|
{:error, {:already_registered, pid}} ->
|
||||||
|
pid
|
||||||
|
end
|
||||||
|
|
||||||
|
{pid, Process.monitor(pid)}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def init(_) do
|
||||||
|
{:ok, nil, {:continue, :reclaim}}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_continue(:reclaim, _) do
|
||||||
|
max_connections = Pleroma.Config.get([:connections_pool, :max_connections])
|
||||||
|
|
||||||
|
reclaim_max =
|
||||||
|
[:connections_pool, :reclaim_multiplier]
|
||||||
|
|> Pleroma.Config.get()
|
||||||
|
|> Kernel.*(max_connections)
|
||||||
|
|> round
|
||||||
|
|> max(1)
|
||||||
|
|
||||||
|
:telemetry.execute([:pleroma, :connection_pool, :reclaim, :start], %{}, %{
|
||||||
|
max_connections: max_connections,
|
||||||
|
reclaim_max: reclaim_max
|
||||||
|
})
|
||||||
|
|
||||||
|
# :ets.fun2ms(
|
||||||
|
# fn {_, {worker_pid, {_, used_by, crf, last_reference}}} when used_by == [] ->
|
||||||
|
# {worker_pid, crf, last_reference} end)
|
||||||
|
unused_conns =
|
||||||
|
Registry.select(
|
||||||
|
@registry,
|
||||||
|
[
|
||||||
|
{{:_, :"$1", {:_, :"$2", :"$3", :"$4"}}, [{:==, :"$2", []}], [{{:"$1", :"$3", :"$4"}}]}
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
case unused_conns do
|
||||||
|
[] ->
|
||||||
|
:telemetry.execute(
|
||||||
|
[:pleroma, :connection_pool, :reclaim, :stop],
|
||||||
|
%{reclaimed_count: 0},
|
||||||
|
%{
|
||||||
|
max_connections: max_connections
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
{:stop, :no_unused_conns, nil}
|
||||||
|
|
||||||
|
unused_conns ->
|
||||||
|
reclaimed =
|
||||||
|
unused_conns
|
||||||
|
|> Enum.sort(fn {_pid1, crf1, last_reference1}, {_pid2, crf2, last_reference2} ->
|
||||||
|
crf1 <= crf2 and last_reference1 <= last_reference2
|
||||||
|
end)
|
||||||
|
|> Enum.take(reclaim_max)
|
||||||
|
|
||||||
|
reclaimed
|
||||||
|
|> Enum.each(fn {pid, _, _} ->
|
||||||
|
DynamicSupervisor.terminate_child(Pleroma.Gun.ConnectionPool.WorkerSupervisor, pid)
|
||||||
|
end)
|
||||||
|
|
||||||
|
:telemetry.execute(
|
||||||
|
[:pleroma, :connection_pool, :reclaim, :stop],
|
||||||
|
%{reclaimed_count: Enum.count(reclaimed)},
|
||||||
|
%{max_connections: max_connections}
|
||||||
|
)
|
||||||
|
|
||||||
|
{:stop, :normal, nil}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
127
lib/pleroma/gun/connection_pool/worker.ex
Normal file
127
lib/pleroma/gun/connection_pool/worker.ex
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
defmodule Pleroma.Gun.ConnectionPool.Worker do
|
||||||
|
alias Pleroma.Gun
|
||||||
|
use GenServer, restart: :temporary
|
||||||
|
|
||||||
|
@registry Pleroma.Gun.ConnectionPool
|
||||||
|
|
||||||
|
def start_link([key | _] = opts) do
|
||||||
|
GenServer.start_link(__MODULE__, opts, name: {:via, Registry, {@registry, key}})
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def init([_key, _uri, _opts, _client_pid] = opts) do
|
||||||
|
{:ok, nil, {:continue, {:connect, opts}}}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_continue({:connect, [key, uri, opts, client_pid]}, _) do
|
||||||
|
with {:ok, conn_pid} <- Gun.Conn.open(uri, opts),
|
||||||
|
Process.link(conn_pid) do
|
||||||
|
time = :erlang.monotonic_time(:millisecond)
|
||||||
|
|
||||||
|
{_, _} =
|
||||||
|
Registry.update_value(@registry, key, fn _ ->
|
||||||
|
{conn_pid, [client_pid], 1, time}
|
||||||
|
end)
|
||||||
|
|
||||||
|
send(client_pid, {:conn_pid, conn_pid})
|
||||||
|
|
||||||
|
{:noreply,
|
||||||
|
%{key: key, timer: nil, client_monitors: %{client_pid => Process.monitor(client_pid)}},
|
||||||
|
:hibernate}
|
||||||
|
else
|
||||||
|
err ->
|
||||||
|
{:stop, {:shutdown, err}, nil}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_cast({:add_client, client_pid, send_pid_back}, %{key: key} = state) do
|
||||||
|
time = :erlang.monotonic_time(:millisecond)
|
||||||
|
|
||||||
|
{{conn_pid, _, _, _}, _} =
|
||||||
|
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}
|
||||||
|
end)
|
||||||
|
|
||||||
|
if send_pid_back, do: send(client_pid, {:conn_pid, conn_pid})
|
||||||
|
|
||||||
|
state =
|
||||||
|
if state.timer != nil do
|
||||||
|
Process.cancel_timer(state[:timer])
|
||||||
|
%{state | timer: nil}
|
||||||
|
else
|
||||||
|
state
|
||||||
|
end
|
||||||
|
|
||||||
|
ref = Process.monitor(client_pid)
|
||||||
|
|
||||||
|
state = put_in(state.client_monitors[client_pid], ref)
|
||||||
|
{:noreply, state, :hibernate}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_cast({:remove_client, client_pid}, %{key: key} = state) do
|
||||||
|
{{_conn_pid, used_by, _crf, _last_reference}, _} =
|
||||||
|
Registry.update_value(@registry, key, fn {conn_pid, used_by, crf, last_reference} ->
|
||||||
|
{conn_pid, List.delete(used_by, client_pid), crf, last_reference}
|
||||||
|
end)
|
||||||
|
|
||||||
|
{ref, state} = pop_in(state.client_monitors[client_pid])
|
||||||
|
Process.demonitor(ref)
|
||||||
|
|
||||||
|
timer =
|
||||||
|
if used_by == [] do
|
||||||
|
max_idle = Pleroma.Config.get([:connections_pool, :max_idle_time], 30_000)
|
||||||
|
Process.send_after(self(), :idle_close, max_idle)
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
{:noreply, %{state | timer: timer}, :hibernate}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_info(:idle_close, state) do
|
||||||
|
# Gun monitors the owner process, and will close the connection automatically
|
||||||
|
# when it's terminated
|
||||||
|
{:stop, :normal, state}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Gracefully shutdown if the connection got closed without any streams left
|
||||||
|
@impl true
|
||||||
|
def handle_info({:gun_down, _pid, _protocol, _reason, []}, state) do
|
||||||
|
{:stop, :normal, state}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Otherwise, shutdown with an error
|
||||||
|
@impl true
|
||||||
|
def handle_info({:gun_down, _pid, _protocol, _reason, _killed_streams} = down_message, state) do
|
||||||
|
{:stop, {:error, down_message}, state}
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def handle_info({:DOWN, _ref, :process, pid, reason}, state) do
|
||||||
|
# Sometimes the client is dead before we demonitor it in :remove_client, so the message
|
||||||
|
# arrives anyway
|
||||||
|
|
||||||
|
case state.client_monitors[pid] do
|
||||||
|
nil ->
|
||||||
|
{:noreply, state, :hibernate}
|
||||||
|
|
||||||
|
_ref ->
|
||||||
|
:telemetry.execute(
|
||||||
|
[:pleroma, :connection_pool, :client_death],
|
||||||
|
%{client_pid: pid, reason: reason},
|
||||||
|
%{key: state.key}
|
||||||
|
)
|
||||||
|
|
||||||
|
handle_cast({:remove_client, pid}, state)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# LRFU policy: https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.55.1478
|
||||||
|
defp crf(time_delta, prev_crf) do
|
||||||
|
1 + :math.pow(0.5, 0.0001 * time_delta) * prev_crf
|
||||||
|
end
|
||||||
|
end
|
45
lib/pleroma/gun/connection_pool/worker_supervisor.ex
Normal file
45
lib/pleroma/gun/connection_pool/worker_supervisor.ex
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
defmodule Pleroma.Gun.ConnectionPool.WorkerSupervisor do
|
||||||
|
@moduledoc "Supervisor for pool workers. Does not do anything except enforce max connection limit"
|
||||||
|
|
||||||
|
use DynamicSupervisor
|
||||||
|
|
||||||
|
def start_link(opts) do
|
||||||
|
DynamicSupervisor.start_link(__MODULE__, opts, name: __MODULE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def init(_opts) do
|
||||||
|
DynamicSupervisor.init(
|
||||||
|
strategy: :one_for_one,
|
||||||
|
max_children: Pleroma.Config.get([:connections_pool, :max_connections])
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def start_worker(opts, retry \\ false) do
|
||||||
|
case DynamicSupervisor.start_child(__MODULE__, {Pleroma.Gun.ConnectionPool.Worker, opts}) do
|
||||||
|
{:error, :max_children} ->
|
||||||
|
if retry or free_pool() == :error do
|
||||||
|
:telemetry.execute([:pleroma, :connection_pool, :provision_failure], %{opts: opts})
|
||||||
|
{:error, :pool_full}
|
||||||
|
else
|
||||||
|
start_worker(opts, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
res ->
|
||||||
|
res
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp free_pool do
|
||||||
|
wait_for_reclaimer_finish(Pleroma.Gun.ConnectionPool.Reclaimer.start_monitor())
|
||||||
|
end
|
||||||
|
|
||||||
|
defp wait_for_reclaimer_finish({pid, mon}) do
|
||||||
|
receive do
|
||||||
|
{:DOWN, ^mon, :process, ^pid, :no_unused_conns} ->
|
||||||
|
:error
|
||||||
|
|
||||||
|
{:DOWN, ^mon, :process, ^pid, :normal} ->
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,32 +3,30 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.HTTP.AdapterHelper do
|
defmodule Pleroma.HTTP.AdapterHelper do
|
||||||
alias Pleroma.HTTP.Connection
|
@moduledoc """
|
||||||
|
Configure Tesla.Client with default and customized adapter options.
|
||||||
|
"""
|
||||||
|
@defaults [pool: :federation]
|
||||||
|
|
||||||
|
@type proxy_type() :: :socks4 | :socks5
|
||||||
|
@type host() :: charlist() | :inet.ip_address()
|
||||||
|
|
||||||
|
alias Pleroma.Config
|
||||||
|
alias Pleroma.HTTP.AdapterHelper
|
||||||
|
require Logger
|
||||||
|
|
||||||
@type proxy ::
|
@type proxy ::
|
||||||
{Connection.host(), pos_integer()}
|
{Connection.host(), pos_integer()}
|
||||||
| {Connection.proxy_type(), Connection.host(), pos_integer()}
|
| {Connection.proxy_type(), Connection.host(), pos_integer()}
|
||||||
|
|
||||||
@callback options(keyword(), URI.t()) :: keyword()
|
@callback options(keyword(), URI.t()) :: keyword()
|
||||||
@callback after_request(keyword()) :: :ok
|
@callback get_conn(URI.t(), keyword()) :: {:ok, term()} | {:error, term()}
|
||||||
|
|
||||||
@spec options(keyword(), URI.t()) :: keyword()
|
|
||||||
def options(opts, _uri) do
|
|
||||||
proxy = Pleroma.Config.get([:http, :proxy_url], nil)
|
|
||||||
maybe_add_proxy(opts, format_proxy(proxy))
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec maybe_get_conn(URI.t(), keyword()) :: keyword()
|
|
||||||
def maybe_get_conn(_uri, opts), do: opts
|
|
||||||
|
|
||||||
@spec after_request(keyword()) :: :ok
|
|
||||||
def after_request(_opts), do: :ok
|
|
||||||
|
|
||||||
@spec format_proxy(String.t() | tuple() | nil) :: proxy() | nil
|
@spec format_proxy(String.t() | tuple() | nil) :: proxy() | nil
|
||||||
def format_proxy(nil), do: nil
|
def format_proxy(nil), do: nil
|
||||||
|
|
||||||
def format_proxy(proxy_url) do
|
def format_proxy(proxy_url) do
|
||||||
case Connection.parse_proxy(proxy_url) do
|
case parse_proxy(proxy_url) do
|
||||||
{:ok, host, port} -> {host, port}
|
{:ok, host, port} -> {host, port}
|
||||||
{:ok, type, host, port} -> {type, host, port}
|
{:ok, type, host, port} -> {type, host, port}
|
||||||
_ -> nil
|
_ -> nil
|
||||||
|
@ -38,4 +36,105 @@ defmodule Pleroma.HTTP.AdapterHelper do
|
||||||
@spec maybe_add_proxy(keyword(), proxy() | nil) :: keyword()
|
@spec maybe_add_proxy(keyword(), proxy() | nil) :: keyword()
|
||||||
def maybe_add_proxy(opts, nil), do: opts
|
def maybe_add_proxy(opts, nil), do: opts
|
||||||
def maybe_add_proxy(opts, proxy), do: Keyword.put_new(opts, :proxy, proxy)
|
def maybe_add_proxy(opts, proxy), do: Keyword.put_new(opts, :proxy, proxy)
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Merge default connection & adapter options with received ones.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@spec options(URI.t(), keyword()) :: keyword()
|
||||||
|
def options(%URI{} = uri, opts \\ []) do
|
||||||
|
@defaults
|
||||||
|
|> put_timeout()
|
||||||
|
|> Keyword.merge(opts)
|
||||||
|
|> adapter_helper().options(uri)
|
||||||
|
end
|
||||||
|
|
||||||
|
# For Hackney, this is the time a connection can stay idle in the pool.
|
||||||
|
# For Gun, this is the timeout to receive a message from Gun.
|
||||||
|
defp put_timeout(opts) do
|
||||||
|
{config_key, default} =
|
||||||
|
if adapter() == Tesla.Adapter.Gun do
|
||||||
|
{:pools, Config.get([:pools, :default, :timeout], 5_000)}
|
||||||
|
else
|
||||||
|
{:hackney_pools, 10_000}
|
||||||
|
end
|
||||||
|
|
||||||
|
timeout = Config.get([config_key, opts[:pool], :timeout], default)
|
||||||
|
|
||||||
|
Keyword.merge(opts, timeout: timeout)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_conn(uri, opts), do: adapter_helper().get_conn(uri, opts)
|
||||||
|
defp adapter, do: Application.get_env(:tesla, :adapter)
|
||||||
|
|
||||||
|
defp adapter_helper do
|
||||||
|
case adapter() do
|
||||||
|
Tesla.Adapter.Gun -> AdapterHelper.Gun
|
||||||
|
Tesla.Adapter.Hackney -> AdapterHelper.Hackney
|
||||||
|
_ -> AdapterHelper.Default
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@spec parse_proxy(String.t() | tuple() | nil) ::
|
||||||
|
{:ok, host(), pos_integer()}
|
||||||
|
| {:ok, proxy_type(), host(), pos_integer()}
|
||||||
|
| {:error, atom()}
|
||||||
|
| nil
|
||||||
|
|
||||||
|
def parse_proxy(nil), do: nil
|
||||||
|
|
||||||
|
def parse_proxy(proxy) when is_binary(proxy) do
|
||||||
|
with [host, port] <- String.split(proxy, ":"),
|
||||||
|
{port, ""} <- Integer.parse(port) do
|
||||||
|
{:ok, parse_host(host), port}
|
||||||
|
else
|
||||||
|
{_, _} ->
|
||||||
|
Logger.warn("Parsing port failed #{inspect(proxy)}")
|
||||||
|
{:error, :invalid_proxy_port}
|
||||||
|
|
||||||
|
:error ->
|
||||||
|
Logger.warn("Parsing port failed #{inspect(proxy)}")
|
||||||
|
{:error, :invalid_proxy_port}
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Logger.warn("Parsing proxy failed #{inspect(proxy)}")
|
||||||
|
{:error, :invalid_proxy}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_proxy(proxy) when is_tuple(proxy) do
|
||||||
|
with {type, host, port} <- proxy do
|
||||||
|
{:ok, type, parse_host(host), port}
|
||||||
|
else
|
||||||
|
_ ->
|
||||||
|
Logger.warn("Parsing proxy failed #{inspect(proxy)}")
|
||||||
|
{:error, :invalid_proxy}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@spec parse_host(String.t() | atom() | charlist()) :: charlist() | :inet.ip_address()
|
||||||
|
def parse_host(host) when is_list(host), do: host
|
||||||
|
def parse_host(host) when is_atom(host), do: to_charlist(host)
|
||||||
|
|
||||||
|
def parse_host(host) when is_binary(host) do
|
||||||
|
host = to_charlist(host)
|
||||||
|
|
||||||
|
case :inet.parse_address(host) do
|
||||||
|
{:error, :einval} -> host
|
||||||
|
{:ok, ip} -> ip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@spec format_host(String.t()) :: charlist()
|
||||||
|
def format_host(host) do
|
||||||
|
host_charlist = to_charlist(host)
|
||||||
|
|
||||||
|
case :inet.parse_address(host_charlist) do
|
||||||
|
{:error, :einval} ->
|
||||||
|
:idna.encode(host_charlist)
|
||||||
|
|
||||||
|
{:ok, _ip} ->
|
||||||
|
host_charlist
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
14
lib/pleroma/http/adapter_helper/default.ex
Normal file
14
lib/pleroma/http/adapter_helper/default.ex
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
defmodule Pleroma.HTTP.AdapterHelper.Default do
|
||||||
|
alias Pleroma.HTTP.AdapterHelper
|
||||||
|
|
||||||
|
@behaviour Pleroma.HTTP.AdapterHelper
|
||||||
|
|
||||||
|
@spec options(keyword(), URI.t()) :: keyword()
|
||||||
|
def options(opts, _uri) do
|
||||||
|
proxy = Pleroma.Config.get([:http, :proxy_url], nil)
|
||||||
|
AdapterHelper.maybe_add_proxy(opts, AdapterHelper.format_proxy(proxy))
|
||||||
|
end
|
||||||
|
|
||||||
|
@spec get_conn(URI.t(), keyword()) :: {:ok, keyword()}
|
||||||
|
def get_conn(_uri, opts), do: {:ok, opts}
|
||||||
|
end
|
|
@ -5,8 +5,8 @@
|
||||||
defmodule Pleroma.HTTP.AdapterHelper.Gun do
|
defmodule Pleroma.HTTP.AdapterHelper.Gun do
|
||||||
@behaviour Pleroma.HTTP.AdapterHelper
|
@behaviour Pleroma.HTTP.AdapterHelper
|
||||||
|
|
||||||
|
alias Pleroma.Gun.ConnectionPool
|
||||||
alias Pleroma.HTTP.AdapterHelper
|
alias Pleroma.HTTP.AdapterHelper
|
||||||
alias Pleroma.Pool.Connections
|
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ defmodule Pleroma.HTTP.AdapterHelper.Gun do
|
||||||
connect_timeout: 5_000,
|
connect_timeout: 5_000,
|
||||||
domain_lookup_timeout: 5_000,
|
domain_lookup_timeout: 5_000,
|
||||||
tls_handshake_timeout: 5_000,
|
tls_handshake_timeout: 5_000,
|
||||||
retry: 1,
|
retry: 0,
|
||||||
retry_timeout: 1000,
|
retry_timeout: 1000,
|
||||||
await_up_timeout: 5_000
|
await_up_timeout: 5_000
|
||||||
]
|
]
|
||||||
|
@ -31,16 +31,7 @@ defmodule Pleroma.HTTP.AdapterHelper.Gun do
|
||||||
|> Keyword.merge(config_opts)
|
|> Keyword.merge(config_opts)
|
||||||
|> add_scheme_opts(uri)
|
|> add_scheme_opts(uri)
|
||||||
|> AdapterHelper.maybe_add_proxy(proxy)
|
|> AdapterHelper.maybe_add_proxy(proxy)
|
||||||
|> maybe_get_conn(uri, incoming_opts)
|
|> Keyword.merge(incoming_opts)
|
||||||
end
|
|
||||||
|
|
||||||
@spec after_request(keyword()) :: :ok
|
|
||||||
def after_request(opts) do
|
|
||||||
if opts[:conn] && opts[:body_as] != :chunks do
|
|
||||||
Connections.checkout(opts[:conn], self(), :gun_connections)
|
|
||||||
end
|
|
||||||
|
|
||||||
:ok
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp add_scheme_opts(opts, %{scheme: "http"}), do: opts
|
defp add_scheme_opts(opts, %{scheme: "http"}), do: opts
|
||||||
|
@ -48,30 +39,40 @@ defmodule Pleroma.HTTP.AdapterHelper.Gun do
|
||||||
defp add_scheme_opts(opts, %{scheme: "https"}) do
|
defp add_scheme_opts(opts, %{scheme: "https"}) do
|
||||||
opts
|
opts
|
||||||
|> Keyword.put(:certificates_verification, true)
|
|> Keyword.put(:certificates_verification, true)
|
||||||
|> Keyword.put(:tls_opts, log_level: :warning)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_get_conn(adapter_opts, uri, incoming_opts) do
|
@spec get_conn(URI.t(), keyword()) :: {:ok, keyword()} | {:error, atom()}
|
||||||
{receive_conn?, opts} =
|
def get_conn(uri, opts) do
|
||||||
adapter_opts
|
case ConnectionPool.get_conn(uri, opts) do
|
||||||
|> Keyword.merge(incoming_opts)
|
{:ok, conn_pid} -> {:ok, Keyword.merge(opts, conn: conn_pid, close_conn: false)}
|
||||||
|> Keyword.pop(:receive_conn, true)
|
err -> err
|
||||||
|
|
||||||
if Connections.alive?(:gun_connections) and receive_conn? do
|
|
||||||
checkin_conn(uri, opts)
|
|
||||||
else
|
|
||||||
opts
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp checkin_conn(uri, opts) do
|
@prefix Pleroma.Gun.ConnectionPool
|
||||||
case Connections.checkin(uri, :gun_connections) do
|
def limiter_setup do
|
||||||
nil ->
|
wait = Pleroma.Config.get([:connections_pool, :connection_acquisition_wait])
|
||||||
Task.start(Pleroma.Gun.Conn, :open, [uri, :gun_connections, opts])
|
retries = Pleroma.Config.get([:connections_pool, :connection_acquisition_retries])
|
||||||
opts
|
|
||||||
|
|
||||||
conn when is_pid(conn) ->
|
:pools
|
||||||
Keyword.merge(opts, conn: conn, close_conn: false)
|
|> Pleroma.Config.get([])
|
||||||
end
|
|> Enum.each(fn {name, opts} ->
|
||||||
|
max_running = Keyword.get(opts, :size, 50)
|
||||||
|
max_waiting = Keyword.get(opts, :max_waiting, 10)
|
||||||
|
|
||||||
|
result =
|
||||||
|
ConcurrentLimiter.new(:"#{@prefix}.#{name}", max_running, max_waiting,
|
||||||
|
wait: wait,
|
||||||
|
max_retries: retries
|
||||||
|
)
|
||||||
|
|
||||||
|
case result do
|
||||||
|
:ok -> :ok
|
||||||
|
{:error, :existing} -> :ok
|
||||||
|
e -> raise e
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,5 +24,6 @@ defmodule Pleroma.HTTP.AdapterHelper.Hackney do
|
||||||
|
|
||||||
defp add_scheme_opts(opts, _), do: opts
|
defp add_scheme_opts(opts, _), do: opts
|
||||||
|
|
||||||
def after_request(_), do: :ok
|
@spec get_conn(URI.t(), keyword()) :: {:ok, keyword()}
|
||||||
|
def get_conn(_uri, opts), do: {:ok, opts}
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,124 +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.HTTP.Connection do
|
|
||||||
@moduledoc """
|
|
||||||
Configure Tesla.Client with default and customized adapter options.
|
|
||||||
"""
|
|
||||||
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.HTTP.AdapterHelper
|
|
||||||
|
|
||||||
require Logger
|
|
||||||
|
|
||||||
@defaults [pool: :federation]
|
|
||||||
|
|
||||||
@type ip_address :: ipv4_address() | ipv6_address()
|
|
||||||
@type ipv4_address :: {0..255, 0..255, 0..255, 0..255}
|
|
||||||
@type ipv6_address ::
|
|
||||||
{0..65_535, 0..65_535, 0..65_535, 0..65_535, 0..65_535, 0..65_535, 0..65_535, 0..65_535}
|
|
||||||
@type proxy_type() :: :socks4 | :socks5
|
|
||||||
@type host() :: charlist() | ip_address()
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Merge default connection & adapter options with received ones.
|
|
||||||
"""
|
|
||||||
|
|
||||||
@spec options(URI.t(), keyword()) :: keyword()
|
|
||||||
def options(%URI{} = uri, opts \\ []) do
|
|
||||||
@defaults
|
|
||||||
|> pool_timeout()
|
|
||||||
|> Keyword.merge(opts)
|
|
||||||
|> adapter_helper().options(uri)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp pool_timeout(opts) do
|
|
||||||
{config_key, default} =
|
|
||||||
if adapter() == Tesla.Adapter.Gun do
|
|
||||||
{:pools, Config.get([:pools, :default, :timeout])}
|
|
||||||
else
|
|
||||||
{:hackney_pools, 10_000}
|
|
||||||
end
|
|
||||||
|
|
||||||
timeout = Config.get([config_key, opts[:pool], :timeout], default)
|
|
||||||
|
|
||||||
Keyword.merge(opts, timeout: timeout)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec after_request(keyword()) :: :ok
|
|
||||||
def after_request(opts), do: adapter_helper().after_request(opts)
|
|
||||||
|
|
||||||
defp adapter, do: Application.get_env(:tesla, :adapter)
|
|
||||||
|
|
||||||
defp adapter_helper do
|
|
||||||
case adapter() do
|
|
||||||
Tesla.Adapter.Gun -> AdapterHelper.Gun
|
|
||||||
Tesla.Adapter.Hackney -> AdapterHelper.Hackney
|
|
||||||
_ -> AdapterHelper
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec parse_proxy(String.t() | tuple() | nil) ::
|
|
||||||
{:ok, host(), pos_integer()}
|
|
||||||
| {:ok, proxy_type(), host(), pos_integer()}
|
|
||||||
| {:error, atom()}
|
|
||||||
| nil
|
|
||||||
|
|
||||||
def parse_proxy(nil), do: nil
|
|
||||||
|
|
||||||
def parse_proxy(proxy) when is_binary(proxy) do
|
|
||||||
with [host, port] <- String.split(proxy, ":"),
|
|
||||||
{port, ""} <- Integer.parse(port) do
|
|
||||||
{:ok, parse_host(host), port}
|
|
||||||
else
|
|
||||||
{_, _} ->
|
|
||||||
Logger.warn("Parsing port failed #{inspect(proxy)}")
|
|
||||||
{:error, :invalid_proxy_port}
|
|
||||||
|
|
||||||
:error ->
|
|
||||||
Logger.warn("Parsing port failed #{inspect(proxy)}")
|
|
||||||
{:error, :invalid_proxy_port}
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
Logger.warn("Parsing proxy failed #{inspect(proxy)}")
|
|
||||||
{:error, :invalid_proxy}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def parse_proxy(proxy) when is_tuple(proxy) do
|
|
||||||
with {type, host, port} <- proxy do
|
|
||||||
{:ok, type, parse_host(host), port}
|
|
||||||
else
|
|
||||||
_ ->
|
|
||||||
Logger.warn("Parsing proxy failed #{inspect(proxy)}")
|
|
||||||
{:error, :invalid_proxy}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec parse_host(String.t() | atom() | charlist()) :: charlist() | ip_address()
|
|
||||||
def parse_host(host) when is_list(host), do: host
|
|
||||||
def parse_host(host) when is_atom(host), do: to_charlist(host)
|
|
||||||
|
|
||||||
def parse_host(host) when is_binary(host) do
|
|
||||||
host = to_charlist(host)
|
|
||||||
|
|
||||||
case :inet.parse_address(host) do
|
|
||||||
{:error, :einval} -> host
|
|
||||||
{:ok, ip} -> ip
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec format_host(String.t()) :: charlist()
|
|
||||||
def format_host(host) do
|
|
||||||
host_charlist = to_charlist(host)
|
|
||||||
|
|
||||||
case :inet.parse_address(host_charlist) do
|
|
||||||
{:error, :einval} ->
|
|
||||||
:idna.encode(host_charlist)
|
|
||||||
|
|
||||||
{:ok, _ip} ->
|
|
||||||
host_charlist
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -7,7 +7,7 @@ defmodule Pleroma.HTTP do
|
||||||
Wrapper for `Tesla.request/2`.
|
Wrapper for `Tesla.request/2`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Pleroma.HTTP.Connection
|
alias Pleroma.HTTP.AdapterHelper
|
||||||
alias Pleroma.HTTP.Request
|
alias Pleroma.HTTP.Request
|
||||||
alias Pleroma.HTTP.RequestBuilder, as: Builder
|
alias Pleroma.HTTP.RequestBuilder, as: Builder
|
||||||
alias Tesla.Client
|
alias Tesla.Client
|
||||||
|
@ -60,49 +60,30 @@ defmodule Pleroma.HTTP do
|
||||||
{:ok, Env.t()} | {:error, any()}
|
{:ok, Env.t()} | {:error, any()}
|
||||||
def request(method, url, body, headers, options) when is_binary(url) do
|
def request(method, url, body, headers, options) when is_binary(url) do
|
||||||
uri = URI.parse(url)
|
uri = URI.parse(url)
|
||||||
adapter_opts = Connection.options(uri, options[:adapter] || [])
|
adapter_opts = AdapterHelper.options(uri, options[:adapter] || [])
|
||||||
options = put_in(options[:adapter], adapter_opts)
|
|
||||||
params = options[:params] || []
|
|
||||||
request = build_request(method, headers, options, url, body, params)
|
|
||||||
|
|
||||||
adapter = Application.get_env(:tesla, :adapter)
|
case AdapterHelper.get_conn(uri, adapter_opts) do
|
||||||
client = Tesla.client([Tesla.Middleware.FollowRedirects], adapter)
|
{:ok, adapter_opts} ->
|
||||||
|
options = put_in(options[:adapter], adapter_opts)
|
||||||
|
params = options[:params] || []
|
||||||
|
request = build_request(method, headers, options, url, body, params)
|
||||||
|
|
||||||
pid = Process.whereis(adapter_opts[:pool])
|
adapter = Application.get_env(:tesla, :adapter)
|
||||||
|
|
||||||
pool_alive? =
|
client = Tesla.client(adapter_middlewares(adapter), adapter)
|
||||||
if adapter == Tesla.Adapter.Gun && pid do
|
|
||||||
Process.alive?(pid)
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
request_opts =
|
maybe_limit(
|
||||||
adapter_opts
|
fn ->
|
||||||
|> Enum.into(%{})
|
request(client, request)
|
||||||
|> Map.put(:env, Pleroma.Config.get([:env]))
|
end,
|
||||||
|> Map.put(:pool_alive?, pool_alive?)
|
adapter,
|
||||||
|
adapter_opts
|
||||||
|
)
|
||||||
|
|
||||||
response = request(client, request, request_opts)
|
# Connection release is handled in a custom FollowRedirects middleware
|
||||||
|
err ->
|
||||||
Connection.after_request(adapter_opts)
|
err
|
||||||
|
end
|
||||||
response
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec request(Client.t(), keyword(), map()) :: {:ok, Env.t()} | {:error, any()}
|
|
||||||
def request(%Client{} = client, request, %{env: :test}), do: request(client, request)
|
|
||||||
|
|
||||||
def request(%Client{} = client, request, %{body_as: :chunks}), do: request(client, request)
|
|
||||||
|
|
||||||
def request(%Client{} = client, request, %{pool_alive?: false}), do: request(client, request)
|
|
||||||
|
|
||||||
def request(%Client{} = client, request, %{pool: pool, timeout: timeout}) do
|
|
||||||
:poolboy.transaction(
|
|
||||||
pool,
|
|
||||||
&Pleroma.Pool.Request.execute(&1, client, request, timeout),
|
|
||||||
timeout
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec request(Client.t(), keyword()) :: {:ok, Env.t()} | {:error, any()}
|
@spec request(Client.t(), keyword()) :: {:ok, Env.t()} | {:error, any()}
|
||||||
|
@ -118,4 +99,19 @@ defmodule Pleroma.HTTP do
|
||||||
|> Builder.add_param(:query, :query, params)
|
|> Builder.add_param(:query, :query, params)
|
||||||
|> Builder.convert_to_keyword()
|
|> Builder.convert_to_keyword()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@prefix Pleroma.Gun.ConnectionPool
|
||||||
|
defp maybe_limit(fun, Tesla.Adapter.Gun, opts) do
|
||||||
|
ConcurrentLimiter.limit(:"#{@prefix}.#{opts[:pool] || :default}", fun)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_limit(fun, _, _) do
|
||||||
|
fun.()
|
||||||
|
end
|
||||||
|
|
||||||
|
defp adapter_middlewares(Tesla.Adapter.Gun) do
|
||||||
|
[Pleroma.HTTP.Middleware.FollowRedirects]
|
||||||
|
end
|
||||||
|
|
||||||
|
defp adapter_middlewares(_), do: []
|
||||||
end
|
end
|
||||||
|
|
|
@ -571,10 +571,7 @@ defmodule Pleroma.Notification do
|
||||||
[
|
[
|
||||||
:self,
|
:self,
|
||||||
:invisible,
|
:invisible,
|
||||||
:followers,
|
:block_from_strangers,
|
||||||
:follows,
|
|
||||||
:non_followers,
|
|
||||||
:non_follows,
|
|
||||||
:recently_followed,
|
:recently_followed,
|
||||||
:filtered
|
:filtered
|
||||||
]
|
]
|
||||||
|
@ -595,45 +592,15 @@ defmodule Pleroma.Notification do
|
||||||
end
|
end
|
||||||
|
|
||||||
def skip?(
|
def skip?(
|
||||||
:followers,
|
:block_from_strangers,
|
||||||
%Activity{} = activity,
|
%Activity{} = activity,
|
||||||
%User{notification_settings: %{followers: false}} = user
|
%User{notification_settings: %{block_from_strangers: true}} = user
|
||||||
) do
|
|
||||||
actor = activity.data["actor"]
|
|
||||||
follower = User.get_cached_by_ap_id(actor)
|
|
||||||
User.following?(follower, user)
|
|
||||||
end
|
|
||||||
|
|
||||||
def skip?(
|
|
||||||
:non_followers,
|
|
||||||
%Activity{} = activity,
|
|
||||||
%User{notification_settings: %{non_followers: false}} = user
|
|
||||||
) do
|
) do
|
||||||
actor = activity.data["actor"]
|
actor = activity.data["actor"]
|
||||||
follower = User.get_cached_by_ap_id(actor)
|
follower = User.get_cached_by_ap_id(actor)
|
||||||
!User.following?(follower, user)
|
!User.following?(follower, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def skip?(
|
|
||||||
:follows,
|
|
||||||
%Activity{} = activity,
|
|
||||||
%User{notification_settings: %{follows: false}} = user
|
|
||||||
) do
|
|
||||||
actor = activity.data["actor"]
|
|
||||||
followed = User.get_cached_by_ap_id(actor)
|
|
||||||
User.following?(user, followed)
|
|
||||||
end
|
|
||||||
|
|
||||||
def skip?(
|
|
||||||
:non_follows,
|
|
||||||
%Activity{} = activity,
|
|
||||||
%User{notification_settings: %{non_follows: false}} = user
|
|
||||||
) do
|
|
||||||
actor = activity.data["actor"]
|
|
||||||
followed = User.get_cached_by_ap_id(actor)
|
|
||||||
!User.following?(user, followed)
|
|
||||||
end
|
|
||||||
|
|
||||||
# To do: consider defining recency in hours and checking FollowingRelationship with a single SQL
|
# To do: consider defining recency in hours and checking FollowingRelationship with a single SQL
|
||||||
def skip?(:recently_followed, %Activity{data: %{"type" => "Follow"}} = activity, %User{} = user) do
|
def skip?(:recently_followed, %Activity{data: %{"type" => "Follow"}} = activity, %User{} = user) do
|
||||||
actor = activity.data["actor"]
|
actor = activity.data["actor"]
|
||||||
|
|
|
@ -124,6 +124,10 @@ defmodule Pleroma.Object.Fetcher do
|
||||||
{:error, "Object has been deleted"} ->
|
{:error, "Object has been deleted"} ->
|
||||||
nil
|
nil
|
||||||
|
|
||||||
|
{:reject, reason} ->
|
||||||
|
Logger.info("Rejected #{id} while fetching: #{inspect(reason)}")
|
||||||
|
nil
|
||||||
|
|
||||||
e ->
|
e ->
|
||||||
Logger.error("Error while fetching #{id}: #{inspect(e)}")
|
Logger.error("Error while fetching #{id}: #{inspect(e)}")
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -1,283 +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.Pool.Connections do
|
|
||||||
use GenServer
|
|
||||||
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.Gun
|
|
||||||
|
|
||||||
require Logger
|
|
||||||
|
|
||||||
@type domain :: String.t()
|
|
||||||
@type conn :: Pleroma.Gun.Conn.t()
|
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
|
||||||
conns: %{domain() => conn()},
|
|
||||||
opts: keyword()
|
|
||||||
}
|
|
||||||
|
|
||||||
defstruct conns: %{}, opts: []
|
|
||||||
|
|
||||||
@spec start_link({atom(), keyword()}) :: {:ok, pid()}
|
|
||||||
def start_link({name, opts}) do
|
|
||||||
GenServer.start_link(__MODULE__, opts, name: name)
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def init(opts), do: {:ok, %__MODULE__{conns: %{}, opts: opts}}
|
|
||||||
|
|
||||||
@spec checkin(String.t() | URI.t(), atom()) :: pid() | nil
|
|
||||||
def checkin(url, name)
|
|
||||||
def checkin(url, name) when is_binary(url), do: checkin(URI.parse(url), name)
|
|
||||||
|
|
||||||
def checkin(%URI{} = uri, name) do
|
|
||||||
timeout = Config.get([:connections_pool, :checkin_timeout], 250)
|
|
||||||
|
|
||||||
GenServer.call(name, {:checkin, uri}, timeout)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec alive?(atom()) :: boolean()
|
|
||||||
def alive?(name) do
|
|
||||||
if pid = Process.whereis(name) do
|
|
||||||
Process.alive?(pid)
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec get_state(atom()) :: t()
|
|
||||||
def get_state(name) do
|
|
||||||
GenServer.call(name, :state)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec count(atom()) :: pos_integer()
|
|
||||||
def count(name) do
|
|
||||||
GenServer.call(name, :count)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec get_unused_conns(atom()) :: [{domain(), conn()}]
|
|
||||||
def get_unused_conns(name) do
|
|
||||||
GenServer.call(name, :unused_conns)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec checkout(pid(), pid(), atom()) :: :ok
|
|
||||||
def checkout(conn, pid, name) do
|
|
||||||
GenServer.cast(name, {:checkout, conn, pid})
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec add_conn(atom(), String.t(), Pleroma.Gun.Conn.t()) :: :ok
|
|
||||||
def add_conn(name, key, conn) do
|
|
||||||
GenServer.cast(name, {:add_conn, key, conn})
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec remove_conn(atom(), String.t()) :: :ok
|
|
||||||
def remove_conn(name, key) do
|
|
||||||
GenServer.cast(name, {:remove_conn, key})
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_cast({:add_conn, key, conn}, state) do
|
|
||||||
state = put_in(state.conns[key], conn)
|
|
||||||
|
|
||||||
Process.monitor(conn.conn)
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_cast({:checkout, conn_pid, pid}, state) do
|
|
||||||
state =
|
|
||||||
with true <- Process.alive?(conn_pid),
|
|
||||||
{key, conn} <- find_conn(state.conns, conn_pid),
|
|
||||||
used_by <- List.keydelete(conn.used_by, pid, 0) do
|
|
||||||
conn_state = if used_by == [], do: :idle, else: conn.conn_state
|
|
||||||
|
|
||||||
put_in(state.conns[key], %{conn | conn_state: conn_state, used_by: used_by})
|
|
||||||
else
|
|
||||||
false ->
|
|
||||||
Logger.debug("checkout for closed conn #{inspect(conn_pid)}")
|
|
||||||
state
|
|
||||||
|
|
||||||
nil ->
|
|
||||||
Logger.debug("checkout for alive conn #{inspect(conn_pid)}, but is not in state")
|
|
||||||
state
|
|
||||||
end
|
|
||||||
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_cast({:remove_conn, key}, state) do
|
|
||||||
state = put_in(state.conns, Map.delete(state.conns, key))
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_call({:checkin, uri}, from, state) do
|
|
||||||
key = "#{uri.scheme}:#{uri.host}:#{uri.port}"
|
|
||||||
|
|
||||||
case state.conns[key] do
|
|
||||||
%{conn: pid, gun_state: :up} = conn ->
|
|
||||||
time = :os.system_time(:second)
|
|
||||||
last_reference = time - conn.last_reference
|
|
||||||
crf = crf(last_reference, 100, conn.crf)
|
|
||||||
|
|
||||||
state =
|
|
||||||
put_in(state.conns[key], %{
|
|
||||||
conn
|
|
||||||
| last_reference: time,
|
|
||||||
crf: crf,
|
|
||||||
conn_state: :active,
|
|
||||||
used_by: [from | conn.used_by]
|
|
||||||
})
|
|
||||||
|
|
||||||
{:reply, pid, state}
|
|
||||||
|
|
||||||
%{gun_state: :down} ->
|
|
||||||
{:reply, nil, state}
|
|
||||||
|
|
||||||
nil ->
|
|
||||||
{:reply, nil, state}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_call(:state, _from, state), do: {:reply, state, state}
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_call(:count, _from, state) do
|
|
||||||
{:reply, Enum.count(state.conns), state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_call(:unused_conns, _from, state) do
|
|
||||||
unused_conns =
|
|
||||||
state.conns
|
|
||||||
|> Enum.filter(&filter_conns/1)
|
|
||||||
|> Enum.sort(&sort_conns/2)
|
|
||||||
|
|
||||||
{:reply, unused_conns, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
defp filter_conns({_, %{conn_state: :idle, used_by: []}}), do: true
|
|
||||||
defp filter_conns(_), do: false
|
|
||||||
|
|
||||||
defp sort_conns({_, c1}, {_, c2}) do
|
|
||||||
c1.crf <= c2.crf and c1.last_reference <= c2.last_reference
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_up, conn_pid, _protocol}, state) do
|
|
||||||
%{origin_host: host, origin_scheme: scheme, origin_port: port} = Gun.info(conn_pid)
|
|
||||||
|
|
||||||
host =
|
|
||||||
case :inet.ntoa(host) do
|
|
||||||
{:error, :einval} -> host
|
|
||||||
ip -> ip
|
|
||||||
end
|
|
||||||
|
|
||||||
key = "#{scheme}:#{host}:#{port}"
|
|
||||||
|
|
||||||
state =
|
|
||||||
with {key, conn} <- find_conn(state.conns, conn_pid, key),
|
|
||||||
{true, key} <- {Process.alive?(conn_pid), key} do
|
|
||||||
put_in(state.conns[key], %{
|
|
||||||
conn
|
|
||||||
| gun_state: :up,
|
|
||||||
conn_state: :active,
|
|
||||||
retries: 0
|
|
||||||
})
|
|
||||||
else
|
|
||||||
{false, key} ->
|
|
||||||
put_in(
|
|
||||||
state.conns,
|
|
||||||
Map.delete(state.conns, key)
|
|
||||||
)
|
|
||||||
|
|
||||||
nil ->
|
|
||||||
:ok = Gun.close(conn_pid)
|
|
||||||
|
|
||||||
state
|
|
||||||
end
|
|
||||||
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_down, conn_pid, _protocol, _reason, _killed}, state) do
|
|
||||||
retries = Config.get([:connections_pool, :retry], 1)
|
|
||||||
# we can't get info on this pid, because pid is dead
|
|
||||||
state =
|
|
||||||
with {key, conn} <- find_conn(state.conns, conn_pid),
|
|
||||||
{true, key} <- {Process.alive?(conn_pid), key} do
|
|
||||||
if conn.retries == retries do
|
|
||||||
:ok = Gun.close(conn.conn)
|
|
||||||
|
|
||||||
put_in(
|
|
||||||
state.conns,
|
|
||||||
Map.delete(state.conns, key)
|
|
||||||
)
|
|
||||||
else
|
|
||||||
put_in(state.conns[key], %{
|
|
||||||
conn
|
|
||||||
| gun_state: :down,
|
|
||||||
retries: conn.retries + 1
|
|
||||||
})
|
|
||||||
end
|
|
||||||
else
|
|
||||||
{false, key} ->
|
|
||||||
put_in(
|
|
||||||
state.conns,
|
|
||||||
Map.delete(state.conns, key)
|
|
||||||
)
|
|
||||||
|
|
||||||
nil ->
|
|
||||||
Logger.debug(":gun_down for conn which isn't found in state")
|
|
||||||
|
|
||||||
state
|
|
||||||
end
|
|
||||||
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:DOWN, _ref, :process, conn_pid, reason}, state) do
|
|
||||||
Logger.debug("received DOWN message for #{inspect(conn_pid)} reason -> #{inspect(reason)}")
|
|
||||||
|
|
||||||
state =
|
|
||||||
with {key, conn} <- find_conn(state.conns, conn_pid) do
|
|
||||||
Enum.each(conn.used_by, fn {pid, _ref} ->
|
|
||||||
Process.exit(pid, reason)
|
|
||||||
end)
|
|
||||||
|
|
||||||
put_in(
|
|
||||||
state.conns,
|
|
||||||
Map.delete(state.conns, key)
|
|
||||||
)
|
|
||||||
else
|
|
||||||
nil ->
|
|
||||||
Logger.debug(":DOWN for conn which isn't found in state")
|
|
||||||
|
|
||||||
state
|
|
||||||
end
|
|
||||||
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
defp find_conn(conns, conn_pid) do
|
|
||||||
Enum.find(conns, fn {_key, conn} ->
|
|
||||||
conn.conn == conn_pid
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp find_conn(conns, conn_pid, conn_key) do
|
|
||||||
Enum.find(conns, fn {key, conn} ->
|
|
||||||
key == conn_key and conn.conn == conn_pid
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
def crf(current, steps, crf) do
|
|
||||||
1 + :math.pow(0.5, current / steps) * crf
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,22 +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.Pool do
|
|
||||||
def child_spec(opts) do
|
|
||||||
poolboy_opts =
|
|
||||||
opts
|
|
||||||
|> Keyword.put(:worker_module, Pleroma.Pool.Request)
|
|
||||||
|> Keyword.put(:name, {:local, opts[:name]})
|
|
||||||
|> Keyword.put(:size, opts[:size])
|
|
||||||
|> Keyword.put(:max_overflow, opts[:max_overflow])
|
|
||||||
|
|
||||||
%{
|
|
||||||
id: opts[:id] || {__MODULE__, make_ref()},
|
|
||||||
start: {:poolboy, :start_link, [poolboy_opts, [name: opts[:name]]]},
|
|
||||||
restart: :permanent,
|
|
||||||
shutdown: 5000,
|
|
||||||
type: :worker
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,65 +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.Pool.Request do
|
|
||||||
use GenServer
|
|
||||||
|
|
||||||
require Logger
|
|
||||||
|
|
||||||
def start_link(args) do
|
|
||||||
GenServer.start_link(__MODULE__, args)
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def init(_), do: {:ok, []}
|
|
||||||
|
|
||||||
@spec execute(pid() | atom(), Tesla.Client.t(), keyword(), pos_integer()) ::
|
|
||||||
{:ok, Tesla.Env.t()} | {:error, any()}
|
|
||||||
def execute(pid, client, request, timeout) do
|
|
||||||
GenServer.call(pid, {:execute, client, request}, timeout)
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_call({:execute, client, request}, _from, state) do
|
|
||||||
response = Pleroma.HTTP.request(client, request)
|
|
||||||
|
|
||||||
{:reply, response, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_data, _conn, _stream, _, _}, state) do
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_up, _conn, _protocol}, state) do
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_down, _conn, _protocol, _reason, _killed}, state) do
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_error, _conn, _stream, _error}, state) do
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_push, _conn, _stream, _new_stream, _method, _uri, _headers}, state) do
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info({:gun_response, _conn, _stream, _, _status, _headers}, state) do
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_info(msg, state) do
|
|
||||||
Logger.warn("Received unexpected message #{inspect(__MODULE__)} #{inspect(msg)}")
|
|
||||||
{:noreply, state}
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,42 +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.Pool.Supervisor do
|
|
||||||
use Supervisor
|
|
||||||
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.Pool
|
|
||||||
|
|
||||||
def start_link(args) do
|
|
||||||
Supervisor.start_link(__MODULE__, args, name: __MODULE__)
|
|
||||||
end
|
|
||||||
|
|
||||||
def init(_) do
|
|
||||||
conns_child = %{
|
|
||||||
id: Pool.Connections,
|
|
||||||
start:
|
|
||||||
{Pool.Connections, :start_link, [{:gun_connections, Config.get([:connections_pool])}]}
|
|
||||||
}
|
|
||||||
|
|
||||||
Supervisor.init([conns_child | pools()], strategy: :one_for_one)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp pools do
|
|
||||||
pools = Config.get(:pools)
|
|
||||||
|
|
||||||
pools =
|
|
||||||
if Config.get([Pleroma.Upload, :proxy_remote]) == false do
|
|
||||||
Keyword.delete(pools, :upload)
|
|
||||||
else
|
|
||||||
pools
|
|
||||||
end
|
|
||||||
|
|
||||||
for {pool_name, pool_opts} <- pools do
|
|
||||||
pool_opts
|
|
||||||
|> Keyword.put(:id, {Pool, pool_name})
|
|
||||||
|> Keyword.put(:name, pool_name)
|
|
||||||
|> Pool.child_spec()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -48,7 +48,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
|
||||||
# if there were redirects we need to checkout old conn
|
# if there were redirects we need to checkout old conn
|
||||||
conn = opts[:old_conn] || opts[:conn]
|
conn = opts[:old_conn] || opts[:conn]
|
||||||
|
|
||||||
if conn, do: :ok = Pleroma.Pool.Connections.checkout(conn, self(), :gun_connections)
|
if conn, do: :ok = Pleroma.Gun.ConnectionPool.release_conn(conn)
|
||||||
|
|
||||||
:done
|
:done
|
||||||
end
|
end
|
||||||
|
|
76
lib/pleroma/telemetry/logger.ex
Normal file
76
lib/pleroma/telemetry/logger.ex
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
defmodule Pleroma.Telemetry.Logger do
|
||||||
|
@moduledoc "Transforms Pleroma telemetry events to logs"
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
|
@events [
|
||||||
|
[:pleroma, :connection_pool, :reclaim, :start],
|
||||||
|
[:pleroma, :connection_pool, :reclaim, :stop],
|
||||||
|
[:pleroma, :connection_pool, :provision_failure],
|
||||||
|
[:pleroma, :connection_pool, :client_death]
|
||||||
|
]
|
||||||
|
def attach do
|
||||||
|
:telemetry.attach_many("pleroma-logger", @events, &handle_event/4, [])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Passing anonymous functions instead of strings to logger is intentional,
|
||||||
|
# that way strings won't be concatenated if the message is going to be thrown
|
||||||
|
# out anyway due to higher log level configured
|
||||||
|
|
||||||
|
def handle_event(
|
||||||
|
[:pleroma, :connection_pool, :reclaim, :start],
|
||||||
|
_,
|
||||||
|
%{max_connections: max_connections, reclaim_max: reclaim_max},
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
Logger.debug(fn ->
|
||||||
|
"Connection pool is exhausted (reached #{max_connections} connections). Starting idle connection cleanup to reclaim as much as #{
|
||||||
|
reclaim_max
|
||||||
|
} connections"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event(
|
||||||
|
[:pleroma, :connection_pool, :reclaim, :stop],
|
||||||
|
%{reclaimed_count: 0},
|
||||||
|
_,
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
Logger.error(fn ->
|
||||||
|
"Connection pool failed to reclaim any connections due to all of them being in use. It will have to drop requests for opening connections to new hosts"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event(
|
||||||
|
[:pleroma, :connection_pool, :reclaim, :stop],
|
||||||
|
%{reclaimed_count: reclaimed_count},
|
||||||
|
_,
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
Logger.debug(fn -> "Connection pool cleaned up #{reclaimed_count} idle connections" end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event(
|
||||||
|
[:pleroma, :connection_pool, :provision_failure],
|
||||||
|
%{opts: [key | _]},
|
||||||
|
_,
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
Logger.error(fn ->
|
||||||
|
"Connection pool had to refuse opening a connection to #{key} due to connection limit exhaustion"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def handle_event(
|
||||||
|
[:pleroma, :connection_pool, :client_death],
|
||||||
|
%{client_pid: client_pid, reason: reason},
|
||||||
|
%{key: key},
|
||||||
|
_
|
||||||
|
) do
|
||||||
|
Logger.warn(fn ->
|
||||||
|
"Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{
|
||||||
|
inspect(reason)
|
||||||
|
}"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
110
lib/pleroma/tesla/middleware/follow_redirects.ex
Normal file
110
lib/pleroma/tesla/middleware/follow_redirects.ex
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2015-2020 Tymon Tobolski <https://github.com/teamon/tesla/blob/master/lib/tesla/middleware/follow_redirects.ex>
|
||||||
|
# Copyright © 2020 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.HTTP.Middleware.FollowRedirects do
|
||||||
|
@moduledoc """
|
||||||
|
Pool-aware version of https://github.com/teamon/tesla/blob/master/lib/tesla/middleware/follow_redirects.ex
|
||||||
|
|
||||||
|
Follow 3xx redirects
|
||||||
|
## Options
|
||||||
|
- `:max_redirects` - limit number of redirects (default: `5`)
|
||||||
|
"""
|
||||||
|
|
||||||
|
alias Pleroma.Gun.ConnectionPool
|
||||||
|
|
||||||
|
@behaviour Tesla.Middleware
|
||||||
|
|
||||||
|
@max_redirects 5
|
||||||
|
@redirect_statuses [301, 302, 303, 307, 308]
|
||||||
|
|
||||||
|
@impl Tesla.Middleware
|
||||||
|
def call(env, next, opts \\ []) do
|
||||||
|
max = Keyword.get(opts, :max_redirects, @max_redirects)
|
||||||
|
|
||||||
|
redirect(env, next, max)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp redirect(env, next, left) do
|
||||||
|
opts = env.opts[:adapter]
|
||||||
|
|
||||||
|
case Tesla.run(env, next) do
|
||||||
|
{:ok, %{status: status} = res} when status in @redirect_statuses and left > 0 ->
|
||||||
|
release_conn(opts)
|
||||||
|
|
||||||
|
case Tesla.get_header(res, "location") do
|
||||||
|
nil ->
|
||||||
|
{:ok, res}
|
||||||
|
|
||||||
|
location ->
|
||||||
|
location = parse_location(location, res)
|
||||||
|
|
||||||
|
case get_conn(location, opts) do
|
||||||
|
{:ok, opts} ->
|
||||||
|
%{env | opts: Keyword.put(env.opts, :adapter, opts)}
|
||||||
|
|> new_request(res.status, location)
|
||||||
|
|> redirect(next, left - 1)
|
||||||
|
|
||||||
|
e ->
|
||||||
|
e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
{:ok, %{status: status}} when status in @redirect_statuses ->
|
||||||
|
release_conn(opts)
|
||||||
|
{:error, {__MODULE__, :too_many_redirects}}
|
||||||
|
|
||||||
|
{:error, _} = e ->
|
||||||
|
release_conn(opts)
|
||||||
|
e
|
||||||
|
|
||||||
|
other ->
|
||||||
|
unless opts[:body_as] == :chunks do
|
||||||
|
release_conn(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
other
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp get_conn(location, opts) do
|
||||||
|
uri = URI.parse(location)
|
||||||
|
|
||||||
|
case ConnectionPool.get_conn(uri, opts) do
|
||||||
|
{:ok, conn} ->
|
||||||
|
{:ok, Keyword.merge(opts, conn: conn)}
|
||||||
|
|
||||||
|
e ->
|
||||||
|
e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp release_conn(opts) do
|
||||||
|
ConnectionPool.release_conn(opts[:conn])
|
||||||
|
end
|
||||||
|
|
||||||
|
# The 303 (See Other) redirect was added in HTTP/1.1 to indicate that the originally
|
||||||
|
# requested resource is not available, however a related resource (or another redirect)
|
||||||
|
# available via GET is available at the specified location.
|
||||||
|
# https://tools.ietf.org/html/rfc7231#section-6.4.4
|
||||||
|
defp new_request(env, 303, location), do: %{env | url: location, method: :get, query: []}
|
||||||
|
|
||||||
|
# The 307 (Temporary Redirect) status code indicates that the target
|
||||||
|
# resource resides temporarily under a different URI and the user agent
|
||||||
|
# MUST NOT change the request method (...)
|
||||||
|
# https://tools.ietf.org/html/rfc7231#section-6.4.7
|
||||||
|
defp new_request(env, 307, location), do: %{env | url: location}
|
||||||
|
|
||||||
|
defp new_request(env, _, location), do: %{env | url: location, query: []}
|
||||||
|
|
||||||
|
defp parse_location("https://" <> _rest = location, _env), do: location
|
||||||
|
defp parse_location("http://" <> _rest = location, _env), do: location
|
||||||
|
|
||||||
|
defp parse_location(location, env) do
|
||||||
|
env.url
|
||||||
|
|> URI.parse()
|
||||||
|
|> URI.merge(location)
|
||||||
|
|> URI.to_string()
|
||||||
|
end
|
||||||
|
end
|
|
@ -736,21 +736,25 @@ defmodule Pleroma.User do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_send_confirmation_email(%User{} = user) do
|
@spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
|
||||||
if user.confirmation_pending &&
|
def try_send_confirmation_email(%User{confirmation_pending: true} = user) do
|
||||||
Config.get([:instance, :account_activation_required]) do
|
if Config.get([:instance, :account_activation_required]) do
|
||||||
user
|
send_confirmation_email(user)
|
||||||
|> Pleroma.Emails.UserEmail.account_confirmation_email()
|
|
||||||
|> Pleroma.Emails.Mailer.deliver_async()
|
|
||||||
|
|
||||||
{:ok, :enqueued}
|
{:ok, :enqueued}
|
||||||
else
|
else
|
||||||
{:ok, :noop}
|
{:ok, :noop}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_send_confirmation_email(users) do
|
def try_send_confirmation_email(_), do: {:ok, :noop}
|
||||||
Enum.each(users, &try_send_confirmation_email/1)
|
|
||||||
|
@spec send_confirmation_email(Uset.t()) :: User.t()
|
||||||
|
def send_confirmation_email(%User{} = user) do
|
||||||
|
user
|
||||||
|
|> Pleroma.Emails.UserEmail.account_confirmation_email()
|
||||||
|
|> Pleroma.Emails.Mailer.deliver_async()
|
||||||
|
|
||||||
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
def needs_update?(%User{local: true}), do: false
|
def needs_update?(%User{local: true}), do: false
|
||||||
|
|
|
@ -10,21 +10,15 @@ defmodule Pleroma.User.NotificationSetting do
|
||||||
@primary_key false
|
@primary_key false
|
||||||
|
|
||||||
embedded_schema do
|
embedded_schema do
|
||||||
field(:followers, :boolean, default: true)
|
field(:block_from_strangers, :boolean, default: false)
|
||||||
field(:follows, :boolean, default: true)
|
field(:hide_notification_contents, :boolean, default: false)
|
||||||
field(:non_follows, :boolean, default: true)
|
|
||||||
field(:non_followers, :boolean, default: true)
|
|
||||||
field(:privacy_option, :boolean, default: false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def changeset(schema, params) do
|
def changeset(schema, params) do
|
||||||
schema
|
schema
|
||||||
|> cast(prepare_attrs(params), [
|
|> cast(prepare_attrs(params), [
|
||||||
:followers,
|
:block_from_strangers,
|
||||||
:follows,
|
:hide_notification_contents
|
||||||
:non_follows,
|
|
||||||
:non_followers,
|
|
||||||
:privacy_option
|
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1370,6 +1370,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
Logger.debug("Could not decode user at fetch #{ap_id}, #{inspect(e)}")
|
Logger.debug("Could not decode user at fetch #{ap_id}, #{inspect(e)}")
|
||||||
{:error, e}
|
{:error, e}
|
||||||
|
|
||||||
|
{:error, {:reject, reason} = e} ->
|
||||||
|
Logger.info("Rejected user #{ap_id}: #{inspect(reason)}")
|
||||||
|
{:error, e}
|
||||||
|
|
||||||
{:error, e} ->
|
{:error, e} ->
|
||||||
Logger.error("Could not decode user at fetch #{ap_id}, #{inspect(e)}")
|
Logger.error("Could not decode user at fetch #{ap_id}, #{inspect(e)}")
|
||||||
{:error, e}
|
{:error, e}
|
||||||
|
|
|
@ -60,7 +60,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy do
|
||||||
if score < 0.8 do
|
if score < 0.8 do
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
{:reject, nil}
|
{:reject, "[AntiFollowbotPolicy] Scored #{actor_id} as #{score}"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,14 +39,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicy do
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
|
|
||||||
{:old_user, false} ->
|
{:old_user, false} ->
|
||||||
{:reject, nil}
|
{:reject, "[AntiLinkSpamPolicy] User has no posts nor followers"}
|
||||||
|
|
||||||
{:error, _} ->
|
{:error, _} ->
|
||||||
{:reject, nil}
|
{:reject, "[AntiLinkSpamPolicy] Failed to get or fetch user by ap_id"}
|
||||||
|
|
||||||
e ->
|
e ->
|
||||||
Logger.warn("[MRF anti-link-spam] WTF: unhandled error #{inspect(e)}")
|
{:reject, "[AntiLinkSpamPolicy] Unhandled error #{inspect(e)}"}
|
||||||
{:reject, nil}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
|
||||||
defp reject_message(message, threshold) when threshold > 0 do
|
defp reject_message(message, threshold) when threshold > 0 do
|
||||||
with {_, recipients} <- get_recipient_count(message) do
|
with {_, recipients} <- get_recipient_count(message) do
|
||||||
if recipients > threshold do
|
if recipients > threshold do
|
||||||
{:reject, nil}
|
{:reject, "[HellthreadPolicy] #{recipients} recipients is over the limit of #{threshold}"}
|
||||||
else
|
else
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
end
|
end
|
||||||
|
@ -87,7 +87,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
|
||||||
{:ok, message} <- delist_message(message, delist_threshold) do
|
{:ok, message} <- delist_message(message, delist_threshold) do
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
_e -> {:reject, nil}
|
e -> e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicy do
|
||||||
if Enum.any?(Pleroma.Config.get([:mrf_keyword, :reject]), fn pattern ->
|
if Enum.any?(Pleroma.Config.get([:mrf_keyword, :reject]), fn pattern ->
|
||||||
string_matches?(content, pattern) or string_matches?(summary, pattern)
|
string_matches?(content, pattern) or string_matches?(summary, pattern)
|
||||||
end) do
|
end) do
|
||||||
{:reject, nil}
|
{:reject, "[KeywordPolicy] Matches with rejected keyword"}
|
||||||
else
|
else
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
end
|
end
|
||||||
|
@ -89,8 +89,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicy do
|
||||||
{:ok, message} <- check_replace(message) do
|
{:ok, message} <- check_replace(message) do
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
_e ->
|
{:reject, nil} -> {:reject, "[KeywordPolicy] "}
|
||||||
{:reject, nil}
|
{:reject, _} = e -> e
|
||||||
|
_e -> {:reject, "[KeywordPolicy] "}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.MentionPolicy do
|
||||||
reject_actors = Pleroma.Config.get([:mrf_mention, :actors], [])
|
reject_actors = Pleroma.Config.get([:mrf_mention, :actors], [])
|
||||||
recipients = (message["to"] || []) ++ (message["cc"] || [])
|
recipients = (message["to"] || []) ++ (message["cc"] || [])
|
||||||
|
|
||||||
if Enum.any?(recipients, fn recipient -> Enum.member?(reject_actors, recipient) end) do
|
if rejected_mention =
|
||||||
{:reject, nil}
|
Enum.find(recipients, fn recipient -> Enum.member?(reject_actors, recipient) end) do
|
||||||
|
{:reject, "[MentionPolicy] Rejected for mention of #{rejected_mention}"}
|
||||||
else
|
else
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,7 +28,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
|
||||||
|
|
||||||
defp check_reject(message, actions) do
|
defp check_reject(message, actions) do
|
||||||
if :reject in actions do
|
if :reject in actions do
|
||||||
{:reject, nil}
|
{:reject, "[ObjectAgePolicy]"}
|
||||||
else
|
else
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
end
|
end
|
||||||
|
@ -47,9 +47,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
|
||||||
|
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
# Unhandleable error: somebody is messing around, just drop the message.
|
|
||||||
_e ->
|
_e ->
|
||||||
{:reject, nil}
|
{:reject, "[ObjectAgePolicy] Unhandled error"}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
|
@ -69,9 +68,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
|
||||||
|
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
# Unhandleable error: somebody is messing around, just drop the message.
|
|
||||||
_e ->
|
_e ->
|
||||||
{:reject, nil}
|
{:reject, "[ObjectAgePolicy] Unhandled error"}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
|
|
|
@ -38,7 +38,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublic do
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
|
|
||||||
true ->
|
true ->
|
||||||
{:reject, nil}
|
{:reject, "[RejectNonPublic] visibility: #{visibility}"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
|
||||||
accepts == [] -> {:ok, object}
|
accepts == [] -> {:ok, object}
|
||||||
actor_host == Config.get([Pleroma.Web.Endpoint, :url, :host]) -> {:ok, object}
|
actor_host == Config.get([Pleroma.Web.Endpoint, :url, :host]) -> {:ok, object}
|
||||||
MRF.subdomain_match?(accepts, actor_host) -> {:ok, object}
|
MRF.subdomain_match?(accepts, actor_host) -> {:ok, object}
|
||||||
true -> {:reject, nil}
|
true -> {:reject, "[SimplePolicy] host not in accept list"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
|
||||||
|> MRF.subdomains_regex()
|
|> MRF.subdomains_regex()
|
||||||
|
|
||||||
if MRF.subdomain_match?(rejects, actor_host) do
|
if MRF.subdomain_match?(rejects, actor_host) do
|
||||||
{:reject, nil}
|
{:reject, "[SimplePolicy] host in reject list"}
|
||||||
else
|
else
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
end
|
end
|
||||||
|
@ -114,7 +114,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
|
||||||
|> MRF.subdomains_regex()
|
|> MRF.subdomains_regex()
|
||||||
|
|
||||||
if MRF.subdomain_match?(report_removal, actor_host) do
|
if MRF.subdomain_match?(report_removal, actor_host) do
|
||||||
{:reject, nil}
|
{:reject, "[SimplePolicy] host in report_removal list"}
|
||||||
else
|
else
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
end
|
end
|
||||||
|
@ -159,7 +159,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
|
||||||
|> MRF.subdomains_regex()
|
|> MRF.subdomains_regex()
|
||||||
|
|
||||||
if MRF.subdomain_match?(reject_deletes, actor_host) do
|
if MRF.subdomain_match?(reject_deletes, actor_host) do
|
||||||
{:reject, nil}
|
{:reject, "[SimplePolicy] host in reject_deletes list"}
|
||||||
else
|
else
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
end
|
end
|
||||||
|
@ -177,7 +177,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
|
||||||
{:ok, object} <- check_report_removal(actor_info, object) do
|
{:ok, object} <- check_report_removal(actor_info, object) do
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
else
|
else
|
||||||
_e -> {:reject, nil}
|
{:reject, nil} -> {:reject, "[SimplePolicy]"}
|
||||||
|
{:reject, _} = e -> e
|
||||||
|
_ -> {:reject, "[SimplePolicy]"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -191,7 +193,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
|
||||||
{:ok, object} <- check_banner_removal(actor_info, object) do
|
{:ok, object} <- check_banner_removal(actor_info, object) do
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
else
|
else
|
||||||
_e -> {:reject, nil}
|
{:reject, nil} -> {:reject, "[SimplePolicy]"}
|
||||||
|
{:reject, _} = e -> e
|
||||||
|
_ -> {:reject, "[SimplePolicy]"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -134,12 +134,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do
|
||||||
if user.local == true do
|
if user.local == true do
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
{:reject, nil}
|
{:reject,
|
||||||
|
"[TagPolicy] Follow from #{actor} tagged with mrf_tag:disable-remote-subscription"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp process_tag("mrf_tag:disable-any-subscription", %{"type" => "Follow"}),
|
defp process_tag("mrf_tag:disable-any-subscription", %{"type" => "Follow", "actor" => actor}),
|
||||||
do: {:reject, nil}
|
do: {:reject, "[TagPolicy] Follow from #{actor} tagged with mrf_tag:disable-any-subscription"}
|
||||||
|
|
||||||
defp process_tag(_, message), do: {:ok, message}
|
defp process_tag(_, message), do: {:ok, message}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy do
|
||||||
if actor in allow_list do
|
if actor in allow_list do
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
else
|
else
|
||||||
{:reject, nil}
|
{:reject, "[UserAllowListPolicy] #{actor} not in the list"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,22 +11,26 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicy do
|
||||||
with {:ok, _} <- filter(child_message) do
|
with {:ok, _} <- filter(child_message) do
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
{:reject, nil} ->
|
{:reject, _} = e -> e
|
||||||
{:reject, nil}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter(%{"type" => message_type} = message) do
|
def filter(%{"type" => message_type} = message) do
|
||||||
with accepted_vocabulary <- Pleroma.Config.get([:mrf_vocabulary, :accept]),
|
with accepted_vocabulary <- Pleroma.Config.get([:mrf_vocabulary, :accept]),
|
||||||
rejected_vocabulary <- Pleroma.Config.get([:mrf_vocabulary, :reject]),
|
rejected_vocabulary <- Pleroma.Config.get([:mrf_vocabulary, :reject]),
|
||||||
true <-
|
{_, true} <-
|
||||||
Enum.empty?(accepted_vocabulary) || Enum.member?(accepted_vocabulary, message_type),
|
{:accepted,
|
||||||
false <-
|
Enum.empty?(accepted_vocabulary) || Enum.member?(accepted_vocabulary, message_type)},
|
||||||
length(rejected_vocabulary) > 0 && Enum.member?(rejected_vocabulary, message_type),
|
{_, false} <-
|
||||||
|
{:rejected,
|
||||||
|
length(rejected_vocabulary) > 0 && Enum.member?(rejected_vocabulary, message_type)},
|
||||||
{:ok, _} <- filter(message["object"]) do
|
{:ok, _} <- filter(message["object"]) do
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
_ -> {:reject, nil}
|
{:reject, _} = e -> e
|
||||||
|
{:accepted, _} -> {:reject, "[VocabularyPolicy] #{message_type} not in accept list"}
|
||||||
|
{:rejected, _} -> {:reject, "[VocabularyPolicy] #{message_type} in reject list"}
|
||||||
|
_ -> {:reject, "[VocabularyPolicy]"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
||||||
"""
|
"""
|
||||||
def publish_one(%{inbox: inbox, json: json, actor: %User{} = actor, id: id} = params) do
|
def publish_one(%{inbox: inbox, json: json, actor: %User{} = actor, id: id} = params) do
|
||||||
Logger.debug("Federating #{id} to #{inbox}")
|
Logger.debug("Federating #{id} to #{inbox}")
|
||||||
%{host: host, path: path} = URI.parse(inbox)
|
|
||||||
|
uri = URI.parse(inbox)
|
||||||
|
|
||||||
digest = "SHA-256=" <> (:crypto.hash(:sha256, json) |> Base.encode64())
|
digest = "SHA-256=" <> (:crypto.hash(:sha256, json) |> Base.encode64())
|
||||||
|
|
||||||
|
@ -57,8 +58,8 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
||||||
|
|
||||||
signature =
|
signature =
|
||||||
Pleroma.Signature.sign(actor, %{
|
Pleroma.Signature.sign(actor, %{
|
||||||
"(request-target)": "post #{path}",
|
"(request-target)": "post #{uri.path}",
|
||||||
host: host,
|
host: signature_host(uri),
|
||||||
"content-length": byte_size(json),
|
"content-length": byte_size(json),
|
||||||
digest: digest,
|
digest: digest,
|
||||||
date: date
|
date: date
|
||||||
|
@ -76,8 +77,9 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
||||||
{"digest", digest}
|
{"digest", digest}
|
||||||
]
|
]
|
||||||
) do
|
) do
|
||||||
if !Map.has_key?(params, :unreachable_since) || params[:unreachable_since],
|
if not Map.has_key?(params, :unreachable_since) || params[:unreachable_since] do
|
||||||
do: Instances.set_reachable(inbox)
|
Instances.set_reachable(inbox)
|
||||||
|
end
|
||||||
|
|
||||||
result
|
result
|
||||||
else
|
else
|
||||||
|
@ -96,6 +98,14 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
||||||
|> publish_one()
|
|> publish_one()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp signature_host(%URI{port: port, scheme: scheme, host: host}) do
|
||||||
|
if port == URI.default_port(scheme) do
|
||||||
|
host
|
||||||
|
else
|
||||||
|
"#{host}:#{port}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp should_federate?(inbox, public) do
|
defp should_federate?(inbox, public) do
|
||||||
if public do
|
if public do
|
||||||
true
|
true
|
||||||
|
|
|
@ -178,7 +178,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
|> Map.drop(["conversation"])
|
|> Map.drop(["conversation"])
|
||||||
else
|
else
|
||||||
e ->
|
e ->
|
||||||
Logger.error("Couldn't fetch #{inspect(in_reply_to_id)}, error: #{inspect(e)}")
|
Logger.warn("Couldn't fetch #{inspect(in_reply_to_id)}, error: #{inspect(e)}")
|
||||||
object
|
object
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -719,15 +719,18 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
||||||
|
|
||||||
case Activity.get_by_ap_id_with_object(id) do
|
case Activity.get_by_ap_id_with_object(id) do
|
||||||
%Activity{} = activity ->
|
%Activity{} = activity ->
|
||||||
|
activity_actor = User.get_by_ap_id(activity.object.data["actor"])
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"type" => "Note",
|
"type" => "Note",
|
||||||
"id" => activity.data["id"],
|
"id" => activity.data["id"],
|
||||||
"content" => activity.object.data["content"],
|
"content" => activity.object.data["content"],
|
||||||
"published" => activity.object.data["published"],
|
"published" => activity.object.data["published"],
|
||||||
"actor" =>
|
"actor" =>
|
||||||
AccountView.render("show.json", %{
|
AccountView.render(
|
||||||
user: User.get_by_ap_id(activity.object.data["actor"])
|
"show.json",
|
||||||
})
|
%{user: activity_actor, skip_visibility_check: true}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
|
|
|
@ -361,7 +361,11 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
||||||
with {:ok, users, count} <- Search.user(Map.merge(search_params, filters)) do
|
with {:ok, users, count} <- Search.user(Map.merge(search_params, filters)) do
|
||||||
json(
|
json(
|
||||||
conn,
|
conn,
|
||||||
AccountView.render("index.json", users: users, count: count, page_size: page_size)
|
AccountView.render("index.json",
|
||||||
|
users: users,
|
||||||
|
count: count,
|
||||||
|
page_size: page_size
|
||||||
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -632,29 +636,24 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm_email(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do
|
def confirm_email(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do
|
||||||
users = nicknames |> Enum.map(&User.get_cached_by_nickname/1)
|
users = Enum.map(nicknames, &User.get_cached_by_nickname/1)
|
||||||
|
|
||||||
User.toggle_confirmation(users)
|
User.toggle_confirmation(users)
|
||||||
|
|
||||||
ModerationLog.insert_log(%{
|
ModerationLog.insert_log(%{actor: admin, subject: users, action: "confirm_email"})
|
||||||
actor: admin,
|
|
||||||
subject: users,
|
|
||||||
action: "confirm_email"
|
|
||||||
})
|
|
||||||
|
|
||||||
json(conn, "")
|
json(conn, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
def resend_confirmation_email(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do
|
def resend_confirmation_email(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do
|
||||||
users = nicknames |> Enum.map(&User.get_cached_by_nickname/1)
|
users =
|
||||||
|
Enum.map(nicknames, fn nickname ->
|
||||||
|
nickname
|
||||||
|
|> User.get_cached_by_nickname()
|
||||||
|
|> User.send_confirmation_email()
|
||||||
|
end)
|
||||||
|
|
||||||
User.try_send_confirmation_email(users)
|
ModerationLog.insert_log(%{actor: admin, subject: users, action: "resend_confirmation_email"})
|
||||||
|
|
||||||
ModerationLog.insert_log(%{
|
|
||||||
actor: admin,
|
|
||||||
subject: users,
|
|
||||||
action: "resend_confirmation_email"
|
|
||||||
})
|
|
||||||
|
|
||||||
json(conn, "")
|
json(conn, "")
|
||||||
end
|
end
|
||||||
|
|
|
@ -107,7 +107,7 @@ defmodule Pleroma.Web.AdminAPI.AccountView do
|
||||||
end
|
end
|
||||||
|
|
||||||
def merge_account_views(%User{} = user) do
|
def merge_account_views(%User{} = user) do
|
||||||
MastodonAPI.AccountView.render("show.json", %{user: user})
|
MastodonAPI.AccountView.render("show.json", %{user: user, skip_visibility_check: true})
|
||||||
|> Map.merge(AdminAPI.AccountView.render("show.json", %{user: user}))
|
|> Map.merge(AdminAPI.AccountView.render("show.json", %{user: user}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
||||||
"Accounts which follow the given account, if network is not hidden by the account owner.",
|
"Accounts which follow the given account, if network is not hidden by the account owner.",
|
||||||
parameters: [
|
parameters: [
|
||||||
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
|
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
|
||||||
|
Operation.parameter(:id, :query, :string, "ID of the resource owner"),
|
||||||
with_relationships_param() | pagination_params()
|
with_relationships_param() | pagination_params()
|
||||||
],
|
],
|
||||||
responses: %{
|
responses: %{
|
||||||
|
@ -177,6 +178,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
||||||
"Accounts which the given account is following, if network is not hidden by the account owner.",
|
"Accounts which the given account is following, if network is not hidden by the account owner.",
|
||||||
parameters: [
|
parameters: [
|
||||||
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
|
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
|
||||||
|
Operation.parameter(:id, :query, :string, "ID of the resource owner"),
|
||||||
with_relationships_param() | pagination_params()
|
with_relationships_param() | pagination_params()
|
||||||
],
|
],
|
||||||
responses: %{200 => Operation.response("Accounts", "application/json", array_of_accounts())}
|
responses: %{200 => Operation.response("Accounts", "application/json", array_of_accounts())}
|
||||||
|
|
|
@ -300,11 +300,11 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
|
||||||
"content" => "Check this out :firefox:",
|
"content" => "Check this out :firefox:",
|
||||||
"id" => "13",
|
"id" => "13",
|
||||||
"chat_id" => "1",
|
"chat_id" => "1",
|
||||||
"actor_id" => "someflakeid",
|
"account_id" => "someflakeid",
|
||||||
"unread" => false
|
"unread" => false
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
"actor_id" => "someflakeid",
|
"account_id" => "someflakeid",
|
||||||
"content" => "Whats' up?",
|
"content" => "Whats' up?",
|
||||||
"id" => "12",
|
"id" => "12",
|
||||||
"chat_id" => "1",
|
"chat_id" => "1",
|
||||||
|
|
|
@ -31,6 +31,7 @@ defmodule Pleroma.Web.ApiSpec.DomainBlockOperation do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Supporting domain query parameter is deprecated in Mastodon API
|
||||||
def create_operation do
|
def create_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["domain_blocks"],
|
tags: ["domain_blocks"],
|
||||||
|
@ -45,11 +46,13 @@ defmodule Pleroma.Web.ApiSpec.DomainBlockOperation do
|
||||||
""",
|
""",
|
||||||
operationId: "DomainBlockController.create",
|
operationId: "DomainBlockController.create",
|
||||||
requestBody: domain_block_request(),
|
requestBody: domain_block_request(),
|
||||||
|
parameters: [Operation.parameter(:domain, :query, %Schema{type: :string}, "Domain name")],
|
||||||
security: [%{"oAuth" => ["follow", "write:blocks"]}],
|
security: [%{"oAuth" => ["follow", "write:blocks"]}],
|
||||||
responses: %{200 => empty_object_response()}
|
responses: %{200 => empty_object_response()}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Supporting domain query parameter is deprecated in Mastodon API
|
||||||
def delete_operation do
|
def delete_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["domain_blocks"],
|
tags: ["domain_blocks"],
|
||||||
|
@ -57,6 +60,7 @@ defmodule Pleroma.Web.ApiSpec.DomainBlockOperation do
|
||||||
description: "Remove a domain block, if it exists in the user's array of blocked domains.",
|
description: "Remove a domain block, if it exists in the user's array of blocked domains.",
|
||||||
operationId: "DomainBlockController.delete",
|
operationId: "DomainBlockController.delete",
|
||||||
requestBody: domain_block_request(),
|
requestBody: domain_block_request(),
|
||||||
|
parameters: [Operation.parameter(:domain, :query, %Schema{type: :string}, "Domain name")],
|
||||||
security: [%{"oAuth" => ["follow", "write:blocks"]}],
|
security: [%{"oAuth" => ["follow", "write:blocks"]}],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("Empty object", "application/json", %Schema{type: :object})
|
200 => Operation.response("Empty object", "application/json", %Schema{type: :object})
|
||||||
|
@ -71,10 +75,9 @@ defmodule Pleroma.Web.ApiSpec.DomainBlockOperation do
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
domain: %Schema{type: :string}
|
domain: %Schema{type: :string}
|
||||||
},
|
}
|
||||||
required: [:domain]
|
|
||||||
},
|
},
|
||||||
required: true,
|
required: false,
|
||||||
example: %{
|
example: %{
|
||||||
"domain" => "facebook.com"
|
"domain" => "facebook.com"
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,11 +90,8 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
||||||
notification_settings: %Schema{
|
notification_settings: %Schema{
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: %{
|
properties: %{
|
||||||
followers: %Schema{type: :boolean},
|
block_from_strangers: %Schema{type: :boolean},
|
||||||
follows: %Schema{type: :boolean},
|
hide_notification_contents: %Schema{type: :boolean}
|
||||||
non_followers: %Schema{type: :boolean},
|
|
||||||
non_follows: %Schema{type: :boolean},
|
|
||||||
privacy_option: %Schema{type: :boolean}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
relationship: AccountRelationship,
|
relationship: AccountRelationship,
|
||||||
|
@ -182,11 +179,8 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
||||||
"unread_conversation_count" => 0,
|
"unread_conversation_count" => 0,
|
||||||
"tags" => [],
|
"tags" => [],
|
||||||
"notification_settings" => %{
|
"notification_settings" => %{
|
||||||
"followers" => true,
|
"block_from_strangers" => false,
|
||||||
"follows" => true,
|
"hide_notification_contents" => false
|
||||||
"non_followers" => true,
|
|
||||||
"non_follows" => true,
|
|
||||||
"privacy_option" => false
|
|
||||||
},
|
},
|
||||||
"relationship" => %{
|
"relationship" => %{
|
||||||
"blocked_by" => false,
|
"blocked_by" => false,
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
|
|
||||||
defmodule Pleroma.Web.ChatChannel do
|
defmodule Pleroma.Web.ChatChannel do
|
||||||
use Phoenix.Channel
|
use Phoenix.Channel
|
||||||
|
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.ChatChannel.ChatChannelState
|
alias Pleroma.Web.ChatChannel.ChatChannelState
|
||||||
|
alias Pleroma.Web.MastodonAPI.AccountView
|
||||||
|
|
||||||
def join("chat:public", _message, socket) do
|
def join("chat:public", _message, socket) do
|
||||||
send(self(), :after_join)
|
send(self(), :after_join)
|
||||||
|
@ -22,9 +24,9 @@ defmodule Pleroma.Web.ChatChannel do
|
||||||
|
|
||||||
if String.length(text) in 1..Pleroma.Config.get([:instance, :chat_limit]) do
|
if String.length(text) in 1..Pleroma.Config.get([:instance, :chat_limit]) do
|
||||||
author = User.get_cached_by_nickname(user_name)
|
author = User.get_cached_by_nickname(user_name)
|
||||||
author = Pleroma.Web.MastodonAPI.AccountView.render("show.json", user: author)
|
author_json = AccountView.render("show.json", user: author, skip_visibility_check: true)
|
||||||
|
|
||||||
message = ChatChannelState.add_message(%{text: text, author: author})
|
message = ChatChannelState.add_message(%{text: text, author: author_json})
|
||||||
|
|
||||||
broadcast!(socket, "new_msg", message)
|
broadcast!(socket, "new_msg", message)
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,9 +32,19 @@ defmodule Pleroma.Web.MastodonAPI.DomainBlockController do
|
||||||
json(conn, %{})
|
json(conn, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create(%{assigns: %{user: blocker}} = conn, %{domain: domain}) do
|
||||||
|
User.block_domain(blocker, domain)
|
||||||
|
json(conn, %{})
|
||||||
|
end
|
||||||
|
|
||||||
@doc "DELETE /api/v1/domain_blocks"
|
@doc "DELETE /api/v1/domain_blocks"
|
||||||
def delete(%{assigns: %{user: blocker}, body_params: %{domain: domain}} = conn, _params) do
|
def delete(%{assigns: %{user: blocker}, body_params: %{domain: domain}} = conn, _params) do
|
||||||
User.unblock_domain(blocker, domain)
|
User.unblock_domain(blocker, domain)
|
||||||
json(conn, %{})
|
json(conn, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delete(%{assigns: %{user: blocker}} = conn, %{domain: domain}) do
|
||||||
|
User.unblock_domain(blocker, domain)
|
||||||
|
json(conn, %{})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -93,7 +93,6 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
||||||
AccountView.render("index.json",
|
AccountView.render("index.json",
|
||||||
users: accounts,
|
users: accounts,
|
||||||
for: options[:for_user],
|
for: options[:for_user],
|
||||||
as: :user,
|
|
||||||
embed_relationships: options[:embed_relationships]
|
embed_relationships: options[:embed_relationships]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -172,6 +172,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
|
||||||
with_direct_conversation_id: true
|
with_direct_conversation_id: true
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
{:error, {:reject, message}} ->
|
||||||
|
conn
|
||||||
|
|> put_status(:unprocessable_entity)
|
||||||
|
|> json(%{error: message})
|
||||||
|
|
||||||
{:error, message} ->
|
{:error, message} ->
|
||||||
conn
|
conn
|
||||||
|> put_status(:unprocessable_entity)
|
|> put_status(:unprocessable_entity)
|
||||||
|
|
|
@ -27,21 +27,40 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
||||||
UserRelationship.view_relationships_option(reading_user, users)
|
UserRelationship.view_relationships_option(reading_user, users)
|
||||||
end
|
end
|
||||||
|
|
||||||
opts = Map.put(opts, :relationships, relationships_opt)
|
opts =
|
||||||
|
opts
|
||||||
|
|> Map.merge(%{relationships: relationships_opt, as: :user})
|
||||||
|
|> Map.delete(:users)
|
||||||
|
|
||||||
users
|
users
|
||||||
|> render_many(AccountView, "show.json", opts)
|
|> render_many(AccountView, "show.json", opts)
|
||||||
|> Enum.filter(&Enum.any?/1)
|
|> Enum.filter(&Enum.any?/1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("show.json", %{user: user} = opts) do
|
@doc """
|
||||||
if User.visible_for(user, opts[:for]) == :visible do
|
Renders specified user account.
|
||||||
|
:skip_visibility_check option skips visibility check and renders any user (local or remote)
|
||||||
|
regardless of [:pleroma, :restrict_unauthenticated] setting.
|
||||||
|
:for option specifies the requester and can be a User record or nil.
|
||||||
|
Only use `user: user, for: user` when `user` is the actual requester of own profile.
|
||||||
|
"""
|
||||||
|
def render("show.json", %{user: _user, skip_visibility_check: true} = opts) do
|
||||||
|
do_render("show.json", opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def render("show.json", %{user: user, for: for_user_or_nil} = opts) do
|
||||||
|
if User.visible_for(user, for_user_or_nil) == :visible do
|
||||||
do_render("show.json", opts)
|
do_render("show.json", opts)
|
||||||
else
|
else
|
||||||
%{}
|
%{}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render("show.json", _) do
|
||||||
|
raise "In order to prevent account accessibility issues, " <>
|
||||||
|
":skip_visibility_check or :for option is required."
|
||||||
|
end
|
||||||
|
|
||||||
def render("mention.json", %{user: user}) do
|
def render("mention.json", %{user: user}) do
|
||||||
%{
|
%{
|
||||||
id: to_string(user.id),
|
id: to_string(user.id),
|
||||||
|
|
|
@ -38,7 +38,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: participation.id |> to_string(),
|
id: participation.id |> to_string(),
|
||||||
accounts: render(AccountView, "index.json", users: users, as: :user),
|
accounts: render(AccountView, "index.json", users: users, for: user),
|
||||||
unread: !participation.read,
|
unread: !participation.read,
|
||||||
last_status:
|
last_status:
|
||||||
render(StatusView, "show.json",
|
render(StatusView, "show.json",
|
||||||
|
|
|
@ -42,7 +42,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
||||||
account_activation_required: Keyword.get(instance, :account_activation_required),
|
account_activation_required: Keyword.get(instance, :account_activation_required),
|
||||||
features: features(),
|
features: features(),
|
||||||
federation: federation(),
|
federation: federation(),
|
||||||
fields_limits: fields_limits()
|
fields_limits: fields_limits(),
|
||||||
|
post_formats: Config.get([:instance, :allowed_post_formats])
|
||||||
},
|
},
|
||||||
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,13 +297,17 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
|
|
||||||
emoji_reactions =
|
emoji_reactions =
|
||||||
with %{data: %{"reactions" => emoji_reactions}} <- object do
|
with %{data: %{"reactions" => emoji_reactions}} <- object do
|
||||||
Enum.map(emoji_reactions, fn [emoji, users] ->
|
Enum.map(emoji_reactions, fn
|
||||||
%{
|
[emoji, users] when is_list(users) ->
|
||||||
name: emoji,
|
build_emoji_map(emoji, users, opts[:for])
|
||||||
count: length(users),
|
|
||||||
me: !!(opts[:for] && opts[:for].ap_id in users)
|
{emoji, users} when is_list(users) ->
|
||||||
}
|
build_emoji_map(emoji, users, opts[:for])
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
nil
|
||||||
end)
|
end)
|
||||||
|
|> Enum.reject(&is_nil/1)
|
||||||
else
|
else
|
||||||
_ -> []
|
_ -> []
|
||||||
end
|
end
|
||||||
|
@ -545,4 +549,12 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
|
|
||||||
defp pinned?(%Activity{id: id}, %User{pinned_activities: pinned_activities}),
|
defp pinned?(%Activity{id: id}, %User{pinned_activities: pinned_activities}),
|
||||||
do: id in pinned_activities
|
do: id in pinned_activities
|
||||||
|
|
||||||
|
defp build_emoji_map(emoji, users, current_user) do
|
||||||
|
%{
|
||||||
|
name: emoji,
|
||||||
|
count: length(users),
|
||||||
|
me: !!(current_user && current_user.ap_id in users)
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -89,11 +89,11 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
|
||||||
cm_ref <- MessageReference.for_chat_and_object(chat, message) do
|
cm_ref <- MessageReference.for_chat_and_object(chat, message) do
|
||||||
conn
|
conn
|
||||||
|> put_view(MessageReferenceView)
|
|> put_view(MessageReferenceView)
|
||||||
|> render("show.json", for: user, chat_message_reference: cm_ref)
|
|> render("show.json", chat_message_reference: cm_ref)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def mark_message_as_read(%{assigns: %{user: %{id: user_id} = user}} = conn, %{
|
def mark_message_as_read(%{assigns: %{user: %{id: user_id}}} = conn, %{
|
||||||
id: chat_id,
|
id: chat_id,
|
||||||
message_id: message_id
|
message_id: message_id
|
||||||
}) do
|
}) do
|
||||||
|
@ -104,12 +104,15 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
|
||||||
{:ok, cm_ref} <- MessageReference.mark_as_read(cm_ref) do
|
{:ok, cm_ref} <- MessageReference.mark_as_read(cm_ref) do
|
||||||
conn
|
conn
|
||||||
|> put_view(MessageReferenceView)
|
|> put_view(MessageReferenceView)
|
||||||
|> render("show.json", for: user, chat_message_reference: cm_ref)
|
|> render("show.json", chat_message_reference: cm_ref)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def mark_as_read(
|
def mark_as_read(
|
||||||
%{body_params: %{last_read_id: last_read_id}, assigns: %{user: %{id: user_id}}} = conn,
|
%{
|
||||||
|
body_params: %{last_read_id: last_read_id},
|
||||||
|
assigns: %{user: %{id: user_id}}
|
||||||
|
} = conn,
|
||||||
%{id: id}
|
%{id: id}
|
||||||
) do
|
) do
|
||||||
with %Chat{} = chat <- Repo.get_by(Chat, id: id, user_id: user_id),
|
with %Chat{} = chat <- Repo.get_by(Chat, id: id, user_id: user_id),
|
||||||
|
@ -121,7 +124,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def messages(%{assigns: %{user: %{id: user_id} = user}} = conn, %{id: id} = params) do
|
def messages(%{assigns: %{user: %{id: user_id}}} = conn, %{id: id} = params) do
|
||||||
with %Chat{} = chat <- Repo.get_by(Chat, id: id, user_id: user_id) do
|
with %Chat{} = chat <- Repo.get_by(Chat, id: id, user_id: user_id) do
|
||||||
cm_refs =
|
cm_refs =
|
||||||
chat
|
chat
|
||||||
|
@ -130,7 +133,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_view(MessageReferenceView)
|
|> put_view(MessageReferenceView)
|
||||||
|> render("index.json", for: user, chat_message_references: cm_refs)
|
|> render("index.json", chat_message_references: cm_refs)
|
||||||
else
|
else
|
||||||
_ ->
|
_ ->
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -21,8 +21,8 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@skip_plugs [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug]
|
@skip_plugs [Pleroma.Plugs.OAuthScopesPlug, Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug]
|
||||||
plug(:skip_plug, @skip_plugs when action in [:archive, :show, :list])
|
plug(:skip_plug, @skip_plugs when action in [:index, :show, :archive])
|
||||||
|
|
||||||
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaEmojiPackOperation
|
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaEmojiPackOperation
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,11 @@ defmodule Pleroma.Web.PleromaAPI.ChatView do
|
||||||
def render("show.json", %{chat: %Chat{} = chat} = opts) do
|
def render("show.json", %{chat: %Chat{} = chat} = opts) do
|
||||||
recipient = User.get_cached_by_ap_id(chat.recipient)
|
recipient = User.get_cached_by_ap_id(chat.recipient)
|
||||||
last_message = opts[:last_message] || MessageReference.last_message_for_chat(chat)
|
last_message = opts[:last_message] || MessageReference.last_message_for_chat(chat)
|
||||||
|
account_view_opts = account_view_opts(opts, recipient)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: chat.id |> to_string(),
|
id: chat.id |> to_string(),
|
||||||
account: AccountView.render("show.json", Map.put(opts, :user, recipient)),
|
account: AccountView.render("show.json", account_view_opts),
|
||||||
unread: MessageReference.unread_count_for_chat(chat),
|
unread: MessageReference.unread_count_for_chat(chat),
|
||||||
last_message:
|
last_message:
|
||||||
last_message &&
|
last_message &&
|
||||||
|
@ -27,7 +28,17 @@ defmodule Pleroma.Web.PleromaAPI.ChatView do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("index.json", %{chats: chats}) do
|
def render("index.json", %{chats: chats} = opts) do
|
||||||
render_many(chats, __MODULE__, "show.json")
|
render_many(chats, __MODULE__, "show.json", Map.delete(opts, :chats))
|
||||||
|
end
|
||||||
|
|
||||||
|
defp account_view_opts(opts, recipient) do
|
||||||
|
account_view_opts = Map.put(opts, :user, recipient)
|
||||||
|
|
||||||
|
if Map.has_key?(account_view_opts, :for) do
|
||||||
|
account_view_opts
|
||||||
|
else
|
||||||
|
Map.put(account_view_opts, :skip_visibility_check, true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionView do
|
||||||
%{
|
%{
|
||||||
name: emoji,
|
name: emoji,
|
||||||
count: length(users),
|
count: length(users),
|
||||||
accounts: render(AccountView, "index.json", users: users, for: user, as: :user),
|
accounts: render(AccountView, "index.json", users: users, for: user),
|
||||||
me: !!(user && user.ap_id in user_ap_ids)
|
me: !!(user && user.ap_id in user_ap_ids)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -104,7 +104,7 @@ defmodule Pleroma.Web.Push.Impl do
|
||||||
|
|
||||||
def build_content(
|
def build_content(
|
||||||
%{
|
%{
|
||||||
user: %{notification_settings: %{privacy_option: true}}
|
user: %{notification_settings: %{hide_notification_contents: true}}
|
||||||
} = notification,
|
} = notification,
|
||||||
_actor,
|
_actor,
|
||||||
_object,
|
_object,
|
||||||
|
|
|
@ -11,10 +11,10 @@ defmodule Pleroma.Web.RichMedia.Helpers do
|
||||||
|
|
||||||
@spec validate_page_url(URI.t() | binary()) :: :ok | :error
|
@spec validate_page_url(URI.t() | binary()) :: :ok | :error
|
||||||
defp validate_page_url(page_url) when is_binary(page_url) do
|
defp validate_page_url(page_url) when is_binary(page_url) do
|
||||||
validate_tld = Application.get_env(:auto_linker, :opts)[:validate_tld]
|
validate_tld = Pleroma.Config.get([Pleroma.Formatter, :validate_tld])
|
||||||
|
|
||||||
page_url
|
page_url
|
||||||
|> AutoLinker.Parser.url?(scheme: true, validate_tld: validate_tld)
|
|> Linkify.Parser.url?(validate_tld: validate_tld)
|
||||||
|> parse_uri(page_url)
|
|> parse_uri(page_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
|
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<%= label f, :code, "Recovery code" %>
|
<%= label f, :code, "Recovery code" %>
|
||||||
<%= text_input f, :code %>
|
<%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, spellcheck: false] %>
|
||||||
<%= hidden_input f, :mfa_token, value: @mfa_token %>
|
<%= hidden_input f, :mfa_token, value: @mfa_token %>
|
||||||
<%= hidden_input f, :state, value: @state %>
|
<%= hidden_input f, :state, value: @state %>
|
||||||
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
|
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
|
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<%= label f, :code, "Authentication code" %>
|
<%= label f, :code, "Authentication code" %>
|
||||||
<%= text_input f, :code %>
|
<%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, pattern: "[0-9]*", spellcheck: false] %>
|
||||||
<%= hidden_input f, :mfa_token, value: @mfa_token %>
|
<%= hidden_input f, :mfa_token, value: @mfa_token %>
|
||||||
<%= hidden_input f, :state, value: @state %>
|
<%= hidden_input f, :state, value: @state %>
|
||||||
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
|
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
|
||||||
|
|
18
mix.exs
18
mix.exs
|
@ -135,13 +135,11 @@ defmodule Pleroma.Mixfile do
|
||||||
{:poison, "~> 3.0", override: true},
|
{:poison, "~> 3.0", override: true},
|
||||||
# {:tesla, "~> 1.3", override: true},
|
# {:tesla, "~> 1.3", override: true},
|
||||||
{:tesla,
|
{:tesla,
|
||||||
git: "https://git.pleroma.social/pleroma/elixir-libraries/tesla.git",
|
github: "teamon/tesla", ref: "af3707078b10793f6a534938e56b963aff82fe3c", override: true},
|
||||||
ref: "61b7503cef33f00834f78ddfafe0d5d9dec2270b",
|
|
||||||
override: true},
|
|
||||||
{:castore, "~> 0.1"},
|
{:castore, "~> 0.1"},
|
||||||
{:cowlib, "~> 2.8", override: true},
|
{:cowlib, "~> 2.8", override: true},
|
||||||
{:gun,
|
{:gun,
|
||||||
github: "ninenines/gun", ref: "e1a69b36b180a574c0ac314ced9613fdd52312cc", override: true},
|
github: "ninenines/gun", ref: "921c47146b2d9567eac7e9a4d2ccc60fffd4f327", override: true},
|
||||||
{:jason, "~> 1.0"},
|
{:jason, "~> 1.0"},
|
||||||
{:mogrify, "~> 0.6.1"},
|
{:mogrify, "~> 0.6.1"},
|
||||||
{:ex_aws, "~> 2.1"},
|
{:ex_aws, "~> 2.1"},
|
||||||
|
@ -153,12 +151,13 @@ defmodule Pleroma.Mixfile do
|
||||||
{:credo, "~> 1.1.0", only: [:dev, :test], runtime: false},
|
{:credo, "~> 1.1.0", only: [:dev, :test], runtime: false},
|
||||||
{:mock, "~> 0.3.3", only: :test},
|
{:mock, "~> 0.3.3", only: :test},
|
||||||
{:crypt,
|
{:crypt,
|
||||||
git: "https://github.com/msantos/crypt", ref: "f63a705f92c26955977ee62a313012e309a4d77a"},
|
git: "https://github.com/msantos/crypt.git",
|
||||||
|
ref: "f63a705f92c26955977ee62a313012e309a4d77a"},
|
||||||
{:cors_plug, "~> 1.5"},
|
{:cors_plug, "~> 1.5"},
|
||||||
{:ex_doc, "~> 0.21", only: :dev, runtime: false},
|
{:ex_doc, "~> 0.21", only: :dev, runtime: false},
|
||||||
{:web_push_encryption, "~> 0.2.1"},
|
{:web_push_encryption, "~> 0.2.1"},
|
||||||
{:swoosh,
|
{:swoosh,
|
||||||
git: "https://github.com/swoosh/swoosh",
|
git: "https://github.com/swoosh/swoosh.git",
|
||||||
ref: "c96e0ca8a00d8f211ec1f042a4626b09f249caa5",
|
ref: "c96e0ca8a00d8f211ec1f042a4626b09f249caa5",
|
||||||
override: true},
|
override: true},
|
||||||
{:phoenix_swoosh, "~> 0.2"},
|
{:phoenix_swoosh, "~> 0.2"},
|
||||||
|
@ -168,9 +167,7 @@ defmodule Pleroma.Mixfile do
|
||||||
{:floki, "~> 0.25"},
|
{:floki, "~> 0.25"},
|
||||||
{:timex, "~> 3.5"},
|
{:timex, "~> 3.5"},
|
||||||
{:ueberauth, "~> 0.4"},
|
{:ueberauth, "~> 0.4"},
|
||||||
{:auto_linker,
|
{:linkify, "~> 0.2.0"},
|
||||||
git: "https://git.pleroma.social/pleroma/auto_linker.git",
|
|
||||||
ref: "95e8188490e97505c56636c1379ffdf036c1fdde"},
|
|
||||||
{:http_signatures,
|
{:http_signatures,
|
||||||
git: "https://git.pleroma.social/pleroma/http_signatures.git",
|
git: "https://git.pleroma.social/pleroma/http_signatures.git",
|
||||||
ref: "293d77bb6f4a67ac8bde1428735c3b42f22cbb30"},
|
ref: "293d77bb6f4a67ac8bde1428735c3b42f22cbb30"},
|
||||||
|
@ -191,6 +188,9 @@ defmodule Pleroma.Mixfile do
|
||||||
{:plug_static_index_html, "~> 1.0.0"},
|
{:plug_static_index_html, "~> 1.0.0"},
|
||||||
{:excoveralls, "~> 0.12.1", only: :test},
|
{:excoveralls, "~> 0.12.1", only: :test},
|
||||||
{:flake_id, "~> 0.1.0"},
|
{:flake_id, "~> 0.1.0"},
|
||||||
|
{:concurrent_limiter,
|
||||||
|
git: "https://git.pleroma.social/pleroma/elixir-libraries/concurrent_limiter.git",
|
||||||
|
ref: "8eee96c6ba39b9286ec44c51c52d9f2758951365"},
|
||||||
{: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"},
|
||||||
|
|
11
mix.lock
11
mix.lock
|
@ -1,6 +1,5 @@
|
||||||
%{
|
%{
|
||||||
"accept": {:hex, :accept, "0.3.5", "b33b127abca7cc948bbe6caa4c263369abf1347cfa9d8e699c6d214660f10cd1", [:rebar3], [], "hexpm", "11b18c220bcc2eab63b5470c038ef10eb6783bcb1fcdb11aa4137defa5ac1bb8"},
|
"accept": {:hex, :accept, "0.3.5", "b33b127abca7cc948bbe6caa4c263369abf1347cfa9d8e699c6d214660f10cd1", [:rebar3], [], "hexpm", "11b18c220bcc2eab63b5470c038ef10eb6783bcb1fcdb11aa4137defa5ac1bb8"},
|
||||||
"auto_linker": {:git, "https://git.pleroma.social/pleroma/auto_linker.git", "95e8188490e97505c56636c1379ffdf036c1fdde", [ref: "95e8188490e97505c56636c1379ffdf036c1fdde"]},
|
|
||||||
"base62": {:hex, :base62, "1.2.1", "4866763e08555a7b3917064e9eef9194c41667276c51b59de2bc42c6ea65f806", [:mix], [{:custom_base, "~> 0.2.1", [hex: :custom_base, repo: "hexpm", optional: false]}], "hexpm", "3b29948de2013d3f93aa898c884a9dff847e7aec75d9d6d8c1dc4c61c2716c42"},
|
"base62": {:hex, :base62, "1.2.1", "4866763e08555a7b3917064e9eef9194c41667276c51b59de2bc42c6ea65f806", [:mix], [{:custom_base, "~> 0.2.1", [hex: :custom_base, repo: "hexpm", optional: false]}], "hexpm", "3b29948de2013d3f93aa898c884a9dff847e7aec75d9d6d8c1dc4c61c2716c42"},
|
||||||
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"},
|
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"},
|
||||||
"bbcode": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/bbcode.git", "f2d267675e9a7e1ad1ea9beb4cc23382762b66c2", [ref: "v0.2.0"]},
|
"bbcode": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/bbcode.git", "f2d267675e9a7e1ad1ea9beb4cc23382762b66c2", [ref: "v0.2.0"]},
|
||||||
|
@ -15,13 +14,14 @@
|
||||||
"certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"},
|
"certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"},
|
||||||
"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", "8eee96c6ba39b9286ec44c51c52d9f2758951365", [ref: "8eee96c6ba39b9286ec44c51c52d9f2758951365"]},
|
||||||
"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, "1.5.2", "72df63c87e4f94112f458ce9d25800900cc88608c1078f0e4faddf20933eda6e", [:mix], [{:plug, "~> 1.3 or ~> 1.4 or ~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9af027d20dc12dd0c4345a6b87247e0c62965871feea0bfecf9764648b02cc69"},
|
"cors_plug": {:hex, :cors_plug, "1.5.2", "72df63c87e4f94112f458ce9d25800900cc88608c1078f0e4faddf20933eda6e", [:mix], [{:plug, "~> 1.3 or ~> 1.4 or ~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9af027d20dc12dd0c4345a6b87247e0c62965871feea0bfecf9764648b02cc69"},
|
||||||
"cowboy": {:hex, :cowboy, "2.7.0", "91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "04fd8c6a39edc6aaa9c26123009200fc61f92a3a94f3178c527b70b767c6e605"},
|
"cowboy": {:hex, :cowboy, "2.7.0", "91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "04fd8c6a39edc6aaa9c26123009200fc61f92a3a94f3178c527b70b767c6e605"},
|
||||||
"cowlib": {:hex, :cowlib, "2.8.0", "fd0ff1787db84ac415b8211573e9a30a3ebe71b5cbff7f720089972b2319c8a4", [:rebar3], [], "hexpm", "79f954a7021b302186a950a32869dbc185523d99d3e44ce430cd1f3289f41ed4"},
|
"cowlib": {:hex, :cowlib, "2.8.0", "fd0ff1787db84ac415b8211573e9a30a3ebe71b5cbff7f720089972b2319c8a4", [:rebar3], [], "hexpm", "79f954a7021b302186a950a32869dbc185523d99d3e44ce430cd1f3289f41ed4"},
|
||||||
"credo": {:hex, :credo, "1.1.5", "caec7a3cadd2e58609d7ee25b3931b129e739e070539ad1a0cd7efeeb47014f4", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d0bbd3222607ccaaac5c0340f7f525c627ae4d7aee6c8c8c108922620c5b6446"},
|
"credo": {:hex, :credo, "1.1.5", "caec7a3cadd2e58609d7ee25b3931b129e739e070539ad1a0cd7efeeb47014f4", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d0bbd3222607ccaaac5c0340f7f525c627ae4d7aee6c8c8c108922620c5b6446"},
|
||||||
"crontab": {:hex, :crontab, "1.1.8", "2ce0e74777dfcadb28a1debbea707e58b879e6aa0ffbf9c9bb540887bce43617", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
|
"crontab": {:hex, :crontab, "1.1.8", "2ce0e74777dfcadb28a1debbea707e58b879e6aa0ffbf9c9bb540887bce43617", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
|
||||||
"crypt": {:git, "https://github.com/msantos/crypt", "f63a705f92c26955977ee62a313012e309a4d77a", [ref: "f63a705f92c26955977ee62a313012e309a4d77a"]},
|
"crypt": {:git, "https://github.com/msantos/crypt.git", "f63a705f92c26955977ee62a313012e309a4d77a", [ref: "f63a705f92c26955977ee62a313012e309a4d77a"]},
|
||||||
"custom_base": {:hex, :custom_base, "0.2.1", "4a832a42ea0552299d81652aa0b1f775d462175293e99dfbe4d7dbaab785a706", [:mix], [], "hexpm", "8df019facc5ec9603e94f7270f1ac73ddf339f56ade76a721eaa57c1493ba463"},
|
"custom_base": {:hex, :custom_base, "0.2.1", "4a832a42ea0552299d81652aa0b1f775d462175293e99dfbe4d7dbaab785a706", [:mix], [], "hexpm", "8df019facc5ec9603e94f7270f1ac73ddf339f56ade76a721eaa57c1493ba463"},
|
||||||
"db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"},
|
"db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"},
|
||||||
"decimal": {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"},
|
"decimal": {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"},
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
"gen_stage": {:hex, :gen_stage, "0.14.3", "d0c66f1c87faa301c1a85a809a3ee9097a4264b2edf7644bf5c123237ef732bf", [:mix], [], "hexpm"},
|
"gen_stage": {:hex, :gen_stage, "0.14.3", "d0c66f1c87faa301c1a85a809a3ee9097a4264b2edf7644bf5c123237ef732bf", [:mix], [], "hexpm"},
|
||||||
"gen_state_machine": {:hex, :gen_state_machine, "2.0.5", "9ac15ec6e66acac994cc442dcc2c6f9796cf380ec4b08267223014be1c728a95", [:mix], [], "hexpm"},
|
"gen_state_machine": {:hex, :gen_state_machine, "2.0.5", "9ac15ec6e66acac994cc442dcc2c6f9796cf380ec4b08267223014be1c728a95", [:mix], [], "hexpm"},
|
||||||
"gettext": {:hex, :gettext, "0.17.4", "f13088e1ec10ce01665cf25f5ff779e7df3f2dc71b37084976cf89d1aa124d5c", [:mix], [], "hexpm", "3c75b5ea8288e2ee7ea503ff9e30dfe4d07ad3c054576a6e60040e79a801e14d"},
|
"gettext": {:hex, :gettext, "0.17.4", "f13088e1ec10ce01665cf25f5ff779e7df3f2dc71b37084976cf89d1aa124d5c", [:mix], [], "hexpm", "3c75b5ea8288e2ee7ea503ff9e30dfe4d07ad3c054576a6e60040e79a801e14d"},
|
||||||
"gun": {:git, "https://github.com/ninenines/gun.git", "e1a69b36b180a574c0ac314ced9613fdd52312cc", [ref: "e1a69b36b180a574c0ac314ced9613fdd52312cc"]},
|
"gun": {:git, "https://github.com/ninenines/gun.git", "921c47146b2d9567eac7e9a4d2ccc60fffd4f327", [ref: "921c47146b2d9567eac7e9a4d2ccc60fffd4f327"]},
|
||||||
"hackney": {:hex, :hackney, "1.16.0", "5096ac8e823e3a441477b2d187e30dd3fff1a82991a806b2003845ce72ce2d84", [:rebar3], [{:certifi, "2.5.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.1", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.0", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "3bf0bebbd5d3092a3543b783bf065165fa5d3ad4b899b836810e513064134e18"},
|
"hackney": {:hex, :hackney, "1.16.0", "5096ac8e823e3a441477b2d187e30dd3fff1a82991a806b2003845ce72ce2d84", [:rebar3], [{:certifi, "2.5.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.1", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.0", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "3bf0bebbd5d3092a3543b783bf065165fa5d3ad4b899b836810e513064134e18"},
|
||||||
"html_entities": {:hex, :html_entities, "0.5.1", "1c9715058b42c35a2ab65edc5b36d0ea66dd083767bef6e3edb57870ef556549", [:mix], [], "hexpm", "30efab070904eb897ff05cd52fa61c1025d7f8ef3a9ca250bc4e6513d16c32de"},
|
"html_entities": {:hex, :html_entities, "0.5.1", "1c9715058b42c35a2ab65edc5b36d0ea66dd083767bef6e3edb57870ef556549", [:mix], [], "hexpm", "30efab070904eb897ff05cd52fa61c1025d7f8ef3a9ca250bc4e6513d16c32de"},
|
||||||
"html_sanitize_ex": {:hex, :html_sanitize_ex, "1.3.0", "f005ad692b717691203f940c686208aa3d8ffd9dd4bb3699240096a51fa9564e", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"},
|
"html_sanitize_ex": {:hex, :html_sanitize_ex, "1.3.0", "f005ad692b717691203f940c686208aa3d8ffd9dd4bb3699240096a51fa9564e", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"},
|
||||||
|
@ -62,6 +62,7 @@
|
||||||
"jose": {:hex, :jose, "1.10.1", "16d8e460dae7203c6d1efa3f277e25b5af8b659febfc2f2eb4bacf87f128b80a", [:mix, :rebar3], [], "hexpm", "3c7ddc8a9394b92891db7c2771da94bf819834a1a4c92e30857b7d582e2f8257"},
|
"jose": {:hex, :jose, "1.10.1", "16d8e460dae7203c6d1efa3f277e25b5af8b659febfc2f2eb4bacf87f128b80a", [:mix, :rebar3], [], "hexpm", "3c7ddc8a9394b92891db7c2771da94bf819834a1a4c92e30857b7d582e2f8257"},
|
||||||
"jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"},
|
"jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"},
|
||||||
"libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"},
|
"libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"},
|
||||||
|
"linkify": {:hex, :linkify, "0.2.0", "2518bbbea21d2caa9d372424e1ad845b640c6630e2d016f1bd1f518f9ebcca28", [:mix], [], "hexpm", "b8ca8a68b79e30b7938d6c996085f3db14939f29538a59ca5101988bb7f917f6"},
|
||||||
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"},
|
"makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"},
|
||||||
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"},
|
"makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"},
|
||||||
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"},
|
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"},
|
||||||
|
@ -104,10 +105,10 @@
|
||||||
"sleeplocks": {:hex, :sleeplocks, "1.1.1", "3d462a0639a6ef36cc75d6038b7393ae537ab394641beb59830a1b8271faeed3", [:rebar3], [], "hexpm", "84ee37aeff4d0d92b290fff986d6a95ac5eedf9b383fadfd1d88e9b84a1c02e1"},
|
"sleeplocks": {:hex, :sleeplocks, "1.1.1", "3d462a0639a6ef36cc75d6038b7393ae537ab394641beb59830a1b8271faeed3", [:rebar3], [], "hexpm", "84ee37aeff4d0d92b290fff986d6a95ac5eedf9b383fadfd1d88e9b84a1c02e1"},
|
||||||
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
|
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
|
||||||
"sweet_xml": {:hex, :sweet_xml, "0.6.6", "fc3e91ec5dd7c787b6195757fbcf0abc670cee1e4172687b45183032221b66b8", [:mix], [], "hexpm", "2e1ec458f892ffa81f9f8386e3f35a1af6db7a7a37748a64478f13163a1f3573"},
|
"sweet_xml": {:hex, :sweet_xml, "0.6.6", "fc3e91ec5dd7c787b6195757fbcf0abc670cee1e4172687b45183032221b66b8", [:mix], [], "hexpm", "2e1ec458f892ffa81f9f8386e3f35a1af6db7a7a37748a64478f13163a1f3573"},
|
||||||
"swoosh": {:git, "https://github.com/swoosh/swoosh", "c96e0ca8a00d8f211ec1f042a4626b09f249caa5", [ref: "c96e0ca8a00d8f211ec1f042a4626b09f249caa5"]},
|
"swoosh": {:git, "https://github.com/swoosh/swoosh.git", "c96e0ca8a00d8f211ec1f042a4626b09f249caa5", [ref: "c96e0ca8a00d8f211ec1f042a4626b09f249caa5"]},
|
||||||
"syslog": {:hex, :syslog, "1.1.0", "6419a232bea84f07b56dc575225007ffe34d9fdc91abe6f1b2f254fd71d8efc2", [:rebar3], [], "hexpm", "4c6a41373c7e20587be33ef841d3de6f3beba08519809329ecc4d27b15b659e1"},
|
"syslog": {:hex, :syslog, "1.1.0", "6419a232bea84f07b56dc575225007ffe34d9fdc91abe6f1b2f254fd71d8efc2", [:rebar3], [], "hexpm", "4c6a41373c7e20587be33ef841d3de6f3beba08519809329ecc4d27b15b659e1"},
|
||||||
"telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"},
|
"telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"},
|
||||||
"tesla": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/tesla.git", "61b7503cef33f00834f78ddfafe0d5d9dec2270b", [ref: "61b7503cef33f00834f78ddfafe0d5d9dec2270b"]},
|
"tesla": {:git, "https://github.com/teamon/tesla.git", "af3707078b10793f6a534938e56b963aff82fe3c", [ref: "af3707078b10793f6a534938e56b963aff82fe3c"]},
|
||||||
"timex": {:hex, :timex, "3.6.1", "efdf56d0e67a6b956cc57774353b0329c8ab7726766a11547e529357ffdc1d56", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5 or ~> 1.0.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "f354efb2400dd7a80fd9eb6c8419068c4f632da4ac47f3d8822d6e33f08bc852"},
|
"timex": {:hex, :timex, "3.6.1", "efdf56d0e67a6b956cc57774353b0329c8ab7726766a11547e529357ffdc1d56", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5 or ~> 1.0.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "f354efb2400dd7a80fd9eb6c8419068c4f632da4ac47f3d8822d6e33f08bc852"},
|
||||||
"trailing_format_plug": {:hex, :trailing_format_plug, "0.0.7", "64b877f912cf7273bed03379936df39894149e35137ac9509117e59866e10e45", [:mix], [{:plug, "> 0.12.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bd4fde4c15f3e993a999e019d64347489b91b7a9096af68b2bdadd192afa693f"},
|
"trailing_format_plug": {:hex, :trailing_format_plug, "0.0.7", "64b877f912cf7273bed03379936df39894149e35137ac9509117e59866e10e45", [:mix], [{:plug, "> 0.12.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bd4fde4c15f3e993a999e019d64347489b91b7a9096af68b2bdadd192afa693f"},
|
||||||
"tzdata": {:hex, :tzdata, "1.0.3", "73470ad29dde46e350c60a66e6b360d3b99d2d18b74c4c349dbebbc27a09a3eb", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a6e1ee7003c4d04ecbd21dd3ec690d4c6662db5d3bbdd7262d53cdf5e7c746c1"},
|
"tzdata": {:hex, :tzdata, "1.0.3", "73470ad29dde46e350c60a66e6b360d3b99d2d18b74c4c349dbebbc27a09a3eb", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a6e1ee7003c4d04ecbd21dd3ec690d4c6662db5d3bbdd7262d53cdf5e7c746c1"},
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.RenameNotificationPrivacyOption do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
execute(
|
||||||
|
"UPDATE users SET notification_settings = notification_settings - 'privacy_option' || jsonb_build_object('hide_notification_contents', notification_settings->'privacy_option')
|
||||||
|
where notification_settings ? 'privacy_option'
|
||||||
|
and local"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
execute(
|
||||||
|
"UPDATE users SET notification_settings = notification_settings - 'hide_notification_contents' || jsonb_build_object('privacy_option', notification_settings->'hide_notification_contents')
|
||||||
|
where notification_settings ? 'hide_notification_contents'
|
||||||
|
and local"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,36 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.AutolinkerToLinkify do
|
||||||
|
use Ecto.Migration
|
||||||
|
alias Pleroma.ConfigDB
|
||||||
|
|
||||||
|
@autolinker_path %{group: :auto_linker, key: :opts}
|
||||||
|
@linkify_path %{group: :pleroma, key: Pleroma.Formatter}
|
||||||
|
|
||||||
|
@compat_opts [:class, :rel, :new_window, :truncate, :strip_prefix, :extra]
|
||||||
|
|
||||||
|
def change do
|
||||||
|
with {:ok, {old, new}} <- maybe_get_params() do
|
||||||
|
move_config(old, new)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp move_config(%{} = old, %{} = new) do
|
||||||
|
{:ok, _} = ConfigDB.update_or_create(new)
|
||||||
|
{:ok, _} = ConfigDB.delete(old)
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_get_params() do
|
||||||
|
with %ConfigDB{value: opts} <- ConfigDB.get_by_params(@autolinker_path),
|
||||||
|
opts <- transform_opts(opts),
|
||||||
|
%{} = linkify_params <- Map.put(@linkify_path, :value, opts) do
|
||||||
|
{:ok, {@autolinker_path, linkify_params}}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def transform_opts(opts) when is_list(opts) do
|
||||||
|
opts
|
||||||
|
|> Enum.into(%{})
|
||||||
|
|> Map.take(@compat_opts)
|
||||||
|
|> Map.to_list()
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.FixMalformedFormatterConfig do
|
||||||
|
use Ecto.Migration
|
||||||
|
alias Pleroma.ConfigDB
|
||||||
|
|
||||||
|
@config_path %{group: :pleroma, key: Pleroma.Formatter}
|
||||||
|
|
||||||
|
def change do
|
||||||
|
with %ConfigDB{value: %{} = opts} <- ConfigDB.get_by_params(@config_path),
|
||||||
|
fixed_opts <- Map.to_list(opts) do
|
||||||
|
fix_config(fixed_opts)
|
||||||
|
else
|
||||||
|
_ -> :skipped
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp fix_config(fixed_opts) when is_list(fixed_opts) do
|
||||||
|
{:ok, _} =
|
||||||
|
ConfigDB.update_or_create(%{
|
||||||
|
group: :pleroma,
|
||||||
|
key: Pleroma.Formatter,
|
||||||
|
value: fixed_opts
|
||||||
|
})
|
||||||
|
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
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.1594374054351.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.247dc52c7abe6a0dab87.js></script><script type=text/javascript src=/static/js/app.1e68e208590653dab5aa.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.6dbc7dea4fc148c85860.css rel=stylesheet><link href=/static/fontello.1594823398494.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.9e24ed238da5a8538f50.js></script><script type=text/javascript src=/static/js/app.31bba9f1e242ff273dcb.js></script></body></html>
|
|
@ -243,4 +243,4 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=app.77b1644622e3bae24b6b.css.map*/
|
/*# sourceMappingURL=app.6dbc7dea4fc148c85860.css.map*/
|
File diff suppressed because one or more lines are too long
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.1594823398494.woff2
Normal file
BIN
priv/static/static/font/fontello.1594823398494.woff2
Normal file
Binary file not shown.
144
priv/static/static/fontello.1589385935077.css
vendored
144
priv/static/static/fontello.1589385935077.css
vendored
|
@ -1,144 +0,0 @@
|
||||||
@font-face {
|
|
||||||
font-family: "Icons";
|
|
||||||
src: url("./font/fontello.1589385935077.eot");
|
|
||||||
src: url("./font/fontello.1589385935077.eot") format("embedded-opentype"),
|
|
||||||
url("./font/fontello.1589385935077.woff2") format("woff2"),
|
|
||||||
url("./font/fontello.1589385935077.woff") format("woff"),
|
|
||||||
url("./font/fontello.1589385935077.ttf") format("truetype"),
|
|
||||||
url("./font/fontello.1589385935077.svg") format("svg");
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
[class^="icon-"]::before,
|
|
||||||
[class*=" icon-"]::before {
|
|
||||||
font-family: "Icons";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
speak: none;
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: inherit;
|
|
||||||
width: 1em;
|
|
||||||
margin-right: .2em;
|
|
||||||
text-align: center;
|
|
||||||
font-variant: normal;
|
|
||||||
text-transform: none;
|
|
||||||
line-height: 1em;
|
|
||||||
margin-left: .2em;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-spin4::before { content: "\e834"; }
|
|
||||||
|
|
||||||
.icon-cancel::before { content: "\e800"; }
|
|
||||||
|
|
||||||
.icon-upload::before { content: "\e801"; }
|
|
||||||
|
|
||||||
.icon-spin3::before { content: "\e832"; }
|
|
||||||
|
|
||||||
.icon-reply::before { content: "\f112"; }
|
|
||||||
|
|
||||||
.icon-star::before { content: "\e802"; }
|
|
||||||
|
|
||||||
.icon-star-empty::before { content: "\e803"; }
|
|
||||||
|
|
||||||
.icon-retweet::before { content: "\e804"; }
|
|
||||||
|
|
||||||
.icon-eye-off::before { content: "\e805"; }
|
|
||||||
|
|
||||||
.icon-binoculars::before { content: "\f1e5"; }
|
|
||||||
|
|
||||||
.icon-cog::before { content: "\e807"; }
|
|
||||||
|
|
||||||
.icon-user-plus::before { content: "\f234"; }
|
|
||||||
|
|
||||||
.icon-menu::before { content: "\f0c9"; }
|
|
||||||
|
|
||||||
.icon-logout::before { content: "\e808"; }
|
|
||||||
|
|
||||||
.icon-down-open::before { content: "\e809"; }
|
|
||||||
|
|
||||||
.icon-attach::before { content: "\e80a"; }
|
|
||||||
|
|
||||||
.icon-link-ext::before { content: "\f08e"; }
|
|
||||||
|
|
||||||
.icon-link-ext-alt::before { content: "\f08f"; }
|
|
||||||
|
|
||||||
.icon-picture::before { content: "\e80b"; }
|
|
||||||
|
|
||||||
.icon-video::before { content: "\e80c"; }
|
|
||||||
|
|
||||||
.icon-right-open::before { content: "\e80d"; }
|
|
||||||
|
|
||||||
.icon-left-open::before { content: "\e80e"; }
|
|
||||||
|
|
||||||
.icon-up-open::before { content: "\e80f"; }
|
|
||||||
|
|
||||||
.icon-comment-empty::before { content: "\f0e5"; }
|
|
||||||
|
|
||||||
.icon-mail-alt::before { content: "\f0e0"; }
|
|
||||||
|
|
||||||
.icon-lock::before { content: "\e811"; }
|
|
||||||
|
|
||||||
.icon-lock-open-alt::before { content: "\f13e"; }
|
|
||||||
|
|
||||||
.icon-globe::before { content: "\e812"; }
|
|
||||||
|
|
||||||
.icon-brush::before { content: "\e813"; }
|
|
||||||
|
|
||||||
.icon-search::before { content: "\e806"; }
|
|
||||||
|
|
||||||
.icon-adjust::before { content: "\e816"; }
|
|
||||||
|
|
||||||
.icon-thumbs-up-alt::before { content: "\f164"; }
|
|
||||||
|
|
||||||
.icon-attention::before { content: "\e814"; }
|
|
||||||
|
|
||||||
.icon-plus-squared::before { content: "\f0fe"; }
|
|
||||||
|
|
||||||
.icon-plus::before { content: "\e815"; }
|
|
||||||
|
|
||||||
.icon-edit::before { content: "\e817"; }
|
|
||||||
|
|
||||||
.icon-play-circled::before { content: "\f144"; }
|
|
||||||
|
|
||||||
.icon-pencil::before { content: "\e818"; }
|
|
||||||
|
|
||||||
.icon-chart-bar::before { content: "\e81b"; }
|
|
||||||
|
|
||||||
.icon-smile::before { content: "\f118"; }
|
|
||||||
|
|
||||||
.icon-bell-alt::before { content: "\f0f3"; }
|
|
||||||
|
|
||||||
.icon-wrench::before { content: "\e81a"; }
|
|
||||||
|
|
||||||
.icon-pin::before { content: "\e819"; }
|
|
||||||
|
|
||||||
.icon-ellipsis::before { content: "\f141"; }
|
|
||||||
|
|
||||||
.icon-bell-ringing-o::before { content: "\e810"; }
|
|
||||||
|
|
||||||
.icon-zoom-in::before { content: "\e81c"; }
|
|
||||||
|
|
||||||
.icon-gauge::before { content: "\f0e4"; }
|
|
||||||
|
|
||||||
.icon-users::before { content: "\e81d"; }
|
|
||||||
|
|
||||||
.icon-info-circled::before { content: "\e81f"; }
|
|
||||||
|
|
||||||
.icon-home-2::before { content: "\e821"; }
|
|
||||||
|
|
||||||
.icon-chat::before { content: "\e81e"; }
|
|
||||||
|
|
||||||
.icon-login::before { content: "\e820"; }
|
|
||||||
|
|
||||||
.icon-arrow-curved::before { content: "\e822"; }
|
|
||||||
|
|
||||||
.icon-link::before { content: "\e823"; }
|
|
||||||
|
|
||||||
.icon-share::before { content: "\f1e0"; }
|
|
||||||
|
|
||||||
.icon-user::before { content: "\e824"; }
|
|
||||||
|
|
||||||
.icon-ok::before { content: "\e827"; }
|
|
152
priv/static/static/fontello.1594030805019.css
vendored
152
priv/static/static/fontello.1594030805019.css
vendored
|
@ -1,152 +0,0 @@
|
||||||
@font-face {
|
|
||||||
font-family: "Icons";
|
|
||||||
src: url("./font/fontello.1594030805019.eot");
|
|
||||||
src: url("./font/fontello.1594030805019.eot") format("embedded-opentype"),
|
|
||||||
url("./font/fontello.1594030805019.woff2") format("woff2"),
|
|
||||||
url("./font/fontello.1594030805019.woff") format("woff"),
|
|
||||||
url("./font/fontello.1594030805019.ttf") format("truetype"),
|
|
||||||
url("./font/fontello.1594030805019.svg") format("svg");
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
[class^="icon-"]::before,
|
|
||||||
[class*=" icon-"]::before {
|
|
||||||
font-family: "Icons";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
speak: none;
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: inherit;
|
|
||||||
width: 1em;
|
|
||||||
margin-right: .2em;
|
|
||||||
text-align: center;
|
|
||||||
font-variant: normal;
|
|
||||||
text-transform: none;
|
|
||||||
line-height: 1em;
|
|
||||||
margin-left: .2em;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-spin4::before { content: "\e834"; }
|
|
||||||
|
|
||||||
.icon-cancel::before { content: "\e800"; }
|
|
||||||
|
|
||||||
.icon-upload::before { content: "\e801"; }
|
|
||||||
|
|
||||||
.icon-spin3::before { content: "\e832"; }
|
|
||||||
|
|
||||||
.icon-reply::before { content: "\f112"; }
|
|
||||||
|
|
||||||
.icon-star::before { content: "\e802"; }
|
|
||||||
|
|
||||||
.icon-star-empty::before { content: "\e803"; }
|
|
||||||
|
|
||||||
.icon-retweet::before { content: "\e804"; }
|
|
||||||
|
|
||||||
.icon-eye-off::before { content: "\e805"; }
|
|
||||||
|
|
||||||
.icon-binoculars::before { content: "\f1e5"; }
|
|
||||||
|
|
||||||
.icon-cog::before { content: "\e807"; }
|
|
||||||
|
|
||||||
.icon-user-plus::before { content: "\f234"; }
|
|
||||||
|
|
||||||
.icon-menu::before { content: "\f0c9"; }
|
|
||||||
|
|
||||||
.icon-logout::before { content: "\e808"; }
|
|
||||||
|
|
||||||
.icon-down-open::before { content: "\e809"; }
|
|
||||||
|
|
||||||
.icon-attach::before { content: "\e80a"; }
|
|
||||||
|
|
||||||
.icon-link-ext::before { content: "\f08e"; }
|
|
||||||
|
|
||||||
.icon-link-ext-alt::before { content: "\f08f"; }
|
|
||||||
|
|
||||||
.icon-picture::before { content: "\e80b"; }
|
|
||||||
|
|
||||||
.icon-video::before { content: "\e80c"; }
|
|
||||||
|
|
||||||
.icon-right-open::before { content: "\e80d"; }
|
|
||||||
|
|
||||||
.icon-left-open::before { content: "\e80e"; }
|
|
||||||
|
|
||||||
.icon-up-open::before { content: "\e80f"; }
|
|
||||||
|
|
||||||
.icon-comment-empty::before { content: "\f0e5"; }
|
|
||||||
|
|
||||||
.icon-mail-alt::before { content: "\f0e0"; }
|
|
||||||
|
|
||||||
.icon-lock::before { content: "\e811"; }
|
|
||||||
|
|
||||||
.icon-lock-open-alt::before { content: "\f13e"; }
|
|
||||||
|
|
||||||
.icon-globe::before { content: "\e812"; }
|
|
||||||
|
|
||||||
.icon-brush::before { content: "\e813"; }
|
|
||||||
|
|
||||||
.icon-search::before { content: "\e806"; }
|
|
||||||
|
|
||||||
.icon-adjust::before { content: "\e816"; }
|
|
||||||
|
|
||||||
.icon-thumbs-up-alt::before { content: "\f164"; }
|
|
||||||
|
|
||||||
.icon-attention::before { content: "\e814"; }
|
|
||||||
|
|
||||||
.icon-plus-squared::before { content: "\f0fe"; }
|
|
||||||
|
|
||||||
.icon-plus::before { content: "\e815"; }
|
|
||||||
|
|
||||||
.icon-edit::before { content: "\e817"; }
|
|
||||||
|
|
||||||
.icon-play-circled::before { content: "\f144"; }
|
|
||||||
|
|
||||||
.icon-pencil::before { content: "\e818"; }
|
|
||||||
|
|
||||||
.icon-chart-bar::before { content: "\e81b"; }
|
|
||||||
|
|
||||||
.icon-smile::before { content: "\f118"; }
|
|
||||||
|
|
||||||
.icon-bell-alt::before { content: "\f0f3"; }
|
|
||||||
|
|
||||||
.icon-wrench::before { content: "\e81a"; }
|
|
||||||
|
|
||||||
.icon-pin::before { content: "\e819"; }
|
|
||||||
|
|
||||||
.icon-ellipsis::before { content: "\f141"; }
|
|
||||||
|
|
||||||
.icon-bell-ringing-o::before { content: "\e810"; }
|
|
||||||
|
|
||||||
.icon-zoom-in::before { content: "\e81c"; }
|
|
||||||
|
|
||||||
.icon-gauge::before { content: "\f0e4"; }
|
|
||||||
|
|
||||||
.icon-users::before { content: "\e81d"; }
|
|
||||||
|
|
||||||
.icon-info-circled::before { content: "\e81f"; }
|
|
||||||
|
|
||||||
.icon-home-2::before { content: "\e821"; }
|
|
||||||
|
|
||||||
.icon-chat::before { content: "\e81e"; }
|
|
||||||
|
|
||||||
.icon-login::before { content: "\e820"; }
|
|
||||||
|
|
||||||
.icon-arrow-curved::before { content: "\e822"; }
|
|
||||||
|
|
||||||
.icon-link::before { content: "\e823"; }
|
|
||||||
|
|
||||||
.icon-share::before { content: "\f1e0"; }
|
|
||||||
|
|
||||||
.icon-user::before { content: "\e824"; }
|
|
||||||
|
|
||||||
.icon-ok::before { content: "\e827"; }
|
|
||||||
|
|
||||||
.icon-filter::before { content: "\f0b0"; }
|
|
||||||
|
|
||||||
.icon-download::before { content: "\e825"; }
|
|
||||||
|
|
||||||
.icon-bookmark::before { content: "\e826"; }
|
|
||||||
|
|
||||||
.icon-bookmark-empty::before { content: "\f097"; }
|
|
156
priv/static/static/fontello.1594134783339.css
vendored
156
priv/static/static/fontello.1594134783339.css
vendored
|
@ -1,156 +0,0 @@
|
||||||
@font-face {
|
|
||||||
font-family: "Icons";
|
|
||||||
src: url("./font/fontello.1594134783339.eot");
|
|
||||||
src: url("./font/fontello.1594134783339.eot") format("embedded-opentype"),
|
|
||||||
url("./font/fontello.1594134783339.woff2") format("woff2"),
|
|
||||||
url("./font/fontello.1594134783339.woff") format("woff"),
|
|
||||||
url("./font/fontello.1594134783339.ttf") format("truetype"),
|
|
||||||
url("./font/fontello.1594134783339.svg") format("svg");
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
[class^="icon-"]::before,
|
|
||||||
[class*=" icon-"]::before {
|
|
||||||
font-family: "Icons";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
speak: none;
|
|
||||||
display: inline-block;
|
|
||||||
text-decoration: inherit;
|
|
||||||
width: 1em;
|
|
||||||
margin-right: .2em;
|
|
||||||
text-align: center;
|
|
||||||
font-variant: normal;
|
|
||||||
text-transform: none;
|
|
||||||
line-height: 1em;
|
|
||||||
margin-left: .2em;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-spin4::before { content: "\e834"; }
|
|
||||||
|
|
||||||
.icon-cancel::before { content: "\e800"; }
|
|
||||||
|
|
||||||
.icon-upload::before { content: "\e801"; }
|
|
||||||
|
|
||||||
.icon-spin3::before { content: "\e832"; }
|
|
||||||
|
|
||||||
.icon-reply::before { content: "\f112"; }
|
|
||||||
|
|
||||||
.icon-star::before { content: "\e802"; }
|
|
||||||
|
|
||||||
.icon-star-empty::before { content: "\e803"; }
|
|
||||||
|
|
||||||
.icon-retweet::before { content: "\e804"; }
|
|
||||||
|
|
||||||
.icon-eye-off::before { content: "\e805"; }
|
|
||||||
|
|
||||||
.icon-binoculars::before { content: "\f1e5"; }
|
|
||||||
|
|
||||||
.icon-cog::before { content: "\e807"; }
|
|
||||||
|
|
||||||
.icon-user-plus::before { content: "\f234"; }
|
|
||||||
|
|
||||||
.icon-menu::before { content: "\f0c9"; }
|
|
||||||
|
|
||||||
.icon-logout::before { content: "\e808"; }
|
|
||||||
|
|
||||||
.icon-down-open::before { content: "\e809"; }
|
|
||||||
|
|
||||||
.icon-attach::before { content: "\e80a"; }
|
|
||||||
|
|
||||||
.icon-link-ext::before { content: "\f08e"; }
|
|
||||||
|
|
||||||
.icon-link-ext-alt::before { content: "\f08f"; }
|
|
||||||
|
|
||||||
.icon-picture::before { content: "\e80b"; }
|
|
||||||
|
|
||||||
.icon-video::before { content: "\e80c"; }
|
|
||||||
|
|
||||||
.icon-right-open::before { content: "\e80d"; }
|
|
||||||
|
|
||||||
.icon-left-open::before { content: "\e80e"; }
|
|
||||||
|
|
||||||
.icon-up-open::before { content: "\e80f"; }
|
|
||||||
|
|
||||||
.icon-comment-empty::before { content: "\f0e5"; }
|
|
||||||
|
|
||||||
.icon-mail-alt::before { content: "\f0e0"; }
|
|
||||||
|
|
||||||
.icon-lock::before { content: "\e811"; }
|
|
||||||
|
|
||||||
.icon-lock-open-alt::before { content: "\f13e"; }
|
|
||||||
|
|
||||||
.icon-globe::before { content: "\e812"; }
|
|
||||||
|
|
||||||
.icon-brush::before { content: "\e813"; }
|
|
||||||
|
|
||||||
.icon-search::before { content: "\e806"; }
|
|
||||||
|
|
||||||
.icon-adjust::before { content: "\e816"; }
|
|
||||||
|
|
||||||
.icon-thumbs-up-alt::before { content: "\f164"; }
|
|
||||||
|
|
||||||
.icon-attention::before { content: "\e814"; }
|
|
||||||
|
|
||||||
.icon-plus-squared::before { content: "\f0fe"; }
|
|
||||||
|
|
||||||
.icon-plus::before { content: "\e815"; }
|
|
||||||
|
|
||||||
.icon-edit::before { content: "\e817"; }
|
|
||||||
|
|
||||||
.icon-play-circled::before { content: "\f144"; }
|
|
||||||
|
|
||||||
.icon-pencil::before { content: "\e818"; }
|
|
||||||
|
|
||||||
.icon-chart-bar::before { content: "\e81b"; }
|
|
||||||
|
|
||||||
.icon-smile::before { content: "\f118"; }
|
|
||||||
|
|
||||||
.icon-bell-alt::before { content: "\f0f3"; }
|
|
||||||
|
|
||||||
.icon-wrench::before { content: "\e81a"; }
|
|
||||||
|
|
||||||
.icon-pin::before { content: "\e819"; }
|
|
||||||
|
|
||||||
.icon-ellipsis::before { content: "\f141"; }
|
|
||||||
|
|
||||||
.icon-bell-ringing-o::before { content: "\e810"; }
|
|
||||||
|
|
||||||
.icon-zoom-in::before { content: "\e81c"; }
|
|
||||||
|
|
||||||
.icon-gauge::before { content: "\f0e4"; }
|
|
||||||
|
|
||||||
.icon-users::before { content: "\e81d"; }
|
|
||||||
|
|
||||||
.icon-info-circled::before { content: "\e81f"; }
|
|
||||||
|
|
||||||
.icon-home-2::before { content: "\e821"; }
|
|
||||||
|
|
||||||
.icon-chat::before { content: "\e81e"; }
|
|
||||||
|
|
||||||
.icon-login::before { content: "\e820"; }
|
|
||||||
|
|
||||||
.icon-arrow-curved::before { content: "\e822"; }
|
|
||||||
|
|
||||||
.icon-link::before { content: "\e823"; }
|
|
||||||
|
|
||||||
.icon-share::before { content: "\f1e0"; }
|
|
||||||
|
|
||||||
.icon-user::before { content: "\e824"; }
|
|
||||||
|
|
||||||
.icon-ok::before { content: "\e827"; }
|
|
||||||
|
|
||||||
.icon-filter::before { content: "\f0b0"; }
|
|
||||||
|
|
||||||
.icon-download::before { content: "\e825"; }
|
|
||||||
|
|
||||||
.icon-bookmark::before { content: "\e826"; }
|
|
||||||
|
|
||||||
.icon-bookmark-empty::before { content: "\f097"; }
|
|
||||||
|
|
||||||
.icon-music::before { content: "\e828"; }
|
|
||||||
|
|
||||||
.icon-doc::before { content: "\e829"; }
|
|
|
@ -1,11 +1,11 @@
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Icons";
|
font-family: "Icons";
|
||||||
src: url("./font/fontello.1594374054351.eot");
|
src: url("./font/fontello.1594823398494.eot");
|
||||||
src: url("./font/fontello.1594374054351.eot") format("embedded-opentype"),
|
src: url("./font/fontello.1594823398494.eot") format("embedded-opentype"),
|
||||||
url("./font/fontello.1594374054351.woff2") format("woff2"),
|
url("./font/fontello.1594823398494.woff2") format("woff2"),
|
||||||
url("./font/fontello.1594374054351.woff") format("woff"),
|
url("./font/fontello.1594823398494.woff") format("woff"),
|
||||||
url("./font/fontello.1594374054351.ttf") format("truetype"),
|
url("./font/fontello.1594823398494.ttf") format("truetype"),
|
||||||
url("./font/fontello.1594374054351.svg") format("svg");
|
url("./font/fontello.1594823398494.svg") format("svg");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
0
priv/static/static/fontello.json
Executable file → Normal file
0
priv/static/static/fontello.json
Executable file → Normal file
File diff suppressed because one or more lines are too long
2
priv/static/static/js/10.5ef4671883649cf93524.js
Normal file
2
priv/static/static/js/10.5ef4671883649cf93524.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.2823375ec309b971aaea.js","sourceRoot":""}
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/10.5ef4671883649cf93524.js","sourceRoot":""}
|
File diff suppressed because one or more lines are too long
2
priv/static/static/js/11.c5b938b4349f87567338.js
Normal file
2
priv/static/static/js/11.c5b938b4349f87567338.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/11.2cb4b0f72a4654070a58.js","sourceRoot":""}
|
{"version":3,"sources":[],"names":[],"mappings":"","file":"static/js/11.c5b938b4349f87567338.js","sourceRoot":""}
|
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue