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

This commit is contained in:
itepechi 2025-05-12 03:58:50 +09:00
commit 6288ad06ac
Signed by: itepechi
GPG key ID: D948CE1B5ACD0B25
88 changed files with 1258 additions and 675 deletions

View file

@ -6,18 +6,41 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
### Added
- Prometheus stats now exposes failed ActivityPub deliveries
which failed all attempts and the failure reason
- status and user HTML pages now provide ActivityPub alternate links
- the `prune_objects` mix task no longer deletes pinned posts by default
- added `--prune-pinned` and `--keep-followed {posts,full,none}` options to the `prune_objects` mix task
### Fixed
- Internal actors no longer pretend to have unresolvable follow(er|ing) collections
- fixed user-level default post expiry duration overriding `expires_in` values explicitly passed during post creation
- fix crashes on non-UTF8 usernames for the API paths taking both nicknames and IDs
- fixed divergences in fields used to determine visibility;
this lead e.g. to unlisted replies from Pleroma instances being partially treated as private posts
- fixed our fetch actor advertising bogus follower and following collection ActivityPub IDs
- fix network-path references not being handled by media proxy
### Changed
- Internal and relay actors are now again represented with type "Application"
- `cleanup_attachments` is now enabled by default
- shared inboxes are now generally preferred over personal inboxes, cutting down on duplicate publishing churn
- instance actors are now really of type `Service`
- ActivityPub delivery attempts are spaced out more giving up after 3h instead of ~20min before
## 2025.03
## Added
### Added
- Oban (worker) dashboard at `/akkoma/oban`
## Fixed
### Fixed
- fixed some holes in SigningKey verification potentially allowing they key-user mapping to be poisoned
- frontend ZIP files can no longer traverse to paths outside their install dir
- fixed user updates trying but failing to renew signing key information
- fixed signing key refresh on key rotation
## Changed
### Changed
- Dropped obsolete `ap_enabled` indicator from user table and associated buggy logic
- The remote user count in prometheus metrics is now an estimate instead of an exact number
since the latter proved unreasonably costly to obtain for a merely nice-to-have statistic
@ -31,12 +54,12 @@ Hotfix: Federation could break if a null value found its way into `should_federa
## 2025.01
## Added
### Added
- New config option `:instance, :cleanup_attachments_delay`
- It is now possible to display custom source URLs in akkoma-fe;
the settings are part of the frontend configuration
## Fixed
### Fixed
- Media proxy no longer attempts to proxy embedded images
- Fix significant uneccessary overhead of attachment cleanup;
it no longer attempts to cleanup attachments of deleted remote posts
@ -45,24 +68,24 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- ObjectAge policy no longer leaks belated DMs and follower-only posts
- the NodeINfo endpoint now uses the correct content type
## Changed
### Changed
- Anonymous objects now federate completely without an id
adopting a proposed AP spec errata and restoring federation
with e.g. IceShrimp.NET and fedify-based implementations
## 3.13.3
## BREAKING
### BREAKING
- Minimum PostgreSQL version is raised to 12
- Swagger UI moved from `/akkoma/swaggerui/` to `/pleroma/swaggerui/`
## Added
### Added
- Implement [FEP-67ff](https://codeberg.org/fediverse/fep/src/branch/main/fep/67ff/fep-67ff.md) (federation documentation)
- Meilisearch: it is now possible to use separate keys for search and admin actions
- New standalone `prune_orphaned_activities` mix task with configurable batch limit
- The `prune_objects` mix task now accepts a `--limit` parameter for initial object pruning
## Fixed
### Fixed
- Meilisearch: order of results returned from our REST API now actually matches how Meilisearch ranks results
- Emoji are now federated as anonymous objects, fixing issues with
some strict servers e.g. rejecting e.g. remote emoji reactions
@ -70,25 +93,25 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- Single-selection polls no longer expose the voter_count; MastoAPI demands it be null
and this confused some clients leading to vote distributions >100%
## Changed
### Changed
- Refactored Rich Media to cache the content in the database. Fetching operations that could block status rendering have been eliminated.
## 2024.04.1 (Security)
## Fixed
### Fixed
- Issue allowing non-owners to use media objects in posts
- Issue allowing use of non-media objects as attachments and crashing timeline rendering
- Issue allowing webfinger spoofing in certain situations
## 2024.04
## Added
### Added
- Support for [FEP-fffd](https://codeberg.org/fediverse/fep/src/branch/main/fep/fffd/fep-fffd.md) (proxy objects)
- Verified support for elixir 1.16
- Uploadfilter `Pleroma.Upload.Filter.Exiftool.ReadDescription` returns description values to the FE so they can pre fill the image description field
NOTE: this filter MUST be placed before `Exiftool.StripMetadata` to work
## Changed
### Changed
- Inbound pipeline error handing was modified somewhat, which should lead to less incomprehensible log spam. Hopefully.
- Uploadfilter `Pleroma.Upload.Filter.Exiftool` was replaced by `Pleroma.Upload.Filter.Exiftool.StripMetadata`;
the latter strips all non-essential metadata by default but can be configured.
@ -97,7 +120,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- MRF.InlineQuotePolicy now prefers to insert display URLs instead of ActivityPub IDs
- Old accounts are no longer listed in WebFinger as aliases; this was breaking spec
## Fixed
### Fixed
- Issue preventing fetching anything from IPv6-only instances
- Issue allowing post content to leak via opengraph tags despite :estrict\_unauthenticated being set
- Move activities no longer operate on stale user data
@ -113,17 +136,17 @@ Hotfix: Federation could break if a null value found its way into `should_federa
JSON-LD-compacted forms of public scope; affected e.g. federation with bovine
- Ratelimits encountered when fetching objects are now respected; 429 responses will cause a backoff when we get one.
## Removed
### Removed
- ActivityPub Client-To-Server write API endpoints have been disabled;
read endpoints are planned to be removed next release unless a clear need is demonstrated
## 2024.03
## Added
### Added
- CLI tasks best-effort checking for past abuse of the recent spoofing exploit
- new `:mrf_steal_emoji, :download_unknown_size` option; defaults to `false`
## Changed
### Changed
- `Pleroma.Upload, :base_url` now MUST be configured explicitly if used;
use of the same domain as the instance is **strongly** discouraged
- `:media_proxy, :base_url` now MUST be configured explicitly if used;
@ -139,7 +162,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- Uploads, emoji and media proxy now restrict Content-Type headers to a safe subset
- Akkoma will no longer fetch and parse objects hosted on the same domain
## Fixed
### Fixed
- Critical security issue allowing Akkoma to be used as a vector for
(depending on configuration) impersonation of other users or creation
of bogus users and posts on the upload domain
@ -152,7 +175,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- our litepub JSON-LD schema is now served with the correct content type
- remote APNG attachments are now recognised as images
## Upgrade Notes
### Upgrade Notes
- As mentioned in "Changed", `Pleroma.Upload, :base_url` **MUST** be configured. Uploads will fail without it.
- Akkoma will refuse to start if this is not set.
@ -160,20 +183,20 @@ Hotfix: Federation could break if a null value found its way into `should_federa
## 2024.02
## Added
### Added
- Full compatibility with Erlang OTP26
- handling of GET /api/v1/preferences
- Akkoma API is now documented
- ability to auto-approve follow requests from users you are already following
- The SimplePolicy MRF can now strip user backgrounds from selected remote hosts
## Changed
### Changed
- OTP builds are now built on erlang OTP26
- The base Phoenix framework is now updated to 1.7
- An `outbox` field has been added to actor profiles to comply with AP spec
- User profile backgrounds do now federate with other Akkoma instances and Sharkey
## Fixed
### Fixed
- Documentation issue in which a non-existing nginx file was referenced
- Issue where a bad inbox URL could break federation
- Issue where hashtag rel values would be scrubbed
@ -181,7 +204,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
## 2023.08
## Added
### Added
- Added a new configuration option to the MediaProxy feature that allows the blocking of specific domains from using the media proxy or being explicitly allowed by the Content-Security-Policy.
- Please make sure instances you wanted to block media from are not in the MediaProxy `whitelist`, and instead use `blocklist`.
@ -194,7 +217,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- OTP26 is currently "unsupported". It will probably work, but due to the way
it handles map ordering, the test suite will not pass for it as yet.
## Changed
### Changed
- Alpine OTP builds are now from alpine 3.18, which is OpenSSLv3 compatible.
If you use alpine OTP builds you will have to update your local system.
@ -205,19 +228,19 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- Blocks/Mutes now return from max ID to min ID, in line with mastodon.
- The AnonymizeFilename filter is now enabled by default.
## Fixed
### Fixed
- Deactivated users can no longer show up in the emoji reaction list
- Embedded posts can no longer bypass `:restrict\_unauthenticated`
- GET/HEAD requests will now work when requesting AWS-based instances.
## Security
### Security
- Add `no_new_privs` hardening to OpenRC and systemd service files
- XML parsers cannot load any entities (thanks @Mae@is.badat.dev!)
- Reduced permissions of config files and directories, distros requiring greater permissions like group-read need to pre-create the directories
## Removed
### Removed
- Builds for debian oldstable (bullseye)
- If you are on oldstable you should NOT attempt to update OTP builds without
@ -225,7 +248,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
## 2023.05
## Added
### Added
- Custom options for users to accept/reject private messages
- options: everybody, nobody, people\_i\_follow
- MRF to reject notes from accounts newer than a given age
@ -233,16 +256,16 @@ Hotfix: Federation could break if a null value found its way into `should_federa
post gets boosted outside of your local bubble and people your instance
does not know about reply to it.
## Fixed
### Fixed
- Support for `streams` public key URIs
- Bookmarks are cleaned up on DB prune now
## Security
### Security
- Fixed mediaproxy being a bit of a silly billy
## 2023.04
## Added
### Added
- Nodeinfo keys for unauthenticated timeline visibility
- Option to disable federated timeline
- Option to make the bubble timeline publicly accessible
@ -256,7 +279,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
## 2023.03
## Fixed
### Fixed
- Allowed contentMap to be updated on edit
- Filter creation now accepts expires\_at
@ -316,7 +339,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
## 2022.12
## Added
### Added
- Config: HTTP timeout options, :pool\_timeout and :receive\_timeout
- Added statistic gathering about instances which do/don't have signed fetches when they request from us
- Ability to set a default post expiry time, after which the post will be deleted. If used in concert with ActivityExpiration MRF, the expiry which comes _sooner_ will be applied.
@ -326,7 +349,7 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- Option to extend `reject` in MRF-Simple to apply to entire threads, where the originating instance is rejected
- Extra information to failed HTTP requests
## Changed
### Changed
- MastoAPI: Accept BooleanLike input on `/api/v1/accounts/:id/follow` (fixes follows with mastodon.py)
- Relays from akkoma are now off by default
- NormalizeMarkup MRF is now on by default
@ -335,30 +358,30 @@ Hotfix: Federation could break if a null value found its way into `should_federa
- Overhauled static-fe view for logged-out users
- Blocked instances will now not be sent _any_ requests, even fetch ones that would get rejected by MRF anyhow
## Removed
### Removed
- FollowBotPolicy
- Passing of undo/block into MRF
## Upgrade Notes
### Upgrade Notes
- If you have an old instance, you will probably want to run `mix pleroma.database prune_task` in the foreground to catch it up with the history of your instance.
## 2022.11
## Added
### Added
- Officially supported docker release
- Ability to remove followers unilaterally without a block
- Scraping of nodeinfo from remote instances to display instance info
- `requested_by` in relationships when the user has requested to follow you
## Changed
### Changed
- Follows no longer override domain blocks, a domain block is final
- Deletes are now the lowest priority to publish and will be handled after creates
- Domain blocks are now subdomain-matches by default
## Fixed
### Fixed
- Registrations via ldap are now compatible with the latest OTP24
## Update notes
### Update notes
- If you use LDAP and run from source, please update your elixir/erlang
to the latest. The changes in OTP24.3 are breaking.
- You can now remove the leading `*.` from domain blocks, but you do not have to.
@ -1678,7 +1701,7 @@ curl -Lo ./bin/pleroma_ctl 'https://git.pleroma.social/pleroma/pleroma/raw/devel
- User-Agent is now sent correctly for all HTTP requests.
- MRF: Simple policy now properly delists imported or relayed statuses
## Removed
### Removed
- Configuration: `config :pleroma, :fe` in favor of the more flexible `config :pleroma, :frontend_configurations`
## [0.9.99999] - 2019-05-31

View file

@ -252,7 +252,7 @@
registration_reason_length: 500,
external_user_synchronization: true,
extended_nickname_format: true,
cleanup_attachments: false,
cleanup_attachments: true,
cleanup_attachments_delay: 1800,
multi_factor_authentication: [
totp: [

View file

@ -15,7 +15,7 @@ source venv/bin/activate
pip install -r requirements.txt
# Run an http server who rebuilds when files change
# Accessable on http://127.0.0.1:8000
# Accessible on http://127.0.0.1:8000
mkdocs serve
# Build the docs

View file

@ -1,4 +1,4 @@
# Transfering the config to/from the database
# Transferring the config to/from the database
{! administration/CLI_tasks/general_cli_task_info.include !}
@ -34,9 +34,9 @@
Options:
- `<path>` - where to save migrated config. E.g. `--path=/tmp`. If file saved into non standart folder, you must manually copy file into directory where Pleroma can read it. For OTP install path will be `PLEROMA_CONFIG_PATH` or `/etc/akkoma`. For installation from source - `config` directory in the akkoma folder.
- `<env>` - environment, for which is migrated config. By default is `prod`.
- To delete transferred settings from database optional flag `-d` can be used
- `<path>` - where to save migrated config. E.g. `--path=/tmp`. If the file was saved into a non-standard directory, you must manually copy it into a location where Pleroma can read it. For OTP the install path will be `PLEROMA_CONFIG_PATH` or `/etc/akkoma`. For installation from source its the `config` directory in the akkoma folder.
- `<env>` - environment, for which is migrated config. By default, its `prod`.
- To delete transferred settings from database the optional flag `-d` can be used
=== "OTP"
```sh
@ -48,7 +48,7 @@ Options:
mix pleroma.config migrate_from_db [--env=<env>] [-d] [--path=<path>]
```
## Dump all of the config settings defined in the database
## Dump all config settings defined in the database
=== "OTP"
@ -172,15 +172,16 @@ it may be easier to dump the values to JSON and then modify them in a text edito
=== "From Source"
```sh
mix pleroma.config dump_to_file group key path
mix pleroma.config dump_to_file group key path
# For example, to dump the MRF simple configuration:
mix pleroma.config dump_to_file pleroma mrf_simple /tmp/mrf_simple.json
```
## Loading specific configuration values from JSON
**Note:** This will overwrite any existing value in the database, and can
cause crashes if you do not have exactly the correct formatting.
!!!note
This will overwrite any existing value in the database, and can
cause crashes if you do not have exactly the correct formatting.
Once you have modified the JSON file, you can load it back into the database.
@ -200,6 +201,7 @@ Once you have modified the JSON file, you can load it back into the database.
mix pleroma.config load_from_file /tmp/mrf_simple.json
```
**NOTE** an instance reboot is needed for many changes to take effect,
you may want to visit `/api/v1/pleroma/admin/restart` on your instance
to soft-restart the instance.
!!! note
An instance reboot is needed for many changes to take effect,
you may want to visit `/api/v1/pleroma/admin/restart` on your instance
to soft-restart the instance.

View file

