Merge pull request 'change default allow_relay to false' (#309) from nocebo/akkoma...
authorfloatingghost <hannah@coffee-and-dreams.uk>
Fri, 25 Nov 2022 09:57:01 +0000 (09:57 +0000)
committerfloatingghost <hannah@coffee-and-dreams.uk>
Fri, 25 Nov 2022 09:57:01 +0000 (09:57 +0000)
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/309

42 files changed:
CHANGELOG.md
COPYING
config/config.exs
config/description.exs
docs/docs/clients.md
docs/docs/configuration/cheatsheet.md
docs/docs/configuration/hardening.md
docs/docs/configuration/howto_theming_your_instance.md
docs/docs/configuration/i2p.md
docs/docs/configuration/onion_federation.md
docs/docs/configuration/static_dir.md
docs/docs/development/API/differences_in_mastoapi_responses.md
docs/docs/development/API/prometheus.md
docs/docs/index.md
docs/docs/installation/migrating_to_akkoma.md
docs/docs/installation/openbsd_en.md
lib/pleroma/http/adapter_helper.ex
lib/pleroma/http/adapter_helper/default.ex
lib/pleroma/object/fetcher.ex
lib/pleroma/user.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/api_spec/operations/account_operation.ex
lib/pleroma/web/federator.ex
lib/pleroma/web/plugs/http_security_plug.ex
lib/pleroma/workers/backup_worker.ex
lib/pleroma/workers/purge_expired_activity.ex
lib/pleroma/workers/purge_expired_filter.ex
lib/pleroma/workers/purge_expired_token.ex
lib/pleroma/workers/worker_helper.ex
priv/gettext/ca/LC_MESSAGES/config_descriptions.po
priv/gettext/config_descriptions.pot
priv/gettext/es/LC_MESSAGES/config_descriptions.po
priv/gettext/nl/LC_MESSAGES/config_descriptions.po
test/fixtures/microblogpub/user_with_invalid_also_known_as.json [new file with mode: 0644]
test/pleroma/http/adapter_helper_test.exs
test/pleroma/object/fetcher_test.exs
test/pleroma/user_test.exs
test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
test/pleroma/web/plugs/http_security_plug_test.exs
test/pleroma/workers/publisher_worker_test.exs [new file with mode: 0644]
test/pleroma/workers/purge_expired_activity_test.exs
test/pleroma/workers/scheduled_activity_worker_test.exs

index ac6695c368e60756c979e6bae0ee5cf68b572fb7..cbf1ac832dbc4d98d37e31b4b1295e578b80ee3e 100644 (file)
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 
+## Unreleased
+
+## Added
+- Config: HTTP timeout options, :pool\_timeout and :receive\_timeout
+
+## Changed
+- MastoAPI: Accept BooleanLike input on `/api/v1/accounts/:id/follow` (fixes follows with mastodon.py)
+
 ## 2022.11
 
 ## Added
@@ -12,7 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Scraping of nodeinfo from remote instances to display instance info
 - `requested_by` in relationships when the user has requested to follow you
 
-## Changes
+## 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
diff --git a/COPYING b/COPYING
index dd25f1d81ddc95abf1453abe421ba5fe1a9b341a..077a664edc5e14e8ca450d6ecedc46e9f32ea860 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1,12 +1,15 @@
-Unless otherwise stated this repository is copyright © 2017-2021
-Pleroma Authors <https://pleroma.social/>, and is distributed under
-The GNU Affero General Public License Version 3, you should have received a
-copy of the license file as AGPL-3.
+Unless otherwise stated this repository is 
+Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+Copyright © 2022 Akkoma Authors <https://akkoma.social/>
+and is distributed under The GNU Affero General Public License Version 3, you
+should have received a copy of the license file as AGPL-3.
 
 ---
 
-Files inside docs directory are copyright © 2021 Pleroma Authors
-<https://pleroma.social/>, and are distributed under the Creative Commons
+Files inside docs directory are
+Copyright © 2021-2022 Pleroma Authors <https://pleroma.social/>
+Copyright © 2022 Akkoma Authors <https://akkoma.social/>
+and are distributed under the Creative Commons
 Attribution 4.0 International license, you should have received
 a copy of the license file as CC-BY-4.0.
 
@@ -16,17 +19,7 @@ The following files are copyright © 2019 shitposter.club, and are distributed
 under the Creative Commons Attribution-ShareAlike 4.0 International license,
 you should have received a copy of the license file as CC-BY-SA-4.0.
 
-priv/static/images/pleroma-fox-tan.png
 priv/static/images/pleroma-fox-tan-smol.png
-priv/static/images/pleroma-tan.png
-
----
-
-The following files are copyright © 2019 shitposter.club, and are distributed
-under the Creative Commons Attribution 4.0 International license, you should
-have received a copy of the license file as CC-BY-4.0.
-
-priv/static/images/pleroma-fox-tan-shy.png
 
 ---
 
@@ -35,8 +28,6 @@ The following files are copyright © 2017-2020 Pleroma Authors
 Attribution-ShareAlike 4.0 International license, you should have received
 a copy of the license file as CC-BY-SA-4.0.
 
-priv/static/images/avi.png
-priv/static/images/banner.png
 priv/static/instance/thumbnail.jpeg
 
 ---
index 301c2b05cc74e2c175fb3e48868485a72703396c..c98a18d39115a32b90d058d8df613f7d00284300 100644 (file)
@@ -180,6 +180,8 @@ config :tesla, :adapter, {Tesla.Adapter.Finch, name: MyFinch}
 
 # Configures http settings, upstream proxy etc.
 config :pleroma, :http,
+  pool_timeout: :timer.seconds(5),
+  receive_timeout: :timer.seconds(15),
   proxy_url: nil,
   user_agent: :default,
   adapter: []
@@ -312,19 +314,19 @@ config :pleroma, :frontend_configurations,
     logo: "/static/logo.svg",
     logoMargin: ".1em",
     logoMask: true,
-    minimalScopesMode: false,
     noAttachmentLinks: false,
     nsfwCensorImage: "",
     postContentType: "text/plain",
     redirectRootLogin: "/main/friends",
-    redirectRootNoLogin: "/main/all",
+    redirectRootNoLogin: "/main/public",
     scopeCopy: true,
     sidebarRight: false,
     showFeaturesPanel: true,
     showInstanceSpecificPanel: false,
     subjectLineBehavior: "email",
     theme: "pleroma-dark",
-    webPushNotifications: false
+    webPushNotifications: false,
+    conversationDisplay: "linear"
   },
   masto_fe: %{
     showInstanceSpecificPanel: true
@@ -487,8 +489,7 @@ config :pleroma, Pleroma.Web.Preload,
 config :pleroma, :http_security,
   enabled: true,
   sts: false,
-  sts_max_age: 31_536_000,
-  ct_max_age: 2_592_000,
+  sts_max_age: 63_072_000,
   referrer_policy: "same-origin"
 
 config :cors_plug,
@@ -584,6 +585,27 @@ config :pleroma, :workers,
     federator_incoming: 5,
     federator_outgoing: 5,
     search_indexing: 2
+  ],
+  timeout: [
+    activity_expiration: :timer.seconds(5),
+    token_expiration: :timer.seconds(5),
+    filter_expiration: :timer.seconds(5),
+    backup: :timer.seconds(900),
+    federator_incoming: :timer.seconds(10),
+    federator_outgoing: :timer.seconds(10),
+    ingestion_queue: :timer.seconds(5),
+    web_push: :timer.seconds(5),
+    mailer: :timer.seconds(5),
+    transmogrifier: :timer.seconds(5),
+    scheduled_activities: :timer.seconds(5),
+    poll_notifications: :timer.seconds(5),
+    background: :timer.seconds(5),
+    remote_fetcher: :timer.seconds(10),
+    attachments_cleanup: :timer.seconds(900),
+    new_users_digest: :timer.seconds(10),
+    mute_expire: :timer.seconds(5),
+    search_indexing: :timer.seconds(5),
+    nodeinfo_fetcher: :timer.seconds(10)
   ]
 
 config :pleroma, Pleroma.Formatter,
