diff options
| author | lain <lain@soykaf.club> | 2019-04-08 14:10:51 +0200 | 
|---|---|---|
| committer | lain <lain@soykaf.club> | 2019-04-08 14:10:51 +0200 | 
| commit | a9f805c87100fd2ee1d8426460b81af4a235d574 (patch) | |
| tree | 70179175f0ff84f3f4c7399f63694766aaa65b35 /docs | |
| parent | 5d871173d189a0019fda0ee76f8a324d90a163ee (diff) | |
| parent | 4977e96fa408e8148a355b3c759af34ae3ca312d (diff) | |
| download | pleroma-a9f805c87100fd2ee1d8426460b81af4a235d574.tar.gz pleroma-a9f805c87100fd2ee1d8426460b81af4a235d574.zip | |
Merge remote-tracking branch 'origin/develop' into features/mastoapi/2.6.0-conversations
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api/admin_api.md | 20 | ||||
| -rw-r--r-- | docs/api/differences_in_mastoapi_responses.md | 6 | ||||
| -rw-r--r-- | docs/api/pleroma_api.md | 6 | ||||
| -rw-r--r-- | docs/api/prometheus.md | 22 | ||||
| -rw-r--r-- | docs/config.md | 99 | ||||
| -rw-r--r-- | docs/config/custom_emoji.md | 39 | 
6 files changed, 181 insertions, 11 deletions
| diff --git a/docs/api/admin_api.md b/docs/api/admin_api.md index 53b68ffd4..86cacebb1 100644 --- a/docs/api/admin_api.md +++ b/docs/api/admin_api.md @@ -58,6 +58,26 @@ Authentication is required and the user must be an admin.    - `password`  - Response: User’s nickname +## `/api/pleroma/admin/user/follow` +### Make a user follow another user + +- Methods: `POST` +- Params: + - `follower`: The nickname of the follower + - `followed`: The nickname of the followed +- Response: + - "ok" + +## `/api/pleroma/admin/user/unfollow` +### Make a user unfollow another user + +- Methods: `POST` +- Params: + - `follower`: The nickname of the follower + - `followed`: The nickname of the followed +- Response: + - "ok" +  ## `/api/pleroma/admin/users/:nickname/toggle_activation`  ### Toggle user activation diff --git a/docs/api/differences_in_mastoapi_responses.md b/docs/api/differences_in_mastoapi_responses.md index d993d1383..215f43155 100644 --- a/docs/api/differences_in_mastoapi_responses.md +++ b/docs/api/differences_in_mastoapi_responses.md @@ -44,3 +44,9 @@ Has these additional fields under the `pleroma` object:  Has these additional fields under the `pleroma` object:  - `is_seen`: true if the notification was read by the user + +## POST `/api/v1/statuses` + +Additional parameters can be added to the JSON body/Form data: + +- `preview`: boolean, if set to `true` the post won't be actually posted, but the status entitiy would still be rendered back. This could be useful for previewing rich text/custom emoji, for example. diff --git a/docs/api/pleroma_api.md b/docs/api/pleroma_api.md index 478c9d874..2e8fb04d2 100644 --- a/docs/api/pleroma_api.md +++ b/docs/api/pleroma_api.md @@ -10,7 +10,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi  * Authentication: not required  * Params: none  * Response: JSON -* Example response: `{"kalsarikannit_f":"/finmoji/128px/kalsarikannit_f-128.png","perkele":"/finmoji/128px/perkele-128.png","blobdab":"/emoji/blobdab.png","happiness":"/finmoji/128px/happiness-128.png"}` +* Example response: `[{"kalsarikannit_f":{"tags":["Finmoji"],"image_url":"/finmoji/128px/kalsarikannit_f-128.png"}},{"perkele":{"tags":["Finmoji"],"image_url":"/finmoji/128px/perkele-128.png"}},{"blobdab":{"tags":["SomeTag"],"image_url":"/emoji/blobdab.png"}},"happiness":{"tags":["Finmoji"],"image_url":"/finmoji/128px/happiness-128.png"}}]`  * Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format  ## `/api/pleroma/follow_import` @@ -27,14 +27,14 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi  * Method: `GET`  * Authentication: not required  * Params: none -* Response: Provider specific JSON, the only guaranteed parameter is `type`  +* Response: Provider specific JSON, the only guaranteed parameter is `type`  * Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint"}`  ## `/api/pleroma/delete_account`  ### Delete an account  * Method `POST`  * Authentication: required -* Params:  +* Params:      * `password`: user's password  * Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise  * Example response: `{"error": "Invalid password."}` diff --git a/docs/api/prometheus.md b/docs/api/prometheus.md new file mode 100644 index 000000000..19c564e3c --- /dev/null +++ b/docs/api/prometheus.md @@ -0,0 +1,22 @@ +# Prometheus Metrics + +Pleroma includes support for exporting metrics via the [prometheus_ex](https://github.com/deadtrickster/prometheus.ex) library. + +## `/api/pleroma/app_metrics` +### Exports Prometheus application metrics +* Method: `GET` +* Authentication: not required +* Params: none +* Response: JSON + +## Grafana +### Config example +The following is a config example to use with [Grafana](https://grafana.com) + +``` +  - job_name: 'beam' +    metrics_path: /api/pleroma/app_metrics +    scheme: https +    static_configs: +    - targets: ['pleroma.soykaf.com'] +``` diff --git a/docs/config.md b/docs/config.md index 97a0e6ffa..b5ea58746 100644 --- a/docs/config.md +++ b/docs/config.md @@ -105,7 +105,7 @@ config :pleroma, Pleroma.Mailer,  * `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`)  ## :logger -* `backends`: `:console` is used to send logs to stdout, `{ExSyslogger, :ex_syslogger}` to log to syslog +* `backends`: `:console` is used to send logs to stdout, `{ExSyslogger, :ex_syslogger}` to log to syslog, and `Quack.Logger` to log to Slack  An example to enable ONLY ExSyslogger (f/ex in ``prod.secret.exs``) with info and debug suppressed:  ``` @@ -128,6 +128,24 @@ config :logger, :ex_syslogger,  See: [logger’s documentation](https://hexdocs.pm/logger/Logger.html) and [ex_syslogger’s documentation](https://hexdocs.pm/ex_syslogger/) +An example of logging info to local syslog, but warn to a Slack channel: +``` +config :logger, +  backends: [ {ExSyslogger, :ex_syslogger}, Quack.Logger ], +  level: :info + +config :logger, :ex_syslogger, +  level: :info, +  ident: "pleroma", +  format: "$metadata[$level] $message" + +config :quack, +  level: :warn, +  meta: [:all], +  webhook_url: "https://hooks.slack.com/services/YOUR-API-KEY-HERE" +``` + +See the [Quack Github](https://github.com/azohra/quack) for more details  ## :frontend_configurations @@ -200,14 +218,14 @@ This section is used to configure Pleroma-FE, unless ``:managed_config`` in ``:i    - `port`  * `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`  **Important note**: if you modify anything inside these lists, default `config.exs` values will be overwritten, which may result in breakage, to make sure this does not happen please copy the default value for the list from `config.exs` and modify/add only what you need -Example:  +Example:  ```elixir  config :pleroma, Pleroma.Web.Endpoint,    url: [host: "example.com", port: 2020, scheme: "https"], @@ -296,9 +314,13 @@ curl "http://localhost:4000/api/pleroma/admin/invite_token?admin_token=somerando  [Pleroma Job Queue](https://git.pleroma.social/pleroma/pleroma_job_queue) configuration: a list of queues with maximum concurrent jobs.  Pleroma has the following queues: +  * `federator_outgoing` - Outgoing federation  * `federator_incoming` - Incoming federation  * `mailer` - Email sender, see [`Pleroma.Mailer`](#pleroma-mailer) +* `transmogrifier` - Transmogrifier +* `web_push` - Web push notifications +* `scheduled_activities` - Scheduled activities, see [`Pleroma.ScheduledActivities`](#pleromascheduledactivity)  Example: @@ -372,6 +394,17 @@ config :auto_linker,    ]  ``` +## Pleroma.ScheduledActivity + +* `daily_user_limit`: the number of scheduled activities a user is allowed to create in a single day (Default: `25`) +* `total_user_limit`: the number of scheduled activities a user is allowed to create in total (Default: `300`) +* `enabled`: whether scheduled activities are sent to the job queue to be executed + +## Pleroma.Web.Auth.Authenticator + +* `Pleroma.Web.Auth.PleromaAuthenticator`: default database authenticator +* `Pleroma.Web.Auth.LDAPAuthenticator`: LDAP authentication +  ## :ldap  Use LDAP for user authentication.  When a user logs in to the Pleroma @@ -390,7 +423,61 @@ Pleroma account will be created with the same name as the LDAP user name.  * `base`: LDAP base, e.g. "dc=example,dc=com"  * `uid`: LDAP attribute name to authenticate the user, e.g. when "cn", the filter will be "cn=username,base" -## Pleroma.Web.Auth.Authenticator +## :auth -* `Pleroma.Web.Auth.PleromaAuthenticator`: default database authenticator -* `Pleroma.Web.Auth.LDAPAuthenticator`: LDAP authentication +Authentication / authorization settings. + +* `auth_template`: authentication form template. By default it's `show.html` which corresponds to `lib/pleroma/web/templates/o_auth/o_auth/show.html.eex`.  +* `oauth_consumer_template`: OAuth consumer mode authentication form template. By default it's `consumer.html` which corresponds to `lib/pleroma/web/templates/o_auth/o_auth/consumer.html.eex`. +* `oauth_consumer_strategies`: the list of enabled OAuth consumer strategies; by default it's set by OAUTH_CONSUMER_STRATEGIES environment variable. + +# 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). + +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. + +Note: each strategy requires separate setup (on external provider side and Pleroma side). Below are the guidelines on setting up most popular strategies.   + +* For Twitter, [register an app](https://developer.twitter.com/en/apps), configure callback URL to https://<your_host>/oauth/twitter/callback + +* For Facebook, [register an app](https://developers.facebook.com/apps), configure callback URL to https://<your_host>/oauth/facebook/callback, enable Facebook Login service at https://developers.facebook.com/apps/<app_id>/fb-login/settings/ + +* For Google, [register an app](https://console.developers.google.com), configure callback URL to https://<your_host>/oauth/google/callback + +* For Microsoft, [register an app](https://portal.azure.com), configure callback URL to https://<your_host>/oauth/microsoft/callback + +Once the app is configured on external OAuth provider side, add app's credentials and strategy-specific settings (if any — e.g. see Microsoft below) to `config/prod.secret.exs`, +per strategy's documentation (e.g. [ueberauth_twitter](https://github.com/ueberauth/ueberauth_twitter)). Example config basing on environment variables: + +``` +# Twitter +config :ueberauth, Ueberauth.Strategy.Twitter.OAuth, +  consumer_key: System.get_env("TWITTER_CONSUMER_KEY"), +  consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET") + +# Facebook +config :ueberauth, Ueberauth.Strategy.Facebook.OAuth, +  client_id: System.get_env("FACEBOOK_APP_ID"), +  client_secret: System.get_env("FACEBOOK_APP_SECRET"), +  redirect_uri: System.get_env("FACEBOOK_REDIRECT_URI") + +# Google +config :ueberauth, Ueberauth.Strategy.Google.OAuth, +  client_id: System.get_env("GOOGLE_CLIENT_ID"), +  client_secret: System.get_env("GOOGLE_CLIENT_SECRET"), +  redirect_uri: System.get_env("GOOGLE_REDIRECT_URI") + +# Microsoft +config :ueberauth, Ueberauth.Strategy.Microsoft.OAuth, +  client_id: System.get_env("MICROSOFT_CLIENT_ID"), +  client_secret: System.get_env("MICROSOFT_CLIENT_SECRET") +   +config :ueberauth, Ueberauth, +  providers: [ +    microsoft: {Ueberauth.Strategy.Microsoft, [callback_params: []]} +  ] +``` diff --git a/docs/config/custom_emoji.md b/docs/config/custom_emoji.md index e833d2080..419a7d0e2 100644 --- a/docs/config/custom_emoji.md +++ b/docs/config/custom_emoji.md @@ -11,8 +11,43 @@ image files (in `/priv/static/emoji/custom`): `happy.png` and `sad.png`  content of `config/custom_emoji.txt`:  ``` -happy, /emoji/custom/happy.png -sad, /emoji/custom/sad.png +happy, /emoji/custom/happy.png, Tag1,Tag2 +sad, /emoji/custom/sad.png, Tag1 +foo, /emoji/custom/foo.png  ```  The files should be PNG (APNG is okay with `.png` for `image/png` Content-type) and under 50kb for compatibility with mastodon. + +## Emoji tags (groups) + +Default tags are set in `config.exs`. +```elixir +config :pleroma, :emoji, +  shortcode_globs: ["/emoji/custom/**/*.png"], +  groups: [ +    Finmoji: "/finmoji/128px/*-128.png", +    Custom: ["/emoji/*.png", "/emoji/custom/*.png"] +  ] +``` + +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"], +  groups: [ +    "Finmoji special": "/finmoji/128px/a_trusted_friend-128.png", # special file +    "Cirno": "/emoji/custom/cirno*.png", # png files in /emoji/custom/ which start with `cirno` +    "Special group": "/emoji/custom/special_folder/*.png", # png files in /emoji/custom/special_folder/ +    "Another group": "/emoji/custom/special_folder/*/.png", # png files in /emoji/custom/special_folder/ subfolders +    Finmoji: "/finmoji/128px/*-128.png", +    Custom: ["/emoji/*.png", "/emoji/custom/*.png"] +  ] +``` + +Priority of tags assigns in emoji.txt and custom.txt: + +`tag in file > special group setting in config.exs > default setting in config.exs` + +Priority for globs: + +`special group setting in config.exs > default setting in config.exs` | 