@ -7,7 +7,7 @@
## Replace embedded objects with their references
Replaces embedded objects with references to them in the `objects` table. Only needs to be ran once if the instance was created before Pleroma 1.0.5. The reason why this is not a migration is because it could significantly increase the database size after being ran, however after this `VACUUM FULL` will be able to reclaim about 20% (really depends on what is in the database, your mileage may vary) of the db size before the migration.
Replaces embedded objects with references to them in the `objects` table. Only needs to be ran once if the instance was created before Pleroma 1.0.5. The reason why this is not a migration is because it could significantly increase the database size after being ran, however after this `VACUUM FULL` will be able to reclaim about 20% (really depends on what is in the database, your mileage may vary) of the database size before the migration.
=== "OTP"
@ -29,7 +29,7 @@ Replaces embedded objects with references to them in the `objects` table. Only n
This will prune remote posts older than 90 days (configurable with [`config :pleroma, :instance, remote_post_retention_days`](../../configuration/cheatsheet.md#instance)) from the database. Pruned posts may be refetched in some cases.
!!! note
The disk space will only be reclaimed after a proper vacuum. By default Postgresql does this for you on a regular basis, but if your instance has been running for a long time and there are many rows deleted, it may be advantageous to use `VACUUM FULL` (e.g. by using the `--vacuum` option).
The disk space will only be reclaimed after a proper vacuum. By default, Postgresql does this for you on a regular basis, but if your instance has been running for a long time and there are many rows deleted, it may be advantageous to use `VACUUM FULL` (e.g. by using the `--vacuum` option).
!!! danger
You may run out of disk space during the execution of the task or vacuuming if you don't have about 1/3rds of the database size free. Vacuum causes a substantial increase in I/O traffic, and may lead to a degraded experience while it is running.
@ -48,10 +48,15 @@ This will prune remote posts older than 90 days (configurable with [`config :ple
### Options
- `--keep-threads` - Don't prune posts when they are part of a thread where at least one post has seen local interaction (e.g. one of the posts is a local post, or is favourited by a local user, or has been repeated by a local user...). It also wont delete posts when at least one of the posts in that thread is kept (e.g. because one of the posts has seen recent activity).
- `--keep-followed <mode>` - If set to `posts` all posts and boosts of users with local follows will be kept.
If set to `full` it will additionally keep any posts such users interacted with; this requires `--keep-threads`.
By default this is set to `none` and followed users are not treated special.
- `--keep-threads` - Don't prune posts when they are part of a thread where at least one post has seen local interaction (e.g. one of the posts is a local post, or is favourited by a local user, or has been repeated by a local user...). It also wont delete posts when at least one of the posts in the thread has seen recent activity or is kept due to `--keep-followed`.
- `--keep-non-public` - Keep non-public posts like DM's and followers-only, even if they are remote.
- `--limit` - limits how many remote posts get pruned. This limit does **not** apply to any of the follow up jobs. If wanting to keep the database load in check it is thus advisable to run the standalone `prune_orphaned_activities` task with a limit afterwards instead of passing `--prune-orphaned-activities` to this task.
- `--prune-orphaned-activities` - Also prune orphaned activities afterwards. Activities are things like Like, Create, Announce, Flag (aka reports)... They can significantly help reduce the database size.
- `--prune-pinned` - Also prune pinned posts; keeping pinned posts does not suffice to protect their threads from pruning, even when using `--keep-threads`.
Note, if using this option and pinned posts are pruned, they and their threads will just be refetched on the next user update. Therefore it usually doesn't bring much gain while incurring a heavy fetch load after pruning.
- `--vacuum` - Run `VACUUM FULL` after the objects are pruned. This should not be used on a regular basis, but is useful if your instance has been running for a long time before pruning.
## Prune orphaned activities from the database
@ -130,7 +135,7 @@ Can be safely re-run
## Vacuum the database
!!! note
By default Postgresql has an autovacuum deamon running. While the tasks described here can help in some cases, they shouldn't be needed on a regular basis. See [the Postgresql docs on vacuuming](https://www.postgresql.org/docs/current/sql-vacuum.html) for more information on this.
By default, Postgresql has an autovacuum daemon running. While the tasks described here can help in some cases, they shouldn't be needed on a regular basis. See [the Postgresql docs on vacuuming](https://www.postgresql.org/docs/current/sql-vacuum.html) for more information on this.
### Analyze
@ -150,7 +155,7 @@ Running an `analyze` vacuum job can improve performance by updating statistics u
### Full
Running a `full` vacuum job rebuilds your entire database by reading all of the data and rewriting it into smaller
Running a `full` vacuum job rebuilds your entire database by reading all data and rewriting it into smaller
and more compact files with an optimized layout. This process will take a long time and use additional disk space as
it builds the files side-by-side the existing database files. It can make your database faster and use less disk space,
but should only be run if necessary. **It is safe to cancel this.**
@ -183,7 +188,7 @@ but should only be run if necessary. **It is safe to cancel this.**
## 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).
Change `default_text_search_config` for database and (if necessary) text_search_config used in index, then rebuild index (it may take time).
=== "OTP"
@ -202,9 +207,9 @@ See [PostgreSQL documentation](https://www.postgresql.org/docs/current/textsearc
## Pruning old activities
Over time, transient `Delete` activities and `Tombstone` objects
can accumulate in your database, inflating its size. This is not ideal.
There is a periodic task to prune these transient objects,
but on first run this may take a while on older instances to catch up
can accumulate in your database, inflating its size. This is not ideal.
There is a periodic task to prune these transient objects,
but on the first run this may take a while on older instances to catch up
to the current day.
=== "OTP"

View file

@ -26,5 +26,5 @@ from the perspective of another given user.
`./bin/pleroma_ctl diagnostics user_timeline <nickname> <viewing_nickname>`
=== "From Source"
`mix pleroma.diagnostics user_timeline <nickname> <viewing_nickname>`
`mix pleroma.diagnostics user_timeline <nickname> <viewing_nickname>`

View file

@ -16,7 +16,6 @@
mix pleroma.digest test <nickname> [since_date]
```
Example:
=== "OTP"
@ -30,4 +29,3 @@ Example:
```sh
mix pleroma.digest test donaldtheduck 2019-05-20
```

View file

@ -1,4 +1,4 @@
# EMail administration tasks
# Email administration tasks
{! administration/CLI_tasks/general_cli_task_info.include !}

View file

@ -14,9 +14,8 @@
mix pleroma.emoji ls-packs [option ...]
```
### Options
- `-m, --manifest PATH/URL` - path to a custom manifest, it can either be an URL starting with `http`, in that case the manifest will be fetched from that address, or a local path
- `-m, --manifest PATH/URL` - path to a custom manifest, it can either be a URL starting with `http`, in that case the manifest will be fetched from that address, or a local path
## Fetch, verify and install the specified packs from the manifest into `STATIC-DIR/emoji/PACK-NAME`

View file

@ -12,14 +12,14 @@
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 a local ZIP file, or automatically downloaded from the web.
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:
- [admin-fe](https://akkoma.dev/AkkomaGang/admin-fe)
- [mastodon-fe](https://akkoma.dev/AkkomaGang/masto-fe)
- [masto-fe](https://akkoma.dev/AkkomaGang/masto-fe)
- [pleroma-fe](https://akkoma.dev/AkkomaGang/pleroma-fe)
You can still install frontends that are not configured, see below.
@ -42,7 +42,7 @@ For a frontend configured under the `available` key, it's enough to install it b
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 an Akkoma-FE build from a different URL, you could do this:
You can override any of the details. To install an akkoma-fe build from a different URL, you could do this:
=== "OTP"
@ -56,7 +56,7 @@ You can override any of the details. To install an Akkoma-FE build from a differ
mix pleroma.frontend install pleroma-fe --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.
=== "OTP"
@ -90,5 +90,4 @@ The installation process is the same, but you will have to give all the needed o
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}`.

View file

@ -1,5 +1,5 @@
Every command should be ran as the `akkoma` user from it's home directory. For example if you are superuser, you would have to wrap the command in `su akkoma -s $SHELL -lc "$COMMAND"`.
Every command should be ran as the `akkoma` user from its home directory. For example if you are superuser, you would have to wrap the command in `su akkoma -s $SHELL -lc "$COMMAND"`.
??? note "From source note about `MIX_ENV`"
The `mix` command should be prefixed with the name of environment your Akkoma server is running in, usually it's `MIX_ENV=prod`
The `mix` command should be prefixed with the name of the environment your Akkoma server is running in, usually it's `MIX_ENV=prod`

View file

@ -15,7 +15,6 @@
mix pleroma.instance gen [option ...]
```
If any of the options are left unspecified, you will be prompted interactively.
### Options
@ -35,11 +34,11 @@ If any of the options are left unspecified, you will be prompted interactively.
- `--db-configurable <Y|N>` - Allow/disallow configuring instance from admin part
- `--uploads-dir <path>` - the directory uploads go in when using a local uploader
- `--static-dir <path>` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)
- `--listen-ip <ip>` - the ip the app should listen to, defaults to 127.0.0.1
- `--listen-ip <ip>` - the IP the app should listen to, defaults to 127.0.0.1
- `--listen-port <port>` - the port the app should listen to, defaults to 4000
- `--strip-uploads-metadata <Y|N>` - use ExifTool to strip uploads of metadata when possible
- `--read-uploads-description <Y|N>` - use ExifTool to read image descriptions from uploads
- `--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
- `--skip-release-env` - skip generation the release environment file
- `--skip-release-env` - skip generation of the release environment file
- `--release-env-file` - release environment file path

View file

@ -4,7 +4,7 @@
## Create trusted OAuth App.
Optional params:
Optional parameters:
* `-s SCOPES` - scopes for app, e.g. `read,write,follow,push`.
=== "OTP"
@ -17,4 +17,4 @@ Optional params:
```sh
mix pleroma.app create -n APP_NAME -r REDIRECT_URI
```
```

View file

@ -16,7 +16,6 @@
mix pleroma.user new <nickname> <email> [option ...]
```
### Options
- `--name <name>` - the user's display name
- `--bio <bio>` - the user's bio
@ -39,8 +38,7 @@
mix pleroma.user list
```
## Generate an invite link
## Generate an invitation link
=== "OTP"
@ -54,7 +52,6 @@
mix pleroma.user invite [option ...]
```
### Options
- `--expires-at DATE` - last day on which token is active (e.g. "2019-04-05")
- `--max-use NUMBER` - maximum numbers of token uses
@ -73,7 +70,6 @@
mix pleroma.user invites
```
## Revoke invite
=== "OTP"
@ -88,7 +84,6 @@
mix pleroma.user revoke_invite <token>
```
## Delete a user
=== "OTP"
@ -103,7 +98,6 @@
mix pleroma.user rm <nickname>
```
## Delete user's posts and interactions
=== "OTP"
@ -118,7 +112,6 @@
mix pleroma.user delete_activities <nickname>
```
## Sign user out from all applications (delete user's OAuth tokens and authorizations)
=== "OTP"
@ -161,7 +154,6 @@
mix pleroma.user deactivate NICKNAME
```
## Deactivate all accounts from an instance and unsubscribe local users on it
=== "OTP"
@ -176,7 +168,6 @@
mix pleroma.user deactivate_all_from_instance <instance>
```
## Create a password reset link for user
=== "OTP"
@ -191,8 +182,7 @@
mix pleroma.user reset_password <nickname>
```
## Disable Multi Factor Authentication (MFA/2FA) for a user
## Disable Multi-Factor Authentication (MFA/2FA) for a user
=== "OTP"
@ -206,7 +196,6 @@
mix pleroma.user reset_mfa <nickname>
```
## Set the value of the given user's settings
=== "OTP"
@ -241,7 +230,6 @@
mix pleroma.user tag <nickname> <tags>
```
## Delete tags from a user
=== "OTP"
@ -256,7 +244,6 @@
mix pleroma.user untag <nickname> <tags>
```
## Toggle confirmation status of the user
=== "OTP"
@ -304,7 +291,7 @@
## Fix following state
Sometimes the system can get into a situation where
it think you're already following someone and won't send a request
it thinks you're already following someone and won't send a request
to the remote instance, or won't let you unfollow someone. This
bug was fixed, but in case you encounter these weird states:
@ -324,4 +311,4 @@ The first argument is the local user's nickname - if you are `myuser@myinstance`
The second is the remote user, consisting of both nickname AND domain.
If you are a weird follow state situation and cannot resolve it with the above, you may need to co-operate with the remote admin to clear the state their side too - they should provide the arguments *backwards*, i.e `fix_follow_state remote local`.
If you are a weird follow state situation and cannot resolve it with the above, you may need to co-operate with the remote admin to clear the state their side too - they should provide the arguments *backwards*, i.e. `fix_follow_state remote local`.

View file

@ -9,30 +9,30 @@
5. Restart the Akkoma service.
[¹]: We assume the database name is "akkoma". If not, you can find the correct name in your configuration files.
[²]: If you have a from source installation, you need `config/prod.secret.exs` instead of `config/config.exs`. The `config/config.exs` file also exists, but in case of from source installations, it only contains the default values and it is tracked by Git, so you don't need to back it up.
[²]: If you have a from source installation, you need `config/prod.secret.exs` instead of `config/config.exs`. The `config/config.exs` file also exists, but in case of from source installations, it only contains the default values and it is tracked by Git, so you don't need to back it up.
## Restore/Move
1. Optionally reinstall Akkoma (either on the same server or on another server if you want to move servers).
2. Stop the Akkoma service.
3. Go to the working directory of Akkoma (default is `/opt/akkoma`)
4. Copy the above mentioned files back to their original position.
4. Copy the above-mentioned files back to their original position.
5. Drop the existing database and user[¹]. `sudo -Hu postgres psql -c 'DROP DATABASE akkoma;';` `sudo -Hu postgres psql -c 'DROP USER akkoma;'`
6. Restore the database schema and akkoma role[¹] (replace the password with the one you find in the configuration file), `sudo -Hu postgres psql -c "CREATE USER akkoma WITH ENCRYPTED PASSWORD '<database-password-wich-you-can-find-in-your-configuration-file>';"` `sudo -Hu postgres psql -c "CREATE DATABASE akkoma OWNER akkoma;"`.
7. Now restore the Akkoma instance's data into the empty database schema[¹]: `sudo -Hu postgres pg_restore -d akkoma -v -1 </path/to/backup_location/akkoma.pgdump>`
8. If you installed a newer Akkoma version, you should run the database migrations `./bin/pleroma_ctl migrate`[²].
9. Restart the Akkoma service.
10. Run `sudo -Hu postgres vacuumdb --all --analyze-in-stages`. This will quickly generate the statistics so that postgres can properly plan queries.
11. If setting up on a new server, configure Nginx by using the `installation/nginx/akkoma.nginx` configuration sample or reference the Akkoma installation guide which contains the Nginx configuration instructions.
11. If setting up on a new server, configure nginx by using the `installation/nginx/akkoma.nginx` configuration sample or reference the Akkoma installation guide which contains the nginx configuration instructions.
[¹]: We assume the database name and user are both "akkoma". If not, you can find the correct name in your configuration files.
[²]: If you have a from source installation, the command is `MIX_ENV=prod mix ecto.migrate`. Note that we prefix with `MIX_ENV=prod` to use the `config/prod.secret.exs` configuration file.
## Remove
1. Optionally you can remove the users of your instance. This will trigger delete requests for their accounts and posts. Note that this is 'best effort' and doesn't mean that all traces of your instance will be gone from the fediverse.
* You can do this from the admin-FE where you can select all local users and delete the accounts using the *Moderate multiple users* dropdown.
* You can also list local users and delete them individually using the CLI tasks for [Managing users](./CLI_tasks/user.md).
1. Optionally, you can remove the users of your instance. This will trigger delete requests for their accounts and posts. Note that this is 'best effort' and doesn't mean that all traces of your instance will be gone from the fediverse.
* You can do this from the admin-fe where you can select all local users and delete the accounts using the *Moderate multiple users* dropdown.
* You can also list local users and delete them individually using the CLI tasks for [managing users](./CLI_tasks/user.md).
2. Stop the Akkoma service `systemctl stop akkoma`
3. Disable Akkoma from systemd `systemctl disable akkoma`
4. Remove the files and folders you created during installation (see installation guide). This includes the akkoma, nginx and systemd files and folders.

View file

@ -11,7 +11,7 @@ See: [export\_prometheus\_metrics](../../configuration/cheatsheet#instance)
To scrape prometheus metrics, we need an oauth2 token with the `admin:metrics` scope.
consider using [constanze](https://akkoma.dev/AkkomaGang/constanze) to make this easier -
Consider using [constanze](https://akkoma.dev/AkkomaGang/constanze) to make this easier -
```bash
constanze token --client-app --scopes "admin:metrics" --client-name "Prometheus"

View file

@ -33,8 +33,8 @@ su -s "$SHELL" akkoma
./bin/pleroma_ctl frontend install pleroma-fe --ref stable
```
If you selected an alternate flavour on installation,
you _may_ need to specify `--flavour`, in the same way as
If you selected an alternate flavour on installation,
you _may_ need to specify `--flavour`, in the same way as
[when installing](../../installation/otp_en#detecting-flavour).
## For from source installations (using git)
@ -62,6 +62,6 @@ mix ecto.migrate
# Start akkoma (replace with your system service manager's equivalent if different)
sudo systemctl start akkoma
# Update Akkoma-FE frontend to latest stable. For other Frontends see Frontend Configuration doc for more information.
# Update akkoma-fe frontend to latest stable. For other Frontends see Frontend Configuration doc for more information.
mix pleroma.frontend install pleroma-fe --ref stable
```

View file

@ -2,9 +2,9 @@
This is a cheat sheet for Akkoma configuration file, any setting possible to configure should be listed here.
For OTP installations the configuration is typically stored in `/etc/akkoma/config.exs`.
For OTP installations, the configuration is typically stored in `/etc/akkoma/config.exs`.
For from source installations Akkoma configuration works by first importing the base config `config/config.exs`, then overriding it by the environment config `config/$MIX_ENV.exs` and then overriding it by user config `config/$MIX_ENV.secret.exs`. In from source installations you should always make the changes to the user config and NEVER to the base config to avoid breakages and merge conflicts. So for production you change/add configuration to `config/prod.secret.exs`.
For from source installations, Akkoma configuration works by first importing the base config `config/config.exs`, then overriding it by the environment config `config/$MIX_ENV.exs` and then overriding it by user config `config/$MIX_ENV.secret.exs`. In from source installations you should always make the changes to the user config and NEVER to the base config to avoid breakages and merge conflicts. I.e. for production you change/add configuration to `config/prod.secret.exs`.
To add configuration to your config file, you can copy it from the base config. The latest version of it can be viewed [here](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/config/config.exs). You can also use this file if you don't know how an option is supposed to be formatted.
@ -12,7 +12,7 @@ To add configuration to your config file, you can copy it from the base config.
* `name`: The instances name.
* `email`: Email used to reach an Administrator/Moderator of the instance.
* `notify_email`: Email used for notifications.
* `description`: The instances description, can be seen in nodeinfo and ``/api/v1/instance``.
* `description`: The instances description, can be seen in nodeinfo and `/api/v1/instance`.
* `limit`: Posts character limit (CW/Subject included in the counter).
* `description_limit`: The character limit for image descriptions.
* `remote_limit`: Hard character limit beyond which remote posts will be dropped.
@ -33,12 +33,12 @@ To add configuration to your config file, you can copy it from the base config.
* `federation_incoming_replies_max_depth`: Max. depth of reply-to activities fetching on incoming federation, to prevent out-of-memory situations while fetching very long threads. If set to `nil`, threads of any depth will be fetched. Lower this value if you experience out-of-memory crashes.
* `federation_reachability_timeout_days`: Timeout (in days) of each external federation target being unreachable prior to pausing federating to it.
* `allow_relay`: Permits remote instances to subscribe to all public posts of your instance. This may increase the visibility of your instance.
* `public`: Allows unauthenticated access to public resources on your instance. This is essentially used as the default value for `:restrict_unauthenticated`.
* `public`: Allows unauthenticated access to public resources on your instance. This is essentially used as the default value for `:restrict_unauthenticated`.
See `restrict_unauthenticated` for more details.
* `quarantined_instances`: *DEPRECATED* ActivityPub instances where activities will not be sent. They can still reach there via other means, we just won't send them.
* `quarantined_instances`: *DEPRECATED* ActivityPub instances where activities will not be sent. They can still see our activities via other means, we just won't send them.
* `allowed_post_formats`: MIME-type list of formats allowed to be posted (transformed into HTML).
* `extended_nickname_format`: Set to `true` to use extended local nicknames format (allows underscores/dashes). This will break federation with
older software for theses nicknames.
* `extended_nickname_format`: Set to `true` to use extended local nicknames format (allows underscores/dashes).
This will break federation with older software for theses nicknames.
* `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.
* `autofollowing_nicknames`: Set to nicknames of (local) users that automatically follows every newly registered user.
@ -46,7 +46,7 @@ To add configuration to your config file, you can copy it from the base config.
* `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`.
* `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 number of days to retain remote posts when pruning the database.
* `user_bio_length`: A user bio maximum length (default: `5000`).
* `user_name_length`: A user name maximum length (default: `100`).
* `skip_thread_containment`: Skip filter out broken threads. The default is `false`.
@ -61,9 +61,9 @@ To add configuration to your config file, you can copy it from the base config.
* `cleanup_attachments_delay`: How many seconds to wait after post deletion before attempting to deletion; useful for “delete & redraft” functionality (default: `1800`)
* `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).
* `local_bubble`: Array of domains representing instances closely related to yours. Used to populate the `bubble` timeline. e.g `["example.com"]`, (default: `[]`)
* `languages`: List of Language Codes used by the instance. This is used to try and set a default language from the frontend. It will try and find the first match between the languages set here and the user's browser languages. It will default to the first language in this setting if there is no match.. (default `["en"]`)
* `export_prometheus_metrics`: Enable prometheus metrics, served at `/api/v1/akkoma/metrics`, requiring the `admin:metrics` oauth scope.
* `local_bubble`: Array of domains representing instances closely related to yours. Used to populate the `bubble` timeline. e.g. `["example.com"]`, (default: `[]`)
* `languages`: List of Language Codes used by the instance. This is used to try and set a default language from the frontend. It will try and find the first match between the languages set here and the user's browser languages. It will default to the first language in this setting if there is no match. (default `["en"]`)
* `export_prometheus_metrics`: Enable prometheus metrics, served at `/api/v1/akkoma/metrics`, requiring the `admin:metrics` OAuth scope.
* `privileged_staff`: Set to `true` to give moderators access to a few higher responsibility actions.
* `federated_timeline_available`: Set to `false` to remove access to the federated timeline for all users.
@ -76,15 +76,15 @@ To add configuration to your config file, you can copy it from the base config.
## Welcome
* `direct_message`: - welcome message sent as a direct message.
* `enabled`: Enables the send a direct message to a newly registered user. Defaults to `false`.
* `enabled`: Enables sending a direct message to a newly registered user. Defaults to `false`.
* `sender_nickname`: The nickname of the local user that sends the welcome message.
* `message`: A message that will be send to a newly registered users as a direct message.
* `message`: A message that will be sent to a newly registered users as a direct message.
* `email`: - welcome message sent as a email.
* `enabled`: Enables the send a welcome email to a newly registered user. Defaults to `false`.
* `enabled`: Enables sending a welcome email to newly registered users. Defaults to `false`.
* `sender`: The email address or tuple with `{nickname, email}` that will use as sender to the welcome email.
* `subject`: A subject of welcome email.
* `html`: A html that will be send to a newly registered users as a email.
* `text`: A text that will be send to a newly registered users as a email.
* `html`: A html that will be sent to newly registered users as an email.
* `text`: A text that will be sent to newly registered users as an email.
Example:
@ -135,7 +135,7 @@ To add configuration to your config file, you can copy it from the base config.
* `Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy`: Steals all eligible emoji encountered in posts from remote instances
(See [`:mrf_steal_emoji`](#mrf_steal_emoji))
* `Pleroma.Web.ActivityPub.MRF.SubchainPolicy`: Selectively runs other MRF policies when messages match (See [`:mrf_subchain`](#mrf_subchain)).
* `Pleroma.Web.ActivityPub.MRF.TagPolicy`: Applies policies to individual users based on tags, which can be set using pleroma-fe/admin-fe/any other app that supports Pleroma Admin API. For example it allows marking posts from individual users nsfw (sensitive).
* `Pleroma.Web.ActivityPub.MRF.TagPolicy`: Applies policies to individual users based on tags, which can be set using pleroma-fe/admin-fe/any other app that supports Pleroma Admin API. For example, it allows marking posts from individual users nsfw (sensitive).
* `Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy`: Drops all posts except from users specified in a list.
(See [`:mrf_user_allowlist`](#mrf_user_allowlist))
* `Pleroma.Web.ActivityPub.MRF.VocabularyPolicy`: Restricts activities to a configured set of vocabulary. (See [`:mrf_vocabulary`](#mrf_vocabulary)).
@ -170,7 +170,7 @@ Additionally the following MRFs will *always* be aplied and cannot be disabled:
* `media_removal`: List of instances to strip media attachments from and the reason for doing so.
* `media_nsfw`: List of instances to tag all media as NSFW (sensitive) from and the reason for doing so.
* `federated_timeline_removal`: List of instances to remove from the Federated Timeline (aka The Whole Known Network) and the reason for doing so.
* `reject`: List of instances to reject activities (except deletes) from and the reason for doing so. Additionally prevents activities from being sent to that instance.
* `reject`: List of instances to reject activities (except deletes) from and the reason for doing so. Additionally, prevents activities from being sent to that instance.
* `accept`: List of instances to only accept activities (except deletes) from and the reason for doing so.
* `followers_only`: Force posts from the given instances to be visible by followers only and the reason for doing so.
* `report_removal`: List of instances to reject reports from and the reason for doing so.
@ -203,8 +203,8 @@ config :pleroma, :mrf_subchain,
* `reject_threshold`: Number of mentioned users after which the messaged gets rejected. Set to 0 to disable.
#### :mrf_keyword
* `reject`: A list of patterns which result in message being rejected, each pattern can be a string or a [regular expression](https://hexdocs.pm/elixir/Regex.html).
* `federated_timeline_removal`: A list of patterns which result in message being removed from federated timelines (a.k.a unlisted), each pattern can be a string or a [regular expression](https://hexdocs.pm/elixir/Regex.html).
* `reject`: A list of patterns which result in a message being rejected, each pattern can be a string or a [regular expression](https://hexdocs.pm/elixir/Regex.html).
* `federated_timeline_removal`: A list of patterns which result in message being removed from federated timelines (a.k.a. unlisted), each pattern can be a string or a [regular expression](https://hexdocs.pm/elixir/Regex.html).
* `replace`: A list of tuples containing `{pattern, replacement}`, `pattern` can be a string or a [regular expression](https://hexdocs.pm/elixir/Regex.html).
#### :mrf_mention
@ -291,11 +291,11 @@ config :pleroma, :mrf_reject_newly_created_account_notes, age: 86400
### :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 [Akkoma-FE configuration and customization for instance administrators](https://docs-fe.akkoma.dev/stable/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 [akkoma-fe configuration and customization for instance administrators](https://docs-fe.akkoma.dev/stable/CONFIGURATION/#options).
Frontends can access these settings at `/api/v1/pleroma/frontend_configurations`
To add your own configuration for Akkoma-FE, use it like this:
To add your own configuration for akkoma-fe, use it like this:
```elixir
config :pleroma, :frontend_configurations,
@ -340,7 +340,7 @@ config :pleroma, :frontends,
* `:primary` - The frontend that will be served at `/`
* `:admin` - The frontend that will be served at `/pleroma/admin`
* `:swagger` - Config for developers to act as an API reference to be served at `/pleroma/swaggerui/` (trailing slash _needed_). Disabled by default.
* `:mastodon` - The mastodon-fe configuration. This shouldn't need to be changed. This is served at `/web` when installed.
* `:mastodon` - The masto-fe configuration. This shouldn't need to be changed. This is served at `/web` when installed.
### :static\_fe
@ -352,20 +352,20 @@ Available options:
### :assets
This section configures assets to be used with various frontends. Currently the only option
relates to mascots on the mastodon frontend
This section configures assets to be used with various frontends.
Currently, the only option relates to mascots on masto-fe
* `mascots`: KeywordList of mascots, each element __MUST__ contain both a `url` and a
`mime_type` key.
* `default_mascot`: An element from `mascots` - This will be used as the default mascot
on MastoFE (default: `:pleroma_fox_tan`).
on masto-fe (default: `:pleroma_fox_tan`).
### :manifest
This section describe PWA manifest instance-specific values. Currently this option relate only for MastoFE.
This section describes PWA manifest instance-specific values. Currently this option relate only for masto-fe.
* `icons`: Describe the icons of the app, this a list of maps describing icons in the same way as the
[spec](https://www.w3.org/TR/appmanifest/#imageresource-and-its-members) describes it.
* `icons`: Describe the icons of the app, this is a list of maps describing icons as
detailed in its [spec](https://www.w3.org/TR/appmanifest/#imageresource-and-its-members).
Example:
@ -393,7 +393,7 @@ This section describe PWA manifest instance-specific values. Currently this opti
* `shortcode_globs`: Location of custom emoji files. `*` can be used as a wildcard. Example `["/emoji/custom/**/*.png"]`
* `pack_extensions`: A list of file extensions for emojis, when no emoji.txt for a pack is present. Example `[".png", ".gif"]`
* `groups`: Emojis are ordered in groups (tags). This is an array of key-value pairs where the key is the groupname and the value the location or array of locations. `*` can be used as a wildcard. Example `[Custom: ["/emoji/*.png", "/emoji/custom/*.png"]]`
* `groups`: Emojis are ordered in groups (tags). This is an array of key-value pairs where the key is the group name and the value the location or array of locations. `*` can be used as a wildcard. Example `[Custom: ["/emoji/*.png", "/emoji/custom/*.png"]]`
* `default_manifest`: Location of the JSON-manifest. This manifest contains information about the emoji-packs you can download. Currently only one manifest can be added (no arrays).
* `shared_pack_cache_seconds_per_file`: When an emoji pack is shared, the archive is created and cached in
memory for this amount of seconds multiplied by the number of files.
@ -404,14 +404,14 @@ This section describe PWA manifest instance-specific values. Currently this opti
* `base_url`: The base URL to access a user-uploaded file.
Using a (sub)domain distinct from the instance endpoint is **strongly** recommended.
* `proxy_opts`: All options defined in `Pleroma.ReverseProxy` documentation, defaults to `[max_body_length: (25*1_048_576)]`.
* `whitelist`: List of hosts with scheme to bypass the mediaproxy (e.g. `https://example.com`)
* `whitelist`: List of hosts with scheme to bypass the media proxy (e.g. `https://example.com`)
* `invalidation`: options for remove media from cache after delete object:
* `enabled`: Enables purge cache
* `provider`: Which one of the [purge cache strategy](#purge-cache-strategy) to use.
* `provider`: Which one of the [purge cache strategies](#purge-cache-strategy) to use.
## :media_preview_proxy
* `enabled`: Enables proxying of remote media preview to the instances proxy. Requires enabled media proxy (`media_proxy/enabled`).
* `enabled`: Enables proxying of remote media preview to the instances proxy. Requires media proxy to be enabled (`media_proxy/enabled`).
* `thumbnail_max_width`: Max width of preview thumbnail for images (video preview always has original dimensions).
* `thumbnail_max_height`: Max height of preview thumbnail for images (video preview always has original dimensions).
* `image_quality`: Quality of the output. Ranges from 0 (min quality) to 100 (max quality).
@ -421,8 +421,8 @@ This section describe PWA manifest instance-specific values. Currently this opti
#### Pleroma.Web.MediaProxy.Invalidation.Script
This strategy allow perform external shell script to purge cache.
Urls of attachments are passed to the script as arguments.
This strategy allows executing an external shell script to purge cache.
URLs of attachments are passed to the script as arguments.
* `script_path`: Path to the external script.
* `url_format`: Set to `:htcacheclean` if using Apache's htcacheclean utility.
@ -436,7 +436,7 @@ config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script,
#### Pleroma.Web.MediaProxy.Invalidation.Http
This strategy allow perform custom http request to purge cache.
This strategy allows performing a custom HTTP request to purge cache.
* `method`: http method. default is `purge`
* `headers`: http headers.
@ -456,12 +456,12 @@ config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Http,
* `providers`: a list of metadata providers to enable. Providers available:
* `Pleroma.Web.Metadata.Providers.OpenGraph`
* `Pleroma.Web.Metadata.Providers.TwitterCard`
* `unfurl_nsfw`: If set to `true` nsfw attachments will be shown in previews.
* `unfurl_nsfw`: If set to `true` NSFW attachments will be shown in previews.
### :rich_media (consumer)
* `enabled`: if enabled the instance will parse metadata from attached links to generate link previews.
* `enabled`: if enabled, the instance will parse metadata from attached links to generate link previews.
* `ignore_hosts`: list of hosts which will be ignored by the metadata parser. For example `["accounts.google.com", "xss.website"]`, defaults to `[]`.
* `ignore_tld`: list TLDs (top-level domains) which will ignore for parse metadata. default is ["local", "localdomain", "lan"].
* `ignore_tld`: list of TLDs (top-level domains) which will ignore for parse metadata. The default is ["local", "localdomain", "lan"].
* `parsers`: list of Rich Media parsers.
* `failure_backoff`: Amount of milliseconds after request failure, during which the request will not be retried.
@ -472,12 +472,12 @@ config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Http,
!!! note
`Phoenix` endpoint configuration, all configuration options can be viewed [here](https://hexdocs.pm/phoenix/Phoenix.Endpoint.html#module-dynamic-configuration), only common options are listed here.
* `http` - a list containing http protocol configuration, all configuration options can be viewed [here](https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html#module-options), only common options are listed here. For deployment using docker, you need to set this to `[ip: {0,0,0,0}, port: 4000]` to make akkoma accessible from other containers (such as your nginx server).
* `http` - a list containing HTTP protocol configuration, all configuration options can be viewed [here](https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html#module-options), only common options are listed here. For deployment using Docker, you need to set this to `[ip: {0,0,0,0}, port: 4000]` to make akkoma accessible from other containers (such as your nginx server).
- `ip` - a tuple consisting of 4 integers
- `port`
* `url` - a list containing the configuration for generating urls, accepts
* `url` - a list containing the configuration for generating URLs, accepts
- `host` - the host without the scheme and a post (e.g `example.com`, not `https://example.com:2020`)
- `scheme` - e.g `http`, `https`
- `scheme` - e.g. `http`, `https`
- `port`
- `path`
* `extra_cookie_attrs` - a list of `Key=Value` strings to be added as non-standard cookie attributes. Defaults to `["SameSite=Lax"]`. See the [SameSite article](https://www.owasp.org/index.php/SameSite) on OWASP for more info.
@ -492,14 +492,14 @@ config :pleroma, Pleroma.Web.Endpoint,
]
```
This will make Akkoma listen on `127.0.0.1` port `8080` and generate urls starting with `https://example.com:2020`
This will make Akkoma listen on `127.0.0.1` port `8080` and generate URLs starting with `https://example.com:2020`
### :http_security
* ``enabled``: Whether the managed content security policy is enabled.
* ``sts``: Whether to additionally send a `Strict-Transport-Security` header.
* ``sts_max_age``: The maximum age for the `Strict-Transport-Security` header if sent.
* ``referrer_policy``: The referrer policy to use, either `"same-origin"` or `"no-referrer"`.
* ``report_uri``: Adds the specified url to `report-uri` and `report-to` group in CSP header.
* ``report_uri``: Adds the specified URL to `report-uri` and `report-to` group in CSP header.
### Pleroma.Web.Plugs.RemoteIp
@ -515,11 +515,10 @@ Available options:
* `proxies` - A list of upstream proxy IP subnets in CIDR notation from which we will parse the content of `headers`. Defaults to `[]`. IPv4 entries without a bitmask will be assumed to be /32 and IPv6 /128.
* `reserved` - A list of reserved IP subnets in CIDR notation which should be ignored if found in `headers`. Defaults to `["127.0.0.0/8", "::1/128", "fc00::/7", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]`.
### :rate_limit
!!! note
If your instance is behind a reverse proxy ensure [`Pleroma.Web.Plugs.RemoteIp`](#pleroma-plugs-remoteip) is enabled (it is enabled by default).
If your instance is behind a reverse proxy, ensure [`Pleroma.Web.Plugs.RemoteIp`](#pleroma-plugs-remoteip) is enabled (it is enabled by default).
A keyword list of rate limiters where a key is a limiter name and value is the limiter configuration. The basic configuration is a tuple where:
@ -539,18 +538,18 @@ config :pleroma, :rate_limit,
Means that:
1. In 60 seconds, 15 authentication attempts can be performed from the same IP address.
2. In 1 second, 10 search requests can be performed from the same IP adress by unauthenticated users, while authenticated users can perform 30 search requests per second.
2. In 1 second, 10 search requests can be performed from the same IP address by unauthenticated users, while authenticated users can perform 30 search requests per second.
Supported rate limiters:
* `:search` - Account/Status search.
* `:timeline` - Timeline requests (each timeline has it's own limiter).
* `:timeline` - Timeline requests (each timeline has its own limiter).
* `:app_account_creation` - Account registration from the API.
* `:relations_actions` - Following/Unfollowing in general.
* `:relation_id_action` - Following/Unfollowing for a specific user.
* `:statuses_actions` - Status actions such as: (un)repeating, (un)favouriting, creating, deleting.
* `:status_id_action` - (un)Repeating/(un)Favouriting a particular status.
* `:authentication` - Authentication actions, i.e getting an OAuth token.
* `:authentication` - Authentication actions, i.e. getting an OAuth token.
* `:password_reset` - Requesting password reset emails.
* `:account_confirmation_resend` - Requesting resending account confirmation emails.
* `:ap_routes` - Requesting statuses via ActivityPub.
@ -603,7 +602,7 @@ the source code is here: [kocaptcha](https://github.com/koto-bank/kocaptcha). Th
* `uploader`: Which one of the [uploaders](#uploaders) to use.
* `filters`: List of [upload filters](#upload-filters) to use.
* `link_name`: When enabled Akkoma 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
* `link_name`: When enabled Akkoma 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
* `base_url`: The base URL to access a user-uploaded file; MUST be configured explicitly.
Using a (sub)domain distinct from the instance endpoint is **strongly** recommended. A good value might be `https://media.myakkoma.instance/media/`.
* `proxy_opts`: Proxy options, see `Pleroma.ReverseProxy` documentation.
@ -616,7 +615,7 @@ the source code is here: [kocaptcha](https://github.com/koto-bank/kocaptcha). Th
#### Pleroma.Uploaders.Local
* `uploads`: Which directory to store the user-uploads in, relative to pleromas working directory.
* `uploads`: Which directory to store the user-uploads in, relative to akkomas working directory.
#### Pleroma.Uploaders.S3
@ -658,7 +657,7 @@ This filter replaces the declared filename (not the path) of an upload.
#### Pleroma.Upload.Filter.Exiftool.StripMetadata
This filter strips metadata with Exiftool leaving color profiles and orientation intact.
This filter strips metadata with ExifTool leaving color profiles and orientation intact.
* `purge`: List of Exiftool tag names or tag group names to purge
* `preserve`: List of Exiftool tag names or tag group names to preserve even if they occur in the purge list
@ -678,16 +677,16 @@ No specific configuration.
#### Pleroma.Upload.Filter.Mogrify
* `args`: List of actions for the `mogrify` command like `"strip"` or `["strip", "auto-orient", {"implode", "1"}]`.
* `args`: List of actions for the `mogrify` command, like `"strip"` or `["strip", "auto-orient", {"implode", "1"}]`.
## Email
### Pleroma.Emails.Mailer
* `adapter`: one of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters), or `Swoosh.Adapters.Local` for in-memory mailbox.
* `api_key` / `password` and / or other adapter-specific settings, per the above documentation.
* `enabled`: Allows enable/disable send emails. Default: `false`.
* `enabled`: whether your instance is allowed to send emails. Default: `false`.
An example for Sendgrid adapter:
An example for SendGrid adapter:
```elixir
config :pleroma, Pleroma.Emails.Mailer,
@ -729,7 +728,7 @@ Email notifications settings.
### Pleroma.Emails.NewUsersDigestEmail
- `:enabled` - a boolean, enables new users admin digest email when `true`. Defaults to `false`.
- `:enabled` - a boolean, enables admin-digest email about new users when `true`. Defaults to `false`.
## Background jobs
@ -824,7 +823,7 @@ config :logger, :ex_syslogger,
level: :warn
```
Another example, keeping console output and adding the pid to syslog output:
Another example, keeping console output and adding the PID to syslog output:
```elixir
config :logger,
backends: [:console, {ExSyslogger, :ex_syslogger}]
@ -871,7 +870,7 @@ This will probably take a long time.
### :admin_token
Allows to set a token that can be used to authenticate with the admin api without using an actual user by giving it as the `admin_token` parameter or `x-admin-token` HTTP header. Example:
Allows to set a token that can be used to authenticate with the admin API without using an actual user by giving it as the `admin_token` parameter or `x-admin-token` HTTP header. Example:
```elixir
config :pleroma, :admin_token, "somerandomtoken"
@ -889,7 +888,8 @@ or
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.
### :auth
@ -909,8 +909,8 @@ Authentication / authorization settings.
Use LDAP for user authentication. When a user logs in to the Akkoma
instance, the name and password will be verified by trying to authenticate
(bind) to an LDAP server. If a user exists in the LDAP directory but there
is no account with the same name yet on the Akkoma instance then a new
Akkoma account will be created with the same name as the LDAP user name.
is no account with the same name yet on the Akkoma instance, then a new
Akkoma account will be created with the same name as the LDAP username.
* `enabled`: enables LDAP authentication
* `host`: LDAP server hostname
@ -931,20 +931,20 @@ 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`.
* `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.
* `POST /api/v1/apps` creates client app basing on provided parameters.
* `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).
* `GET /api/v1/accounts/verify_credentials` (with proper `Authorization` header or `access_token` URI parameter) 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 allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.).
Implementation is based on Ueberauth; see the list of [available strategies](https://github.com/ueberauth/ueberauth/wiki/List-of-Strategies).
Implementation is based on Überauth; see the list of [available strategies](https://github.com/ueberauth/ueberauth/wiki/List-of-Strategies).
!!! note
Each strategy is shipped as a separate dependency; in order to get the strategies, run `OAUTH_CONSUMER_STRATEGIES="..." mix deps.get`, e.g. `OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft" mix deps.get`. The server should also be started with `OAUTH_CONSUMER_STRATEGIES="..." mix phx.server` in case you enable any strategies.
@ -1025,7 +1025,7 @@ config :pleroma, :frontend_configurations,
## Link parsing
### :uri_schemes
* `valid_schemes`: List of the scheme part that is considered valid to be an URL.
* `valid_schemes`: List of the scheme part that is considered valid to be a URL.
### Pleroma.Formatter
@ -1034,10 +1034,10 @@ Configuration for Akkoma's link formatter which parses mentions, hashtags, and U
* `class` - specify the class to be added to the generated link (default: `false`)
* `rel` - specify the rel attribute (default: `ugc`)
* `new_window` - adds `target="_blank"` attribute (default: `false`)
* `truncate` - Set to a number to truncate URLs longer then the number. Truncated URLs will end in `...` (default: `false`)
* `truncate` - Set to a number to truncate URLs longer than the number. Truncated URLs will end in `...` (default: `false`)
* `strip_prefix` - Strip the scheme prefix (default: `false`)
* `extra` - link URLs with rarely used schemes (magnet, ipfs, irc, etc.) (default: `true`)
* `validate_tld` - Set to false to disable TLD validation for URLs/emails. Can be set to :no_scheme to validate TLDs only for urls without a scheme (e.g `example.com` will be validated, but `http://example.loki` won't) (default: `:no_scheme`)
* `validate_tld` - Set to false to disable TLD validation for URLs/emails. Can be set to :no_scheme to validate TLDs only for URLs without a scheme (e.g `example.com` will be validated, but `http://example.loki` won't) (default: `:no_scheme`)
Example:
@ -1073,7 +1073,7 @@ git clone <MY MODULE>
## :configurable_from_database
Boolean, enables/disables in-database configuration. Read [Transfering the config to/from the database](../administration/CLI_tasks/config.md) for more information.
Boolean, enables/disables in-database configuration. Read [transferring the config to/from the database](../administration/CLI_tasks/config.md) for more information.
## :database_config_whitelist
@ -1123,12 +1123,13 @@ Turning any of the `:restrict_unauthenticated` options to `true` will restrict a
#### When :instance, :public is `false`
When `:instance, :public` is set to `false`, all of the `:restrict_unauthenticated` options will effectively be set to `true` by default,
When `:instance, :public` is set to `false`, all `:restrict_unauthenticated` options will effectively be set to `true` by default,
meaning that only authenticated users will be able to access the corresponding resources.
If you'd like to allow unauthenticated access to specific resources, you can turn these settings to `false`.
**Note**: setting `restrict_unauthenticated/timelines/local` to `true` has no practical sense if `restrict_unauthenticated/timelines/federated` is set to `false` (since local public activities will still be delivered to unauthenticated users as part of federated timeline).
!!! note
Setting `restrict_unauthenticated/timelines/local` to `true` has no practical sense if `restrict_unauthenticated/timelines/federated` is set to `false` (since local public activities will still be delivered to unauthenticated users as part of federated timeline).
## Pleroma.Web.ApiSpec.CastAndValidate
@ -1145,7 +1146,7 @@ Control favicons for instances.
!!! note
Requires enabled email
* `:purge_after_days` an integer, remove backup achives after N days.
* `:purge_after_days` an integer, remove backup archives 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 Akkoma choose temporary directory in the following order:
1. the directory named by the TMPDIR environment variable
@ -1157,7 +1158,7 @@ Control favicons for instances.
### Theme settings
Settings to change theme as exposed to the outside world, for software
that scans `index.html` (mainly misskey)
that scans `index.html` (mainly Misskey)
```
config :pleroma, Pleroma.Web.Metadata.Providers.Theme, theme_color: "#593196"
@ -1182,7 +1183,7 @@ Settings to restrict concurrently running jobs. Jobs which can be configured:
Each job has these settings:
* `:max_running` - max concurrently runnings jobs
* `:max_running` - max concurrently running jobs
* `:max_waiting` - max waiting jobs
### Translation Settings
@ -1212,6 +1213,6 @@ Translations are available at `/api/v1/statuses/:id/translations/:language`, whe
### `:argos_translate`
- `:command_argos_translate` - command for `argos-translate`. Can be the command if it's in your PATH, or the full path to the file (default: `argos-translate`).
- `:command_argos_translate` - command for `argos-translate`. Can be the command if it's in your PATH, or the full path to the file (default: `argos-translate`).
- `:command_argospm` - command for `argospm`. Can be the command if it's in your PATH, or the full path to the file (default: `argospm`).
- `:strip_html` - Strip html from the post before translating it (default: `true`).

View file

@ -46,7 +46,7 @@ config :pleroma, :emoji,
]
```
Order of the `groups` matters, so to override default tags just put your group on top of the list. E.g:
Order of the `groups` matters, so to override default tags, just put your group on top of the list. E.g:
```elixir
config :pleroma, :emoji,
shortcode_globs: ["/emoji/custom/**/*.png"],

View file

@ -2,7 +2,7 @@
Frontends in Akkoma are swappable, you can pick which you'd like.
For a basic setup, you can set a frontends for the key `primary` and `admin` and the options of `name` and `ref`. This will then make Akkoma serve the frontend from a folder constructed by concatenating the instance static path, `frontends` and the name and ref.
For a basic setup, you can set a frontend for the key `primary` and `admin` and the options of `name` and `ref`. This will then make Akkoma serve the frontend from a folder constructed by concatenating the instance static path, `frontends` and the name and ref.
The key `primary` refers to the frontend that will be served by default for general requests. The key `admin` refers to the frontend that will be served at the `/pleroma/admin` path.
@ -34,15 +34,15 @@ If you choose not to install a frontend for whatever reason, it is recommended t
You can also replace the default "no frontend" page by placing an `index.html` file under your `instance/static/` directory.
## Mastodon-FE
## masto-fe
Akkoma supports both [glitchsoc](https://github.com/glitch-soc/mastodon)'s more "vanilla" mastodon frontend,
Akkoma supports both [glitch-soc](https://github.com/glitch-soc/mastodon)'s more "vanilla" mastodon frontend,
as well as [fedibird](https://github.com/fedibird/mastodon)'s extended frontend which has near-feature-parity with akkoma (with quoting and reactions).
To enable either one, you must run the `frontend.install` task for either `mastodon-fe` or `fedibird-fe` (both `--ref akkoma`), then make sure
To enable either one, you must run the `frontend.install` task for either `masto-fe` or `fedibird-fe` (both `--ref akkoma`), then make sure
`:pleroma, :frontends, :mastodon` references the one you want.
## Swagger (openAPI) documentation viewer
## Swagger (OpenAPI) documentation viewer
If you're a developer and you'd like a human-readable rendering of the
API documentation, you can enable [Swagger UI](https://github.com/swagger-api/swagger-ui).

View file

@ -81,7 +81,7 @@ Use private `/tmp` and `/var/tmp` folders inside a new file system namespace, wh
> Recommended value: `true`
The `/home`, `/root`, and `/run/user` folders can not be accessed by this service anymore. If your Akkoma user has its home folder in one of the restricted places, or use one of these folders as its working directory, you have to set this to `false`.
The `/home`, `/root`, and `/run/user` folders cannot be accessed by this service anymore. If your Akkoma user has its home folder in one of the restricted places, or use one of these folders as its working directory, you have to set this to `false`.
### ProtectSystem

View file

@ -11,7 +11,7 @@ Akkoma supports that, but it might be tricky to set up, and any error might prev
It is important to understand that for federation purposes, a user in Akkoma has two unique identifiers associated:
- A webfinger `acct:` URI, used for discovery and as a verifiable global name for the user across Akkoma instances. In our example, our account's acct: URI is `acct:user@example.org`
- A WebFinger `acct:` URI, used for discovery and as a verifiable global name for the user across Akkoma instances. In our example, our account's acct: URI is `acct:user@example.org`
- An author/actor URI, used in every other aspect of federation. This is the way in which users are identified in ActivityPub, the underlying protocol used for federation with other Akkoma instances.
In our case, it is `https://akkoma.example.org/users/user`.
@ -19,7 +19,7 @@ Both account identifiers are unique and required for Akkoma. An important risk i
## WebFinger
As said earlier, each Akkoma user has an `acct`: URI, which is used for discovery and authentication. When you add @user@example.org, a webfinger query is performed. This is done in two steps:
As said earlier, each Akkoma user has an `acct`: URI, which is used for discovery and authentication. When you add @user@example.org, a WebFinger query is performed. This is done in two steps:
1. Querying `https://example.org/.well-known/host-meta` (where the domain of the URL matches the domain part of the `acct`: URI) to get information on how to perform the query.
This file will indeed contain a URL template of the form `https://example.org/.well-known/webfinger?resource={uri}` that will be used in the second step.
@ -27,7 +27,8 @@ This file will indeed contain a URL template of the form `https://example.org/.w
## Configuring your Akkoma instance
**_DO NOT ATTEMPT TO CONFIGURE YOUR INSTANCE THIS WAY IF YOU DID NOT UNDERSTAND THE ABOVE_**
!!! danger
DO NOT ATTEMPT TO CONFIGURE YOUR INSTANCE THIS WAY IF YOU DID NOT UNDERSTAND THE ABOVE
### Configuring Akkoma
@ -47,7 +48,7 @@ config :pleroma, Pleroma.Web.WebFinger, domain: "example.org"
### Configuring WebFinger domain
Now, you have Akkoma running at `https://akkoma.example.org` as well as a website at `https://example.org`. If you recall how webfinger queries work, the first step is to query `https://example.org/.well-known/host-meta`, which will contain an URL template.
Now, you have Akkoma running at `https://akkoma.example.org` as well as a website at `https://example.org`. If you recall how WebFinger queries work, the first step is to query `https://example.org/.well-known/host-meta`, which will contain a URL template.
Therefore, the easiest way to configure `example.org` is to redirect `/.well-known/host-meta` to `akkoma.example.org`.

View file

@ -1,7 +1,7 @@
# How to activate Akkoma in-database configuration
## Explanation
The configuration of Akkoma (and Pleroma) has traditionally been managed with a config file, e.g. `config/prod.secret.exs`. This method requires a restart of the application for any configuration changes to take effect. We have made it possible to control most settings in the AdminFE interface after running a migration script.
The configuration of Akkoma (and Pleroma) has traditionally been managed with a config file, e.g. `config/prod.secret.exs`. This method requires a restart of the application for any configuration changes to take effect. We have made it possible to control most settings in the admin-fe interface after running a migration script.
## Migration to database config
@ -75,7 +75,7 @@ The configuration of Akkoma (and Pleroma) has traditionally been managed with a
config :pleroma, configurable_from_database: true
```
5. Restart your instance and you can now access the Settings tab in AdminFE.
5. Restart your instance and you can now access the Settings tab in admin-fe.
## Reverting back from database config
@ -131,7 +131,7 @@ You can clear the database config with the following command:
Additionally, every time you migrate the configuration to the database the config table is automatically truncated to ensure a clean migration.
### 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 admin-fe, you can manually remove the offending setting if you know which one it is.
e.g., here is an example showing a the removal of the `config :pleroma, :instance` settings:

View file

@ -1,5 +1,5 @@
# How to configure upstream proxy for federation
If you want to proxify all http requests (e.g. for TOR) that Akkoma makes to an upstream proxy server, edit your config file (`dev.secret.exs` or `prod.secret.exs`) and add the following:
If you want to proxify all HTTP requests (e.g. for TOR) that Akkoma makes to an upstream proxy server, edit your config file (`dev.secret.exs` or `prod.secret.exs`) and add the following:
```
config :pleroma, :http,

View file

@ -15,7 +15,7 @@ In most cases, you would need an extension installed to support parsing CJK text
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をインストールします');
SELECT ts_debug('YOUR.CONFIG', '安装和配置nginx, ElixirとErlangをインストールします');
```
Check output of the query, and see if it matches your expectation.

View file

@ -47,7 +47,7 @@ Now you'll already be able to select the theme in Pleroma FE from the drop-down.
### Give the theme a name
When you open one of the themes that ship with Akkoma, you'll notice that the json has a `"name"` key. Add a key-value pair to your theme where the key name is `"name"` and the value the name you want to give your theme. After this you can refresh te page in your browser and the name should be visible in the drop-down.
When you open one of the themes that ship with Akkoma, you'll notice that the JSON has a `"name"` key. Add a key-value pair to your theme where the key name is `"name"` and the value the name you want to give your theme. After this you can refresh the page in your browser and the name should be visible in the drop-down.
Example of `my-awesome-theme.json` where we add the name "My Awesome Theme"
```json
@ -70,4 +70,4 @@ config :pleroma, :frontend_configurations,
}
```
If you added it in the back-end configuration file, you'll need to restart your instance for the changes to take effect. If you don't see the changes, it's probably because the browser has cached the previous theme. In that case you'll want to clear browser caches. Alternatively you can use a private/incognito window just to see the changes.
If you added it in the back-end configuration file, you'll need to restart your instance for the changes to take effect. If you don't see the changes, it's probably because the browser has cached the previous theme. In that case you'll want to clear browser caches. Alternatively, you can use a private/incognito window just to see the changes.

View file

@ -1,4 +1,4 @@
# I2P Federation and Accessability
# I2P Federation and Accessibility
This guide is going to focus on the Akkoma federation aspect. The actual installation is neatly explained in the official documentation, and more likely to remain up-to-date.
It might be added to this guide if there will be a need for that.
@ -15,9 +15,10 @@ One using the config, and one using external software (fedproxy). The external s
### Using the Config
**Warning:** So far, everytime I followed this way of federating using I2P, the rest of my federation stopped working. I'm leaving this here in case it will help with making it work.
!!! warning
So far, everytime I followed this way of federating using I2P, the rest of my federation stopped working. I'm leaving this here in case it will help with making it work.
Assuming you're running in prod, cd to your Akkoma folder and append the following to `config/prod.secret.exs`:
Assuming you're running in prod, `cd` to your Akkoma folder and append the following to `config/prod.secret.exs`:
```
config :pleroma, :http, proxy_url: {:socks5, :localhost, 4447}
```
@ -45,7 +46,7 @@ To use [fedproxy](https://github.com/majestrate/fedproxy) you'll need to install
```
apt install golang
```
Use a different user than akkoma or root. Run the following to add the Gopath to your ~/.bashrc.
Use a different user than akkoma or root. Run the following to add the `GOPATH` to your ~/.bashrc.
```
echo "export GOPATH=/home/ren/.go" >> ~/.bashrc
```
@ -103,7 +104,7 @@ systemctl start i2pd.service
*Notice:* The stop command initiates a graceful shutdown process, i2pd stops after finishing to route transit tunnels (maximum 10 minutes).
Now you'll have to find your address.
To do that you can download and use I2PD tools.[^1]
To do that, you can download and use I2PD tools.[^1]
Or you'll need to access your web-console on localhost:7070.
If you don't have a GUI, you'll have to SSH tunnel into it like this:
`ssh -L 7070:127.0.0.1:7070 user@ip -p port`.
@ -130,7 +131,7 @@ config :pleroma, :http_security,
enabled: false
```
In the Nginx config, add the following into the `location /` block:
In the nginx config, add the following into the `location /` block:
```nginx
add_header X-XSS-Protection "0";
add_header X-Permitted-Cross-Domain-Policies none;
@ -146,7 +147,7 @@ listen 127.0.0.1:14447;
Set `server_name` to your i2p address.
Reload Nginx:
Reload nginx:
```
systemctl restart i2pd.service --no-block
systemctl reload nginx.service

View file

@ -1,10 +1,10 @@
# Configuring Ejabberd (XMPP Server) to use Akkoma for authentication
# Configuring ejabberd (XMPP Server) to use Akkoma for authentication
If you want to give your Akkoma users an XMPP (chat) account, you can configure [Ejabberd](https://github.com/processone/ejabberd) to use your Akkoma server for user authentication, automatically giving every local user an XMPP account.
If you want to give your Akkoma users an XMPP (chat) account, you can configure [ejabberd](https://github.com/processone/ejabberd) to use your Akkoma 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.
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 `AKKOMA_HOST` and `AKKOMA_PORT`, if necessary.
Copy the script below to a suitable path on your system and set owner and permissions. Also do not forget adjusting `AKKOMA_HOST` and `AKKOMA_PORT`, if necessary.
```bash
cp akkoma_ejabberd_auth.py /etc/ejabberd/akkoma_ejabberd_auth.py
@ -12,7 +12,7 @@ chown ejabberd /etc/ejabberd/akkoma_ejabberd_auth.py
chmod 700 /etc/ejabberd/akkoma_ejabberd_auth.py
```
Set external auth params in ejabberd.yaml file:
Set external auth parameters in ejabberd.yaml file:
```bash
auth_method: [external]
@ -23,8 +23,7 @@ auth_use_cache: false
Restart / reload your ejabberd service.
After restarting your Ejabberd server, your users should now be able to connect with their Akkoma credentials.
After restarting your ejabberd server, your users should now be able to connect with their Akkoma credentials.
```python
import sys
@ -33,7 +32,6 @@ import http.client
from base64 import b64encode
import logging
AKKOMA_HOST = "127.0.0.1"
AKKOMA_PORT = "4000"
AUTH_ENDPOINT = "/api/v1/accounts/verify_credentials"

View file

@ -5,6 +5,6 @@ If you want to give your Akkoma users an XMPP (chat) account, you can configure
In general, you just have to follow the configuration described at [https://mongooseim.readthedocs.io/en/latest/authentication-backends/HTTP-authentication-module/](https://mongooseim.readthedocs.io/en/latest/authentication-backends/HTTP-authentication-module/) and do these changes to your mongooseim.cfg.
1. Set the auth_method to `{auth_method, http}`.
2. Add the http auth pool like this: `{http, global, auth, [{workers, 50}], [{server, "https://yourakkomainstance.com"}]}`
2. Add the HTTP auth pool like this: `{http, global, auth, [{workers, 50}], [{server, "https://yourakkomainstance.com"}]}`
Restart your MongooseIM server, your users should now be able to connect with their Akkoma credentials.

View file

@ -11,7 +11,7 @@ Possible uses include:
* removing media from messages
* sending only public messages to a specific instance
The MRF provides user-configurable policies. The default policy is `NoOpPolicy`, which disables the MRF functionality. Akkoma also includes an easy to use policy called `SimplePolicy` which maps messages matching certain pre-defined criterion to actions built into the policy module.
The MRF provides user-configurable policies. The default policy is `NoOpPolicy`, which disables the MRF functionality. Akkoma also includes an easy-to-use policy called `SimplePolicy` which maps messages matching certain pre-defined criterion to actions built into the policy module.
It is possible to use multiple, active MRF policies at the same time.
@ -29,7 +29,7 @@ config :pleroma, :mrf,
Once `SimplePolicy` is enabled, you can configure various groups in the `:mrf_simple` config object. These groups are:
* `reject`: Servers in this group will have their messages rejected. Also outbound messages will not be sent to these servers.
* `reject`: Servers in this group will have their messages rejected. Also, outbound messages will not be sent to these servers.
* `accept`: If not empty, only messages from these instances will be accepted (whitelist federation).
* `media_nsfw`: Servers in this group will have the #nsfw tag and sensitive setting injected into incoming messages which contain media.
* `media_removal`: Servers in this group will have media stripped from incoming messages.
@ -151,7 +151,7 @@ Please note that the Akkoma developers consider custom MRF policy modules to fal
### 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.
If MRF policy depends on config, it can be added into MRF tab to admin-fe 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 admin-fe and just adding it to `config_description/0` may not be enough to get these inputs working from the admin-fe.
Example:

View file

@ -5,7 +5,7 @@ In addition, federating with such instances will also help furthering that goal.
This is a guide to show you how it can be easily done.
This guide assumes you already got Akkoma working, and that it's running on the default port 4000.
This guide also assumes you're using Nginx as the reverse proxy.
This guide also assumes you're using nginx as the reverse proxy.
To install Tor on Debian / Ubuntu:
```
@ -21,7 +21,7 @@ HiddenServicePort 80 127.0.0.1:8099
HiddenServiceVersion 3 # Remove if Tor version is below 0.3 ( tor --version )
HTTPTunnelPort 9080
```
Restart Tor to generate an adress:
Restart Tor to generate an address:
```
systemctl restart tor@default.service
```
@ -63,7 +63,7 @@ If creating a Tor-only instance, open `config/prod.secret.exs` and under "config
In addition to that, replace the existing nginx config's contents with the example below.
## Existing Instance (Clearnet Instance)
If not a Tor-only instance,
If not a Tor-only instance,
add the nginx config below to your existing config at `/etc/nginx/sites-enabled/akkoma.nginx`.
---
@ -74,7 +74,7 @@ config :pleroma, :http_security,
enabled: false
```
In the Nginx config, add the following into the `location /` block:
In the nginx config, add the following into the `location /` block:
```nginx
add_header X-XSS-Protection "0";
add_header X-Permitted-Cross-Domain-Policies none;
@ -90,7 +90,7 @@ listen 127.0.0.1:8099;
Set the `server_name` to your onion address.
Reload Nginx:
Reload nginx:
```
systemctl reload nginx
```
@ -101,7 +101,7 @@ You should now be able to both access your instance using Tor and federate with
### Possible Issues
* In Debian, make sure your hidden service folder `/var/lib/tor/akkoma_hidden_service/` and its contents, has debian-tor as both owner and group by using
* In Debian, make sure your hidden service folder `/var/lib/tor/akkoma_hidden_service/` and its contents, has debian-tor as both owner and group by using
```
ls -la /var/lib/tor/
```

View file

@ -1,6 +1,6 @@
# Optimizing the BEAM
Akkoma 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.
Akkoma 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 processes 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. Akkoma instances are often deployed on the same server as the required PostgreSQL database which can lead to situations where the Akkoma 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.
@ -18,7 +18,6 @@ Please only change these settings if you are experiencing issues or really know
* 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:

View file

@ -4,29 +4,29 @@ Varnish is a layer that sits between your web server and your backend applicatio
it does something similar to nginx caching, but tends to be optimised for speed over
all else.
To set up a varnish cache, first you'll need to install varnish.
To set up a Varnish cache, first you'll need to install Varnish.
This will vary by distribution, and since this is a rather advanced guide,
no copy-paste instructions are provided. It's probably in your distribution's
package manager, though. `apt-get install varnish` and so on.
Once you have varnish installed, you'll need to configure it to work with akkoma.
Once you have Varnish installed, you'll need to configure it to work with akkoma.
Copy the configuration file to the varnish configuration directory:
Copy the configuration file to the Varnish configuration directory:
cp installation/akkoma.vcl /etc/varnish/akkoma.vcl
You may want to check if varnish added a `default.vcl` file to the same directory,
if so you can just remove it without issue.
You may want to check if Varnish added a `default.vcl` file to the same directory,
if so, you can just remove it without issue.
Then boot up varnish, probably `systemctl start varnish` or `service varnish start`.
Then boot up Varnish, probably `systemctl start varnish` or `service varnish start`.
Now you should be able to `curl -D- localhost:6081` and see a bunch of
akkoma javascript.
Once that's out of the way, we can point our webserver at varnish. This
Once that's out of the way, we can point our webserver at Varnish. This
=== "Nginx"
=== "nginx"
upstream phoenix {
server 127.0.0.1:6081 max_fails=5 fail_timeout=60s;
@ -51,4 +51,4 @@ if (std.port(server.ip) != 443) {
}
```
This will allow your webserver alone to handle redirects.
This will allow your webserver alone to handle redirects.

View file

@ -10,4 +10,4 @@ It is also recommended to not use "Network Storage" option.
If your server runs other services, you may want to take that into account. E.g. if you have 4G ram, but 1G of it is already used for other services, it may be better to tell PGTune you only have 3G.
In the end, PGTune only provides recomended settings, you can always try to finetune further.
In the end, PGTune only provides recommended settings, you can always try to finetune further.

View file

@ -18,7 +18,7 @@ around 4 gigabytes. Like [RUM](./cheatsheet.md#rum-indexing-for-full-text-search
higher performance and ordering by timestamp in a reasonable amount of time.
Additionally, the search results seem to be more accurate.
Due to high memory usage, it may be best to set it up on a different machine, if running pleroma on a low-resource
Due to high memory usage, it may be best to set it up on a different machine, if running akkoma on a low-resource
computer, and use private key authentication to secure the remote search instance.
To use [meilisearch](https://www.meilisearch.com/), set the search module to `Pleroma.Search.Meilisearch`:
@ -26,8 +26,8 @@ To use [meilisearch](https://www.meilisearch.com/), set the search module to `Pl
> config :pleroma, Pleroma.Search, module: Pleroma.Search.Meilisearch
You then need to set the address of the meilisearch instance, and optionally the private key for authentication. You might
also want to change the `initial_indexing_chunk_size` to be smaller if you're server is not very powerful, but not higher than `100_000`,
because meilisearch will refuse to process it if it's too big. However, in general you want this to be as big as possible, because meilisearch
also want to change the `initial_indexing_chunk_size` to be smaller if your server is not very powerful, but not higher than `100_000`,
because Meilisearch will refuse to process it if it's too big. However, in general you want this to be as big as possible, because Meilisearch
indexes faster when it can process many posts in a single batch.
> config :pleroma, Pleroma.Search.Meilisearch,
@ -36,7 +36,7 @@ indexes faster when it can process many posts in a single batch.
> search_key: "search key",
> initial_indexing_chunk_size: 100_000
Information about setting up meilisearch can be found in the
Information about setting up Meilisearch can be found in the
[official documentation](https://docs.meilisearch.com/learn/getting_started/installation.html).
You probably want to start it with `MEILI_NO_ANALYTICS=true` environment variable to disable analytics.
At least version 0.25.0 is required, but you are strongly adviced to use at least 0.26.0, as it introduces
@ -93,7 +93,7 @@ To start the initial indexing, run the `index` command:
```
This will show you the total amount of posts to index, and then show you the amount of posts indexed currently, until the numbers eventually
become the same. The posts are indexed in big batches and meilisearch will take some time to actually index them, even after you have
become the same. The posts are indexed in big batches and Meilisearch will take some time to actually index them, even after you have
inserted all the posts into it. Depending on the amount of posts, this may be as long as several hours. To get information about the status
of indexing and how many posts have actually been indexed, use the `stats` command:
@ -131,9 +131,9 @@ depends on the amount of text in posts.
**Note: This requires at least ElasticSearch 7**
As with meilisearch, this can be rather memory-hungry, but it is very good at what it does.
As with Meilisearch, this can be rather memory-hungry, but it is very good at what it does.
To use [elasticsearch](https://www.elastic.co/), set the search module to `Pleroma.Search.Elasticsearch`:
To use [Elasticsearch](https://www.elastic.co/), set the search module to `Pleroma.Search.Elasticsearch`:
> config :pleroma, Pleroma.Search, module: Pleroma.Search.Elasticsearch
@ -146,7 +146,7 @@ You then need to set the URL and authentication credentials if relevant.
### Initial indexing
After setting up the configuration, you'll want to index all of your already existsing posts. You'll only have to do it one time, but it might take a while, depending on the amount of posts your instance has seen.
After setting up the configuration, you'll want to index all of your already existsing posts. You'll only have to do it one time, but it might take a while, depending on the amount of posts your instance has seen.
The sequence of actions is as follows:

View file

@ -49,7 +49,7 @@ Add `$static_dir/instance/thumbnail.jpeg` with your selfie or other neat picture
## Instance-specific panel
Create and Edit your file at `$static_dir/instance/panel.html`.
Create and edit your file at `$static_dir/instance/panel.html`.
## Background
@ -69,7 +69,7 @@ config :pleroma, :frontend_configurations,
!!! important
Note the extra `static` folder for the default logo.png location
If you want to give a brand to your instance, You can change the logo of your instance by uploading it to the static directory `$static_dir/static/logo.png`.
If you want to give a brand to your instance, you can change the logo of your instance by uploading it to the static directory `$static_dir/static/logo.png`.
Alternatively, you can specify the path to your logo in [your configuration](../cheatsheet/#frontend_configurations).
@ -91,21 +91,21 @@ Terms of Service will be shown to all users on the registration page. It's the b
## Favicon
The favicon will display on the frontend, and in the browser tab.
The favicon will display on the frontend, and in the browser tab.
Place a PNG file at `$static_dir/favicon.png` to change the favicon. Not that this
is _one level above_ where the logo is placed, it should be on the same level as
the `frontends` directory.
## 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.
## Overriding pleroma-fe styles
## Overriding akkoma-fe styles
To overwrite the CSS stylesheet of pleroma-fe, you can put a file at
To overwrite the CSS stylesheet of akkoma-fe, you can put a file at
`$static_dir/static/custom.css` containing your styles. These will be loaded
with the rest of the CSS.
You will probably have to put `!important` on most/all your styles to override the
default ones, due to the specificity precedence of CSS.
default ones, due to the specificity precedence of CSS.

View file

@ -1,10 +1,10 @@
# Storing Remote Media
Akkoma does not store remote/federated media by default. The best way to achieve this is to change Nginx to keep its reverse proxy cache
Akkoma does not store remote/federated media by default. The best way to achieve this is to change nginx to keep its reverse proxy cache
for a year and to activate the `MediaProxyWarmingPolicy` MRF policy in Akkoma which will automatically fetch all media through the proxy
as soon as the post is received by your instance.
## Nginx
## nginx
The following are excerpts from the [suggested nginx config](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/installation/nginx/akkoma.nginx) that demonstrates the necessary config for the media proxy to work.

View file

@ -137,7 +137,7 @@ Backwards-compatibility for admin API endpoints without version prefixes (`/api/
## `GET /api/v1/pleroma/admin/users/:nickname/permission_group`
### Get user user permission groups membership
### Get user permission groups membership
- Params: none
- Response:
@ -153,7 +153,7 @@ Backwards-compatibility for admin API endpoints without version prefixes (`/api/
Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesnt exist.
### Get user user permission groups membership per permission group
### Get user permission groups membership per permission group
- Params: none
- Response:
@ -303,7 +303,7 @@ Removes the user(s) from follower recommendations.
## `GET /api/v1/pleroma/admin/users/:nickname_or_id`
### Retrive the details of a user
### Retrieve the details of a user
- Params:
- `nickname` or `id`
@ -313,7 +313,7 @@ Removes the user(s) from follower recommendations.
## `GET /api/v1/pleroma/admin/users/:nickname_or_id/statuses`
### Retrive user's latest statuses
### Retrieve user's latest statuses
- Params:
- `nickname` or `id`
@ -337,7 +337,7 @@ Removes the user(s) from follower recommendations.
## `GET /api/v1/pleroma/admin/instances/:instance/statuses`
### Retrive instance's latest statuses
### Retrieve instance's latest statuses
- Params:
- `instance`: instance name
@ -377,7 +377,7 @@ It may take some time.
## `GET /api/v1/pleroma/admin/statuses`
### Retrives all latest statuses
### Retrieves all latest statuses
- Params:
- *optional* `page_size`: number of statuses to return (default is `20`)
@ -414,7 +414,7 @@ Params:
Response:
* On success: relay json object
* On success: relay JSON object
```json
{"actor": "https://example.com/relay", "followed_back": true}
@ -505,7 +505,7 @@ Response:
## `POST /api/v1/pleroma/admin/users/email_invite`
### Sends registration invite via email
### Sends a registration invite via email
- Params:
- `email`
@ -528,7 +528,6 @@ Response:
### Get a password reset token for a given nickname
- Params: none
- Response:
@ -541,7 +540,7 @@ Response:
## `PATCH /api/v1/pleroma/admin/users/force_password_reset`
### Force passord reset for a user with a given nickname
### Force password reset for a user with a given nickname
- Params:
- `nicknames`
@ -960,7 +959,7 @@ Status: 404
## `GET /api/v1/pleroma/admin/need_reboot`
### Returns the flag whether the pleroma should be restarted
### Returns whether Akkoma should be restarted
- Params: none
- Response:
@ -975,7 +974,7 @@ Status: 404
### Get list of merged default settings with saved in database.
*If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.*
*If `need_reboot` is `true`, the instance must be restarted, so reboot time settings can take effect.*
**Only works when configuration from database is enabled.**
@ -1044,7 +1043,7 @@ Most of the settings will be applied in `runtime`, this means that you don't nee
- `delete` - true (*optional*, if setting must be deleted)
- `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored)
*When a value have several nested settings, you can delete only some nested settings by passing a parameter `subkeys`, without deleting all settings by key.*
*When a value has several nested settings, you can delete only some nested settings by passing a parameter `subkeys`, without deleting all settings by key.*
```
[subkey: val1, subkey2: val2, subkey3: val3] \\ initial value
{"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion
@ -1130,7 +1129,7 @@ List of settings which support only full update by subkey:
## ` GET /api/v1/pleroma/admin/config/descriptions`
### Get JSON with config descriptions.
Loads json generated from `config/descriptions.exs`.
Loads JSON generated from `config/descriptions.exs`.
- Params: none
- Response:

View file

@ -1,10 +1,10 @@
# Differences in Mastodon API responses from vanilla Mastodon
A Akkoma instance can be identified by "<Mastodon version> (compatible; Akkoma <version>)" present in `version` field in response from `/api/v1/instance`
An Akkoma instance can be identified by "<Mastodon version> (compatible; Akkoma <version>)" present in `version` field in response from `/api/v1/instance`
## Flake IDs
Akkoma uses 128-bit ids as opposed to Mastodon's 64 bits. However, just like Mastodon's ids, they are lexically sortable strings
Akkoma uses 128-bit IDs as opposed to Mastodon's 64 bits. However, just like Mastodon's IDs, they are lexically sortable strings
## Timelines
@ -101,11 +101,11 @@ Endpoints which accept `with_relationships` parameter:
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
- `background_image`: nullable URL string, background image of the user
- `tags`: Lists an array of tags for the user
- `relationship` (object): Includes fields as documented for Mastodon API https://docs.joinmastodon.org/entities/relationship/
- `is_moderator`: boolean, nullable, true if user is a moderator
- `is_moderator`: boolean, nullable, true if user is a moderator
- `is_admin`: boolean, nullable, true if user is an admin
- `confirmation_pending`: boolean, true if a new user account is waiting on email confirmation to be activated
- `hide_favorites`: boolean, true when the user has hiding favorites enabled
@ -131,8 +131,8 @@ Has these additional fields under the `akkoma` object:
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
- `no_rich_text` - boolean, nullable, true when html tags are stripped from all statuses requested from the API
- `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
- `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.
@ -200,7 +200,7 @@ An endpoint to delete multiple statuses by IDs.
Required parameters:
- `ids`: array of activity ids
- `ids`: array of activity IDs
Usage example: `DELETE /api/v1/notifications/destroy_multiple/?ids[]=1&ids[]=2`.
@ -261,7 +261,7 @@ All images (avatar, banner and background) can be reset to the default by sendin
### Akkoma Settings Store
Akkoma has mechanism that allows frontends to save blobs of json for each user on the backend. This can be used to save frontend-specific settings for a user that the backend does not need to know about.
Akkoma has a mechanism that allows frontends to save blobs of json for each user on the backend. This can be used to save frontend-specific settings for a user that the backend does not need to know about.
The parameter should have a form of `{frontend_name: {...}}`, with `frontend_name` identifying your type of client, e.g. `pleroma_fe`. It will overwrite everything under this property, but will not overwrite other frontend's settings.
@ -340,7 +340,7 @@ Permits these additional alert types:
Has these additional fields under the `pleroma` object:
- `unread_count`: contains number unread notifications
- `unread_count`: contains number of unread notifications
## Streaming
@ -352,7 +352,7 @@ For viewing remote server timelines, there are `public:remote` and `public:remot
Akkoma streams follow relationships updates as `pleroma:follow_relationships_update` events to the `user` stream.
The message payload consist of:
The message payload consists of:
- `state`: a relationship state, one of `follow_pending`, `follow_accept` or `follow_reject`.

View file

@ -10,7 +10,7 @@
For routes with `:authenticated_api` pipeline, authentication & authorization are expected, thus `OAuthScopesPlug` will be run unless explicitly skipped (also `EnsureAuthenticatedPlug` will be executed immediately before action even if there was an early run to give an early error, since `OAuthScopesPlug` supports `:proceed_unauthenticated` option, and other plugs may support similar options as well).
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.
## Non-OAuth authentication

View file

@ -20,16 +20,16 @@ The docs are written in Markdown, including certain extensions, and can be found
Akkoma is written in [Elixir](https://elixir-lang.org/) and uses [Postgresql](https://www.postgresql.org/) for database. We use [Git](https://git-scm.com/) for collaboration and tracking code changes. Furthermore it can typically run on [Unix and Unix-like OS'es](https://en.wikipedia.org/wiki/Unix-like). For development, you should use an OS which [can run Akkoma](../installation/debian_based_en/).
It's good to have at least some basic understanding of at least Git and Elixir. If this is completely new for you, there's some [videos explaining Git](https://git-scm.com/doc) and Codeberg has a nice article explaining the typical [pull requests Git flow](https://docs.codeberg.org/collaborating/pull-requests-and-git-flow/). For Elixir, you can follow Elixir's own [Getting Started guide](https://elixir-lang.org/getting-started/introduction.html).
It's good to have at least some basic understanding of at least Git and Elixir. If this is completely new for you, there are some [videos explaining Git](https://git-scm.com/doc) and Codeberg has a nice article explaining the typical [pull requests Git flow](https://docs.codeberg.org/collaborating/pull-requests-and-git-flow/). For Elixir, you can follow Elixir's own [Getting Started guide](https://elixir-lang.org/getting-started/introduction.html).
## Setting up a development environment
The best way to start is getting the software to run from source so you can start poking on it. Check out the [guides for setting up an Akkoma instance for development](setting_up_akkoma_dev/#setting-up-a-akkoma-development-environment).
The best way to start is getting the software to run from source, so you can start poking on it. Check out the [guides for setting up an Akkoma instance for development](setting_up_akkoma_dev/#setting-up-a-akkoma-development-environment).
## General overview
### Modules
Akkoma has several modules. There are modules for [uploading](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/uploaders), [upload filters](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/upload/filter), [translators](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/akkoma/translators)... The most famous ones are without a doubt the [MRF policies](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/activity_pub/mrf). Modules are often self contained and a good way to start with development because you don't have to think about much more than just the module itself. We even have an example on [writing your own MRF policy](/configuration/mrf/#writing-your-own-mrf-policy)!
Akkoma has several modules. There are modules for [uploading](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/uploaders), [upload filters](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/upload/filter), [translators](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/akkoma/translators)... The most famous ones are without a doubt the [MRF policies](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/activity_pub/mrf). Modules are often self-contained and a good way to start with development because you don't have to think about much more than just the module itself. We even have an example on [writing your own MRF policy](/configuration/mrf/#writing-your-own-mrf-policy)!
Another easy entry point is the [mix tasks](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/mix/tasks/pleroma). They too are often self contained and don't need you to go through much of the code.

View file

@ -1,4 +1,4 @@
# Setting up a Akkoma development environment
# Setting up an Akkoma development environment
Akkoma requires some adjustments from the defaults for running the instance locally. The following should help you to get started.
@ -9,15 +9,15 @@ Akkoma requires some adjustments from the defaults for running the instance loca
* You can use your own fork of the repository and add akkoma as a remote `git remote add akkoma 'https://akkoma.dev/AkkomaGang/akkoma.git'`
* For domain you can use `localhost`
* For the DB you can still choose a dedicated user. The mix tasks sets it up, so it's no extra work for you
* instead of creating a `prod.secret.exs`, create `dev.secret.exs`
* 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
* You can skip nginx and systemd
* For front-end, you'll probably want to install and use the develop branch instead of the stable branch. There's no guarantee that the stable branch of the FE will always work on the develop branch of the BE.
2. Change the dev.secret.exs
* Change the FE settings to use the installed branch (see also [Frontend Management](/configuration/frontend_management/))
* Change the scheme in `config :pleroma, Pleroma.Web.Endpoint` to http (see examples below)
* 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 with `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 normally can.
3. You can now start the server with `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 normally can.
Example on how to install pleroma-fe and admin-fe using it's develop branch
```sh
@ -32,7 +32,7 @@ config :pleroma, :frontends,
admin: %{"name" => "admin-fe", "ref" => "develop"}
```
Example config to change the scheme to http. Change the port if you want to run on another port.
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],
@ -53,7 +53,7 @@ config :logger, :console,
## Testing with HTTPS
If you end up developing alongside other software like misskey,
If you end up developing alongside other software like Misskey,
you will not be able to federate without an SSL certificate. You should
be able to use the snakeoil certificate that comes standard with most
distributions or generate one from scratch, then force elixir to accept it.

View file

@ -3,9 +3,9 @@
# Introduction to Akkoma
## What is Akkoma?
Akkoma is a federated social networking platform, compatible with Mastodon and other ActivityPub implementations. It is free software licensed under the AGPLv3.
It actually consists of two components: a backend, named simply Akkoma, and a user-facing frontend, named Akkoma-FE. It also includes the Mastodon frontend, if that's your thing.
It's part of what we call the fediverse, a federated network of instances which speak common protocols and can communicate with each other.
One account on an instance is enough to talk to the entire fediverse!
It actually consists of two components: a backend, named simply Akkoma, and a user-facing frontend, named akkoma-fe. It also includes the Mastodon frontend, if that's your thing.
It's part of what we call the Fediverse, a federated network of instances which speak common protocols and can communicate with each other.
One account on an instance is enough to talk to the entire Fediverse!
## Community Channels
@ -29,15 +29,14 @@ If you don't feel like joining an existing instance, but instead prefer to deplo
Installation instructions can be found in the installation section of these docs.
## I got an account, now what?
Great! Now you can explore the fediverse! Open the login page for your Akkoma instance (e.g. <https://otp.akkoma.dev>) and login with your username and password. (If you don't have an account yet, click on Register)
Great! Now you can explore the Fediverse! Open the login page for your Akkoma instance (e.g. <https://otp.akkoma.dev>) and login with your username and password. (If you don't have an account yet, click on Register)
### Akkoma-FE
The default front-end used by Akkoma is Akkoma-FE. You can find more information on what it is and how to use it in the [Introduction to Akkoma-FE](https://docs-fe.akkoma.dev/stable/).
### akkoma-fe
The default front-end used by Akkoma is akkoma-fe. You can find more information on what it is and how to use it in the [Introduction to akkoma-fe](https://docs-fe.akkoma.dev/stable/).
### Mastodon interface
If the Akkoma-FE interface isn't your thing, or you're just trying something new but you want to keep using the familiar Mastodon interface, we got that too!
Just add a "/web" after your instance url (e.g. <https://otp.akkoma.dev/web>) and you'll end on the Mastodon web interface, but with a Akkoma backend! MAGIC!
If the akkoma-fe interface isn't your thing, or you're just trying something new but you want to keep using the familiar Mastodon interface, we got that too!
Just add a "/web" after your instance URL (e.g. <https://otp.akkoma.dev/web>) and you'll end on the Mastodon web interface, but with a Akkoma backend! MAGIC!
The Mastodon interface is from the Glitch-soc fork. For more information on the Mastodon interface you can check the [Mastodon](https://docs.joinmastodon.org/) and [Glitch-soc](https://glitch-soc.github.io/docs/) documentation.
Remember, what you see is only the frontend part of Mastodon, the backend is still Akkoma.

View file

@ -137,7 +137,7 @@ doas -u akkoma env MIX_ENV=prod mix phx.server
If you want to open your newly installed instance to the world, you should run nginx or some other webserver/proxy in front of Akkoma and you should consider to create an OpenRC service file for Akkoma.
#### Nginx
#### nginx
* Install nginx, if not already done:

View file

@ -20,7 +20,7 @@ This guide will assume that you have administrative rights, either as root or a
* `nginx` (preferred, example configs for other reverse proxies can be found in the repo)
* `certbot` (or any other ACME client for Lets Encrypt certificates)
* `ImageMagick`
* `imagemagick`
* `ffmpeg`
* `exiftool`
@ -130,7 +130,7 @@ sudo -Hu akkoma MIX_ENV=prod mix phx.server
If you want to open your newly installed instance to the world, you should run nginx or some other webserver/proxy in front of Akkoma and you should consider to create a systemd service file for Akkoma.
#### Nginx
#### nginx
* Install nginx, if not already done:

View file

@ -50,6 +50,11 @@ First, install some dependencies needed to build Elixir and Erlang:
sudo apt install curl unzip build-essential autoconf m4 libncurses5-dev libssh-dev unixodbc-dev xsltproc libxml2-utils libncurses-dev
```
Second, make sure that erlang and elixir (via asdf) is reachable from `sudo -Hu akkoma`:
```shell
echo 'Defaults>akkoma secure_path="/var/lib/akkoma/.asdf/shims:/sbin:/bin:/usr/sbin:/usr/bin"' > /etc/sudoers.d/custom_path
```
Then login to the `akkoma` user.
Install asdf by following steps 1 to 3 on [their website](https://asdf-vm.com/guide/getting-started.html), then restart the shell to load asdf:
@ -139,7 +144,7 @@ sudo -Hu akkoma MIX_ENV=prod mix phx.server
If you want to open your newly installed instance to the world, you should run nginx or some other webserver/proxy in front of Akkoma and you should consider to create a systemd service file for Akkoma.
#### Nginx
#### nginx
* Install nginx, if not already done:

View file

@ -113,7 +113,7 @@ This is a tad more complex in docker than on the host itself. It
You've got two options.
#### Running caddy in a container
#### Running Caddy in a container
This is by far the easiest option. It'll handle HTTPS and all that for you.

View file

@ -127,7 +127,7 @@ sudo -Hu akkoma MIX_ENV=prod mix phx.server
If you want to open your newly installed instance to the world, you should run nginx or some other webserver/proxy in front of Akkoma and you should consider to create a systemd service file for Akkoma.
#### Nginx
#### nginx
* Install nginx, if not already done:

View file

@ -181,7 +181,7 @@ It probably won't work over the public internet quite yet, however, as we still
Assuming you want to open your newly installed federated social network to, well, the federation, you should run nginx or some other webserver/proxy in front of Akkoma. It is also a good idea to set up Akkoma to run as a system service.
#### Nginx
#### nginx
* Install nginx, if not already done:
@ -197,7 +197,7 @@ Assuming you want to open your newly installed federated social network to, well
* Append the following line at the end of the `http` block in `/etc/nginx/nginx.conf`:
```Nginx
```nginx
include sites-enabled/*;
```

View file

@ -16,7 +16,7 @@ pkg_add elixir gmake git postgresql-server postgresql-contrib cmake ffmpeg erlan
pkg_add erlang-wx # Choose the latest version as package version when promted
```
Akkoma requires a reverse proxy, OpenBSD has relayd in base (and is used in this guide) and packages/ports are available for nginx (www/nginx) and apache (www/apache-httpd). Independently of the reverse proxy, [acme-client(1)](https://man.openbsd.org/acme-client) can be used to get a certificate from Let's Encrypt.
Akkoma requires a reverse proxy, OpenBSD has relayd in base (and is used in this guide) and packages/ports are available for nginx (www/nginx) and Apache (www/apache-httpd). Independently of the reverse proxy, [acme-client(1)](https://man.openbsd.org/acme-client) can be used to get a certificate from Let's Encrypt.
#### Optional software

View file

@ -1,30 +1,30 @@
# Optional software packages needed for specific functionality
For specific Akkoma functionality (which is disabled by default) some or all of the below packages are required:
* `ImageMagick`
* `ffmpeg`
* `exiftool`
For specific Akkoma functionality (which is disabled by default) some or all of the below projects are required:
* ImageMagick
* ffmpeg
* ExifTool
Please refer to documentation in `docs/installation` on how to install them on specific OS.
Note: the packages are not required with the current default settings of Akkoma.
## `ImageMagick`
## ImageMagick
`ImageMagick` is a set of tools to create, edit, compose, or convert bitmap images.
ImageMagick provides a set of tools to create, edit, compose, or convert bitmap images.
It is required for the following Akkoma features:
* `Pleroma.Upload.Filters.Mogrify`, `Pleroma.Upload.Filters.Mogrifun` upload filters (related config: `Pleroma.Upload/filters` in `config/config.exs`)
* Media preview proxy for still images (related config: `media_preview_proxy/enabled` in `config/config.exs`)
## `ffmpeg`
## ffmpeg
`ffmpeg` is software to record, convert and stream audio and video.
It is required for the following Akkoma features:
* Media preview proxy for videos (related config: `media_preview_proxy/enabled` in `config/config.exs`)
## `exiftool`
## ExifTool
`exiftool` is media files metadata reader/writer.

View file

@ -58,7 +58,7 @@ Other than things bundled in the OTP release Akkoma depends on:
Per [`docs/installation/optional/media_graphics_packages.md`](optional/media_graphics_packages.md):
* ImageMagick
* ffmpeg
* exiftool
* ExifTool
=== "Alpine"
```
@ -248,7 +248,7 @@ At this point if you open your (sub)domain in a browser you should see a 502 err
systemctl enable akkoma
```
If everything worked, you should see Akkoma-FE when visiting your domain. If that didn't happen, try reviewing the installation steps, starting Akkoma in the foreground and seeing if there are any errrors.
If everything worked, you should see akkoma-fe when visiting your domain. If that didn't happen, try reviewing the installation steps, starting Akkoma in the foreground and seeing if there are any errrors.
{! support.include !}

View file

@ -218,7 +218,7 @@ sudo systemctl start akkoma
sudo systemctl enable akkoma
```
If everything worked, you should see a response from Akkoma-BE when visiting your domain. You may need to install frontends like Akkoma-FE and Admin-FE; refer to [this guide](../administration/CLI_tasks/frontend.md) on how to install them.
If everything worked, you should see a response from Akkoma-BE when visiting your domain. You may need to install frontends like akkoma-fe and admin-fe; refer to [this guide](../administration/CLI_tasks/frontend.md) on how to install them.
If that didn't happen, try reviewing the installation steps, starting Akkoma in the foreground and seeing if there are any errrors.

View file

@ -1,5 +1,5 @@
## Support
If you encounter any issues or have questions regarding the install process, feel free to ask at [meta.akkoma.dev](https://meta.akkoma.dev/).
If you encounter any issues or have questions regarding the installation process, feel free to ask at [meta.akkoma.dev](https://meta.akkoma.dev/).
Or message via IRC on #akkoma at irc.akkoma.dev (port 6697, SSL)

View file

@ -20,6 +20,10 @@ defmodule Mix.Tasks.Pleroma.Database do
@shortdoc "A collection of database related tasks"
@moduledoc File.read!("docs/docs/administration/CLI_tasks/database.md")
defp maybe_concat(str, condition, appendix) do
if condition, do: str <> appendix, else: str
end
defp maybe_limit(query, limit_cnt) do
if is_number(limit_cnt) and limit_cnt > 0 do
limit(query, [], ^limit_cnt)
@ -116,6 +120,149 @@ def prune_orphaned_activities(limit \\ 0, opts \\ []) when is_number(limit) do
del_single + del_array
end
defp query_pinned_object_apids() do
Pleroma.User
|> select([u], %{ap_id: fragment("jsonb_object_keys(?)", u.pinned_objects)})
end
defp query_pinned_object_ids() do
# If this additional level of subquery is omitted and we directly supply AP ids
# to te final query, it appears to overexert PostgreSQL(17)'s planner leading
# to a very inefficient query with enormous memory and time consumption.
# By supplying database IDs it ends up quite cheap however.
Object
|> where([o], fragment("?->>'id' IN ?", o.data, subquery(query_pinned_object_apids())))
|> select([o], o.id)
end
defp query_followed_remote_user_apids() do
Pleroma.FollowingRelationship
|> join(:inner, [rel], ufing in User, on: rel.following_id == ufing.id)
|> join(:inner, [rel], ufer in User, on: rel.follower_id == ufer.id)
|> where([rel], rel.state == :follow_accept)
|> where([_rel, ufing, ufer], ufer.local and not ufing.local)
|> select([_rel, ufing], %{ap_id: ufing.ap_id})
end
defp parse_keep_followed_arg(options) do
case Keyword.get(options, :keep_followed) do
"full" -> :full
"posts" -> :posts
"none" -> false
nil -> false
_ -> raise "Invalid argument for keep_followed! Must be 'full', 'posts' or 'none'"
end
end
defp maybe_restrict_followed_activities(query, options) do
case Keyword.get(options, :keep_followed) do
:full ->
having(
query,
[a],
fragment(
"bool_and(?->>'actor' NOT IN ?)",
a.data,
subquery(query_followed_remote_user_apids())
)
)
:posts ->
having(
query,
[a],
not fragment(
"bool_or(?->>'actor' IN ? AND ?->>'type' = ANY('{Create,Announce}'))",
a.data,
subquery(query_followed_remote_user_apids()),
a.data
)
)
_ ->
query
end
end
defp deletable_objects_keeping_threads(time_deadline, limit_cnt, options) do
# We want to delete objects from threads where
# 1. the newest post is still old
# 2. none of the activities is local
# 3. none of the activities is bookmarked
# 4. optionally none of the posts is non-public
deletable_context =
if Keyword.get(options, :keep_non_public) do
Pleroma.Activity
|> join(:left, [a], b in Pleroma.Bookmark, on: a.id == b.activity_id)
|> group_by([a], fragment("? ->> 'context'::text", a.data))
|> having(
[a],
not fragment(
# Posts (checked on Create Activity) is non-public
"bool_or((not(?->'to' \\? ? OR ?->'cc' \\? ?)) and ? ->> 'type' = 'Create')",
a.data,
^Pleroma.Constants.as_public(),
a.data,
^Pleroma.Constants.as_public(),
a.data
)
)
else
Pleroma.Activity
|> join(:left, [a], b in Pleroma.Bookmark, on: a.id == b.activity_id)
|> group_by([a], fragment("? ->> 'context'::text", a.data))
end
|> having([a], max(a.updated_at) < ^time_deadline)
|> having([a], not fragment("bool_or(?)", a.local))
|> having([_, b], fragment("max(?::text) is null", b.id))
|> maybe_restrict_followed_activities(options)
|> maybe_limit(limit_cnt)
|> select([a], fragment("? ->> 'context'::text", a.data))
Pleroma.Object
|> where([o], fragment("? ->> 'context'::text", o.data) in subquery(deletable_context))
end
defp deletable_objects_breaking_threads(time_deadline, limit_cnt, options) do
deletable =
if Keyword.get(options, :keep_non_public) do
Pleroma.Object
|> where(
[o],
fragment(
"?->'to' \\? ? OR ?->'cc' \\? ?",
o.data,
^Pleroma.Constants.as_public(),
o.data,
^Pleroma.Constants.as_public()
)
)
else
Pleroma.Object
end
|> where([o], o.updated_at < ^time_deadline)
|> where(
[o],
fragment("split_part(?->>'actor', '/', 3) != ?", o.data, ^Pleroma.Web.Endpoint.host())
)
|> then(fn q ->
if Keyword.get(options, :keep_followed) do
where(
q,
[o],
fragment("?->>'actor'", o.data) not in subquery(query_followed_remote_user_apids())
)
else
q
end
end)
|> maybe_limit(limit_cnt)
|> select([o], o.id)
Pleroma.Object
|> where([o], o.id in subquery(deletable))
end
def run(["remove_embedded_objects" | args]) do
{options, [], []} =
OptionParser.parse(
@ -173,16 +320,9 @@ def run(["prune_orphaned_activities" | args]) do
{limit, options} = Keyword.pop(options, :limit, 0)
log_message = "Pruning orphaned activities"
log_message =
if limit > 0 do
log_message <> ", limiting deletion to #{limit} rows"
else
log_message
end
Logger.info(log_message)
"Pruning orphaned activities"
|> maybe_concat(limit > 0, ", limiting deletion to #{limit} rows")
|> Logger.info()
deleted = prune_orphaned_activities(limit, options)
@ -195,13 +335,22 @@ def run(["prune_objects" | args]) do
args,
strict: [
vacuum: :boolean,
keep_followed: :string,
keep_threads: :boolean,
keep_non_public: :boolean,
prune_orphaned_activities: :boolean,
prune_pinned: :boolean,
limit: :integer
]
)
kf = parse_keep_followed_arg(options)
options = Keyword.put(options, :keep_followed, kf)
if kf == :full and not Keyword.get(options, :keep_threads) do
raise "keep_followed=full only works in conjunction with keep_thread!"
end
start_pleroma()
deadline = Pleroma.Config.get([:instance, :remote_post_retention_days])
@ -209,111 +358,35 @@ def run(["prune_objects" | args]) do
limit_cnt = Keyword.get(options, :limit, 0)
log_message = "Pruning objects older than #{deadline} days"
log_message =
if Keyword.get(options, :keep_non_public) do
log_message <> ", keeping non public posts"
else
log_message
end
log_message =
if Keyword.get(options, :keep_threads) do
log_message <> ", keeping threads intact"
else
log_message
end
log_message =
if Keyword.get(options, :prune_orphaned_activities) do
log_message <> ", pruning orphaned activities"
else
log_message
end
log_message =
if Keyword.get(options, :vacuum) do
log_message <>
", doing a full vacuum (you shouldn't do this as a recurring maintanance task)"
else
log_message
end
log_message =
if limit_cnt > 0 do
log_message <> ", limiting to #{limit_cnt} rows"
else
log_message
end
Logger.info(log_message)
"Pruning objects older than #{deadline} days"
|> maybe_concat(Keyword.get(options, :keep_non_public), ", keeping non public posts")
|> maybe_concat(Keyword.get(options, :keep_threads), ", keeping threads intact")
|> maybe_concat(kf, ", keeping #{kf} activities of followed users")
|> maybe_concat(Keyword.get(options, :prune_pinned), ", pruning pinned posts")
|> maybe_concat(
Keyword.get(options, :prune_orphaned_activities),
", pruning orphaned activities"
)
|> maybe_concat(
Keyword.get(options, :vacuum),
", doing a full vacuum (you shouldn't do this as a recurring maintanance task)"
)
|> maybe_concat(limit_cnt > 0, ", limiting to #{limit_cnt} rows")
|> Logger.info()
{del_obj, _} =
if Keyword.get(options, :keep_threads) do
# We want to delete objects from threads where
# 1. the newest post is still old
# 2. none of the activities is local
# 3. none of the activities is bookmarked
# 4. optionally none of the posts is non-public
deletable_context =
if Keyword.get(options, :keep_non_public) do
Pleroma.Activity
|> join(:left, [a], b in Pleroma.Bookmark, on: a.id == b.activity_id)
|> group_by([a], fragment("? ->> 'context'::text", a.data))
|> having(
[a],
not fragment(
# Posts (checked on Create Activity) is non-public
"bool_or((not(?->'to' \\? ? OR ?->'cc' \\? ?)) and ? ->> 'type' = 'Create')",
a.data,
^Pleroma.Constants.as_public(),
a.data,
^Pleroma.Constants.as_public(),
a.data
)
)
else
Pleroma.Activity
|> join(:left, [a], b in Pleroma.Bookmark, on: a.id == b.activity_id)
|> group_by([a], fragment("? ->> 'context'::text", a.data))
end
|> having([a], max(a.updated_at) < ^time_deadline)
|> having([a], not fragment("bool_or(?)", a.local))
|> having([_, b], fragment("max(?::text) is null", b.id))
|> maybe_limit(limit_cnt)
|> select([a], fragment("? ->> 'context'::text", a.data))
Pleroma.Object
|> where([o], fragment("? ->> 'context'::text", o.data) in subquery(deletable_context))
deletable_objects_keeping_threads(time_deadline, limit_cnt, options)
else
deletable =
if Keyword.get(options, :keep_non_public) do
Pleroma.Object
|> where(
[o],
fragment(
"?->'to' \\? ? OR ?->'cc' \\? ?",
o.data,
^Pleroma.Constants.as_public(),
o.data,
^Pleroma.Constants.as_public()
)
)
else
Pleroma.Object
end
|> where([o], o.updated_at < ^time_deadline)
|> where(
[o],
fragment("split_part(?->>'actor', '/', 3) != ?", o.data, ^Pleroma.Web.Endpoint.host())
)
|> maybe_limit(limit_cnt)
|> select([o], o.id)
Pleroma.Object
|> where([o], o.id in subquery(deletable))
deletable_objects_breaking_threads(time_deadline, limit_cnt, options)
end
|> then(fn q ->
if Keyword.get(options, :prune_pinned) do
q
else
where(q, [o], o.id not in subquery(query_pinned_object_ids()))
end
end)
|> Repo.delete_all(timeout: :infinity)
Logger.info("Deleted #{del_obj} objects...")

View file

@ -182,6 +182,10 @@ def fetch_object_from_id(id, options \\ []) do
log_fetch_error(id, e)
{:reject, reason}
{:transmogrifier, {:error, reason}} = e ->
log_fetch_error(id, e)
{:error, reason}
{:transmogrifier, reason} = e ->
log_fetch_error(id, e)
{:error, reason}

View file

@ -2022,12 +2022,13 @@ def get_or_fetch_by_ap_id(ap_id, options \\ []) do
Creates an internal service actor by URI if missing.
Optionally takes nickname for addressing.
"""
@spec get_or_create_service_actor_by_ap_id(String.t(), String.t()) :: User.t() | nil
def get_or_create_service_actor_by_ap_id(uri, nickname) do
@spec get_or_create_service_actor_by_ap_id(String.t(), String.t(), Keyword.t()) ::
User.t() | nil
def get_or_create_service_actor_by_ap_id(uri, nickname, create_opts \\ []) do
{_, user} =
case get_cached_by_ap_id(uri) do
nil ->
with {:error, %{errors: errors}} <- create_service_actor(uri, nickname) do
with {:error, %{errors: errors}} <- create_service_actor(uri, nickname, create_opts) do
Logger.error("Cannot create service actor: #{uri}/.\n#{inspect(errors)}")
{:error, nil}
end
@ -2049,15 +2050,27 @@ defp set_invisible(user) do
|> update_and_set_cache()
end
@spec create_service_actor(String.t(), String.t()) ::
@spec create_service_actor(String.t(), String.t(), Keyword.t()) ::
{:ok, User.t()} | {:error, Ecto.Changeset.t()}
defp create_service_actor(uri, nickname) do
defp create_service_actor(uri, nickname, opts) do
%User{
invisible: true,
local: true,
ap_id: uri,
nickname: nickname,
follower_address: uri <> "/followers"
actor_type: "Application",
follower_address:
if Keyword.get(opts, :followable, false) do
uri <> "/followers"
else
nil
end,
following_address:
if Keyword.get(opts, :following, false) do
uri <> "/following"
else
nil
end
}
|> change
|> put_private_key()

View file

@ -47,7 +47,9 @@ def is_representable?(%Activity{} = activity) do
* `actor`: the actor which is signing the message
* `id`: the ActivityStreams URI of the message
"""
def publish_one(%{inbox: inbox, json: json, actor: %User{} = actor, id: id} = params) do
def publish_one(
%{"inbox" => inbox, "json" => json, "actor" => %User{} = actor, "id" => id} = params
) do
Logger.debug("Federating #{id} to #{inbox}")
uri = %{path: path} = URI.parse(inbox)
digest = "SHA-256=" <> (:crypto.hash(:sha256, json) |> Base.encode64())
@ -74,24 +76,24 @@ def publish_one(%{inbox: inbox, json: json, actor: %User{} = actor, id: id} = pa
{"digest", digest}
]
) do
if not Map.has_key?(params, :unreachable_since) || params[:unreachable_since] do
if not Map.has_key?(params, "unreachable_since") || params["unreachable_since"] do
Instances.set_reachable(inbox)
end
result
else
{_post_result, response} ->
unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
unless params["unreachable_since"], do: Instances.set_unreachable(inbox)
{:error, response}
end
end
def publish_one(%{actor_id: actor_id} = params) do
def publish_one(%{"actor_id" => actor_id} = params) do
actor = User.get_cached_by_id(actor_id)
params
|> Map.delete(:actor_id)
|> Map.put(:actor, actor)
|> Map.delete("actor_id")
|> Map.put("actor", actor)
|> publish_one()
end
@ -170,42 +172,8 @@ defp get_cc_ap_ids(ap_id, recipients) do
|> Enum.map(& &1.ap_id)
end
defp maybe_use_sharedinbox(%User{shared_inbox: nil, inbox: inbox}), do: inbox
defp maybe_use_sharedinbox(%User{shared_inbox: shared_inbox}), do: shared_inbox
@doc """
Determine a user inbox to use based on heuristics. These heuristics
are based on an approximation of the ``sharedInbox`` rules in the
[ActivityPub specification][ap-sharedinbox].
Please do not edit this function (or its children) without reading
the spec, as editing the code is likely to introduce some breakage
without some familiarity.
[ap-sharedinbox]: https://www.w3.org/TR/activitypub/#shared-inbox-delivery
"""
def determine_inbox(
%Activity{data: activity_data},
%User{inbox: inbox} = user
) do
to = activity_data["to"] || []
cc = activity_data["cc"] || []
type = activity_data["type"]
cond do
type == "Delete" ->
maybe_use_sharedinbox(user)
Pleroma.Constants.as_public() in to || Pleroma.Constants.as_public() in cc ->
maybe_use_sharedinbox(user)
length(to) + length(cc) > 1 ->
maybe_use_sharedinbox(user)
true ->
inbox
end
end
defp try_sharedinbox(%User{shared_inbox: nil, inbox: inbox}), do: inbox
defp try_sharedinbox(%User{shared_inbox: shared_inbox}), do: shared_inbox
@doc """
Publishes an activity with BCC to all relevant peers.
@ -237,11 +205,11 @@ def publish(%User{} = actor, %{data: %{"bcc" => bcc}} = activity)
|> Jason.encode!()
Pleroma.Web.Federator.Publisher.enqueue_one(__MODULE__, %{
inbox: inbox,
json: json,
actor_id: actor.id,
id: activity.data["id"],
unreachable_since: unreachable_since
"inbox" => inbox,
"json" => json,
"actor_id" => actor.id,
"id" => activity.data["id"],
"unreachable_since" => unreachable_since
})
end)
end)
@ -261,7 +229,7 @@ def publish(%User{} = actor, %Activity{} = activity) do
recipients(actor, activity)
|> Enum.map(fn %User{} = user ->
determine_inbox(activity, user)
try_sharedinbox(user)
end)
|> Enum.uniq()
|> Enum.filter(fn inbox -> should_federate?(inbox) end)
@ -270,11 +238,11 @@ def publish(%User{} = actor, %Activity{} = activity) do
Pleroma.Web.Federator.Publisher.enqueue_one(
__MODULE__,
%{
inbox: inbox,
json: json,
actor_id: actor.id,
id: activity.data["id"],
unreachable_since: unreachable_since
"inbox" => inbox,
"json" => json,
"actor_id" => actor.id,
"id" => activity.data["id"],
"unreachable_since" => unreachable_since
}
)
end)

View file

@ -16,7 +16,12 @@ defmodule Pleroma.Web.ActivityPub.Relay do
def ap_id, do: "#{Pleroma.Web.Endpoint.url()}/#{@nickname}"
@spec get_actor() :: User.t() | nil
def get_actor, do: User.get_or_create_service_actor_by_ap_id(ap_id(), @nickname)
def get_actor,
do:
User.get_or_create_service_actor_by_ap_id(ap_id(), @nickname,
followable: true,
following: true
)
@spec follow(String.t()) :: {:ok, Activity.t()} | {:error, any()}
def follow(target_instance) do

View file

@ -118,7 +118,7 @@ defp normalise_addressing_public_list(%{} = map, [field | fields]) do
Map.put(map, field, new_fval)
else
map
Map.put(map, field, [])
end
normalise_addressing_public_list(map, fields)
@ -208,6 +208,19 @@ def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object, options)
def fix_in_reply_to(object, _options), do: object
# Pleroma sends unlisted posts without addressing public scope in the enclosing activity
# but we only use the ativity for access perm cheks, see:
# https://git.pleroma.social/pleroma/pleroma/-/issues/3323
defp fix_create_visibility(%{"type" => "Create", "object" => %{} = object} = activity) do
activity
|> Map.put("to", object["to"])
|> Map.put("cc", object["cc"])
|> Map.put("bto", object["bto"])
|> Map.put("bcc", object["bcc"])
end
defp fix_create_visibility(activity), do: activity
def fix_quote_url(object, options \\ [])
def fix_quote_url(%{"quoteUri" => quote_url} = object, options)
@ -513,6 +526,7 @@ defp handle_incoming_normalised(
)
when objtype in ~w{Question Answer Audio Video Event Article Note Page} do
fetch_options = Keyword.put(options, :depth, (options[:depth] || 0) + 1)
data = fix_create_visibility(data)
object =
data["object"]
@ -672,6 +686,16 @@ defp handle_incoming_normalised(
end
end
defp handle_incoming_normalised(
%{
"type" => "Undo",
"object" => %{"type" => "Delete"}
},
_options
) do
{:error, :unsupported}
end
# For Undos that don't have the complete object attached, try to find it in our database.
defp handle_incoming_normalised(
%{
@ -713,7 +737,7 @@ defp handle_incoming_normalised(
end
end
defp handle_incoming_normalised(_, _), do: :error
defp handle_incoming_normalised(_, _), do: {:error, :unsupported}
@spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil
def get_obj_helper(id, options \\ []) do

View file

@ -16,9 +16,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do
import Ecto.Query
def render("endpoints.json", %{user: %User{nickname: nil, local: true} = _user}) do
%{"sharedInbox" => url(~p"/inbox")}
end
defp maybe_put(map, _, nil), do: map
defp maybe_put(map, k, v), do: Map.put(map, k, v)
def render("endpoints.json", %{user: %User{local: true} = _user}) do
%{
@ -39,13 +38,11 @@ def render("service.json", %{user: user}) do
%{
"id" => user.ap_id,
"type" => "Application",
"following" => "#{user.ap_id}/following",
"followers" => "#{user.ap_id}/followers",
"inbox" => "#{user.ap_id}/inbox",
"outbox" => "#{user.ap_id}/outbox",
"name" => "Pleroma",
"name" => "Akkoma",
"summary" =>
"An internal service actor for this Pleroma instance. No user-serviceable parts inside.",
"An internal service actor for this Akkoma instance. No user-serviceable parts inside.",
"url" => user.ap_id,
"manuallyApprovesFollowers" => false,
"publicKey" => %{
@ -56,16 +53,15 @@ def render("service.json", %{user: user}) do
"endpoints" => endpoints,
"invisible" => User.invisible?(user)
}
|> maybe_put("following", user.following_address)
|> maybe_put("followers", user.follower_address)
|> maybe_put("preferredUsername", user.nickname)
|> Map.merge(Utils.make_json_ld_header())
end
# the instance itself is not a Person, but instead an Application
def render("user.json", %{user: %User{nickname: nil} = user}),
def render("user.json", %{user: %User{actor_type: "Application"} = user}),
do: render("service.json", %{user: user})
def render("user.json", %{user: %User{nickname: "internal." <> _} = user}),
do: render("service.json", %{user: user}) |> Map.put("preferredUsername", user.nickname)
def render("user.json", %{user: user}) do
public_key =
case User.SigningKey.public_key_pem(user) do

View file

@ -40,6 +40,7 @@ def put_in_banned_urls(url) when is_binary(url) do
end
def url(url) when is_nil(url) or url == "", do: nil
def url("//" <> _ = url), do: url("https:" <> url)
def url("/" <> _ = url), do: url
def url(url) do
@ -55,7 +56,10 @@ def url_proxiable?(url) do
not local?(url) and not whitelisted?(url) and not blocked?(url) and http_scheme?(url)
end
def preview_url(url, preview_params \\ []) do
def preview_url(url, preview_params \\ [])
def preview_url("//" <> _ = url, pparams), do: preview_url("https:" <> url, pparams)
def preview_url(url, preview_params) do
if preview_enabled?() and url_proxiable?(url) do
encode_preview_url(url, preview_params)
else

View file

@ -62,7 +62,11 @@ def activity_nsfw?(_) do
defp activated_providers do
unless Pleroma.Config.restrict_unauthenticated_access?(:activities, :local) do
[Pleroma.Web.Metadata.Providers.Feed | Pleroma.Config.get([__MODULE__, :providers], [])]
[
Pleroma.Web.Metadata.Providers.Feed,
Pleroma.Web.Metadata.Providers.ApUrl
| Pleroma.Config.get([__MODULE__, :providers], [])
]
else
[]
end

View file

@ -0,0 +1,35 @@
# Akkoma: Magically expressive social media
# Copyright © 2025 Akkoma Authors <https://akkoma.dev/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Providers.ApUrl do
alias Pleroma.Web.Metadata.Providers.Provider
@behaviour Provider
defp alt_link(uri, type) do
{
:link,
[rel: "alternate", href: uri, type: type],
[]
}
end
defp ap_alt_links(uri) do
[
alt_link(uri, "application/activity+json"),
alt_link(uri, "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")
]
end
@impl Provider
def build_tags(%{object: %{data: %{"id" => ap_id}}}) when is_binary(ap_id) do
ap_alt_links(ap_id)
end
def build_tags(%{user: %{ap_id: ap_id}}) when is_binary(ap_id) do
ap_alt_links(ap_id)
end
def build_tags(_), do: []
end

View file

@ -3,6 +3,7 @@ defmodule Pleroma.Web.Telemetry do
import Telemetry.Metrics
alias Pleroma.Stats
alias Pleroma.Config
require Logger
def start_link(arg) do
Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
@ -10,6 +11,8 @@ def start_link(arg) do
@impl true
def init(_arg) do
subscribe_to_events()
children =
[
{:telemetry_poller, measurements: periodic_measurements(), period: 10_000}
@ -32,6 +35,82 @@ defp prometheus_children do
end
end
defp subscribe_to_events() do
# note: all handlers for a event are executed blockingly
# before the event can conclude, so they mustn't do anything heavy
:telemetry.attach(
"akkoma-oban-jobs-stop",
[:oban, :job, :stop],
&__MODULE__.handle_lib_event/4,
[]
)
:telemetry.attach(
"akkoma-oban-jobs-fail",
[:oban, :job, :exception],
&__MODULE__.handle_lib_event/4,
[]
)
end
def handle_lib_event(
[:oban, :job, event],
_measurements,
%{state: :discard, worker: "Pleroma.Workers.PublisherWorker"} = meta,
_config
)
when event in [:stop, :exception] do
{full_target, simple_target, reason} =
case meta.args["op"] do
"publish" ->
{meta.args["activity_id"], nil, "inbox_collection"}
"publish_one" ->
full_target = get_in(meta.args, ["params", "inbox"])
%{host: simple_target} = URI.parse(full_target || "")
error = collect_apdelivery_error(event, meta)
{full_target, simple_target, error}
end
Logger.error("Failed AP delivery: #{inspect(reason)} for #{inspect(full_target)}")
:telemetry.execute([:akkoma, :ap, :delivery, :fail], %{final: 1}, %{
reason: reason,
target: simple_target
})
end
def handle_lib_event([:oban, :job, _], _, _, _), do: :ok
defp collect_apdelivery_error(:exception, %{result: nil, reason: reason}) do
case reason do
%Oban.CrashError{} -> "crash"
%Oban.TimeoutError{} -> "timeout"
%type{} -> "exception_#{type}"
end
end
defp collect_apdelivery_error(:exception, %{result: {:error, error}}) do
process_fail_reason(error)
end
defp collect_apdelivery_error(:stop, %{result: {_, reason}}) do
process_fail_reason(reason)
end
defp collect_apdelivery_error(_, _) do
"cause_unknown"
end
defp process_fail_reason(error) do
case error do
error when is_binary(error) -> error
error when is_atom(error) -> "#{error}"
%{status: code} when is_number(code) -> "http_#{code}"
_ -> "error_unknown"
end
end
# A seperate set of metrics for distributions because phoenix dashboard does NOT handle them well
defp distribution_metrics do
[
@ -215,7 +294,8 @@ defp common_metrics(byte_unit \\ :byte) do
last_value("pleroma.local_users.total"),
last_value("pleroma.domains.total"),
last_value("pleroma.local_statuses.total"),
last_value("pleroma.remote_users.total")
last_value("pleroma.remote_users.total"),
counter("akkoma.ap.delivery.fail.final", tags: [:target, :reason])
]
end

View file

@ -9,7 +9,11 @@ defmodule Pleroma.Workers.PublisherWorker do
use Pleroma.Workers.WorkerHelper, queue: "federator_outgoing"
def backoff(%Job{attempt: attempt}) when is_integer(attempt) do
Pleroma.Workers.WorkerHelper.sidekiq_backoff(attempt, 5)
if attempt > 3 do
Pleroma.Workers.WorkerHelper.exponential_backoff(attempt, 9.5)
else
Pleroma.Workers.WorkerHelper.sidekiq_backoff(attempt, 6)
end
end
@impl Oban.Worker
@ -30,7 +34,6 @@ def perform(%Job{
end
def perform(%Job{args: %{"op" => "publish_one", "module" => module_name, "params" => params}}) do
params = Map.new(params, fn {k, v} -> {String.to_atom(k), v} end)
Federator.perform(:publish_one, String.to_atom(module_name), params)
Federator.perform(:publish_one, String.to_existing_atom(module_name), params)
end
end

View file

@ -7,7 +7,24 @@ defmodule Pleroma.Workers.ReceiverWorker do
alias Pleroma.Web.Federator
use Pleroma.Workers.WorkerHelper, queue: "federator_incoming"
use Pleroma.Workers.WorkerHelper,
queue: "federator_incoming",
unique: [
keys: [:op, :id],
# all states except :discarded
states: [:scheduled, :available, :executing, :retryable, :completed, :cancelled]
]
def enqueue(op, %{"id" => _} = params, worker_args), do: do_enqueue(op, params, worker_args)
def enqueue(op, %{"params" => %{"id" => id}} = params, worker_args) when is_binary(id) do
do_enqueue(op, Map.put(params, "id", id), worker_args)
end
def enqueue(op, params, worker_args) do
# should be rare if it happens at all (transient activity)
do_enqueue(op, Map.put(params, "id", Ecto.UUID.generate()), worker_args)
end
@impl Oban.Worker
def perform(%Job{args: %{"op" => "incoming_ap_doc", "params" => params}}) do
@ -18,13 +35,17 @@ def perform(%Job{args: %{"op" => "incoming_ap_doc", "params" => params}}) do
{:discard, :origin_containment_failed}
{:error, {:reject, reason}} ->
{:discard, reason}
{:cancel, reason}
{:error, :already_present} ->
{:discard, :already_present}
{:cancel, :already_present}
{:error, :ignore} ->
{:discard, :ignore}
{:cancel, :ignore}
{:error, :unsupported} ->
Logger.info("Received unsupported action: #{inspect(params)}")
{:cancel, :unsupported}
# invalid data or e.g. deleting an object we don't know about anyway
{:error, {:validate, issue}} ->

View file

@ -16,22 +16,22 @@ def perform(%Job{args: %{"op" => "fetch_remote", "id" => id} = args}) do
:ok
{:error, :forbidden} ->
{:discard, :forbidden}
{:cancel, :forbidden}
{:error, :not_found} ->
{:discard, :not_found}
{:cancel, :not_found}
{:error, :allowed_depth} ->
{:discard, :allowed_depth}
{:cancel, :allowed_depth}
{:error, :invalid_uri_scheme} ->
{:discard, :invalid_uri_scheme}
{:cancel, :invalid_uri_scheme}
{:error, :local_resource} ->
{:discard, :local_resource}
{:cancel, :local_resource}
{:reject, _} ->
{:discard, :reject}
{:cancel, :reject}
{:error, :id_mismatch} ->
{:discard, :id_mismatch}

View file

@ -22,6 +22,15 @@ def sidekiq_backoff(attempt, pow \\ 4, base_backoff \\ 15) do
trunc(backoff)
end
def exponential_backoff(attempt, base, base_backoff \\ 15) do
backoff =
:math.pow(base, attempt) +
base_backoff +
:rand.uniform(2 * base_backoff) * attempt
trunc(backoff)
end
defmacro __using__(opts) do
caller_module = __CALLER__.module
queue = Keyword.fetch!(opts, :queue)

View file

@ -175,7 +175,9 @@ defp deps do
{:pot, "~> 1.0"},
{:ex_const, "~> 0.2"},
{:plug_static_index_html, "~> 1.0.0"},
{:flake_id, "~> 0.1.0"},
{:flake_id,
git: "https://akkoma.dev/AkkomaGang/flake_id.git",
ref: "5a68513f7e7353706e788781eff6e56bf00bb41b"},
{:concurrent_limiter,
git: "https://akkoma.dev/AkkomaGang/concurrent-limiter.git",
ref: "a9e0b3d64574bdba761f429bb4fba0cf687b3338"},

View file

@ -50,7 +50,7 @@
"file_ex": {:git, "https://akkoma.dev/AkkomaGang/file_ex.git", "cc7067c7d446c2526e9ecf91d40896b088851569", [ref: "cc7067c7d446c2526e9ecf91d40896b088851569"]},
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
"finch": {:hex, :finch, "0.18.0", "944ac7d34d0bd2ac8998f79f7a811b21d87d911e77a786bc5810adb75632ada4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69f5045b042e531e53edc2574f15e25e735b522c37e2ddb766e15b979e03aa65"},
"flake_id": {:hex, :flake_id, "0.1.0", "7716b086d2e405d09b647121a166498a0d93d1a623bead243e1f74216079ccb3", [:mix], [{:base62, "~> 1.2", [hex: :base62, repo: "hexpm", optional: false]}, {:ecto, ">= 2.0.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "31fc8090fde1acd267c07c36ea7365b8604055f897d3a53dd967658c691bd827"},
"flake_id": {:git, "https://akkoma.dev/AkkomaGang/flake_id.git", "5a68513f7e7353706e788781eff6e56bf00bb41b", [ref: "5a68513f7e7353706e788781eff6e56bf00bb41b"]},
"floki": {:hex, :floki, "0.37.0", "b83e0280bbc6372f2a403b2848013650b16640cd2470aea6701f0632223d719e", [:mix], [], "hexpm", "516a0c15a69f78c47dc8e0b9b3724b29608aa6619379f91b1ffa47109b5d0dd3"},
"gen_smtp": {:hex, :gen_smtp, "1.2.0", "9cfc75c72a8821588b9b9fe947ae5ab2aed95a052b81237e0928633a13276fd3", [:rebar3], [{:ranch, ">= 1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "5ee0375680bca8f20c4d85f58c2894441443a743355430ff33a783fe03296779"},
"gettext": {:hex, :gettext, "0.22.3", "c8273e78db4a0bb6fba7e9f0fd881112f349a3117f7f7c598fa18c66c888e524", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "935f23447713954a6866f1bb28c3a878c4c011e802bcd68a726f5e558e4b64bd"},

View file

@ -0,0 +1,22 @@
defmodule Pleroma.Repo.Migrations.ReceiverWorkerIdKey do
use Ecto.Migration
def up() do
# since we currently still support PostgreSQL 12 and 13, do NOT use the args['id'] snytax!
"""
UPDATE public.oban_jobs
SET args = jsonb_set(
args,
'{id}',
to_jsonb(COALESCE(args#>>'{params,id}', id::text))
)
WHERE worker = 'Pleroma.Workers.ReceiverWorker';
"""
|> Pleroma.Repo.query!([], timeout: :infinity)
end
def down() do
# no action needed
:ok
end
end

View file

@ -0,0 +1,41 @@
defmodule Pleroma.Repo.Migrations.InstanceActorsTweaks do
use Ecto.Migration
import Ecto.Query
def up() do
# since Akkoma isnt up and running at this point, Web.endpoint()
# isnt available and we can't use the functions from Relay and InternalFetchActor,
# thus the AP ID suffix are hardcoded here and used together with a check for locality
# (e.g. custom ports make it hard to hardcode the full base url)
relay_ap_id = "%/relay"
fetch_ap_id = "%/internal/fetch"
# Convert to Application type
Pleroma.User
|> where([u], u.local and (like(u.ap_id, ^fetch_ap_id) or like(u.ap_id, ^relay_ap_id)))
|> Pleroma.Repo.update_all(set: [actor_type: "Application"])
# Drop bogus follow* addresses
Pleroma.User
|> where([u], u.local and like(u.ap_id, ^fetch_ap_id))
|> Pleroma.Repo.update_all(set: [follower_address: nil, following_address: nil])
# Add required follow* addresses
Pleroma.User
|> where([u], u.local and like(u.ap_id, ^relay_ap_id))
|> update([u],
set: [
follower_address: fragment("CONCAT(?, '/followers')", u.ap_id),
following_address: fragment("CONCAT(?, '/following')", u.ap_id)
]
)
|> Pleroma.Repo.update_all([])
end
def down do
# We don't know if the type was Person or Application before and
# without this or the lost patch it didn't matter, so just do nothing
:ok
end
end

View file

@ -13,6 +13,10 @@ def scrub_attribute(:img, {"src", "http" <> target}) do
{"src", media_url}
end
def scrub_attribute(:img, {"src", "//" <> target}) do
scrub_attribute(:img, {"src", "https://" <> target})
end
def scrub_attribute(_tag, attribute), do: attribute
def scrub({:img, attributes, children}) do

View file

@ -88,6 +88,74 @@ test "it prunes old objects from the database", %{old_insert_date: old_insert_da
refute Object.get_by_id(note_remote_non_public_id)
end
test "it retains pinned posts by default", %{old_insert_date: old_insert_date} do
insert(:note)
pin_user = insert(:user, local: false)
%{id: note_remote_pinned_id, data: note_remote_pinned_data} =
:note
|> insert(user: pin_user)
|> Ecto.Changeset.change(%{updated_at: old_insert_date})
|> Repo.update!()
User.add_pinned_object_id(pin_user, note_remote_pinned_data["id"])
note_remote_non_public =
%{id: note_remote_non_public_id, data: note_remote_non_public_data} =
:note
|> insert()
note_remote_non_public
|> Ecto.Changeset.change(%{
updated_at: old_insert_date,
data: note_remote_non_public_data |> update_in(["to"], fn _ -> [] end)
})
|> Repo.update!()
assert length(Repo.all(Object)) == 3
Mix.Tasks.Pleroma.Database.run(["prune_objects"])
assert length(Repo.all(Object)) == 2
assert Object.get_by_id(note_remote_pinned_id)
refute Object.get_by_id(note_remote_non_public_id)
end
test "it prunes pinned posts with --prune-pinned", %{old_insert_date: old_insert_date} do
insert(:note)
pin_user = insert(:user, local: false)
%{id: note_remote_pinned_id, data: note_remote_pinned_data} =
:note
|> insert(user: pin_user)
|> Ecto.Changeset.change(%{updated_at: old_insert_date})
|> Repo.update!()
User.add_pinned_object_id(pin_user, note_remote_pinned_data["id"])
note_remote_non_public =
%{id: note_remote_non_public_id, data: note_remote_non_public_data} =
:note
|> insert()
note_remote_non_public
|> Ecto.Changeset.change(%{
updated_at: old_insert_date,
data: note_remote_non_public_data |> update_in(["to"], fn _ -> [] end)
})
|> Repo.update!()
assert length(Repo.all(Object)) == 3
Mix.Tasks.Pleroma.Database.run(["prune_objects", "--prune-pinned"])
assert length(Repo.all(Object)) == 1
refute Object.get_by_id(note_remote_pinned_id)
refute Object.get_by_id(note_remote_non_public_id)
end
test "it cleans up bookmarks", %{old_insert_date: old_insert_date} do
user = insert(:user)
{:ok, old_object_activity} = CommonAPI.post(user, %{status: "yadayada"})
@ -351,6 +419,85 @@ test "with the --keep-threads option it keeps old threads with bookmarked posts"
assert length(Repo.all(Object)) == 1
end
defp prepare_keep_followed_test(old_insert_date) do
remote_user = insert(:user, local: false)
local_user = insert(:user, local: true)
third_party = insert(:user, local: false)
CommonAPI.follow(local_user, remote_user)
CommonAPI.accept_follow_request(local_user, remote_user)
assert :follow_accept == Pleroma.FollowingRelationship.get(local_user, remote_user).state
{:ok, old_remote_post_activity} =
CommonAPI.post(remote_user, %{status: "some thing", local: false})
old_remote_post_activity
|> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date})
|> Repo.update!()
old_remote_post_activity.object
|> Ecto.Changeset.change(%{updated_at: old_insert_date})
|> Repo.update!()
{:ok, old_liked_post_activity} =
CommonAPI.post(third_party, %{status: "boo!", local: false})
{:ok, old_like_activity} = CommonAPI.favorite(remote_user, old_liked_post_activity.id)
old_liked_post_activity
|> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date})
|> Repo.update!()
old_liked_post_activity.object
|> Ecto.Changeset.change(%{updated_at: old_insert_date})
|> Repo.update!()
old_like_activity
|> Ecto.Changeset.change(%{local: false, updated_at: old_insert_date})
|> Repo.update!()
assert length(Repo.all(Object)) == 2
{old_remote_post_activity.object.id, old_liked_post_activity.object.id}
end
test "by default does not keep posts of followed users", %{
old_insert_date: old_insert_date
} do
_ = prepare_keep_followed_test(old_insert_date)
Mix.Tasks.Pleroma.Database.run(["prune_objects"])
assert length(Repo.all(Object)) == 0
end
test "with the --keep-followed posts option it keeps old posts of followed users", %{
old_insert_date: old_insert_date
} do
{old_remote_post_id, old_liked_post_id} =
prepare_keep_followed_test(old_insert_date)
Mix.Tasks.Pleroma.Database.run(["prune_objects", "--keep-followed", "posts"])
assert length(Repo.all(Object)) == 1
assert Object.get_by_id(old_remote_post_id)
refute Object.get_by_id(old_liked_post_id)
end
test "with the --keep-followed full option it keeps old posts liked by a followed user", %{
old_insert_date: old_insert_date
} do
_ = prepare_keep_followed_test(old_insert_date)
Mix.Tasks.Pleroma.Database.run([
"prune_objects",
"--keep-followed",
"full",
"--keep-threads"
])
assert length(Repo.all(Object)) == 2
end
test "We don't have unexpected tables which may contain objects that are referenced by activities" do
# We can delete orphaned activities. For that we look for the objects they reference in the 'objects', 'activities', and 'users' table.
# If someone adds another table with objects (idk, maybe with separate relations, or collections or w/e), then we need to make sure we

View file

@ -58,7 +58,11 @@ test "returns relay user" do
local: true,
ap_id: ^uri,
follower_address: ^followers_uri
} = User.get_or_create_service_actor_by_ap_id(uri, "relay")
} =
User.get_or_create_service_actor_by_ap_id(uri, "relay",
followable: true,
following: true
)
assert capture_log(fn ->
refute User.get_or_create_service_actor_by_ap_id("/relay", "relay")
@ -67,7 +71,6 @@ test "returns relay user" do
test "returns invisible actor" do
uri = "#{Pleroma.Web.Endpoint.url()}/internal/fetch-test"
followers_uri = "#{uri}/followers"
user = User.get_or_create_service_actor_by_ap_id(uri, "internal.fetch-test")
assert %User{
@ -75,7 +78,7 @@ test "returns invisible actor" do
invisible: true,
local: true,
ap_id: ^uri,
follower_address: ^followers_uri
follower_address: nil
} = user
user2 = User.get_or_create_service_actor_by_ap_id(uri, "internal.fetch-test")

View file

@ -0,0 +1,32 @@
# Akkoma: Magically expressive social media
# Copyright © 2025 Akkoma Authors <https://akkoma.dev/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.InternalFetchActorTests do
use Pleroma.DataCase, async: true
alias Pleroma.User
alias Pleroma.Web.ActivityPub.InternalFetchActor
test "creates a fetch actor if needed" do
user = InternalFetchActor.get_actor()
assert user
assert user.ap_id == "#{Pleroma.Web.Endpoint.url()}/internal/fetch"
end
test "fetch actor is an application" do
user = InternalFetchActor.get_actor()
assert user.actor_type == "Application"
end
test "fetch actor doesn't expose follow* collections" do
user = InternalFetchActor.get_actor()
refute user.follower_address
refute user.following_address
end
test "fetch actor is invisible" do
user = InternalFetchActor.get_actor()
assert User.invisible?(user)
end
end

View file

@ -11,7 +11,6 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
import Tesla.Mock
import Mock
alias Pleroma.Activity
alias Pleroma.Instances
alias Pleroma.Object
alias Pleroma.Web.ActivityPub.Publisher
@ -51,82 +50,6 @@ test "it returns links" do
end
end
describe "determine_inbox/2" do
test "it returns sharedInbox for messages involving as:Public in to" do
user = insert(:user, %{shared_inbox: "http://example.com/inbox"})
activity = %Activity{
data: %{"to" => [@as_public], "cc" => [user.follower_address]}
}
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
end
test "it returns sharedInbox for messages involving as:Public in cc" do
user = insert(:user, %{shared_inbox: "http://example.com/inbox"})
activity = %Activity{
data: %{"cc" => [@as_public], "to" => [user.follower_address]}
}
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
end
test "it returns sharedInbox for messages involving multiple recipients in to" do
user = insert(:user, %{shared_inbox: "http://example.com/inbox"})
user_two = insert(:user)
user_three = insert(:user)
activity = %Activity{
data: %{"cc" => [], "to" => [user.ap_id, user_two.ap_id, user_three.ap_id]}
}
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
end
test "it returns sharedInbox for messages involving multiple recipients in cc" do
user = insert(:user, %{shared_inbox: "http://example.com/inbox"})
user_two = insert(:user)
user_three = insert(:user)
activity = %Activity{
data: %{"to" => [], "cc" => [user.ap_id, user_two.ap_id, user_three.ap_id]}
}
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
end
test "it returns sharedInbox for messages involving multiple recipients in total" do
user =
insert(:user, %{
shared_inbox: "http://example.com/inbox",
inbox: "http://example.com/personal-inbox"
})
user_two = insert(:user)
activity = %Activity{
data: %{"to" => [user_two.ap_id], "cc" => [user.ap_id]}
}
assert Publisher.determine_inbox(activity, user) == "http://example.com/inbox"
end
test "it returns inbox for messages involving single recipients in total" do
user =
insert(:user, %{
shared_inbox: "http://example.com/inbox",
inbox: "http://example.com/personal-inbox"
})
activity = %Activity{
data: %{"to" => [user.ap_id], "cc" => []}
}
assert Publisher.determine_inbox(activity, user) == "http://example.com/personal-inbox"
end
end
describe "publish_one/1" do
test "publish to url with with different ports" do
inbox80 = "http://42.site/users/nick1/inbox"
@ -146,20 +69,20 @@ test "publish to url with with different ports" do
assert {:ok, %{body: "port 42"}} =
Publisher.publish_one(%{
inbox: inbox42,
json: "{}",
actor: actor,
id: 1,
unreachable_since: true
"inbox" => inbox42,
"json" => "{}",
"actor" => actor,
"id" => 1,
"unreachable_since" => true
})
assert {:ok, %{body: "port 80"}} =
Publisher.publish_one(%{
inbox: inbox80,
json: "{}",
actor: actor,
id: 1,
unreachable_since: true
"inbox" => inbox80,
"json" => "{}",
"actor" => actor,
"id" => 1,
"unreachable_since" => true
})
end
@ -173,7 +96,14 @@ test "publish to url with with different ports" do
inbox = "http://200.site/users/nick1/inbox"
assert {:ok, _} = Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
assert {:ok, _} =
Publisher.publish_one(%{
"inbox" => inbox,
"json" => "{}",
"actor" => actor,
"id" => 1
})
assert called(Instances.set_reachable(inbox))
end
@ -189,11 +119,11 @@ test "publish to url with with different ports" do
assert {:ok, _} =
Publisher.publish_one(%{
inbox: inbox,
json: "{}",
actor: actor,
id: 1,
unreachable_since: NaiveDateTime.utc_now()
"inbox" => inbox,
"json" => "{}",
"actor" => actor,
"id" => 1,
"unreachable_since" => NaiveDateTime.utc_now()
})
assert called(Instances.set_reachable(inbox))
@ -211,11 +141,11 @@ test "publish to url with with different ports" do
assert {:ok, _} =
Publisher.publish_one(%{
inbox: inbox,
json: "{}",
actor: actor,
id: 1,
unreachable_since: nil
"inbox" => inbox,
"json" => "{}",
"actor" => actor,
"id" => 1,
"unreachable_since" => nil
})
refute called(Instances.set_reachable(inbox))
@ -231,7 +161,13 @@ test "publish to url with with different ports" do
inbox = "http://404.site/users/nick1/inbox"
assert {:error, _} = Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
assert {:error, _} =
Publisher.publish_one(%{
"inbox" => inbox,
"json" => "{}",
"actor" => actor,
"id" => 1
})
assert called(Instances.set_unreachable(inbox))
end
@ -248,7 +184,12 @@ test "publish to url with with different ports" do
assert capture_log(fn ->
assert {:error, _} =
Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
Publisher.publish_one(%{
"inbox" => inbox,
"json" => "{}",
"actor" => actor,
"id" => 1
})
end) =~ "connrefused"
assert called(Instances.set_unreachable(inbox))
@ -264,7 +205,13 @@ test "publish to url with with different ports" do
inbox = "http://200.site/users/nick1/inbox"
assert {:ok, _} = Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1})
assert {:ok, _} =
Publisher.publish_one(%{
"inbox" => inbox,
"json" => "{}",
"actor" => actor,
"id" => 1
})
refute called(Instances.set_unreachable(inbox))
end
@ -282,11 +229,11 @@ test "publish to url with with different ports" do
assert capture_log(fn ->
assert {:error, _} =
Publisher.publish_one(%{
inbox: inbox,
json: "{}",
actor: actor,
id: 1,
unreachable_since: NaiveDateTime.utc_now()
"inbox" => inbox,
"json" => "{}",
"actor" => actor,
"id" => 1,
"unreachable_since" => NaiveDateTime.utc_now()
})
end) =~ "connrefused"
@ -344,33 +291,33 @@ test "publish to url with with different ports" do
assert not called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
id: note_activity.data["id"]
"inbox" => "https://domain.com/users/nick1/inbox",
"actor_id" => actor.id,
"id" => note_activity.data["id"]
})
)
assert not called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
id: public_note_activity.data["id"]
"inbox" => "https://domain.com/users/nick1/inbox",
"actor_id" => actor.id,
"id" => public_note_activity.data["id"]
})
)
assert not called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://rejected.com/users/nick2/inbox",
actor_id: actor.id,
id: note_activity.data["id"]
"inbox" => "https://rejected.com/users/nick2/inbox",
"actor_id" => actor.id,
"id" => note_activity.data["id"]
})
)
assert not called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://rejected.com/users/nick2/inbox",
actor_id: actor.id,
id: public_note_activity.data["id"]
"inbox" => "https://rejected.com/users/nick2/inbox",
"actor_id" => actor.id,
"id" => public_note_activity.data["id"]
})
)
end
@ -406,9 +353,9 @@ test "publish to url with with different ports" do
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
id: note_activity.data["id"]
"inbox" => "https://domain.com/users/nick1/inbox",
"actor_id" => actor.id,
"id" => note_activity.data["id"]
})
)
end
@ -441,9 +388,9 @@ test "publish to url with with different ports" do
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
id: note_activity.data["id"]
"inbox" => "https://domain.com/users/nick1/inbox",
"actor_id" => actor.id,
"id" => note_activity.data["id"]
})
)
end
@ -493,17 +440,17 @@ test "publish to url with with different ports" do
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain.com/users/nick1/inbox",
actor_id: actor.id,
id: delete.data["id"]
"inbox" => "https://domain.com/users/nick1/inbox",
"actor_id" => actor.id,
"id" => delete.data["id"]
})
)
assert called(
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
inbox: "https://domain2.com/users/nick1/inbox",
actor_id: actor.id,
id: delete.data["id"]
"inbox" => "https://domain2.com/users/nick1/inbox",
"actor_id" => actor.id,
"id" => delete.data["id"]
})
)
end

View file

@ -20,6 +20,18 @@ test "gets an actor for the relay" do
assert user.ap_id == "#{Pleroma.Web.Endpoint.url()}/relay"
end
test "relay actor is an application" do
# See <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-application>
user = Relay.get_actor()
assert user.actor_type == "Application"
end
test "relay actor has follow* collections" do
user = Relay.get_actor()
assert user.follower_address
assert user.following_address
end
test "relay actor is invisible" do
user = Relay.get_actor()
assert User.invisible?(user)

View file

@ -17,6 +17,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
import Mock
import Pleroma.Factory
require Pleroma.Constants
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
:ok
@ -276,6 +278,32 @@ test "it ensures that address fields become lists" do
refute is_nil(data["cc"])
end
test "it fixes Pleroma unlisted" do
# https://git.pleroma.social/pleroma/pleroma/-/issues/3323
user1 = insert(:user)
user2 = insert(:user)
data =
File.read!("test/fixtures/mastodon-post-activity.json")
|> Jason.decode!()
|> Map.put("actor", user1.ap_id)
|> Map.put("cc", [])
|> Map.put("to", [user2.ap_id, user1.follower_address])
object =
data["object"]
|> Map.put("attributedTo", user1.ap_id)
|> Map.put("cc", [Pleroma.Constants.as_public()])
|> Map.put("to", [user2.ap_id, user1.follower_address])
|> Map.put("id", user1.ap_id <> "/activities/12345678")
data = Map.put(data, "object", object)
{:ok, %Activity{} = activity} = Transmogrifier.handle_incoming(data)
assert "unlisted" == Pleroma.Web.ActivityPub.Visibility.get_visibility(activity)
end
test "it strips internal likes" do
data =
File.read!("test/fixtures/mastodon-post-activity.json")

View file

@ -126,18 +126,6 @@ test "remote users have an empty endpoints structure" do
assert result["id"] == user.ap_id
assert result["endpoints"] == %{}
end
test "instance users do not expose oAuth endpoints" do
user =
insert(:user, nickname: nil, local: true)
|> with_signing_key()
result = UserView.render("user.json", %{user: user})
refute result["endpoints"]["oauthAuthorizationEndpoint"]
refute result["endpoints"]["oauthRegistrationEndpoint"]
refute result["endpoints"]["oauthTokenEndpoint"]
end
end
describe "followers" do

View file

@ -132,7 +132,7 @@ test "successfully processes incoming AP docs with correct origin" do
assert {:ok, _activity} = ObanHelpers.perform(job)
assert {:ok, job} = Federator.incoming_ap_doc(params)
assert {:discard, :already_present} = ObanHelpers.perform(job)
assert {:cancel, :already_present} = ObanHelpers.perform(job)
end
test "successfully normalises public scope descriptors" do
@ -199,7 +199,7 @@ test "it does not crash if MRF rejects the post" do
|> Jason.decode!()
assert {:ok, job} = Federator.incoming_ap_doc(params)
assert {:discard, _} = ObanHelpers.perform(job)
assert {:cancel, _} = ObanHelpers.perform(job)
end
end
end

View file

@ -509,6 +509,44 @@ test "create mentions from the 'to' field" do
assert mention.url == recipient_ap_id
end
test "inlined images are media proxied" do
clear_config([:media_proxy, :enabled], true)
user = insert(:user)
{:ok, activity} =
CommonAPI.post(user, %{
content_type: "text/html",
status: "hii <img src=\"https://example.org/a.png\" />"
})
activity = Repo.get(Activity, activity.id)
status = StatusView.render("show.json", activity: activity)
assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec())
assert status[:content] =~
~r/^hii <img src="https?:\/\/[^\/]+\/proxy\/[^\/]+\/aHR0cHM6Ly9leGFtcGxlLm9yZy9hLnBuZw\/a.png"/
end
test "inlined images using network-path ref are media proxied" do
clear_config([:media_proxy, :enabled], true)
user = insert(:user)
{:ok, activity} =
CommonAPI.post(user, %{
content_type: "text/html",
status: "hii <img src=\"//example.org/a.png\" />"
})
activity = Repo.get(Activity, activity.id)
status = StatusView.render("show.json", activity: activity)
assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec())
assert status[:content] =~
~r/^hii <img src="https?:\/\/[^\/]+\/proxy\/[^\/]+\/aHR0cHM6Ly9leGFtcGxlLm9yZy9hLnBuZw\/a.png"/
end
test "create mentions from the 'tag' field" do
recipient = insert(:user)
cc = insert_pair(:user) |> Enum.map(& &1.ap_id)

View file

@ -55,6 +55,20 @@ test "encodes and decodes URL" do
assert decode_result(encoded) == url
end
test "encodes and decodes a network-path reference URL as HTTPS" do
url = "//example.org/static/logo.png"
encoded = MediaProxy.url(url)
assert String.starts_with?(
encoded,
Config.get([:media_proxy, :base_url], Pleroma.Web.Endpoint.url())
)
assert String.ends_with?(encoded, "/logo.png")
assert decode_result(encoded) == "https:" <> url
end
test "encodes and decodes URL without a path" do
url = "https://pleroma.soykaf.com"
encoded = MediaProxy.url(url)

View file

@ -0,0 +1,31 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Providers.ApUrlTest do
use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.Metadata.Providers.ApUrl
@ap_type_compliant "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
@ap_type_mastodon "application/activity+json"
test "it preferentially renders a link to a post" do
user = insert(:user)
note = insert(:note, user: user)
assert ApUrl.build_tags(%{object: note, user: user}) == [
{:link, [rel: "alternate", href: note.data["id"], type: @ap_type_mastodon], []},
{:link, [rel: "alternate", href: note.data["id"], type: @ap_type_compliant], []}
]
end
test "it renders a link to a user" do
user = insert(:user)
assert ApUrl.build_tags(%{user: user}) == [
{:link, [rel: "alternate", href: user.ap_id, type: @ap_type_mastodon], []},
{:link, [rel: "alternate", href: user.ap_id, type: @ap_type_compliant], []}
]
end
end

View file

@ -321,6 +321,16 @@ defp meta_find_twitter(document, name) do
Floki.find(document, "head>meta[name=\"twitter:" <> name <> "\"]")
end
defp meta_find_alt_links(document) do
Floki.find(document, "head>link[rel=\"alternate\"]")
|> Enum.map(fn {_, attr, _} ->
{
:proplists.get_value("type", attr),
:proplists.get_value("href", attr)
}
end)
end
# Detailed metadata tests are already done for each builder individually, so just
# one check per type of content should suffice to ensure we're calling the providers correctly
describe "metadata tags for" do
@ -350,6 +360,8 @@ test "user profile", %{conn: conn, user: user, user_avatar_url: user_avatar_url}
[{"meta", tw_desc, _}] = meta_find_twitter(document, "description")
[{"meta", tw_img, _}] = meta_find_twitter(document, "image")
alt_links = meta_find_alt_links(document)
assert meta_content(og_type) == "article"
assert meta_content(og_title) == Pleroma.Web.Metadata.Utils.user_name_string(user)
assert meta_content(og_url) == user.ap_id
@ -362,6 +374,8 @@ test "user profile", %{conn: conn, user: user, user_avatar_url: user_avatar_url}
assert meta_content(tw_title) == meta_content(og_title)
assert meta_content(tw_desc) == meta_content(og_desc)
assert meta_content(tw_img) == meta_content(og_img)
assert Enum.any?(alt_links, fn e -> e == {"application/activity+json", user.ap_id} end)
end
test "text-only post", %{conn: conn, user: user, user_avatar_url: user_avatar_url} do
@ -386,6 +400,8 @@ test "text-only post", %{conn: conn, user: user, user_avatar_url: user_avatar_ur
[{"meta", tw_desc, _}] = meta_find_twitter(document, "description")
[{"meta", tw_img, _}] = meta_find_twitter(document, "image")
alt_links = meta_find_alt_links(document)
assert meta_content(og_type) == "article"
assert meta_content(og_title) == Pleroma.Web.Metadata.Utils.user_name_string(user)
assert meta_content(og_url) == activity.data["id"]
@ -398,6 +414,10 @@ test "text-only post", %{conn: conn, user: user, user_avatar_url: user_avatar_ur
assert meta_content(tw_title) == meta_content(og_title)
assert meta_content(tw_desc) == meta_content(og_desc)
assert meta_content(tw_img) == meta_content(og_img)
assert Enum.any?(alt_links, fn e ->
e == {"application/activity+json", activity.object.data["id"]}
end)
end
test "post with attachments", %{conn: conn, user: user} do

View file

@ -20,7 +20,7 @@ test "it ignores MRF reject" do
with_mock Pleroma.Web.ActivityPub.Transmogrifier,
handle_incoming: fn _ -> {:reject, "MRF"} end do
assert {:discard, "MRF"} =
assert {:cancel, "MRF"} =
ReceiverWorker.perform(%Oban.Job{
args: %{"op" => "incoming_ap_doc", "params" => params}
})

View file

@ -39,19 +39,19 @@ defmodule Pleroma.Workers.RemoteFetcherWorkerTest do
end
test "does not requeue a deleted object" do
assert {:discard, _} =
assert {:cancel, _} =
RemoteFetcherWorker.perform(%Oban.Job{
args: %{"op" => "fetch_remote", "id" => @deleted_object_one}
})
assert {:discard, _} =
assert {:cancel, _} =
RemoteFetcherWorker.perform(%Oban.Job{
args: %{"op" => "fetch_remote", "id" => @deleted_object_two}
})
end
test "does not requeue an unauthorized object" do
assert {:discard, _} =
assert {:cancel, _} =
RemoteFetcherWorker.perform(%Oban.Job{
args: %{"op" => "fetch_remote", "id" => @unauthorized_object}
})
@ -60,7 +60,7 @@ test "does not requeue an unauthorized object" do
test "does not requeue an object that exceeded depth" do
clear_config([:instance, :federation_incoming_replies_max_depth], 0)
assert {:discard, _} =
assert {:cancel, _} =
RemoteFetcherWorker.perform(%Oban.Job{
args: %{"op" => "fetch_remote", "id" => @depth_object, "depth" => 1}
})