index 4843c0aaeeb905decdc9d591adb03e92044eecb9..fc10cbf8107a8d41617bf6c67c0c062805c8084d 100644 (file)
@@ -1226,6 +1226,13 @@ config :pleroma, :config_description, [
             type: :boolean,
             description: "Enables green text on lines prefixed with the > character"
           },
+          %{
+            key: :conversationDisplay,
+            label: "Conversation display style",
+            type: :string,
+            description: "How to display conversations (linear or tree)",
+            suggestions: ["linear", "tree"]
+          },
           %{
             key: :hideFilteredStatuses,
             label: "Hide Filtered Statuses",
@@ -1274,14 +1281,6 @@ config :pleroma, :config_description, [
               "By default it assumes logo used will be monochrome with alpha channel to be compatible with both light and dark themes. " <>
                 "If you want a colorful logo you must disable logoMask."
           },
-          %{
-            key: :minimalScopesMode,
-            label: "Minimal scopes mode",
-            type: :boolean,
-            description:
-              "Limit scope selection to Direct, User default, and Scope of post replying to. " <>
-                "Also prevents replying to a DM with a public post from PleromaFE."
-          },
           %{
             key: :nsfwCensorImage,
             label: "NSFW Censor Image",
@@ -1750,14 +1749,7 @@ config :pleroma, :config_description, [
         label: "STS max age",
         type: :integer,
         description: "The maximum age for the Strict-Transport-Security header if sent",
-        suggestions: [31_536_000]
-      },
-      %{
-        key: :ct_max_age,
-        label: "CT max age",
-        type: :integer,
-        description: "The maximum age for the Expect-CT header if sent",
-        suggestions: [2_592_000]
+        suggestions: [63_072_000]
       },
       %{
         key: :referrer_policy,
@@ -1979,6 +1971,32 @@ config :pleroma, :config_description, [
           federator_incoming: 5,
           federator_outgoing: 5
         ]
+      },
+      %{
+        key: :timeout,
+        type: {:keyword, :integer},
+        description: "Timeout for jobs, per `Oban` queue, in ms",
+        suggestions: [
+          activity_expiration: :timer.seconds(5),
+          token_expiration: :timer.seconds(5),
+          filter_expiration: :timer.seconds(5),
+          backup: :timer.seconds(900),
+          federator_incoming: :timer.seconds(10),
+          federator_outgoing: :timer.seconds(10),
+          ingestion_queue: :timer.seconds(5),
+          web_push: :timer.seconds(5),
+          mailer: :timer.seconds(5),
+          transmogrifier: :timer.seconds(5),
+          scheduled_activities: :timer.seconds(5),
+          poll_notifications: :timer.seconds(5),
+          background: :timer.seconds(5),
+          remote_fetcher: :timer.seconds(10),
+          attachments_cleanup: :timer.seconds(900),
+          new_users_digest: :timer.seconds(10),
+          mute_expire: :timer.seconds(5),
+          search_indexing: :timer.seconds(5),
+          nodeinfo_fetcher: :timer.seconds(10)
+        ]
       }
     ]
   },
