Merge branch 'release/2.3.0' into 'stable'
Release/2.3.0 See merge request pleroma/pleroma!3354
This commit is contained in:
commit
b221d77a6d
|
@ -1,3 +1,3 @@
|
||||||
[
|
[
|
||||||
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}", "priv/repo/migrations/*.exs", "priv/scrubbers/*.ex"]
|
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}", "priv/repo/migrations/*.exs", "priv/repo/optional_migrations/**/*.exs", "priv/scrubbers/*.ex"]
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,2 +1,10 @@
|
||||||
*.ex diff=elixir
|
*.ex diff=elixir
|
||||||
*.exs diff=elixir
|
*.exs diff=elixir
|
||||||
|
|
||||||
|
priv/static/instance/static.css diff=css
|
||||||
|
|
||||||
|
# Most of js/css files included in the repo are minified bundles,
|
||||||
|
# and we don't want to search/diff those as text files.
|
||||||
|
*.js binary
|
||||||
|
*.js.map binary
|
||||||
|
*.css binary
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
/db
|
/db
|
||||||
/deps
|
/deps
|
||||||
/*.ez
|
/*.ez
|
||||||
|
/test/instance
|
||||||
/test/uploads
|
/test/uploads
|
||||||
/.elixir_ls
|
/.elixir_ls
|
||||||
/test/fixtures/DSCN0010_tmp.jpg
|
/test/fixtures/DSCN0010_tmp.jpg
|
||||||
|
@ -27,9 +28,11 @@ erl_crash.dump
|
||||||
# variables.
|
# variables.
|
||||||
/config/*.secret.exs
|
/config/*.secret.exs
|
||||||
/config/generated_config.exs
|
/config/generated_config.exs
|
||||||
|
/config/*.env
|
||||||
|
|
||||||
|
|
||||||
# Database setup file, some may forget to delete it
|
# Database setup file, some may forget to delete it
|
||||||
/config/setup_db.psql
|
/config/setup_db*.psql
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env
|
.env
|
||||||
|
@ -50,3 +53,7 @@ pleroma.iml
|
||||||
|
|
||||||
# asdf
|
# asdf
|
||||||
.tool-versions
|
.tool-versions
|
||||||
|
|
||||||
|
# Editor temp files
|
||||||
|
/*~
|
||||||
|
/*#
|
|
@ -34,6 +34,14 @@ build:
|
||||||
- mix deps.get
|
- mix deps.get
|
||||||
- mix compile --force
|
- mix compile --force
|
||||||
|
|
||||||
|
spec-build:
|
||||||
|
stage: test
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- spec.json
|
||||||
|
script:
|
||||||
|
- mix pleroma.openapi_spec spec.json
|
||||||
|
|
||||||
benchmark:
|
benchmark:
|
||||||
stage: benchmark
|
stage: benchmark
|
||||||
when: manual
|
when: manual
|
||||||
|
@ -57,7 +65,7 @@ unit-testing:
|
||||||
policy: pull
|
policy: pull
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- name: postgres:9.6
|
- name: postgres:13
|
||||||
alias: postgres
|
alias: postgres
|
||||||
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
|
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
|
||||||
script:
|
script:
|
||||||
|
@ -155,6 +163,20 @@ review_app:
|
||||||
- (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
|
- (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
|
||||||
- git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
|
- git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
|
||||||
|
|
||||||
|
spec-deploy:
|
||||||
|
stage: deploy
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- spec.json
|
||||||
|
only:
|
||||||
|
- develop@pleroma/pleroma
|
||||||
|
image: alpine:latest
|
||||||
|
before_script:
|
||||||
|
- apk add curl
|
||||||
|
script:
|
||||||
|
- curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=$CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline
|
||||||
|
|
||||||
|
|
||||||
stop_review_app:
|
stop_review_app:
|
||||||
image: alpine:3.9
|
image: alpine:3.9
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
@ -181,7 +203,6 @@ amd64:
|
||||||
- develop@pleroma/pleroma
|
- develop@pleroma/pleroma
|
||||||
- /^maint/.*$/@pleroma/pleroma
|
- /^maint/.*$/@pleroma/pleroma
|
||||||
- /^release/.*$/@pleroma/pleroma
|
- /^release/.*$/@pleroma/pleroma
|
||||||
- /^build-release/.*$/@pleroma/pleroma
|
|
||||||
artifacts: &release-artifacts
|
artifacts: &release-artifacts
|
||||||
name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
|
name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
|
||||||
paths:
|
paths:
|
||||||
|
@ -229,8 +250,8 @@ arm:
|
||||||
artifacts: *release-artifacts
|
artifacts: *release-artifacts
|
||||||
only: *release-only
|
only: *release-only
|
||||||
tags:
|
tags:
|
||||||
- arm32
|
- arm32-specified
|
||||||
image: elixir:1.10.3
|
image: arm32v7/elixir:1.10.3
|
||||||
cache: *release-cache
|
cache: *release-cache
|
||||||
variables: *release-variables
|
variables: *release-variables
|
||||||
before_script: *before-release
|
before_script: *before-release
|
||||||
|
@ -241,8 +262,8 @@ arm-musl:
|
||||||
artifacts: *release-artifacts
|
artifacts: *release-artifacts
|
||||||
only: *release-only
|
only: *release-only
|
||||||
tags:
|
tags:
|
||||||
- arm32
|
- arm32-specified
|
||||||
image: elixir:1.10.3-alpine
|
image: arm32v7/elixir:1.10.3-alpine
|
||||||
cache: *release-cache
|
cache: *release-cache
|
||||||
variables: *release-variables
|
variables: *release-variables
|
||||||
before_script: *before-release-musl
|
before_script: *before-release-musl
|
||||||
|
@ -254,7 +275,7 @@ arm64:
|
||||||
only: *release-only
|
only: *release-only
|
||||||
tags:
|
tags:
|
||||||
- arm
|
- arm
|
||||||
image: elixir:1.10.3
|
image: arm64v8/elixir:1.10.3
|
||||||
cache: *release-cache
|
cache: *release-cache
|
||||||
variables: *release-variables
|
variables: *release-variables
|
||||||
before_script: *before-release
|
before_script: *before-release
|
||||||
|
@ -266,8 +287,7 @@ arm64-musl:
|
||||||
only: *release-only
|
only: *release-only
|
||||||
tags:
|
tags:
|
||||||
- arm
|
- arm
|
||||||
# TODO: Replace with upstream image when 1.9.0 comes out
|
image: arm64v8/elixir:1.10.3-alpine
|
||||||
image: elixir:1.10.3-alpine
|
|
||||||
cache: *release-cache
|
cache: *release-cache
|
||||||
variables: *release-variables
|
variables: *release-variables
|
||||||
before_script: *before-release-musl
|
before_script: *before-release-musl
|
||||||
|
@ -351,3 +371,26 @@ docker-release:
|
||||||
- dind
|
- dind
|
||||||
only:
|
only:
|
||||||
- /^release/.*$/@pleroma/pleroma
|
- /^release/.*$/@pleroma/pleroma
|
||||||
|
|
||||||
|
docker-adhoc:
|
||||||
|
stage: docker
|
||||||
|
image: docker:latest
|
||||||
|
cache: {}
|
||||||
|
dependencies: []
|
||||||
|
variables: *docker-variables
|
||||||
|
before_script: *before-docker
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
script:
|
||||||
|
- mkdir -p /root/.docker/cli-plugins
|
||||||
|
- wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
|
||||||
|
- echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
|
||||||
|
- chmod +x ~/.docker/cli-plugins/docker-buildx
|
||||||
|
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||||
|
- docker buildx create --name mbuilder --driver docker-container --use
|
||||||
|
- docker buildx inspect --bootstrap
|
||||||
|
- docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG .
|
||||||
|
tags:
|
||||||
|
- dind
|
||||||
|
only:
|
||||||
|
- /^build-docker/.*$/@pleroma/pleroma
|
1
.mailmap
1
.mailmap
|
@ -1,2 +1,3 @@
|
||||||
Ariadne Conill <ariadne@dereferenced.org> <nenolod@dereferenced.org>
|
Ariadne Conill <ariadne@dereferenced.org> <nenolod@dereferenced.org>
|
||||||
Ariadne Conill <ariadne@dereferenced.org> <nenolod@gmail.com>
|
Ariadne Conill <ariadne@dereferenced.org> <nenolod@gmail.com>
|
||||||
|
rinpatch <rin@patch.cx> <rinpatch@sdf.org>
|
||||||
|
|
110
CHANGELOG.md
110
CHANGELOG.md
|
@ -1,8 +1,107 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## [2.3.0] - 2020-03-01
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
- Fixed client user agent leaking through MediaProxy
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- `:auth, :enforce_oauth_admin_scope_usage` configuration option.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
|
||||||
|
- **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate/deactivate`
|
||||||
|
- Polls now always return a `voters_count`, even if they are single-choice.
|
||||||
|
- Admin Emails: The ap id is used as the user link in emails now.
|
||||||
|
- Improved registration workflow for email confirmation and account approval modes.
|
||||||
|
- Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries.
|
||||||
|
- Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators.
|
||||||
|
- Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders.
|
||||||
|
- Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script
|
||||||
|
- Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address.
|
||||||
|
- Provide redirect of external posts from `/notice/:id` to their original URL
|
||||||
|
- Admins no longer receive notifications for reports if they are the actor making the report.
|
||||||
|
- Improved Mailer configuration setting descriptions for AdminFE.
|
||||||
|
- Updated default avatar to look nicer.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>API Changes</summary>
|
||||||
|
|
||||||
|
- **Breaking:** AdminAPI changed User field `confirmation_pending` to `is_confirmed`
|
||||||
|
- **Breaking:** AdminAPI changed User field `approval_pending` to `is_approved`
|
||||||
|
- **Breaking**: AdminAPI changed User field `deactivated` to `is_active`
|
||||||
|
- **Breaking:** AdminAPI `GET /api/pleroma/admin/users/:nickname_or_id/statuses` changed response format and added the number of total users posts.
|
||||||
|
- **Breaking:** AdminAPI `GET /api/pleroma/admin/instances/:instance/statuses` changed response format and added the number of total users posts.
|
||||||
|
- Admin API: Reports now ordered by newest
|
||||||
|
- Pleroma API: `GET /api/v1/pleroma/chats` is deprecated in favor of `GET /api/v2/pleroma/chats`.
|
||||||
|
- Pleroma API: Reroute `/api/pleroma/*` to `/api/v1/pleroma/*`
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Reports now generate notifications for admins and mods.
|
||||||
|
- Support for local-only statuses.
|
||||||
|
- Support pagination of blocks and mutes.
|
||||||
|
- Account backup.
|
||||||
|
- Configuration: Add `:instance, autofollowing_nicknames` setting to provide a way to make accounts automatically follow new users that register on the local Pleroma instance.
|
||||||
|
- Ability to view remote timelines, with ex. `/api/v1/timelines/public?instance=lain.com` and streams `public:remote` and `public:remote:media`.
|
||||||
|
- The site title is now injected as a `title` tag like preloads or metadata.
|
||||||
|
- Password reset tokens now are not accepted after a certain age.
|
||||||
|
- Mix tasks to help with displaying and removing ConfigDB entries. See `mix pleroma.config`.
|
||||||
|
- OAuth form improvements: users are remembered by their cookie, the CSS is overridable by the admin, and the style has been improved.
|
||||||
|
- OAuth improvements and fixes: more secure session-based authentication (by token that could be revoked anytime), ability to revoke belonging OAuth token from any client etc.
|
||||||
|
- Ability to set ActivityPub aliases for follower migration.
|
||||||
|
- Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy
|
||||||
|
- Ability to define custom HTTP headers per each frontend
|
||||||
|
- MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users
|
||||||
|
- New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required)
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>API Changes</summary>
|
||||||
|
- Admin API: (`GET /api/pleroma/admin/users`) filter users by `unconfirmed` status and `actor_type`.
|
||||||
|
- Pleroma API: `GET /api/v2/pleroma/chats` added. It is exactly like `GET /api/v1/pleroma/chats` except supports pagination.
|
||||||
|
- Pleroma API: Add `idempotency_key` to the chat message entity that can be used for optimistic message sending.
|
||||||
|
- Pleroma API: (`GET /api/v1/pleroma/federation_status`) Add a way to get a list of unreachable instances.
|
||||||
|
- Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute.
|
||||||
|
- Admin API: An endpoint to manage frontends.
|
||||||
|
- Streaming API: Add follow relationships updates.
|
||||||
|
- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types.
|
||||||
|
- Mastodon API: Add monthly active users to `/api/v1/instance` (`pleroma.stats.mau`).
|
||||||
|
- Mastodon API: Home, public, hashtag & list timelines accept `only_media`, `remote` & `local` parameters for filtration.
|
||||||
|
- Mastodon API: `/api/v1/accounts/:id` & `/api/v1/mutes` endpoints accept `with_relationships` parameter and return filled `pleroma.relationship` field.
|
||||||
|
- Mastodon API: Endpoint to remove a conversation (`DELETE /api/v1/conversations/:id`).
|
||||||
|
- Mastodon API: `expires_in` in the scheduled post `params` field on `/api/v1/statuses` and `/api/v1/scheduled_statuses/:id` endpoints.
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Users with `is_discoverable` field set to false (default value) will appear in in-service search results but be hidden from external services (search bots etc.).
|
||||||
|
- Streaming API: Posts and notifications are not dropped, when CLI task is executing.
|
||||||
|
- Creating incorrect IPv4 address-style HTTP links when encountering certain numbers.
|
||||||
|
- Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private.
|
||||||
|
- Tag URLs in statuses are now absolute
|
||||||
|
- Removed duplicate jobs to purge expired activities
|
||||||
|
- File extensions of some attachments were incorrectly changed. This feature has been disabled for now.
|
||||||
|
- Mix task pleroma.instance creates missing parent directories if the configuration or SQL output paths are changed.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>API Changes</summary>
|
||||||
|
- Mastodon API: Current user is now included in conversation if it's the only participant.
|
||||||
|
- Mastodon API: Fixed last_status.account being not filled with account data.
|
||||||
|
- Mastodon API: Fix not being able to add or remove multiple users at once in lists.
|
||||||
|
- Mastodon API: Fixed own_votes being not returned with poll data.
|
||||||
|
- Mastodon API: Fixed creation of scheduled posts with polls.
|
||||||
|
- Mastodon API: Support for expires_in/expires_at in the Filters.
|
||||||
|
</details>
|
||||||
|
|
||||||
## [2.2.2] - 2020-01-18
|
## [2.2.2] - 2020-01-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -39,10 +138,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
1. Restart Pleroma
|
1. Restart Pleroma
|
||||||
|
|
||||||
|
|
||||||
## [2.2.0] - 2020-11-12
|
## [2.2.0] - 2020-11-12
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
- Fixed the possibility of using file uploads to spoof posts.
|
- Fixed the possibility of using file uploads to spoof posts.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -55,7 +154,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Renamed `:await_up_timeout` in `:connections_pool` namespace to `:connect_timeout`, old name is deprecated.
|
- Renamed `:await_up_timeout` in `:connections_pool` namespace to `:connect_timeout`, old name is deprecated.
|
||||||
- Renamed `:timeout` in `pools` namespace to `:recv_timeout`, old name is deprecated.
|
- Renamed `:timeout` in `pools` namespace to `:recv_timeout`, old name is deprecated.
|
||||||
- The `discoverable` field in the `User` struct will now add a NOINDEX metatag to profile pages when false.
|
- The `discoverable` field in the `User` struct will now add a NOINDEX metatag to profile pages when false.
|
||||||
- Users with the `discoverable` field set to false will not show up in searches.
|
- Users with the `is_discoverable` field set to false will not show up in searches ([bug](https://git.pleroma.social/pleroma/pleroma/-/issues/2301)).
|
||||||
- Minimum lifetime for ephmeral activities changed to 10 minutes and made configurable (`:min_lifetime` option).
|
- Minimum lifetime for ephmeral activities changed to 10 minutes and made configurable (`:min_lifetime` option).
|
||||||
- Introduced optional dependencies on `ffmpeg`, `ImageMagick`, `exiftool` software packages. Please refer to `docs/installation/optional/media_graphics_packages.md`.
|
- Introduced optional dependencies on `ffmpeg`, `ImageMagick`, `exiftool` software packages. Please refer to `docs/installation/optional/media_graphics_packages.md`.
|
||||||
- <details>
|
- <details>
|
||||||
|
@ -72,12 +171,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
switched to a new configuration mechanism, however it was not officially removed until now.
|
switched to a new configuration mechanism, however it was not officially removed until now.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Media preview proxy (requires `ffmpeg` and `ImageMagick` to be installed and media proxy to be enabled; see `:media_preview_proxy` config for more details).
|
- Media preview proxy (requires `ffmpeg` and `ImageMagick` to be installed and media proxy to be enabled; see `:media_preview_proxy` config for more details).
|
||||||
- Mix tasks for controlling user account confirmation status in bulk (`mix pleroma.user confirm_all` and `mix pleroma.user unconfirm_all`)
|
- Mix tasks for controlling user account confirmation status in bulk (`mix pleroma.user confirm_all` and `mix pleroma.user unconfirm_all`)
|
||||||
- Mix task for sending confirmation emails to all unconfirmed users (`mix pleroma.email send_confirmation_mails`)
|
- Mix task for sending confirmation emails to all unconfirmed users (`mix pleroma.email resend_confirmation_emails`)
|
||||||
- Mix task option for force-unfollowing relays
|
- Mix task option for force-unfollowing relays
|
||||||
- App metrics: ability to restrict access to specified IP whitelist.
|
- App metrics: ability to restrict access to specified IP whitelist.
|
||||||
- <details>
|
|
||||||
|
<details>
|
||||||
<summary>API Changes</summary>
|
<summary>API Changes</summary>
|
||||||
|
|
||||||
- Admin API: Importing emoji from a zip file
|
- Admin API: Importing emoji from a zip file
|
||||||
|
@ -86,7 +187,6 @@ switched to a new configuration mechanism, however it was not officially removed
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Add documented-but-missing chat pagination.
|
- Add documented-but-missing chat pagination.
|
||||||
|
|
9
COPYING
9
COPYING
|
@ -1,10 +1,17 @@
|
||||||
Unless otherwise stated this repository is copyright © 2017-2020
|
Unless otherwise stated this repository is copyright © 2017-2021
|
||||||
Pleroma Authors <https://pleroma.social/>, and is distributed under
|
Pleroma Authors <https://pleroma.social/>, and is distributed under
|
||||||
The GNU Affero General Public License Version 3, you should have received a
|
The GNU Affero General Public License Version 3, you should have received a
|
||||||
copy of the license file as AGPL-3.
|
copy of the license file as AGPL-3.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Files inside docs directory are copyright © 2021 Pleroma Authors
|
||||||
|
<https://pleroma.social/>, and are distributed under the Creative Commons
|
||||||
|
Attribution 4.0 International license, you should have received
|
||||||
|
a copy of the license file as CC-BY-4.0.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
The following files are copyright © 2019 shitposter.club, and are distributed
|
The following files are copyright © 2019 shitposter.club, and are distributed
|
||||||
under the Creative Commons Attribution-ShareAlike 4.0 International license,
|
under the Creative Commons Attribution-ShareAlike 4.0 International license,
|
||||||
you should have received a copy of the license file as CC-BY-SA-4.0.
|
you should have received a copy of the license file as CC-BY-SA-4.0.
|
||||||
|
|
|
@ -33,10 +33,11 @@ defp fetch_user(user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp create_filter(user) do
|
defp create_filter(user) do
|
||||||
Pleroma.Filter.create(%Pleroma.Filter{
|
Pleroma.Filter.create(%{
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
phrase: "must be filtered",
|
phrase: "must be filtered",
|
||||||
hide: true
|
hide: true,
|
||||||
|
context: ["home"]
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ defp generate_user(i) do
|
||||||
name: "Test テスト User #{i}",
|
name: "Test テスト User #{i}",
|
||||||
email: "user#{i}@example.com",
|
email: "user#{i}@example.com",
|
||||||
nickname: "nick#{i}",
|
nickname: "nick#{i}",
|
||||||
password_hash: Pbkdf2.hash_pwd_salt("test"),
|
password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("test"),
|
||||||
bio: "Tester Number #{i}",
|
bio: "Tester Number #{i}",
|
||||||
local: !remote
|
local: !remote
|
||||||
}
|
}
|
||||||
|
@ -109,8 +109,8 @@ def make_friends(main_user, max) when is_integer(max) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_friends(%User{} = main_user, %User{} = user) do
|
def make_friends(%User{} = main_user, %User{} = user) do
|
||||||
{:ok, _} = User.follow(main_user, user)
|
{:ok, _, _} = User.follow(main_user, user)
|
||||||
{:ok, _} = User.follow(user, main_user)
|
{:ok, _, _} = User.follow(user, main_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec get_users(User.t(), keyword()) :: [User.t()]
|
@spec get_users(User.t(), keyword()) :: [User.t()]
|
||||||
|
|
|
@ -50,7 +50,7 @@ def run(_args) do
|
||||||
)
|
)
|
||||||
|
|
||||||
users
|
users
|
||||||
|> Enum.each(fn {:ok, follower} -> Pleroma.User.follow(follower, user) end)
|
|> Enum.each(fn {:ok, follower, user} -> Pleroma.User.follow(follower, user) end)
|
||||||
|
|
||||||
Benchee.run(
|
Benchee.run(
|
||||||
%{
|
%{
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
config :pleroma, ecto_repos: [Pleroma.Repo]
|
config :pleroma, ecto_repos: [Pleroma.Repo]
|
||||||
|
|
||||||
config :pleroma, Pleroma.Repo,
|
config :pleroma, Pleroma.Repo,
|
||||||
types: Pleroma.PostgresTypes,
|
|
||||||
telemetry_event: [Pleroma.Repo.Instrumenter],
|
telemetry_event: [Pleroma.Repo.Instrumenter],
|
||||||
migration_lock: nil
|
migration_lock: nil
|
||||||
|
|
||||||
|
@ -64,23 +63,24 @@
|
||||||
filters: [Pleroma.Upload.Filter.Dedupe],
|
filters: [Pleroma.Upload.Filter.Dedupe],
|
||||||
link_name: false,
|
link_name: false,
|
||||||
proxy_remote: false,
|
proxy_remote: false,
|
||||||
proxy_opts: [
|
|
||||||
redirect_on_failure: false,
|
|
||||||
max_body_length: 25 * 1_048_576,
|
|
||||||
http: [
|
|
||||||
follow_redirect: true,
|
|
||||||
pool: :upload
|
|
||||||
]
|
|
||||||
],
|
|
||||||
filename_display_max_length: 30,
|
filename_display_max_length: 30,
|
||||||
default_description: nil
|
default_description: nil,
|
||||||
|
base_url: nil
|
||||||
|
|
||||||
config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
|
config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
|
||||||
|
|
||||||
config :pleroma, Pleroma.Uploaders.S3,
|
config :pleroma, Pleroma.Uploaders.S3,
|
||||||
bucket: nil,
|
bucket: nil,
|
||||||
streaming_enabled: true,
|
bucket_namespace: nil,
|
||||||
public_endpoint: "https://s3.amazonaws.com"
|
truncated_namespace: nil,
|
||||||
|
streaming_enabled: true
|
||||||
|
|
||||||
|
config :ex_aws, :s3,
|
||||||
|
# host: "s3.wasabisys.com", # required if not Amazon AWS
|
||||||
|
access_key_id: nil,
|
||||||
|
secret_access_key: nil,
|
||||||
|
# region: "us-east-1", # may be required for Amazon AWS
|
||||||
|
scheme: "https://"
|
||||||
|
|
||||||
config :pleroma, :emoji,
|
config :pleroma, :emoji,
|
||||||
shortcode_globs: ["/emoji/custom/**/*.png"],
|
shortcode_globs: ["/emoji/custom/**/*.png"],
|
||||||
|
@ -129,9 +129,6 @@
|
||||||
dispatch: [
|
dispatch: [
|
||||||
{:_,
|
{:_,
|
||||||
[
|
[
|
||||||
# FedSockets are commented out of the dispatch table on stable because they can't even
|
|
||||||
# fail properly when they are disabled. They will hang the connection instead of returning a 404.
|
|
||||||
# {"/api/fedsocket/v1", Pleroma.Web.FedSockets.IncomingHandler, []},
|
|
||||||
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
|
||||||
{"/websocket", Phoenix.Endpoint.CowboyWebSocket,
|
{"/websocket", Phoenix.Endpoint.CowboyWebSocket,
|
||||||
{Phoenix.Transports.WebSocket,
|
{Phoenix.Transports.WebSocket,
|
||||||
|
@ -150,16 +147,6 @@
|
||||||
"SameSite=Lax"
|
"SameSite=Lax"
|
||||||
]
|
]
|
||||||
|
|
||||||
config :pleroma, :fed_sockets,
|
|
||||||
enabled: false,
|
|
||||||
connection_duration: :timer.hours(8),
|
|
||||||
rejection_duration: :timer.minutes(15),
|
|
||||||
fed_socket_fetches: [
|
|
||||||
default: 12_000,
|
|
||||||
interval: 3_000,
|
|
||||||
lazy: false
|
|
||||||
]
|
|
||||||
|
|
||||||
# Configures Elixir's Logger
|
# Configures Elixir's Logger
|
||||||
config :logger, :console,
|
config :logger, :console,
|
||||||
level: :debug,
|
level: :debug,
|
||||||
|
@ -236,6 +223,7 @@
|
||||||
"text/bbcode"
|
"text/bbcode"
|
||||||
],
|
],
|
||||||
autofollowed_nicknames: [],
|
autofollowed_nicknames: [],
|
||||||
|
autofollowing_nicknames: [],
|
||||||
max_pinned_statuses: 1,
|
max_pinned_statuses: 1,
|
||||||
attachment_links: false,
|
attachment_links: false,
|
||||||
max_report_comment_size: 1000,
|
max_report_comment_size: 1000,
|
||||||
|
@ -265,7 +253,8 @@
|
||||||
length: 16
|
length: 16
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
show_reactions: true
|
show_reactions: true,
|
||||||
|
password_reset_token_validity: 60 * 60 * 24
|
||||||
|
|
||||||
config :pleroma, :welcome,
|
config :pleroma, :welcome,
|
||||||
direct_message: [
|
direct_message: [
|
||||||
|
@ -317,7 +306,7 @@
|
||||||
hideSitename: false,
|
hideSitename: false,
|
||||||
hideUserStats: false,
|
hideUserStats: false,
|
||||||
loginMethod: "password",
|
loginMethod: "password",
|
||||||
logo: "/static/logo.png",
|
logo: "/static/logo.svg",
|
||||||
logoMargin: ".1em",
|
logoMargin: ".1em",
|
||||||
logoMask: true,
|
logoMask: true,
|
||||||
minimalScopesMode: false,
|
minimalScopesMode: false,
|
||||||
|
@ -354,8 +343,8 @@
|
||||||
config :pleroma, :manifest,
|
config :pleroma, :manifest,
|
||||||
icons: [
|
icons: [
|
||||||
%{
|
%{
|
||||||
src: "/static/logo.png",
|
src: "/static/logo.svg",
|
||||||
type: "image/png"
|
type: "image/svg+xml"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
theme_color: "#282c37",
|
theme_color: "#282c37",
|
||||||
|
@ -449,7 +438,9 @@
|
||||||
headers: [],
|
headers: [],
|
||||||
options: []
|
options: []
|
||||||
|
|
||||||
config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, script_path: nil
|
config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script,
|
||||||
|
script_path: nil,
|
||||||
|
url_format: nil
|
||||||
|
|
||||||
# Note: media preview proxy depends on media proxy to be enabled
|
# Note: media preview proxy depends on media proxy to be enabled
|
||||||
config :pleroma, :media_preview_proxy,
|
config :pleroma, :media_preview_proxy,
|
||||||
|
@ -552,6 +543,8 @@
|
||||||
queues: [
|
queues: [
|
||||||
activity_expiration: 10,
|
activity_expiration: 10,
|
||||||
token_expiration: 5,
|
token_expiration: 5,
|
||||||
|
filter_expiration: 1,
|
||||||
|
backup: 1,
|
||||||
federator_incoming: 50,
|
federator_incoming: 50,
|
||||||
federator_outgoing: 50,
|
federator_outgoing: 50,
|
||||||
ingestion_queue: 50,
|
ingestion_queue: 50,
|
||||||
|
@ -561,8 +554,9 @@
|
||||||
scheduled_activities: 10,
|
scheduled_activities: 10,
|
||||||
background: 5,
|
background: 5,
|
||||||
remote_fetcher: 2,
|
remote_fetcher: 2,
|
||||||
attachments_cleanup: 5,
|
attachments_cleanup: 1,
|
||||||
new_users_digest: 1
|
new_users_digest: 1,
|
||||||
|
mute_expire: 5
|
||||||
],
|
],
|
||||||
plugins: [Oban.Plugins.Pruner],
|
plugins: [Oban.Plugins.Pruner],
|
||||||
crontab: [
|
crontab: [
|
||||||
|
@ -617,10 +611,7 @@
|
||||||
base_path: "/oauth",
|
base_path: "/oauth",
|
||||||
providers: ueberauth_providers
|
providers: ueberauth_providers
|
||||||
|
|
||||||
config :pleroma,
|
config :pleroma, :auth, oauth_consumer_strategies: oauth_consumer_strategies
|
||||||
:auth,
|
|
||||||
enforce_oauth_admin_scope_usage: true,
|
|
||||||
oauth_consumer_strategies: oauth_consumer_strategies
|
|
||||||
|
|
||||||
config :pleroma, Pleroma.Emails.Mailer, adapter: Swoosh.Adapters.Sendmail, enabled: false
|
config :pleroma, Pleroma.Emails.Mailer, adapter: Swoosh.Adapters.Sendmail, enabled: false
|
||||||
|
|
||||||
|
@ -657,7 +648,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
config :pleroma, :oauth2,
|
config :pleroma, :oauth2,
|
||||||
token_expires_in: 600,
|
token_expires_in: 3600 * 24 * 365 * 100,
|
||||||
issue_new_refresh_token: true,
|
issue_new_refresh_token: true,
|
||||||
clean_expired_tokens: false
|
clean_expired_tokens: false
|
||||||
|
|
||||||
|
@ -732,7 +723,10 @@
|
||||||
"git" => "https://git.pleroma.social/pleroma/fedi-fe",
|
"git" => "https://git.pleroma.social/pleroma/fedi-fe",
|
||||||
"build_url" =>
|
"build_url" =>
|
||||||
"https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
|
"https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
|
||||||
"ref" => "master"
|
"ref" => "master",
|
||||||
|
"custom-http-headers" => [
|
||||||
|
{"service-worker-allowed", "/"}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"admin-fe" => %{
|
"admin-fe" => %{
|
||||||
"name" => "admin-fe",
|
"name" => "admin-fe",
|
||||||
|
@ -820,7 +814,7 @@
|
||||||
config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: false
|
config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: false
|
||||||
|
|
||||||
config :pleroma, :mrf,
|
config :pleroma, :mrf,
|
||||||
policies: Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy,
|
policies: [Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy, Pleroma.Web.ActivityPub.MRF.TagPolicy],
|
||||||
transparency: true,
|
transparency: true,
|
||||||
transparency_exclusions: []
|
transparency_exclusions: []
|
||||||
|
|
||||||
|
@ -836,6 +830,16 @@
|
||||||
|
|
||||||
config :pleroma, Pleroma.Web.Auth.Authenticator, Pleroma.Web.Auth.PleromaAuthenticator
|
config :pleroma, Pleroma.Web.Auth.Authenticator, Pleroma.Web.Auth.PleromaAuthenticator
|
||||||
|
|
||||||
|
config :pleroma, Pleroma.User.Backup,
|
||||||
|
purge_after_days: 30,
|
||||||
|
limit_days: 7,
|
||||||
|
dir: nil
|
||||||
|
|
||||||
|
config :pleroma, ConcurrentLimiter, [
|
||||||
|
{Pleroma.Web.RichMedia.Helpers, [max_running: 5, max_waiting: 5]},
|
||||||
|
{Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy, [max_running: 5, max_waiting: 5]}
|
||||||
|
]
|
||||||
|
|
||||||
# Import environment specific config. This must remain at the bottom
|
# Import environment specific config. This must remain at the bottom
|
||||||
# of this file so it overrides the configuration defined above.
|
# of this file so it overrides the configuration defined above.
|
||||||
import_config "#{Mix.env()}.exs"
|
import_config "#{Mix.env()}.exs"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +1,3 @@
|
||||||
firefox, /emoji/Firefox.gif, Gif,Fun
|
firefox, /emoji/Firefox.gif, Gif,Fun
|
||||||
blank, /emoji/blank.png, Fun
|
blank, /emoji/blank.png, Fun
|
||||||
|
dinosaur, /emoji/dino walking.gif, Gif
|
||||||
|
|
|
@ -19,11 +19,6 @@
|
||||||
level: :warn,
|
level: :warn,
|
||||||
format: "\n[$level] $message\n"
|
format: "\n[$level] $message\n"
|
||||||
|
|
||||||
config :pleroma, :fed_sockets,
|
|
||||||
enabled: false,
|
|
||||||
connection_duration: 5,
|
|
||||||
rejection_duration: 5
|
|
||||||
|
|
||||||
config :pleroma, :auth, oauth_consumer_strategies: []
|
config :pleroma, :auth, oauth_consumer_strategies: []
|
||||||
|
|
||||||
config :pleroma, Pleroma.Upload,
|
config :pleroma, Pleroma.Upload,
|
||||||
|
@ -43,7 +38,7 @@
|
||||||
external_user_synchronization: false,
|
external_user_synchronization: false,
|
||||||
static_dir: "test/instance_static/"
|
static_dir: "test/instance_static/"
|
||||||
|
|
||||||
config :pleroma, :activitypub, sign_object_fetches: false
|
config :pleroma, :activitypub, sign_object_fetches: false, follow_handshake_timeout: 0
|
||||||
|
|
||||||
# Configure your database
|
# Configure your database
|
||||||
config :pleroma, Pleroma.Repo,
|
config :pleroma, Pleroma.Repo,
|
||||||
|
@ -52,10 +47,13 @@
|
||||||
password: "postgres",
|
password: "postgres",
|
||||||
database: "pleroma_test",
|
database: "pleroma_test",
|
||||||
hostname: System.get_env("DB_HOST") || "localhost",
|
hostname: System.get_env("DB_HOST") || "localhost",
|
||||||
pool: Ecto.Adapters.SQL.Sandbox
|
pool: Ecto.Adapters.SQL.Sandbox,
|
||||||
|
pool_size: 50
|
||||||
|
|
||||||
|
config :pleroma, :dangerzone, override_repo_pool_size: true
|
||||||
|
|
||||||
# Reduce hash rounds for testing
|
# Reduce hash rounds for testing
|
||||||
config :pbkdf2_elixir, rounds: 1
|
config :pleroma, :password, iterations: 1
|
||||||
|
|
||||||
config :tesla, adapter: Tesla.Mock
|
config :tesla, adapter: Tesla.Mock
|
||||||
|
|
||||||
|
@ -117,15 +115,24 @@
|
||||||
|
|
||||||
config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true
|
config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true
|
||||||
|
|
||||||
config :pleroma, Pleroma.Uploaders.S3,
|
|
||||||
bucket: nil,
|
|
||||||
streaming_enabled: true,
|
|
||||||
public_endpoint: nil
|
|
||||||
|
|
||||||
config :tzdata, :autoupdate, :disabled
|
config :tzdata, :autoupdate, :disabled
|
||||||
|
|
||||||
config :pleroma, :mrf, policies: []
|
config :pleroma, :mrf, policies: []
|
||||||
|
|
||||||
|
config :pleroma, :pipeline,
|
||||||
|
object_validator: Pleroma.Web.ActivityPub.ObjectValidatorMock,
|
||||||
|
mrf: Pleroma.Web.ActivityPub.MRFMock,
|
||||||
|
activity_pub: Pleroma.Web.ActivityPub.ActivityPubMock,
|
||||||
|
side_effects: Pleroma.Web.ActivityPub.SideEffectsMock,
|
||||||
|
federator: Pleroma.Web.FederatorMock,
|
||||||
|
config: Pleroma.ConfigMock
|
||||||
|
|
||||||
|
config :pleroma, :cachex, provider: Pleroma.CachexMock
|
||||||
|
|
||||||
|
config :pleroma, :side_effects,
|
||||||
|
ap_streamer: Pleroma.Web.ActivityPub.ActivityPubMock,
|
||||||
|
logger: Pleroma.LoggerMock
|
||||||
|
|
||||||
if File.exists?("./config/test.secret.exs") do
|
if File.exists?("./config/test.secret.exs") do
|
||||||
import_config "test.secret.exs"
|
import_config "test.secret.exs"
|
||||||
else
|
else
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
config :pleroma, configurable_from_database: false
|
config :pleroma, configurable_from_database: false
|
||||||
```
|
```
|
||||||
|
|
||||||
To delete transfered settings from database optional flag `-d` can be used. `<env>` is `prod` by default.
|
To delete transferred settings from database optional flag `-d` can be used. `<env>` is `prod` by default.
|
||||||
|
|
||||||
=== "OTP"
|
=== "OTP"
|
||||||
```sh
|
```sh
|
||||||
|
@ -43,3 +43,111 @@ To delete transfered settings from database optional flag `-d` can be used. `<en
|
||||||
```sh
|
```sh
|
||||||
mix pleroma.config migrate_from_db [--env=<env>] [-d]
|
mix pleroma.config migrate_from_db [--env=<env>] [-d]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Dump all of the config settings defined in the database
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl config dump
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.config dump
|
||||||
|
```
|
||||||
|
|
||||||
|
## List individual configuration groups in the database
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl config groups
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.config groups
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dump the saved configuration values for a specific group or key
|
||||||
|
|
||||||
|
e.g., this shows all the settings under `config :pleroma`
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl config dump pleroma
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.config dump pleroma
|
||||||
|
```
|
||||||
|
|
||||||
|
To get values under a specific key:
|
||||||
|
|
||||||
|
e.g., this shows all the settings under `config :pleroma, :instance`
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl config dump pleroma instance
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.config dump pleroma instance
|
||||||
|
```
|
||||||
|
|
||||||
|
## Delete the saved configuration values for a specific group or key
|
||||||
|
|
||||||
|
e.g., this deletes all the settings under `config :tesla`
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl config delete [--force] tesla
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.config delete [--force] tesla
|
||||||
|
```
|
||||||
|
|
||||||
|
To delete values under a specific key:
|
||||||
|
|
||||||
|
e.g., this deletes all the settings under `config :phoenix, :stacktrace_depth`
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl config delete [--force] phoenix stacktrace_depth
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.config delete [--force] phoenix stacktrace_depth
|
||||||
|
```
|
||||||
|
|
||||||
|
## Remove all settings from the database
|
||||||
|
|
||||||
|
This forcibly removes all saved values in the database.
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl config [--force] reset
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.config [--force] reset
|
||||||
|
```
|
||||||
|
|
|
@ -141,3 +141,21 @@ but should only be run if necessary. **It is safe to cancel this.**
|
||||||
```sh
|
```sh
|
||||||
mix pleroma.database ensure_expiration
|
mix pleroma.database ensure_expiration
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Change Text Search Configuration
|
||||||
|
|
||||||
|
Change `default_text_search_config` for database and (if necessary) text_search_config used in index, then rebuild index (it may take time).
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl database set_text_search_config english
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.database set_text_search_config english
|
||||||
|
```
|
||||||
|
|
||||||
|
See [PostgreSQL documentation](https://www.postgresql.org/docs/current/textsearch-configuration.html) and `docs/configuration/howto_search_cjk.md` for more detail.
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
mix pleroma.email test [--to <destination email address>]
|
mix pleroma.email test [--to <destination email address>]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
=== "OTP"
|
=== "OTP"
|
||||||
|
@ -36,11 +35,11 @@ Example:
|
||||||
=== "OTP"
|
=== "OTP"
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./bin/pleroma_ctl email send_confirmation_mails
|
./bin/pleroma_ctl email resend_confirmation_emails
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "From Source"
|
=== "From Source"
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mix pleroma.email send_confirmation_mails
|
mix pleroma.email resend_confirmation_emails
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
# Managing frontends
|
# Managing frontends
|
||||||
|
|
||||||
`mix pleroma.frontend install <frontend> [--ref <ref>] [--file <file>] [--build-url <build-url>] [--path <path>] [--build-dir <build-dir>]`
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl frontend install <frontend> [--ref <ref>] [--file <file>] [--build-url <build-url>] [--path <path>] [--build-dir <build-dir>]
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.frontend install <frontend> [--ref <ref>] [--file <file>] [--build-url <build-url>] [--path <path>] [--build-dir <build-dir>]
|
||||||
|
```
|
||||||
|
|
||||||
Frontend can be installed either from local zip file, or automatically downloaded from the web.
|
Frontend can be installed either from local zip file, or automatically downloaded from the web.
|
||||||
|
|
||||||
You can give all the options directly on the command like, but missing information will be filled out by looking at the data configured under `frontends.available` in the config files.
|
You can give all the options directly on the command line, but missing information will be filled out by looking at the data configured under `frontends.available` in the config files.
|
||||||
|
|
||||||
|
Currently, known `<frontend>` values are:
|
||||||
|
|
||||||
Currently known `<frontend>` values are:
|
|
||||||
- [admin-fe](https://git.pleroma.social/pleroma/admin-fe)
|
- [admin-fe](https://git.pleroma.social/pleroma/admin-fe)
|
||||||
- [kenoma](http://git.pleroma.social/lambadalambda/kenoma)
|
- [kenoma](http://git.pleroma.social/lambadalambda/kenoma)
|
||||||
- [pleroma-fe](http://git.pleroma.social/pleroma/pleroma-fe)
|
- [pleroma-fe](http://git.pleroma.social/pleroma/pleroma-fe)
|
||||||
|
@ -19,51 +30,67 @@ You can still install frontends that are not configured, see below.
|
||||||
|
|
||||||
For a frontend configured under the `available` key, it's enough to install it by name.
|
For a frontend configured under the `available` key, it's enough to install it by name.
|
||||||
|
|
||||||
```sh tab="OTP"
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
./bin/pleroma_ctl frontend install pleroma
|
./bin/pleroma_ctl frontend install pleroma
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh tab="From Source"
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
mix pleroma.frontend install pleroma
|
mix pleroma.frontend install pleroma
|
||||||
```
|
```
|
||||||
|
|
||||||
This will download the latest build for the the pre-configured `ref` and install it. It can then be configured as the one of the served frontends in the config file (see `primary` or `admin`).
|
This will download the latest build for the pre-configured `ref` and install it. It can then be configured as the one of the served frontends in the config file (see `primary` or `admin`).
|
||||||
|
|
||||||
You can override any of the details. To install a pleroma build from a different url, you could do this:
|
You can override any of the details. To install a pleroma build from a different URL, you could do this:
|
||||||
|
|
||||||
```sh tab="OPT"
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
./bin/pleroma_ctl frontend install pleroma --ref 2hu_edition --build-url https://example.org/raymoo.zip
|
./bin/pleroma_ctl frontend install pleroma --ref 2hu_edition --build-url https://example.org/raymoo.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh tab="From Source"
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
mix pleroma.frontend install pleroma --ref 2hu_edition --build-url https://example.org/raymoo.zip
|
mix pleroma.frontend install pleroma --ref 2hu_edition --build-url https://example.org/raymoo.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, you can also install from a local zip file.
|
Similarly, you can also install from a local zip file.
|
||||||
|
|
||||||
```sh tab="OTP"
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
./bin/pleroma_ctl frontend install pleroma --ref mybuild --file ~/Downloads/doomfe.zip
|
./bin/pleroma_ctl frontend install pleroma --ref mybuild --file ~/Downloads/doomfe.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh tab="From Source"
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
mix pleroma.frontend install pleroma --ref mybuild --file ~/Downloads/doomfe.zip
|
mix pleroma.frontend install pleroma --ref mybuild --file ~/Downloads/doomfe.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
The resulting frontend will always be installed into a folder of this template: `${instance_static}/frontends/${name}/${ref}`
|
The resulting frontend will always be installed into a folder of this template: `${instance_static}/frontends/${name}/${ref}`.
|
||||||
|
|
||||||
Careful: This folder will be completely replaced on installation
|
Careful: This folder will be completely replaced on installation.
|
||||||
|
|
||||||
## Example installation for an unknown frontend
|
## Example installation for an unknown frontend
|
||||||
|
|
||||||
The installation process is the same, but you will have to give all the needed options on the commond line. For example:
|
The installation process is the same, but you will have to give all the needed options on the command line. For example:
|
||||||
|
|
||||||
```sh tab="OTP"
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
./bin/pleroma_ctl frontend install gensokyo --ref master --build-url https://gensokyo.2hu/builds/marisa.zip
|
./bin/pleroma_ctl frontend install gensokyo --ref master --build-url https://gensokyo.2hu/builds/marisa.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh tab="From Source"
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
mix pleroma.frontend install gensokyo --ref master --build-url https://gensokyo.2hu/builds/marisa.zip
|
mix pleroma.frontend install gensokyo --ref master --build-url https://gensokyo.2hu/builds/marisa.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't have a zip file but just want to install a frontend from a local path, you can simply copy the files over a folder of this template: `${instance_static}/frontends/${name}/${ref}`
|
If you don't have a zip file but just want to install a frontend from a local path, you can simply copy the files over a folder of this template: `${instance_static}/frontends/${name}/${ref}`.
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,5 @@ If any of the options are left unspecified, you will be prompted interactively.
|
||||||
- `--strip-uploads <Y|N>` - use ExifTool to strip uploads of sensitive location data
|
- `--strip-uploads <Y|N>` - use ExifTool to strip uploads of sensitive location data
|
||||||
- `--anonymize-uploads <Y|N>` - randomize uploaded filenames
|
- `--anonymize-uploads <Y|N>` - randomize uploaded filenames
|
||||||
- `--dedupe-uploads <Y|N>` - store files based on their hash to reduce data storage requirements if duplicates are uploaded with different filenames
|
- `--dedupe-uploads <Y|N>` - store files based on their hash to reduce data storage requirements if duplicates are uploaded with different filenames
|
||||||
|
- `--skip-release-env` - skip generation the release environment file
|
||||||
|
- `--release-env-file` - release environment file path
|
||||||
|
|
|
@ -133,22 +133,20 @@
|
||||||
mix pleroma.user sign_out <nickname>
|
mix pleroma.user sign_out <nickname>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Activate a user
|
||||||
## Deactivate or activate a user
|
|
||||||
|
|
||||||
=== "OTP"
|
=== "OTP"
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./bin/pleroma_ctl user toggle_activated <nickname>
|
./bin/pleroma_ctl user activate NICKNAME
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "From Source"
|
=== "From Source"
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mix pleroma.user toggle_activated <nickname>
|
mix pleroma.user activate NICKNAME
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Deactivate a user and unsubscribes local users from the user
|
## Deactivate a user and unsubscribes local users from the user
|
||||||
|
|
||||||
=== "OTP"
|
=== "OTP"
|
||||||
|
@ -264,13 +262,13 @@
|
||||||
=== "OTP"
|
=== "OTP"
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./bin/pleroma_ctl user toggle_confirmed <nickname>
|
./bin/pleroma_ctl user confirm <nickname>
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "From Source"
|
=== "From Source"
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mix pleroma.user toggle_confirmed <nickname>
|
mix pleroma.user confirm <nickname>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Set confirmation status for all regular active users
|
## Set confirmation status for all regular active users
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
# ChatMessages
|
|
||||||
|
|
||||||
ChatMessages are the messages sent in 1-on-1 chats. They are similar to
|
|
||||||
`Note`s, but the addresing is done by having a single AP actor in the `to`
|
|
||||||
field. Addressing multiple actors is not allowed. These messages are always
|
|
||||||
private, there is no public version of them. They are created with a `Create`
|
|
||||||
activity.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"actor": "http://2hu.gensokyo/users/raymoo",
|
|
||||||
"id": "http://2hu.gensokyo/objects/1",
|
|
||||||
"object": {
|
|
||||||
"attributedTo": "http://2hu.gensokyo/users/raymoo",
|
|
||||||
"content": "You expected a cute girl? Too bad.",
|
|
||||||
"id": "http://2hu.gensokyo/objects/2",
|
|
||||||
"published": "2020-02-12T14:08:20Z",
|
|
||||||
"to": [
|
|
||||||
"http://2hu.gensokyo/users/marisa"
|
|
||||||
],
|
|
||||||
"type": "ChatMessage"
|
|
||||||
},
|
|
||||||
"published": "2018-02-12T14:08:20Z",
|
|
||||||
"to": [
|
|
||||||
"http://2hu.gensokyo/users/marisa"
|
|
||||||
],
|
|
||||||
"type": "Create"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This setup does not prevent multi-user chats, but these will have to go through
|
|
||||||
a `Group`, which will be the recipient of the messages and then `Announce` them
|
|
||||||
to the users in the `Group`.
|
|
|
@ -7,97 +7,105 @@ Feel free to contact us to be added to this list!
|
||||||
- Homepage: <https://www.pleroma.com/#desktopApp>
|
- Homepage: <https://www.pleroma.com/#desktopApp>
|
||||||
- Source Code: <https://github.com/roma-apps/roma-desktop>
|
- Source Code: <https://github.com/roma-apps/roma-desktop>
|
||||||
- Platforms: Windows, Mac, Linux
|
- Platforms: Windows, Mac, Linux
|
||||||
- Features: Streaming Ready
|
- Features: MastoAPI, Streaming Ready
|
||||||
|
|
||||||
### Social
|
### Social
|
||||||
- Source Code: <https://gitlab.gnome.org/World/Social>
|
- Source Code: <https://gitlab.gnome.org/World/Social>
|
||||||
- Contact: [@brainblasted@social.libre.fi](https://social.libre.fi/users/brainblasted)
|
- Contact: [@brainblasted@social.libre.fi](https://social.libre.fi/users/brainblasted)
|
||||||
- Platforms: Linux (GNOME)
|
- Platforms: Linux (GNOME)
|
||||||
- Note(2019-01-28): Not at a pre-alpha stage yet
|
- Note(2019-01-28): Not at a pre-alpha stage yet
|
||||||
|
- Features: MastoAPI
|
||||||
|
|
||||||
### Whalebird
|
### Whalebird
|
||||||
- Homepage: <https://whalebird.org/>
|
- Homepage: <https://whalebird.social/>
|
||||||
- Source Code: <https://github.com/h3poteto/whalebird-desktop>
|
- Source Code: <https://github.com/h3poteto/whalebird-desktop>
|
||||||
- Contact: [@h3poteto@pleroma.io](https://pleroma.io/users/h3poteto)
|
- Contact: [@h3poteto@pleroma.io](https://pleroma.io/users/h3poteto)
|
||||||
- Platforms: Windows, Mac, Linux
|
- Platforms: Windows, Mac, Linux
|
||||||
- Features: Streaming Ready
|
- Features: MastoAPI, Streaming Ready
|
||||||
|
|
||||||
## Handheld
|
## Handheld
|
||||||
|
### AndStatus
|
||||||
|
- Homepage: <http://andstatus.org/>
|
||||||
|
- Source Code: <https://github.com/andstatus/andstatus/>
|
||||||
|
- Platforms: Android
|
||||||
|
- Features: MastoAPI, ActivityPub (Client-to-Server)
|
||||||
|
|
||||||
### Amaroq
|
### Amaroq
|
||||||
- Homepage: <https://itunes.apple.com/us/app/amaroq-for-mastodon/id1214116200>
|
- Homepage: <https://itunes.apple.com/us/app/amaroq-for-mastodon/id1214116200>
|
||||||
- Source Code: <https://github.com/ReticentJohn/Amaroq>
|
- Source Code: <https://github.com/ReticentJohn/Amaroq>
|
||||||
- Contact: [@eurasierboy@mastodon.social](https://mastodon.social/users/eurasierboy)
|
- Contact: [@eurasierboy@mastodon.social](https://mastodon.social/users/eurasierboy)
|
||||||
- Platforms: iOS
|
- Platforms: iOS
|
||||||
- Features: No Streaming
|
- Features: MastoAPI, No Streaming
|
||||||
|
|
||||||
### Fedilab
|
### Fedilab
|
||||||
- Homepage: <https://fedilab.app/>
|
- Homepage: <https://fedilab.app/>
|
||||||
- Source Code: <https://framagit.org/tom79/fedilab/>
|
- Source Code: <https://framagit.org/tom79/fedilab/>
|
||||||
- Contact: [@fedilab@framapiaf.org](https://framapiaf.org/users/fedilab)
|
- Contact: [@fedilab@framapiaf.org](https://framapiaf.org/users/fedilab)
|
||||||
- Platforms: Android
|
- Platforms: Android
|
||||||
- Features: Streaming Ready, Moderation, Text Formatting
|
- Features: MastoAPI, Streaming Ready, Moderation, Text Formatting
|
||||||
|
|
||||||
### Kyclos
|
### Kyclos
|
||||||
- Source Code: <https://git.pleroma.social/pleroma/harbour-kyclos>
|
- Source Code: <https://git.pleroma.social/pleroma/harbour-kyclos>
|
||||||
- Platforms: SailfishOS
|
- Platforms: SailfishOS
|
||||||
- Features: No Streaming
|
- Features: MastoAPI, No Streaming
|
||||||
|
|
||||||
### Husky
|
### Husky
|
||||||
- Source code: <https://git.mentality.rip/FWGS/Husky>
|
- Source code: <https://git.mentality.rip/FWGS/Husky>
|
||||||
- Contact: [@Husky@enigmatic.observer](https://enigmatic.observer/users/Husky)
|
- Contact: [@Husky@enigmatic.observer](https://enigmatic.observer/users/Husky)
|
||||||
- Platforms: Android
|
- Platforms: Android
|
||||||
- Features: No Streaming, Emoji Reactions, Text Formatting, FE Stickers
|
- Features: MastoAPI, No Streaming, Emoji Reactions, Text Formatting, FE Stickers
|
||||||
|
|
||||||
### Fedi
|
### Fedi
|
||||||
- Homepage: <https://www.fediapp.com/>
|
- Homepage: <https://www.fediapp.com/>
|
||||||
- Source Code: Proprietary, but gratis
|
- Source Code: Proprietary, but gratis
|
||||||
- Platforms: iOS, Android
|
- Platforms: iOS, Android
|
||||||
- Features: Pleroma-specific features like Reactions
|
- Features: MastoAPI, Pleroma-specific features like Reactions
|
||||||
|
|
||||||
### Tusky
|
### Tusky
|
||||||
- Homepage: <https://tuskyapp.github.io/>
|
- Homepage: <https://tuskyapp.github.io/>
|
||||||
- Source Code: <https://github.com/tuskyapp/Tusky>
|
- Source Code: <https://github.com/tuskyapp/Tusky>
|
||||||
- Contact: [@ConnyDuck@mastodon.social](https://mastodon.social/users/ConnyDuck)
|
- Contact: [@ConnyDuck@mastodon.social](https://mastodon.social/users/ConnyDuck)
|
||||||
- Platforms: Android
|
- Platforms: Android
|
||||||
- Features: No Streaming
|
- Features: MastoAPI, No Streaming
|
||||||
|
|
||||||
### Twidere
|
### Twidere
|
||||||
- Homepage: <https://twidere.mariotaku.org/>
|
- Homepage: <https://twidere.mariotaku.org/>
|
||||||
- Source Code: <https://github.com/TwidereProject/Twidere-Android/>
|
- Source Code: <https://github.com/TwidereProject/Twidere-Android/>
|
||||||
- Contact: <me@mariotaku.org>
|
- Contact: <me@mariotaku.org>
|
||||||
- Platform: Android
|
- Platform: Android
|
||||||
- Features: No Streaming
|
- Features: MastoAPI, No Streaming
|
||||||
|
|
||||||
### Indigenous
|
### Indigenous
|
||||||
- Homepage: <https://indigenous.realize.be/>
|
- Homepage: <https://indigenous.realize.be/>
|
||||||
- Source Code: <https://github.com/swentel/indigenous-android/>
|
- Source Code: <https://github.com/swentel/indigenous-android/>
|
||||||
- Contact: [@swentel@realize.be](https://realize.be)
|
- Contact: [@swentel@realize.be](https://realize.be)
|
||||||
- Platforms: Android
|
- Platforms: Android
|
||||||
- Features: No Streaming
|
- Features: MastoAPI, No Streaming
|
||||||
|
|
||||||
## Alternative Web Interfaces
|
## Alternative Web Interfaces
|
||||||
### Brutaldon
|
### Brutaldon
|
||||||
- Homepage: <https://jfm.carcosa.net/projects/software/brutaldon/>
|
- Homepage: <https://jfm.carcosa.net/projects/software/brutaldon/>
|
||||||
- Source Code: <https://git.carcosa.net/jmcbray/brutaldon>
|
- Source Code: <https://git.carcosa.net/jmcbray/brutaldon>
|
||||||
- Contact: [@gcupc@glitch.social](https://glitch.social/users/gcupc)
|
- Contact: [@gcupc@glitch.social](https://glitch.social/users/gcupc)
|
||||||
- Features: No Streaming
|
- Features: MastoAPI, No Streaming
|
||||||
|
|
||||||
### Halcyon
|
### Halcyon
|
||||||
- Source Code: <https://notabug.org/halcyon-suite/halcyon>
|
- Source Code: <https://notabug.org/halcyon-suite/halcyon>
|
||||||
- Contact: [@halcyon@social.csswg.org](https://social.csswg.org/users/halcyon)
|
- Contact: [@halcyon@social.csswg.org](https://social.csswg.org/users/halcyon)
|
||||||
- Features: Streaming Ready
|
- Features: MastoAPI, Streaming Ready
|
||||||
|
|
||||||
### Pinafore
|
### Pinafore
|
||||||
- Homepage: <https://pinafore.social/>
|
- Homepage: <https://pinafore.social/>
|
||||||
- Source Code: <https://github.com/nolanlawson/pinafore>
|
- Source Code: <https://github.com/nolanlawson/pinafore>
|
||||||
- Contact: [@pinafore@mastodon.technology](https://mastodon.technology/users/pinafore)
|
- Contact: [@pinafore@mastodon.technology](https://mastodon.technology/users/pinafore)
|
||||||
- Note: Pleroma support is a secondary goal
|
- Note: Pleroma support is a secondary goal
|
||||||
- Features: No Streaming
|
- Features: MastoAPI, No Streaming
|
||||||
|
|
||||||
### Sengi
|
### Sengi
|
||||||
- Homepage: <https://nicolasconstant.github.io/sengi/>
|
- Homepage: <https://nicolasconstant.github.io/sengi/>
|
||||||
- Source Code: <https://github.com/NicolasConstant/sengi>
|
- Source Code: <https://github.com/NicolasConstant/sengi>
|
||||||
- Contact: [@sengi_app@mastodon.social](https://mastodon.social/users/sengi_app)
|
- Contact: [@sengi_app@mastodon.social](https://mastodon.social/users/sengi_app)
|
||||||
|
- Features: MastoAPI
|
||||||
|
|
||||||
### DashFE
|
### DashFE
|
||||||
- Source Code: <https://notabug.org/daisuke/DashboardFE>
|
- Source Code: <https://notabug.org/daisuke/DashboardFE>
|
||||||
|
@ -107,3 +115,4 @@ Feel free to contact us to be added to this list!
|
||||||
- Source Code: <https://git.freesoftwareextremist.com/bloat/>
|
- Source Code: <https://git.freesoftwareextremist.com/bloat/>
|
||||||
- Contact: [@r@freesoftwareextremist.com](https://freesoftwareextremist.com/users/r)
|
- Contact: [@r@freesoftwareextremist.com](https://freesoftwareextremist.com/users/r)
|
||||||
- Features: Does not requires JavaScript
|
- Features: Does not requires JavaScript
|
||||||
|
- Features: MastoAPI
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
See `Authentication` section of [the configuration cheatsheet](../configuration/cheatsheet.md#authentication).
|
|
@ -45,10 +45,11 @@ To add configuration to your config file, you can copy it from the base config.
|
||||||
older software for theses nicknames.
|
older software for theses nicknames.
|
||||||
* `max_pinned_statuses`: The maximum number of pinned statuses. `0` will disable the feature.
|
* `max_pinned_statuses`: The maximum number of pinned statuses. `0` will disable the feature.
|
||||||
* `autofollowed_nicknames`: Set to nicknames of (local) users that every new user should automatically follow.
|
* `autofollowed_nicknames`: Set to nicknames of (local) users that every new user should automatically follow.
|
||||||
|
* `autofollowing_nicknames`: Set to nicknames of (local) users that automatically follows every newly registered user.
|
||||||
* `attachment_links`: Set to true to enable automatically adding attachment link text to statuses.
|
* `attachment_links`: Set to true to enable automatically adding attachment link text to statuses.
|
||||||
* `max_report_comment_size`: The maximum size of the report comment (Default: `1000`).
|
* `max_report_comment_size`: The maximum size of the report comment (Default: `1000`).
|
||||||
* `safe_dm_mentions`: If set to true, only mentions at the beginning of a post will be used to address people in direct messages. This is to prevent accidental mentioning of people when talking about them (e.g. "@friend hey i really don't like @enemy"). Default: `false`.
|
* `safe_dm_mentions`: If set to true, only mentions at the beginning of a post will be used to address people in direct messages. This is to prevent accidental mentioning of people when talking about them (e.g. "@friend hey i really don't like @enemy"). Default: `false`.
|
||||||
* `healthcheck`: If set to true, system data will be shown on ``/api/pleroma/healthcheck``.
|
* `healthcheck`: If set to true, system data will be shown on ``/api/v1/pleroma/healthcheck``.
|
||||||
* `remote_post_retention_days`: The default amount of days to retain remote posts when pruning the database.
|
* `remote_post_retention_days`: The default amount of days to retain remote posts when pruning the database.
|
||||||
* `user_bio_length`: A user bio maximum length (default: `5000`).
|
* `user_bio_length`: A user bio maximum length (default: `5000`).
|
||||||
* `user_name_length`: A user name maximum length (default: `100`).
|
* `user_name_length`: A user name maximum length (default: `100`).
|
||||||
|
@ -62,6 +63,7 @@ To add configuration to your config file, you can copy it from the base config.
|
||||||
* `external_user_synchronization`: Enabling following/followers counters synchronization for external users.
|
* `external_user_synchronization`: Enabling following/followers counters synchronization for external users.
|
||||||
* `cleanup_attachments`: Remove attachments along with statuses. Does not affect duplicate files and attachments without status. Enabling this will increase load to database when deleting statuses on larger instances.
|
* `cleanup_attachments`: Remove attachments along with statuses. Does not affect duplicate files and attachments without status. Enabling this will increase load to database when deleting statuses on larger instances.
|
||||||
* `show_reactions`: Let favourites and emoji reactions be viewed through the API (default: `true`).
|
* `show_reactions`: Let favourites and emoji reactions be viewed through the API (default: `true`).
|
||||||
|
* `password_reset_token_validity`: The time after which reset tokens aren't accepted anymore, in seconds (default: one day).
|
||||||
|
|
||||||
## Welcome
|
## Welcome
|
||||||
* `direct_message`: - welcome message sent as a direct message.
|
* `direct_message`: - welcome message sent as a direct message.
|
||||||
|
@ -219,13 +221,11 @@ config :pleroma, :mrf_user_allowlist, %{
|
||||||
* `total_user_limit`: the number of scheduled activities a user is allowed to create in total (Default: `300`)
|
* `total_user_limit`: the number of scheduled activities a user is allowed to create in total (Default: `300`)
|
||||||
* `enabled`: whether scheduled activities are sent to the job queue to be executed
|
* `enabled`: whether scheduled activities are sent to the job queue to be executed
|
||||||
|
|
||||||
## Frontends
|
|
||||||
|
|
||||||
### :frontend_configurations
|
### :frontend_configurations
|
||||||
|
|
||||||
This can be used to configure a keyword list that keeps the configuration data for any kind of frontend. By default, settings for `pleroma_fe` and `masto_fe` are configured. You can find the documentation for `pleroma_fe` configuration into [Pleroma-FE configuration and customization for instance administrators](/frontend/CONFIGURATION/#options).
|
This can be used to configure a keyword list that keeps the configuration data for any kind of frontend. By default, settings for `pleroma_fe` and `masto_fe` are configured. You can find the documentation for `pleroma_fe` configuration into [Pleroma-FE configuration and customization for instance administrators](/frontend/CONFIGURATION/#options).
|
||||||
|
|
||||||
Frontends can access these settings at `/api/pleroma/frontend_configurations`
|
Frontends can access these settings at `/api/v1/pleroma/frontend_configurations`
|
||||||
|
|
||||||
To add your own configuration for PleromaFE, use it like this:
|
To add your own configuration for PleromaFE, use it like this:
|
||||||
|
|
||||||
|
@ -321,9 +321,10 @@ This section describe PWA manifest instance-specific values. Currently this opti
|
||||||
#### Pleroma.Web.MediaProxy.Invalidation.Script
|
#### Pleroma.Web.MediaProxy.Invalidation.Script
|
||||||
|
|
||||||
This strategy allow perform external shell script to purge cache.
|
This strategy allow perform external shell script to purge cache.
|
||||||
Urls of attachments pass to script as arguments.
|
Urls of attachments are passed to the script as arguments.
|
||||||
|
|
||||||
* `script_path`: path to external script.
|
* `script_path`: Path to the external script.
|
||||||
|
* `url_format`: Set to `:htcacheclean` if using Apache's htcacheclean utility.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
@ -549,7 +550,7 @@ the source code is here: [kocaptcha](https://github.com/koto-bank/kocaptcha). Th
|
||||||
* `uploader`: Which one of the [uploaders](#uploaders) to use.
|
* `uploader`: Which one of the [uploaders](#uploaders) to use.
|
||||||
* `filters`: List of [upload filters](#upload-filters) to use.
|
* `filters`: List of [upload filters](#upload-filters) to use.
|
||||||
* `link_name`: When enabled Pleroma will add a `name` parameter to the url of the upload, for example `https://instance.tld/media/corndog.png?name=corndog.png`. This is needed to provide the correct filename in Content-Disposition headers when using filters like `Pleroma.Upload.Filter.Dedupe`
|
* `link_name`: When enabled Pleroma will add a `name` parameter to the url of the upload, for example `https://instance.tld/media/corndog.png?name=corndog.png`. This is needed to provide the correct filename in Content-Disposition headers when using filters like `Pleroma.Upload.Filter.Dedupe`
|
||||||
* `base_url`: The base URL to access a user-uploaded file. Useful when you want to proxy the media files via another host.
|
* `base_url`: The base URL to access a user-uploaded file. Useful when you want to host the media files via another domain or are using a 3rd party S3 provider.
|
||||||
* `proxy_remote`: If you're using a remote uploader, Pleroma will proxy media requests instead of redirecting to it.
|
* `proxy_remote`: If you're using a remote uploader, Pleroma will proxy media requests instead of redirecting to it.
|
||||||
* `proxy_opts`: Proxy options, see `Pleroma.ReverseProxy` documentation.
|
* `proxy_opts`: Proxy options, see `Pleroma.ReverseProxy` documentation.
|
||||||
* `filename_display_max_length`: Set max length of a filename to display. 0 = no limit. Default: 30.
|
* `filename_display_max_length`: Set max length of a filename to display. 0 = no limit. Default: 30.
|
||||||
|
@ -570,10 +571,7 @@ Don't forget to configure [Ex AWS S3](#ex-aws-s3-settings)
|
||||||
|
|
||||||
* `bucket`: S3 bucket name.
|
* `bucket`: S3 bucket name.
|
||||||
* `bucket_namespace`: S3 bucket namespace.
|
* `bucket_namespace`: S3 bucket namespace.
|
||||||
* `public_endpoint`: S3 endpoint that the user finally accesses(ex. "https://s3.dualstack.ap-northeast-1.amazonaws.com")
|
|
||||||
* `truncated_namespace`: If you use S3 compatible service such as Digital Ocean Spaces or CDN, set folder name or "" etc.
|
* `truncated_namespace`: If you use S3 compatible service such as Digital Ocean Spaces or CDN, set folder name or "" etc.
|
||||||
For example, when using CDN to S3 virtual host format, set "".
|
|
||||||
At this time, write CNAME to CDN in public_endpoint.
|
|
||||||
* `streaming_enabled`: Enable streaming uploads, when enabled the file will be sent to the server in chunks as it's being read. This may be unsupported by some providers, try disabling this if you have upload problems.
|
* `streaming_enabled`: Enable streaming uploads, when enabled the file will be sent to the server in chunks as it's being read. This may be unsupported by some providers, try disabling this if you have upload problems.
|
||||||
|
|
||||||
#### Ex AWS S3 settings
|
#### Ex AWS S3 settings
|
||||||
|
@ -850,13 +848,13 @@ config :pleroma, :admin_token, "somerandomtoken"
|
||||||
You can then do
|
You can then do
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl "http://localhost:4000/api/pleroma/admin/users/invites?admin_token=somerandomtoken"
|
curl "http://localhost:4000/api/v1/pleroma/admin/users/invites?admin_token=somerandomtoken"
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
curl -H "X-Admin-Token: somerandomtoken" "http://localhost:4000/api/pleroma/admin/users/invites"
|
curl -H "X-Admin-Token: somerandomtoken" "http://localhost:4000/api/v1/pleroma/admin/users/invites"
|
||||||
```
|
```
|
||||||
|
|
||||||
Warning: it's discouraged to use this feature because of the associated security risk: static / rarely changed instance-wide token is much weaker compared to email-password pair of a real admin user; consider using HTTP Basic Auth or OAuth-based authentication instead.
|
Warning: it's discouraged to use this feature because of the associated security risk: static / rarely changed instance-wide token is much weaker compared to email-password pair of a real admin user; consider using HTTP Basic Auth or OAuth-based authentication instead.
|
||||||
|
@ -895,6 +893,22 @@ Pleroma account will be created with the same name as the LDAP user name.
|
||||||
Note, if your LDAP server is an Active Directory server the correct value is commonly `uid: "cn"`, but if you use an
|
Note, if your LDAP server is an Active Directory server the correct value is commonly `uid: "cn"`, but if you use an
|
||||||
OpenLDAP server the value may be `uid: "uid"`.
|
OpenLDAP server the value may be `uid: "uid"`.
|
||||||
|
|
||||||
|
### :oauth2 (Pleroma as OAuth 2.0 provider settings)
|
||||||
|
|
||||||
|
OAuth 2.0 provider settings:
|
||||||
|
|
||||||
|
* `token_expires_in` - The lifetime in seconds of the access token.
|
||||||
|
* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token.
|
||||||
|
* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`.
|
||||||
|
|
||||||
|
OAuth 2.0 provider and related endpoints:
|
||||||
|
|
||||||
|
* `POST /api/v1/apps` creates client app basing on provided params.
|
||||||
|
* `GET/POST /oauth/authorize` renders/submits authorization form.
|
||||||
|
* `POST /oauth/token` creates/renews OAuth token.
|
||||||
|
* `POST /oauth/revoke` revokes provided OAuth token.
|
||||||
|
* `GET /api/v1/accounts/verify_credentials` (with proper `Authorization` header or `access_token` URI param) returns user info on requester (with `acct` field containing local nickname and `fqn` field containing fully-qualified nickname which could generally be used as email stub for OAuth software that demands email field in identity endpoint response, like Peertube).
|
||||||
|
|
||||||
### OAuth consumer mode
|
### OAuth consumer mode
|
||||||
|
|
||||||
OAuth consumer mode allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.).
|
OAuth consumer mode allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.).
|
||||||
|
@ -967,14 +981,6 @@ config :ueberauth, Ueberauth,
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
### OAuth 2.0 provider - :oauth2
|
|
||||||
|
|
||||||
Configure OAuth 2 provider capabilities:
|
|
||||||
|
|
||||||
* `token_expires_in` - The lifetime in seconds of the access token.
|
|
||||||
* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token.
|
|
||||||
* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`.
|
|
||||||
|
|
||||||
## Link parsing
|
## Link parsing
|
||||||
|
|
||||||
### :uri_schemes
|
### :uri_schemes
|
||||||
|
@ -1067,6 +1073,20 @@ Control favicons for instances.
|
||||||
|
|
||||||
* `enabled`: Allow/disallow displaying and getting instances favicons
|
* `enabled`: Allow/disallow displaying and getting instances favicons
|
||||||
|
|
||||||
|
## Pleroma.User.Backup
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
Requires enabled email
|
||||||
|
|
||||||
|
* `:purge_after_days` an integer, remove backup achives after N days.
|
||||||
|
* `:limit_days` an integer, limit user to export not more often than once per N days.
|
||||||
|
* `:dir` a string with a path to backup temporary directory or `nil` to let Pleroma choose temporary directory in the following order:
|
||||||
|
1. the directory named by the TMPDIR environment variable
|
||||||
|
2. the directory named by the TEMP environment variable
|
||||||
|
3. the directory named by the TMP environment variable
|
||||||
|
4. C:\TMP on Windows or /tmp on Unix-like operating systems
|
||||||
|
5. as a last resort, the current working directory
|
||||||
|
|
||||||
## Frontend management
|
## Frontend management
|
||||||
|
|
||||||
Frontends in Pleroma are swappable - you can specify which one to use here.
|
Frontends in Pleroma are swappable - you can specify which one to use here.
|
||||||
|
@ -1099,3 +1119,15 @@ Settings to enable and configure expiration for ephemeral activities
|
||||||
|
|
||||||
* `:enabled` - enables ephemeral activities creation
|
* `:enabled` - enables ephemeral activities creation
|
||||||
* `:min_lifetime` - minimum lifetime for ephemeral activities (in seconds). Default: 10 minutes.
|
* `:min_lifetime` - minimum lifetime for ephemeral activities (in seconds). Default: 10 minutes.
|
||||||
|
|
||||||
|
## ConcurrentLimiter
|
||||||
|
|
||||||
|
Settings to restrict concurrently running jobs. Jobs which can be configured:
|
||||||
|
|
||||||
|
* `Pleroma.Web.RichMedia.Helpers` - generating link previews of URLs in activities
|
||||||
|
* `Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy` - warming remote media cache via MediaProxyWarmingPolicy
|
||||||
|
|
||||||
|
Each job has these settings:
|
||||||
|
|
||||||
|
* `:max_running` - max concurrently runnings jobs
|
||||||
|
* `:max_waiting` - max waiting jobs
|
||||||
|
|
|
@ -5,7 +5,7 @@ The configuration of Pleroma has traditionally been managed with a config file,
|
||||||
|
|
||||||
## Migration to database config
|
## Migration to database config
|
||||||
|
|
||||||
1. Run the mix task to migrate to the database. You'll receive some debugging output and a few messages informing you of what happened.
|
1. Run the mix task to migrate to the database.
|
||||||
|
|
||||||
**Source:**
|
**Source:**
|
||||||
|
|
||||||
|
@ -24,21 +24,8 @@ The configuration of Pleroma has traditionally been managed with a config file,
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
10:04:34.155 [debug] QUERY OK source="config" db=1.6ms decode=2.0ms queue=33.5ms idle=0.0ms
|
|
||||||
SELECT c0."id", c0."key", c0."group", c0."value", c0."inserted_at", c0."updated_at" FROM "config" AS c0 []
|
|
||||||
Migrating settings from file: /home/pleroma/config/dev.secret.exs
|
Migrating settings from file: /home/pleroma/config/dev.secret.exs
|
||||||
|
|
||||||
10:04:34.240 [debug] QUERY OK db=4.5ms queue=0.3ms idle=92.2ms
|
|
||||||
TRUNCATE config; []
|
|
||||||
|
|
||||||
10:04:34.244 [debug] QUERY OK db=2.8ms queue=0.3ms idle=97.2ms
|
|
||||||
ALTER SEQUENCE config_id_seq RESTART; []
|
|
||||||
|
|
||||||
10:04:34.256 [debug] QUERY OK source="config" db=0.8ms queue=1.4ms idle=109.8ms
|
|
||||||
SELECT c0."id", c0."key", c0."group", c0."value", c0."inserted_at", c0."updated_at" FROM "config" AS c0 WHERE ((c0."group" = $1) AND (c0."key" = $2)) [":pleroma", ":instance"]
|
|
||||||
|
|
||||||
10:04:34.292 [debug] QUERY OK db=2.6ms queue=1.7ms idle=137.7ms
|
|
||||||
INSERT INTO "config" ("group","key","value","inserted_at","updated_at") VALUES ($1,$2,$3,$4,$5) RETURNING "id" [":pleroma", ":instance", <<131, 108, 0, 0, 0, 1, 104, 2, 100, 0, 4, 110, 97, 109, 101, 109, 0, 0, 0, 7, 66, 108, 101, 114, 111, 109, 97, 106>>, ~N[2020-07-12 15:04:34], ~N[2020-07-12 15:04:34]]
|
|
||||||
Settings for key instance migrated.
|
Settings for key instance migrated.
|
||||||
Settings for group :pleroma migrated.
|
Settings for group :pleroma migrated.
|
||||||
```
|
```
|
||||||
|
@ -124,12 +111,20 @@ The configuration of Pleroma has traditionally been managed with a config file,
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
### Clearing database config
|
### Clearing database config
|
||||||
You can clear the database config by truncating the `config` table in the database. e.g.,
|
You can clear the database config with the following command:
|
||||||
|
|
||||||
|
**Source:**
|
||||||
|
|
||||||
```
|
```
|
||||||
psql -d pleroma_dev
|
$ mix pleroma.config reset
|
||||||
pleroma_dev=# TRUNCATE config;
|
```
|
||||||
TRUNCATE TABLE
|
|
||||||
|
or
|
||||||
|
|
||||||
|
**OTP:**
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./bin/pleroma_ctl config reset
|
||||||
```
|
```
|
||||||
|
|
||||||
Additionally, every time you migrate the configuration to the database the config table is automatically truncated to ensure a clean migration.
|
Additionally, every time you migrate the configuration to the database the config table is automatically truncated to ensure a clean migration.
|
||||||
|
@ -137,17 +132,24 @@ Additionally, every time you migrate the configuration to the database the confi
|
||||||
### Manually removing a setting
|
### Manually removing a setting
|
||||||
If you encounter a situation where the server cannot run properly because of an invalid setting in the database and this is preventing you from accessing AdminFE, you can manually remove the offending setting if you know which one it is.
|
If you encounter a situation where the server cannot run properly because of an invalid setting in the database and this is preventing you from accessing AdminFE, you can manually remove the offending setting if you know which one it is.
|
||||||
|
|
||||||
e.g., here is an example showing a minimal configuration in the database. Only the `config :pleroma, :instance` settings are in the table:
|
e.g., here is an example showing a the removal of the `config :pleroma, :instance` settings:
|
||||||
|
|
||||||
|
**Source:**
|
||||||
|
|
||||||
```
|
```
|
||||||
psql -d pleroma_dev
|
$ mix pleroma.config delete pleroma instance
|
||||||
pleroma_dev=# select * from config;
|
Are you sure you want to continue? [n] y
|
||||||
id | key | value | inserted_at | updated_at | group
|
config :pleroma, :instance deleted from the ConfigDB.
|
||||||
----+-----------+------------------------------------------------------------+---------------------+---------------------+----------
|
```
|
||||||
1 | :instance | \x836c0000000168026400046e616d656d00000007426c65726f6d616a | 2020-07-12 15:33:29 | 2020-07-12 15:33:29 | :pleroma
|
|
||||||
(1 row)
|
or
|
||||||
pleroma_dev=# delete from config where key = ':instance' and group = ':pleroma';
|
|
||||||
DELETE 1
|
**OTP:**
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./bin/pleroma_ctl config delete pleroma instance
|
||||||
|
Are you sure you want to continue? [n] y
|
||||||
|
config :pleroma, :instance deleted from the ConfigDB.
|
||||||
```
|
```
|
||||||
|
|
||||||
Now the `config :pleroma, :instance` settings have been removed from the database.
|
Now the `config :pleroma, :instance` settings have been removed from the database.
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
# Configuring Ejabberd (XMPP Server) to use Pleroma for authentication
|
||||||
|
|
||||||
|
If you want to give your Pleroma users an XMPP (chat) account, you can configure [Ejabberd](https://github.com/processone/ejabberd) to use your Pleroma server for user authentication, automatically giving every local user an XMPP account.
|
||||||
|
|
||||||
|
In general, you just have to follow the configuration described at [https://docs.ejabberd.im/admin/configuration/authentication/#external-script](https://docs.ejabberd.im/admin/configuration/authentication/#external-script). Please read this section carefully.
|
||||||
|
|
||||||
|
Copy the script below to suitable path on your system and set owner and permissions. Also do not forget adjusting `PLEROMA_HOST` and `PLEROMA_PORT`, if necessary.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp pleroma_ejabberd_auth.py /etc/ejabberd/pleroma_ejabberd_auth.py
|
||||||
|
chown ejabberd /etc/ejabberd/pleroma_ejabberd_auth.py
|
||||||
|
chmod 700 /etc/ejabberd/pleroma_ejabberd_auth.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Set external auth params in ejabberd.yaml file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
auth_method: [external]
|
||||||
|
extauth_program: "python3 /etc/ejabberd/pleroma_ejabberd_auth.py"
|
||||||
|
extauth_instances: 3
|
||||||
|
auth_use_cache: false
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart / reload your ejabberd service.
|
||||||
|
|
||||||
|
After restarting your Ejabberd server, your users should now be able to connect with their Pleroma credentials.
|
||||||
|
|
||||||
|
|
||||||
|
```python
|
||||||
|
import sys
|
||||||
|
import struct
|
||||||
|
import http.client
|
||||||
|
from base64 import b64encode
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
PLEROMA_HOST = "127.0.0.1"
|
||||||
|
PLEROMA_PORT = "4000"
|
||||||
|
AUTH_ENDPOINT = "/api/v1/accounts/verify_credentials"
|
||||||
|
USER_ENDPOINT = "/api/v1/accounts"
|
||||||
|
LOGFILE = "/var/log/ejabberd/pleroma_auth.log"
|
||||||
|
|
||||||
|
logging.basicConfig(filename=LOGFILE, level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
# Pleroma functions
|
||||||
|
def create_connection():
|
||||||
|
return http.client.HTTPConnection(PLEROMA_HOST, PLEROMA_PORT)
|
||||||
|
|
||||||
|
|
||||||
|
def verify_credentials(user: str, password: str) -> bool:
|
||||||
|
user_pass_b64 = b64encode("{}:{}".format(
|
||||||
|
user, password).encode('utf-8')).decode("ascii")
|
||||||
|
params = {}
|
||||||
|
headers = {
|
||||||
|
"Authorization": "Basic {}".format(user_pass_b64)
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
conn = create_connection()
|
||||||
|
conn.request("GET", AUTH_ENDPOINT, params, headers)
|
||||||
|
|
||||||
|
response = conn.getresponse()
|
||||||
|
if response.status == 200:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("Can not connect: %s", str(e))
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def does_user_exist(user: str) -> bool:
|
||||||
|
conn = create_connection()
|
||||||
|
conn.request("GET", "{}/{}".format(USER_ENDPOINT, user))
|
||||||
|
|
||||||
|
response = conn.getresponse()
|
||||||
|
if response.status == 200:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def auth(username: str, server: str, password: str) -> bool:
|
||||||
|
return verify_credentials(username, password)
|
||||||
|
|
||||||
|
|
||||||
|
def isuser(username, server):
|
||||||
|
return does_user_exist(username)
|
||||||
|
|
||||||
|
|
||||||
|
def read():
|
||||||
|
(pkt_size,) = struct.unpack('>H', bytes(sys.stdin.read(2), encoding='utf8'))
|
||||||
|
pkt = sys.stdin.read(pkt_size)
|
||||||
|
cmd = pkt.split(':')[0]
|
||||||
|
if cmd == 'auth':
|
||||||
|
username, server, password = pkt.split(':', 3)[1:]
|
||||||
|
write(auth(username, server, password))
|
||||||
|
elif cmd == 'isuser':
|
||||||
|
username, server = pkt.split(':', 2)[1:]
|
||||||
|
write(isuser(username, server))
|
||||||
|
elif cmd == 'setpass':
|
||||||
|
# u, s, p = pkt.split(':', 3)[1:]
|
||||||
|
write(False)
|
||||||
|
elif cmd == 'tryregister':
|
||||||
|
# u, s, p = pkt.split(':', 3)[1:]
|
||||||
|
write(False)
|
||||||
|
elif cmd == 'removeuser':
|
||||||
|
# u, s = pkt.split(':', 2)[1:]
|
||||||
|
write(False)
|
||||||
|
elif cmd == 'removeuser3':
|
||||||
|
# u, s, p = pkt.split(':', 3)[1:]
|
||||||
|
write(False)
|
||||||
|
else:
|
||||||
|
write(False)
|
||||||
|
|
||||||
|
|
||||||
|
def write(result):
|
||||||
|
if result:
|
||||||
|
sys.stdout.write('\x00\x02\x00\x01')
|
||||||
|
else:
|
||||||
|
sys.stdout.write('\x00\x02\x00\x00')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
logging.info("Starting pleroma ejabberd auth daemon...")
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
read()
|
||||||
|
except Exception as e:
|
||||||
|
logging.info(
|
||||||
|
"Error while processing data from ejabberd %s", str(e))
|
||||||
|
pass
|
||||||
|
|
||||||
|
```
|
|
@ -0,0 +1,42 @@
|
||||||
|
# How to enable text search for Chinese, Japanese and Korean
|
||||||
|
|
||||||
|
Pleroma's full text search feature is powered by PostgreSQL's native [text search](https://www.postgresql.org/docs/current/textsearch.html), it works well out of box for most of languages, but needs extra configurations for some asian languages like Chinese, Japanese and Korean (CJK).
|
||||||
|
|
||||||
|
|
||||||
|
## Setup and test the new search config
|
||||||
|
|
||||||
|
In most cases, you would need an extension installed to support parsing CJK text. Here are a few extension you may choose from, or you are more than welcome to share additional ones you found working for you with the rest of Pleroma community.
|
||||||
|
|
||||||
|
* [a generic n-gram parser](https://github.com/huangjimmy/pg_cjk_parser) supports Simplifed/Traditional Chinese, Japanese, and Korean
|
||||||
|
* [a Korean parser](https://github.com/i0seph/textsearch_ko) based on mecab
|
||||||
|
* [a Japanese parser](https://www.amris.co.jp/tsja/index.html) based on mecab
|
||||||
|
* [zhparser](https://github.com/amutu/zhparser/) is a PostgreSQL extension base on the Simple Chinese Word Segmentation(SCWS)
|
||||||
|
* [another Chinese parser](https://github.com/jaiminpan/pg_jieba) based on Jieba Chinese Word Segmentation
|
||||||
|
|
||||||
|
Once you have the new search config , make sure you test it with the `pleroma` user in PostgreSQL (change `YOUR.CONFIG` to your real configuration name)
|
||||||
|
```
|
||||||
|
SELECT ts_debug('YOUR.CONFIG', '安装和配置Nginx, ElixirとErlangをインストールします');
|
||||||
|
```
|
||||||
|
Check output of the query, and see if it matches your expectation.
|
||||||
|
|
||||||
|
|
||||||
|
## Update text search config and index in database
|
||||||
|
|
||||||
|
=== "OTP"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./bin/pleroma_ctl database set_text_search_config YOUR.CONFIG
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "From Source"
|
||||||
|
|
||||||
|
```sh
|
||||||
|
mix pleroma.database set_text_search_config YOUR.CONFIG
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: index update may take a while.
|
||||||
|
|
||||||
|
## Restart database connection
|
||||||
|
Since some changes above will only apply with a new database connection, you will have to restart either Pleroma or PostgreSQL process, or use `pg_terminate_backend` SQL command without restarting either.
|
||||||
|
|
||||||
|
Now the search results of statuses should be much more friendly for your language of choice, the results for searching users and tags were not changed, as the default parsing/matching should work for most cases.
|
|
@ -133,3 +133,26 @@ config :pleroma, :mrf,
|
||||||
```
|
```
|
||||||
|
|
||||||
Please note that the Pleroma developers consider custom MRF policy modules to fall under the purview of the AGPL. As such, you are obligated to release the sources to your custom MRF policy modules upon request.
|
Please note that the Pleroma developers consider custom MRF policy modules to fall under the purview of the AGPL. As such, you are obligated to release the sources to your custom MRF policy modules upon request.
|
||||||
|
|
||||||
|
### MRF policies descriptions
|
||||||
|
|
||||||
|
If MRF policy depends on config, it can be added into MRF tab to adminFE by adding `config_description/0` method, which returns a map with a specific structure. See existing MRF's like `lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex` for examples. Note that more complex inputs, like tuples or maps, may need extra changes in the adminFE and just adding it to `config_description/0` may not be enough to get these inputs working from the adminFE.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```elixir
|
||||||
|
%{
|
||||||
|
key: :mrf_activity_expiration,
|
||||||
|
related_policy: "Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy",
|
||||||
|
label: "MRF Activity Expiration Policy",
|
||||||
|
description: "Adds automatic expiration to all local activities",
|
||||||
|
children: [
|
||||||
|
%{
|
||||||
|
key: :days,
|
||||||
|
type: :integer,
|
||||||
|
description: "Default global expiration time for all local activities (in days)",
|
||||||
|
suggestions: [90, 365]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
# Optimizing the BEAM
|
||||||
|
|
||||||
|
Pleroma is built upon the Erlang/OTP VM known as BEAM. The BEAM VM is highly optimized for latency, but this has drawbacks in environments without dedicated hardware. One of the tricks used by the BEAM VM is [busy waiting](https://en.wikipedia.org/wiki/Busy_waiting). This allows the application to pretend to be busy working so the OS kernel does not pause the application process and switch to another process waiting for the CPU to execute its workload. It does this by spinning for a period of time which inflates the apparent CPU usage of the application so it is immediately ready to execute another task. This can be observed with utilities like **top(1)** which will show consistently high CPU usage for the process. Switching between procesess is a rather expensive operation and also clears CPU caches further affecting latency and performance. The goal of busy waiting is to avoid this penalty.
|
||||||
|
|
||||||
|
This strategy is very successful in making a performant and responsive application, but is not desirable on Virtual Machines or hardware with few CPU cores. Pleroma instances are often deployed on the same server as the required PostgreSQL database which can lead to situations where the Pleroma application is holding the CPU in a busy-wait loop and as a result the database cannot process requests in a timely manner. The fewer CPUs available, the more this problem is exacerbated. The latency is further amplified by the OS being installed on a Virtual Machine as the Hypervisor uses CPU time-slicing to pause the entire OS and switch between other tasks.
|
||||||
|
|
||||||
|
More adventurous admins can be creative with CPU affinity (e.g., *taskset* for Linux and *cpuset* on FreeBSD) to pin processes to specific CPUs and eliminate much of this contention. The most important advice is to run as few processes as possible on your server to achieve the best performance. Even idle background processes can occasionally create [software interrupts](https://en.wikipedia.org/wiki/Interrupt) and take attention away from the executing process creating latency spikes and invalidation of the CPU caches as they must be cleared when switching between processes for security.
|
||||||
|
|
||||||
|
Please only change these settings if you are experiencing issues or really know what you are doing. In general, there's no need to change these settings.
|
||||||
|
|
||||||
|
## VPS Provider Recommendations
|
||||||
|
|
||||||
|
### Good
|
||||||
|
|
||||||
|
* Hetzner Cloud
|
||||||
|
|
||||||
|
### Bad
|
||||||
|
|
||||||
|
* AWS (known to use burst scheduling)
|
||||||
|
|
||||||
|
|
||||||
|
## Example configurations
|
||||||
|
|
||||||
|
Tuning the BEAM requires you provide a config file normally called [vm.args](http://erlang.org/doc/man/erl.html#emulator-flags). If you are using systemd to manage the service you can modify the unit file as such:
|
||||||
|
|
||||||
|
`ExecStart=/usr/bin/elixir --erl '-args_file /opt/pleroma/config/vm.args' -S /usr/bin/mix phx.server`
|
||||||
|
|
||||||
|
Check your OS documentation to adopt a similar strategy on other platforms.
|
||||||
|
|
||||||
|
### Virtual Machine and/or few CPU cores
|
||||||
|
|
||||||
|
Disable the busy-waiting. This should generally only be done if you're on a platform that does burst scheduling, like AWS.
|
||||||
|
|
||||||
|
**vm.args:**
|
||||||
|
|
||||||
|
```
|
||||||
|
+sbwt none
|
||||||
|
+sbwtdcpu none
|
||||||
|
+sbwtdio none
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dedicated Hardware
|
||||||
|
|
||||||
|
Enable more busy waiting, increase the internal maximum limit of BEAM processes and ports. You can use this if you run on dedicated hardware, but it is not necessary.
|
||||||
|
|
||||||
|
**vm.args:**
|
||||||
|
|
||||||
|
```
|
||||||
|
+P 16777216
|
||||||
|
+Q 16777216
|
||||||
|
+K true
|
||||||
|
+A 128
|
||||||
|
+sbt db
|
||||||
|
+sbwt very_long
|
||||||
|
+swt very_low
|
||||||
|
+sub true
|
||||||
|
+Mulmbcs 32767
|
||||||
|
+Mumbcgs 1
|
||||||
|
+Musmbcs 2047
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Reading
|
||||||
|
|
||||||
|
* [WhatsApp: Scaling to Millions of Simultaneous Connections](https://www.erlang-factory.com/upload/presentations/558/efsf2012-whatsapp-scaling.pdf)
|
||||||
|
* [Preemptive Scheduling and Spinlocks](https://www.uio.no/studier/emner/matnat/ifi/nedlagte-emner/INF3150/h03/annet/slides/preemptive.pdf)
|
||||||
|
* [The Curious Case of BEAM CPU Usage](https://stressgrid.com/blog/beam_cpu_usage/)
|
|
@ -1,10 +1,28 @@
|
||||||
# Optimizing your PostgreSQL performance
|
# Optimizing PostgreSQL performance
|
||||||
|
|
||||||
Pleroma performance depends to a large extent on good database performance. The default PostgreSQL settings are mostly fine, but often you can get better performance by changing a few settings.
|
Pleroma performance is largely dependent on performance of the underlying database. Better performance can be achieved by adjusting a few settings.
|
||||||
|
|
||||||
You can use [PGTune](https://pgtune.leopard.in.ua) to get recommendations for your setup. If you do, set the "Number of Connections" field to 20, as Pleroma will only use 10 concurrent connections anyway. If you don't, it will give you advice that might even hurt your performance.
|
## PGTune
|
||||||
|
|
||||||
We also recommend not using the "Network Storage" option.
|
[PgTune](https://pgtune.leopard.in.ua) can be used to get recommended settings. Be sure to set "Number of Connections" to 20, otherwise it might produce settings hurtful to database performance. It is also recommended to not use "Network Storage" option.
|
||||||
|
|
||||||
|
## Disable generic query plans
|
||||||
|
|
||||||
|
When PostgreSQL receives a query, it decides on a strategy for searching the requested data, this is called a query plan. The query planner has two modes: generic and custom. Generic makes a plan for all queries of the same shape, ignoring the parameters, which is then cached and reused. Custom, on the contrary, generates a unique query plan based on query parameters.
|
||||||
|
|
||||||
|
By default PostgreSQL has an algorithm to decide which mode is more efficient for particular query, however this algorithm has been observed to be wrong on some of the queries Pleroma sends, leading to serious performance loss. Therefore, it is recommended to disable generic mode.
|
||||||
|
|
||||||
|
|
||||||
|
Pleroma already avoids generic query plans by default, however the method it uses is not the most efficient because it needs to be compatible with all supported PostgreSQL versions. For PostgreSQL 12 and higher additional performance can be gained by adding the following to Pleroma configuration:
|
||||||
|
```elixir
|
||||||
|
config :pleroma, Pleroma.Repo,
|
||||||
|
prepare: :named,
|
||||||
|
parameters: [
|
||||||
|
plan_cache_mode: "force_custom_plan"
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
A more detailed explaination of the issue can be found at <https://blog.soykaf.com/post/postgresql-elixir-troubles/>.
|
||||||
|
|
||||||
## Example configurations
|
## Example configurations
|
||||||
|
|
||||||
|
@ -28,4 +46,3 @@ max_worker_processes = 2
|
||||||
max_parallel_workers_per_gather = 1
|
max_parallel_workers_per_gather = 1
|
||||||
max_parallel_workers = 2
|
max_parallel_workers = 2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -88,3 +88,8 @@ config :pleroma, :frontend_configurations,
|
||||||
Note the extra `static` folder for the terms-of-service.html
|
Note the extra `static` folder for the terms-of-service.html
|
||||||
|
|
||||||
Terms of Service will be shown to all users on the registration page. It's the best place where to write down the rules for your instance. You can modify the rules by adding and changing `$static_dir/static/terms-of-service.html`.
|
Terms of Service will be shown to all users on the registration page. It's the best place where to write down the rules for your instance. You can modify the rules by adding and changing `$static_dir/static/terms-of-service.html`.
|
||||||
|
|
||||||
|
|
||||||
|
## Styling rendered pages
|
||||||
|
|
||||||
|
To overwrite the CSS stylesheet of the OAuth form and other static pages, you can upload your own CSS file to `instance/static/static.css`. This will completely replace the CSS used by those pages, so it might be a good idea to copy the one from `priv/static/instance/static.css` and make your changes.
|
||||||
|
|
|
@ -2,14 +2,9 @@
|
||||||
|
|
||||||
Authentication is required and the user must be an admin.
|
Authentication is required and the user must be an admin.
|
||||||
|
|
||||||
Configuration options:
|
The `/api/v1/pleroma/admin/*` path is backwards compatible with `/api/pleroma/admin/*` (`/api/pleroma/admin/*` will be deprecated in the future).
|
||||||
|
|
||||||
* `[:auth, :enforce_oauth_admin_scope_usage]` — OAuth admin scope requirement toggle.
|
## `GET /api/v1/pleroma/admin/users`
|
||||||
If `true`, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token (client app must support admin scopes).
|
|
||||||
If `false` and token doesn't have admin scope(s), `is_admin` user flag grants access to admin-specific actions.
|
|
||||||
Note that client app needs to explicitly support admin scopes and request them when obtaining auth token.
|
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users`
|
|
||||||
|
|
||||||
### List users
|
### List users
|
||||||
|
|
||||||
|
@ -20,15 +15,17 @@ Configuration options:
|
||||||
- `external`: only external users
|
- `external`: only external users
|
||||||
- `active`: only active users
|
- `active`: only active users
|
||||||
- `need_approval`: only unapproved users
|
- `need_approval`: only unapproved users
|
||||||
|
- `unconfirmed`: only unconfirmed users
|
||||||
- `deactivated`: only deactivated users
|
- `deactivated`: only deactivated users
|
||||||
- `is_admin`: users with admin role
|
- `is_admin`: users with admin role
|
||||||
- `is_moderator`: users with moderator role
|
- `is_moderator`: users with moderator role
|
||||||
- *optional* `page`: **integer** page number
|
- *optional* `page`: **integer** page number
|
||||||
- *optional* `page_size`: **integer** number of users per page (default is `50`)
|
- *optional* `page_size`: **integer** number of users per page (default is `50`)
|
||||||
- *optional* `tags`: **[string]** tags list
|
- *optional* `tags`: **[string]** tags list
|
||||||
|
- *optional* `actor_types`: **[string]** actor type list (`Person`, `Service`, `Application`)
|
||||||
- *optional* `name`: **string** user display name
|
- *optional* `name`: **string** user display name
|
||||||
- *optional* `email`: **string** user email
|
- *optional* `email`: **string** user email
|
||||||
- Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com`
|
- Example: `https://mypleroma.org/api/v1/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com`
|
||||||
- Response:
|
- Response:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
@ -57,7 +54,7 @@ Configuration options:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## DEPRECATED `DELETE /api/pleroma/admin/users`
|
## DEPRECATED `DELETE /api/v1/pleroma/admin/users`
|
||||||
|
|
||||||
### Remove a user
|
### Remove a user
|
||||||
|
|
||||||
|
@ -65,7 +62,7 @@ Configuration options:
|
||||||
- `nickname`
|
- `nickname`
|
||||||
- Response: User’s nickname
|
- Response: User’s nickname
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/users`
|
## `DELETE /api/v1/pleroma/admin/users`
|
||||||
|
|
||||||
### Remove a user
|
### Remove a user
|
||||||
|
|
||||||
|
@ -86,7 +83,7 @@ Configuration options:
|
||||||
]
|
]
|
||||||
- Response: User’s nickname
|
- Response: User’s nickname
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/users/follow`
|
## `POST /api/v1/pleroma/admin/users/follow`
|
||||||
|
|
||||||
### Make a user follow another user
|
### Make a user follow another user
|
||||||
|
|
||||||
|
@ -96,7 +93,7 @@ Configuration options:
|
||||||
- Response:
|
- Response:
|
||||||
- "ok"
|
- "ok"
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/users/unfollow`
|
## `POST /api/v1/pleroma/admin/users/unfollow`
|
||||||
|
|
||||||
### Make a user unfollow another user
|
### Make a user unfollow another user
|
||||||
|
|
||||||
|
@ -106,7 +103,7 @@ Configuration options:
|
||||||
- Response:
|
- Response:
|
||||||
- "ok"
|
- "ok"
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/:nickname/toggle_activation`
|
## `PATCH /api/v1/pleroma/admin/users/:nickname/toggle_activation`
|
||||||
|
|
||||||
### Toggle user activation
|
### Toggle user activation
|
||||||
|
|
||||||
|
@ -122,7 +119,7 @@ Configuration options:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `PUT /api/pleroma/admin/users/tag`
|
## `PUT /api/v1/pleroma/admin/users/tag`
|
||||||
|
|
||||||
### Tag a list of users
|
### Tag a list of users
|
||||||
|
|
||||||
|
@ -130,7 +127,7 @@ Configuration options:
|
||||||
- `nicknames` (array)
|
- `nicknames` (array)
|
||||||
- `tags` (array)
|
- `tags` (array)
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/users/tag`
|
## `DELETE /api/v1/pleroma/admin/users/tag`
|
||||||
|
|
||||||
### Untag a list of users
|
### Untag a list of users
|
||||||
|
|
||||||
|
@ -138,7 +135,7 @@ Configuration options:
|
||||||
- `nicknames` (array)
|
- `nicknames` (array)
|
||||||
- `tags` (array)
|
- `tags` (array)
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users/:nickname/permission_group`
|
## `GET /api/v1/pleroma/admin/users/:nickname/permission_group`
|
||||||
|
|
||||||
### Get user user permission groups membership
|
### Get user user permission groups membership
|
||||||
|
|
||||||
|
@ -152,7 +149,7 @@ Configuration options:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
## `GET /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
||||||
|
|
||||||
Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
|
Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist.
|
||||||
|
|
||||||
|
@ -168,7 +165,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## DEPRECATED `POST /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
## DEPRECATED `POST /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
||||||
|
|
||||||
### Add user to permission group
|
### Add user to permission group
|
||||||
|
|
||||||
|
@ -177,7 +174,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- On failure: `{"error": "…"}`
|
- On failure: `{"error": "…"}`
|
||||||
- On success: JSON of the user
|
- On success: JSON of the user
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/users/permission_group/:permission_group`
|
## `POST /api/v1/pleroma/admin/users/permission_group/:permission_group`
|
||||||
|
|
||||||
### Add users to permission group
|
### Add users to permission group
|
||||||
|
|
||||||
|
@ -187,9 +184,9 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- On failure: `{"error": "…"}`
|
- On failure: `{"error": "…"}`
|
||||||
- On success: JSON of the user
|
- On success: JSON of the user
|
||||||
|
|
||||||
## DEPRECATED `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
## DEPRECATED `DELETE /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
## `DELETE /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group`
|
||||||
|
|
||||||
### Remove user from permission group
|
### Remove user from permission group
|
||||||
|
|
||||||
|
@ -199,7 +196,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- On success: JSON of the user
|
- On success: JSON of the user
|
||||||
- Note: An admin cannot revoke their own admin status.
|
- Note: An admin cannot revoke their own admin status.
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/users/permission_group/:permission_group`
|
## `DELETE /api/v1/pleroma/admin/users/permission_group/:permission_group`
|
||||||
|
|
||||||
### Remove users from permission group
|
### Remove users from permission group
|
||||||
|
|
||||||
|
@ -210,7 +207,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- On success: JSON of the user
|
- On success: JSON of the user
|
||||||
- Note: An admin cannot revoke their own admin status.
|
- Note: An admin cannot revoke their own admin status.
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/activate`
|
## `PATCH /api/v1/pleroma/admin/users/activate`
|
||||||
|
|
||||||
### Activate user
|
### Activate user
|
||||||
|
|
||||||
|
@ -228,7 +225,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/deactivate`
|
## `PATCH /api/v1/pleroma/admin/users/deactivate`
|
||||||
|
|
||||||
### Deactivate user
|
### Deactivate user
|
||||||
|
|
||||||
|
@ -246,7 +243,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/approve`
|
## `PATCH /api/v1/pleroma/admin/users/approve`
|
||||||
|
|
||||||
### Approve user
|
### Approve user
|
||||||
|
|
||||||
|
@ -264,7 +261,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users/:nickname_or_id`
|
## `GET /api/v1/pleroma/admin/users/:nickname_or_id`
|
||||||
|
|
||||||
### Retrive the details of a user
|
### Retrive the details of a user
|
||||||
|
|
||||||
|
@ -274,7 +271,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- On failure: `Not found`
|
- On failure: `Not found`
|
||||||
- On success: JSON of the user
|
- On success: JSON of the user
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users/:nickname_or_id/statuses`
|
## `GET /api/v1/pleroma/admin/users/:nickname_or_id/statuses`
|
||||||
|
|
||||||
### Retrive user's latest statuses
|
### Retrive user's latest statuses
|
||||||
|
|
||||||
|
@ -285,9 +282,20 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
|
- *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
|
||||||
- Response:
|
- Response:
|
||||||
- On failure: `Not found`
|
- On failure: `Not found`
|
||||||
- On success: JSON array of user's latest statuses
|
- On success: JSON, where:
|
||||||
|
- `total`: total count of the statuses for the user
|
||||||
|
- `activities`: list of the statuses for the user
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/instances/:instance/statuses`
|
```json
|
||||||
|
{
|
||||||
|
"total" : 1,
|
||||||
|
"activities": [
|
||||||
|
// activities list
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## `GET /api/v1/pleroma/admin/instances/:instance/statuses`
|
||||||
|
|
||||||
### Retrive instance's latest statuses
|
### Retrive instance's latest statuses
|
||||||
|
|
||||||
|
@ -298,9 +306,20 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
|
- *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
|
||||||
- Response:
|
- Response:
|
||||||
- On failure: `Not found`
|
- On failure: `Not found`
|
||||||
- On success: JSON array of instance's latest statuses
|
- On success: JSON, where:
|
||||||
|
- `total`: total count of the statuses for the instance
|
||||||
|
- `activities`: list of the statuses for the instance
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/statuses`
|
```json
|
||||||
|
{
|
||||||
|
"total" : 1,
|
||||||
|
"activities": [
|
||||||
|
// activities list
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## `GET /api/v1/pleroma/admin/statuses`
|
||||||
|
|
||||||
### Retrives all latest statuses
|
### Retrives all latest statuses
|
||||||
|
|
||||||
|
@ -313,7 +332,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
|
||||||
- On failure: `Not found`
|
- On failure: `Not found`
|
||||||
- On success: JSON array of user's latest statuses
|
- On success: JSON array of user's latest statuses
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/relay`
|
## `GET /api/v1/pleroma/admin/relay`
|
||||||
|
|
||||||
### List Relays
|
### List Relays
|
||||||
|
|
||||||
|
@ -329,7 +348,7 @@ Response:
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/relay`
|
## `POST /api/v1/pleroma/admin/relay`
|
||||||
|
|
||||||
### Follow a Relay
|
### Follow a Relay
|
||||||
|
|
||||||
|
@ -345,7 +364,7 @@ Response:
|
||||||
{"actor": "https://example.com/relay", "followed_back": true}
|
{"actor": "https://example.com/relay", "followed_back": true}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/relay`
|
## `DELETE /api/v1/pleroma/admin/relay`
|
||||||
|
|
||||||
### Unfollow a Relay
|
### Unfollow a Relay
|
||||||
|
|
||||||
|
@ -361,7 +380,7 @@ Response:
|
||||||
{"https://example.com/relay"}
|
{"https://example.com/relay"}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/users/invite_token`
|
## `POST /api/v1/pleroma/admin/users/invite_token`
|
||||||
|
|
||||||
### Create an account registration invite token
|
### Create an account registration invite token
|
||||||
|
|
||||||
|
@ -382,7 +401,7 @@ Response:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users/invites`
|
## `GET /api/v1/pleroma/admin/users/invites`
|
||||||
|
|
||||||
### Get a list of generated invites
|
### Get a list of generated invites
|
||||||
|
|
||||||
|
@ -407,7 +426,7 @@ Response:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/users/revoke_invite`
|
## `POST /api/v1/pleroma/admin/users/revoke_invite`
|
||||||
|
|
||||||
### Revoke invite by token
|
### Revoke invite by token
|
||||||
|
|
||||||
|
@ -428,7 +447,7 @@ Response:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/users/email_invite`
|
## `POST /api/v1/pleroma/admin/users/email_invite`
|
||||||
|
|
||||||
### Sends registration invite via email
|
### Sends registration invite via email
|
||||||
|
|
||||||
|
@ -449,7 +468,7 @@ Response:
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users/:nickname/password_reset`
|
## `GET /api/v1/pleroma/admin/users/:nickname/password_reset`
|
||||||
|
|
||||||
### Get a password reset token for a given nickname
|
### Get a password reset token for a given nickname
|
||||||
|
|
||||||
|
@ -460,11 +479,11 @@ Response:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"token": "base64 reset token",
|
"token": "base64 reset token",
|
||||||
"link": "https://pleroma.social/api/pleroma/password_reset/url-encoded-base64-token"
|
"link": "https://pleroma.social/api/v1/pleroma/password_reset/url-encoded-base64-token"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/force_password_reset`
|
## `PATCH /api/v1/pleroma/admin/users/force_password_reset`
|
||||||
|
|
||||||
### Force passord reset for a user with a given nickname
|
### Force passord reset for a user with a given nickname
|
||||||
|
|
||||||
|
@ -472,7 +491,7 @@ Response:
|
||||||
- `nicknames`
|
- `nicknames`
|
||||||
- Response: none (code `204`)
|
- Response: none (code `204`)
|
||||||
|
|
||||||
## PUT `/api/pleroma/admin/users/disable_mfa`
|
## PUT `/api/v1/pleroma/admin/users/disable_mfa`
|
||||||
|
|
||||||
### Disable mfa for user's account.
|
### Disable mfa for user's account.
|
||||||
|
|
||||||
|
@ -480,7 +499,7 @@ Response:
|
||||||
- `nickname`
|
- `nickname`
|
||||||
- Response: User’s nickname
|
- Response: User’s nickname
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/users/:nickname/credentials`
|
## `GET /api/v1/pleroma/admin/users/:nickname/credentials`
|
||||||
|
|
||||||
### Get the user's email, password, display and settings-related fields
|
### Get the user's email, password, display and settings-related fields
|
||||||
|
|
||||||
|
@ -528,7 +547,7 @@ Response:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/:nickname/credentials`
|
## `PATCH /api/v1/pleroma/admin/users/:nickname/credentials`
|
||||||
|
|
||||||
### Change the user's email, password, display and settings-related fields
|
### Change the user's email, password, display and settings-related fields
|
||||||
|
|
||||||
|
@ -552,7 +571,7 @@ Response:
|
||||||
* `show_role`
|
* `show_role`
|
||||||
* `skip_thread_containment`
|
* `skip_thread_containment`
|
||||||
* `fields`
|
* `fields`
|
||||||
* `discoverable`
|
* `is_discoverable`
|
||||||
* `actor_type`
|
* `actor_type`
|
||||||
|
|
||||||
* Responses:
|
* Responses:
|
||||||
|
@ -579,7 +598,7 @@ Status: 404
|
||||||
{"error": "Not found"}
|
{"error": "Not found"}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/reports`
|
## `GET /api/v1/pleroma/admin/reports`
|
||||||
|
|
||||||
### Get a list of reports
|
### Get a list of reports
|
||||||
|
|
||||||
|
@ -739,17 +758,17 @@ Status: 404
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/grouped_reports`
|
## `GET /api/v1/pleroma/admin/grouped_reports`
|
||||||
|
|
||||||
### Get a list of reports, grouped by status
|
### Get a list of reports, grouped by status
|
||||||
|
|
||||||
- Params: none
|
- Params: none
|
||||||
- On success: JSON, returns a list of reports, where:
|
- On success: JSON, returns a list of reports, where:
|
||||||
- `date`: date of the latest report
|
- `date`: date of the latest report
|
||||||
- `account`: the user who has been reported (see `/api/pleroma/admin/reports` for reference)
|
- `account`: the user who has been reported (see `/api/v1/pleroma/admin/reports` for reference)
|
||||||
- `status`: reported status (see `/api/pleroma/admin/reports` for reference)
|
- `status`: reported status (see `/api/v1/pleroma/admin/reports` for reference)
|
||||||
- `actors`: users who had reported this status (see `/api/pleroma/admin/reports` for reference)
|
- `actors`: users who had reported this status (see `/api/v1/pleroma/admin/reports` for reference)
|
||||||
- `reports`: reports (see `/api/pleroma/admin/reports` for reference)
|
- `reports`: reports (see `/api/v1/pleroma/admin/reports` for reference)
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"reports": [
|
"reports": [
|
||||||
|
@ -763,7 +782,7 @@ Status: 404
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/reports/:id`
|
## `GET /api/v1/pleroma/admin/reports/:id`
|
||||||
|
|
||||||
### Get an individual report
|
### Get an individual report
|
||||||
|
|
||||||
|
@ -775,7 +794,7 @@ Status: 404
|
||||||
- 404 Not Found `"Not found"`
|
- 404 Not Found `"Not found"`
|
||||||
- On success: JSON, Report object (see above)
|
- On success: JSON, Report object (see above)
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/reports`
|
## `PATCH /api/v1/pleroma/admin/reports`
|
||||||
|
|
||||||
### Change the state of one or multiple reports
|
### Change the state of one or multiple reports
|
||||||
|
|
||||||
|
@ -806,7 +825,7 @@ Status: 404
|
||||||
|
|
||||||
- On success: `204`, empty response
|
- On success: `204`, empty response
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/reports/:id/notes`
|
## `POST /api/v1/pleroma/admin/reports/:id/notes`
|
||||||
|
|
||||||
### Create report note
|
### Create report note
|
||||||
|
|
||||||
|
@ -818,7 +837,7 @@ Status: 404
|
||||||
- 400 Bad Request `"Invalid parameters"` when `status` is missing
|
- 400 Bad Request `"Invalid parameters"` when `status` is missing
|
||||||
- On success: `204`, empty response
|
- On success: `204`, empty response
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/reports/:report_id/notes/:id`
|
## `DELETE /api/v1/pleroma/admin/reports/:report_id/notes/:id`
|
||||||
|
|
||||||
### Delete report note
|
### Delete report note
|
||||||
|
|
||||||
|
@ -830,7 +849,7 @@ Status: 404
|
||||||
- 400 Bad Request `"Invalid parameters"` when `status` is missing
|
- 400 Bad Request `"Invalid parameters"` when `status` is missing
|
||||||
- On success: `204`, empty response
|
- On success: `204`, empty response
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/statuses/:id`
|
## `GET /api/v1/pleroma/admin/statuses/:id`
|
||||||
|
|
||||||
### Show status by id
|
### Show status by id
|
||||||
|
|
||||||
|
@ -841,7 +860,7 @@ Status: 404
|
||||||
- 404 Not Found `"Not Found"`
|
- 404 Not Found `"Not Found"`
|
||||||
- On success: JSON, Mastodon Status entity
|
- On success: JSON, Mastodon Status entity
|
||||||
|
|
||||||
## `PUT /api/pleroma/admin/statuses/:id`
|
## `PUT /api/v1/pleroma/admin/statuses/:id`
|
||||||
|
|
||||||
### Change the scope of an individual reported status
|
### Change the scope of an individual reported status
|
||||||
|
|
||||||
|
@ -856,7 +875,7 @@ Status: 404
|
||||||
- 404 Not Found `"Not found"`
|
- 404 Not Found `"Not found"`
|
||||||
- On success: JSON, Mastodon Status entity
|
- On success: JSON, Mastodon Status entity
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/statuses/:id`
|
## `DELETE /api/v1/pleroma/admin/statuses/:id`
|
||||||
|
|
||||||
### Delete an individual reported status
|
### Delete an individual reported status
|
||||||
|
|
||||||
|
@ -868,7 +887,7 @@ Status: 404
|
||||||
- 404 Not Found `"Not found"`
|
- 404 Not Found `"Not found"`
|
||||||
- On success: 200 OK `{}`
|
- On success: 200 OK `{}`
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/restart`
|
## `GET /api/v1/pleroma/admin/restart`
|
||||||
|
|
||||||
### Restarts pleroma application
|
### Restarts pleroma application
|
||||||
|
|
||||||
|
@ -883,7 +902,7 @@ Status: 404
|
||||||
{}
|
{}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/need_reboot`
|
## `GET /api/v1/pleroma/admin/need_reboot`
|
||||||
|
|
||||||
### Returns the flag whether the pleroma should be restarted
|
### Returns the flag whether the pleroma should be restarted
|
||||||
|
|
||||||
|
@ -896,7 +915,7 @@ Status: 404
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/config`
|
## `GET /api/v1/pleroma/admin/config`
|
||||||
|
|
||||||
### Get list of merged default settings with saved in database.
|
### Get list of merged default settings with saved in database.
|
||||||
|
|
||||||
|
@ -923,7 +942,7 @@ Status: 404
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/config`
|
## `POST /api/v1/pleroma/admin/config`
|
||||||
|
|
||||||
### Update config settings
|
### Update config settings
|
||||||
|
|
||||||
|
@ -1072,7 +1091,7 @@ config :quack,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## ` GET /api/pleroma/admin/config/descriptions`
|
## ` GET /api/v1/pleroma/admin/config/descriptions`
|
||||||
|
|
||||||
### Get JSON with config descriptions.
|
### Get JSON with config descriptions.
|
||||||
Loads json generated from `config/descriptions.exs`.
|
Loads json generated from `config/descriptions.exs`.
|
||||||
|
@ -1105,7 +1124,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
}]
|
}]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/moderation_log`
|
## `GET /api/v1/pleroma/admin/moderation_log`
|
||||||
|
|
||||||
### Get moderation log
|
### Get moderation log
|
||||||
|
|
||||||
|
@ -1121,6 +1140,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
"id": 1234,
|
||||||
"data": {
|
"data": {
|
||||||
"actor": {
|
"actor": {
|
||||||
"id": 1,
|
"id": 1,
|
||||||
|
@ -1134,7 +1154,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/reload_emoji`
|
## `POST /api/v1/pleroma/admin/reload_emoji`
|
||||||
|
|
||||||
### Reload the instance's custom emoji
|
### Reload the instance's custom emoji
|
||||||
|
|
||||||
|
@ -1142,7 +1162,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
- Params: None
|
- Params: None
|
||||||
- Response: JSON, "ok" and 200 status
|
- Response: JSON, "ok" and 200 status
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/confirm_email`
|
## `PATCH /api/v1/pleroma/admin/users/confirm_email`
|
||||||
|
|
||||||
### Confirm users' emails
|
### Confirm users' emails
|
||||||
|
|
||||||
|
@ -1150,7 +1170,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
- `nicknames`
|
- `nicknames`
|
||||||
- Response: Array of user nicknames
|
- Response: Array of user nicknames
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/users/resend_confirmation_email`
|
## `PATCH /api/v1/pleroma/admin/users/resend_confirmation_email`
|
||||||
|
|
||||||
### Resend confirmation email
|
### Resend confirmation email
|
||||||
|
|
||||||
|
@ -1158,13 +1178,13 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
- `nicknames`
|
- `nicknames`
|
||||||
- Response: Array of user nicknames
|
- Response: Array of user nicknames
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/stats`
|
## `GET /api/v1/pleroma/admin/stats`
|
||||||
|
|
||||||
### Stats
|
### Stats
|
||||||
|
|
||||||
- Query Params:
|
- Query Params:
|
||||||
- *optional* `instance`: **string** instance hostname (without protocol) to get stats for
|
- *optional* `instance`: **string** instance hostname (without protocol) to get stats for
|
||||||
- Example: `https://mypleroma.org/api/pleroma/admin/stats?instance=lain.com`
|
- Example: `https://mypleroma.org/api/v1/pleroma/admin/stats?instance=lain.com`
|
||||||
|
|
||||||
- Response:
|
- Response:
|
||||||
|
|
||||||
|
@ -1179,7 +1199,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/oauth_app`
|
## `GET /api/v1/pleroma/admin/oauth_app`
|
||||||
|
|
||||||
### List OAuth app
|
### List OAuth app
|
||||||
|
|
||||||
|
@ -1211,7 +1231,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/oauth_app`
|
## `POST /api/v1/pleroma/admin/oauth_app`
|
||||||
|
|
||||||
### Create OAuth App
|
### Create OAuth App
|
||||||
|
|
||||||
|
@ -1244,7 +1264,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/oauth_app/:id`
|
## `PATCH /api/v1/pleroma/admin/oauth_app/:id`
|
||||||
|
|
||||||
### Update OAuth App
|
### Update OAuth App
|
||||||
|
|
||||||
|
@ -1269,7 +1289,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/oauth_app/:id`
|
## `DELETE /api/v1/pleroma/admin/oauth_app/:id`
|
||||||
|
|
||||||
### Delete OAuth App
|
### Delete OAuth App
|
||||||
|
|
||||||
|
@ -1280,7 +1300,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
- On failure:
|
- On failure:
|
||||||
- 400 Bad Request `"Invalid parameters"` when `status` is missing
|
- 400 Bad Request `"Invalid parameters"` when `status` is missing
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/media_proxy_caches`
|
## `GET /api/v1/pleroma/admin/media_proxy_caches`
|
||||||
|
|
||||||
### Get a list of all banned MediaProxy URLs in Cachex
|
### Get a list of all banned MediaProxy URLs in Cachex
|
||||||
|
|
||||||
|
@ -1304,7 +1324,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/media_proxy_caches/delete`
|
## `POST /api/v1/pleroma/admin/media_proxy_caches/delete`
|
||||||
|
|
||||||
### Remove a banned MediaProxy URL from Cachex
|
### Remove a banned MediaProxy URL from Cachex
|
||||||
|
|
||||||
|
@ -1319,7 +1339,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/admin/media_proxy_caches/purge`
|
## `POST /api/v1/pleroma/admin/media_proxy_caches/purge`
|
||||||
|
|
||||||
### Purge a MediaProxy URL
|
### Purge a MediaProxy URL
|
||||||
|
|
||||||
|
@ -1335,7 +1355,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## GET /api/pleroma/admin/users/:nickname/chats
|
## GET /api/v1/pleroma/admin/users/:nickname/chats
|
||||||
|
|
||||||
### List a user's chats
|
### List a user's chats
|
||||||
|
|
||||||
|
@ -1364,7 +1384,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## GET /api/pleroma/admin/chats/:chat_id
|
## GET /api/v1/pleroma/admin/chats/:chat_id
|
||||||
|
|
||||||
### View a single chat
|
### View a single chat
|
||||||
|
|
||||||
|
@ -1391,7 +1411,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## GET /api/pleroma/admin/chats/:chat_id/messages
|
## GET /api/v1/pleroma/admin/chats/:chat_id/messages
|
||||||
|
|
||||||
### List the messages in a chat
|
### List the messages in a chat
|
||||||
|
|
||||||
|
@ -1429,7 +1449,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DELETE /api/pleroma/admin/chats/:chat_id/messages/:message_id
|
## DELETE /api/v1/pleroma/admin/chats/:chat_id/messages/:message_id
|
||||||
|
|
||||||
### Delete a single message
|
### Delete a single message
|
||||||
|
|
||||||
|
@ -1456,7 +1476,7 @@ Loads json generated from `config/descriptions.exs`.
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/admin/instance_document/:document_name`
|
## `GET /api/v1/pleroma/admin/instance_document/:document_name`
|
||||||
|
|
||||||
### Get an instance document
|
### Get an instance document
|
||||||
|
|
||||||
|
@ -1470,7 +1490,7 @@ Returns the content of the document
|
||||||
<h1>Instance panel</h1>
|
<h1>Instance panel</h1>
|
||||||
```
|
```
|
||||||
|
|
||||||
## `PATCH /api/pleroma/admin/instance_document/:document_name`
|
## `PATCH /api/v1/pleroma/admin/instance_document/:document_name`
|
||||||
- Params:
|
- Params:
|
||||||
- `file` (the file to be uploaded, using multipart form data.)
|
- `file` (the file to be uploaded, using multipart form data.)
|
||||||
|
|
||||||
|
@ -1486,7 +1506,7 @@ Returns the content of the document
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `DELETE /api/pleroma/admin/instance_document/:document_name`
|
## `DELETE /api/v1/pleroma/admin/instance_document/:document_name`
|
||||||
|
|
||||||
### Delete an instance document
|
### Delete an instance document
|
||||||
|
|
||||||
|
@ -1497,3 +1517,66 @@ Returns the content of the document
|
||||||
"url": "https://example.com/instance/panel.html"
|
"url": "https://example.com/instance/panel.html"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `GET /api/v1/pleroma/admin/frontends
|
||||||
|
|
||||||
|
### List available frontends
|
||||||
|
|
||||||
|
- Response:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
|
||||||
|
"git": "https://git.pleroma.social/pleroma/fedi-fe",
|
||||||
|
"installed": true,
|
||||||
|
"name": "fedi-fe",
|
||||||
|
"ref": "master"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build",
|
||||||
|
"git": "https://git.pleroma.social/lambadalambda/kenoma",
|
||||||
|
"installed": false,
|
||||||
|
"name": "kenoma",
|
||||||
|
"ref": "master"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## `POST /api/v1/pleroma/admin/frontends/install`
|
||||||
|
|
||||||
|
### Install a frontend
|
||||||
|
|
||||||
|
- Params:
|
||||||
|
- `name`: frontend name, required
|
||||||
|
- `ref`: frontend ref
|
||||||
|
- `file`: path to a frontend zip file
|
||||||
|
- `build_url`: build URL
|
||||||
|
- `build_dir`: build directory
|
||||||
|
|
||||||
|
- Response:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build",
|
||||||
|
"git": "https://git.pleroma.social/pleroma/fedi-fe",
|
||||||
|
"installed": true,
|
||||||
|
"name": "fedi-fe",
|
||||||
|
"ref": "master"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build",
|
||||||
|
"git": "https://git.pleroma.social/lambadalambda/kenoma",
|
||||||
|
"installed": false,
|
||||||
|
"name": "kenoma",
|
||||||
|
"ref": "master"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Could not install frontend"
|
||||||
|
}
|
||||||
|
```
|
|
@ -116,6 +116,10 @@ The modified chat message
|
||||||
This will return a list of chats that you have been involved in, sorted by their
|
This will return a list of chats that you have been involved in, sorted by their
|
||||||
last update (so new chats will be at the top).
|
last update (so new chats will be at the top).
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
- with_muted: Include chats from muted users (boolean).
|
||||||
|
|
||||||
Returned data:
|
Returned data:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
@ -173,11 +177,14 @@ Returned data:
|
||||||
"created_at": "2020-04-21T15:06:45.000Z",
|
"created_at": "2020-04-21T15:06:45.000Z",
|
||||||
"emojis": [],
|
"emojis": [],
|
||||||
"id": "12",
|
"id": "12",
|
||||||
"unread": false
|
"unread": false,
|
||||||
|
"idempotency_key": "75442486-0874-440c-9db1-a7006c25a31f"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- idempotency_key: The copy of the `idempotency-key` HTTP request header that can be used for optimistic message sending. Included only during the first few minutes after the message creation.
|
||||||
|
|
||||||
### Posting a chat message
|
### Posting a chat message
|
||||||
|
|
||||||
Posting a chat message for given Chat id works like this:
|
Posting a chat message for given Chat id works like this:
|
|
@ -4,17 +4,27 @@ A Pleroma instance can be identified by "<Mastodon version> (compatible; Pleroma
|
||||||
|
|
||||||
## Flake IDs
|
## Flake IDs
|
||||||
|
|
||||||
Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However just like Mastodon's ids they are lexically sortable strings
|
Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However, just like Mastodon's ids, they are lexically sortable strings
|
||||||
|
|
||||||
## Timelines
|
## Timelines
|
||||||
|
|
||||||
Adding the parameter `with_muted=true` to the timeline queries will also return activities by muted (not by blocked!) users.
|
Adding the parameter `with_muted=true` to the timeline queries will also return activities by muted (not by blocked!) users.
|
||||||
|
|
||||||
Adding the parameter `exclude_visibilities` to the timeline queries will exclude the statuses with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`), e.g., `exclude_visibilities[]=direct&exclude_visibilities[]=private`.
|
Adding the parameter `exclude_visibilities` to the timeline queries will exclude the statuses with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`), e.g., `exclude_visibilities[]=direct&exclude_visibilities[]=private`.
|
||||||
|
|
||||||
Adding the parameter `reply_visibility` to the public and home timelines queries will filter replies. Possible values: without parameter (default) shows all replies, `following` - replies directed to you or users you follow, `self` - replies directed to you.
|
Adding the parameter `reply_visibility` to the public and home timelines queries will filter replies. Possible values: without parameter (default) shows all replies, `following` - replies directed to you or users you follow, `self` - replies directed to you.
|
||||||
|
|
||||||
|
Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance).
|
||||||
|
|
||||||
|
Home, public, hashtag & list timelines accept these parameters:
|
||||||
|
|
||||||
|
- `only_media`: show only statuses with media attached
|
||||||
|
- `local`: show only local statuses
|
||||||
|
- `remote`: show only remote statuses
|
||||||
|
|
||||||
## Statuses
|
## Statuses
|
||||||
|
|
||||||
- `visibility`: has an additional possible value `list`
|
- `visibility`: has additional possible values `list` and `local` (for local-only statuses)
|
||||||
|
|
||||||
Has these additional fields under the `pleroma` object:
|
Has these additional fields under the `pleroma` object:
|
||||||
|
|
||||||
|
@ -22,13 +32,19 @@ Has these additional fields under the `pleroma` object:
|
||||||
- `conversation_id`: the ID of the AP context the status is associated with (if any)
|
- `conversation_id`: the ID of the AP context the status is associated with (if any)
|
||||||
- `direct_conversation_id`: the ID of the Mastodon direct message conversation the status is associated with (if any)
|
- `direct_conversation_id`: the ID of the Mastodon direct message conversation the status is associated with (if any)
|
||||||
- `in_reply_to_account_acct`: the `acct` property of User entity for replied user (if any)
|
- `in_reply_to_account_acct`: the `acct` property of User entity for replied user (if any)
|
||||||
- `content`: a map consisting of alternate representations of the `content` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`
|
- `content`: a map consisting of alternate representations of the `content` property with the key being its mimetype. Currently, the only alternate representation supported is `text/plain`
|
||||||
- `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`
|
- `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being its mimetype. Currently, the only alternate representation supported is `text/plain`
|
||||||
- `expires_at`: a datetime (iso8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire
|
- `expires_at`: a datetime (iso8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire
|
||||||
- `thread_muted`: true if the thread the post belongs to is muted
|
- `thread_muted`: true if the thread the post belongs to is muted
|
||||||
- `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint.
|
- `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint.
|
||||||
- `parent_visible`: If the parent of this post is visible to the user or not.
|
- `parent_visible`: If the parent of this post is visible to the user or not.
|
||||||
|
|
||||||
|
## Scheduled statuses
|
||||||
|
|
||||||
|
Has these additional fields in `params`:
|
||||||
|
|
||||||
|
- `expires_in`: the number of seconds the posted activity should expire in.
|
||||||
|
|
||||||
## Media Attachments
|
## Media Attachments
|
||||||
|
|
||||||
Has these additional fields under the `pleroma` object:
|
Has these additional fields under the `pleroma` object:
|
||||||
|
@ -50,6 +66,23 @@ The `id` parameter can also be the `nickname` of the user. This only works in th
|
||||||
- `/api/v1/accounts/:id`
|
- `/api/v1/accounts/:id`
|
||||||
- `/api/v1/accounts/:id/statuses`
|
- `/api/v1/accounts/:id/statuses`
|
||||||
|
|
||||||
|
`/api/v1/accounts/:id/statuses` endpoint accepts these parameters:
|
||||||
|
|
||||||
|
- `pinned`: include only pinned statuses
|
||||||
|
- `tagged`: with tag
|
||||||
|
- `only_media`: include only statuses with media attached
|
||||||
|
- `with_muted`: include statuses/reactions from muted accounts
|
||||||
|
- `exclude_reblogs`: exclude reblogs
|
||||||
|
- `exclude_replies`: exclude replies
|
||||||
|
- `exclude_visibilities`: exclude visibilities
|
||||||
|
|
||||||
|
Endpoints which accept `with_relationships` parameter:
|
||||||
|
|
||||||
|
- `/api/v1/accounts/:id`
|
||||||
|
- `/api/v1/accounts/:id/followers`
|
||||||
|
- `/api/v1/accounts/:id/following`
|
||||||
|
- `/api/v1/mutes`
|
||||||
|
|
||||||
Has these additional fields under the `pleroma` object:
|
Has these additional fields under the `pleroma` object:
|
||||||
|
|
||||||
- `ap_id`: nullable URL string, ActivityPub id of the user
|
- `ap_id`: nullable URL string, ActivityPub id of the user
|
||||||
|
@ -65,12 +98,12 @@ Has these additional fields under the `pleroma` object:
|
||||||
- `hide_followers_count`: boolean, true when the user has follower stat hiding enabled
|
- `hide_followers_count`: boolean, true when the user has follower stat hiding enabled
|
||||||
- `hide_follows_count`: boolean, true when the user has follow stat hiding enabled
|
- `hide_follows_count`: boolean, true when the user has follow stat hiding enabled
|
||||||
- `settings_store`: A generic map of settings for frontends. Opaque to the backend. Only returned in `/api/v1/accounts/verify_credentials` and `/api/v1/accounts/update_credentials`
|
- `settings_store`: A generic map of settings for frontends. Opaque to the backend. Only returned in `/api/v1/accounts/verify_credentials` and `/api/v1/accounts/update_credentials`
|
||||||
- `chat_token`: The token needed for Pleroma chat. Only returned in `/api/v1/accounts/verify_credentials`
|
- `chat_token`: The token needed for Pleroma shoutbox. Only returned in `/api/v1/accounts/verify_credentials`
|
||||||
- `deactivated`: boolean, true when the user is deactivated
|
- `deactivated`: boolean, true when the user is deactivated
|
||||||
- `allow_following_move`: boolean, true when the user allows automatically follow moved following accounts
|
- `allow_following_move`: boolean, true when the user allows automatically follow moved following accounts
|
||||||
- `unread_conversation_count`: The count of unread conversations. Only returned to the account owner.
|
- `unread_conversation_count`: The count of unread conversations. Only returned to the account owner.
|
||||||
- `unread_notifications_count`: The count of unread notifications. Only returned to the account owner.
|
- `unread_notifications_count`: The count of unread notifications. Only returned to the account owner.
|
||||||
- `notification_settings`: object, can be absent. See `/api/pleroma/notification_settings` for the parameters/keys returned.
|
- `notification_settings`: object, can be absent. See `/api/v1/pleroma/notification_settings` for the parameters/keys returned.
|
||||||
- `accepts_chat_messages`: boolean, but can be null if we don't have that information about a user
|
- `accepts_chat_messages`: boolean, but can be null if we don't have that information about a user
|
||||||
- `favicon`: nullable URL string, Favicon image of the user's instance
|
- `favicon`: nullable URL string, Favicon image of the user's instance
|
||||||
|
|
||||||
|
@ -80,7 +113,7 @@ Has these additional fields under the `pleroma` object:
|
||||||
|
|
||||||
- `show_role`: boolean, nullable, true when the user wants his role (e.g admin, moderator) to be shown
|
- `show_role`: boolean, nullable, true when the user wants his role (e.g admin, moderator) to be shown
|
||||||
- `no_rich_text` - boolean, nullable, true when html tags are stripped from all statuses requested from the API
|
- `no_rich_text` - boolean, nullable, true when html tags are stripped from all statuses requested from the API
|
||||||
- `discoverable`: boolean, true when the user allows discovery of the account in search results and other services.
|
- `discoverable`: boolean, true when the user allows external services (search bots) etc. to index / list the account (regardless of this setting, user will still appear in regular search results)
|
||||||
- `actor_type`: string, the type of this account.
|
- `actor_type`: string, the type of this account.
|
||||||
|
|
||||||
## Conversations
|
## Conversations
|
||||||
|
@ -125,12 +158,30 @@ The `type` value is `pleroma:emoji_reaction`. Has these fields:
|
||||||
- `account`: The account of the user who reacted
|
- `account`: The account of the user who reacted
|
||||||
- `status`: The status that was reacted on
|
- `status`: The status that was reacted on
|
||||||
|
|
||||||
|
### ChatMention Notification (not default)
|
||||||
|
|
||||||
|
This notification has to be requested explicitly.
|
||||||
|
|
||||||
|
The `type` value is `pleroma:chat_mention`
|
||||||
|
|
||||||
|
- `account`: The account who sent the message
|
||||||
|
- `chat_message`: The chat message
|
||||||
|
|
||||||
|
### Report Notification (not default)
|
||||||
|
|
||||||
|
This notification has to be requested explicitly.
|
||||||
|
|
||||||
|
The `type` value is `pleroma:report`
|
||||||
|
|
||||||
|
- `account`: The account who reported
|
||||||
|
- `report`: The report
|
||||||
|
|
||||||
## GET `/api/v1/notifications`
|
## GET `/api/v1/notifications`
|
||||||
|
|
||||||
Accepts additional parameters:
|
Accepts additional parameters:
|
||||||
|
|
||||||
- `exclude_visibilities`: will exclude the notifications for activities with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`). Usage example: `GET /api/v1/notifications?exclude_visibilities[]=direct&exclude_visibilities[]=private`.
|
- `exclude_visibilities`: will exclude the notifications for activities with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`). Usage example: `GET /api/v1/notifications?exclude_visibilities[]=direct&exclude_visibilities[]=private`.
|
||||||
- `include_types`: will include the notifications for activities with the given types. The parameter accepts an array of types (`mention`, `follow`, `reblog`, `favourite`, `move`, `pleroma:emoji_reaction`). Usage example: `GET /api/v1/notifications?include_types[]=mention&include_types[]=reblog`.
|
- `include_types`: will include the notifications for activities with the given types. The parameter accepts an array of types (`mention`, `follow`, `reblog`, `favourite`, `move`, `pleroma:emoji_reaction`, `pleroma:chat_mention`, `pleroma:report`). Usage example: `GET /api/v1/notifications?include_types[]=mention&include_types[]=reblog`.
|
||||||
|
|
||||||
## DELETE `/api/v1/notifications/destroy_multiple`
|
## DELETE `/api/v1/notifications/destroy_multiple`
|
||||||
|
|
||||||
|
@ -148,10 +199,10 @@ Returns on success: 200 OK `{}`
|
||||||
|
|
||||||
Additional parameters can be added to the JSON body/Form data:
|
Additional parameters can be added to the JSON body/Form data:
|
||||||
|
|
||||||
- `preview`: boolean, if set to `true` the post won't be actually posted, but the status entitiy would still be rendered back. This could be useful for previewing rich text/custom emoji, for example.
|
- `preview`: boolean, if set to `true` the post won't be actually posted, but the status entity would still be rendered back. This could be useful for previewing rich text/custom emoji, for example.
|
||||||
- `content_type`: string, contain the MIME type of the status, it is transformed into HTML by the backend. You can get the list of the supported MIME types with the nodeinfo endpoint.
|
- `content_type`: string, contain the MIME type of the status, it is transformed into HTML by the backend. You can get the list of the supported MIME types with the nodeinfo endpoint.
|
||||||
- `to`: A list of nicknames (like `lain@soykaf.club` or `lain` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for for post visibility are not affected by this and will still apply.
|
- `to`: A list of nicknames (like `lain@soykaf.club` or `lain` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for post visibility are not affected by this and will still apply.
|
||||||
- `visibility`: string, besides standard MastoAPI values (`direct`, `private`, `unlisted` or `public`) it can be used to address a List by setting it to `list:LIST_ID`.
|
- `visibility`: string, besides standard MastoAPI values (`direct`, `private`, `unlisted`, `local` or `public`) it can be used to address a List by setting it to `list:LIST_ID`.
|
||||||
- `expires_in`: The number of seconds the posted activity should expire in. When a posted activity expires it will be deleted from the server, and a delete request for it will be federated. This needs to be longer than an hour.
|
- `expires_in`: The number of seconds the posted activity should expire in. When a posted activity expires it will be deleted from the server, and a delete request for it will be federated. This needs to be longer than an hour.
|
||||||
- `in_reply_to_conversation_id`: Will reply to a given conversation, addressing only the people who are part of the recipient set of that conversation. Sets the visibility to `direct`.
|
- `in_reply_to_conversation_id`: Will reply to a given conversation, addressing only the people who are part of the recipient set of that conversation. Sets the visibility to `direct`.
|
||||||
|
|
||||||
|
@ -184,8 +235,9 @@ Additional parameters can be added to the JSON body/Form data:
|
||||||
- `pleroma_settings_store` - Opaque user settings to be saved on the backend.
|
- `pleroma_settings_store` - Opaque user settings to be saved on the backend.
|
||||||
- `skip_thread_containment` - if true, skip filtering out broken threads
|
- `skip_thread_containment` - if true, skip filtering out broken threads
|
||||||
- `allow_following_move` - if true, allows automatically follow moved following accounts
|
- `allow_following_move` - if true, allows automatically follow moved following accounts
|
||||||
|
- `also_known_as` - array of ActivityPub IDs, needed for following move
|
||||||
- `pleroma_background_image` - sets the background image of the user. Can be set to "" (an empty string) to reset.
|
- `pleroma_background_image` - sets the background image of the user. Can be set to "" (an empty string) to reset.
|
||||||
- `discoverable` - if true, discovery of this account in search results and other services is allowed.
|
- `discoverable` - if true, external services (search bots) etc. are allowed to index / list the account (regardless of this setting, user will still appear in regular search results).
|
||||||
- `actor_type` - the type of this account.
|
- `actor_type` - the type of this account.
|
||||||
- `accepts_chat_messages` - if false, this account will reject all chat messages.
|
- `accepts_chat_messages` - if false, this account will reject all chat messages.
|
||||||
|
|
||||||
|
@ -211,7 +263,7 @@ Post here request with `grant_type=refresh_token` to obtain new access token. Re
|
||||||
|
|
||||||
`POST /api/v1/accounts`
|
`POST /api/v1/accounts`
|
||||||
|
|
||||||
Has theses additional parameters (which are the same as in Pleroma-API):
|
Has these additional parameters (which are the same as in Pleroma-API):
|
||||||
|
|
||||||
- `fullname`: optional
|
- `fullname`: optional
|
||||||
- `bio`: optional
|
- `bio`: optional
|
||||||
|
@ -239,6 +291,16 @@ Has theses additional parameters (which are the same as in Pleroma-API):
|
||||||
- `pleroma.metadata.post_formats`: A list of the allowed post format types
|
- `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
|
||||||
|
|
||||||
|
## Push Subscription
|
||||||
|
|
||||||
|
`POST /api/v1/push/subscription`
|
||||||
|
`PUT /api/v1/push/subscription`
|
||||||
|
|
||||||
|
Permits these additional alert types:
|
||||||
|
|
||||||
|
- pleroma:chat_mention
|
||||||
|
- pleroma:emoji_reaction
|
||||||
|
|
||||||
## Markers
|
## Markers
|
||||||
|
|
||||||
Has these additional fields under the `pleroma` object:
|
Has these additional fields under the `pleroma` object:
|
||||||
|
@ -247,8 +309,31 @@ Has these additional fields under the `pleroma` object:
|
||||||
|
|
||||||
## Streaming
|
## Streaming
|
||||||
|
|
||||||
|
### Chats
|
||||||
|
|
||||||
There is an additional `user:pleroma_chat` stream. Incoming chat messages will make the current chat be sent to this `user` stream. The `event` of an incoming chat message is `pleroma:chat_update`. The payload is the updated chat with the incoming chat message in the `last_message` field.
|
There is an additional `user:pleroma_chat` stream. Incoming chat messages will make the current chat be sent to this `user` stream. The `event` of an incoming chat message is `pleroma:chat_update`. The payload is the updated chat with the incoming chat message in the `last_message` field.
|
||||||
|
|
||||||
|
### Remote timelines
|
||||||
|
|
||||||
|
For viewing remote server timelines, there are `public:remote` and `public:remote:media` streams. Each of these accept a parameter like `?instance=lain.com`.
|
||||||
|
|
||||||
|
### Follow relationships updates
|
||||||
|
|
||||||
|
Pleroma streams follow relationships updates as `pleroma:follow_relationships_update` events to the `user` stream.
|
||||||
|
|
||||||
|
The message payload consist of:
|
||||||
|
|
||||||
|
- `state`: a relationship state, one of `follow_pending`, `follow_accept` or `follow_reject`.
|
||||||
|
|
||||||
|
- `follower` and `following` maps with following fields:
|
||||||
|
- `id`: user ID
|
||||||
|
- `follower_count`: follower count
|
||||||
|
- `following_count`: following count
|
||||||
|
|
||||||
|
## User muting and thread muting
|
||||||
|
|
||||||
|
Both user muting and thread muting can be done for only a certain time by adding an `expires_in` parameter to the API calls and giving the expiration time in seconds.
|
||||||
|
|
||||||
## Not implemented
|
## Not implemented
|
||||||
|
|
||||||
Pleroma is generally compatible with the Mastodon 2.7.2 API, but some newer features and non-essential features are omitted. These features usually return an HTTP 200 status code, but with an empty response. While they may be added in the future, they are considered low priority.
|
Pleroma is generally compatible with the Mastodon 2.7.2 API, but some newer features and non-essential features are omitted. These features usually return an HTTP 200 status code, but with an empty response. While they may be added in the future, they are considered low priority.
|
|
@ -4,7 +4,9 @@ Requests that require it can be authenticated with [an OAuth token](https://tool
|
||||||
|
|
||||||
Request parameters can be passed via [query strings](https://en.wikipedia.org/wiki/Query_string) or as [form data](https://www.w3.org/TR/html401/interact/forms.html). Files must be uploaded as `multipart/form-data`.
|
Request parameters can be passed via [query strings](https://en.wikipedia.org/wiki/Query_string) or as [form data](https://www.w3.org/TR/html401/interact/forms.html). Files must be uploaded as `multipart/form-data`.
|
||||||
|
|
||||||
## `/api/pleroma/emoji`
|
The `/api/v1/pleroma/*` path is backwards compatible with `/api/pleroma/*` (`/api/pleroma/*` will be deprecated in the future).
|
||||||
|
|
||||||
|
## `/api/v1/pleroma/emoji`
|
||||||
### Lists the custom emoji on that server.
|
### Lists the custom emoji on that server.
|
||||||
* Method: `GET`
|
* Method: `GET`
|
||||||
* Authentication: not required
|
* Authentication: not required
|
||||||
|
@ -35,7 +37,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
```
|
```
|
||||||
* Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format
|
* Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format
|
||||||
|
|
||||||
## `/api/pleroma/follow_import`
|
## `/api/v1/pleroma/follow_import`
|
||||||
### Imports your follows, for example from a Mastodon CSV file.
|
### Imports your follows, for example from a Mastodon CSV file.
|
||||||
* Method: `POST`
|
* Method: `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -44,7 +46,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* Response: HTTP 200 on success, 500 on error
|
* Response: HTTP 200 on success, 500 on error
|
||||||
* Note: Users that can't be followed are silently skipped.
|
* Note: Users that can't be followed are silently skipped.
|
||||||
|
|
||||||
## `/api/pleroma/blocks_import`
|
## `/api/v1/pleroma/blocks_import`
|
||||||
### Imports your blocks.
|
### Imports your blocks.
|
||||||
* Method: `POST`
|
* Method: `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -52,7 +54,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* `list`: STRING or FILE containing a whitespace-separated list of accounts to block
|
* `list`: STRING or FILE containing a whitespace-separated list of accounts to block
|
||||||
* Response: HTTP 200 on success, 500 on error
|
* Response: HTTP 200 on success, 500 on error
|
||||||
|
|
||||||
## `/api/pleroma/mutes_import`
|
## `/api/v1/pleroma/mutes_import`
|
||||||
### Imports your mutes.
|
### Imports your mutes.
|
||||||
* Method: `POST`
|
* Method: `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -60,7 +62,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* `list`: STRING or FILE containing a whitespace-separated list of accounts to mute
|
* `list`: STRING or FILE containing a whitespace-separated list of accounts to mute
|
||||||
* Response: HTTP 200 on success, 500 on error
|
* Response: HTTP 200 on success, 500 on error
|
||||||
|
|
||||||
## `/api/pleroma/captcha`
|
## `/api/v1/pleroma/captcha`
|
||||||
### Get a new captcha
|
### Get a new captcha
|
||||||
* Method: `GET`
|
* Method: `GET`
|
||||||
* Authentication: not required
|
* Authentication: not required
|
||||||
|
@ -68,7 +70,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* Response: Provider specific JSON, the only guaranteed parameter is `type`
|
* Response: Provider specific JSON, the only guaranteed parameter is `type`
|
||||||
* Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint", "seconds_valid": 300}`
|
* Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint", "seconds_valid": 300}`
|
||||||
|
|
||||||
## `/api/pleroma/delete_account`
|
## `/api/v1/pleroma/delete_account`
|
||||||
### Delete an account
|
### Delete an account
|
||||||
* Method `POST`
|
* Method `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -77,7 +79,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise
|
* Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise
|
||||||
* Example response: `{"error": "Invalid password."}`
|
* Example response: `{"error": "Invalid password."}`
|
||||||
|
|
||||||
## `/api/pleroma/disable_account`
|
## `/api/v1/pleroma/disable_account`
|
||||||
### Disable an account
|
### Disable an account
|
||||||
* Method `POST`
|
* Method `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -86,21 +88,21 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* Response: JSON. Returns `{"status": "success"}` if the account was successfully disabled, `{"error": "[error message]"}` otherwise
|
* Response: JSON. Returns `{"status": "success"}` if the account was successfully disabled, `{"error": "[error message]"}` otherwise
|
||||||
* Example response: `{"error": "Invalid password."}`
|
* Example response: `{"error": "Invalid password."}`
|
||||||
|
|
||||||
## `/api/pleroma/accounts/mfa`
|
## `/api/v1/pleroma/accounts/mfa`
|
||||||
#### Gets current MFA settings
|
#### Gets current MFA settings
|
||||||
* method: `GET`
|
* method: `GET`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
* OAuth scope: `read:security`
|
* OAuth scope: `read:security`
|
||||||
* Response: JSON. Returns `{"enabled": "false", "totp": false }`
|
* Response: JSON. Returns `{"enabled": "false", "totp": false }`
|
||||||
|
|
||||||
## `/api/pleroma/accounts/mfa/setup/totp`
|
## `/api/v1/pleroma/accounts/mfa/setup/totp`
|
||||||
#### Pre-setup the MFA/TOTP method
|
#### Pre-setup the MFA/TOTP method
|
||||||
* method: `GET`
|
* method: `GET`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
* OAuth scope: `write:security`
|
* OAuth scope: `write:security`
|
||||||
* Response: JSON. Returns `{"key": [secret_key], "provisioning_uri": "[qr code uri]" }` when successful, otherwise returns HTTP 422 `{"error": "error_msg"}`
|
* Response: JSON. Returns `{"key": [secret_key], "provisioning_uri": "[qr code uri]" }` when successful, otherwise returns HTTP 422 `{"error": "error_msg"}`
|
||||||
|
|
||||||
## `/api/pleroma/accounts/mfa/confirm/totp`
|
## `/api/v1/pleroma/accounts/mfa/confirm/totp`
|
||||||
#### Confirms & enables MFA/TOTP support for user account.
|
#### Confirms & enables MFA/TOTP support for user account.
|
||||||
* method: `POST`
|
* method: `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -111,7 +113,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* Response: JSON. Returns `{}` if the enable was successful, HTTP 422 `{"error": "[error message]"}` otherwise
|
* Response: JSON. Returns `{}` if the enable was successful, HTTP 422 `{"error": "[error message]"}` otherwise
|
||||||
|
|
||||||
|
|
||||||
## `/api/pleroma/accounts/mfa/totp`
|
## `/api/v1/pleroma/accounts/mfa/totp`
|
||||||
#### Disables MFA/TOTP method for user account.
|
#### Disables MFA/TOTP method for user account.
|
||||||
* method: `DELETE`
|
* method: `DELETE`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -121,14 +123,14 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi
|
||||||
* Response: JSON. Returns `{}` if the disable was successful, HTTP 422 `{"error": "[error message]"}` otherwise
|
* Response: JSON. Returns `{}` if the disable was successful, HTTP 422 `{"error": "[error message]"}` otherwise
|
||||||
* Example response: `{"error": "Invalid password."}`
|
* Example response: `{"error": "Invalid password."}`
|
||||||
|
|
||||||
## `/api/pleroma/accounts/mfa/backup_codes`
|
## `/api/v1/pleroma/accounts/mfa/backup_codes`
|
||||||
#### Generstes backup codes MFA for user account.
|
#### Generstes backup codes MFA for user account.
|
||||||
* method: `GET`
|
* method: `GET`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
* OAuth scope: `write:security`
|
* OAuth scope: `write:security`
|
||||||
* Response: JSON. Returns `{"codes": codes}`when successful, otherwise HTTP 422 `{"error": "[error message]"}`
|
* Response: JSON. Returns `{"codes": codes}`when successful, otherwise HTTP 422 `{"error": "[error message]"}`
|
||||||
|
|
||||||
## `/api/pleroma/admin/`
|
## `/api/v1/pleroma/admin/`
|
||||||
See [Admin-API](admin_api.md)
|
See [Admin-API](admin_api.md)
|
||||||
|
|
||||||
## `/api/v1/pleroma/notifications/read`
|
## `/api/v1/pleroma/notifications/read`
|
||||||
|
@ -298,7 +300,7 @@ See [Admin-API](admin_api.md)
|
||||||
* Note: Behaves exactly the same as `POST /api/v1/upload`.
|
* Note: Behaves exactly the same as `POST /api/v1/upload`.
|
||||||
Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`.
|
Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`.
|
||||||
|
|
||||||
## `/api/pleroma/notification_settings`
|
## `/api/v1/pleroma/notification_settings`
|
||||||
### Updates user notification settings
|
### Updates user notification settings
|
||||||
* Method `PUT`
|
* Method `PUT`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -307,7 +309,7 @@ See [Admin-API](admin_api.md)
|
||||||
* `hide_notification_contents`: BOOLEAN field. When set to true, it removes the contents of a message from the push notification.
|
* `hide_notification_contents`: 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/v1/pleroma/healthcheck`
|
||||||
### Healthcheck endpoint with additional system data.
|
### Healthcheck endpoint with additional system data.
|
||||||
* Method `GET`
|
* Method `GET`
|
||||||
* Authentication: not required
|
* Authentication: not required
|
||||||
|
@ -325,7 +327,7 @@ See [Admin-API](admin_api.md)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `/api/pleroma/change_email`
|
## `/api/v1/pleroma/change_email`
|
||||||
### Change account email
|
### Change account email
|
||||||
* Method `POST`
|
* Method `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
@ -378,7 +380,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* Params: None
|
* Params: None
|
||||||
* Response: JSON, returns a list of Mastodon Conversation entities that were marked as read (200 - healthy, 503 unhealthy).
|
* Response: JSON, returns a list of Mastodon Conversation entities that were marked as read (200 - healthy, 503 unhealthy).
|
||||||
|
|
||||||
## `GET /api/pleroma/emoji/pack?name=:name`
|
## `GET /api/v1/pleroma/emoji/pack?name=:name`
|
||||||
|
|
||||||
### Get pack.json for the pack
|
### Get pack.json for the pack
|
||||||
|
|
||||||
|
@ -397,7 +399,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/pleroma/emoji/pack?name=:name`
|
## `POST /api/v1/pleroma/emoji/pack?name=:name`
|
||||||
|
|
||||||
### Creates an empty pack
|
### Creates an empty pack
|
||||||
|
|
||||||
|
@ -407,7 +409,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* `name`: pack name
|
* `name`: pack name
|
||||||
* Response: JSON, "ok" and 200 status or 409 if the pack with that name already exists
|
* Response: JSON, "ok" and 200 status or 409 if the pack with that name already exists
|
||||||
|
|
||||||
## `PATCH /api/pleroma/emoji/pack?name=:name`
|
## `PATCH /api/v1/pleroma/emoji/pack?name=:name`
|
||||||
|
|
||||||
### Updates (replaces) pack metadata
|
### Updates (replaces) pack metadata
|
||||||
|
|
||||||
|
@ -425,7 +427,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* Response: JSON, updated "metadata" section of the pack and 200 status or 400 if there was a
|
* Response: JSON, updated "metadata" section of the pack and 200 status or 400 if there was a
|
||||||
problem with the new metadata (the error is specified in the "error" part of the response JSON)
|
problem with the new metadata (the error is specified in the "error" part of the response JSON)
|
||||||
|
|
||||||
## `DELETE /api/pleroma/emoji/pack?name=:name`
|
## `DELETE /api/v1/pleroma/emoji/pack?name=:name`
|
||||||
|
|
||||||
### Delete a custom emoji pack
|
### Delete a custom emoji pack
|
||||||
|
|
||||||
|
@ -435,7 +437,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* `name`: pack name
|
* `name`: pack name
|
||||||
* Response: JSON, "ok" and 200 status or 500 if there was an error deleting the pack
|
* Response: JSON, "ok" and 200 status or 500 if there was an error deleting the pack
|
||||||
|
|
||||||
## `GET /api/pleroma/emoji/packs/import`
|
## `GET /api/v1/pleroma/emoji/packs/import`
|
||||||
|
|
||||||
### Imports packs from filesystem
|
### Imports packs from filesystem
|
||||||
|
|
||||||
|
@ -444,7 +446,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* Params: None
|
* Params: None
|
||||||
* Response: JSON, returns a list of imported packs.
|
* Response: JSON, returns a list of imported packs.
|
||||||
|
|
||||||
## `GET /api/pleroma/emoji/packs/remote`
|
## `GET /api/v1/pleroma/emoji/packs/remote`
|
||||||
|
|
||||||
### Make request to another instance for packs list
|
### Make request to another instance for packs list
|
||||||
|
|
||||||
|
@ -456,7 +458,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* `page_size`: page size for packs (default 50)
|
* `page_size`: page size for packs (default 50)
|
||||||
* Response: JSON with the pack list, hashmap with pack name and pack contents
|
* Response: JSON with the pack list, hashmap with pack name and pack contents
|
||||||
|
|
||||||
## `POST /api/pleroma/emoji/packs/download`
|
## `POST /api/v1/pleroma/emoji/packs/download`
|
||||||
|
|
||||||
### Download pack from another instance
|
### Download pack from another instance
|
||||||
|
|
||||||
|
@ -469,7 +471,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* Response: JSON, "ok" with 200 status if the pack was downloaded, or 500 if there were
|
* Response: JSON, "ok" with 200 status if the pack was downloaded, or 500 if there were
|
||||||
errors downloading the pack
|
errors downloading the pack
|
||||||
|
|
||||||
## `POST /api/pleroma/emoji/packs/files?name=:name`
|
## `POST /api/v1/pleroma/emoji/packs/files?name=:name`
|
||||||
|
|
||||||
### Add new file to the pack
|
### Add new file to the pack
|
||||||
|
|
||||||
|
@ -482,7 +484,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* `filename`: (*optional*) new emoji file name. If not specified will be taken from original filename.
|
* `filename`: (*optional*) new emoji file name. If not specified will be taken from original filename.
|
||||||
* Response: JSON, list of files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message.
|
* Response: JSON, list of files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message.
|
||||||
|
|
||||||
## `PATCH /api/pleroma/emoji/packs/files?name=:name`
|
## `PATCH /api/v1/pleroma/emoji/packs/files?name=:name`
|
||||||
|
|
||||||
### Update emoji file from pack
|
### Update emoji file from pack
|
||||||
|
|
||||||
|
@ -496,7 +498,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* `force`: (*optional*) with true value to overwrite existing emoji with new shortcode
|
* `force`: (*optional*) with true value to overwrite existing emoji with new shortcode
|
||||||
* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message.
|
* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message.
|
||||||
|
|
||||||
## `DELETE /api/pleroma/emoji/packs/files?name=:name`
|
## `DELETE /api/v1/pleroma/emoji/packs/files?name=:name`
|
||||||
|
|
||||||
### Delete emoji file from pack
|
### Delete emoji file from pack
|
||||||
|
|
||||||
|
@ -507,7 +509,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
* `shortcode`: emoji file shortcode
|
* `shortcode`: emoji file shortcode
|
||||||
* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message.
|
* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message.
|
||||||
|
|
||||||
## `GET /api/pleroma/emoji/packs`
|
## `GET /api/v1/pleroma/emoji/packs`
|
||||||
|
|
||||||
### Lists local custom emoji packs
|
### Lists local custom emoji packs
|
||||||
|
|
||||||
|
@ -528,7 +530,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `GET /api/pleroma/emoji/packs/archive?name=:name`
|
## `GET /api/v1/pleroma/emoji/packs/archive?name=:name`
|
||||||
|
|
||||||
### Requests a local pack archive from the instance
|
### Requests a local pack archive from the instance
|
||||||
|
|
||||||
|
@ -579,14 +581,14 @@ Emoji reactions work a lot like favourites do. They make it possible to react to
|
||||||
### React to a post with a unicode emoji
|
### React to a post with a unicode emoji
|
||||||
* Method: `PUT`
|
* Method: `PUT`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
* Params: `emoji`: A single character unicode emoji
|
* Params: `emoji`: A unicode RGI emoji or a regional indicator
|
||||||
* Response: JSON, the status.
|
* Response: JSON, the status.
|
||||||
|
|
||||||
## `DELETE /api/v1/pleroma/statuses/:id/reactions/:emoji`
|
## `DELETE /api/v1/pleroma/statuses/:id/reactions/:emoji`
|
||||||
### Remove a reaction to a post with a unicode emoji
|
### Remove a reaction to a post with a unicode emoji
|
||||||
* Method: `DELETE`
|
* Method: `DELETE`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
* Params: `emoji`: A single character unicode emoji
|
* Params: `emoji`: A unicode RGI emoji or a regional indicator
|
||||||
* Response: JSON, the status.
|
* Response: JSON, the status.
|
||||||
|
|
||||||
## `GET /api/v1/pleroma/statuses/:id/reactions`
|
## `GET /api/v1/pleroma/statuses/:id/reactions`
|
||||||
|
@ -615,3 +617,41 @@ Emoji reactions work a lot like favourites do. They make it possible to react to
|
||||||
{"name": "😀", "count": 2, "me": true, "accounts": [{"id" => "xyz.."...}, {"id" => "zyx..."}]}
|
{"name": "😀", "count": 2, "me": true, "accounts": [{"id" => "xyz.."...}, {"id" => "zyx..."}]}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## `POST /api/v1/pleroma/backups`
|
||||||
|
### Create a user backup archive
|
||||||
|
|
||||||
|
* Method: `POST`
|
||||||
|
* Authentication: required
|
||||||
|
* Params: none
|
||||||
|
* Response: JSON
|
||||||
|
* Example response:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[{
|
||||||
|
"content_type": "application/zip",
|
||||||
|
"file_size": 0,
|
||||||
|
"inserted_at": "2020-09-10T16:18:03.000Z",
|
||||||
|
"processed": false,
|
||||||
|
"url": "https://example.com/media/backups/archive-foobar-20200910T161803-QUhx6VYDRQ2wfV0SdA2Pfj_2CLM_ATUlw-D5l5TJf4Q.zip"
|
||||||
|
}]
|
||||||
|
```
|
||||||
|
|
||||||
|
## `GET /api/v1/pleroma/backups`
|
||||||
|
### Lists user backups
|
||||||
|
|
||||||
|
* Method: `GET`
|
||||||
|
* Authentication: not required
|
||||||
|
* Params: none
|
||||||
|
* Response: JSON
|
||||||
|
* Example response:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[{
|
||||||
|
"content_type": "application/zip",
|
||||||
|
"file_size": 55457,
|
||||||
|
"inserted_at": "2020-09-10T16:18:03.000Z",
|
||||||
|
"processed": true,
|
||||||
|
"url": "https://example.com/media/backups/archive-foobar-20200910T161803-QUhx6VYDRQ2wfV0SdA2Pfj_2CLM_ATUlw-D5l5TJf4Q.zip"
|
||||||
|
}]
|
||||||
|
```
|
|
@ -0,0 +1,65 @@
|
||||||
|
# AP Extensions
|
||||||
|
## Actor endpoints
|
||||||
|
|
||||||
|
The following endpoints are additionally present into our actors.
|
||||||
|
|
||||||
|
- `oauthRegistrationEndpoint` (`http://litepub.social/ns#oauthRegistrationEndpoint`)
|
||||||
|
- `uploadMedia` (`https://www.w3.org/ns/activitystreams#uploadMedia`)
|
||||||
|
|
||||||
|
### oauthRegistrationEndpoint
|
||||||
|
|
||||||
|
Points to MastodonAPI `/api/v1/apps` for now.
|
||||||
|
|
||||||
|
See <https://docs.joinmastodon.org/methods/apps/>
|
||||||
|
|
||||||
|
### uploadMedia
|
||||||
|
|
||||||
|
Inspired by <https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload>, it is part of the ActivityStreams namespace because it used to be part of the ActivityPub specification and got removed from it.
|
||||||
|
|
||||||
|
Content-Type: multipart/form-data
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- (required) `file`: The file being uploaded
|
||||||
|
- (optionnal) `description`: A plain-text description of the media, for accessibility purposes.
|
||||||
|
|
||||||
|
Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id`
|
||||||
|
|
||||||
|
The object given in the reponse should then be inserted into an Object's `attachment` field.
|
||||||
|
|
||||||
|
## ChatMessages
|
||||||
|
|
||||||
|
`ChatMessage`s are the messages sent in 1-on-1 chats. They are similar to
|
||||||
|
`Note`s, but the addresing is done by having a single AP actor in the `to`
|
||||||
|
field. Addressing multiple actors is not allowed. These messages are always
|
||||||
|
private, there is no public version of them. They are created with a `Create`
|
||||||
|
activity.
|
||||||
|
|
||||||
|
They are part of the `litepub` namespace as `http://litepub.social/ns#ChatMessage`.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"actor": "http://2hu.gensokyo/users/raymoo",
|
||||||
|
"id": "http://2hu.gensokyo/objects/1",
|
||||||
|
"object": {
|
||||||
|
"attributedTo": "http://2hu.gensokyo/users/raymoo",
|
||||||
|
"content": "You expected a cute girl? Too bad.",
|
||||||
|
"id": "http://2hu.gensokyo/objects/2",
|
||||||
|
"published": "2020-02-12T14:08:20Z",
|
||||||
|
"to": [
|
||||||
|
"http://2hu.gensokyo/users/marisa"
|
||||||
|
],
|
||||||
|
"type": "ChatMessage"
|
||||||
|
},
|
||||||
|
"published": "2018-02-12T14:08:20Z",
|
||||||
|
"to": [
|
||||||
|
"http://2hu.gensokyo/users/marisa"
|
||||||
|
],
|
||||||
|
"type": "Create"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This setup does not prevent multi-user chats, but these will have to go through
|
||||||
|
a `Group`, which will be the recipient of the messages and then `Announce` them
|
||||||
|
to the users in the `Group`.
|
|
@ -1,5 +1,3 @@
|
||||||
This document contains notes and guidelines for Pleroma developers.
|
|
||||||
|
|
||||||
# Authentication & Authorization
|
# Authentication & Authorization
|
||||||
|
|
||||||
## OAuth token-based authentication & authorization
|
## OAuth token-based authentication & authorization
|
||||||
|
@ -14,10 +12,10 @@ This document contains notes and guidelines for Pleroma developers.
|
||||||
|
|
||||||
For `:api` pipeline routes, it'll be verified whether `OAuthScopesPlug` was called or explicitly skipped, and if it was not then auth information will be dropped for request. Then `EnsurePublicOrAuthenticatedPlug` will be called to ensure that either the instance is not private or user is authenticated (unless explicitly skipped). Such automated checks help to prevent human errors and result in higher security / privacy for users.
|
For `:api` pipeline routes, it'll be verified whether `OAuthScopesPlug` was called or explicitly skipped, and if it was not then auth information will be dropped for request. Then `EnsurePublicOrAuthenticatedPlug` will be called to ensure that either the instance is not private or user is authenticated (unless explicitly skipped). Such automated checks help to prevent human errors and result in higher security / privacy for users.
|
||||||
|
|
||||||
## [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization)
|
## Non-OAuth authentication
|
||||||
|
|
||||||
* With HTTP Basic Auth, OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways). `Pleroma.Web.Plugs.AuthenticationPlug` and `Pleroma.Web.Plugs.LegacyAuthenticationPlug` both call `Pleroma.Web.Plugs.OAuthScopesPlug.skip_plug(conn)` when password is provided.
|
* With non-OAuth authentication ([HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) or HTTP header- or params-provided auth), OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways); auth plugs invoke `Pleroma.Helpers.AuthHelper.skip_oauth(conn)` in this case.
|
||||||
|
|
||||||
## Auth-related configuration, OAuth consumer mode etc.
|
## Auth-related configuration, OAuth consumer mode etc.
|
||||||
|
|
||||||
See `Authentication` section of [the configuration cheatsheet](configuration/cheatsheet.md#authentication).
|
See `Authentication` section of [the configuration cheatsheet](../configuration/cheatsheet.md#authentication).
|
|
@ -0,0 +1 @@
|
||||||
|
This section contains notes and guidelines for developers.
|
|
@ -0,0 +1,70 @@
|
||||||
|
# Setting up a Pleroma development environment
|
||||||
|
|
||||||
|
Pleroma requires some adjustments from the defaults for running the instance locally. The following should help you to get started.
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
1. Install Pleroma as explained in [the docs](../installation/debian_based_en.md), with some exceptions:
|
||||||
|
* You can use your own fork of the repository and add pleroma as a remote `git remote add pleroma 'https://git.pleroma.social/pleroma/pleroma'`
|
||||||
|
* You can skip systemd and nginx and all that stuff
|
||||||
|
* No need to create a dedicated pleroma user, it's easier to just use your own user
|
||||||
|
* For the DB you can still choose a dedicated user, the mix tasks set it up for you so it's no extra work for you
|
||||||
|
* For domain you can use `localhost`
|
||||||
|
* instead of creating a `prod.secret.exs`, create `dev.secret.exs`
|
||||||
|
* No need to prefix with `MIX_ENV=prod`. We're using dev and that's the default MIX_ENV
|
||||||
|
2. Change the dev.secret.exs
|
||||||
|
* Change the scheme in `config :pleroma, Pleroma.Web.Endpoint` to http (see examples below)
|
||||||
|
* If you want to change other settings, you can do that too
|
||||||
|
3. You can now start the server `mix phx.server`. Once it's build and started, you can access the instance on `http://<host>:<port>` (e.g.http://localhost:4000 ) and should be able to do everything locally you normaly can.
|
||||||
|
|
||||||
|
Example config to change the scheme to http. Change the port if you want to run on another port.
|
||||||
|
```elixir
|
||||||
|
config :pleroma, Pleroma.Web.Endpoint,
|
||||||
|
url: [host: "localhost", scheme: "http", port: 4000],
|
||||||
|
```
|
||||||
|
|
||||||
|
Example config to disable captcha. This makes it a bit easier to create test-users.
|
||||||
|
```elixir
|
||||||
|
config :pleroma, Pleroma.Captcha,
|
||||||
|
enabled: false
|
||||||
|
```
|
||||||
|
|
||||||
|
Example config to change the log level to info
|
||||||
|
```elixir
|
||||||
|
config :logger, :console,
|
||||||
|
# :debug :info :warning :error
|
||||||
|
level: :info
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
1. Create a `test.secret.exs` file with the content as shown below
|
||||||
|
2. Create the database user and test database.
|
||||||
|
1. You can use the `config/setup_db.psql` as a template. Copy the file if you want and change the database name, user and password to the values for the test-database (e.g. 'pleroma_local_test' for database and user). Then run this file like you did during installation.
|
||||||
|
2. The tests will try to create the Database, so we'll have to allow our test-database user to create databases, `sudo -Hu postgres psql -c "ALTER USER pleroma_local_test WITH CREATEDB;"`
|
||||||
|
3. Run the tests with `mix test`. The tests should succeed.
|
||||||
|
|
||||||
|
Example content for the `test.secret.exs` file. Feel free to use another user, database name or password, just make sure the database is dedicated for the testing environment.
|
||||||
|
```elixir
|
||||||
|
# Pleroma test configuration
|
||||||
|
|
||||||
|
# NOTE: This file should not be committed to a repo or otherwise made public
|
||||||
|
# without removing sensitive information.
|
||||||
|
|
||||||
|
import Config
|
||||||
|
|
||||||
|
config :pleroma, Pleroma.Repo,
|
||||||
|
username: "pleroma_local_test",
|
||||||
|
password: "mysuperduperpassword",
|
||||||
|
database: "pleroma_local_test",
|
||||||
|
hostname: "localhost"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Updating
|
||||||
|
|
||||||
|
Update Pleroma as explained in [the docs](../administration/updating.md). Just make sure you pull from upstream and not from your own fork.
|
||||||
|
|
||||||
|
## Working on multiple branches
|
||||||
|
|
||||||
|
If you develop on a separate branch, it's possible you did migrations that aren't merged into another branch you're working on. If you have multiple things you're working on, it's probably best to set up multiple pleroma's each with their own database. If you finished with a branch and want to switch back to develop to start a new branch from there, you can drop the database and recreate the database (e.g. by using `config/setup_db.psql`). The commands to drop and recreate the database can be found in [the docs](../administration/backup.md).
|
|
@ -80,7 +80,7 @@ sudo /etc/init.d/postgresql start
|
||||||
sudo rc-update add postgresql
|
sudo rc-update add postgresql
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md))
|
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo apk add ffmpeg imagemagick exiftool
|
sudo apk add ffmpeg imagemagick exiftool
|
||||||
|
@ -125,7 +125,7 @@ sudo -Hu pleroma mix deps.get
|
||||||
* Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
|
* Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mv config/{generated_config.exs,prod.secret.exs}
|
sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs}
|
||||||
```
|
```
|
||||||
|
|
||||||
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
|
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
|
||||||
|
|
|
@ -56,7 +56,7 @@ sudo -iu postgres initdb -D /var/lib/postgres/data
|
||||||
sudo systemctl enable --now postgresql.service
|
sudo systemctl enable --now postgresql.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md))
|
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo pacman -S ffmpeg imagemagick perl-image-exiftool
|
sudo pacman -S ffmpeg imagemagick perl-image-exiftool
|
||||||
|
@ -100,7 +100,7 @@ sudo -Hu pleroma mix deps.get
|
||||||
* Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
|
* Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mv config/{generated_config.exs,prod.secret.exs}
|
sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs}
|
||||||
```
|
```
|
||||||
|
|
||||||
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
|
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
|
||||||
|
|
|
@ -35,7 +35,7 @@ sudo apt full-upgrade
|
||||||
* Install some of the above mentioned programs:
|
* Install some of the above mentioned programs:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo apt install git build-essential postgresql postgresql-contrib cmake libmagic-devel
|
sudo apt install git build-essential postgresql postgresql-contrib cmake libmagic-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install Elixir and Erlang
|
### Install Elixir and Erlang
|
||||||
|
@ -54,7 +54,7 @@ sudo apt update
|
||||||
sudo apt install elixir erlang-dev erlang-nox
|
sudo apt install elixir erlang-dev erlang-nox
|
||||||
```
|
```
|
||||||
|
|
||||||
### Optional packages: [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md)
|
### Optional packages: [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo apt install imagemagick ffmpeg libimage-exiftool-perl
|
sudo apt install imagemagick ffmpeg libimage-exiftool-perl
|
||||||
|
@ -98,9 +98,10 @@ sudo -Hu pleroma mix deps.get
|
||||||
* Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
|
* Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mv config/{generated_config.exs,prod.secret.exs}
|
sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
|
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
|
@ -54,7 +54,7 @@ sudo apt update
|
||||||
sudo apt install elixir erlang-dev erlang-nox
|
sudo apt install elixir erlang-dev erlang-nox
|
||||||
```
|
```
|
||||||
|
|
||||||
### オプションパッケージ: [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md)
|
### オプションパッケージ: [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo apt install imagemagick ffmpeg libimage-exiftool-perl
|
sudo apt install imagemagick ffmpeg libimage-exiftool-perl
|
||||||
|
@ -98,7 +98,7 @@ sudo -Hu pleroma mix pleroma.instance gen
|
||||||
|
|
||||||
* コンフィギュレーションを確認して、もし問題なければ、ファイル名を変更してください。
|
* コンフィギュレーションを確認して、もし問題なければ、ファイル名を変更してください。
|
||||||
```
|
```
|
||||||
mv config/{generated_config.exs,prod.secret.exs}
|
sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs}
|
||||||
```
|
```
|
||||||
|
|
||||||
* 先程のコマンドで、すでに `config/setup_db.psql` というファイルが作られています。このファイルをもとに、データベースを作成します。
|
* 先程のコマンドで、すでに `config/setup_db.psql` というファイルが作られています。このファイルをもとに、データベースを作成します。
|
||||||
|
|
|
@ -26,7 +26,7 @@ Setup the required services to automatically start at boot, using `sysrc(8)`.
|
||||||
# service postgresql start
|
# service postgresql start
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md))
|
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# pkg install imagemagick ffmpeg p5-Image-ExifTool
|
# pkg install imagemagick ffmpeg p5-Image-ExifTool
|
||||||
|
|
|
@ -44,7 +44,7 @@ pgsql=YES
|
||||||
|
|
||||||
First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`.
|
First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`.
|
||||||
|
|
||||||
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md))
|
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
|
||||||
|
|
||||||
`# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool`
|
`# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool`
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ Pleroma requires a reverse proxy, OpenBSD has relayd in base (and is used in thi
|
||||||
|
|
||||||
#### Optional software
|
#### Optional software
|
||||||
|
|
||||||
Per [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md):
|
Per [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md):
|
||||||
* ImageMagick
|
* ImageMagick
|
||||||
* ffmpeg
|
* ffmpeg
|
||||||
* exiftool
|
* exiftool
|
||||||
|
|
|
@ -20,7 +20,7 @@ Asenna tarvittava ohjelmisto:
|
||||||
|
|
||||||
#### Optional software
|
#### Optional software
|
||||||
|
|
||||||
[`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md):
|
[`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md):
|
||||||
* ImageMagick
|
* ImageMagick
|
||||||
* ffmpeg
|
* ffmpeg
|
||||||
* exiftool
|
* exiftool
|
||||||
|
|
|
@ -43,7 +43,7 @@ Other than things bundled in the OTP release Pleroma depends on:
|
||||||
|
|
||||||
### Installing optional packages
|
### Installing optional packages
|
||||||
|
|
||||||
Per [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md):
|
Per [`docs/installation/optional/media_graphics_packages.md`](optional/media_graphics_packages.md):
|
||||||
* ImageMagick
|
* ImageMagick
|
||||||
* ffmpeg
|
* ffmpeg
|
||||||
* exiftool
|
* exiftool
|
||||||
|
@ -89,6 +89,8 @@ RUM indexes are an alternative indexing scheme that is not included in PostgreSQ
|
||||||
#### (Optional) Performance configuration
|
#### (Optional) Performance configuration
|
||||||
It is encouraged to check [Optimizing your PostgreSQL performance](../configuration/postgresql.md) document, for tips on PostgreSQL tuning.
|
It is encouraged to check [Optimizing your PostgreSQL performance](../configuration/postgresql.md) document, for tips on PostgreSQL tuning.
|
||||||
|
|
||||||
|
Restart PostgreSQL to apply configuration changes:
|
||||||
|
|
||||||
=== "Alpine"
|
=== "Alpine"
|
||||||
```
|
```
|
||||||
rc-service postgresql restart
|
rc-service postgresql restart
|
||||||
|
@ -99,17 +101,6 @@ It is encouraged to check [Optimizing your PostgreSQL performance](../configurat
|
||||||
systemctl restart postgresql
|
systemctl restart postgresql
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using PostgreSQL 12 or higher, add this to your Ecto database configuration
|
|
||||||
|
|
||||||
```elixir
|
|
||||||
#
|
|
||||||
config :pleroma, Pleroma.Repo,
|
|
||||||
prepare: :named,
|
|
||||||
parameters: [
|
|
||||||
plan_cache_mode: "force_custom_plan"
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Installing Pleroma
|
### Installing Pleroma
|
||||||
```sh
|
```sh
|
||||||
# Create a Pleroma user
|
# Create a Pleroma user
|
||||||
|
@ -311,4 +302,3 @@ This will create an account withe the username of 'joeuser' with the email addre
|
||||||
## Questions
|
## Questions
|
||||||
|
|
||||||
Questions about the installation or didn’t it work as it should be, ask in [#pleroma:matrix.org](https://matrix.heldscal.la/#/room/#freenode_#pleroma:matrix.org) or IRC Channel **#pleroma** on **Freenode**.
|
Questions about the installation or didn’t it work as it should be, ask in [#pleroma:matrix.org](https://matrix.heldscal.la/#/room/#freenode_#pleroma:matrix.org) or IRC Channel **#pleroma** on **Freenode**.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# A simple shell script to delete a media from Apache's mod_disk_cache.
|
||||||
|
# You will likely need to setup a sudo rule like the following:
|
||||||
|
#
|
||||||
|
# Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean
|
||||||
|
# pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN
|
||||||
|
#
|
||||||
|
# Please also ensure you have enabled:
|
||||||
|
#
|
||||||
|
# config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, url_format: :htcacheclean
|
||||||
|
#
|
||||||
|
# which will correctly format the URLs passed to this script for the htcacheclean utility.
|
||||||
|
#
|
||||||
|
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
|
||||||
|
# mod_disk_cache directory
|
||||||
|
CACHE_DIRECTORY="/tmp/pleroma-media-cache"
|
||||||
|
|
||||||
|
## Removes an item via the htcacheclean utility
|
||||||
|
## $1 - the filename, can be a pattern .
|
||||||
|
## $2 - the cache directory.
|
||||||
|
purge_item() {
|
||||||
|
sudo htcacheclean -v -p "${2}" "${1}"
|
||||||
|
} # purge_item
|
||||||
|
|
||||||
|
purge() {
|
||||||
|
for url in $@
|
||||||
|
do
|
||||||
|
echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)"
|
||||||
|
purge_item "$url" $CACHE_DIRECTORY
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
purge $@
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
project_id="74"
|
project_id="74"
|
||||||
project_branch="rebase/glitch-soc"
|
project_branch="rebase/glitch-soc"
|
||||||
|
@ -9,29 +9,32 @@ static_dir="instance/static"
|
||||||
# project_branch="pleroma"
|
# project_branch="pleroma"
|
||||||
# static_dir="priv/static"
|
# static_dir="priv/static"
|
||||||
|
|
||||||
if [[ ! -d "${static_dir}" ]]
|
if [ ! -d "${static_dir}" ]
|
||||||
then
|
then
|
||||||
echo "Error: ${static_dir} directory is missing, are you sure you are running this script at the root of pleroma’s repository?"
|
echo "Error: ${static_dir} directory is missing, are you sure you are running this script at the root of pleroma’s repository?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
last_modified="$(curl -s -I 'https://git.pleroma.social/api/v4/projects/'${project_id}'/jobs/artifacts/'${project_branch}'/download?job=build' | grep '^Last-Modified:' | cut -d: -f2-)"
|
last_modified="$(curl --fail -s -I 'https://git.pleroma.social/api/v4/projects/'${project_id}'/jobs/artifacts/'${project_branch}'/download?job=build' | grep '^Last-Modified:' | cut -d: -f2-)"
|
||||||
|
|
||||||
echo "branch:${project_branch}"
|
echo "branch:${project_branch}"
|
||||||
echo "Last-Modified:${last_modified}"
|
echo "Last-Modified:${last_modified}"
|
||||||
|
|
||||||
artifact="mastofe.zip"
|
artifact="mastofe.zip"
|
||||||
|
|
||||||
if [[ -e mastofe.timestamp ]] && [[ "${last_modified}" != "" ]]
|
if [ "${last_modified}x" = "x" ]
|
||||||
then
|
then
|
||||||
if [[ "$(cat mastofe.timestamp)" == "${last_modified}" ]]
|
echo "ERROR: Couldn't get the modification date of the latest build archive, maybe it expired, exiting..."
|
||||||
then
|
exit 1
|
||||||
echo "MastoFE is up-to-date, exiting…"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit
|
if [ -e mastofe.timestamp ] && [ "$(cat mastofe.timestamp)" = "${last_modified}" ]
|
||||||
|
then
|
||||||
|
echo "MastoFE is up-to-date, exiting..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl --fail -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit
|
||||||
|
|
||||||
# TODO: Update the emoji as well
|
# TODO: Update the emoji as well
|
||||||
rm -fr "${static_dir}/sw.js" "${static_dir}/packs" || exit
|
rm -fr "${static_dir}/sw.js" "${static_dir}/packs" || exit
|
||||||
|
|
|
@ -1,73 +1,84 @@
|
||||||
# default Apache site config for Pleroma
|
# Sample Apache config for Pleroma
|
||||||
#
|
|
||||||
# needed modules: define headers proxy proxy_http proxy_wstunnel rewrite ssl
|
|
||||||
# optional modules: cache cache_disk
|
|
||||||
#
|
#
|
||||||
# Simple installation instructions:
|
# Simple installation instructions:
|
||||||
# 1. Install your TLS certificate, possibly using Let's Encrypt.
|
# 1. Install your TLS certificate. We recommend using Let's Encrypt via Certbot
|
||||||
# 2. Replace 'example.tld' with your instance's domain wherever it appears.
|
# 2. Replace 'example.tld' with your instance's domain.
|
||||||
# 3. This assumes a Debian style Apache config. Copy this file to
|
# 3. This assumes a Debian-style Apache config. Copy this file to
|
||||||
# /etc/apache2/sites-available/ and then add a symlink to it in
|
# /etc/apache2/sites-available/ and then activate the site by running
|
||||||
# /etc/apache2/sites-enabled/ by running 'a2ensite pleroma-apache.conf', then restart Apache.
|
# 'a2ensite pleroma-apache.conf', then restart Apache.
|
||||||
#
|
#
|
||||||
# Optional: enable disk-based caching for the media proxy
|
# Optional: enable disk-based caching for the media proxy
|
||||||
# For details, see https://git.pleroma.social/pleroma/pleroma/wikis/How%20to%20activate%20mediaproxy
|
# For details, see https://git.pleroma.social/pleroma/pleroma/wikis/How%20to%20activate%20mediaproxy
|
||||||
#
|
#
|
||||||
# 1. Create the directory listed below as the CacheRoot, and make sure
|
# 1. Create a directory as shown below for the CacheRoot and make sure
|
||||||
# the Apache user can write to it.
|
# the Apache user can write to it.
|
||||||
# 2. Configure Apache's htcacheclean to clean the directory periodically.
|
# 2. Configure Apache's htcacheclean to clean the directory periodically.
|
||||||
# 3. Run 'a2enmod cache cache_disk' and restart Apache.
|
# Your OS may provide a service you can enable to do this automatically.
|
||||||
|
|
||||||
Define servername example.tld
|
Define servername example.tld
|
||||||
|
|
||||||
|
<IfModule !proxy_module>
|
||||||
|
LoadModule proxy_module libexec/apache24/mod_proxy.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !proxy_http_module>
|
||||||
|
LoadModule proxy_http_module libexec/apache24/mod_proxy_http.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !proxy_wstunnel_module>
|
||||||
|
LoadModule proxy_wstunnel_module libexec/apache24/mod_proxy_wstunnel.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !rewrite_module>
|
||||||
|
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !ssl_module>
|
||||||
|
LoadModule ssl_module libexec/apache24/mod_ssl.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !cache_module>
|
||||||
|
LoadModule cache_module libexec/apache24/mod_cache.so
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !cache_disk_module>
|
||||||
|
LoadModule cache_disk_module libexec/apache24/mod_cache_disk.so
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
ServerName ${servername}
|
ServerName ${servername}
|
||||||
ServerTokens Prod
|
ServerTokens Prod
|
||||||
|
|
||||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
# If you want Pleroma-specific logs
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
#ErrorLog /var/log/httpd-pleroma-error.log
|
||||||
|
#CustomLog /var/log/httpd-pleroma-access.log combined
|
||||||
|
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
Redirect permanent / https://${servername}
|
RewriteEngine on
|
||||||
|
RewriteCond %{SERVER_NAME} =${servername}
|
||||||
|
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
SSLCertificateFile /etc/letsencrypt/live/${servername}/fullchain.pem
|
SSLCertificateFile /etc/letsencrypt/live/${servername}/fullchain.pem
|
||||||
SSLCertificateKeyFile /etc/letsencrypt/live/${servername}/privkey.pem
|
SSLCertificateKeyFile /etc/letsencrypt/live/${servername}/privkey.pem
|
||||||
|
# Make sure you have the certbot-apache module installed
|
||||||
|
Include /etc/letsencrypt/options-ssl-apache.conf
|
||||||
|
|
||||||
# Mozilla modern configuration, tweak to your needs
|
# Uncomment the following to enable MediaProxy caching on disk
|
||||||
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
|
#CacheRoot /tmp/pleroma-media-cache/
|
||||||
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
|
|
||||||
SSLHonorCipherOrder on
|
|
||||||
SSLCompression off
|
|
||||||
SSLSessionTickets off
|
|
||||||
|
|
||||||
# uncomment the following to enable mediaproxy caching on disk
|
|
||||||
# <IfModule mod_cache_disk.c>
|
|
||||||
# CacheRoot /var/cache/apache2/mod_cache_disk
|
|
||||||
#CacheDirLevels 1
|
#CacheDirLevels 1
|
||||||
#CacheDirLength 2
|
#CacheDirLength 2
|
||||||
#CacheEnable disk /proxy
|
#CacheEnable disk /proxy
|
||||||
#CacheLock on
|
#CacheLock on
|
||||||
# </IfModule>
|
#CacheHeader on
|
||||||
|
#CacheDetailHeader on
|
||||||
|
## 16MB max filesize for caching, configure as desired
|
||||||
|
#CacheMaxFileSize 16000000
|
||||||
|
#CacheDefaultExpire 86400
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{HTTP:Connection} Upgrade [NC]
|
RewriteCond %{HTTP:Connection} Upgrade [NC]
|
||||||
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
||||||
RewriteRule /(.*) ws://localhost:4000/$1 [P,L]
|
RewriteRule /(.*) ws://127.0.0.1:4000/$1 [P,L]
|
||||||
|
|
||||||
|
#ProxyRequests must be off or you open your server to abuse as an open proxy
|
||||||
ProxyRequests off
|
ProxyRequests off
|
||||||
# this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only
|
|
||||||
# and `localhost.` resolves to [::0] on some systems: see issue #930
|
|
||||||
ProxyPass / http://127.0.0.1:4000/
|
ProxyPass / http://127.0.0.1:4000/
|
||||||
ProxyPassReverse / http://127.0.0.1:4000/
|
ProxyPassReverse / http://127.0.0.1:4000/
|
||||||
|
|
||||||
RequestHeader set Host ${servername}
|
|
||||||
ProxyPreserveHost On
|
ProxyPreserveHost On
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
# OCSP Stapling, only in httpd 2.3.3 and later
|
|
||||||
SSLUseStapling on
|
|
||||||
SSLStaplingResponderTimeout 5
|
|
||||||
SSLStaplingReturnResponderErrors off
|
|
||||||
SSLStaplingCache shmcb:/var/run/ocsp(128000)
|
|
||||||
|
|
|
@ -93,9 +93,4 @@ server {
|
||||||
chunked_transfer_encoding on;
|
chunked_transfer_encoding on;
|
||||||
proxy_pass http://phoenix;
|
proxy_pass http://phoenix;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/fedsocket/v1 {
|
|
||||||
proxy_request_buffering off;
|
|
||||||
proxy_pass http://phoenix/api/fedsocket/v1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@ ProtectHome=true
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
; Sets up a new /dev mount for the process and only adds API pseudo devices like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled by default because it may not work on devices like the Raspberry Pi.
|
; Sets up a new /dev mount for the process and only adds API pseudo devices like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled by default because it may not work on devices like the Raspberry Pi.
|
||||||
PrivateDevices=false
|
PrivateDevices=false
|
||||||
; Ensures that the service process and all its children can never gain new privileges through execve().
|
|
||||||
NoNewPrivileges=true
|
|
||||||
; Drops the sysadmin capability from the daemon.
|
; Drops the sysadmin capability from the daemon.
|
||||||
CapabilityBoundingSet=~CAP_SYS_ADMIN
|
CapabilityBoundingSet=~CAP_SYS_ADMIN
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,13 @@ sub vcl_backend_response {
|
||||||
set beresp.http.CR = beresp.http.content-range;
|
set beresp.http.CR = beresp.http.content-range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Bypass cache for large files
|
||||||
|
# 50000000 ~ 50MB
|
||||||
|
if (std.integer(beresp.http.content-length, 0) > 50000000) {
|
||||||
|
set beresp.uncacheable = true;
|
||||||
|
return(deliver);
|
||||||
|
}
|
||||||
|
|
||||||
# Don't cache objects that require authentication
|
# Don't cache objects that require authentication
|
||||||
if (beresp.http.Authorization && !beresp.http.Cache-Control ~ "public") {
|
if (beresp.http.Authorization && !beresp.http.Cache-Control ~ "public") {
|
||||||
set beresp.uncacheable = true;
|
set beresp.uncacheable = true;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
Postgrex.Types.define(
|
|
||||||
Pleroma.PostgresTypes,
|
|
||||||
[] ++ Ecto.Adapters.Postgres.extensions(),
|
|
||||||
json: Jason
|
|
||||||
)
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Pleroma do
|
defmodule Mix.Pleroma do
|
||||||
|
@ -12,17 +12,20 @@ defmodule Mix.Pleroma do
|
||||||
:cachex,
|
:cachex,
|
||||||
:flake_id,
|
:flake_id,
|
||||||
:swoosh,
|
:swoosh,
|
||||||
:timex
|
:timex,
|
||||||
|
:fast_html,
|
||||||
|
:oban
|
||||||
]
|
]
|
||||||
@cachex_children ["object", "user", "scrubber", "web_resp"]
|
@cachex_children ["object", "user", "scrubber", "web_resp"]
|
||||||
@doc "Common functions to be reused in mix tasks"
|
@doc "Common functions to be reused in mix tasks"
|
||||||
def start_pleroma do
|
def start_pleroma do
|
||||||
Pleroma.Config.Holder.save_default()
|
Pleroma.Config.Holder.save_default()
|
||||||
Pleroma.Config.Oban.warn()
|
Pleroma.Config.Oban.warn()
|
||||||
|
Pleroma.Application.limiters_setup()
|
||||||
Application.put_env(:phoenix, :serve_endpoints, false, persistent: true)
|
Application.put_env(:phoenix, :serve_endpoints, false, persistent: true)
|
||||||
|
|
||||||
if Pleroma.Config.get(:env) != :test do
|
unless System.get_env("DEBUG") do
|
||||||
Application.put_env(:logger, :console, level: :debug)
|
Logger.remove_backend(:console)
|
||||||
end
|
end
|
||||||
|
|
||||||
adapter = Application.get_env(:tesla, :adapter)
|
adapter = Application.get_env(:tesla, :adapter)
|
||||||
|
@ -36,12 +39,23 @@ def start_pleroma do
|
||||||
|
|
||||||
Enum.each(apps, &Application.ensure_all_started/1)
|
Enum.each(apps, &Application.ensure_all_started/1)
|
||||||
|
|
||||||
|
oban_config = [
|
||||||
|
crontab: [],
|
||||||
|
repo: Pleroma.Repo,
|
||||||
|
log: false,
|
||||||
|
queues: [],
|
||||||
|
plugins: []
|
||||||
|
]
|
||||||
|
|
||||||
children =
|
children =
|
||||||
[
|
[
|
||||||
Pleroma.Repo,
|
Pleroma.Repo,
|
||||||
|
Pleroma.Emoji,
|
||||||
{Pleroma.Config.TransferTask, false},
|
{Pleroma.Config.TransferTask, false},
|
||||||
Pleroma.Web.Endpoint,
|
Pleroma.Web.Endpoint,
|
||||||
{Oban, Pleroma.Config.get(Oban)}
|
{Oban, oban_config},
|
||||||
|
{Majic.Pool,
|
||||||
|
[name: Pleroma.MajicPool, pool_size: Pleroma.Config.get([:majic_pool, :size], 2)]}
|
||||||
] ++
|
] ++
|
||||||
http_children(adapter)
|
http_children(adapter)
|
||||||
|
|
||||||
|
@ -97,12 +111,6 @@ def shell_prompt(prompt, defval \\ nil, defname \\ nil) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def shell_yes?(message) do
|
|
||||||
if mix_shell?(),
|
|
||||||
do: Mix.shell().yes?("Continue?"),
|
|
||||||
else: shell_prompt(message, "Continue?") in ~w(Yn Y y)
|
|
||||||
end
|
|
||||||
|
|
||||||
def shell_info(message) do
|
def shell_info(message) do
|
||||||
if mix_shell?(),
|
if mix_shell?(),
|
||||||
do: Mix.shell().info(message),
|
do: Mix.shell().info(message),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.App do
|
defmodule Mix.Tasks.Pleroma.App do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Benchmark do
|
defmodule Mix.Tasks.Pleroma.Benchmark do
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Config do
|
defmodule Mix.Tasks.Pleroma.Config do
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
|
import Ecto.Query
|
||||||
import Mix.Pleroma
|
import Mix.Pleroma
|
||||||
|
|
||||||
alias Pleroma.ConfigDB
|
alias Pleroma.ConfigDB
|
||||||
|
@ -14,11 +15,14 @@ defmodule Mix.Tasks.Pleroma.Config do
|
||||||
@moduledoc File.read!("docs/administration/CLI_tasks/config.md")
|
@moduledoc File.read!("docs/administration/CLI_tasks/config.md")
|
||||||
|
|
||||||
def run(["migrate_to_db"]) do
|
def run(["migrate_to_db"]) do
|
||||||
|
check_configdb(fn ->
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
migrate_to_db()
|
migrate_to_db()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["migrate_from_db" | options]) do
|
def run(["migrate_from_db" | options]) do
|
||||||
|
check_configdb(fn ->
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
{opts, _} =
|
{opts, _} =
|
||||||
|
@ -28,12 +32,182 @@ def run(["migrate_from_db" | options]) do
|
||||||
)
|
)
|
||||||
|
|
||||||
migrate_from_db(opts)
|
migrate_from_db(opts)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["dump"]) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
header = config_header()
|
||||||
|
|
||||||
|
settings =
|
||||||
|
ConfigDB
|
||||||
|
|> Repo.all()
|
||||||
|
|> Enum.sort()
|
||||||
|
|
||||||
|
unless settings == [] do
|
||||||
|
shell_info("#{header}")
|
||||||
|
|
||||||
|
Enum.each(settings, &dump(&1))
|
||||||
|
else
|
||||||
|
shell_error("No settings in ConfigDB.")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["dump", group, key]) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
group = maybe_atomize(group)
|
||||||
|
key = maybe_atomize(key)
|
||||||
|
|
||||||
|
group
|
||||||
|
|> ConfigDB.get_by_group_and_key(key)
|
||||||
|
|> dump()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["dump", group]) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
group = maybe_atomize(group)
|
||||||
|
|
||||||
|
dump_group(group)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["groups"]) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
groups =
|
||||||
|
ConfigDB
|
||||||
|
|> distinct([c], true)
|
||||||
|
|> select([c], c.group)
|
||||||
|
|> Repo.all()
|
||||||
|
|
||||||
|
if length(groups) > 0 do
|
||||||
|
shell_info("The following configuration groups are set in ConfigDB:\r\n")
|
||||||
|
groups |> Enum.each(fn x -> shell_info("- #{x}") end)
|
||||||
|
shell_info("\r\n")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["reset", "--force"]) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
start_pleroma()
|
||||||
|
truncatedb()
|
||||||
|
shell_info("The ConfigDB settings have been removed from the database.")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["reset"]) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
shell_info("The following settings will be permanently removed:")
|
||||||
|
|
||||||
|
ConfigDB
|
||||||
|
|> Repo.all()
|
||||||
|
|> Enum.sort()
|
||||||
|
|> Enum.each(&dump(&1))
|
||||||
|
|
||||||
|
shell_error("\nTHIS CANNOT BE UNDONE!")
|
||||||
|
|
||||||
|
if shell_prompt("Are you sure you want to continue?", "n") in ~w(Yn Y y) do
|
||||||
|
truncatedb()
|
||||||
|
|
||||||
|
shell_info("The ConfigDB settings have been removed from the database.")
|
||||||
|
else
|
||||||
|
shell_error("No changes made.")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["delete", "--force", group, key]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
group = maybe_atomize(group)
|
||||||
|
key = maybe_atomize(key)
|
||||||
|
|
||||||
|
with true <- key_exists?(group, key) do
|
||||||
|
shell_info("The following settings will be removed from ConfigDB:\n")
|
||||||
|
|
||||||
|
group
|
||||||
|
|> ConfigDB.get_by_group_and_key(key)
|
||||||
|
|> dump()
|
||||||
|
|
||||||
|
delete_key(group, key)
|
||||||
|
else
|
||||||
|
_ ->
|
||||||
|
shell_error("No settings in ConfigDB for #{inspect(group)}, #{inspect(key)}. Aborting.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["delete", "--force", group]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
group = maybe_atomize(group)
|
||||||
|
|
||||||
|
with true <- group_exists?(group) do
|
||||||
|
shell_info("The following settings will be removed from ConfigDB:\n")
|
||||||
|
dump_group(group)
|
||||||
|
delete_group(group)
|
||||||
|
else
|
||||||
|
_ -> shell_error("No settings in ConfigDB for #{inspect(group)}. Aborting.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["delete", group, key]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
group = maybe_atomize(group)
|
||||||
|
key = maybe_atomize(key)
|
||||||
|
|
||||||
|
with true <- key_exists?(group, key) do
|
||||||
|
shell_info("The following settings will be removed from ConfigDB:\n")
|
||||||
|
|
||||||
|
group
|
||||||
|
|> ConfigDB.get_by_group_and_key(key)
|
||||||
|
|> dump()
|
||||||
|
|
||||||
|
if shell_prompt("Are you sure you want to continue?", "n") in ~w(Yn Y y) do
|
||||||
|
delete_key(group, key)
|
||||||
|
else
|
||||||
|
shell_error("No changes made.")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
_ ->
|
||||||
|
shell_error("No settings in ConfigDB for #{inspect(group)}, #{inspect(key)}. Aborting.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def run(["delete", group]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
group = maybe_atomize(group)
|
||||||
|
|
||||||
|
with true <- group_exists?(group) do
|
||||||
|
shell_info("The following settings will be removed from ConfigDB:\n")
|
||||||
|
dump_group(group)
|
||||||
|
|
||||||
|
if shell_prompt("Are you sure you want to continue?", "n") in ~w(Yn Y y) do
|
||||||
|
delete_group(group)
|
||||||
|
else
|
||||||
|
shell_error("No changes made.")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
_ -> shell_error("No settings in ConfigDB for #{inspect(group)}. Aborting.")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec migrate_to_db(Path.t() | nil) :: any()
|
@spec migrate_to_db(Path.t() | nil) :: any()
|
||||||
def migrate_to_db(file_path \\ nil) do
|
def migrate_to_db(file_path \\ nil) do
|
||||||
with true <- Pleroma.Config.get([:configurable_from_database]),
|
with :ok <- Pleroma.Config.DeprecationWarnings.warn() do
|
||||||
:ok <- Pleroma.Config.DeprecationWarnings.warn() do
|
|
||||||
config_file =
|
config_file =
|
||||||
if file_path do
|
if file_path do
|
||||||
file_path
|
file_path
|
||||||
|
@ -47,16 +221,15 @@ def migrate_to_db(file_path \\ nil) do
|
||||||
|
|
||||||
do_migrate_to_db(config_file)
|
do_migrate_to_db(config_file)
|
||||||
else
|
else
|
||||||
:error -> deprecation_error()
|
_ ->
|
||||||
_ -> migration_error()
|
shell_error("Migration is not allowed until all deprecation warnings have been resolved.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_migrate_to_db(config_file) do
|
defp do_migrate_to_db(config_file) do
|
||||||
if File.exists?(config_file) do
|
if File.exists?(config_file) do
|
||||||
shell_info("Migrating settings from file: #{Path.expand(config_file)}")
|
shell_info("Migrating settings from file: #{Path.expand(config_file)}")
|
||||||
Ecto.Adapters.SQL.query!(Repo, "TRUNCATE config;")
|
truncatedb()
|
||||||
Ecto.Adapters.SQL.query!(Repo, "ALTER SEQUENCE config_id_seq RESTART;")
|
|
||||||
|
|
||||||
custom_config =
|
custom_config =
|
||||||
config_file
|
config_file
|
||||||
|
@ -80,11 +253,10 @@ defp create(group, settings) do
|
||||||
shell_info("Settings for key #{key} migrated.")
|
shell_info("Settings for key #{key} migrated.")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
shell_info("Settings for group :#{group} migrated.")
|
shell_info("Settings for group #{inspect(group)} migrated.")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp migrate_from_db(opts) do
|
defp migrate_from_db(opts) do
|
||||||
if Pleroma.Config.get([:configurable_from_database]) do
|
|
||||||
env = opts[:env] || Pleroma.Config.get(:env)
|
env = opts[:env] || Pleroma.Config.get(:env)
|
||||||
|
|
||||||
config_path =
|
config_path =
|
||||||
|
@ -111,19 +283,6 @@ defp migrate_from_db(opts) do
|
||||||
shell_info(
|
shell_info(
|
||||||
"Database configuration settings have been exported to config/#{env}.exported_from_db.secret.exs"
|
"Database configuration settings have been exported to config/#{env}.exported_from_db.secret.exs"
|
||||||
)
|
)
|
||||||
else
|
|
||||||
migration_error()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp migration_error do
|
|
||||||
shell_error(
|
|
||||||
"Migration is not allowed in config. You can change this behavior by setting `config :pleroma, configurable_from_database: true`"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp deprecation_error do
|
|
||||||
shell_error("Migration is not allowed until all deprecation warnings have been resolved.")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if Code.ensure_loaded?(Config.Reader) do
|
if Code.ensure_loaded?(Config.Reader) do
|
||||||
|
@ -150,8 +309,80 @@ defp write(config, file) do
|
||||||
|
|
||||||
defp delete(config, true) do
|
defp delete(config, true) do
|
||||||
{:ok, _} = Repo.delete(config)
|
{:ok, _} = Repo.delete(config)
|
||||||
shell_info("#{config.key} deleted from DB.")
|
|
||||||
|
shell_info(
|
||||||
|
"config #{inspect(config.group)}, #{inspect(config.key)} was deleted from the ConfigDB."
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp delete(_config, _), do: :ok
|
defp delete(_config, _), do: :ok
|
||||||
|
|
||||||
|
defp dump(%ConfigDB{} = config) do
|
||||||
|
value = inspect(config.value, limit: :infinity)
|
||||||
|
|
||||||
|
shell_info("config #{inspect(config.group)}, #{inspect(config.key)}, #{value}\r\n\r\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
defp dump(_), do: :noop
|
||||||
|
|
||||||
|
defp dump_group(group) when is_atom(group) do
|
||||||
|
group
|
||||||
|
|> ConfigDB.get_all_by_group()
|
||||||
|
|> Enum.each(&dump/1)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp group_exists?(group) do
|
||||||
|
group
|
||||||
|
|> ConfigDB.get_all_by_group()
|
||||||
|
|> Enum.any?()
|
||||||
|
end
|
||||||
|
|
||||||
|
defp key_exists?(group, key) do
|
||||||
|
group
|
||||||
|
|> ConfigDB.get_by_group_and_key(key)
|
||||||
|
|> is_nil
|
||||||
|
|> Kernel.!()
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_atomize(arg) when is_atom(arg), do: arg
|
||||||
|
|
||||||
|
defp maybe_atomize(":" <> arg), do: maybe_atomize(arg)
|
||||||
|
|
||||||
|
defp maybe_atomize(arg) when is_binary(arg) do
|
||||||
|
if ConfigDB.module_name?(arg) do
|
||||||
|
String.to_existing_atom("Elixir." <> arg)
|
||||||
|
else
|
||||||
|
String.to_atom(arg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp check_configdb(callback) do
|
||||||
|
with true <- Pleroma.Config.get([:configurable_from_database]) do
|
||||||
|
callback.()
|
||||||
|
else
|
||||||
|
_ ->
|
||||||
|
shell_error(
|
||||||
|
"ConfigDB not enabled. Please check the value of :configurable_from_database in your configuration."
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp delete_key(group, key) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
ConfigDB.delete(%{group: group, key: key})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp delete_group(group) do
|
||||||
|
check_configdb(fn ->
|
||||||
|
group
|
||||||
|
|> ConfigDB.get_all_by_group()
|
||||||
|
|> Enum.each(&ConfigDB.delete/1)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp truncatedb do
|
||||||
|
Ecto.Adapters.SQL.query!(Repo, "TRUNCATE config;")
|
||||||
|
Ecto.Adapters.SQL.query!(Repo, "ALTER SEQUENCE config_id_seq RESTART;")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.CountStatuses do
|
defmodule Mix.Tasks.Pleroma.CountStatuses do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Database do
|
defmodule Mix.Tasks.Pleroma.Database do
|
||||||
|
@ -48,9 +48,15 @@ def run(["bump_all_conversations"]) do
|
||||||
def run(["update_users_following_followers_counts"]) do
|
def run(["update_users_following_followers_counts"]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
User
|
Repo.transaction(
|
||||||
|> Repo.all()
|
fn ->
|
||||||
|> Enum.each(&User.update_follower_count/1)
|
from(u in User, select: u)
|
||||||
|
|> Repo.stream()
|
||||||
|
|> Stream.each(&User.update_follower_count/1)
|
||||||
|
|> Stream.run()
|
||||||
|
end,
|
||||||
|
timeout: :infinity
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["prune_objects" | args]) do
|
def run(["prune_objects" | args]) do
|
||||||
|
@ -161,4 +167,51 @@ def run(["ensure_expiration"]) do
|
||||||
end)
|
end)
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def run(["set_text_search_config", tsconfig]) do
|
||||||
|
start_pleroma()
|
||||||
|
%{rows: [[tsc]]} = Ecto.Adapters.SQL.query!(Pleroma.Repo, "SHOW default_text_search_config;")
|
||||||
|
shell_info("Current default_text_search_config: #{tsc}")
|
||||||
|
|
||||||
|
%{rows: [[db]]} = Ecto.Adapters.SQL.query!(Pleroma.Repo, "SELECT current_database();")
|
||||||
|
shell_info("Update default_text_search_config: #{tsconfig}")
|
||||||
|
|
||||||
|
%{messages: msg} =
|
||||||
|
Ecto.Adapters.SQL.query!(
|
||||||
|
Pleroma.Repo,
|
||||||
|
"ALTER DATABASE #{db} SET default_text_search_config = '#{tsconfig}';"
|
||||||
|
)
|
||||||
|
|
||||||
|
# non-exist config will not raise excpetion but only give >0 messages
|
||||||
|
if length(msg) > 0 do
|
||||||
|
shell_info("Error: #{inspect(msg, pretty: true)}")
|
||||||
|
else
|
||||||
|
rum_enabled = Pleroma.Config.get([:database, :rum_enabled])
|
||||||
|
shell_info("Recreate index, RUM: #{rum_enabled}")
|
||||||
|
|
||||||
|
# Note SQL below needs to be kept up-to-date with latest GIN or RUM index definition in future
|
||||||
|
if rum_enabled do
|
||||||
|
Ecto.Adapters.SQL.query!(
|
||||||
|
Pleroma.Repo,
|
||||||
|
"CREATE OR REPLACE FUNCTION objects_fts_update() RETURNS trigger AS $$ BEGIN
|
||||||
|
new.fts_content := to_tsvector(new.data->>'content');
|
||||||
|
RETURN new;
|
||||||
|
END
|
||||||
|
$$ LANGUAGE plpgsql"
|
||||||
|
)
|
||||||
|
|
||||||
|
shell_info("Refresh RUM index")
|
||||||
|
Ecto.Adapters.SQL.query!(Pleroma.Repo, "UPDATE objects SET updated_at = NOW();")
|
||||||
|
else
|
||||||
|
Ecto.Adapters.SQL.query!(Pleroma.Repo, "DROP INDEX IF EXISTS objects_fts;")
|
||||||
|
|
||||||
|
Ecto.Adapters.SQL.query!(
|
||||||
|
Pleroma.Repo,
|
||||||
|
"CREATE INDEX objects_fts ON objects USING gin(to_tsvector('#{tsconfig}', data->>'content')); "
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
shell_info('Done.')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Digest do
|
defmodule Mix.Tasks.Pleroma.Digest do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Docs do
|
defmodule Mix.Tasks.Pleroma.Docs do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-onl
|
# SPDX-License-Identifier: AGPL-3.0-onl
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Ecto do
|
defmodule Mix.Tasks.Pleroma.Ecto do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-onl
|
# SPDX-License-Identifier: AGPL-3.0-onl
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Ecto.Migrate do
|
defmodule Mix.Tasks.Pleroma.Ecto.Migrate do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-onl
|
# SPDX-License-Identifier: AGPL-3.0-onl
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
|
defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
|
||||||
|
@ -20,7 +20,8 @@ defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
|
||||||
start: :boolean,
|
start: :boolean,
|
||||||
quiet: :boolean,
|
quiet: :boolean,
|
||||||
log_sql: :boolean,
|
log_sql: :boolean,
|
||||||
migrations_path: :string
|
migrations_path: :string,
|
||||||
|
env: :string
|
||||||
]
|
]
|
||||||
|
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
|
@ -59,7 +60,7 @@ def run(args \\ []) do
|
||||||
level = Logger.level()
|
level = Logger.level()
|
||||||
Logger.configure(level: :info)
|
Logger.configure(level: :info)
|
||||||
|
|
||||||
if Pleroma.Config.get(:env) == :test do
|
if opts[:env] == "test" do
|
||||||
Logger.info("Rollback succesfully")
|
Logger.info("Rollback succesfully")
|
||||||
else
|
else
|
||||||
{:ok, _, _} =
|
{:ok, _, _} =
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Email do
|
defmodule Mix.Tasks.Pleroma.Email do
|
||||||
|
@ -33,12 +33,12 @@ def run(["resend_confirmation_emails"]) do
|
||||||
|
|
||||||
Pleroma.User.Query.build(%{
|
Pleroma.User.Query.build(%{
|
||||||
local: true,
|
local: true,
|
||||||
deactivated: false,
|
is_active: true,
|
||||||
confirmation_pending: true,
|
is_confirmed: false,
|
||||||
invisible: false
|
invisible: false
|
||||||
})
|
})
|
||||||
|> Pleroma.Repo.chunk_stream(500)
|
|> Pleroma.Repo.chunk_stream(500)
|
||||||
|> Stream.each(&Pleroma.User.try_send_confirmation_email(&1))
|
|> Stream.each(&Pleroma.User.maybe_send_confirmation_email(&1))
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Emoji do
|
defmodule Mix.Tasks.Pleroma.Emoji do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Frontend do
|
defmodule Mix.Tasks.Pleroma.Frontend do
|
||||||
|
@ -17,8 +17,6 @@ def run(["install", "none" | _args]) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["install", frontend | args]) do
|
def run(["install", frontend | args]) do
|
||||||
log_level = Logger.level()
|
|
||||||
Logger.configure(level: :warn)
|
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
{options, [], []} =
|
{options, [], []} =
|
||||||
|
@ -33,109 +31,6 @@ def run(["install", frontend | args]) do
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
instance_static_dir =
|
Pleroma.Frontend.install(frontend, options)
|
||||||
with nil <- options[:static_dir] do
|
|
||||||
Pleroma.Config.get!([:instance, :static_dir])
|
|
||||||
end
|
|
||||||
|
|
||||||
cmd_frontend_info = %{
|
|
||||||
"name" => frontend,
|
|
||||||
"ref" => options[:ref],
|
|
||||||
"build_url" => options[:build_url],
|
|
||||||
"build_dir" => options[:build_dir]
|
|
||||||
}
|
|
||||||
|
|
||||||
config_frontend_info = Pleroma.Config.get([:frontends, :available, frontend], %{})
|
|
||||||
|
|
||||||
frontend_info =
|
|
||||||
Map.merge(config_frontend_info, cmd_frontend_info, fn _key, config, cmd ->
|
|
||||||
# This only overrides things that are actually set
|
|
||||||
cmd || config
|
|
||||||
end)
|
|
||||||
|
|
||||||
ref = frontend_info["ref"]
|
|
||||||
|
|
||||||
unless ref do
|
|
||||||
raise "No ref given or configured"
|
|
||||||
end
|
|
||||||
|
|
||||||
dest =
|
|
||||||
Path.join([
|
|
||||||
instance_static_dir,
|
|
||||||
"frontends",
|
|
||||||
frontend,
|
|
||||||
ref
|
|
||||||
])
|
|
||||||
|
|
||||||
fe_label = "#{frontend} (#{ref})"
|
|
||||||
|
|
||||||
tmp_dir = Path.join([instance_static_dir, "frontends", "tmp"])
|
|
||||||
|
|
||||||
with {_, :ok} <-
|
|
||||||
{:download_or_unzip, download_or_unzip(frontend_info, tmp_dir, options[:file])},
|
|
||||||
shell_info("Installing #{fe_label} to #{dest}"),
|
|
||||||
:ok <- install_frontend(frontend_info, tmp_dir, dest) do
|
|
||||||
File.rm_rf!(tmp_dir)
|
|
||||||
shell_info("Frontend #{fe_label} installed to #{dest}")
|
|
||||||
|
|
||||||
Logger.configure(level: log_level)
|
|
||||||
else
|
|
||||||
{:download_or_unzip, _} ->
|
|
||||||
shell_info("Could not download or unzip the frontend")
|
|
||||||
|
|
||||||
_e ->
|
|
||||||
shell_info("Could not install the frontend")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp download_or_unzip(frontend_info, temp_dir, file) do
|
|
||||||
if file do
|
|
||||||
with {:ok, zip} <- File.read(Path.expand(file)) do
|
|
||||||
unzip(zip, temp_dir)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
download_build(frontend_info, temp_dir)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def unzip(zip, dest) do
|
|
||||||
with {:ok, unzipped} <- :zip.unzip(zip, [:memory]) do
|
|
||||||
File.rm_rf!(dest)
|
|
||||||
File.mkdir_p!(dest)
|
|
||||||
|
|
||||||
Enum.each(unzipped, fn {filename, data} ->
|
|
||||||
path = filename
|
|
||||||
|
|
||||||
new_file_path = Path.join(dest, path)
|
|
||||||
|
|
||||||
new_file_path
|
|
||||||
|> Path.dirname()
|
|
||||||
|> File.mkdir_p!()
|
|
||||||
|
|
||||||
File.write!(new_file_path, data)
|
|
||||||
end)
|
|
||||||
|
|
||||||
:ok
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp download_build(frontend_info, dest) do
|
|
||||||
shell_info("Downloading pre-built bundle for #{frontend_info["name"]}")
|
|
||||||
url = String.replace(frontend_info["build_url"], "${ref}", frontend_info["ref"])
|
|
||||||
|
|
||||||
with {:ok, %{status: 200, body: zip_body}} <-
|
|
||||||
Pleroma.HTTP.get(url, [], pool: :media, recv_timeout: 120_000) do
|
|
||||||
unzip(zip_body, dest)
|
|
||||||
else
|
|
||||||
e -> {:error, e}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp install_frontend(frontend_info, source, dest) do
|
|
||||||
from = frontend_info["build_dir"] || "dist"
|
|
||||||
File.rm_rf!(dest)
|
|
||||||
File.mkdir_p!(dest)
|
|
||||||
File.cp_r!(Path.join([source, from]), dest)
|
|
||||||
:ok
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Instance do
|
defmodule Mix.Tasks.Pleroma.Instance do
|
||||||
|
@ -161,12 +161,21 @@ def run(["gen" | rest]) do
|
||||||
)
|
)
|
||||||
|> Path.expand()
|
|> Path.expand()
|
||||||
|
|
||||||
|
{strip_uploads_message, strip_uploads_default} =
|
||||||
|
if Pleroma.Utils.command_available?("exiftool") do
|
||||||
|
{"Do you want to strip location (GPS) data from uploaded images? This requires exiftool, it was detected as installed. (y/n)",
|
||||||
|
"y"}
|
||||||
|
else
|
||||||
|
{"Do you want to strip location (GPS) data from uploaded images? This requires exiftool, it was detected as not installed, please install it if you answer yes. (y/n)",
|
||||||
|
"n"}
|
||||||
|
end
|
||||||
|
|
||||||
strip_uploads =
|
strip_uploads =
|
||||||
get_option(
|
get_option(
|
||||||
options,
|
options,
|
||||||
:strip_uploads,
|
:strip_uploads,
|
||||||
"Do you want to strip location (GPS) data from uploaded images? (y/n)",
|
strip_uploads_message,
|
||||||
"y"
|
strip_uploads_default
|
||||||
) === "y"
|
) === "y"
|
||||||
|
|
||||||
anonymize_uploads =
|
anonymize_uploads =
|
||||||
|
@ -233,6 +242,13 @@ def run(["gen" | rest]) do
|
||||||
rum_enabled: rum_enabled
|
rum_enabled: rum_enabled
|
||||||
)
|
)
|
||||||
|
|
||||||
|
config_dir = Path.dirname(config_path)
|
||||||
|
psql_dir = Path.dirname(psql_path)
|
||||||
|
|
||||||
|
[config_dir, psql_dir, static_dir, uploads_dir]
|
||||||
|
|> Enum.reject(&File.exists?/1)
|
||||||
|
|> Enum.map(&File.mkdir_p!/1)
|
||||||
|
|
||||||
shell_info("Writing config to #{config_path}.")
|
shell_info("Writing config to #{config_path}.")
|
||||||
|
|
||||||
File.write(config_path, result_config)
|
File.write(config_path, result_config)
|
||||||
|
@ -253,7 +269,7 @@ def run(["gen" | rest]) do
|
||||||
else
|
else
|
||||||
shell_error(
|
shell_error(
|
||||||
"The task would have overwritten the following files:\n" <>
|
"The task would have overwritten the following files:\n" <>
|
||||||
(Enum.map(paths, &"- #{&1}\n") |> Enum.join("")) <>
|
(Enum.map(will_overwrite, &"- #{&1}\n") |> Enum.join("")) <>
|
||||||
"Rerun with `--force` to overwrite them."
|
"Rerun with `--force` to overwrite them."
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -266,10 +282,6 @@ defp write_robots_txt(static_dir, indexable, template_dir) do
|
||||||
indexable: indexable
|
indexable: indexable
|
||||||
)
|
)
|
||||||
|
|
||||||
unless File.exists?(static_dir) do
|
|
||||||
File.mkdir_p!(static_dir)
|
|
||||||
end
|
|
||||||
|
|
||||||
robots_txt_path = Path.join(static_dir, "robots.txt")
|
robots_txt_path = Path.join(static_dir, "robots.txt")
|
||||||
|
|
||||||
if File.exists?(robots_txt_path) do
|
if File.exists?(robots_txt_path) do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.NotificationSettings do
|
defmodule Mix.Tasks.Pleroma.NotificationSettings do
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
defmodule Mix.Tasks.Pleroma.OpenapiSpec do
|
||||||
|
def run([path]) do
|
||||||
|
# Load Pleroma application to get version info
|
||||||
|
Application.load(:pleroma)
|
||||||
|
spec = Pleroma.Web.ApiSpec.spec(server_specific: false) |> Jason.encode!()
|
||||||
|
File.write(path, spec)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.RefreshCounterCache do
|
defmodule Mix.Tasks.Pleroma.RefreshCounterCache do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Relay do
|
defmodule Mix.Tasks.Pleroma.Relay do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.RobotsTxt do
|
defmodule Mix.Tasks.Pleroma.RobotsTxt do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.Uploads do
|
defmodule Mix.Tasks.Pleroma.Uploads do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Mix.Tasks.Pleroma.User do
|
defmodule Mix.Tasks.Pleroma.User do
|
||||||
|
@ -60,7 +60,7 @@ def run(["new", nickname, email | rest]) do
|
||||||
- admin: #{if(admin?, do: "true", else: "false")}
|
- admin: #{if(admin?, do: "true", else: "false")}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
proceed? = assume_yes? or shell_yes?("Continue?")
|
proceed? = assume_yes? or shell_prompt("Continue?", "n") in ~w(Yn Y y)
|
||||||
|
|
||||||
if proceed? do
|
if proceed? do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
@ -74,7 +74,7 @@ def run(["new", nickname, email | rest]) do
|
||||||
bio: bio
|
bio: bio
|
||||||
}
|
}
|
||||||
|
|
||||||
changeset = User.register_changeset(%User{}, params, need_confirmation: false)
|
changeset = User.register_changeset(%User{}, params, is_confirmed: true)
|
||||||
{:ok, _user} = User.register(changeset)
|
{:ok, _user} = User.register(changeset)
|
||||||
|
|
||||||
shell_info("User #{nickname} created")
|
shell_info("User #{nickname} created")
|
||||||
|
@ -107,21 +107,6 @@ def run(["rm", nickname]) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["toggle_activated", nickname]) do
|
|
||||||
start_pleroma()
|
|
||||||
|
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
|
||||||
{:ok, user} = User.deactivate(user, !user.deactivated)
|
|
||||||
|
|
||||||
shell_info(
|
|
||||||
"Activation status of #{nickname}: #{if(user.deactivated, do: "de", else: "")}activated"
|
|
||||||
)
|
|
||||||
else
|
|
||||||
_ ->
|
|
||||||
shell_error("No user #{nickname}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def run(["reset_password", nickname]) do
|
def run(["reset_password", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
|
@ -156,20 +141,41 @@ def run(["reset_mfa", nickname]) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def run(["activate", nickname]) do
|
||||||
|
start_pleroma()
|
||||||
|
|
||||||
|
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
||||||
|
false <- user.is_active do
|
||||||
|
User.set_activation(user, true)
|
||||||
|
:timer.sleep(500)
|
||||||
|
|
||||||
|
shell_info("Successfully activated #{nickname}")
|
||||||
|
else
|
||||||
|
true ->
|
||||||
|
shell_info("User #{nickname} already activated")
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
shell_error("No user #{nickname}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def run(["deactivate", nickname]) do
|
def run(["deactivate", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
||||||
shell_info("Deactivating #{user.nickname}")
|
true <- user.is_active do
|
||||||
User.deactivate(user)
|
User.set_activation(user, false)
|
||||||
:timer.sleep(500)
|
:timer.sleep(500)
|
||||||
|
|
||||||
user = User.get_cached_by_id(user.id)
|
user = User.get_cached_by_id(user.id)
|
||||||
|
|
||||||
if Enum.empty?(Enum.filter(User.get_friends(user), & &1.local)) do
|
if Enum.empty?(Enum.filter(User.get_friends(user), & &1.local)) do
|
||||||
shell_info("Successfully unsubscribed all local followers from #{user.nickname}")
|
shell_info("Successfully deactivated #{nickname} and unsubscribed all local followers")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
false ->
|
||||||
|
shell_info("User #{nickname} already deactivated")
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
shell_error("No user #{nickname}")
|
shell_error("No user #{nickname}")
|
||||||
end
|
end
|
||||||
|
@ -213,7 +219,7 @@ def run(["set", nickname | rest]) do
|
||||||
user =
|
user =
|
||||||
case Keyword.get(options, :confirmed) do
|
case Keyword.get(options, :confirmed) do
|
||||||
nil -> user
|
nil -> user
|
||||||
value -> set_confirmed(user, value)
|
value -> set_confirmation(user, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
user =
|
user =
|
||||||
|
@ -345,13 +351,13 @@ def run(["delete_activities", nickname]) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["toggle_confirmed", nickname]) do
|
def run(["confirm", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
||||||
{:ok, user} = User.toggle_confirmation(user)
|
{:ok, user} = User.confirm(user)
|
||||||
|
|
||||||
message = if user.confirmation_pending, do: "needs", else: "doesn't need"
|
message = if !user.is_confirmed, do: "needs", else: "doesn't need"
|
||||||
|
|
||||||
shell_info("#{nickname} #{message} confirmation.")
|
shell_info("#{nickname} #{message} confirmation.")
|
||||||
else
|
else
|
||||||
|
@ -365,7 +371,7 @@ def run(["confirm_all"]) do
|
||||||
|
|
||||||
Pleroma.User.Query.build(%{
|
Pleroma.User.Query.build(%{
|
||||||
local: true,
|
local: true,
|
||||||
deactivated: false,
|
is_active: true,
|
||||||
is_moderator: false,
|
is_moderator: false,
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
invisible: false
|
invisible: false
|
||||||
|
@ -373,7 +379,7 @@ def run(["confirm_all"]) do
|
||||||
|> Pleroma.Repo.chunk_stream(500, :batches)
|
|> Pleroma.Repo.chunk_stream(500, :batches)
|
||||||
|> Stream.each(fn users ->
|
|> Stream.each(fn users ->
|
||||||
users
|
users
|
||||||
|> Enum.each(fn user -> User.need_confirmation(user, false) end)
|
|> Enum.each(fn user -> User.set_confirmation(user, true) end)
|
||||||
end)
|
end)
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
end
|
end
|
||||||
|
@ -383,7 +389,7 @@ def run(["unconfirm_all"]) do
|
||||||
|
|
||||||
Pleroma.User.Query.build(%{
|
Pleroma.User.Query.build(%{
|
||||||
local: true,
|
local: true,
|
||||||
deactivated: false,
|
is_active: true,
|
||||||
is_moderator: false,
|
is_moderator: false,
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
invisible: false
|
invisible: false
|
||||||
|
@ -391,7 +397,7 @@ def run(["unconfirm_all"]) do
|
||||||
|> Pleroma.Repo.chunk_stream(500, :batches)
|
|> Pleroma.Repo.chunk_stream(500, :batches)
|
||||||
|> Stream.each(fn users ->
|
|> Stream.each(fn users ->
|
||||||
users
|
users
|
||||||
|> Enum.each(fn user -> User.need_confirmation(user, true) end)
|
|> Enum.each(fn user -> User.set_confirmation(user, false) end)
|
||||||
end)
|
end)
|
||||||
|> Stream.run()
|
|> Stream.run()
|
||||||
end
|
end
|
||||||
|
@ -420,7 +426,7 @@ def run(["list"]) do
|
||||||
shell_info(
|
shell_info(
|
||||||
"#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{
|
"#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{
|
||||||
user.is_locked
|
user.is_locked
|
||||||
}, deactivated: #{user.deactivated}"
|
}, is_active: #{user.is_active}"
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -454,10 +460,10 @@ defp set_locked(user, value) do
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
defp set_confirmed(user, value) do
|
defp set_confirmation(user, value) do
|
||||||
{:ok, user} = User.need_confirmation(user, !value)
|
{:ok, user} = User.set_confirmation(user, value)
|
||||||
|
|
||||||
shell_info("Confirmation pending status of #{user.nickname}: #{user.confirmation_pending}")
|
shell_info("Confirmation status of #{user.nickname}: #{user.is_confirmed}")
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Phoenix.Transports.WebSocket.Raw do
|
defmodule Phoenix.Transports.WebSocket.Raw do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Activity do
|
defmodule Pleroma.Activity do
|
||||||
|
@ -14,6 +14,7 @@ defmodule Pleroma.Activity do
|
||||||
alias Pleroma.ReportNote
|
alias Pleroma.ReportNote
|
||||||
alias Pleroma.ThreadMute
|
alias Pleroma.ThreadMute
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
|
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
@ -23,6 +24,8 @@ defmodule Pleroma.Activity do
|
||||||
|
|
||||||
@primary_key {:id, FlakeId.Ecto.CompatType, autogenerate: true}
|
@primary_key {:id, FlakeId.Ecto.CompatType, autogenerate: true}
|
||||||
|
|
||||||
|
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
||||||
|
|
||||||
schema "activities" do
|
schema "activities" do
|
||||||
field(:data, :map)
|
field(:data, :map)
|
||||||
field(:local, :boolean, default: true)
|
field(:local, :boolean, default: true)
|
||||||
|
@ -153,6 +156,18 @@ def get_bookmark(%Activity{} = activity, %User{} = user) do
|
||||||
|
|
||||||
def get_bookmark(_, _), do: nil
|
def get_bookmark(_, _), do: nil
|
||||||
|
|
||||||
|
def get_report(activity_id) do
|
||||||
|
opts = %{
|
||||||
|
type: "Flag",
|
||||||
|
skip_preload: true,
|
||||||
|
preload_report_notes: true
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityPub.fetch_activities_query([], opts)
|
||||||
|
|> where(id: ^activity_id)
|
||||||
|
|> Repo.one()
|
||||||
|
end
|
||||||
|
|
||||||
def change(struct, params \\ %{}) do
|
def change(struct, params \\ %{}) do
|
||||||
struct
|
struct
|
||||||
|> cast(params, [:data, :recipients])
|
|> cast(params, [:data, :recipients])
|
||||||
|
@ -181,6 +196,19 @@ def get_by_id(id) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_by_id_with_user_actor(id) do
|
||||||
|
case FlakeId.flake_id?(id) do
|
||||||
|
true ->
|
||||||
|
Activity
|
||||||
|
|> where([a], a.id == ^id)
|
||||||
|
|> with_preloaded_user_actor()
|
||||||
|
|> Repo.one()
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def get_by_id_with_object(id) do
|
def get_by_id_with_object(id) do
|
||||||
Activity
|
Activity
|
||||||
|> where(id: ^id)
|
|> where(id: ^id)
|
||||||
|
@ -246,7 +274,7 @@ defp get_in_reply_to_activity_from_object(%Object{data: %{"inReplyTo" => ap_id}}
|
||||||
defp get_in_reply_to_activity_from_object(_), do: nil
|
defp get_in_reply_to_activity_from_object(_), do: nil
|
||||||
|
|
||||||
def get_in_reply_to_activity(%Activity{} = activity) do
|
def get_in_reply_to_activity(%Activity{} = activity) do
|
||||||
get_in_reply_to_activity_from_object(Object.normalize(activity))
|
get_in_reply_to_activity_from_object(Object.normalize(activity, fetch: false))
|
||||||
end
|
end
|
||||||
|
|
||||||
def normalize(obj) when is_map(obj), do: get_by_ap_id_with_object(obj["id"])
|
def normalize(obj) when is_map(obj), do: get_by_ap_id_with_object(obj["id"])
|
||||||
|
@ -272,7 +300,7 @@ def delete_all_by_object_ap_id(_), do: nil
|
||||||
|
|
||||||
defp purge_web_resp_cache(%Activity{} = activity) do
|
defp purge_web_resp_cache(%Activity{} = activity) do
|
||||||
%{path: path} = URI.parse(activity.data["id"])
|
%{path: path} = URI.parse(activity.data["id"])
|
||||||
Cachex.del(:web_resp_cache, path)
|
@cachex.del(:web_resp_cache, path)
|
||||||
activity
|
activity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Activity.Ir.Topics do
|
defmodule Pleroma.Activity.Ir.Topics do
|
||||||
|
@ -8,7 +8,7 @@ defmodule Pleroma.Activity.Ir.Topics do
|
||||||
|
|
||||||
def get_activity_topics(activity) do
|
def get_activity_topics(activity) do
|
||||||
activity
|
activity
|
||||||
|> Object.normalize()
|
|> Object.normalize(fetch: false)
|
||||||
|> generate_topics(activity)
|
|> generate_topics(activity)
|
||||||
|> List.flatten()
|
|> List.flatten()
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,8 @@ defp visibility_tags(object, activity) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp item_creation_tags(tags, object, %{data: %{"type" => "Create"}} = activity) do
|
defp item_creation_tags(tags, object, %{data: %{"type" => "Create"}} = activity) do
|
||||||
tags ++ hashtags_to_topics(object) ++ attachment_topics(object, activity)
|
tags ++
|
||||||
|
remote_topics(activity) ++ hashtags_to_topics(object) ++ attachment_topics(object, activity)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp item_creation_tags(tags, _, _) do
|
defp item_creation_tags(tags, _, _) do
|
||||||
|
@ -55,9 +56,19 @@ defp hashtags_to_topics(%{data: %{"tag" => tags}}) do
|
||||||
|
|
||||||
defp hashtags_to_topics(_), do: []
|
defp hashtags_to_topics(_), do: []
|
||||||
|
|
||||||
|
defp remote_topics(%{local: true}), do: []
|
||||||
|
|
||||||
|
defp remote_topics(%{actor: actor}) when is_binary(actor),
|
||||||
|
do: ["public:remote:" <> URI.parse(actor).host]
|
||||||
|
|
||||||
|
defp remote_topics(_), do: []
|
||||||
|
|
||||||
defp attachment_topics(%{data: %{"attachment" => []}}, _act), do: []
|
defp attachment_topics(%{data: %{"attachment" => []}}, _act), do: []
|
||||||
|
|
||||||
defp attachment_topics(_object, %{local: true}), do: ["public:media", "public:local:media"]
|
defp attachment_topics(_object, %{local: true}), do: ["public:media", "public:local:media"]
|
||||||
|
|
||||||
|
defp attachment_topics(_object, %{actor: actor}) when is_binary(actor),
|
||||||
|
do: ["public:media", "public:remote:media:" <> URI.parse(actor).host]
|
||||||
|
|
||||||
defp attachment_topics(_object, _act), do: ["public:media"]
|
defp attachment_topics(_object, _act), do: ["public:media"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Activity.Queries do
|
defmodule Pleroma.Activity.Queries do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Activity.Search do
|
defmodule Pleroma.Activity.Search do
|
||||||
|
@ -19,11 +19,18 @@ def search(user, search_query, options \\ []) do
|
||||||
offset = Keyword.get(options, :offset, 0)
|
offset = Keyword.get(options, :offset, 0)
|
||||||
author = Keyword.get(options, :author)
|
author = Keyword.get(options, :author)
|
||||||
|
|
||||||
|
search_function =
|
||||||
|
if :persistent_term.get({Pleroma.Repo, :postgres_version}) >= 11 do
|
||||||
|
:websearch
|
||||||
|
else
|
||||||
|
:plain
|
||||||
|
end
|
||||||
|
|
||||||
Activity
|
Activity
|
||||||
|> Activity.with_preloaded_object()
|
|> Activity.with_preloaded_object()
|
||||||
|> Activity.restrict_deactivated_users()
|
|> Activity.restrict_deactivated_users()
|
||||||
|> restrict_public()
|
|> restrict_public()
|
||||||
|> query_with(index_type, search_query)
|
|> query_with(index_type, search_query, search_function)
|
||||||
|> maybe_restrict_local(user)
|
|> maybe_restrict_local(user)
|
||||||
|> maybe_restrict_author(author)
|
|> maybe_restrict_author(author)
|
||||||
|> maybe_restrict_blocked(user)
|
|> maybe_restrict_blocked(user)
|
||||||
|
@ -53,22 +60,45 @@ defp restrict_public(q) do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp query_with(q, :gin, search_query) do
|
defp query_with(q, :gin, search_query, :plain) do
|
||||||
from([a, o] in q,
|
from([a, o] in q,
|
||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
"to_tsvector('english', ?->>'content') @@ plainto_tsquery('english', ?)",
|
"to_tsvector(?->>'content') @@ plainto_tsquery(?)",
|
||||||
o.data,
|
o.data,
|
||||||
^search_query
|
^search_query
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp query_with(q, :rum, search_query) do
|
defp query_with(q, :gin, search_query, :websearch) do
|
||||||
from([a, o] in q,
|
from([a, o] in q,
|
||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
"? @@ plainto_tsquery('english', ?)",
|
"to_tsvector(?->>'content') @@ websearch_to_tsquery(?)",
|
||||||
|
o.data,
|
||||||
|
^search_query
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp query_with(q, :rum, search_query, :plain) do
|
||||||
|
from([a, o] in q,
|
||||||
|
where:
|
||||||
|
fragment(
|
||||||
|
"? @@ plainto_tsquery(?)",
|
||||||
|
o.fts_content,
|
||||||
|
^search_query
|
||||||
|
),
|
||||||
|
order_by: [fragment("? <=> now()::date", o.inserted_at)]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp query_with(q, :rum, search_query, :websearch) do
|
||||||
|
from([a, o] in q,
|
||||||
|
where:
|
||||||
|
fragment(
|
||||||
|
"? @@ websearch_to_tsquery(?)",
|
||||||
o.fts_content,
|
o.fts_content,
|
||||||
^search_query
|
^search_query
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Application do
|
defmodule Pleroma.Application do
|
||||||
|
@ -14,7 +14,7 @@ defmodule Pleroma.Application do
|
||||||
@name Mix.Project.config()[:name]
|
@name Mix.Project.config()[:name]
|
||||||
@version Mix.Project.config()[:version]
|
@version Mix.Project.config()[:version]
|
||||||
@repository Mix.Project.config()[:source_url]
|
@repository Mix.Project.config()[:source_url]
|
||||||
@env Mix.env()
|
@mix_env Mix.env()
|
||||||
|
|
||||||
def name, do: @name
|
def name, do: @name
|
||||||
def version, do: @version
|
def version, do: @version
|
||||||
|
@ -57,6 +57,7 @@ def start(_type, _args) do
|
||||||
setup_instrumenters()
|
setup_instrumenters()
|
||||||
load_custom_modules()
|
load_custom_modules()
|
||||||
Pleroma.Docs.JSON.compile()
|
Pleroma.Docs.JSON.compile()
|
||||||
|
limiters_setup()
|
||||||
|
|
||||||
adapter = Application.get_env(:tesla, :adapter)
|
adapter = Application.get_env(:tesla, :adapter)
|
||||||
|
|
||||||
|
@ -91,25 +92,46 @@ def start(_type, _args) do
|
||||||
Pleroma.Web.Plugs.RateLimiter.Supervisor
|
Pleroma.Web.Plugs.RateLimiter.Supervisor
|
||||||
] ++
|
] ++
|
||||||
cachex_children() ++
|
cachex_children() ++
|
||||||
http_children(adapter, @env) ++
|
http_children(adapter, @mix_env) ++
|
||||||
[
|
[
|
||||||
Pleroma.Stats,
|
Pleroma.Stats,
|
||||||
Pleroma.JobQueueMonitor,
|
Pleroma.JobQueueMonitor,
|
||||||
{Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]},
|
{Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]},
|
||||||
{Oban, Config.get(Oban)}
|
{Oban, Config.get(Oban)},
|
||||||
|
Pleroma.Web.Endpoint
|
||||||
] ++
|
] ++
|
||||||
task_children(@env) ++
|
task_children(@mix_env) ++
|
||||||
dont_run_in_test(@env) ++
|
dont_run_in_test(@mix_env) ++
|
||||||
chat_child(chat_enabled?()) ++
|
chat_child(chat_enabled?()) ++
|
||||||
[
|
[
|
||||||
Pleroma.Web.Endpoint,
|
|
||||||
Pleroma.Gopher.Server
|
Pleroma.Gopher.Server
|
||||||
]
|
]
|
||||||
|
|
||||||
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
|
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
|
||||||
# for other strategies and supported options
|
# for other strategies and supported options
|
||||||
opts = [strategy: :one_for_one, name: Pleroma.Supervisor]
|
opts = [strategy: :one_for_one, name: Pleroma.Supervisor]
|
||||||
Supervisor.start_link(children, opts)
|
result = Supervisor.start_link(children, opts)
|
||||||
|
|
||||||
|
set_postgres_server_version()
|
||||||
|
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
|
defp set_postgres_server_version do
|
||||||
|
version =
|
||||||
|
with %{rows: [[version]]} <- Ecto.Adapters.SQL.query!(Pleroma.Repo, "show server_version"),
|
||||||
|
{num, _} <- Float.parse(version) do
|
||||||
|
num
|
||||||
|
else
|
||||||
|
e ->
|
||||||
|
Logger.warn(
|
||||||
|
"Could not get the postgres version: #{inspect(e)}.\nSetting the default value of 9.6"
|
||||||
|
)
|
||||||
|
|
||||||
|
9.6
|
||||||
|
end
|
||||||
|
|
||||||
|
:persistent_term.put({Pleroma.Repo, :postgres_version}, version)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_custom_modules do
|
def load_custom_modules do
|
||||||
|
@ -123,7 +145,7 @@ def load_custom_modules do
|
||||||
raise "Invalid custom modules"
|
raise "Invalid custom modules"
|
||||||
|
|
||||||
{:ok, modules, _warnings} ->
|
{:ok, modules, _warnings} ->
|
||||||
if @env != :test do
|
if @mix_env != :test do
|
||||||
Enum.each(modules, fn mod ->
|
Enum.each(modules, fn mod ->
|
||||||
Logger.info("Custom module loaded: #{inspect(mod)}")
|
Logger.info("Custom module loaded: #{inspect(mod)}")
|
||||||
end)
|
end)
|
||||||
|
@ -168,7 +190,11 @@ defp cachex_children do
|
||||||
build_cachex("web_resp", limit: 2500),
|
build_cachex("web_resp", limit: 2500),
|
||||||
build_cachex("emoji_packs", expiration: emoji_packs_expiration(), limit: 10),
|
build_cachex("emoji_packs", expiration: emoji_packs_expiration(), limit: 10),
|
||||||
build_cachex("failed_proxy_url", limit: 2500),
|
build_cachex("failed_proxy_url", limit: 2500),
|
||||||
build_cachex("banned_urls", default_ttl: :timer.hours(24 * 30), limit: 5_000)
|
build_cachex("banned_urls", default_ttl: :timer.hours(24 * 30), limit: 5_000),
|
||||||
|
build_cachex("chat_message_id_idempotency_key",
|
||||||
|
expiration: chat_message_id_idempotency_key_expiration(),
|
||||||
|
limit: 500_000
|
||||||
|
)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -178,6 +204,9 @@ defp emoji_packs_expiration,
|
||||||
defp idempotency_expiration,
|
defp idempotency_expiration,
|
||||||
do: expiration(default: :timer.seconds(6 * 60 * 60), interval: :timer.seconds(60))
|
do: expiration(default: :timer.seconds(6 * 60 * 60), interval: :timer.seconds(60))
|
||||||
|
|
||||||
|
defp chat_message_id_idempotency_key_expiration,
|
||||||
|
do: expiration(default: :timer.minutes(2), interval: :timer.seconds(60))
|
||||||
|
|
||||||
defp seconds_valid_interval,
|
defp seconds_valid_interval,
|
||||||
do: :timer.seconds(Config.get!([Pleroma.Captcha, :seconds_valid]))
|
do: :timer.seconds(Config.get!([Pleroma.Captcha, :seconds_valid]))
|
||||||
|
|
||||||
|
@ -200,8 +229,7 @@ defp dont_run_in_test(_) do
|
||||||
name: Pleroma.Web.Streamer.registry(),
|
name: Pleroma.Web.Streamer.registry(),
|
||||||
keys: :duplicate,
|
keys: :duplicate,
|
||||||
partitions: System.schedulers_online()
|
partitions: System.schedulers_online()
|
||||||
]},
|
]}
|
||||||
Pleroma.Web.FedSockets.Supervisor
|
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -266,4 +294,19 @@ defp http_children(Tesla.Adapter.Gun, _) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp http_children(_, _), do: []
|
defp http_children(_, _), do: []
|
||||||
|
|
||||||
|
@spec limiters_setup() :: :ok
|
||||||
|
def limiters_setup do
|
||||||
|
config = Config.get(ConcurrentLimiter, [])
|
||||||
|
|
||||||
|
[Pleroma.Web.RichMedia.Helpers, Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy]
|
||||||
|
|> Enum.each(fn module ->
|
||||||
|
mod_config = Keyword.get(config, module, [])
|
||||||
|
|
||||||
|
max_running = Keyword.get(mod_config, :max_running, 5)
|
||||||
|
max_waiting = Keyword.get(mod_config, :max_waiting, 5)
|
||||||
|
|
||||||
|
ConcurrentLimiter.new(module, max_running, max_waiting)
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.ApplicationRequirements do
|
defmodule Pleroma.ApplicationRequirements do
|
||||||
|
@ -24,6 +24,7 @@ def verify! do
|
||||||
|> check_migrations_applied!()
|
|> check_migrations_applied!()
|
||||||
|> check_welcome_message_config!()
|
|> check_welcome_message_config!()
|
||||||
|> check_rum!()
|
|> check_rum!()
|
||||||
|
|> check_repo_pool_size!()
|
||||||
|> handle_result()
|
|> handle_result()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,6 +189,30 @@ defp check_system_commands!(:ok) do
|
||||||
|
|
||||||
defp check_system_commands!(result), do: result
|
defp check_system_commands!(result), do: result
|
||||||
|
|
||||||
|
defp check_repo_pool_size!(:ok) do
|
||||||
|
if Pleroma.Config.get([Pleroma.Repo, :pool_size], 10) != 10 and
|
||||||
|
not Pleroma.Config.get([:dangerzone, :override_repo_pool_size], false) do
|
||||||
|
Logger.error("""
|
||||||
|
!!!CONFIG WARNING!!!
|
||||||
|
|
||||||
|
The database pool size has been altered from the recommended value of 10.
|
||||||
|
|
||||||
|
Please revert or ensure your database is tuned appropriately and then set
|
||||||
|
`config :pleroma, :dangerzone, override_repo_pool_size: true`.
|
||||||
|
|
||||||
|
If you are experiencing database timeouts, please check the "Optimizing
|
||||||
|
your PostgreSQL performance" section in the documentation. If you still
|
||||||
|
encounter issues after that, please open an issue on the tracker.
|
||||||
|
""")
|
||||||
|
|
||||||
|
{:error, "Repo.pool_size different than recommended value."}
|
||||||
|
else
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp check_repo_pool_size!(result), do: result
|
||||||
|
|
||||||
defp check_filter(filter, command_required) do
|
defp check_filter(filter, command_required) do
|
||||||
filters = Config.get([Pleroma.Upload, :filters])
|
filters = Config.get([Pleroma.Upload, :filters])
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.BBS.Authenticator do
|
defmodule Pleroma.BBS.Authenticator do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.BBS.Handler do
|
defmodule Pleroma.BBS.Handler do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Bookmark do
|
defmodule Pleroma.Bookmark do
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.Caching do
|
||||||
|
@callback get!(Cachex.cache(), any()) :: any()
|
||||||
|
@callback get(Cachex.cache(), any()) :: {atom(), any()}
|
||||||
|
@callback put(Cachex.cache(), any(), any(), Keyword.t()) :: {Cachex.status(), boolean()}
|
||||||
|
@callback put(Cachex.cache(), any(), any()) :: {Cachex.status(), boolean()}
|
||||||
|
@callback fetch!(Cachex.cache(), any(), function() | nil) :: any()
|
||||||
|
# @callback del(Cachex.cache(), any(), Keyword.t()) :: {Cachex.status(), boolean()}
|
||||||
|
@callback del(Cachex.cache(), any()) :: {Cachex.status(), boolean()}
|
||||||
|
@callback stream!(Cachex.cache(), any()) :: Enumerable.t()
|
||||||
|
@callback expire_at(Cachex.cache(), binary(), number()) :: {Cachex.status(), boolean()}
|
||||||
|
@callback exists?(Cachex.cache(), any()) :: {Cachex.status(), boolean()}
|
||||||
|
@callback execute!(Cachex.cache(), function()) :: any()
|
||||||
|
@callback get_and_update(Cachex.cache(), any(), function()) ::
|
||||||
|
{:commit | :ignore, any()}
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Captcha do
|
defmodule Pleroma.Captcha do
|
||||||
|
@ -7,6 +7,8 @@ defmodule Pleroma.Captcha do
|
||||||
alias Plug.Crypto.KeyGenerator
|
alias Plug.Crypto.KeyGenerator
|
||||||
alias Plug.Crypto.MessageEncryptor
|
alias Plug.Crypto.MessageEncryptor
|
||||||
|
|
||||||
|
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Ask the configured captcha service for a new captcha
|
Ask the configured captcha service for a new captcha
|
||||||
"""
|
"""
|
||||||
|
@ -86,7 +88,7 @@ defp validate_expiration(created_at) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp validate_usage(token) do
|
defp validate_usage(token) do
|
||||||
if is_nil(Cachex.get!(:used_captcha_cache, token)) do
|
if is_nil(@cachex.get!(:used_captcha_cache, token)) do
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
{:error, :already_used}
|
{:error, :already_used}
|
||||||
|
@ -95,7 +97,7 @@ defp validate_usage(token) do
|
||||||
|
|
||||||
defp mark_captcha_as_used(token) do
|
defp mark_captcha_as_used(token) do
|
||||||
ttl = seconds_valid() |> :timer.seconds()
|
ttl = seconds_valid() |> :timer.seconds()
|
||||||
Cachex.put(:used_captcha_cache, token, true, ttl: ttl)
|
@cachex.put(:used_captcha_cache, token, true, ttl: ttl)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp method, do: Pleroma.Config.get!([__MODULE__, :method])
|
defp method, do: Pleroma.Config.get!([__MODULE__, :method])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Captcha.Kocaptcha do
|
defmodule Pleroma.Captcha.Kocaptcha do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Captcha.Native do
|
defmodule Pleroma.Captcha.Native do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Captcha.Service do
|
defmodule Pleroma.Captcha.Service do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Chat do
|
defmodule Pleroma.Chat do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Chat.MessageReference do
|
defmodule Pleroma.Chat.MessageReference do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Clippy do
|
defmodule Pleroma.Clippy do
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Config do
|
defmodule Pleroma.Config do
|
||||||
|
@behaviour Pleroma.Config.Getting
|
||||||
defmodule Error do
|
defmodule Error do
|
||||||
defexception [:message]
|
defexception [:message]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
def get(key), do: get(key, nil)
|
def get(key), do: get(key, nil)
|
||||||
|
|
||||||
|
@impl true
|
||||||
def get([key], default), do: get(key, default)
|
def get([key], default), do: get(key, default)
|
||||||
|
|
||||||
|
@impl true
|
||||||
def get([_ | _] = path, default) do
|
def get([_ | _] = path, default) do
|
||||||
case fetch(path) do
|
case fetch(path) do
|
||||||
{:ok, value} -> value
|
{:ok, value} -> value
|
||||||
|
@ -18,6 +22,7 @@ def get([_ | _] = path, default) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
def get(key, default) do
|
def get(key, default) do
|
||||||
Application.get_env(:pleroma, key, default)
|
Application.get_env(:pleroma, key, default)
|
||||||
end
|
end
|
||||||
|
@ -94,16 +99,4 @@ def restrict_unauthenticated_access?(resource, kind) do
|
||||||
def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], [])
|
def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], [])
|
||||||
|
|
||||||
def oauth_consumer_enabled?, do: oauth_consumer_strategies() != []
|
def oauth_consumer_enabled?, do: oauth_consumer_strategies() != []
|
||||||
|
|
||||||
def enforce_oauth_admin_scope_usage?, do: !!get([:auth, :enforce_oauth_admin_scope_usage])
|
|
||||||
|
|
||||||
def oauth_admin_scopes(scopes) when is_list(scopes) do
|
|
||||||
Enum.flat_map(
|
|
||||||
scopes,
|
|
||||||
fn scope ->
|
|
||||||
["admin:#{scope}"] ++
|
|
||||||
if enforce_oauth_admin_scope_usage?(), do: [], else: [scope]
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Config.DeprecationWarnings do
|
defmodule Pleroma.Config.DeprecationWarnings do
|
||||||
|
@ -40,7 +40,8 @@ def warn do
|
||||||
:ok <- check_welcome_message_config(),
|
:ok <- check_welcome_message_config(),
|
||||||
:ok <- check_gun_pool_options(),
|
:ok <- check_gun_pool_options(),
|
||||||
:ok <- check_activity_expiration_config(),
|
:ok <- check_activity_expiration_config(),
|
||||||
:ok <- check_remote_ip_plug_name() do
|
:ok <- check_remote_ip_plug_name(),
|
||||||
|
:ok <- check_uploders_s3_public_endpoint() do
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -193,4 +194,25 @@ def check_remote_ip_plug_name do
|
||||||
warning_preface
|
warning_preface
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec check_uploders_s3_public_endpoint() :: :ok | nil
|
||||||
|
def check_uploders_s3_public_endpoint do
|
||||||
|
s3_config = Pleroma.Config.get([Pleroma.Uploaders.S3])
|
||||||
|
|
||||||
|
use_old_config = Keyword.has_key?(s3_config, :public_endpoint)
|
||||||
|
|
||||||
|
if use_old_config do
|
||||||
|
Logger.error("""
|
||||||
|
!!!DEPRECATION WARNING!!!
|
||||||
|
Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket.\n
|
||||||
|
Please make the following change at your earliest convenience.\n
|
||||||
|
\n* `config :pleroma, Pleroma.Uploaders.S3, public_endpoint` is now equal to:
|
||||||
|
\n* `config :pleroma, Pleroma.Upload, base_url`
|
||||||
|
""")
|
||||||
|
|
||||||
|
:error
|
||||||
|
else
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.Config.Getting do
|
||||||
|
@callback get(any()) :: any()
|
||||||
|
@callback get(any(), any()) :: any()
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Config.Helpers do
|
defmodule Pleroma.Config.Helpers do
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue