Commit 27e7999a authored by Ivan Tashkinov's avatar Ivan Tashkinov
Browse files

Merge remote-tracking branch 'remotes/origin/develop' into 2168-media-preview-proxy

parents f50c653c 8d70692a
Pipeline #29919 passed with stages
in 18 minutes and 20 seconds
......@@ -196,6 +196,7 @@ amd64:
variables: &release-variables
MIX_ENV: prod
before_script: &before-release
- apt install cmake -y
- echo "import Mix.Config" > config/prod.secret.exs
- mix local.hex --force
- mix local.rebar --force
......@@ -214,7 +215,7 @@ amd64-musl:
cache: *release-cache
variables: *release-variables
before_script: &before-release-musl
- apk add git gcc g++ musl-dev make
- apk add git gcc g++ musl-dev make cmake
- echo "import Mix.Config" > config/prod.secret.exs
- mix local.hex --force
- mix local.rebar --force
......
......@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Configuration: `:media_proxy, whitelist` format changed to host with scheme (e.g. `http://example.com` instead of `example.com`). Domain format is deprecated.
- **Breaking:** Configuration: `:instance, welcome_user_nickname` moved to `:welcome, :direct_message, :sender_nickname`, `:instance, :welcome_message` moved to `:welcome, :direct_message, :message`. Old config namespace is deprecated.
- **Breaking:** LDAP: Fallback to local database authentication has been removed for security reasons and lack of a mechanism to ensure the passwords are synchronized when LDAP passwords are updated.
- **Breaking** Changed defaults for `:restrict_unauthenticated` so that when `:instance, :public` is set to `false` then all `:restrict_unauthenticated` items be effectively set to `true`. If you'd like to allow unauthenticated access to specific API endpoints on a private instance, please explicitly set `:restrict_unauthenticated` to non-default value in `config/prod.secret.exs`.
<details>
<summary>API Changes</summary>
......@@ -105,6 +106,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- 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`
- Fix whole_word always returning false on filter get requests
- Migrations not working on OTP releases if the database was connected over ssl
## [Unreleased (patch)]
......
......@@ -4,7 +4,7 @@ COPY . .
ENV MIX_ENV=prod
RUN apk add git gcc g++ musl-dev make &&\
RUN apk add git gcc g++ musl-dev make cmake &&\
echo "import Mix.Config" > config/prod.secret.exs &&\
mix local.hex --force &&\
mix local.rebar --force &&\
......
......@@ -737,10 +737,12 @@
timeout: 300_000
]
private_instance? = :if_instance_is_private
config :pleroma, :restrict_unauthenticated,
timelines: %{local: false, federated: false},
profiles: %{local: false, remote: false},
activities: %{local: false, remote: false}
timelines: %{local: private_instance?, federated: private_instance?},
profiles: %{local: private_instance?, remote: private_instance?},
activities: %{local: private_instance?, remote: private_instance?}
config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: false
......
......@@ -194,7 +194,7 @@
type: [:string, {:list, :string}, {:list, :tuple}],
description:
"List of actions for the mogrify command. It's possible to add self-written settings as string. " <>
"For example `[\"auto-orient\", \"strip\", {\"resize\", \"3840x1080>\"}]` string will be parsed into list of the settings.",
"For example `auto-orient, strip, {\"resize\", \"3840x1080>\"}` value will be parsed into valid list of the settings.",
suggestions: [
"strip",
"auto-orient",
......@@ -951,7 +951,7 @@
},
%{
key: :instance_thumbnail,
type: :string,
type: {:string, :image},
description:
"The instance thumbnail can be any image that represents your instance and is used by some apps or services when they display information about your instance.",
suggestions: ["/instance/thumbnail.jpeg"]
......@@ -964,25 +964,25 @@
]
},
%{
group: :welcome,
group: :pleroma,
key: :welcome,
type: :group,
description: "Welcome messages settings",
children: [
%{
group: :direct_message,
type: :group,
key: :direct_message,
type: :keyword,
descpiption: "Direct message settings",
children: [
%{
key: :enabled,
type: :boolean,
description: "Enables sends direct message for new user after registration"
description: "Enables sending a direct message to newly registered users"
},
%{
key: :message,
type: :string,
description:
"A message that will be sent to a newly registered users as a direct message",
description: "A message that will be sent to newly registered users",
suggestions: [
"Hi, @username! Welcome on board!"
]
......@@ -990,7 +990,7 @@
%{
key: :sender_nickname,
type: :string,
description: "The nickname of the local user that sends the welcome message",
description: "The nickname of the local user that sends a welcome message",
suggestions: [
"lain"
]
......@@ -998,20 +998,20 @@
]
},
%{
group: :chat_message,
type: :group,
key: :chat_message,
type: :keyword,
descpiption: "Chat message settings",
children: [
%{
key: :enabled,
type: :boolean,
description: "Enables sends chat message for new user after registration"
description: "Enables sending a chat message to newly registered users"
},
%{
key: :message,
type: :string,
description:
"A message that will be sent to a newly registered users as a chat message",
"A message that will be sent to newly registered users as a chat message",
suggestions: [
"Hello, welcome on board!"
]
......@@ -1019,7 +1019,7 @@
%{
key: :sender_nickname,
type: :string,
description: "The nickname of the local user that sends the welcome message",
description: "The nickname of the local user that sends a welcome chat message",
suggestions: [
"lain"
]
......@@ -1027,20 +1027,20 @@
]
},
%{
group: :email,
type: :group,
key: :email,
type: :keyword,
descpiption: "Email message settings",
children: [
%{
key: :enabled,
type: :boolean,
description: "Enables sends direct message for new user after registration"
description: "Enables sending an email to newly registered users"
},
%{
key: :sender,
type: [:string, :tuple],
description:
"The email address or tuple with `{nickname, email}` that will use as sender to the welcome email.",
"Email address and/or nickname that will be used to send the welcome email.",
suggestions: [
{"Pleroma App", "welcome@pleroma.app"}
]
......@@ -1049,21 +1049,21 @@
key: :subject,
type: :string,
description:
"The subject of welcome email. Can be use EEX template with `user` and `instance_name` variables.",
"Subject of the welcome email. EEX template with user and instance_name variables can be used.",
suggestions: ["Welcome to <%= instance_name%>"]
},
%{
key: :html,
type: :string,
description:
"The html content of welcome email. Can be use EEX template with `user` and `instance_name` variables.",
"HTML content of the welcome email. EEX template with user and instance_name variables can be used.",
suggestions: ["<h1>Hello <%= user.name%>. Welcome to <%= instance_name%></h1>"]
},
%{
key: :text,
type: :string,
description:
"The text content of welcome email. Can be use EEX template with `user` and `instance_name` variables.",
"Text content of the welcome email. EEX template with user and instance_name variables can be used.",
suggestions: ["Hello <%= user.name%>. \n Welcome to <%= instance_name%>\n"]
}
]
......@@ -1236,7 +1236,7 @@
},
%{
key: :background,
type: :string,
type: {:string, :image},
description:
"URL of the background, unless viewing a user profile with a background that is set",
suggestions: ["/images/city.jpg"]
......@@ -1293,7 +1293,7 @@
},
%{
key: :logo,
type: :string,
type: {:string, :image},
description: "URL of the logo, defaults to Pleroma's logo",
suggestions: ["/static/logo.png"]
},
......@@ -1325,7 +1325,7 @@
%{
key: :nsfwCensorImage,
label: "NSFW Censor Image",
type: :string,
type: {:string, :image},
description:
"URL of the image to use for hiding NSFW media attachments in the timeline",
suggestions: ["/static/img/nsfw.74818f9.png"]
......@@ -1451,7 +1451,7 @@
},
%{
key: :default_user_avatar,
type: :string,
type: {:string, :image},
description: "URL of the default user avatar",
suggestions: ["/images/avi.png"]
}
......@@ -1810,12 +1810,12 @@
%{
key: :enabled,
type: :boolean,
description: "Enables invalidate media cache"
description: "Enables media cache object invalidation."
},
%{
key: :provider,
type: :module,
description: "Module which will be used to cache purge.",
description: "Module which will be used to purge objects from the cache.",
suggestions: [
Pleroma.Web.MediaProxy.Invalidation.Script,
Pleroma.Web.MediaProxy.Invalidation.Http
......@@ -2642,7 +2642,7 @@
children: [
%{
key: :logo,
type: :string,
type: {:string, :image},
description: "A path to a custom logo. Set it to `nil` to use the default Pleroma logo.",
suggestions: ["some/path/logo.png"]
},
......@@ -3299,13 +3299,13 @@
group: :pleroma,
key: :connections_pool,
type: :group,
description: "Advanced settings for `gun` connections pool",
description: "Advanced settings for `Gun` connections pool",
children: [
%{
key: :connection_acquisition_wait,
type: :integer,
description:
"Timeout to acquire a connection from pool.The total max time is this value multiplied by the number of retries. Default: 250ms.",
"Timeout to acquire a connection from pool. The total max time is this value multiplied by the number of retries. Default: 250ms.",
suggestions: [250]
},
%{
......@@ -3340,7 +3340,7 @@
group: :pleroma,
key: :pools,
type: :group,
description: "Advanced settings for `gun` workers pools",
description: "Advanced settings for `Gun` workers pools",
children:
Enum.map([:federation, :media, :upload, :default], fn pool_name ->
%{
......@@ -3369,7 +3369,7 @@
group: :pleroma,
key: :hackney_pools,
type: :group,
description: "Advanced settings for `hackney` connections pools",
description: "Advanced settings for `Hackney` connections pools",
children: [
%{
key: :federation,
......@@ -3433,6 +3433,7 @@
%{
group: :pleroma,
key: :restrict_unauthenticated,
label: "Restrict Unauthenticated",
type: :group,
description:
"Disallow viewing timelines, user profiles and statuses for unauthenticated users.",
......@@ -3555,13 +3556,17 @@
children: [
%{
key: "name",
label: "Name",
type: :string,
description: "Name of the installed primary frontend"
description:
"Name of the installed primary frontend. Valid config must include both `Name` and `Reference` values."
},
%{
key: "ref",
label: "Reference",
type: :string,
description: "reference of the installed primary frontend to be used"
description:
"Reference of the installed primary frontend to be used. Valid config must include both `Name` and `Reference` values."
}
]
}
......
......@@ -1266,11 +1266,14 @@ Loads json generated from `config/descriptions.exs`.
- Params:
- *optional* `page`: **integer** page number
- *optional* `page_size`: **integer** number of log entries per page (default is `50`)
- *optional* `query`: **string** search term
- Response:
``` json
{
"page_size": integer,
"count": integer,
"urls": [
"http://example.com/media/a688346.jpg",
"http://example.com/media/fb1f4d.jpg"
......@@ -1290,12 +1293,7 @@ Loads json generated from `config/descriptions.exs`.
- Response:
``` json
{
"urls": [
"http://example.com/media/a688346.jpg",
"http://example.com/media/fb1f4d.jpg"
]
}
{ }
```
......@@ -1311,11 +1309,6 @@ Loads json generated from `config/descriptions.exs`.
- Response:
``` json
{
"urls": [
"http://example.com/media/a688346.jpg",
"http://example.com/media/fb1f4d.jpg"
]
}
{ }
```
......@@ -11,14 +11,17 @@
config :pleroma, configurable_from_database: true
```
```sh tab="OTP"
./bin/pleroma_ctl config migrate_to_db
```
=== "OTP"
```sh tab="From Source"
mix pleroma.config migrate_to_db
```
```sh
./bin/pleroma_ctl config migrate_to_db
```
=== "From Source"
```sh
mix pleroma.config migrate_to_db
```
## Transfer config from DB to `config/env.exported_from_db.secret.exs`
......@@ -31,10 +34,12 @@ mix pleroma.config migrate_to_db
To delete transfered settings from database optional flag `-d` can be used. `<env>` is `prod` by default.
```sh tab="OTP"
./bin/pleroma_ctl config migrate_from_db [--env=<env>] [-d]
```
=== "OTP"
```sh
./bin/pleroma_ctl config migrate_from_db [--env=<env>] [-d]
```
```sh tab="From Source"
mix pleroma.config migrate_from_db [--env=<env>] [-d]
```
=== "From Source"
```sh
mix pleroma.config migrate_from_db [--env=<env>] [-d]
```
......@@ -9,13 +9,18 @@
Replaces embedded objects with references to them in the `objects` table. Only needs to be ran once if the instance was created before Pleroma 1.0.5. The reason why this is not a migration is because it could significantly increase the database size after being ran, however after this `VACUUM FULL` will be able to reclaim about 20% (really depends on what is in the database, your mileage may vary) of the db size before the migration.
```sh tab="OTP"
./bin/pleroma_ctl database remove_embedded_objects [option ...]
```
=== "OTP"
```sh
./bin/pleroma_ctl database remove_embedded_objects [option ...]
```
=== "From Source"
```sh
mix pleroma.database remove_embedded_objects [option ...]
```
```sh tab="From Source"
mix pleroma.database remove_embedded_objects [option ...]
```
### Options
- `--vacuum` - run `VACUUM FULL` after the embedded objects are replaced with their references
......@@ -27,13 +32,17 @@ This will prune remote posts older than 90 days (configurable with [`config :ple
!!! danger
The disk space will only be reclaimed after `VACUUM FULL`. You may run out of disk space during the execution of the task or vacuuming if you don't have about 1/3rds of the database size free.
```sh tab="OTP"
./bin/pleroma_ctl database prune_objects [option ...]
```
=== "OTP"
```sh
./bin/pleroma_ctl database prune_objects [option ...]
```
=== "From Source"
```sh tab="From Source"
mix pleroma.database prune_objects [option ...]
```
```sh
mix pleroma.database prune_objects [option ...]
```
### Options
- `--vacuum` - run `VACUUM FULL` after the objects are pruned
......@@ -42,33 +51,45 @@ mix pleroma.database prune_objects [option ...]
Can be safely re-run
```sh tab="OTP"
./bin/pleroma_ctl database bump_all_conversations
```
=== "OTP"
```sh tab="From Source"
mix pleroma.database bump_all_conversations
```
```sh
./bin/pleroma_ctl database bump_all_conversations
```
=== "From Source"
```sh
mix pleroma.database bump_all_conversations
```
## Remove duplicated items from following and update followers count for all users
```sh tab="OTP"
./bin/pleroma_ctl database update_users_following_followers_counts
```
=== "OTP"
```sh
./bin/pleroma_ctl database update_users_following_followers_counts
```
=== "From Source"
```sh tab="From Source"
mix pleroma.database update_users_following_followers_counts
```
```sh
mix pleroma.database update_users_following_followers_counts
```
## Fix the pre-existing "likes" collections for all objects
```sh tab="OTP"
./bin/pleroma_ctl database fix_likes_collections
```
=== "OTP"
```sh tab="From Source"
mix pleroma.database fix_likes_collections
```
```sh
./bin/pleroma_ctl database fix_likes_collections
```
=== "From Source"
```sh
mix pleroma.database fix_likes_collections
```
## Vacuum the database
......@@ -76,13 +97,17 @@ mix pleroma.database fix_likes_collections
Running an `analyze` vacuum job can improve performance by updating statistics used by the query planner. **It is safe to cancel this.**
```sh tab="OTP"
./bin/pleroma_ctl database vacuum analyze
```
=== "OTP"
```sh
./bin/pleroma_ctl database vacuum analyze
```
=== "From Source"
```sh tab="From Source"
mix pleroma.database vacuum analyze
```
```sh
mix pleroma.database vacuum analyze
```
### Full
......@@ -91,20 +116,28 @@ and more compact files with an optimized layout. This process will take a long t
it builds the files side-by-side the existing database files. It can make your database faster and use less disk space,
but should only be run if necessary. **It is safe to cancel this.**
```sh tab="OTP"
./bin/pleroma_ctl database vacuum full
```
=== "OTP"
```sh tab="From Source"
mix pleroma.database vacuum full
```
```sh
./bin/pleroma_ctl database vacuum full
```
=== "From Source"
```sh
mix pleroma.database vacuum full
```
## Add expiration to all local statuses
```sh tab="OTP"
./bin/pleroma_ctl database ensure_expiration
```
=== "OTP"
```sh
./bin/pleroma_ctl database ensure_expiration
```
=== "From Source"
```sh tab="From Source"
mix pleroma.database ensure_expiration
```
```sh
mix pleroma.database ensure_expiration
```
......@@ -4,22 +4,30 @@
## Send digest email since given date (user registration date by default) ignoring user activity status.
```sh tab="OTP"
./bin/pleroma_ctl digest test <nickname> [since_date]
```
=== "OTP"
```sh tab="From Source"
mix pleroma.digest test <nickname> [since_date]
```
```sh
./bin/pleroma_ctl digest test <nickname> [since_date]
```
=== "From Source"
```sh
mix pleroma.digest test <nickname> [since_date]
```
Example:
```sh tab="OTP"
./bin/pleroma_ctl digest test donaldtheduck 2019-05-20
```
=== "OTP"
```sh
./bin/pleroma_ctl digest test donaldtheduck 2019-05-20
```
=== "From Source"
```sh tab="From Source"
mix pleroma.digest test donaldtheduck 2019-05-20
```
```sh
mix pleroma.digest test donaldtheduck 2019-05-20
```
......@@ -4,21 +4,29 @@
## Send test email (instance email by default)
```sh tab="OTP"
./bin/pleroma_ctl email test [--to <destination email address>]
```
=== "OTP"