@@ -2640,6 +2658,21 @@ config :pleroma, :config_description, [
     type: :group,
     description: "HTTP settings",
     children: [
+      %{
+        key: :pool_timeout,
+        label: "HTTP Pool Request Timeout",
+        type: :integer,
+        description: "Timeout for initiating HTTP requests (in ms, default 5000)",
+        suggestions: [5000]
+      },
+      %{
+        key: :receive_timeout,
+        label: "HTTP Receive Timeout",
+        type: :integer,
+        description:
+          "Timeout for waiting on remote servers to respond to HTTP requests (in ms, default 15000)",
+        suggestions: [15000]
+      },
       %{
         key: :proxy_url,
         label: "Proxy URL",
index 5650ea236542c0e69820e81d7422c3009adb6b8b..fb840871883a90ff90fedaa812eb072cf5032f89 100644 (file)
@@ -1,21 +1,8 @@
-# Pleroma Clients
-Note: Additional clients may be working but theses are officially supporting Pleroma.
-Feel free to contact us to be added to this list!
+# Akkoma Clients
+Note: Additional clients may work, but these are known to work with Akkoma.
+Apps listed here might not support all of Akkoma's features.
 
 ## Desktop
-### Roma for Desktop
-- Homepage: <https://www.pleroma.com/#desktopApp>
-- Source Code: <https://github.com/roma-apps/roma-desktop>
-- Platforms: Windows, Mac, Linux
-- Features: MastoAPI, Streaming Ready
-
-### Social
-- Source Code: <https://gitlab.gnome.org/World/Social>
-- Contact: [@brainblasted@social.libre.fi](https://social.libre.fi/users/brainblasted)
-- Platforms: Linux (GNOME)
-- Note(2019-01-28): Not at a pre-alpha stage yet
-- Features: MastoAPI
-
 ### Whalebird
 - Homepage: <https://whalebird.social/>
 - Source Code: <https://github.com/h3poteto/whalebird-desktop>
@@ -30,28 +17,16 @@ Feel free to contact us to be added to this list!
 - Platforms: Android
 - Features: MastoAPI, ActivityPub (Client-to-Server)
 
-### Amaroq
-- Homepage: <https://itunes.apple.com/us/app/amaroq-for-mastodon/id1214116200>
-- Source Code: <https://github.com/ReticentJohn/Amaroq>
-- Contact: [@eurasierboy@mastodon.social](https://mastodon.social/users/eurasierboy)
-- Platforms: iOS
-- Features: MastoAPI, No Streaming
-
 ### Fedilab
 - Homepage: <https://fedilab.app/>
-- Source Code: <https://framagit.org/tom79/fedilab/>
-- Contact: [@fedilab@framapiaf.org](https://framapiaf.org/users/fedilab)
+- Source Code: <https://codeberg.org/tom79/Fedilab>
+- Contact: [@apps@toot.felilab.app](https://toot.fedilab.app/@apps)
 - Platforms: Android
 - Features: MastoAPI, Streaming Ready, Moderation, Text Formatting
 
-### Kyclos
-- Source Code: <https://git.pleroma.social/pleroma/harbour-kyclos>
-- Platforms: SailfishOS
-- Features: MastoAPI, No Streaming
-
 ### Husky
-- Source code: <https://git.mentality.rip/FWGS/Husky>
-- Contact: [@Husky@enigmatic.observer](https://enigmatic.observer/users/Husky)
+- Source code: <https://git.sr.ht/~captainepoch/husky>
+- Contact: [@captainepoch@stereophonic.space](https://stereophonic.space/captainepoch)
 - Platforms: Android
 - Features: MastoAPI, No Streaming, Emoji Reactions, Text Formatting, FE Stickers
 
@@ -68,32 +43,7 @@ Feel free to contact us to be added to this list!
 - Platforms: Android
 - Features: MastoAPI, No Streaming
 
-### Twidere
-- Homepage: <https://twidere.mariotaku.org/>
-- Source Code: <https://github.com/TwidereProject/Twidere-Android/>
-- Contact: <me@mariotaku.org>
-- Platform: Android
-- Features: MastoAPI, No Streaming
-
-### Indigenous
-- Homepage: <https://indigenous.realize.be/>
-- Source Code: <https://github.com/swentel/indigenous-android/>
-- Contact: [@swentel@realize.be](https://realize.be)
-- Platforms: Android
-- Features: MastoAPI, No Streaming
-
 ## Alternative Web Interfaces
-### Brutaldon
-- Homepage: <https://jfm.carcosa.net/projects/software/brutaldon/>
-- Source Code: <https://git.carcosa.net/jmcbray/brutaldon>
-- Contact: [@gcupc@glitch.social](https://glitch.social/users/gcupc)
-- Features: MastoAPI, No Streaming
-
-### Halcyon
-- Source Code: <https://notabug.org/halcyon-suite/halcyon>
-- Contact: [@halcyon@social.csswg.org](https://social.csswg.org/users/halcyon)
-- Features: MastoAPI, Streaming Ready
-
 ### Pinafore
 - Homepage: <https://pinafore.social/>
 - Source Code: <https://github.com/nolanlawson/pinafore>
index ec8bea0cc5cfa5eb843be34a0b11cf0472ab494b..94c32f2a83e9f498a0a7861bf36a70d7c705f82f 100644 (file)
@@ -59,7 +59,8 @@ To add configuration to your config file, you can copy it from the base config.
 * `cleanup_attachments`: Remove attachments along with statuses. Does not affect duplicate files and attachments without status. Enabling this will increase load to database when deleting statuses on larger instances.
 * `show_reactions`: Let favourites and emoji reactions be viewed through the API (default: `true`).
 * `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: `[]`)
+* `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"]`)
 
 ## :database
 * `improved_hashtag_timeline`: Setting to force toggle / force disable improved hashtags timeline. `:enabled` forces hashtags to be fetched from `hashtags` table for hashtags timeline. `:disabled` forces object-embedded hashtags to be used (slower). Keep it `:auto` for automatic behaviour (it is auto-set to `:enabled` [unless overridden] when HashtagsTableMigrator completes).
@@ -452,7 +453,6 @@ This will make Akkoma listen on `127.0.0.1` port `8080` and generate urls starti
 * ``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.
-* ``ct_max_age``: The maximum age for the `Expect-CT` 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.
 
@@ -523,6 +523,8 @@ Available caches:
 
 ### :http
 
+* `receive_timeout`: the amount of time, in ms, to wait for a remote server to respond to a request. (default: `15000`)
+* `pool_timeout`: the amount of time, in ms, to wait to check out an HTTP connection from the pool. This likely does not need changing unless your instance is _very_ busy with outbound requests. (default `5000`)
 * `proxy_url`: an upstream proxy to fetch posts and/or media with, (default: `nil`); for example `http://127.0.0.1:3192`. Does not support SOCKS5 proxy, only http(s).
 * `send_user_agent`: should we include a user agent with HTTP requests? (default: `true`)
 * `user_agent`: what user agent should we use? (default: `:default`), must be string or `:default`
index 182a54422b3bdfc532f3f3ca770cbac39a39a0bc..c5a9e160bc56646b79617723f2d2d5e75b9fc18c 100644 (file)
@@ -23,18 +23,17 @@ This sets the `secure` flag on Akkoma’s session cookie. This makes sure, that
 
 This will send additional HTTP security headers to the clients, including:
 
-* `X-XSS-Protection: "1; mode=block"`
+* `X-XSS-Protection: "0"`
 * `X-Permitted-Cross-Domain-Policies: "none"`
 * `X-Frame-Options: "DENY"`
 * `X-Content-Type-Options: "nosniff"`
-* `X-Download-Options: "noopen"`
 
 A content security policy (CSP) will also be set:
 
 ```csp
 content-security-policy:
   default-src 'none';
-  base-uri 'self';
+  base-uri 'none';
   frame-ancestors 'none';
   img-src 'self' data: blob: https:;
   media-src 'self' https:;
@@ -52,10 +51,6 @@ content-security-policy:
 
 An additional “Strict transport security” header will be sent with the configured `sts_max_age` parameter. This tells the browser, that the domain should only be accessed over a secure HTTPs connection.
 
-#### `ct_max_age`
-
-An additional “Expect-CT” header will be sent with the configured `ct_max_age` parameter. This enforces the use of TLS certificates that are published in the certificate transparency log. (see [Expect-CT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect-CT))
-
 #### `referrer_policy`
 
 > Recommended value: `same-origin`
index af417aee4405d39b2775d9cea55e61f2c2201df0..c226d054b21461e0475c0ea3d4e40a6c5c5d29f1 100644 (file)
@@ -70,5 +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.
\ No newline at end of file
index fecf66a8441d46486b7d43e3afa8663d19bfb18f..ec6266ab7dc09ff85efe2a1550b6a77edab1cafa 100644 (file)
@@ -155,12 +155,11 @@ server {
 
     location / {
 
-        add_header X-XSS-Protection "1; mode=block";
+        add_header X-XSS-Protection "0";
         add_header X-Permitted-Cross-Domain-Policies none;
         add_header X-Frame-Options DENY;
         add_header X-Content-Type-Options nosniff;
         add_header Referrer-Policy same-origin;
-        add_header X-Download-Options noopen;
 
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
index 499b4a693dc57d0cc8a8b9ed45c3d1b2ba5bfb5c..e4ae15fd292e6390315320501eeb6571952f83ea 100644 (file)
@@ -99,12 +99,11 @@ server {
 
     location / {
 
-        add_header X-XSS-Protection "1; mode=block";
+        add_header X-XSS-Protection "0";
         add_header X-Permitted-Cross-Domain-Policies none;
         add_header X-Frame-Options DENY;
         add_header X-Content-Type-Options nosniff;
         add_header Referrer-Policy same-origin;
-        add_header X-Download-Options noopen;
 
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
index 37e07eb0d225e107cb9b4736ec8774a5c595d77b..0653dc2a3bf49bbce63b7e9063adec882fe38b54 100644 (file)
@@ -89,6 +89,13 @@ config :pleroma, :frontend_configurations,
 
 Terms of Service will be shown to all users on the registration page. It's the best place where to write down the rules for your instance. You can modify the rules by adding and changing `$static_dir/static/terms-of-service.html`.
 
+## Favicon
+
+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
 
index 752be1762e76a06634d8a49fda2691fbf6230fc6..b41561c45ebe0f68e7448c174ba8d6227433b768 100644 (file)
@@ -195,7 +195,7 @@ 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 entity would still be rendered back. This could be useful for previewing rich text/custom emoji, for example.
 - `content_type`: string, contain the MIME type of the status, it is transformed into HTML by the backend. You can get the list of the supported MIME types with the nodeinfo endpoint.
-- `to`: A list of nicknames (like `lain@soykaf.club` or `lain` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for post visibility are not affected by this and will still apply.
+- `to`: A list of nicknames (like `admin@otp.akkoma.dev` or `admin` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for post visibility are not affected by this and will still apply.
 - `visibility`: string, besides standard MastoAPI values (`direct`, `private`, `unlisted`, `local` or `public`) it can be used to address a List by setting it to `list:LIST_ID`.
 - `expires_in`: The number of seconds the posted activity should expire in. When a posted activity expires it will be deleted from the server, and a delete request for it will be federated. This needs to be longer than an hour.
 - `in_reply_to_conversation_id`: Will reply to a given conversation, addressing only the people who are part of the recipient set of that conversation. Sets the visibility to `direct`.
index 0c23a404d8d61f87fb4d7a66e5831eb207552f65..39ecc5d386752dfb7b0917bc6ca08e12b1c1c74a 100644 (file)
@@ -40,5 +40,5 @@ The following is a config example to use with [Grafana](https://grafana.com)
     metrics_path: /api/pleroma/app_metrics
     scheme: https
     static_configs:
-    - targets: ['pleroma.soykaf.com']
+    - targets: ['otp.akkoma.dev']
 ```
index 1018e9c2b109e4a49ae0728c7896d26a98c0da40..241f790dc5e0c028d7dd0ae4b78e8b077605dd24 100644 (file)
@@ -23,20 +23,20 @@ will be posted via [@akkoma@ihba](https://ihatebeinga.live/users/akkoma)
 
 ## How can I use it?
 
-Akkoma instances are already widely deployed, a list can be found at <https://the-federation.info/pleroma> and <https://fediverse.network/pleroma>.
+Akkoma instances are already widely deployed, a list can be found at <https://the-federation.info/akkoma> and <https://akkoma.fediverse.observer/list>.
 
 If you don't feel like joining an existing instance, but instead prefer to deploy your own instance, that's easy too!
 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://pleroma.soykaf.com>) 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)
 
 ### Pleroma-FE
 The default front-end used by Akkoma is Pleroma-FE. You can find more information on what it is and how to use it in the [Introduction to Pleroma-FE](https://docs-fe.akkoma.dev/stable/).
 
 ### Mastodon interface
 If the Pleroma-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://pleroma.soykaf.com/web>) and you'll end on the Mastodon web interface, but with a Akkoma backend! MAGIC!
+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.
index b64cdd056e2883688ca3ef2d3911f2ef732c9018..2df7bfad02cc76b56fc1ccfa84bc271364bc2e19 100644 (file)
@@ -95,3 +95,26 @@ Your situation will likely be unique - you'll need the changes in the
 [forked pleroma-fe repository](https://akkoma.dev/AkkomaGang/pleroma-fe),
 and either merge or cherry-pick from there depending on how you've got
 things.
+
+## Common issues
+
+### The frontend doesn't show after installing it
+
+This may occur if you are using database configuration.
+
+Sometimes the config in your database will cause akkoma to still report
+that there's no frontend, even when you've run the install.
+
+To fix this, run:
+
+=== "OTP"
+    ```sh
+    ./bin/pleroma_ctl config delete pleroma frontends
+    ```
+
+=== "From Source"
+    ```sh
+    mix pleroma.config delete pleroma frontends
+    ```
+
+which will remove the config from the database. Things should work now.
\ No newline at end of file
index 581942f9902238edf05afd215f70f4e9a9f724b7..9693467f281926a7a9603e3e52dc1c45be5c71cf 100644 (file)
@@ -160,15 +160,14 @@ http protocol plerup { # Protocol for upstream akkoma server
        match request header append "X-Forwarded-For" value "$REMOTE_ADDR" # This two header and the next one are not strictly required by akkoma but adding them won't hurt
        match request header append "X-Forwarded-By" value "$SERVER_ADDR:$SERVER_PORT"
 
-       match response header append "X-XSS-Protection" value "1; mode=block"
+       match response header append "X-XSS-Protection" value "0"
        match response header append "X-Permitted-Cross-Domain-Policies" value "none"
        match response header append "X-Frame-Options" value "DENY"
        match response header append "X-Content-Type-Options" value "nosniff"
        match response header append "Referrer-Policy" value "same-origin"
-       match response header append "X-Download-Options" value "noopen"
-       match response header append "Content-Security-Policy" value "default-src 'none'; base-uri 'self'; form-action 'self'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; connect-src 'self' wss://CHANGEME.tld; upgrade-insecure-requests;" # Modify "CHANGEME.tld" and set your instance's domain here
+       match response header append "Content-Security-Policy" value "default-src 'none'; base-uri 'none'; form-action 'self'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; connect-src 'self' wss://CHANGEME.tld; upgrade-insecure-requests;" # Modify "CHANGEME.tld" and set your instance's domain here
        match request header append "Connection" value "upgrade"
-       #match response header append "Strict-Transport-Security" value "max-age=31536000; includeSubDomains" # Uncomment this only after you get HTTPS working.
+       #match response header append "Strict-Transport-Security" value "max-age=63072000; includeSubDomains; preload" # Uncomment this only after you get HTTPS working.
 
        # If you do not want remote frontends to be able to access your Akkoma backend server, comment these lines
        match response header append "Access-Control-Allow-Origin" value "*"
index 4949dd7277ba6c00197ea60570cbbe8db30eec81..e837ac8d44713d6ce551611f1637e8e8b2db7560 100644 (file)
@@ -99,6 +99,7 @@ defmodule Pleroma.HTTP.AdapterHelper do
           | {:error, atom()}
           | nil
   def parse_proxy(nil), do: nil
+  def parse_proxy(""), do: nil
 
   def parse_proxy(proxy) when is_binary(proxy) do
     with %URI{} = uri <- URI.parse(proxy),
index 6305368718a33b7f805a4cc5285f996ddc3cc246..fc377b3762c36918a2a5c445a250ba69acc06511 100644 (file)
@@ -10,7 +10,13 @@ defmodule Pleroma.HTTP.AdapterHelper.Default do
   @spec options(keyword(), URI.t()) :: keyword()
   def options(opts, _uri) do
     proxy = Pleroma.Config.get([:http, :proxy_url])
-    AdapterHelper.maybe_add_proxy(opts, AdapterHelper.format_proxy(proxy))
+    pool_timeout = Pleroma.Config.get([:http, :pool_timeout], 5000)
+    receive_timeout = Pleroma.Config.get([:http, :receive_timeout], 15_000)
+
+    opts
+    |> AdapterHelper.maybe_add_proxy(AdapterHelper.format_proxy(proxy))
+    |> Keyword.put(:pool_timeout, pool_timeout)
+    |> Keyword.put(:receive_timeout, receive_timeout)
   end
 
   @spec get_conn(URI.t(), keyword()) :: {:ok, keyword()}
index 8ec28345f3c29bd4321a8edfedc4bff9402d3fa8..aafab6643762f66a58e49d56892feb1dbc6089d3 100644 (file)
@@ -4,6 +4,7 @@
 
 defmodule Pleroma.Object.Fetcher do
   alias Pleroma.HTTP
+  alias Pleroma.Instances
   alias Pleroma.Maps
   alias Pleroma.Object
   alias Pleroma.Object.Containment
@@ -234,6 +235,10 @@ defmodule Pleroma.Object.Fetcher do
          {:ok, body} <- get_object(id),
          {:ok, data} <- safe_json_decode(body),
          :ok <- Containment.contain_origin_from_id(id, data) do
+      unless Instances.reachable?(id) do
+        Instances.set_reachable(id)
+      end
+
       {:ok, data}
     else
       {:scheme, _} ->
index 700cab2b591ea00af408092ba7e45fa060c8ac39..eb907a2d86340d43caef83fa7a6e8a7f9182de6c 100644 (file)
@@ -1910,7 +1910,8 @@ defmodule Pleroma.User do
       {%User{} = user, _} ->
         {:ok, user}
 
-      _ ->
+      e ->
+        Logger.error("Could not fetch user, #{inspect(e)}")
         {:error, :not_found}
     end
   end
index dcdc7085fdaebc45eb36f4d279100ff33cce59a3..3a9b08cf05d39bfa74167ceb7c7c41e9ca843838 100644 (file)
@@ -1247,15 +1247,15 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     end
   end
 
+  defp exclude_invisible_actors(query, %{type: "Flag"}), do: query
   defp exclude_invisible_actors(query, %{invisible_actors: true}), do: query
 
   defp exclude_invisible_actors(query, _opts) do
-    invisible_ap_ids =
-      User.Query.build(%{invisible: true, select: [:ap_id]})
-      |> Repo.all()
-      |> Enum.map(fn %{ap_id: ap_id} -> ap_id end)
-
-    from([activity] in query, where: activity.actor not in ^invisible_ap_ids)
+    query
+    |> join(:inner, [activity], u in User,
+      as: :u,
+      on: activity.actor == u.ap_id and u.invisible == false
+    )
   end
 
   defp exclude_id(query, %{exclude_id: id}) when is_binary(id) do
@@ -1385,7 +1385,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
       |> restrict_instance(opts)
       |> restrict_announce_object_actor(opts)
       |> restrict_filtered(opts)
-      |> Activity.restrict_deactivated_users()
+      |> maybe_restrict_deactivated_users(opts)
       |> exclude_poll_votes(opts)
       |> exclude_invisible_actors(opts)
       |> exclude_visibility(opts)
@@ -1530,6 +1530,18 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     # we request WebFinger here
     nickname = additional[:nickname_from_acct] || generate_nickname(data)
 
+    # also_known_as must be a URL
+    also_known_as =
+      data
+      |> Map.get("alsoKnownAs", [])
+      |> Enum.filter(fn url ->
+        case URI.parse(url) do
+          %URI{scheme: "http"} -> true
+          %URI{scheme: "https"} -> true
+          _ -> false
+        end
+      end)
+
     %{
       ap_id: data["id"],
       uri: get_actor_url(data["url"]),
@@ -1547,7 +1559,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
       featured_address: featured_address,
       bio: data["summary"] || "",
       actor_type: actor_type,
-      also_known_as: Map.get(data, "alsoKnownAs", []),
+      also_known_as: also_known_as,
       public_key: public_key,
       inbox: data["inbox"],
       shared_inbox: shared_inbox,
@@ -1801,4 +1813,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     |> restrict_visibility(%{visibility: "direct"})
     |> order_by([activity], asc: activity.id)
   end
+
+  defp maybe_restrict_deactivated_users(activity, %{type: "Flag"}), do: activity
+
+  defp maybe_restrict_deactivated_users(activity, _opts),
+    do: Activity.restrict_deactivated_users(activity)
 end
index b305dc1ea8fb3d544efe37dae11a4bd0185be856..359a73ac06e3ddcd45914d61f3835e902d67a077 100644 (file)
@@ -223,12 +223,12 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
             type: :object,
             properties: %{
               reblogs: %Schema{
-                type: :boolean,
+                allOf: [BooleanLike],
                 description: "Receive this account's reblogs in home timeline? Defaults to true.",
                 default: true
               },
               notify: %Schema{
-                type: :boolean,
+                allOf: [BooleanLike],
                 description:
                   "Receive notifications for all statuses posted by the account? Defaults to false.",
                 default: false
index 770044de26bbe38566053df5dd99886c3c28bd9b..3a00424c67b72ec848e5a49cc4578e8cbf64ffe4 100644 (file)
@@ -48,7 +48,9 @@ defmodule Pleroma.Web.Federator do
 
   @impl true
   def publish(%{data: %{"object" => object}} = activity) when is_binary(object) do
-    PublisherWorker.enqueue("publish", %{"activity_id" => activity.id, "object_data" => nil})
+    PublisherWorker.enqueue("publish", %{"activity_id" => activity.id, "object_data" => nil},
+      priority: publish_priority(activity)
+    )
   end
 
   @impl true
@@ -63,7 +65,7 @@ defmodule Pleroma.Web.Federator do
     )
   end
 
-  defp publish_priority(%{type: "Delete"}), do: 3
+  defp publish_priority(%{data: %{"type" => "Delete"}}), do: 3
   defp publish_priority(_), do: 0
 
   # Job Worker Callbacks
index fc2f7b268926a7b676d6108af5171f5af3027c2f..47874a980147561439e1894a4bcddd2134edc4b3 100644 (file)
@@ -42,12 +42,11 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
     custom_http_frontend_headers = custom_http_frontend_headers()
 
     headers = [
-      {"x-xss-protection", "1; mode=block"},
+      {"x-xss-protection", "0"},
       {"x-permitted-cross-domain-policies", "none"},
       {"x-frame-options", "DENY"},
       {"x-content-type-options", "nosniff"},
       {"referrer-policy", referrer_policy},
-      {"x-download-options", "noopen"},
       {"content-security-policy", csp_string()},
       {"permissions-policy", "interest-cohort=()"}
     ]
@@ -76,7 +75,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
 
   static_csp_rules = [
     "default-src 'none'",
-    "base-uri 'self'",
+    "base-uri 'none'",
     "frame-ancestors 'none'",
     "style-src 'self' 'unsafe-inline'",
     "font-src 'self'",
@@ -237,11 +236,9 @@ your instance and your users via malicious posts:
 
   defp maybe_send_sts_header(conn, true) do
     max_age_sts = Config.get([:http_security, :sts_max_age])
-    max_age_ct = Config.get([:http_security, :ct_max_age])
 
     merge_resp_headers(conn, [
-      {"strict-transport-security", "max-age=#{max_age_sts}; includeSubDomains"},
-      {"expect-ct", "enforce, max-age=#{max_age_ct}"}
+      {"strict-transport-security", "max-age=#{max_age_sts}; includeSubDomains; preload"}
     ])
   end
 
index 66c5c35916e9b59da4fe69ca84f43dfa9833ccc3..cf78f1cb9048bc9f574c6d35ebe0f5f381533208 100644 (file)
@@ -14,6 +14,11 @@ defmodule Pleroma.Workers.BackupWorker do
     |> Oban.insert()
   end
 
+  @impl Oban.Worker
+  def timeout(_job) do
+    Pleroma.Config.get([:workers, :timeout, :backup], :timer.minutes(1))
+  end
+
   def schedule_deletion(backup) do
     days = Pleroma.Config.get([Backup, :purge_after_days])
     time = 60 * 60 * 24 * days
@@ -30,6 +35,7 @@ defmodule Pleroma.Workers.BackupWorker do
     |> Oban.insert()
   end
 
+  @impl true
   def perform(%Job{
         args: %{"op" => "process", "backup_id" => backup_id, "admin_user_id" => admin_user_id}
       }) do
index 027171c1e66fbf7b61eb746b6ba975405f890699..652e1d6b19008c563f4c973122eba6f9f2450ce7 100644 (file)
@@ -27,6 +27,11 @@ defmodule Pleroma.Workers.PurgeExpiredActivity do
     end
   end
 
+  @impl Oban.Worker
+  def timeout(_job) do
+    Pleroma.Config.get([:workers, :timeout, :activity_expiration], :timer.minutes(1))
+  end
+
   @impl true
   def perform(%Oban.Job{args: %{"activity_id" => id}}) do
     with %Activity{} = activity <- find_activity(id),
index 4740d52e91ac99349fdab64d1f27ffaa0f0f996b..593380d13e405c4efc546fc071dd1b1469c7281f 100644 (file)
@@ -24,6 +24,11 @@ defmodule Pleroma.Workers.PurgeExpiredFilter do
     |> Oban.insert()
   end
 
+  @impl Oban.Worker
+  def timeout(_job) do
+    Pleroma.Config.get([:workers, :timeout, :filter_expiration], :timer.minutes(1))
+  end
+
   @impl true
   def perform(%Job{args: %{"filter_id" => id}}) do
     Pleroma.Filter
index cfdf5c6dc71c9115baaaffb069a1383d32689351..b4db84f4ebceb3b2b54a9fb68923f4911b3a7a1d 100644 (file)
@@ -19,6 +19,11 @@ defmodule Pleroma.Workers.PurgeExpiredToken do
     |> Oban.insert()
   end
 
+  @impl Oban.Worker
+  def timeout(_job) do
+    Pleroma.Config.get([:workers, :timeout, :token_expiration], :timer.minutes(1))
+  end
+
   @impl true
   def perform(%Oban.Job{args: %{"token_id" => id, "mod" => module}}) do
     module
index 4befbeb3b2be34ea2073443fb1b94cc6a2cd1079..4c0a55774d6df3364b56ac2a639d3a6ac413060a 100644 (file)
@@ -43,6 +43,12 @@ defmodule Pleroma.Workers.WorkerHelper do
         |> apply(:new, [params, worker_args])
         |> Oban.insert()
       end
+
+      @impl Oban.Worker
+      def timeout(_job) do
+        queue_atom = String.to_atom(unquote(queue))
+        Config.get([:workers, :timeout, queue_atom], :timer.minutes(1))
+      end
     end
   end
 end
index 3a25f067e45b9e929ea89fd5ed5a2d79462b8921..ad2177a9b171b8c5845125b5b06668851c91deaa 100644 (file)
@@ -1936,12 +1936,6 @@ msgstr ""
 "What user agent to use. Must be a string or an atom `:default`. Default "
 "value is `:default`."
 
-#: lib/pleroma/docs/translator.ex:5
-#, fuzzy
-msgctxt "config description at :pleroma-:http_security > :ct_max_age"
-msgid "The maximum age for the Expect-CT header if sent"
-msgstr "The maximum age for the Expect-CT header if sent"
-
 #: lib/pleroma/docs/translator.ex:5
 #, fuzzy
 msgctxt "config description at :pleroma-:http_security > :enabled"
@@ -4993,12 +4987,6 @@ msgctxt "config label at :pleroma-:http > :user_agent"
 msgid "User agent"
 msgstr "User agent"
 
-#: lib/pleroma/docs/translator.ex:5
-#, fuzzy
-msgctxt "config label at :pleroma-:http_security > :ct_max_age"
-msgid "CT max age"
-msgstr "CT max age"
-
 #: lib/pleroma/docs/translator.ex:5
 #, fuzzy
 msgctxt "config label at :pleroma-:http_security > :enabled"
index 9021fbfab22f5cde6b976356ea9e1d9b9fb98a0f..1a55bfe68e19da4a3d03249f3f08f9881b00c3c8 100644 (file)
@@ -1612,12 +1612,6 @@ msgctxt "config description at :pleroma-:http > :user_agent"
 msgid "What user agent to use. Must be a string or an atom `:default`. Default value is `:default`."
 msgstr ""
 
-#, elixir-autogen, elixir-format
-#: lib/pleroma/docs/translator.ex:5
-msgctxt "config description at :pleroma-:http_security > :ct_max_age"
-msgid "The maximum age for the Expect-CT header if sent"
-msgstr ""
-
 #, elixir-autogen, elixir-format
 #: lib/pleroma/docs/translator.ex:5
 msgctxt "config description at :pleroma-:http_security > :enabled"
@@ -4048,12 +4042,6 @@ msgctxt "config label at :pleroma-:http > :user_agent"
 msgid "User agent"
 msgstr ""
 
-#, elixir-autogen, elixir-format
-#: lib/pleroma/docs/translator.ex:5
-msgctxt "config label at :pleroma-:http_security > :ct_max_age"
-msgid "CT max age"
-msgstr ""
-
 #, elixir-autogen, elixir-format
 #: lib/pleroma/docs/translator.ex:5
 msgctxt "config label at :pleroma-:http_security > :enabled"
index 9c1acae202210710d87336cf57e72a9b19b7d20e..f3602ce46025f5c882f0307430a40b78b5fd12b8 100644 (file)
@@ -1759,12 +1759,6 @@ msgstr ""
 "What user agent to use. Must be a string or an atom `:default`. Default "
 "value is `:default`."
 
-#: lib/pleroma/docs/translator.ex:5
-#, elixir-autogen, elixir-format, fuzzy
-msgctxt "config description at :pleroma-:http_security > :ct_max_age"
-msgid "The maximum age for the Expect-CT header if sent"
-msgstr "The maximum age for the Expect-CT header if sent"
-
 #: lib/pleroma/docs/translator.ex:5
 #, elixir-autogen, elixir-format, fuzzy
 msgctxt "config description at :pleroma-:http_security > :enabled"
@@ -4420,12 +4414,6 @@ msgctxt "config label at :pleroma-:http > :user_agent"
 msgid "User agent"
 msgstr "User agent"
 
-#: lib/pleroma/docs/translator.ex:5
-#, elixir-autogen, elixir-format, fuzzy
-msgctxt "config label at :pleroma-:http_security > :ct_max_age"
-msgid "CT max age"
-msgstr "CT max age"
-
 #: lib/pleroma/docs/translator.ex:5
 #, elixir-autogen, elixir-format, fuzzy
 msgctxt "config label at :pleroma-:http_security > :enabled"
index 4def37366701d9f831be8a6bed8fc2aa1ade8dff..8ce06bf38e375eeee9c6246e01aff3df87fb2bb9 100644 (file)
@@ -1759,12 +1759,6 @@ msgstr ""
 "What user agent to use. Must be a string or an atom `:default`. Default "
 "value is `:default`."
 
-#: lib/pleroma/docs/translator.ex:5
-#, elixir-autogen, elixir-format, fuzzy
-msgctxt "config description at :pleroma-:http_security > :ct_max_age"
-msgid "The maximum age for the Expect-CT header if sent"
-msgstr "The maximum age for the Expect-CT header if sent"
-
 #: lib/pleroma/docs/translator.ex:5
 #, elixir-autogen, elixir-format, fuzzy
 msgctxt "config description at :pleroma-:http_security > :enabled"
@@ -4420,12 +4414,6 @@ msgctxt "config label at :pleroma-:http > :user_agent"
 msgid "User agent"
 msgstr "User agent"
 
-#: lib/pleroma/docs/translator.ex:5
-#, elixir-autogen, elixir-format, fuzzy
-msgctxt "config label at :pleroma-:http_security > :ct_max_age"
-msgid "CT max age"
-msgstr "CT max age"
-
 #: lib/pleroma/docs/translator.ex:5
 #, elixir-autogen, elixir-format, fuzzy
 msgctxt "config label at :pleroma-:http_security > :enabled"
diff --git a/test/fixtures/microblogpub/user_with_invalid_also_known_as.json b/test/fixtures/microblogpub/user_with_invalid_also_known_as.json
new file mode 100644 (file)
index 0000000..a030762
--- /dev/null
@@ -0,0 +1,57 @@
+{
+  "@context": [
+    "https://www.w3.org/ns/activitystreams",
+    "https://w3id.org/security/v1",
+    {
+      "Hashtag": "as:Hashtag",
+      "sensitive": "as:sensitive",
+      "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
+      "alsoKnownAs": {
+        "@id": "as:alsoKnownAs",
+        "@type": "@id"
+      },
+      "movedTo": {
+        "@id": "as:movedTo",
+        "@type": "@id"
+      },
+      "toot": "http://joinmastodon.org/ns#",
+      "featured": {
+        "@id": "toot:featured",
+        "@type": "@id"
+      },
+      "Emoji": "toot:Emoji",
+      "blurhash": "toot:blurhash",
+      "votersCount": "toot:votersCount",
+      "schema": "http://schema.org#",
+      "PropertyValue": "schema:PropertyValue",
+      "value": "schema:value",
+      "ostatus": "http://ostatus.org#",
+      "conversation": "ostatus:conversation"
+    }
+  ],
+  "type": "Person",
+  "id": "https://mbp.example.com",
+  "following": "https://mbp.example.com/following",
+  "followers": "https://mbp.example.com/followers",
+  "featured": "https://mbp.example.com/featured",
+  "inbox": "https://mbp.example.com/inbox",
+  "outbox": "https://mbp.example.com/outbox",
+  "preferredUsername": "MBP",
+  "name": "MBP",
+  "summary": "wowee",
+  "endpoints": {
+    "sharedInbox": "https://mbp.example.com/inbox"
+  },
+  "url": "https://mbp.example.com/",
+  "manuallyApprovesFollowers": false,
+  "attachment": [],
+  "icon": {
+    "mediaType": "image/jpeg",
+    "type": "Image",
+    "url": "https://beta.4201337.xyz/static/denise.jpg"
+  },
+  "tag": [],
+  "alsoKnownAs": [
+    "example@elsewhere.com"
+  ]
+}
index 55ffe4921543cb11a2aae6dce35135ecb29aec14..ba09f3422ba07095994b3108c583cc9f53ce50a6 100644 (file)
@@ -3,8 +3,7 @@
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.HTTP.AdapterHelperTest do
-  use ExUnit.Case, async: true
-
+  use Pleroma.DataCase, async: true
   alias Pleroma.HTTP.AdapterHelper
 
   describe "format_proxy/1" do
@@ -47,4 +46,24 @@ defmodule Pleroma.HTTP.AdapterHelperTest do
              ]
     end
   end
+
+  describe "timeout settings" do
+    test "should default to 5000/15000" do
+      options = AdapterHelper.options(%URI{host: 'somewhere'})
+      assert options[:pool_timeout] == 5000
+      assert options[:receive_timeout] == 15_000
+    end
+
+    test "pool_timeout should be overridden by :http, :pool_timeout" do
+      clear_config([:http, :pool_timeout], 10_000)
+      options = AdapterHelper.options(%URI{host: 'somewhere'})
+      assert options[:pool_timeout] == 10_000
+    end
+
+    test "receive_timeout should be overridden by :http, :receive_timeout" do
+      clear_config([:http, :receive_timeout], 20_000)
+      options = AdapterHelper.options(%URI{host: 'somewhere'})
+      assert options[:receive_timeout] == 20_000
+    end
+  end
 end
index c321032adb7f896fc794e16749ecae797959bdbc..71306cdfe4f822c3bf2f42ef51e1ff194d2cc4f7 100644 (file)
@@ -6,6 +6,7 @@ defmodule Pleroma.Object.FetcherTest do
   use Pleroma.DataCase
 
   alias Pleroma.Activity
+  alias Pleroma.Instances
   alias Pleroma.Object
   alias Pleroma.Object.Fetcher
 
@@ -159,6 +160,17 @@ defmodule Pleroma.Object.FetcherTest do
                  "https://patch.cx/media/03ca3c8b4ac3ddd08bf0f84be7885f2f88de0f709112131a22d83650819e36c2.json"
                )
     end
+
+    test "it resets instance reachability on successful fetch" do
+      id = "http://mastodon.example.org/@admin/99541947525187367"
+      Instances.set_consistently_unreachable(id)
+      refute Instances.reachable?(id)
+
+      {:ok, _object} =
+        Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
+
+      assert Instances.reachable?(id)
+    end
   end
 
   describe "implementation quirks" do
index 195df2a03047231e9a95325af57ebe9306825565..44763daf70bcf544c273dea4866693b3444b6495 100644 (file)
@@ -968,6 +968,25 @@ defmodule Pleroma.UserTest do
 
       assert user.last_refreshed_at == orig_user.last_refreshed_at
     end
+
+    test "it doesn't fail on invalid alsoKnownAs entries" do
+      Tesla.Mock.mock(fn
+        %{url: "https://mbp.example.com/"} ->
+          %Tesla.Env{
+            status: 200,
+            body:
+              "test/fixtures/microblogpub/user_with_invalid_also_known_as.json"
+              |> File.read!(),
+            headers: [{"content-type", "application/activity+json"}]
+          }
+
+        _ ->
+          %Tesla.Env{status: 404}
+      end)
+
+      assert {:ok, %User{also_known_as: []}} =
+               User.get_or_fetch_by_ap_id("https://mbp.example.com/")
+    end
   end
 
   test "returns an ap_id for a user" do
index 5b4f124021a1fa8620b9f1f83eb329486cbcde5d..29e34546e0eddb79746f1be6f26418a2c37460b1 100644 (file)
@@ -902,6 +902,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
                |> post("/api/v1/accounts/#{followed.id}/follow", %{reblogs: true})
                |> json_response_and_validate_schema(200)
 
+      assert %{"showing_reblogs" => true} =
+               conn
+               |> put_req_header("content-type", "application/json")
+               |> post("/api/v1/accounts/#{followed.id}/follow", %{reblogs: "1"})
+               |> json_response_and_validate_schema(200)
+
       assert [%{"id" => ^reblog_id}] =
                conn
                |> get("/api/v1/timelines/home")
@@ -931,6 +937,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
                |> post("/api/v1/accounts/#{followed.id}/follow", %{reblogs: false})
                |> json_response_and_validate_schema(200)
 
+      assert %{"showing_reblogs" => false} =
+               conn
+               |> put_req_header("content-type", "application/json")
+               |> post("/api/v1/accounts/#{followed.id}/follow", %{reblogs: "0"})
+               |> json_response_and_validate_schema(200)
+
       assert [] ==
                conn
                |> get("/api/v1/timelines/home")
@@ -941,21 +953,23 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
       %{conn: conn} = oauth_access(["follow"])
       followed = insert(:user)
 
-      ret_conn =
-        conn
-        |> put_req_header("content-type", "application/json")
-        |> post("/api/v1/accounts/#{followed.id}/follow", %{notify: true})
-
-      assert %{"id" => _id, "subscribing" => true} =
-               json_response_and_validate_schema(ret_conn, 200)
+      assert %{"subscribing" => true} =
+               conn
+               |> put_req_header("content-type", "application/json")
+               |> post("/api/v1/accounts/#{followed.id}/follow", %{notify: true})
+               |> json_response_and_validate_schema(200)
 
-      ret_conn =
-        conn
-        |> put_req_header("content-type", "application/json")
-        |> post("/api/v1/accounts/#{followed.id}/follow", %{notify: false})
+      assert %{"subscribing" => true} =
+               conn
+               |> put_req_header("content-type", "application/json")
+               |> post("/api/v1/accounts/#{followed.id}/follow", %{notify: "1"})
+               |> json_response_and_validate_schema(200)
 
-      assert %{"id" => _id, "subscribing" => false} =
-               json_response_and_validate_schema(ret_conn, 200)
+      assert %{"subscribing" => false} =
+               conn
+               |> put_req_header("content-type", "application/json")
+               |> post("/api/v1/accounts/#{followed.id}/follow", %{notify: false})
+               |> json_response_and_validate_schema(200)
     end
 
     test "following / unfollowing errors", %{user: user, conn: conn} do
index 7f85f4a11352776c9f4555309c54241957eee4c7..d6d84107815896459bf6e78bebfe5c2b5e038f31 100644 (file)
@@ -17,7 +17,6 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do
       refute Conn.get_resp_header(conn, "x-permitted-cross-domain-policies") == []
       refute Conn.get_resp_header(conn, "x-frame-options") == []
       refute Conn.get_resp_header(conn, "x-content-type-options") == []
-      refute Conn.get_resp_header(conn, "x-download-options") == []
       refute Conn.get_resp_header(conn, "referrer-policy") == []
       refute Conn.get_resp_header(conn, "content-security-policy") == []
     end
@@ -28,7 +27,6 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do
       conn = get(conn, "/api/v1/instance")
 
       refute Conn.get_resp_header(conn, "strict-transport-security") == []
-      refute Conn.get_resp_header(conn, "expect-ct") == []
     end
 
     test "it does not send STS headers when disabled", %{conn: conn} do
@@ -37,7 +35,6 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do
       conn = get(conn, "/api/v1/instance")
 
       assert Conn.get_resp_header(conn, "strict-transport-security") == []
-      assert Conn.get_resp_header(conn, "expect-ct") == []
     end
 
     test "referrer-policy header reflects configured value", %{conn: conn} do
@@ -155,7 +152,6 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do
     assert Conn.get_resp_header(conn, "x-permitted-cross-domain-policies") == []
     assert Conn.get_resp_header(conn, "x-frame-options") == []
     assert Conn.get_resp_header(conn, "x-content-type-options") == []
-    assert Conn.get_resp_header(conn, "x-download-options") == []
     assert Conn.get_resp_header(conn, "referrer-policy") == []
     assert Conn.get_resp_header(conn, "content-security-policy") == []
   end
diff --git a/test/pleroma/workers/publisher_worker_test.exs b/test/pleroma/workers/publisher_worker_test.exs
new file mode 100644 (file)
index 0000000..cf0ac0c
--- /dev/null
@@ -0,0 +1,52 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Workers.PublisherWorkerTest do
+  use Pleroma.DataCase, async: true
+  use Oban.Testing, repo: Pleroma.Repo
+
+  import Pleroma.Factory
+
+  alias Pleroma.Object
+  alias Pleroma.Web.ActivityPub.ActivityPub
+  alias Pleroma.Web.ActivityPub.Builder
+  alias Pleroma.Web.CommonAPI
+  alias Pleroma.Web.Federator
+
+  describe "Oban job priority:" do
+    setup do
+      user = insert(:user)
+
+      {:ok, post} = CommonAPI.post(user, %{status: "Regrettable post"})
+      object = Object.normalize(post, fetch: false)
+      {:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])
+      {:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true)
+
+      %{
+        post: post,
+        delete: delete
+      }
+    end
+
+    test "Deletions are lower priority", %{delete: delete} do
+      assert {:ok, %Oban.Job{priority: 3}} = Federator.publish(delete)
+    end
+
+    test "Creates are normal priority", %{post: post} do
+      assert {:ok, %Oban.Job{priority: 0}} = Federator.publish(post)
+    end
+  end
+
+  describe "Oban job timeout" do
+    test "should have a timeout" do
+      clear_config([:workers, :timeout, :federator_outgoing], :timer.minutes(2))
+      assert Pleroma.Workers.PublisherWorker.timeout(nil) == :timer.minutes(2)
+    end
+
+    test "should use a default timeout if none specified" do
+      clear_config([:workers, :timeout, :federator_outgoing])
+      assert Pleroma.Workers.PublisherWorker.timeout(nil) == :timer.seconds(10)
+    end
+  end
+end
index 98f30f61f50cedda4bcbb39d44167f8e1cae5389..6285dca3ebefb3be6ff2692001b0db34017cdcc1 100644 (file)
@@ -56,4 +56,9 @@ defmodule Pleroma.Workers.PurgeExpiredActivityTest do
     assert {:error, :activity_not_found} =
              perform_job(Pleroma.Workers.PurgeExpiredActivity, %{activity_id: "some_if"})
   end
+
+  test "has a timeout" do
+    clear_config([:workers, :timeout, :activity_expiration], 50)
+    assert Pleroma.Workers.PurgeExpiredActivity.timeout(%Oban.Job{}) == 50
+  end
 end
index 5558d5b5f9a789d14e1cf0557b09952bfe62d243..9f5f1b687f63fc99803a28d5c2cfbc2916ee5f40 100644 (file)
@@ -49,4 +49,9 @@ defmodule Pleroma.Workers.ScheduledActivityWorkerTest do
              ScheduledActivityWorker.perform(%Oban.Job{args: %{"activity_id" => 42}})
            end) =~ "Couldn't find scheduled activity: 42"
   end
+
+  test "has a timeout" do
+    clear_config([:workers, :timeout, :scheduled_activities], :timer.minutes(5))
+    assert ScheduledActivityWorker.timeout(nil) == :timer.minutes(5)
+  end
 end