From 6b786b063dd67014ce383dbc8a0935cdb1b766f3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 21 Oct 2026 11:24:34 +0200 Subject: [PATCH 001/554] docs(requirements): add 040 OpenPost publishing desk role --- docs/requirements/040-web-app-openpost.md | 296 ++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100644 docs/requirements/040-web-app-openpost.md diff --git a/docs/requirements/040-web-app-openpost.md b/docs/requirements/040-web-app-openpost.md new file mode 100644 index 0000000000..b6756841d8 --- /dev/null +++ b/docs/requirements/040-web-app-openpost.md @@ -0,0 +1,296 @@ +# 040 - OpenPost Publishing Desk Role + +## User Story + +As an Infinito.Nexus PR manager, I want a self-hosted [OpenPost](https://github.com/getopenpost/openpost) publishing desk deployed as the `web-app-openpost` role behind Keycloak single sign-on so that I can compose, schedule and publish content to Fediverse and commercial social networks from one sovereign interface. + +## Background + +This requirement implements the publishing half of the OpenProject user story "sovereign social media publishing and crossposting" (story criteria AC1, AC2, AC3, AC4, AC6, AC7 and the desk part of AC8). +Automated crossposting from Fediverse accounts (story criterion AC5 and its tests) is specified in [041-openpost-crossposter.md](041-openpost-crossposter.md), which builds on this role. +OpenPost is self-hosted and integrated like every other application of the stack: the official upstream image, configured through environment variables, wired into the shared proxy, Keycloak, Postgres, object storage and backups. + +### Evaluation and selection + +| Candidate | Verdict | Decisive evidence | +|---|---|---| +| [OpenPost](https://github.com/getopenpost/openpost) | Selected | Only candidate that publishes to Mastodon (any instance), Pixelfed and PeerTube as well as Facebook, Instagram, X, YouTube, LinkedIn, Threads, TikTok and Bluesky. One image, Postgres, S3 media, OIDC with issuer discovery, AES-256-GCM encryption of provider tokens. | +| [Postiz](https://github.com/gitroomhq/postiz-app) | Rejected | No Pixelfed or PeerTube code, one Mastodon instance per deployment, provider tokens stored in plaintext, Temporal plus Elasticsearch required, OIDC without discovery that self-registers users even with registrations disabled, 19 published advisories. | +| [Ferryman](https://ferryman.io/) | Reference only | Closed SaaS without self-hosting, no Pixelfed or PeerTube, no named legal entity in its privacy policy. | +| [Mixpost](https://mixpost.app/) Pro | Rejected | Commercial source-available licence, no PeerTube, image and database support unverified. | +| [TryPost](https://github.com/trypostit/trypost) | Rejected | No published image, no documented SSO, major version churn within weeks. | +| [n8n](https://n8n.io/) | Not a desk | Automation engine only, Sustainable Use License, native OIDC is a paid feature. | + +OpenPost carries known risks that this requirement mitigates rather than ignores: it was created on 2026-03-21, one maintainer wrote about 95% of its commits, it shipped 265 releases by 2026-10-20, only the latest release receives security fixes, and its maintainer states that no posting option has passed the project's own live certification yet ([provider reference](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/providers/index.md)). + +### Upstream facts established by research + +All OpenPost source references point at commit `0deadaf7`, the branch head on 2026-10-20; the latest published release is `v7.22.9`. + +| Topic | Finding | Source | +|---|---|---| +| Image | `ghcr.io/getopenpost/openpost` publishes release tags for amd64 and arm64; the image runs as UID 1000 on Alpine and ships a HEALTHCHECK on `/api/v1/health`. | [Dockerfile](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/deploy/docker/Dockerfile) | +| Processes | One binary with the roles `all`, `web`, `worker` and `migrate`; Postgres job claiming uses `FOR UPDATE SKIP LOCKED`, migrations take an advisory lock. | [worker.go](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/queue/worker.go) | +| Database | SQLite or Postgres; no MariaDB, no Redis. | [database.go](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/database/database.go) | +| Media | Local disk or S3 (`OPENPOST_S3_*`); Facebook, Instagram and TikTok fetch media from public HTTPS URLs. | [.env.example](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/.env.example) | +| App URL | `OPENPOST_APP_URL` MUST carry a real domain, because OpenPost derives the WebAuthn relying-party ID from it and refuses to start otherwise; cookie sessions additionally require a same-origin `Origin` header. | Proof run on 2026-10-21 (see [Egress proof](#egress-proof)) | +| SSO | One instance-wide OIDC provider (`OPENPOST_OIDC_ISSUER`, `_CLIENT_ID`, `_CLIENT_SECRET_FILE`, `_SCOPES`, `_JIT_ENABLED`, `_BOOTSTRAP_ALLOWLIST`, `OPENPOST_SSO_BREAK_GLASS_EMAILS`); identities match on issuer and subject; `groups` and `preferred_username` are not consumed. | [.env.example](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/.env.example), [identity/service.go](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/services/identity/service.go) | +| Proxy auth | Trusted-proxy mode accepts `X-OpenPost-Proxy-User` together with `OPENPOST_PROXY_AUTH_SECRET`. | [proxyauth middleware](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/services/proxyauth/middleware.go) | +| Secrets at rest | Provider tokens and secrets use AES-256-GCM with key IDs and rotation; JWT, encryption and media signing keys accept `_FILE` variants. | [encrypt.go](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/services/crypto/encrypt.go) | +| Telemetry | Diagnostics to `app.openpo.st` are on by default (`OPENPOST_DIAGNOSTICS_ENABLED`), the update check is on (`OPENPOST_UPDATE_CHECK_ENABLED`), public profiles are on (`OPENPOST_PUBLIC_PROFILES_ENABLED`), PostHog telemetry is off (`OPENPOST_TELEMETRY_ENABLED`). | [diagnostics.md](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/configuration/diagnostics.md) | +| Egress guard | `netguard` is OpenPost's SSRF protection: it rejects a destination when any resolved address lies in a private, loopback, CGNAT, link-local, documentation, benchmarking, multicast or reserved range, checks again at connect time and on every redirect, ignores proxy variables, and has no switch for built-in providers. | [netguard.go](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/netguard/netguard.go) | +| Guard exceptions | Only operator configuration may reach private addresses: the instance OIDC issuer and custom connectors with `mode: private_allowlist`; built-in provider URLs entered by users never may. Custom CAs are honoured through `SSL_CERT_FILE` and the Go `SSL_CERT_DIR` lookup. | [environment-variables.md](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/configuration/environment-variables.md), [custom-connectors.md](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/configuration/custom-connectors.md) | +| Providers | Mastodon (any instance, out-of-band code, `https` on port 443 only), Pixelfed, PeerTube (password exchanged once for tokens), Bluesky (app password), Facebook Pages, Instagram, Threads, X, YouTube, LinkedIn and TikTok; X, LinkedIn and Threads use env triples, Facebook, Instagram, YouTube and TikTok use `OPENPOST_PROVIDER_APPS`. | [.env.example](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/.env.example) | +| API | REST API with `Idempotency-Key`, publications with per-account renditions, `schedule`, `publish-now`, `retry-failed`, job polling and API tokens. | [openapi.json](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/web/openapi.json) | +| Cost control | `OPENPOST_X_MONTHLY_BUDGET_MICROUSD` and per-post cost settings cap X spending. | [.env.example](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/.env.example) | + +### Egress proof + +Inside the development stack, sibling domains such as `*.infinito.test` resolve to the private stack address, and in split-horizon or WireGuard deployments they resolve to private or mesh addresses (`NETWORK_MESH_POOL` is `10.100.0.0/16`), so the unmodified image refuses them. +A role-local egress relay solves this without touching OpenPost: OpenPost reaches the deployment's sibling vhosts through network aliases on a Docker network whose subnet lies outside the guard's ranges, and the relay forwards the untouched TLS stream by SNI to the shared proxy. +The design was proven on 2026-10-21 against the unmodified `ghcr.io/getopenpost/openpost:v7.22.9` with an `nginx:1.30.6-alpine` stream relay on `192.88.99.0/24` (the deprecated 6to4 relay anycast block, RFC 7526) in the compose development stack: + +| Check | Observed result | +|---|---| +| Aliased name forwarded to a Mastodon stub | Mastodon app registration succeeded; the stub received `POST /api/v1/apps` for `microblog.infinito.test`. | +| Aliased name forwarded to the real shared proxy by address | TLS verified against the platform CA through OpenResty; the vhost answered HTTP 404 because it is not a Mastodon instance. | +| Sibling name resolved through normal DNS to the stack address | Rejected: "resolves to a private or local address". | +| Private alias and private IP literal | Rejected by the guard. | +| Aliased name missing from the relay's SNI map | Refused by the relay. | + +### Platform constraints + +| Network | Access path for one organisation | Publish quota | Cost (October 2026) | Token upkeep | Constraint | +|---|---|---|---|---|---| +| Facebook Pages | Own Meta Business app; Standard Access for app-role users without App Review | Reels: 30 per Page per 24 h | No fee found | Long-lived Page tokens do not expire | Development-mode posts are visible only to app-role users | +| Instagram | Professional account via Facebook Login or Instagram Login | 100 per 24 h | No fee found | Instagram Login tokens last 60 days and refresh | JPEG only, fetched from a public URL | +| X | Developer app with prepaid credits | 100 per 15 min per user | $0.015 per post, $0.20 per post with a URL | OAuth 2.0 access tokens refresh via `offline.access` | Identical content across own accounts is forbidden | +| YouTube | Google OAuth client in production status | 100 `videos.insert` calls per day | No fee found | Testing-status refresh tokens expire after 7 days | Private-upload rule for unverified projects is contradictory | +| LinkedIn | Community Management API with legal-entity vetting | Development tier: 500 calls per app per day | No fee found | 60-day tokens without refresh | Human re-authorisation every 60 days | +| Threads | Meta app with `threads_content_publish` | 250 per 24 h | No fee found | 60 days, refreshable | 500 characters per post | +| TikTok | Content Posting API plus audit | About 15 per creator per day | No fee found | Not researched | In-house upload tools are an unacceptable use case | +| Bluesky | App password or atproto OAuth | About 1,666 creates per hour | No fee found | Up to 180 days | Already reachable through `web-app-bridgy-fed` | + +Sources: + +- [X pricing](https://docs.x.com/x-api/getting-started/pricing) +- [Meta access levels](https://developers.facebook.com/docs/graph-api/overview/access-levels) +- [Instagram publishing](https://developers.facebook.com/docs/instagram-platform/content-publishing) +- [YouTube quota costs](https://developers.google.com/youtube/v3/determine_quota_cost) +- [LinkedIn app review](https://learn.microsoft.com/en-us/linkedin/marketing/community-management-app-review) +- [TikTok content sharing guidelines](https://developers.tiktok.com/doc/content-sharing-guidelines) +- [Bluesky rate limits](https://docs.bsky.app/docs/advanced-guides/rate-limits) + +### In-repo analogues + +- [`web-app-nextcloud`](../../roles/web-app-nextcloud/), [`web-app-mastodon`](../../roles/web-app-mastodon/), [`web-app-fider`](../../roles/web-app-fider/), [`web-app-penpot`](../../roles/web-app-penpot/) and [`web-app-discourse`](../../roles/web-app-discourse/) relax their own SSRF guards through native switches; OpenPost has none for built-in providers, which is why the relay exists. +- [container_extra_hosts.py](../../plugins/lookup/container_extra_hosts.py) already resolves the address that reaches the shared proxy per deploy mode for the SSO back-channel pin; the relay forwards to the same address. +- [`svc-net-wireguard`](../../roles/svc-net-wireguard/) carries swarm overlay traffic inside its `swarm` mesh, so an overlay egress network is tunnelled without extra configuration. +- [`web-app-semaphore`](../../roles/web-app-semaphore/) consumes Keycloak through `sso.flavor: oidc`. +- [`web-app-mastodon`](../../roles/web-app-mastodon/), [`web-app-pixelfed`](../../roles/web-app-pixelfed/) and [`web-app-peertube`](../../roles/web-app-peertube/) provide the local Fediverse accounts used as publishing targets in tests. +- [`web-app-seaweedfs`](../../roles/web-app-seaweedfs/) provides S3 object storage through the `seaweedfs` service with `public: true`, as in `web-app-mastodon`. +- [18_api.yml](../../group_vars/all/18_api.yml) is the central SPOT for proprietary API credentials, read through `lookup('api', ...)` and gated by `lookup('api_enabled', ...)`. + +## Confirmed Decisions + +These decisions were confirmed by the operator before implementation starts and are NOT subject to re-litigation during implementation. + +| # | Decision | Reason | +|---|---|---| +| 1 | OpenPost is the publishing desk. | Only candidate covering every required source and target network. | +| 2 | Role id `web-app-openpost`, canonical domain `publish.{{ DOMAIN_PRIMARY }}`. | `social.{{ DOMAIN_PRIMARY }}` belongs to `web-app-friendica`. | +| 3 | The role runs the official `ghcr.io/getopenpost/openpost` image unmodified, pinned to a release tag and configured through environment variables only. | The application is integrated like every other role; the project does not maintain OpenPost. | +| 4 | OpenPost reaches the deployment's own sibling vhosts only through an always-on, role-local egress relay on a network in `NETWORK_EGRESS_RELAY_CIDR`, with exact aliases and an SNI allowlist, forwarding to the shared proxy. | One proven path for development, CI and production, including split-horizon DNS and WireGuard meshes, with the guard intact for every other destination. | +| 5 | Keycloak SSO through native OIDC (`sso.flavor: oidc`); publishing permissions are enforced through OpenPost workspace roles. | OpenPost ships an OIDC adapter and does not consume group claims. | +| 6 | Shared `svc-db-postgres`; media on `web-app-seaweedfs` S3 when deployed, a role volume otherwise. | Postgres is the only multi-process database; S3 gives public media URLs for Meta. | +| 7 | One `all` process with one replica in compose and swarm. | State lives in Postgres and S3, so rescheduling is safe; split `web`/`worker` scaling is out of scope. | +| 8 | Provider app credentials live in the central `API` SPOT. | One place for proprietary credentials. | +| 9 | Diagnostics, update check, PostHog telemetry, feedback and public profiles are disabled. | No unnecessary transmission of internal data. | +| 10 | CI tests Fediverse publishing end to end against local instances through the relay, and the commercial adapters against a role-local provider simulator on the same egress network; real platforms are checked manually in staging. | Real OAuth logins, public redirect hosts and per-post billing make real platforms unusable in CI. | +| 11 | Automated crossposting is a separate sidecar specified in [041](041-openpost-crossposter.md). | Separable deliverable and pull request. | + +## Target Schema + +### Role layout + +``` +roles/web-app-openpost/ +├── Administration.md +├── README.md +├── files/ +│ ├── playwright/ +│ │ ├── playwright.spec.js +│ │ └── test-*.js +│ ├── simulator/ +│ └── test/ +│ └── test.sh +├── meta/ +│ ├── csp.yml +│ ├── domains.yml +│ ├── info.yml +│ ├── main.yml +│ ├── networks.yml +│ ├── secrets.yml +│ ├── services.yml +│ ├── variants.yml +│ └── volumes.yml +├── tasks/ +│ └── main.yml +├── templates/ +│ ├── compose.yml.j2 +│ ├── env.j2 +│ ├── playwright.env.j2 +│ ├── relay.conf.j2 +│ └── test.env.j2 +└── vars/ + └── main.yml +``` + +`templates/relay.conf.j2` renders the relay's SNI map from the deployed sibling vhosts; `files/simulator/` holds the provider simulator mappings. + +### `meta/services.yml` excerpt (proposed shape) + +```yaml +openpost: + image: ghcr.io/getopenpost/openpost + version: "v7.22.9" + update: + type: registry_tags + ports: + internal: + http: 8080 + local: + http: + lifecycle: alpha +relay: + image: nginx + version: "" +simulator: + enabled: false + image: wiremock/wiremock + version: "" +``` + +## Acceptance Criteria + +### Evaluation and documentation (story AC1) + +- [ ] `roles/web-app-openpost/Administration.md` documents, per network (Mastodon, Pixelfed, PeerTube, Facebook Pages, Instagram, X, YouTube, LinkedIn, Threads, TikTok, Bluesky), the supported post types, the developer app and account type, the required scopes, review or verification steps, quotas, costs and token upkeep. +- [ ] `Administration.md` lists every unsupported feature with its workaround, including TikTok's ban on in-house upload tools, the X link surcharge, Instagram's JPEG and public-URL rule, LinkedIn vetting and Bluesky reach through `web-app-bridgy-fed`. +- [ ] `Administration.md` documents data processing (which data each platform receives), third-party dependencies, and licence compatibility of the unmodified AGPL-3.0-only application with the role's own licence. +- [ ] `Administration.md` contains a staging checklist and a verified-combinations matrix (network, content type, OpenPost version, date) for manual checks of the real platforms. + +### Image and configuration (story AC2) + +- [ ] The role runs `ghcr.io/getopenpost/openpost` pinned to a release tag in `meta/services.yml` and ships no role-local Dockerfile or source modification. +- [ ] The external update tooling proposes new upstream release tags through `update.type: registry_tags`. +- [ ] Every OpenPost setting is rendered through `templates/env.j2` or `_FILE` secrets, and `OPENPOST_APP_URL` and `OPENPOST_PUBLIC_URL` carry `https://publish.{{ DOMAIN_PRIMARY }}`. + +### Egress relay (story AC2, AC4, AC7) + +- [ ] `group_vars/all/08_networks.yml` declares `NETWORK_EGRESS_RELAY_CIDR`, a subnet outside every range OpenPost's guard blocks and outside every Docker, mesh, Tor and role subnet pool, and the role's egress network uses it as a bridge in compose and as an overlay in swarm. +- [ ] A `relay` entity running a pinned `nginx` image carries network aliases only for the canonical domains of the deployed sibling roles OpenPost publishes to (`web-app-mastodon`, `web-app-pixelfed`, `web-app-peertube`), each gated by that role's dynamic service flag. +- [ ] The relay forwards TLS unmodified by SNI to the address that reaches the shared proxy in the effective deploy mode, resolved like the `container_extra_hosts` back-channel pin, and never resolves its own aliases. +- [ ] The relay refuses every SNI that is not in its map. +- [ ] When `TLS_MODE` is self-signed, OpenPost trusts the platform CA so that relayed vhosts verify; with public certificates no extra trust is configured. +- [ ] The CLI test proves that OpenPost reaches an aliased sibling vhost, that it still rejects a non-aliased private host and a private IP literal, and that the relay refuses an aliased name missing from its map. +- [ ] Publishing to a local Mastodon account succeeds in swarm through the overlay egress network, verified by `make roundtrip apps="web-app-openpost"`. +- [ ] `Administration.md` explains the guard, the relay, and how a deployment with sibling vhosts on another host or behind split-horizon DNS is covered. + +### Deployment and operations (story AC2) + +- [ ] `publish.{{ DOMAIN_PRIMARY }}` serves the OpenPost UI through the shared OpenResty proxy with TLS and a `Content-Security-Policy` header, and `/api/v1/ready` returns HTTP 200. +- [ ] The role deploys green in compose (`make compose-deploy mode=reinstall apps=web-app-openpost full_cycle=true`) and in swarm, with one `all` replica and no reliance on `container_name`. +- [ ] OpenPost stores its data in `svc-db-postgres`, and no SQLite database exists in the container. +- [ ] With `web-app-seaweedfs` deployed, media lands in S3 and an uploaded file is fetchable anonymously over HTTPS from its public URL; without it, media lands in a role volume served under `/media/`. +- [ ] Media URLs and `/api/v1/accounts//callback` are reachable without a session, while every other UI and API route requires authentication. +- [ ] The container healthcheck probes `/api/v1/health`, and the deploy waits for `/api/v1/ready`. +- [ ] Database and media are part of the platform backup, and a restore drill (purge, restore, redeploy) brings back users, connected accounts and publications. +- [ ] Changing the pinned version and redeploying migrates the schema without manual steps. +- [ ] OpenPost sends mail through the platform mail service resolved by `lookup('email', application_id)`. + +### Secrets and provider credentials (story AC2, AC7) + +- [ ] The JWT secret, encryption key, media signing key and OIDC client secret are generated through `meta/secrets.yml` and reach OpenPost through `_FILE` variants. +- [ ] `group_vars/all/18_api.yml` gains the entries `x`, `meta`, `threads`, `linkedin`, `youtube` and `tiktok`, and the role renders them into `X_CLIENT_*`, `THREADS_CLIENT_*`, `LINKEDIN_CLIENT_*` and `OPENPOST_PROVIDER_APPS`. +- [ ] A provider whose `lookup('api_enabled', ...)` is false cannot be connected in the UI. +- [ ] Connected provider tokens are stored encrypted, verified by reading the token column from Postgres and finding no plaintext token. +- [ ] The X monthly budget (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) is configurable through the inventory and documented. + +### Single sign-on (story AC3) + +- [ ] `meta/services.yml` declares `sso.flavor: oidc`, and OpenPost reads its issuer from `OIDC.CLIENT.ISSUER_URL`, its client from `OIDC.CLIENT.ID` and `OIDC.CLIENT.SECRET`, and uses the scopes `openid profile email`. +- [ ] Password self-registration is disabled, and SSO users are provisioned just in time on their first login. +- [ ] The platform administrator becomes instance administrator through `OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST` on first SSO login. +- [ ] A just-in-time provisioned user without a workspace invitation cannot see or use the organisation workspace or its connected accounts. +- [ ] `Administration.md` documents the break-glass procedure (`OPENPOST_SSO_BREAK_GLASS_EMAILS`), linking an existing account to its SSO identity, and the trusted-proxy fallback through oauth2-proxy. + +### Telemetry and data minimisation (story AC7) + +- [ ] `OPENPOST_DIAGNOSTICS_ENABLED`, `OPENPOST_UPDATE_CHECK_ENABLED`, `OPENPOST_TELEMETRY_ENABLED`, `OPENPOST_FEEDBACK_ENABLED` and `OPENPOST_PUBLIC_PROFILES_ENABLED` are rendered as `false`, and the CLI test asserts it through the running instance. + +### Fediverse publishing (story AC4) + +- [ ] An administrator connects a local Mastodon account through the out-of-band code flow and publishes a text post that appears on the Mastodon instance. +- [ ] An administrator connects a local Pixelfed account and publishes an image post that appears on the Pixelfed instance. +- [ ] An administrator connects a local PeerTube account and publishes a video that appears on the PeerTube instance. + +### Provider simulator (story AC4, AC8) + +- [ ] A `simulator` entity running the pinned `wiremock/wiremock` image is enabled by one `meta/variants.yml` variant only and is absent from the base configuration. +- [ ] Inside that variant, the simulator joins the egress network with aliases for the API hostnames OpenPost uses for X, Facebook, Instagram and YouTube, presents a certificate for those names signed by a per-deploy test CA, and OpenPost trusts that CA. +- [ ] An X, Facebook Page, Instagram and YouTube account each connect through OpenPost's real callback against the simulator without a real provider login. +- [ ] Publishing to those accounts produces the documented request sequence, asserted from the simulator's request journal: one X post within 280 weighted characters, one Facebook Page post, an Instagram media container followed by a publish call with a public JPEG URL, and a resumable YouTube upload. +- [ ] Simulated 429 responses with a reset header and 503 responses lead to retries and exactly one successful delivery. +- [ ] A permanent 4xx response leaves the rendition in a failed state that the UI shows together with the provider error. + +### Publishing management (story AC6) + +- [ ] A post published immediately and a post scheduled two minutes ahead both reach the local Mastodon target, the scheduled one not before its time. +- [ ] Every destination shows its state (scheduled, published, failed) and a failed destination can be retried alone. +- [ ] Two accounts of the same network can be connected in one workspace and selected together for one publication. +- [ ] A workspace member with a role that cannot publish is refused when publishing, while an editor succeeds. + +### Variants, tests and quality (story AC8) + +- [ ] `meta/variants.yml` defines a full variant with every integration and the simulator, separate variants that add the local Mastodon, Pixelfed and PeerTube targets so no single CI runner deploys all three instances, and an all-off variant; every variant deploys cleanly on a fresh host. +- [ ] `files/playwright/` covers the `guest`, `biber` and `administrator` personas per the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md), with the administrator connecting a Fediverse account and publishing, and `biber` being denied the organisation workspace. +- [ ] `files/test/test.sh` with `templates/test.env.j2` covers readiness, the telemetry flags, the egress relay and its negative controls, token encryption at rest, Fediverse delivery and the simulator journal assertions. +- [ ] `make compose-playwright role=web-app-openpost` exits 0 without stub tests and ends logged out. +- [ ] `make roundtrip apps="web-app-openpost"` is green in compose and swarm. +- [ ] `make test` is green tree-wide. + +### Role documentation + +- [ ] `README.md` follows the [role README rules](../contributing/artefact/files/role/readme_md.md), including the Cosmos diagram with the relay, and states the image and bump policy, the egress relay, the SSO model and the telemetry defaults. +- [ ] This requirement is cross-linked from the implementing pull request and from the OpenProject work item. + +## Validation Apps + +```bash +INFINITO_PLAYWRIGHT_KEEP=true make compose-deploy mode=reinstall apps=web-app-openpost full_cycle=true +make roundtrip apps="web-app-openpost" +``` + +Smoke: open `https://publish.{{ DOMAIN_PRIMARY }}/`, sign in through Keycloak, connect the local Mastodon account, publish a post and find it on the Mastodon instance. + +## Prerequisites + +Before implementation, the agent MUST read [AGENTS.md](../../AGENTS.md), then [Compose Loop](../agents/action/iteration/compose.md), [Swarm Loop](../agents/action/iteration/swarm.md) and the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md). + +## Implementation Strategy + +Execute autonomously and start from the proven egress topology: an egress network in `NETWORK_EGRESS_RELAY_CIDR`, an nginx `stream` relay with `ssl_preread` and an SNI map, and OpenPost attached to that network. +Verify against the pinned upstream image before claiming a criterion: the provider hostnames and OAuth endpoints the simulator must answer, how OpenPost validates the OAuth `state` on its callback, and the account-linking flow. +Prove every relay and simulator change in the live stack via `make compose-exec` and `make compose-inner-run` before redeploying. + +## Commit Policy + +- No git commit until every Acceptance Criterion is checked off. +- When met and `make test` is green, instruct the operator to run `git-sign-push` outside the sandbox. The agent MUST NOT push. + +## See Also + +- Automated crossposting: [041-openpost-crossposter.md](041-openpost-crossposter.md) +- Requirement format: [requirements.md](../contributing/requirements.md) +- How agents process requirements: [requirements.md](../agents/action/requirements.md) From b3a7b0e59ca0ea245f2362d715eba0c9c01dadaa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 21 Oct 2026 11:24:34 +0200 Subject: [PATCH 002/554] docs(requirements): add 041 OpenPost crossposter --- docs/requirements/041-openpost-crossposter.md | 229 ++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 docs/requirements/041-openpost-crossposter.md diff --git a/docs/requirements/041-openpost-crossposter.md b/docs/requirements/041-openpost-crossposter.md new file mode 100644 index 0000000000..cb46113ecb --- /dev/null +++ b/docs/requirements/041-openpost-crossposter.md @@ -0,0 +1,229 @@ +# 041 - OpenPost Crossposter for Automated Fediverse Crossposting + +## User Story + +As an Infinito.Nexus PR manager, I want new posts on our organisation's Mastodon, Pixelfed and PeerTube accounts to be detected and distributed automatically through the OpenPost desk to the selected Fediverse and commercial networks, with optional review, duplicate prevention, retries and attribution, so that one post reaches every audience without duplicated work. + +## Background + +This requirement implements the crossposting half of the OpenProject user story "sovereign social media publishing and crossposting" (story criterion AC5 and the crossposting part of AC8). +It builds on [040-web-app-openpost.md](040-web-app-openpost.md), which delivers the OpenPost desk, the egress relay to the deployment's Fediverse instances, the connected Fediverse targets and the provider simulator for X, Facebook, Instagram and YouTube. +OpenPost's session cookies only accept same-origin requests, so programmatic access uses Bearer API tokens (observed in the 040 egress proof on 2026-10-21). + +No evaluated product forwards Fediverse posts unattended. +OpenPost's built-in workflows refuse to schedule unless a human approves the exact revision in the same run, and its native imports never dispatch automation ([runtime.go](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/services/workflows/runtime.go)). +Postiz turns feeds into drafts without media, and Ferryman is a closed SaaS. +The crossposter therefore lives in the role as a sidecar that detects posts, applies routing, prevents duplicates and drives OpenPost through its API. + +### Upstream facts established by research + +| Topic | Finding | Source | +|---|---|---| +| Mastodon detection | `GET /api/v1/accounts/:id/statuses` accepts a `min_id` cursor plus `exclude_replies`, `exclude_reblogs`, `only_media` and `tagged`; cursor paging is limited to 300 requests per 15 minutes. | [Mastodon accounts API](https://docs.joinmastodon.org/methods/accounts/), [rack_attack.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/config/initializers/rack_attack.rb) | +| Mastodon loop signal | A status fetched with the owner's token exposes the `application` that posted it. | [status_serializer.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/serializers/rest/status_serializer.rb) | +| Mastodon push | Admin webhooks fire only for local posts, have no delete event and are dropped after 16 retries. | [webhook.rb](https://github.com/mastodon/mastodon/blob/main/app/models/webhook.rb) | +| Pixelfed detection | The Mastodon-compatible API requires a token even for public posts and ignores `exclude_reblogs`; the Atom feed is opt-in, photo-only, limited to 10 posts and cached for 4 hours. | [ApiV1Controller.php](https://github.com/pixelfed/pixelfed/blob/v0.15.1/app/Http/Controllers/Api/ApiV1Controller.php), [ProfileController.php](https://github.com/pixelfed/pixelfed/blob/v0.15.1/app/Http/Controllers/ProfileController.php) | +| PeerTube detection | Video lists paginate by offset only; sorting by `-publishedAt` and deduplicating on `uuid` works; no webhook or plugin hook fires when a video becomes published. | [PeerTube OpenAPI](https://github.com/Chocobozzz/PeerTube/blob/v8.3.1/support/doc/api/openapi.yaml) | +| PeerTube media | Default installs keep only HLS files; one MP4 comes from a combined HLS file or the `generate` endpoint; downloads are throttled to 2 MB/s per IP by default. | [default.yaml](https://github.com/Chocobozzz/PeerTube/blob/v8.3.1/config/default.yaml) | +| Idempotency | Mastodon and Pixelfed honour `Idempotency-Key` for one hour, PeerTube has none, and OpenPost answers a reused key with different input with HTTP 409. | [post_status_service.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/services/post_status_service.rb), [OpenPost API reliability](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/docs/content/docs/automate/api/reliability.mdx) | +| OpenPost publish API | `POST /api/v1/publications` takes the workspace, title, source text, target accounts or a social set, renditions, media, metadata and an optional `scheduled_at`; `publish-now`, `events` and media upload sessions complete the flow. | [openapi.json](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/web/openapi.json) | +| Length rules | Mastodon counts graphemes of content warning plus text with 23 per URL; X weights emoji and CJK characters double; Threads allows 500 characters; Instagram allows 2,200 characters and 30 hashtags. | [status_length_validator.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/validators/status_length_validator.rb), [X counting](https://docs.x.com/fundamentals/counting-characters) | +| Media rules | Pixelfed rejects text-only posts; Mastodon caps video at 99 MB; Instagram accepts JPEG only. | [ApiV1Controller.php](https://github.com/pixelfed/pixelfed/blob/v0.15.1/app/Http/Controllers/Api/ApiV1Controller.php), [media_attachment.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/models/media_attachment.rb), [040 platform constraints](040-web-app-openpost.md#platform-constraints) | +| Test tokens | Mastodon disables the password grant and `tootctl` mints no tokens; PeerTube offers a password grant; Pixelfed issues personal access tokens. | [doorkeeper.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/config/initializers/doorkeeper.rb), [tootctl](https://docs.joinmastodon.org/admin/tootctl/) | +| X cost | A post costs $0.015, a post containing a URL costs $0.20. | [X pricing](https://docs.x.com/x-api/getting-started/pricing) | + +### In-repo analogues + +- `web-app-openpost` from [040](040-web-app-openpost.md) provides the desk, the API, the provider simulator and the local Fediverse targets. +- [`web-app-bluesky`](../../roles/web-app-bluesky/) builds its sidecar from `files/login-broker/Dockerfile`. +- `roles/web-app-n8n/files/python/provision/` is tested from `tests/unit/python/roles/web-app-n8n/files/provision/`, the pattern for role-local Python tests. + +## Confirmed Decisions + +These decisions were confirmed by the operator before implementation starts and are NOT subject to re-litigation during implementation. + +| # | Decision | Reason | +|---|---|---| +| 1 | The crossposter is a Python sidecar entity `crossposter` in `web-app-openpost`, built from `files/crossposter/Dockerfile`. | Operator decision over n8n workflows and OpenPost's approval-gated workflows. | +| 2 | Every publication goes through the OpenPost API; the crossposter never calls a target platform directly. | One place for tokens, delivery state and provider adapters. | +| 3 | Detection uses authenticated REST polling with persisted cursors. | The only method that is complete on Mastodon, Pixelfed and PeerTube. | +| 4 | Crossposting state lives in a `crossposter` schema of the role's Postgres database, unique per source post and target account. | Durable duplicate prevention independent of platform idempotency windows. | +| 5 | Routes are declared in the inventory with a `review` mode (OpenPost draft) and an `auto` mode (immediate publishing). | Configurable routing with optional manual approval. | +| 6 | CI covers Mastodon, Pixelfed and PeerTube as sources against local instances, Fediverse targets end to end, and commercial targets through the 040 provider simulator. | Operator decision on automated testing. | + +## Proposed Defaults + +These defaults complete the confirmed design and MAY be adjusted by the operator before implementation starts. + +| # | Default | Reason | +|---|---|---| +| 1 | New routes start in `review` mode. | Routes are cleared for unattended publishing one by one. | +| 2 | Activating a route forwards no existing posts; its cursor starts at the newest item. | Prevents flooding targets with the account history. | +| 3 | The opt-out hashtag is `nocrosspost`. | Authors can keep a single post local. | +| 4 | The X attribution template omits the source link. | A post with a URL costs about 13 times more on X. | +| 5 | One active instance, enforced by a Postgres advisory lock. | Two pollers would race for the same cursors. | +| 6 | Dead-lettered items are reported by email through the platform mail service. | Failures reach the PR team without another dashboard. | + +## Target Schema + +### Files + +``` +roles/web-app-openpost/files/crossposter/ +├── Dockerfile +└── crossposter/ + ├── __init__.py + ├── __main__.py + ├── adapt.py + ├── config.py + ├── notify.py + ├── openpost.py + ├── retry.py + ├── store.py + └── sources/ + ├── __init__.py + ├── mastodon.py + ├── peertube.py + └── pixelfed.py +tests/unit/python/roles/web-app-openpost/files/crossposter/ +``` + +### Route shape (proposed) + +```yaml +crossposter: + enabled: false + poll_interval_seconds: 60 + opt_out_tag: nocrosspost + retry: + max_attempts: 8 + base_seconds: 30 + cap_seconds: 3600 + notify: + recipients: [] + routes: + - name: press-mastodon + source: + platform: mastodon + base_url: "https://microblog.{{ DOMAIN_PRIMARY }}" + account: press + token: "{{ vault_crosspost_press_mastodon_token }}" + filters: + visibility: [public] + exclude_replies: true + exclude_reblogs: true + tags: [] + media: any + targets: + social_set: Commercial + mode: review + attribution: + default: "{text}\n\n{source_url}" + x: "{text}" +``` + +## Acceptance Criteria + +### Packaging and lifecycle + +- [ ] The `crossposter` entity is built from `files/crossposter/Dockerfile` on a Python base image pinned in `meta/services.yml` and passed as an `ARG` without default, and it runs as a non-root user. +- [ ] Its container healthcheck works on the slim base image without extra binaries. +- [ ] The entity is enabled only when at least one route is configured, and the role deploys green with and without it in compose and swarm. +- [ ] A second crossposter instance neither polls nor publishes while the first holds the Postgres advisory lock. +- [ ] The crossposter authenticates to OpenPost with a Bearer API token that the deploy provisions non-interactively for the organisation workspace, and it reaches OpenPost directly on the role network, not through the egress relay. +- [ ] The crossposter's own requests to Mastodon, Pixelfed and PeerTube resolve the sibling vhosts the same way as the relay does, so detection works in compose, swarm and mesh deployments. + +### Configuration + +- [ ] Routes are read from `services.crossposter.routes`, and an invalid route (unknown platform, missing token, unknown target) fails the deploy with a message naming the route and the field. +- [ ] Source tokens come from the vault-encrypted inventory and reach the container as files, never as environment variables. + +### Detection + +- [ ] New public statuses of a configured Mastodon account are detected through `GET /api/v1/accounts/:id/statuses` with a persisted `min_id` cursor, excluding replies and boosts. +- [ ] New posts of a configured Pixelfed account are detected through its API with a token. +- [ ] New videos of a configured PeerTube channel are detected by sorting on `-publishedAt`, and only videos in the published state with public privacy are forwarded. +- [ ] At the configured interval, polling stays within each platform's documented rate limits. +- [ ] Activating a route on an account with existing posts forwards none of them. +- [ ] Posts created while the crossposter was stopped are forwarded exactly once after it restarts. + +### Routing and approval + +- [ ] Each route maps one source account to OpenPost target accounts or a social set and filters by visibility, hashtag and media. +- [ ] A post carrying the opt-out hashtag is never forwarded. +- [ ] In `review` mode the crossposter creates an unscheduled OpenPost draft that an editor can adjust and schedule in the desk, and in `auto` mode it publishes immediately. +- [ ] A post with a content warning, or with mentions that cannot be mapped to a target network, becomes a draft even on an `auto` route. + +### Duplicate and loop prevention + +- [ ] The `crossposter` schema holds one row per source post URI and target account under a unique constraint, and every OpenPost request carries an `Idempotency-Key` derived from that pair. +- [ ] Replaying source items through a restart, a cursor reset or overlapping polls creates no second publication, verified against OpenPost and the target instances. +- [ ] A status that OpenPost itself published to Mastodon is never forwarded again, so one Mastodon account can be source and target without loops. + +### Adaptation and attribution + +- [ ] Text is shortened to each target's limit with that network's counting rules without breaking words, links or hashtags. +- [ ] Fediverse mentions are rewritten to plain names or profile links for commercial targets. +- [ ] Alt text travels with images to every target that supports it. +- [ ] Images for Instagram are converted to JPEG, Pixelfed targets receive only posts with media, PeerTube videos reach YouTube as one MP4 fetched over the internal network, and PeerTube videos above 99 MB reach Mastodon targets as links. +- [ ] Each route renders an attribution template per target network with the source post URL, and the default X template omits the link. + +### Retries and error reporting + +- [ ] Transient failures (network errors, HTTP 429 and 5xx) from sources and from OpenPost are retried with capped exponential backoff and jitter that honours `Retry-After` and rate-limit reset headers. +- [ ] After the configured maximum attempts, an item enters a dead-letter state and an email naming the source post, the target and the last error reaches the configured recipients through `lookup('email', application_id)`. +- [ ] Delivery failures that OpenPost reports for a crossposted publication are stored in the mapping row and included in the notification. +- [ ] A documented command inside the container lists every crossposted item with its state (pending, drafted, published, failed, dead-lettered). + +### Tests + +- [ ] Unit tests under `tests/unit/python/roles/web-app-openpost/files/crossposter/` cover length counting, adaptation, routing filters, the idempotency key, backoff timing and the state machine with fixtures recorded from Mastodon, Pixelfed and PeerTube responses. +- [ ] The CLI test posts as a test user on the local Mastodon, Pixelfed and PeerTube instances and asserts within a bounded time exactly one OpenPost publication per route, one delivered post on the local Fediverse target, and the expected simulator requests for X, Facebook, Instagram and YouTube. +- [ ] The CLI test asserts review mode (draft without delivery), the opt-out hashtag, loop prevention, restart without duplicates, and no forwarding of existing posts on route activation. +- [ ] The CLI test lets the simulator answer 503 before succeeding and asserts one delivery, then forces a permanent failure and asserts the dead-letter state and the notification in the test mailbox. +- [ ] The Playwright spec shows the administrator persona finding a crossposted draft in the desk, editing it and scheduling it. +- [ ] `make test` and `make roundtrip apps="web-app-openpost"` are green. + +### Documentation + +- [ ] `Administration.md` documents the route schema with examples, the review and auto modes, the opt-out hashtag, the attribution templates and their X cost impact, token creation per source platform, and the handling of dead-lettered items. +- [ ] `README.md` lists automated crossposting under Features and shows the crossposter in the Cosmos diagram. +- [ ] This requirement is cross-linked from the implementing pull request and from the OpenProject work item. + +## Out of Scope + +- Propagating edits and deletions from source posts to targets. +- Push-based detection through Mastodon webhooks, streaming or an ActivityPub follower actor. +- Bluesky as a crossposting target, because federation through `web-app-bridgy-fed` already reaches it. +- TikTok publishing, because TikTok's terms exclude in-house upload tools. + +## Validation Apps + +```bash +INFINITO_PLAYWRIGHT_KEEP=true make compose-deploy mode=reinstall apps=web-app-openpost full_cycle=true +make roundtrip apps="web-app-openpost" +``` + +Smoke: post as a test user on the local Mastodon instance, find the draft in the OpenPost desk, schedule it, and see it on the local Fediverse target and in the simulator journal. + +## Prerequisites + +Every Acceptance Criterion of [040](040-web-app-openpost.md) MUST be checked off before this requirement starts. +The agent MUST read [AGENTS.md](../../AGENTS.md), then [Compose Loop](../agents/action/iteration/compose.md), [Unit Tests](../contributing/actions/testing/unit.md) and the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md). + +## Implementation Strategy + +Execute autonomously and write the failing unit tests for the state machine, the idempotency key and the backoff before the code. +Verify against the running OpenPost before claiming a criterion: how an unscheduled publication appears as a draft, how media upload sessions attach files, how long OpenPost keeps idempotency keys, and how a workspace API token is created without a browser. +Verify on the deployed Mastodon, Pixelfed and PeerTube versions that the behaviour cited above from newer upstream releases still holds. + +## Commit Policy + +- No git commit until every Acceptance Criterion is checked off. +- When met and `make test` is green, instruct the operator to run `git-sign-push` outside the sandbox. The agent MUST NOT push. + +## See Also + +- Publishing desk: [040-web-app-openpost.md](040-web-app-openpost.md) +- Requirement format: [requirements.md](../contributing/requirements.md) +- How agents process requirements: [requirements.md](../agents/action/requirements.md) From 350e48211399246d6d47014b34adea539fc96dff Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:55 +0200 Subject: [PATCH 003/554] feat(networks): render caller aliases on the default network --- utils/networks/render.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/networks/render.py b/utils/networks/render.py index 10fc049197..93dc6f70d1 100644 --- a/utils/networks/render.py +++ b/utils/networks/render.py @@ -205,12 +205,14 @@ def render_container_networks( provider_self_alias: bool = True, node_local: bool = False, own_network_only: bool = False, + aliases: list[str] | None = None, ) -> str: if node_local: deployment_mode = "compose" attachments, default_aliases = _compute_attachments( registry, application_id, deployment_mode, lookup_config, lookup_database ) + default_aliases = list(dict.fromkeys([*default_aliases, *(aliases or [])])) lines: list[str] = ["networks:"] for att in attachments: if att["is_provider"] and att["topology"] == "default_net": From 7156c9882f1b5c626d372e1c16529e9206533cde Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 004/554] test(networks): cover caller aliases on the default network --- .../test_render_container_networks.py | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/unit/python/utils/networks/test_render_container_networks.py b/tests/unit/python/utils/networks/test_render_container_networks.py index e2f729b1f8..ef1858f7a6 100644 --- a/tests/unit/python/utils/networks/test_render_container_networks.py +++ b/tests/unit/python/utils/networks/test_render_container_networks.py @@ -169,6 +169,55 @@ class TestRenderContainerNetworks(unittest.TestCase): ) self.assertEqual(rendered, "\nnetworks:\n default:") + def test_caller_aliases_land_on_the_default_network(self): + rendered = render_container_networks( + application_id="web-app-plain", + deployment_mode="compose", + registry={}, + get_entity_name=_entity_name, + lookup_config=_const_lookup_config(), + lookup_database=_const_lookup_database(), + aliases=["microblog.example.com", "video.example.com"], + ) + self.assertEqual( + rendered, + "\nnetworks:\n default:\n aliases:\n" + " - microblog.example.com\n - video.example.com", + ) + + def test_caller_aliases_follow_beacon_aliases_without_duplicates(self): + registry = { + "openresty": { + "role": "svc-prx-openresty", + "entity_name": "openresty", + "overlay": {"modes": ["swarm"], "topology": "default_net"}, + }, + "sso": { + "role": "web-app-keycloak", + "entity_name": "keycloak", + "provides": "sso", + "overlay": { + "modes": ["swarm"], + "proxy_resolvable": True, + "aliases": ["auth.example.com"], + }, + }, + } + rendered = render_container_networks( + application_id="svc-prx-openresty", + deployment_mode="swarm", + registry=registry, + get_entity_name=_entity_name, + lookup_config=_const_lookup_config(), + lookup_database=_const_lookup_database(), + aliases=["auth.example.com", "extra.example.com"], + ) + self.assertEqual(rendered.count("- auth.example.com"), 1) + self.assertLess( + rendered.index("- auth.example.com"), + rendered.index("- extra.example.com"), + ) + class TestRenderEncryption(unittest.TestCase): def test_swarm_encrypted_false_emits_lowercase_quoted_literal(self): From 3299a6e9de49a1db0d3bf0bab3df6aca145dea0b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 005/554] feat(lookup): accept aliases in container_networks --- plugins/lookup/container_networks.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/container_networks.py b/plugins/lookup/container_networks.py index 5bed7737cb..b40beda818 100644 --- a/plugins/lookup/container_networks.py +++ b/plugins/lookup/container_networks.py @@ -7,8 +7,9 @@ Usage in any service template: {{ lookup('container_networks') | indent(4) }} Pass ``provider_self_alias=False`` for a sidecar service that must not carry the -provider's own alias, and ``own_network_only=True`` for one that must not -inherit the networks its provider joins as a consumer. +provider's own alias, ``own_network_only=True`` for one that must not +inherit the networks its provider joins as a consumer, and ``aliases=[...]`` +for names this one service answers to on the role's default network. """ from __future__ import annotations @@ -41,6 +42,15 @@ class LookupModule(LookupBase): "container_networks lookup: application_id is required in variables" ) + aliases = kwargs.get("aliases") + if aliases is not None and ( + not isinstance(aliases, list) + or not all(isinstance(alias, str) and alias for alias in aliases) + ): + raise AnsibleError( + "container_networks lookup: aliases must be a list of non-empty strings" + ) + return [ render_container_networks( application_id=str(application_id), @@ -52,5 +62,6 @@ class LookupModule(LookupBase): provider_self_alias=bool(kwargs.get("provider_self_alias", True)), node_local=bool(kwargs.get("node_local", False)), own_network_only=bool(kwargs.get("own_network_only", False)), + aliases=aliases, ) ] From 0004f259269034766a2d4e4e37c6a0e7804f6a37 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 006/554] test(lookup): cover container_networks aliases --- .../plugins/lookup/test_container_networks.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/unit/python/plugins/lookup/test_container_networks.py b/tests/unit/python/plugins/lookup/test_container_networks.py index d407191de1..5a2930ea2c 100644 --- a/tests/unit/python/plugins/lookup/test_container_networks.py +++ b/tests/unit/python/plugins/lookup/test_container_networks.py @@ -69,6 +69,41 @@ class TestContainerNetworksLookup(unittest.TestCase): self.assertEqual(kwargs["application_id"], "web-app-baserow") self.assertEqual(kwargs["deployment_mode"], "compose") + def test_forwards_caller_aliases(self): + vars_ = {"application_id": "web-app-x", "DEPLOYMENT_MODE": "compose"} + lm = _make_lookup(vars_) + + with ( + mock.patch( + "utils.networks.lookup_context.build_service_registry_from_applications", + return_value={}, + ), + mock.patch("utils.networks.lookup_context.lookup_loader") as loader_mock, + mock.patch( + "plugins.lookup.container_networks.render_container_networks", + return_value="RENDERED", + ) as render_mock, + ): + loader_mock.get.return_value = mock.MagicMock(run=lambda *_a, **_k: [{}]) + lm.run([], variables=vars_, aliases=["a.example.com"]) + + self.assertEqual(render_mock.call_args.kwargs["aliases"], ["a.example.com"]) + + def test_rejects_aliases_that_are_not_a_list_of_strings(self): + vars_ = {"application_id": "web-app-x", "DEPLOYMENT_MODE": "compose"} + lm = _make_lookup(vars_) + + with ( + mock.patch( + "utils.networks.lookup_context.build_service_registry_from_applications", + return_value={}, + ), + mock.patch("utils.networks.lookup_context.lookup_loader") as loader_mock, + ): + loader_mock.get.return_value = mock.MagicMock(run=lambda *_a, **_k: [{}]) + with self.assertRaises(AnsibleError): + lm.run([], variables=vars_, aliases="a.example.com") + def test_falls_back_to_compose_when_deployment_mode_unset(self): vars_ = {"application_id": "web-app-x"} lm = _make_lookup(vars_) From 12b5bd43ec5952812a6564c14d219185bbaa0e53 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 007/554] feat(networks): allow the OpenPost relay subnet outside the role pool --- group_vars/all/08_networks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/group_vars/all/08_networks.yml b/group_vars/all/08_networks.yml index 8dcadeb7f0..79e669a786 100644 --- a/group_vars/all/08_networks.yml +++ b/group_vars/all/08_networks.yml @@ -16,6 +16,7 @@ NETWORK_INTERNAL_CIDRS: "{{ [NETWORK_LOOPBACK_CIDR] + (NETWORK_PRIVATE_CIDRS.val NETWORK_ROLE_SUBNET_POOL: "{{ NETWORK_PRIVATE_CIDRS.class_c }}" NETWORK_ROLE_SUBNET_EXCEPTION_ROLES: - web-app-bigbluebutton + - web-app-openpost NETWORK_SWARM_GWBRIDGE_POOL: "{{ NETWORK_PRIVATE_CIDRS.class_b }}" NETWORK_TRUSTED_PROXY_CIDRS: "{{ ['127.0.0.1', '::1'] + (NETWORK_PRIVATE_CIDRS.values() | list) }}" NETWORK_DOCKER_ADDRESS_POOLS: From 34f660be716715e4ff274696377b246de08af481 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 008/554] feat(api): add social network app credentials --- group_vars/all/18_api.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/group_vars/all/18_api.yml b/group_vars/all/18_api.yml index 5dd167098a..4df39317ea 100644 --- a/group_vars/all/18_api.yml +++ b/group_vars/all/18_api.yml @@ -26,3 +26,21 @@ API: jira: client_id: "" client_secret: "" + x: + client_id: "" + client_secret: "" + meta: + client_id: "" + client_secret: "" + threads: + client_id: "" + client_secret: "" + linkedin: + client_id: "" + client_secret: "" + youtube: + client_id: "" + client_secret: "" + tiktok: + client_id: "" + client_secret: "" From 72315e1b9ae4305bb4410e05482ea74439156b31 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 009/554] docs(requirements): file OpenPost in the MCP audit --- docs/requirements/035-mcp-proxy-expansion.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/requirements/035-mcp-proxy-expansion.md b/docs/requirements/035-mcp-proxy-expansion.md index c2c33155f0..46296d52b9 100644 --- a/docs/requirements/035-mcp-proxy-expansion.md +++ b/docs/requirements/035-mcp-proxy-expansion.md @@ -444,11 +444,11 @@ The section titles below are the classification vocabulary itself, and each role `svc-db-qdrant`, `web-app-baserow`, `web-app-checkmk`, `web-app-fider`, `web-app-gitea`, `web-app-gitlab`, `web-app-jellyfin`, `web-app-jenkins`, `web-app-listmonk`, `web-app-mattermost`, `web-app-nextcloud`, `web-app-pretix`, `web-app-prometheus`, `web-app-snipe-it`, `web-app-zammad`, `web-svc-libretranslate`. -### blocked (11) +### blocked (12) An upstream path exists or is claimed, and something concrete stops it here. Each row names what, using the reason vocabulary above, so "blocked" never reads as "nobody looked". -`svc-ai-litellm`, `svc-ai-lmstudio`, `svc-db-elasticsearch`, `svc-db-mariadb`, `svc-db-redis`, `web-app-discourse`, `web-app-erpnext`, `web-app-matomo`, `web-app-odoo`, `web-app-penpot`, `web-app-shopware`. +`svc-ai-litellm`, `svc-ai-lmstudio`, `svc-db-elasticsearch`, `svc-db-mariadb`, `svc-db-redis`, `web-app-discourse`, `web-app-erpnext`, `web-app-matomo`, `web-app-odoo`, `web-app-openpost`, `web-app-penpot`, `web-app-shopware`. | role | reason | blocker | | --- | --- | --- | @@ -461,6 +461,7 @@ An upstream path exists or is claimed, and something concrete stops it here. Eac | `web-app-erpnext` | `version_unverified` | The Frappe MCP component is experimental and unverified against the pinned Frappe v16. | | `web-app-matomo` | `unreviewed_third_party` | The project-owned plugin is unaudited: endpoint, transport, auth and tool scope are unverified in source. | | `web-app-odoo` | `unreviewed_third_party` | Neither Odoo SA nor the OCA publishes a server; the leading third party carries 197 of 231 commits from one author, keeps its access control in a separate Odoo Apps store module outside any pinnable tag, and defaults to a mutating tool scope. | +| `web-app-openpost` | `version_unverified` | The pinned v7.22.9 serves a native `/mcp` endpoint, but its tool list, client registration and publishing side effects on external networks are not audited against that release. | | `web-app-penpot` | `interactive_browser_session` | The server needs an active browser tab and plugin connection, and can execute powerful design-context operations. | | `web-app-shopware` | `version_unverified` | The pinned 6.7.8.2 predates the experimental native `/api/_mcp` server. | From 14864e10f0172c028a64d140f6c09179915caf86 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 010/554] docs(requirements): align 040 with the verified OpenPost design --- docs/requirements/040-web-app-openpost.md | 47 ++++++++++++++--------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/docs/requirements/040-web-app-openpost.md b/docs/requirements/040-web-app-openpost.md index b6756841d8..ecb904bc46 100644 --- a/docs/requirements/040-web-app-openpost.md +++ b/docs/requirements/040-web-app-openpost.md @@ -85,7 +85,7 @@ Sources: - [`web-app-nextcloud`](../../roles/web-app-nextcloud/), [`web-app-mastodon`](../../roles/web-app-mastodon/), [`web-app-fider`](../../roles/web-app-fider/), [`web-app-penpot`](../../roles/web-app-penpot/) and [`web-app-discourse`](../../roles/web-app-discourse/) relax their own SSRF guards through native switches; OpenPost has none for built-in providers, which is why the relay exists. - [container_extra_hosts.py](../../plugins/lookup/container_extra_hosts.py) already resolves the address that reaches the shared proxy per deploy mode for the SSO back-channel pin; the relay forwards to the same address. -- [`svc-net-wireguard`](../../roles/svc-net-wireguard/) carries swarm overlay traffic inside its `swarm` mesh, so an overlay egress network is tunnelled without extra configuration. +- [`svc-net-wireguard`](../../roles/svc-net-wireguard/) carries swarm overlay traffic inside its `swarm` mesh, so the role's overlay network is tunnelled without extra configuration. - [`web-app-semaphore`](../../roles/web-app-semaphore/) consumes Keycloak through `sso.flavor: oidc`. - [`web-app-mastodon`](../../roles/web-app-mastodon/), [`web-app-pixelfed`](../../roles/web-app-pixelfed/) and [`web-app-peertube`](../../roles/web-app-peertube/) provide the local Fediverse accounts used as publishing targets in tests. - [`web-app-seaweedfs`](../../roles/web-app-seaweedfs/) provides S3 object storage through the `seaweedfs` service with `public: true`, as in `web-app-mastodon`. @@ -100,13 +100,13 @@ These decisions were confirmed by the operator before implementation starts and | 1 | OpenPost is the publishing desk. | Only candidate covering every required source and target network. | | 2 | Role id `web-app-openpost`, canonical domain `publish.{{ DOMAIN_PRIMARY }}`. | `social.{{ DOMAIN_PRIMARY }}` belongs to `web-app-friendica`. | | 3 | The role runs the official `ghcr.io/getopenpost/openpost` image unmodified, pinned to a release tag and configured through environment variables only. | The application is integrated like every other role; the project does not maintain OpenPost. | -| 4 | OpenPost reaches the deployment's own sibling vhosts only through an always-on, role-local egress relay on a network in `NETWORK_EGRESS_RELAY_CIDR`, with exact aliases and an SNI allowlist, forwarding to the shared proxy. | One proven path for development, CI and production, including split-horizon DNS and WireGuard meshes, with the guard intact for every other destination. | +| 4 | OpenPost reaches the deployment's own sibling vhosts only through an always-on, role-local egress relay on the role network `192.88.99.0/24` (declared in `meta/networks.yml`, listed in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES`), with exact aliases and an SNI allowlist, forwarding to the shared proxy. | One proven path for development, CI and production, including split-horizon DNS and WireGuard meshes, with the guard intact for every other destination; the existing role-subnet exception mechanism already carries out-of-pool blocks, so no new SPOT is needed. | | 5 | Keycloak SSO through native OIDC (`sso.flavor: oidc`); publishing permissions are enforced through OpenPost workspace roles. | OpenPost ships an OIDC adapter and does not consume group claims. | | 6 | Shared `svc-db-postgres`; media on `web-app-seaweedfs` S3 when deployed, a role volume otherwise. | Postgres is the only multi-process database; S3 gives public media URLs for Meta. | | 7 | One `all` process with one replica in compose and swarm. | State lives in Postgres and S3, so rescheduling is safe; split `web`/`worker` scaling is out of scope. | | 8 | Provider app credentials live in the central `API` SPOT. | One place for proprietary credentials. | | 9 | Diagnostics, update check, PostHog telemetry, feedback and public profiles are disabled. | No unnecessary transmission of internal data. | -| 10 | CI tests Fediverse publishing end to end against local instances through the relay, and the commercial adapters against a role-local provider simulator on the same egress network; real platforms are checked manually in staging. | Real OAuth logins, public redirect hosts and per-post billing make real platforms unusable in CI. | +| 10 | CI tests Fediverse publishing end to end against local instances through the relay, and the commercial adapters against a role-local provider simulator on the same role network; real platforms are checked manually in staging. | Real OAuth logins, public redirect hosts and per-post billing make real platforms unusable in CI. | | 11 | Automated crossposting is a separate sidecar specified in [041](041-openpost-crossposter.md). | Separable deliverable and pull request. | ## Target Schema @@ -119,10 +119,12 @@ roles/web-app-openpost/ ├── README.md ├── files/ │ ├── playwright/ +│ │ ├── _shared.js │ │ ├── playwright.spec.js │ │ └── test-*.js │ ├── simulator/ │ └── test/ +│ ├── probe.py │ └── test.sh ├── meta/ │ ├── csp.yml @@ -130,11 +132,17 @@ roles/web-app-openpost/ │ ├── info.yml │ ├── main.yml │ ├── networks.yml +│ ├── rbac.yml │ ├── secrets.yml │ ├── services.yml +│ ├── tests.yml +│ ├── users.yml │ ├── variants.yml │ └── volumes.yml ├── tasks/ +│ ├── 00_core.yml +│ ├── 01_fediverse_apps.yml +│ ├── 02_breakglass.yml │ └── main.yml ├── templates/ │ ├── compose.yml.j2 @@ -160,15 +168,15 @@ openpost: internal: http: 8080 local: - http: + http: 8098 lifecycle: alpha relay: image: nginx - version: "" + version: 1.31.7-alpine simulator: enabled: false image: wiremock/wiremock - version: "" + version: "3.13.2" ``` ## Acceptance Criteria @@ -184,17 +192,17 @@ simulator: - [ ] The role runs `ghcr.io/getopenpost/openpost` pinned to a release tag in `meta/services.yml` and ships no role-local Dockerfile or source modification. - [ ] The external update tooling proposes new upstream release tags through `update.type: registry_tags`. -- [ ] Every OpenPost setting is rendered through `templates/env.j2` or `_FILE` secrets, and `OPENPOST_APP_URL` and `OPENPOST_PUBLIC_URL` carry `https://publish.{{ DOMAIN_PRIMARY }}`. +- [ ] Every OpenPost setting is rendered through `templates/env.j2`, and `OPENPOST_APP_URL` and `OPENPOST_PUBLIC_URL` carry `https://publish.{{ DOMAIN_PRIMARY }}`. ### Egress relay (story AC2, AC4, AC7) -- [ ] `group_vars/all/08_networks.yml` declares `NETWORK_EGRESS_RELAY_CIDR`, a subnet outside every range OpenPost's guard blocks and outside every Docker, mesh, Tor and role subnet pool, and the role's egress network uses it as a bridge in compose and as an overlay in swarm. -- [ ] A `relay` entity running a pinned `nginx` image carries network aliases only for the canonical domains of the deployed sibling roles OpenPost publishes to (`web-app-mastodon`, `web-app-pixelfed`, `web-app-peertube`), each gated by that role's dynamic service flag. -- [ ] The relay forwards TLS unmodified by SNI to the address that reaches the shared proxy in the effective deploy mode, resolved like the `container_extra_hosts` back-channel pin, and never resolves its own aliases. +- [ ] `roles/web-app-openpost/meta/networks.yml` declares the role subnet `192.88.99.0/24`, a block outside every range OpenPost's guard rejects and outside every Docker, mesh, Tor and role subnet pool, and `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` in `group_vars/all/08_networks.yml` names the role; the network is a bridge in compose and an overlay in swarm. +- [ ] A `relay` entity running a pinned `nginx` image carries network aliases, passed through the `aliases` argument of the shared `container_networks` lookup, only for the canonical domains of the deployed sibling roles OpenPost publishes to (`web-app-mastodon`, `web-app-pixelfed`, `web-app-peertube`), each gated by that role's dynamic service flag. +- [ ] The relay forwards TLS unmodified by SNI to `host.docker.internal`, which `container_extra_hosts` resolves to the address that reaches the shared proxy in the effective deploy mode, and never resolves its own aliases. - [ ] The relay refuses every SNI that is not in its map. - [ ] When `TLS_MODE` is self-signed, OpenPost trusts the platform CA so that relayed vhosts verify; with public certificates no extra trust is configured. -- [ ] The CLI test proves that OpenPost reaches an aliased sibling vhost, that it still rejects a non-aliased private host and a private IP literal, and that the relay refuses an aliased name missing from its map. -- [ ] Publishing to a local Mastodon account succeeds in swarm through the overlay egress network, verified by `make roundtrip apps="web-app-openpost"`. +- [ ] The CLI test proves that OpenPost reaches an aliased sibling vhost, that it still rejects a private container name and a private IP literal, and that the relay refuses a TLS connection whose SNI is not in its map. +- [ ] Publishing to a local Mastodon account succeeds in swarm through the role's overlay network, verified by `make roundtrip apps="web-app-openpost"`. - [ ] `Administration.md` explains the guard, the relay, and how a deployment with sibling vhosts on another host or behind split-horizon DNS is covered. ### Deployment and operations (story AC2) @@ -211,19 +219,21 @@ simulator: ### Secrets and provider credentials (story AC2, AC7) -- [ ] The JWT secret, encryption key, media signing key and OIDC client secret are generated through `meta/secrets.yml` and reach OpenPost through `_FILE` variants. +- [ ] The JWT secret, encryption key and media signing key are generated through `meta/secrets.yml`, the OIDC client secret comes from `OIDC.CLIENT.SECRET`, and all of them reach OpenPost through the role's env file like every other role's secrets. +- [ ] The break-glass instance admin `web-app-openpost-breakglass` is declared in `meta/users.yml` with a generated password, is bootstrapped as the first account on a fresh instance, and its e-mail differs from every Keycloak user so just-in-time provisioning never collides with it. - [ ] `group_vars/all/18_api.yml` gains the entries `x`, `meta`, `threads`, `linkedin`, `youtube` and `tiktok`, and the role renders them into `X_CLIENT_*`, `THREADS_CLIENT_*`, `LINKEDIN_CLIENT_*` and `OPENPOST_PROVIDER_APPS`. - [ ] A provider whose `lookup('api_enabled', ...)` is false cannot be connected in the UI. - [ ] Connected provider tokens are stored encrypted, verified by reading the token column from Postgres and finding no plaintext token. -- [ ] The X monthly budget (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) is configurable through the inventory and documented. +- [ ] `Administration.md` documents that OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition, so a self-hosted deployment caps X spending through the prepaid credits of the X developer account. ### Single sign-on (story AC3) - [ ] `meta/services.yml` declares `sso.flavor: oidc`, and OpenPost reads its issuer from `OIDC.CLIENT.ISSUER_URL`, its client from `OIDC.CLIENT.ID` and `OIDC.CLIENT.SECRET`, and uses the scopes `openid profile email`. -- [ ] Password self-registration is disabled, and SSO users are provisioned just in time on their first login. +- [ ] Password self-registration is closed and SSO users are provisioned just in time on their first login; because OpenPost gates both with `OPENPOST_DISABLE_REGISTRATIONS`, the role keeps the switch open when Keycloak is deployed and the shared proxy answers `POST /api/v1/auth/register` with HTTP 403. - [ ] The platform administrator becomes instance administrator through `OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST` on first SSO login. - [ ] A just-in-time provisioned user without a workspace invitation cannot see or use the organisation workspace or its connected accounts. - [ ] `Administration.md` documents the break-glass procedure (`OPENPOST_SSO_BREAK_GLASS_EMAILS`), linking an existing account to its SSO identity, and the trusted-proxy fallback through oauth2-proxy. +- [ ] `README.md` documents that OpenPost ships no LDAP adapter, so the role declares no `ldap` service and directory accounts sign in through Keycloak's OpenLDAP federation over OIDC. ### Telemetry and data minimisation (story AC7) @@ -231,6 +241,7 @@ simulator: ### Fediverse publishing (story AC4) +- [ ] The deploy registers an `OpenPost` app once on each deployed sibling Mastodon and Pixelfed instance, persists it, and pins it through `MASTODON_SERVERS` and `PIXELFED_SERVERS` named by the canonical URL, because the dynamic registration path of v7.22.9 fails its own readiness check on code exchange. - [ ] An administrator connects a local Mastodon account through the out-of-band code flow and publishes a text post that appears on the Mastodon instance. - [ ] An administrator connects a local Pixelfed account and publishes an image post that appears on the Pixelfed instance. - [ ] An administrator connects a local PeerTube account and publishes a video that appears on the PeerTube instance. @@ -238,7 +249,7 @@ simulator: ### Provider simulator (story AC4, AC8) - [ ] A `simulator` entity running the pinned `wiremock/wiremock` image is enabled by one `meta/variants.yml` variant only and is absent from the base configuration. -- [ ] Inside that variant, the simulator joins the egress network with aliases for the API hostnames OpenPost uses for X, Facebook, Instagram and YouTube, presents a certificate for those names signed by a per-deploy test CA, and OpenPost trusts that CA. +- [ ] Inside that variant, the simulator joins the role network with aliases for the API hostnames OpenPost uses for X, Facebook, Instagram and YouTube, presents a certificate for those names signed by a per-deploy test CA, and OpenPost trusts that CA. - [ ] An X, Facebook Page, Instagram and YouTube account each connect through OpenPost's real callback against the simulator without a real provider login. - [ ] Publishing to those accounts produces the documented request sequence, asserted from the simulator's request journal: one X post within 280 weighted characters, one Facebook Page post, an Instagram media container followed by a publish call with a public JPEG URL, and a resumable YouTube upload. - [ ] Simulated 429 responses with a reset header and 503 responses lead to retries and exactly one successful delivery. @@ -253,7 +264,7 @@ simulator: ### Variants, tests and quality (story AC8) -- [ ] `meta/variants.yml` defines a full variant with every integration and the simulator, separate variants that add the local Mastodon, Pixelfed and PeerTube targets so no single CI runner deploys all three instances, and an all-off variant; every variant deploys cleanly on a fresh host. +- [ ] `meta/variants.yml` stays within the three-variant limit: variant 0 enables every integration, the simulator and the local Mastodon target, variant 1 adds the local Pixelfed and PeerTube targets with the integrations off, and variant 2 switches everything off, so no single round deploys all three instances; every variant deploys cleanly on a fresh host. - [ ] `files/playwright/` covers the `guest`, `biber` and `administrator` personas per the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md), with the administrator connecting a Fediverse account and publishing, and `biber` being denied the organisation workspace. - [ ] `files/test/test.sh` with `templates/test.env.j2` covers readiness, the telemetry flags, the egress relay and its negative controls, token encryption at rest, Fediverse delivery and the simulator journal assertions. - [ ] `make compose-playwright role=web-app-openpost` exits 0 without stub tests and ends logged out. @@ -280,7 +291,7 @@ Before implementation, the agent MUST read [AGENTS.md](../../AGENTS.md), then [C ## Implementation Strategy -Execute autonomously and start from the proven egress topology: an egress network in `NETWORK_EGRESS_RELAY_CIDR`, an nginx `stream` relay with `ssl_preread` and an SNI map, and OpenPost attached to that network. +Execute autonomously and start from the proven egress topology: the role network on `192.88.99.0/24`, an nginx `stream` relay with `ssl_preread` and an SNI map, and OpenPost attached to that network. Verify against the pinned upstream image before claiming a criterion: the provider hostnames and OAuth endpoints the simulator must answer, how OpenPost validates the OAuth `state` on its callback, and the account-linking flow. Prove every relay and simulator change in the live stack via `make compose-exec` and `make compose-inner-run` before redeploying. From 59aa362fa4a89370975a8a571eeca319d4e0c827 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 011/554] docs(requirements): confirm 041 crossposter defaults --- docs/requirements/041-openpost-crossposter.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/requirements/041-openpost-crossposter.md b/docs/requirements/041-openpost-crossposter.md index cb46113ecb..ea04d0be69 100644 --- a/docs/requirements/041-openpost-crossposter.md +++ b/docs/requirements/041-openpost-crossposter.md @@ -50,19 +50,12 @@ These decisions were confirmed by the operator before implementation starts and | 4 | Crossposting state lives in a `crossposter` schema of the role's Postgres database, unique per source post and target account. | Durable duplicate prevention independent of platform idempotency windows. | | 5 | Routes are declared in the inventory with a `review` mode (OpenPost draft) and an `auto` mode (immediate publishing). | Configurable routing with optional manual approval. | | 6 | CI covers Mastodon, Pixelfed and PeerTube as sources against local instances, Fediverse targets end to end, and commercial targets through the 040 provider simulator. | Operator decision on automated testing. | - -## Proposed Defaults - -These defaults complete the confirmed design and MAY be adjusted by the operator before implementation starts. - -| # | Default | Reason | -|---|---|---| -| 1 | New routes start in `review` mode. | Routes are cleared for unattended publishing one by one. | -| 2 | Activating a route forwards no existing posts; its cursor starts at the newest item. | Prevents flooding targets with the account history. | -| 3 | The opt-out hashtag is `nocrosspost`. | Authors can keep a single post local. | -| 4 | The X attribution template omits the source link. | A post with a URL costs about 13 times more on X. | -| 5 | One active instance, enforced by a Postgres advisory lock. | Two pollers would race for the same cursors. | -| 6 | Dead-lettered items are reported by email through the platform mail service. | Failures reach the PR team without another dashboard. | +| 7 | New routes start in `review` mode. | Routes are cleared for unattended publishing one by one. | +| 8 | Activating a route forwards no existing posts; its cursor starts at the newest item. | Prevents flooding targets with the account history. | +| 9 | The opt-out hashtag is `nocrosspost`. | Authors can keep a single post local. | +| 10 | The X attribution template omits the source link. | A post with a URL costs about 13 times more on X. | +| 11 | One active instance, enforced by a Postgres advisory lock. | Two pollers would race for the same cursors. | +| 12 | Dead-lettered items are reported by email through the platform mail service. | Failures reach the PR team without another dashboard. | ## Target Schema From 1cff3010871fc7bab12082c9de9fcbe3460e1fb4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:56 +0200 Subject: [PATCH 012/554] feat(web-app-openpost): add role metadata --- roles/web-app-openpost/meta/main.yml | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 roles/web-app-openpost/meta/main.yml diff --git a/roles/web-app-openpost/meta/main.yml b/roles/web-app-openpost/meta/main.yml new file mode 100644 index 0000000000..63b3039617 --- /dev/null +++ b/roles/web-app-openpost/meta/main.yml @@ -0,0 +1,34 @@ +--- +galaxy_info: + author: Evangelos Tsakoudis + description: Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks + license: Infinito.Nexus Community License (Non-Commercial) + company: | + Kevin Veen-Birkenbach + https://www.veen.world + galaxy_tags: + - openpost + - social-media + - publishing + - fediverse + - docker + - compose + - sso + issue_tracker_url: https://s.infinito.nexus/issues + min_ansible_version: "2.9" + platforms: + - name: ArchLinux + versions: + - all + - name: Debian + versions: + - all + - name: EL + versions: + - all + - name: Fedora + versions: + - all + - name: Ubuntu + versions: + - all From 5da13d519da61d183eb855b86d5a6b49bb3a91cc Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 013/554] feat(web-app-openpost): add dashboard info --- roles/web-app-openpost/meta/info.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 roles/web-app-openpost/meta/info.yml diff --git a/roles/web-app-openpost/meta/info.yml b/roles/web-app-openpost/meta/info.yml new file mode 100644 index 0000000000..f1e380f10d --- /dev/null +++ b/roles/web-app-openpost/meta/info.yml @@ -0,0 +1,5 @@ +--- +logo: + class: fa-solid fa-paper-plane +homepage: https://openpo.st/ +video: https://www.youtube.com/watch?v=_mZf3HzQaN8 From 1cca41d669bb765b2fd55aae4568422f842f8375 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 014/554] feat(web-app-openpost): serve publish subdomain --- roles/web-app-openpost/meta/domains.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/meta/domains.yml diff --git a/roles/web-app-openpost/meta/domains.yml b/roles/web-app-openpost/meta/domains.yml new file mode 100644 index 0000000000..15d4536b3d --- /dev/null +++ b/roles/web-app-openpost/meta/domains.yml @@ -0,0 +1,4 @@ +--- +canonical: + - publish.{{ DOMAIN_PRIMARY }} +aliases: [] From 943d8f966b1969d8ff631c4f604793b72fac1813 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 015/554] feat(web-app-openpost): place role network on 192.88.99.0/24 --- roles/web-app-openpost/meta/networks.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/meta/networks.yml diff --git a/roles/web-app-openpost/meta/networks.yml b/roles/web-app-openpost/meta/networks.yml new file mode 100644 index 0000000000..d3271bfd99 --- /dev/null +++ b/roles/web-app-openpost/meta/networks.yml @@ -0,0 +1,4 @@ +--- +meshes: [] +local: + subnet: 192.88.99.0/24 From ef4dce3962d958dff1e3f06232f2afa002cb746d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 016/554] feat(web-app-openpost): declare empty rbac --- roles/web-app-openpost/meta/rbac.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 roles/web-app-openpost/meta/rbac.yml diff --git a/roles/web-app-openpost/meta/rbac.yml b/roles/web-app-openpost/meta/rbac.yml new file mode 100644 index 0000000000..0c37d62134 --- /dev/null +++ b/roles/web-app-openpost/meta/rbac.yml @@ -0,0 +1,2 @@ +--- +roles: {} From 1aeccfacc054b44c0beca520cc1991d74b3b34dd Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 017/554] feat(web-app-openpost): generate jwt, encryption and media keys --- roles/web-app-openpost/meta/secrets.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 roles/web-app-openpost/meta/secrets.yml diff --git a/roles/web-app-openpost/meta/secrets.yml b/roles/web-app-openpost/meta/secrets.yml new file mode 100644 index 0000000000..7c91d4d5b2 --- /dev/null +++ b/roles/web-app-openpost/meta/secrets.yml @@ -0,0 +1,11 @@ +--- +credentials: + jwt_secret: + description: Secret OpenPost signs its session and API JWTs with (OPENPOST_JWT_SECRET); upstream requires at least 32 characters. + algorithm: alphanumeric + encryption_key: + description: Key OpenPost encrypts stored provider tokens and provider-app secrets with (OPENPOST_ENCRYPTION_KEY); rotating it requires the upstream previous-keys procedure. + algorithm: alphanumeric + media_signing_key: + description: Key OpenPost signs short-lived media URLs with (OPENPOST_MEDIA_SIGNING_KEY), pinned apart from the encryption key so a key rotation keeps media links valid. + algorithm: alphanumeric From efb1055c82c3341807973efa397304d65c2e15b5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 018/554] feat(web-app-openpost): raise upload body limit --- roles/web-app-openpost/meta/server.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 roles/web-app-openpost/meta/server.yml diff --git a/roles/web-app-openpost/meta/server.yml b/roles/web-app-openpost/meta/server.yml new file mode 100644 index 0000000000..8d25fc4bc9 --- /dev/null +++ b/roles/web-app-openpost/meta/server.yml @@ -0,0 +1,2 @@ +--- +client_max_body_size: 2g From 23332f3b165b1ab2bf05502755c3649adf347d27 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 019/554] feat(web-app-openpost): declare break-glass admin --- roles/web-app-openpost/meta/users.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 roles/web-app-openpost/meta/users.yml diff --git a/roles/web-app-openpost/meta/users.yml b/roles/web-app-openpost/meta/users.yml new file mode 100644 index 0000000000..9510ce5ea9 --- /dev/null +++ b/roles/web-app-openpost/meta/users.yml @@ -0,0 +1,9 @@ +--- +administrator: {} +web-app-openpost-breakglass: + username: openpost-breakglass + password: + algorithm: alphanumeric + accounts: [] + forward: administrator + description: OpenPost local break-glass instance admin; not provisioned to IAM, mail forwards to the administrator mailbox From 25ced8edb8dff04f9fd8b5dc2c6f4526d0606200 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 020/554] feat(web-app-openpost): allow SvelteKit shell and S3 uploads in CSP --- roles/web-app-openpost/meta/csp.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 roles/web-app-openpost/meta/csp.yml diff --git a/roles/web-app-openpost/meta/csp.yml b/roles/web-app-openpost/meta/csp.yml new file mode 100644 index 0000000000..95b30b8d3f --- /dev/null +++ b/roles/web-app-openpost/meta/csp.yml @@ -0,0 +1,9 @@ +--- +flags: + script-src-elem: + unsafe-inline: true # nocheck: csp-unsafe Reason: OpenPost's SvelteKit shell boots through inline scripts whose hashes change with every upstream release, and the unmodified image cannot carry a nonce +whitelist: + connect-src: + - "{{ lookup('tls', 'web-app-seaweedfs', 'protocols.web') }}://{{ lookup('config', 'web-app-seaweedfs', 'domains.canonical.api') }}" + font-src: + - "data:" From b671bb8c988d8fed5a0551107884bcb4ec91be98 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:57 +0200 Subject: [PATCH 021/554] feat(web-app-openpost): declare openpost, relay and simulator --- roles/web-app-openpost/meta/services.yml | 158 +++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 roles/web-app-openpost/meta/services.yml diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml new file mode 100644 index 0000000000..1dc062ef2f --- /dev/null +++ b/roles/web-app-openpost/meta/services.yml @@ -0,0 +1,158 @@ +--- +sso: + bond: 1 + enabled: "{{ 'web-app-keycloak' in group_names }}" + shared: "{{ 'web-app-keycloak' in group_names }}" + flavor: oidc +logout: + bond: 1 + enabled: "{{ 'web-svc-logout' in group_names }}" + shared: "{{ 'web-svc-logout' in group_names }}" +dashboard: + bond: 1 + enabled: "{{ 'web-app-dashboard' in group_names }}" + shared: "{{ 'web-app-dashboard' in group_names }}" +matomo: + bond: 1 + enabled: "{{ 'web-app-matomo' in group_names }}" + shared: "{{ 'web-app-matomo' in group_names }}" +email: + bond: 1 + enabled: "{{ MAIL_PROVIDER in group_names }}" + shared: "{{ MAIL_PROVIDER in group_names }}" +css: + bond: 1 + enabled: "{{ 'web-svc-css' in group_names }}" + shared: "{{ 'web-svc-css' in group_names }}" +prometheus: + bond: 1 + enabled: "{{ 'web-app-prometheus' in group_names }}" + shared: "{{ 'web-app-prometheus' in group_names }}" +# nocheck: playwright-service-flag - DB engine, covered by the role's CLI test +postgres: + bond: 1 + enabled: true # nocheck: dynamic-flag + shared: "{{ 'svc-db-postgres' in group_names }}" +seaweedfs: + bond: 1 + enabled: "{{ 'web-app-seaweedfs' in group_names }}" + shared: "{{ 'web-app-seaweedfs' in group_names }}" + public: true +mastodon: + bond: 1 + enabled: "{{ 'web-app-mastodon' in group_names }}" + shared: "{{ 'web-app-mastodon' in group_names }}" +# nocheck: playwright-service-flag - publishing target reached through the relay, covered by the role's CLI test +pixelfed: + bond: 0.5 + enabled: "{{ 'web-app-pixelfed' in group_names }}" + shared: "{{ 'web-app-pixelfed' in group_names }}" +# nocheck: playwright-service-flag - publishing target reached through the relay, covered by the role's CLI test +peertube: + bond: 0.5 + enabled: "{{ 'web-app-peertube' in group_names }}" + shared: "{{ 'web-app-peertube' in group_names }}" +# nocheck: playwright-service-flag self-provider +openpost: + # nocheck: single-replica one `all` process schedules and publishes; split web and worker scaling is out of scope + replicas: 1 + healthcheck: + flavor: wget + path: api/v1/health + modes: + compose: + enabled: true + swarm: + enabled: true + image: ghcr.io/getopenpost/openpost + version: "v7.22.9" + update: + type: registry_tags + name: openpost + cpus: 1.0 + mem_reservation: 256m + mem_limit: 1g + pids_limit: 512 + min_storage: 600MB + backup: + no_stop_required: true + ports: + internal: + http: 8080 + local: + http: 8098 + run_after: + - svc-db-postgres + - web-app-keycloak + - web-app-seaweedfs + - web-app-stalwart + - web-app-mailu + - web-app-mastodon + - web-app-pixelfed + - web-app-peertube + lifecycle: alpha +# nocheck: playwright-service-flag egress sidecar, covered by the role's CLI test +# nocheck: dynamic-flag the relay is part of this role and runs whenever OpenPost runs; no other role's presence decides it +relay: + enabled: true + shared: false + modes: + compose: + enabled: true + swarm: + enabled: true + image: nginx + version: 1.31.7-alpine + name: openpost-relay + cpus: "0.2" + mem_reservation: 16m + mem_limit: 64m + pids_limit: 64 + ports: + internal: + https: 443 +# nocheck: playwright-service-flag CI provider simulator, covered by the role's CLI test +# nocheck: dynamic-flag a test fixture switched on by one variant only; no other role's presence decides it +simulator: + enabled: false + shared: false + modes: + compose: + enabled: true + swarm: + enabled: true + image: wiremock/wiremock + version: "3.13.2" + name: openpost-simulator + cpus: "0.5" + mem_reservation: 256m + mem_limit: 512m + pids_limit: 256 + ports: + internal: + http: 8080 + https: 443 + hosts: + - api.twitter.com + - upload.twitter.com + - graph.facebook.com + - rupload.facebook.com + - graph.instagram.com + - oauth2.googleapis.com + - www.googleapis.com + providers: + - x + - meta + - youtube + +# nocheck: playwright-service-flag +# nocheck: variants-coverage — sso-variant-tor requires the onion on in every variant, so the false polarity has no variant left to live in +tor: + bond: 0.5 + enabled: "{{ 'svc-net-tor' in group_names }}" + shared: true # nocheck: dynamic-flag +# nocheck: playwright-service-flag, dynamic-flag infrastructure backup consumer +container_backup: # nocheck: bond-baseline backup host joins outside the variant topology + bond: 1 + enabled: "{{ 'svc-bkp-volume-2-local' in group_names }}" + shared: true From beb6e401967a2982cd60e00689e5700e9b8d6d42 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 022/554] feat(web-app-openpost): declare media, relay and simulator mounts --- roles/web-app-openpost/meta/volumes.yml | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 roles/web-app-openpost/meta/volumes.yml diff --git a/roles/web-app-openpost/meta/volumes.yml b/roles/web-app-openpost/meta/volumes.yml new file mode 100644 index 0000000000..1cc4a84cf9 --- /dev/null +++ b/roles/web-app-openpost/meta/volumes.yml @@ -0,0 +1,42 @@ +--- +media: + type: volume + name: openpost_media + mounts: + - service: openpost + target: /data/media + +simulator_mappings: + type: config + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'simulator', 'openpost.json'] | path_join }}" + mode: "0444" + mounts: + - service: simulator + target: /home/wiremock/mappings/openpost.json + when: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" + +simulator_keystore: + type: secret + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'simulator', 'keystore.p12'] | path_join }}" + mode: "0400" + mounts: + - service: simulator + target: /home/wiremock/keystore.p12 + when: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" + +simulator_ca: + type: config + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'simulator', 'ca.crt'] | path_join }}" + mode: "0444" + mounts: + - service: openpost + target: /etc/ssl/openpost-simulator/ca.crt + when: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" + +relay_conf: + type: config + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'relay.conf'] | path_join }}" + mode: "0444" + mounts: + - service: relay + target: /etc/nginx/nginx.conf From 38c9a12e32c6b729dfd412f599c543e57a0f1223 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 023/554] feat(web-app-openpost): define three deploy variants --- roles/web-app-openpost/meta/variants.yml | 128 +++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 roles/web-app-openpost/meta/variants.yml diff --git a/roles/web-app-openpost/meta/variants.yml b/roles/web-app-openpost/meta/variants.yml new file mode 100644 index 0000000000..44fef0adba --- /dev/null +++ b/roles/web-app-openpost/meta/variants.yml @@ -0,0 +1,128 @@ +--- +# nocheck: clearnet-variant-tor PeerTube is a publishing target OpenPost reaches server-side through its relay; the onion round never advertises it +- services: + container_backup: + enabled: true + css: + enabled: true + shared: true + dashboard: + enabled: true + shared: true + email: + enabled: true + shared: true + logout: + enabled: true + shared: true + mastodon: + enabled: true + shared: true + matomo: + enabled: true + shared: true + peertube: + enabled: false + shared: false + pixelfed: + enabled: false + shared: false + postgres: + shared: true + prometheus: + enabled: true + shared: true + seaweedfs: + enabled: true + shared: true + simulator: + enabled: true # nocheck: variants-static-override CI provider simulator that only this round switches on + sso: + enabled: true + shared: true + tor: + enabled: true + +- services: + container_backup: + enabled: false + shared: false # nocheck: variants-static-override backup shared stays literally true + css: + enabled: false + shared: false + dashboard: + enabled: false + shared: false + email: + enabled: false + shared: false + logout: + enabled: false + shared: false + mastodon: + enabled: false + shared: false + matomo: + enabled: false + shared: false + peertube: + enabled: true + shared: true + pixelfed: + enabled: true + shared: true + postgres: + shared: true + prometheus: + enabled: false + shared: false + seaweedfs: + enabled: false + shared: false + sso: + enabled: false + shared: false + tor: + enabled: true + +- services: + container_backup: + enabled: false + shared: false # nocheck: variants-static-override backup shared stays literally true + css: + enabled: false + shared: false + dashboard: + enabled: false + shared: false + email: + enabled: false + shared: false + logout: + enabled: false + shared: false + mastodon: + enabled: false + shared: false + matomo: + enabled: false + shared: false + peertube: + enabled: false + shared: false + pixelfed: + enabled: false + shared: false + postgres: + shared: false + prometheus: + enabled: false + shared: false + seaweedfs: + enabled: false + shared: false + sso: + enabled: false + shared: false + tor: + enabled: true From c4af089542fe40b06e8e33ad7fbc28f610d0a7d0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 024/554] feat(web-app-openpost): add role variables --- roles/web-app-openpost/vars/main.yml | 92 ++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 roles/web-app-openpost/vars/main.yml diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml new file mode 100644 index 0000000000..924754bffe --- /dev/null +++ b/roles/web-app-openpost/vars/main.yml @@ -0,0 +1,92 @@ +--- +application_id: "web-app-openpost" +container_port: "{{ lookup('config', application_id, 'services.openpost.ports.internal.http') }}" + +OPENPOST_NAME: "{{ lookup('config', application_id, 'services.openpost.name') }}" +OPENPOST_RELAY_NAME: "{{ lookup('config', application_id, 'services.relay.name') }}" +OPENPOST_URL: "{{ lookup('tls', application_id, 'url.base') | regex_replace('/+$', '') }}" +OPENPOST_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if DEPLOYMENT_MODE == 'compose' else '127.0.0.1' }}:{{ lookup('config', application_id, 'services.openpost.ports.local.http') }}" +OPENPOST_API_HEADERS: + Host: "{{ lookup('domain', application_id) }}" + X-Forwarded-Proto: "{{ OPENPOST_URL | urlsplit('scheme') }}" +OPENPOST_RELAY_CONF_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'relay.conf'] | path_join }}" + +OPENPOST_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}" +OPENPOST_EMAIL_ENABLED: "{{ lookup('config', application_id, 'services.email.enabled') }}" +OPENPOST_OBJSTORE_ENABLED: "{{ lookup('objstore', application_id, 'enabled') }}" + +OPENPOST_JWT_SECRET: "{{ lookup('config', application_id, 'secrets.credentials.jwt_secret') }}" +OPENPOST_ENCRYPTION_KEY: "{{ lookup('config', application_id, 'secrets.credentials.encryption_key') }}" +OPENPOST_MEDIA_SIGNING_KEY: "{{ lookup('config', application_id, 'secrets.credentials.media_signing_key') }}" + +OPENPOST_TRUSTED_PROXY_CIDRS: >- + {%- set _cidrs = [] -%} + {%- for _entry in NETWORK_TRUSTED_PROXY_CIDRS + [lookup('config', application_id, 'networks.local.subnet')] -%} + {%- set _ = _cidrs.append(_entry if '/' in _entry else _entry ~ ('/128' if ':' in _entry else '/32')) -%} + {%- endfor -%} + {{ _cidrs }} + +OPENPOST_ADMIN_USERNAME: "{{ lookup('users', 'web-app-openpost-breakglass').username }}" +OPENPOST_ADMIN_PASSWORD: "{{ lookup('users', 'web-app-openpost-breakglass').password }}" +OPENPOST_ADMIN_EMAIL: "{{ lookup('users', 'web-app-openpost-breakglass').email }}" +OPENPOST_ORGANISATION_WORKSPACE: "{{ SOFTWARE_NAME }}" + +OPENPOST_BOOTSTRAP_ADMINS: + - "{{ lookup('users', 'administrator').email }}" + +OPENPOST_RELAY_SIBLINGS: + mastodon: web-app-mastodon + pixelfed: web-app-pixelfed + peertube: web-app-peertube +OPENPOST_RELAY_DOMAINS: >- + {%- set _domains = [] -%} + {%- for _key, _role in OPENPOST_RELAY_SIBLINGS.items() -%} + {%- if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} + {%- set _ = _domains.append(lookup('domain', _role)) -%} + {%- endif -%} + {%- endfor -%} + {{ _domains }} +OPENPOST_PINNED_INSTANCES: >- + {%- set _instances = [] -%} + {%- for _key in ['mastodon', 'pixelfed'] -%} + {%- if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} + {%- set _ = _instances.append({'platform': _key, 'url': lookup('tls', OPENPOST_RELAY_SIBLINGS[_key], 'url.base') | regex_replace('/+$', '')}) -%} + {%- endif -%} + {%- endfor -%} + {{ _instances }} +OPENPOST_FEDIVERSE_APPS_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'fediverse-apps.json'] | path_join }}" +OPENPOST_RELAY_UPSTREAM_HOST: "host.docker.internal" +OPENPOST_RELAY_UPSTREAM_PORT: "{{ lookup('config', 'svc-prx-openresty', 'services.openresty.ports.public.https') }}" + +OPENPOST_SIMULATOR_ENABLED: "{{ lookup('config', application_id, 'services.simulator.enabled') | bool }}" +OPENPOST_SIMULATOR_NAME: "{{ lookup('config', application_id, 'services.simulator.name') }}" +OPENPOST_SIMULATOR_DIR: "{{ [lookup('container', application_id, 'directories.config'), 'simulator'] | path_join }}" +OPENPOST_SIMULATOR_HOSTS: "{{ lookup('config', application_id, 'services.simulator.hosts') }}" +OPENPOST_SIMULATOR_KEYSTORE_PASSWORD: "simulator" + +OPENPOST_PROVIDER_CREDENTIALS: >- + {%- set _credentials = {} -%} + {%- for _provider in ['x', 'meta', 'threads', 'linkedin', 'youtube', 'tiktok'] -%} + {%- if OPENPOST_SIMULATOR_ENABLED | bool and _provider in lookup('config', application_id, 'services.simulator.providers') -%} + {%- set _ = _credentials.update({_provider: {'client_id': 'simulator-' ~ _provider, 'client_secret': 'simulator-' ~ _provider ~ '-secret'}}) -%} + {%- elif lookup('api_enabled', _provider) -%} + {%- set _ = _credentials.update({_provider: {'client_id': lookup('api', _provider ~ '.client_id'), 'client_secret': lookup('api', _provider ~ '.client_secret')}}) -%} + {%- endif -%} + {%- endfor -%} + {{ _credentials }} +OPENPOST_PROVIDER_APP_KEYS: + meta: + - facebook + - instagram + youtube: + - youtube + tiktok: + - tiktok +OPENPOST_PROVIDER_APPS: >- + {%- set _apps = [] -%} + {%- for _provider, _keys in OPENPOST_PROVIDER_APP_KEYS.items() if _provider in OPENPOST_PROVIDER_CREDENTIALS -%} + {%- for _key in _keys -%} + {%- set _ = _apps.append({'provider': _key} | combine(OPENPOST_PROVIDER_CREDENTIALS[_provider])) -%} + {%- endfor -%} + {%- endfor -%} + {{ _apps }} From 63f7ea6503af39e079e90dbe25e00c46dcde7f13 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 025/554] feat(web-app-openpost): close password sign-up at the proxy --- .../files/nginx/deny-password-registration.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 roles/web-app-openpost/files/nginx/deny-password-registration.conf diff --git a/roles/web-app-openpost/files/nginx/deny-password-registration.conf b/roles/web-app-openpost/files/nginx/deny-password-registration.conf new file mode 100644 index 0000000000..69c7dd217b --- /dev/null +++ b/roles/web-app-openpost/files/nginx/deny-password-registration.conf @@ -0,0 +1,3 @@ +location = /api/v1/auth/register { + return 403; +} From bb7c8cbef7974e371f708d77826068ed83a39319 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 026/554] feat(web-app-openpost): add provider simulator stubs --- .../files/simulator/openpost.json | 610 ++++++++++++++++++ 1 file changed, 610 insertions(+) create mode 100644 roles/web-app-openpost/files/simulator/openpost.json diff --git a/roles/web-app-openpost/files/simulator/openpost.json b/roles/web-app-openpost/files/simulator/openpost.json new file mode 100644 index 0000000000..a566e855a2 --- /dev/null +++ b/roles/web-app-openpost/files/simulator/openpost.json @@ -0,0 +1,610 @@ +{ + "mappings": [ + { + "name": "x-request-token", + "request": { + "method": "POST", + "urlPath": "/oauth/request_token" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/x-www-form-urlencoded" + }, + "body": "oauth_token=simulator-request-token&oauth_token_secret=simulator-request-secret&oauth_callback_confirmed=true" + } + }, + { + "name": "x-access-token", + "request": { + "method": "POST", + "urlPath": "/oauth/access_token" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/x-www-form-urlencoded" + }, + "body": "oauth_token=simulator-access-token&oauth_token_secret=simulator-access-secret&user_id=4242&screen_name=openpost_simulator" + } + }, + { + "name": "x-users-me", + "request": { + "method": "GET", + "urlPath": "/2/users/me" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "id": "4242", + "name": "OpenPost Simulator", + "username": "openpost_simulator", + "subscription_type": "None" + } + } + } + }, + { + "name": "x-user-metrics", + "request": { + "method": "GET", + "urlPath": "/2/users/4242" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "id": "4242", + "public_metrics": { + "followers_count": 0, + "following_count": 0, + "tweet_count": 0, + "listed_count": 0 + } + } + } + } + }, + { + "name": "x-tweet-rate-limited-once", + "priority": 1, + "scenarioName": "x-rate-limited", + "requiredScenarioState": "Started", + "newScenarioState": "recovered", + "request": { + "method": "POST", + "urlPath": "/2/tweets", + "bodyPatterns": [ + { + "contains": "[simulate-429]" + } + ] + }, + "response": { + "status": 429, + "headers": { + "Content-Type": "application/json", + "x-rate-limit-remaining": "0", + "x-rate-limit-reset": "{{now offset='5 seconds' format='epoch'}}" + }, + "jsonBody": { + "title": "Too Many Requests", + "status": 429 + }, + "transformers": [ + "response-template" + ] + } + }, + { + "name": "x-tweet-unavailable-once", + "priority": 1, + "scenarioName": "x-unavailable", + "requiredScenarioState": "Started", + "newScenarioState": "recovered", + "request": { + "method": "POST", + "urlPath": "/2/tweets", + "bodyPatterns": [ + { + "contains": "[simulate-503]" + } + ] + }, + "response": { + "status": 503, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "title": "Service Unavailable", + "status": 503 + } + } + }, + { + "name": "x-tweet-rejected", + "priority": 1, + "request": { + "method": "POST", + "urlPath": "/2/tweets", + "bodyPatterns": [ + { + "contains": "[simulate-400]" + } + ] + }, + "response": { + "status": 400, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "title": "Invalid Request", + "status": 400, + "detail": "Simulated permanent rejection", + "type": "https://api.twitter.com/2/problems/invalid-request" + } + } + }, + { + "name": "x-tweet-created", + "priority": 5, + "request": { + "method": "POST", + "urlPath": "/2/tweets" + }, + "response": { + "status": 201, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "id": "1840000000000000001", + "text": "simulated" + } + } + } + }, + { + "name": "meta-access-token", + "request": { + "method": "POST", + "urlPathPattern": "/v[0-9.]+/oauth/access_token" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "access_token": "simulator-meta-user-token", + "token_type": "bearer", + "expires_in": 5183944 + } + } + }, + { + "name": "meta-permissions", + "request": { + "method": "GET", + "urlPathPattern": "/v[0-9.]+/me/permissions" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": [ + { + "permission": "business_management", + "status": "granted" + }, + { + "permission": "pages_show_list", + "status": "granted" + }, + { + "permission": "pages_read_engagement", + "status": "granted" + }, + { + "permission": "pages_read_user_content", + "status": "granted" + }, + { + "permission": "pages_manage_engagement", + "status": "granted" + }, + { + "permission": "pages_manage_metadata", + "status": "granted" + }, + { + "permission": "pages_manage_posts", + "status": "granted" + }, + { + "permission": "pages_messaging", + "status": "granted" + }, + { + "permission": "instagram_basic", + "status": "granted" + }, + { + "permission": "instagram_content_publish", + "status": "granted" + }, + { + "permission": "instagram_manage_comments", + "status": "granted" + }, + { + "permission": "instagram_manage_messages", + "status": "granted" + }, + { + "permission": "instagram_manage_insights", + "status": "granted" + } + ] + } + } + }, + { + "name": "meta-me", + "request": { + "method": "GET", + "urlPathPattern": "/v[0-9.]+/me" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "4243", + "name": "OpenPost Simulator", + "username": "openpost.simulator", + "picture": { + "data": { + "url": "" + } + } + } + } + }, + { + "name": "meta-pages", + "request": { + "method": "GET", + "urlPathPattern": "/v[0-9.]+/me/accounts" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": [ + { + "id": "424242", + "name": "OpenPost Simulator Page", + "username": "openpostsimulator", + "access_token": "simulator-page-token", + "tasks": [ + "ADVERTISE", + "ANALYZE", + "CREATE_CONTENT", + "MESSAGING", + "MODERATE", + "MANAGE" + ], + "instagram_business_account": { + "id": "17841400000000000", + "username": "openpost_simulator", + "name": "OpenPost Simulator", + "profile_picture_url": "", + "account_type": "BUSINESS" + }, + "picture": { + "data": { + "url": "" + } + } + } + ], + "paging": {} + } + } + }, + { + "name": "meta-businesses", + "request": { + "method": "GET", + "urlPathPattern": "/v[0-9.]+/me/businesses" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": [], + "paging": {} + } + } + }, + { + "name": "facebook-feed", + "request": { + "method": "POST", + "urlPathPattern": "/v[0-9.]+/424242/feed" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "424242_1001" + } + } + }, + { + "name": "facebook-photos", + "request": { + "method": "POST", + "urlPathPattern": "/v[0-9.]+/424242/photos" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "2001", + "post_id": "424242_2001" + } + } + }, + { + "name": "instagram-container", + "request": { + "method": "POST", + "urlPathPattern": "/v[0-9.]+/17841400000000000/media" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "18000000000000001" + } + } + }, + { + "name": "instagram-container-status", + "request": { + "method": "GET", + "urlPathPattern": "/v[0-9.]+/18000000000000001" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "18000000000000001", + "status_code": "FINISHED", + "status": "Finished: Media has been uploaded and it is ready to be published." + } + } + }, + { + "name": "instagram-publish", + "request": { + "method": "POST", + "urlPathPattern": "/v[0-9.]+/17841400000000000/media_publish" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "18000000000000002" + } + } + }, + { + "name": "instagram-media", + "request": { + "method": "GET", + "urlPathPattern": "/v[0-9.]+/18000000000000002" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "18000000000000002", + "permalink": "https://www.instagram.com/p/simulator/" + } + } + }, + { + "name": "google-token", + "request": { + "method": "POST", + "urlPath": "/token" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "access_token": "simulator-google-token", + "refresh_token": "simulator-google-refresh", + "expires_in": 3599, + "token_type": "Bearer", + "scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.upload" + } + } + }, + { + "name": "google-userinfo", + "request": { + "method": "GET", + "urlPath": "/oauth2/v2/userinfo" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "simulator-google-user", + "name": "OpenPost Simulator", + "email": "simulator@example.org", + "picture": "" + } + } + }, + { + "name": "youtube-channels", + "request": { + "method": "GET", + "urlPath": "/youtube/v3/channels" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "items": [ + { + "id": "UCsimulator", + "snippet": { + "title": "OpenPost Simulator", + "customUrl": "@openpostsimulator", + "thumbnails": { + "default": { + "url": "" + } + } + }, + "statistics": { + "subscriberCount": "0", + "videoCount": "0", + "viewCount": "0" + } + } + ] + } + } + }, + { + "name": "youtube-upload-session", + "request": { + "method": "POST", + "urlPath": "/upload/youtube/v3/videos", + "queryParameters": { + "uploadType": { + "equalTo": "resumable" + } + } + }, + "response": { + "status": 200, + "headers": { + "Location": "https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&upload_id=simulator-upload" + } + } + }, + { + "name": "youtube-upload", + "request": { + "method": "PUT", + "urlPath": "/upload/youtube/v3/videos", + "queryParameters": { + "upload_id": { + "equalTo": "simulator-upload" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "id": "simulatorvid", + "status": { + "uploadStatus": "uploaded", + "privacyStatus": "private" + } + } + } + }, + { + "name": "youtube-videos", + "request": { + "method": "GET", + "urlPath": "/youtube/v3/videos" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "items": [ + { + "id": "simulatorvid", + "status": { + "uploadStatus": "processed", + "privacyStatus": "private" + }, + "processingDetails": { + "processingStatus": "succeeded" + } + } + ] + } + } + }, + { + "name": "unmatched", + "priority": 10, + "request": { + "method": "ANY", + "urlPattern": ".*" + }, + "response": { + "status": 404, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "error": "simulator has no mapping for this request" + } + } + } + ] +} From a225e789588b5156afe93a27f320fb3b03a53346 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 027/554] feat(web-app-openpost): add SNI egress relay config --- .../web-app-openpost/templates/relay.conf.j2 | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 roles/web-app-openpost/templates/relay.conf.j2 diff --git a/roles/web-app-openpost/templates/relay.conf.j2 b/roles/web-app-openpost/templates/relay.conf.j2 new file mode 100644 index 0000000000..73ea195424 --- /dev/null +++ b/roles/web-app-openpost/templates/relay.conf.j2 @@ -0,0 +1,33 @@ +worker_processes 1; +error_log /dev/stderr warn; + +events { + worker_connections 1024; +} + +stream { + log_format relay '$remote_addr sni=$ssl_preread_server_name upstream=$upstream_addr status=$status'; + access_log /dev/stdout relay; + + upstream shared_proxy { + server {{ OPENPOST_RELAY_UPSTREAM_HOST }}:{{ OPENPOST_RELAY_UPSTREAM_PORT }}; + } + + upstream refused { + server 127.0.0.1:9; + } + + map $ssl_preread_server_name $relay_upstream { +{% for domain in OPENPOST_RELAY_DOMAINS %} + {{ domain }} shared_proxy; +{% endfor %} + default refused; + } + + server { + listen {{ lookup('config', application_id, 'services.relay.ports.internal.https') }}; + ssl_preread on; + proxy_pass $relay_upstream; + proxy_connect_timeout 5s; + } +} From 245bd6030ed42224139d9be1fe9d32e23724cae1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 028/554] feat(web-app-openpost): add compose template --- .../web-app-openpost/templates/compose.yml.j2 | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 roles/web-app-openpost/templates/compose.yml.j2 diff --git a/roles/web-app-openpost/templates/compose.yml.j2 b/roles/web-app-openpost/templates/compose.yml.j2 new file mode 100644 index 0000000000..7a9e93e7c7 --- /dev/null +++ b/roles/web-app-openpost/templates/compose.yml.j2 @@ -0,0 +1,48 @@ +{% include 'roles/sys-svc-compose/templates/base.yml.j2' %} + {% set service_name = 'openpost' %} + {{ service_name }}: + {% include 'roles/sys-svc-container/templates/base.yml.j2' %} + {{ lookup('container_image', application_id, 'openpost') }} + {{ lookup('compose_only', 'container_name', OPENPOST_NAME) }} + {{ lookup('container_ports', ['openpost', 'http', DOCKER_BIND_HOST]) | indent(4) }} + {{ lookup('container_healthcheck', service_name) | indent(4) }} + + {{ lookup('container_depends_on', application_id) | indent(4) }} + {{ lookup('container_volumes', service_name) | indent(4) }} + {{ lookup('container_extra_hosts') | indent(4) }} + {{ lookup('container_networks') | indent(4) }} + + {% set service_name = 'relay' %} + {{ service_name }}: + {% include 'roles/sys-svc-container/templates/base.yml.j2' %} + {{ lookup('container_image', application_id, 'relay') }} + {{ lookup('compose_only', 'container_name', OPENPOST_RELAY_NAME) }} + {{ lookup('container_volumes', service_name) | indent(4) }} + {{ lookup('container_extra_hosts', host_alias=True) | indent(4) }} + {{ lookup('container_networks', aliases=OPENPOST_RELAY_DOMAINS) | indent(4) }} + + {% if OPENPOST_SIMULATOR_ENABLED | bool %} + {% set service_name = 'simulator' %} + {{ service_name }}: + {% include 'roles/sys-svc-container/templates/base.yml.j2' %} + {{ lookup('container_image', application_id, 'simulator') }} + {{ lookup('compose_only', 'container_name', OPENPOST_SIMULATOR_NAME) }} + command: + - --https-port + - "{{ lookup('config', application_id, 'services.simulator.ports.internal.https') }}" + - --https-keystore + - "{{ lookup('volume', application_id, 'simulator_keystore').target }}" + - --keystore-type + - PKCS12 + - --keystore-password + - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" + - --key-manager-password + - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" + - --disable-banner + {{ lookup('container_volumes', service_name) | indent(4) }} + {{ lookup('container_networks', aliases=OPENPOST_SIMULATOR_HOSTS) | indent(4) }} + {% endif %} + +{{ lookup('compose_volumes') }} + +{{ lookup('compose_networks') }} From 1e2da3ff76eeaf1ef96ed6b64bc4e7e108cf4498 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:58 +0200 Subject: [PATCH 029/554] feat(web-app-openpost): add environment template --- roles/web-app-openpost/templates/env.j2 | 83 +++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 roles/web-app-openpost/templates/env.j2 diff --git a/roles/web-app-openpost/templates/env.j2 b/roles/web-app-openpost/templates/env.j2 new file mode 100644 index 0000000000..41ae4d5824 --- /dev/null +++ b/roles/web-app-openpost/templates/env.j2 @@ -0,0 +1,83 @@ +{% include 'roles/sys-svc-container/templates/env.j2' %} + +OPENPOST_PORT={{ container_port }} +OPENPOST_EDITION=selfhost +OPENPOST_APP_URL={{ OPENPOST_URL }} +OPENPOST_PUBLIC_URL={{ OPENPOST_URL }} +OPENPOST_TRUSTED_PROXY_CIDRS={{ OPENPOST_TRUSTED_PROXY_CIDRS | join(',') }} +OPENPOST_DISABLE_REGISTRATIONS={{ (not (OPENPOST_OIDC_ENABLED | bool)) | string | lower }} +OPENPOST_OAUTH_DYNAMIC_REGISTRATION_ENABLED=false + +OPENPOST_DATABASE_DRIVER=postgres +OPENPOST_DATABASE_URL={{ (lookup('database', application_id, 'url_full') ~ '?sslmode=disable') | dotenv_quote }} + +OPENPOST_JWT_SECRET={{ OPENPOST_JWT_SECRET | dotenv_quote }} +OPENPOST_ENCRYPTION_KEY={{ OPENPOST_ENCRYPTION_KEY | dotenv_quote }} +OPENPOST_MEDIA_SIGNING_KEY={{ OPENPOST_MEDIA_SIGNING_KEY | dotenv_quote }} + +{% if OPENPOST_OBJSTORE_ENABLED | bool %} +OPENPOST_STORAGE_DRIVER=s3 +OPENPOST_S3_ENDPOINT={{ lookup('objstore', application_id, 'public_url') | regex_replace('/[^/]+/?$', '') }} +OPENPOST_S3_REGION={{ lookup('objstore', application_id, 'region') }} +OPENPOST_S3_BUCKET={{ lookup('objstore', application_id, 'bucket') }} +OPENPOST_S3_ACCESS_KEY_ID={{ lookup('objstore', application_id, 'access_key') }} +OPENPOST_S3_SECRET_ACCESS_KEY={{ lookup('objstore', application_id, 'secret_key') | dotenv_quote }} +OPENPOST_S3_PUBLIC_BASE_URL={{ lookup('objstore', application_id, 'public_url') }} +OPENPOST_S3_FORCE_PATH_STYLE=true +{% else %} +OPENPOST_STORAGE_DRIVER=local +OPENPOST_MEDIA_PATH={{ lookup('volume', application_id, 'media').target }} +OPENPOST_MEDIA_URL=/media +{% endif %} + +OPENPOST_DIAGNOSTICS_ENABLED=false +OPENPOST_UPDATE_CHECK_ENABLED=false +OPENPOST_TELEMETRY_ENABLED=false +OPENPOST_FEEDBACK_ENABLED=false +OPENPOST_PUBLIC_PROFILES_ENABLED=false +OPENPOST_STOCK_MEDIA_ENABLED=false +OPENPOST_WORKFLOWS_AI_ENABLED=false + +{% if OPENPOST_OIDC_ENABLED | bool %} +OPENPOST_OIDC_ISSUER={{ OIDC.CLIENT.ISSUER_URL }} +OPENPOST_OIDC_CLIENT_ID={{ OIDC.CLIENT.ID }} +OPENPOST_OIDC_CLIENT_SECRET={{ OIDC.CLIENT.SECRET | dotenv_quote }} +OPENPOST_OIDC_NAME={{ OIDC.BUTTON_TEXT | dotenv_quote }} +OPENPOST_OIDC_SCOPES=openid,profile,email +OPENPOST_OIDC_JIT_ENABLED=true +OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST={{ OPENPOST_BOOTSTRAP_ADMINS | join(',') }} +{% endif %} + +{% if OPENPOST_EMAIL_ENABLED | bool %} +{% set email = lookup('email', application_id) %} +{% if email.tls | bool or email.start_tls | bool %} +OPENPOST_EMAIL_PROVIDER=smtp +OPENPOST_EMAIL_FROM={{ email['from'] }} +OPENPOST_SMTP_HOST={{ email.host }} +OPENPOST_SMTP_PORT={{ email.port }} +OPENPOST_SMTP_USERNAME={{ email.username }} +OPENPOST_SMTP_PASSWORD={{ email.password | dotenv_quote }} +OPENPOST_SMTP_TLS_MODE={{ 'tls' if email.tls | bool else 'starttls' }} +{% endif %} +{% endif %} + +{% for _platform in ['mastodon', 'pixelfed'] %} +{% set _servers = [] %} +{% for _instance in OPENPOST_PINNED_INSTANCES if _instance.platform == _platform and _instance.url in openpost_fediverse_apps %} +{% set _ = _servers.append({'name': _instance.url, 'instance_url': _instance.url, 'client_id': openpost_fediverse_apps[_instance.url].client_id, 'client_secret': openpost_fediverse_apps[_instance.url].client_secret}) %} +{% endfor %} +{% if _servers %} +{{ _platform | upper }}_SERVERS={{ _servers | to_json | dotenv_quote }} +{% endif %} +{% endfor %} + +{% for _provider in ['x', 'threads', 'linkedin'] if _provider in OPENPOST_PROVIDER_CREDENTIALS %} +{{ _provider | upper }}_CLIENT_ID={{ OPENPOST_PROVIDER_CREDENTIALS[_provider].client_id | dotenv_quote }} +{{ _provider | upper }}_CLIENT_SECRET={{ OPENPOST_PROVIDER_CREDENTIALS[_provider].client_secret | dotenv_quote }} +{% endfor %} +{% if OPENPOST_PROVIDER_APPS | length > 0 %} +OPENPOST_PROVIDER_APPS={{ OPENPOST_PROVIDER_APPS | to_json | dotenv_quote }} +{% endif %} +{% if OPENPOST_SIMULATOR_ENABLED | bool %} +SSL_CERT_DIR={{ lookup('volume', application_id, 'simulator_ca').target | dirname }}:/etc/ssl/certs +{% endif %} From c55b8858040d8f83c545fb3f6241992323887a7b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 030/554] feat(web-app-openpost): add task entrypoint --- roles/web-app-openpost/tasks/main.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 roles/web-app-openpost/tasks/main.yml diff --git a/roles/web-app-openpost/tasks/main.yml b/roles/web-app-openpost/tasks/main.yml new file mode 100644 index 0000000000..96aa3b7dc7 --- /dev/null +++ b/roles/web-app-openpost/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include_tasks: 00_core.yml + when: run_once_web_app_openpost is not defined From c201c85fa53128066d1046cb118efbb13675f18a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 031/554] feat(web-app-openpost): deploy stack, relay and bootstrap --- roles/web-app-openpost/tasks/00_core.yml | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 roles/web-app-openpost/tasks/00_core.yml diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml new file mode 100644 index 0000000000..0451ed6b7c --- /dev/null +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -0,0 +1,38 @@ +--- +- include_tasks: utils/once/flag.yml + +- name: "🔗 Pin OpenPost apps on the sibling Mastodon and Pixelfed instances" + include_tasks: 01_fediverse_apps.yml + +- name: "🧪 Prepare the provider simulator" + include_tasks: + file: 02_simulator.yml + apply: + delegate_to: "{{ STACK_HOST }}" + run_once: true + when: OPENPOST_SIMULATOR_ENABLED | bool + +- name: "🧩 load docker, db and proxy for {{ application_id }}" + include_role: + name: sys-stk-full + vars: + compose_handlers_flush: false + webserver_extra_configuration: >- + {{ lookup('file', lookup('path_absolute', 'roles/web-app-openpost/files/nginx/deny-password-registration.conf')) + if OPENPOST_OIDC_ENABLED | bool else '' }} + +- name: "📄 Render the egress relay config (local + swarm peers)" + ansible.builtin.include_tasks: + file: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/render_replicated_templates.yml') }}" + vars: + role_templates: + - src: "relay.conf.j2" + dest: "{{ OPENPOST_RELAY_CONF_HOST }}" + mode: "0644" + +- name: "🚿 flush handlers for '{{ application_id }}'" + meta: flush_handlers + +- name: "🔑 Bootstrap the break-glass instance admin" + include_tasks: 03_breakglass.yml + when: IS_STACK_HOST | bool From 9d5ab2beab6150d14f7f8eeec7b48a962c7c6da6 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 032/554] feat(web-app-openpost): pin apps on sibling Fediverse instances --- .../tasks/01_fediverse_apps.yml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 roles/web-app-openpost/tasks/01_fediverse_apps.yml diff --git a/roles/web-app-openpost/tasks/01_fediverse_apps.yml b/roles/web-app-openpost/tasks/01_fediverse_apps.yml new file mode 100644 index 0000000000..8a54443721 --- /dev/null +++ b/roles/web-app-openpost/tasks/01_fediverse_apps.yml @@ -0,0 +1,68 @@ +--- +- name: "📖 Read the OpenPost apps already registered on the sibling Fediverse instances" + ansible.builtin.slurp: + src: "{{ OPENPOST_FEDIVERSE_APPS_HOST }}" + register: openpost_fediverse_apps_raw + failed_when: false + changed_when: false + delegate_to: "{{ STACK_HOST }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧾 Keep the registered apps" + ansible.builtin.set_fact: + openpost_fediverse_apps: >- + {{ (openpost_fediverse_apps_raw.content | b64decode | from_json) + if openpost_fediverse_apps_raw.content is defined else {} }} + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "📝 Register an OpenPost app on each sibling instance that has none yet" + uri_retry: + url: "{{ item.url }}/api/v1/apps" + method: POST + body_format: form-urlencoded + body: + client_name: OpenPost + redirect_uris: "urn:ietf:wg:oauth:2.0:oob" + scopes: "read write" + website: "{{ OPENPOST_URL }}" + validate_certs: true + status_code: 200 + loop: "{{ OPENPOST_PINNED_INSTANCES | rejectattr('url', 'in', openpost_fediverse_apps.keys() | list) | list }}" + loop_control: + label: "{{ item.url }}" + register: openpost_fediverse_registrations + delegate_to: "{{ STACK_HOST }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧾 Add the apps registered in this run" + ansible.builtin.set_fact: + openpost_fediverse_apps: "{{ openpost_fediverse_apps | combine(openpost_fediverse_new_apps) }}" + vars: + openpost_fediverse_new_apps: >- + {%- set _apps = {} -%} + {%- for _result in openpost_fediverse_registrations.results -%} + {%- set _ = _apps.update({_result.item.url: {'client_id': _result.json.client_id, 'client_secret': _result.json.client_secret}}) -%} + {%- endfor -%} + {{ _apps }} + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "📁 Ensure the directory for the registered apps exists" + ansible.builtin.file: + path: "{{ OPENPOST_FEDIVERSE_APPS_HOST | dirname }}" + state: directory + mode: "0755" + delegate_to: "{{ STACK_HOST }}" + run_once: true + when: openpost_fediverse_registrations.results | length > 0 + +- name: "💾 Persist the registered apps" + ansible.builtin.copy: + dest: "{{ OPENPOST_FEDIVERSE_APPS_HOST }}" + content: "{{ openpost_fediverse_apps | to_nice_json }}" + mode: "0600" + delegate_to: "{{ STACK_HOST }}" + run_once: true + when: openpost_fediverse_registrations.results | length > 0 + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From 58094d11e7432255fb02cfa1aa758503a9e31bd7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 033/554] feat(web-app-openpost): prepare provider simulator certificates --- roles/web-app-openpost/tasks/02_simulator.yml | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 roles/web-app-openpost/tasks/02_simulator.yml diff --git a/roles/web-app-openpost/tasks/02_simulator.yml b/roles/web-app-openpost/tasks/02_simulator.yml new file mode 100644 index 0000000000..1887dd8f30 --- /dev/null +++ b/roles/web-app-openpost/tasks/02_simulator.yml @@ -0,0 +1,108 @@ +--- +- name: "📁 Ensure the provider simulator directory exists" + ansible.builtin.file: + path: "{{ OPENPOST_SIMULATOR_DIR }}" + state: directory + mode: "0750" + +- name: "🔐 Create the test CA the simulator certificate chains to" + ansible.builtin.command: + argv: + - openssl + - req + - -x509 + - -newkey + - rsa:2048 + - -nodes + - -days + - "365" + - -subj + - "/CN=OpenPost provider simulator CA" + - -keyout + - "{{ OPENPOST_SIMULATOR_DIR }}/ca.key" + - -out + - "{{ OPENPOST_SIMULATOR_DIR }}/ca.crt" + creates: "{{ OPENPOST_SIMULATOR_DIR }}/ca.crt" + +- name: "📄 Write the subject alternative names of the simulated provider hosts" + ansible.builtin.copy: + dest: "{{ OPENPOST_SIMULATOR_DIR }}/server.ext" + content: | + subjectAltName={{ OPENPOST_SIMULATOR_HOSTS | map('regex_replace', '^', 'DNS:') | join(',') }} + extendedKeyUsage=serverAuth + mode: "0640" + register: openpost_simulator_ext + +- name: "🗑️ Drop the simulator certificate when its host list changed" + ansible.builtin.file: + path: "{{ OPENPOST_SIMULATOR_DIR }}/{{ item }}" + state: absent + loop: + - server.crt + - keystore.p12 + when: openpost_simulator_ext.changed + +- name: "🔑 Create the simulator key and signing request" + ansible.builtin.command: + argv: + - openssl + - req + - -newkey + - rsa:2048 + - -nodes + - -subj + - "/CN=openpost-simulator" + - -keyout + - "{{ OPENPOST_SIMULATOR_DIR }}/server.key" + - -out + - "{{ OPENPOST_SIMULATOR_DIR }}/server.csr" + creates: "{{ OPENPOST_SIMULATOR_DIR }}/server.csr" + +- name: "✒️ Sign the simulator certificate with the test CA" + ansible.builtin.command: + argv: + - openssl + - x509 + - -req + - -in + - "{{ OPENPOST_SIMULATOR_DIR }}/server.csr" + - -CA + - "{{ OPENPOST_SIMULATOR_DIR }}/ca.crt" + - -CAkey + - "{{ OPENPOST_SIMULATOR_DIR }}/ca.key" + - -CAcreateserial + - -days + - "365" + - -sha256 + - -extfile + - "{{ OPENPOST_SIMULATOR_DIR }}/server.ext" + - -out + - "{{ OPENPOST_SIMULATOR_DIR }}/server.crt" + creates: "{{ OPENPOST_SIMULATOR_DIR }}/server.crt" + +- name: "📦 Bundle the simulator certificate into the WireMock keystore" + ansible.builtin.command: + argv: + - openssl + - pkcs12 + - -export + - -name + - simulator + - -in + - "{{ OPENPOST_SIMULATOR_DIR }}/server.crt" + - -inkey + - "{{ OPENPOST_SIMULATOR_DIR }}/server.key" + - -certfile + - "{{ OPENPOST_SIMULATOR_DIR }}/ca.crt" + - -passout + - "pass:{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" + - -out + - "{{ OPENPOST_SIMULATOR_DIR }}/keystore.p12" + creates: "{{ OPENPOST_SIMULATOR_DIR }}/keystore.p12" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🗺️ Deploy the simulator stub mappings" + ansible.builtin.copy: + src: simulator/openpost.json + dest: "{{ OPENPOST_SIMULATOR_DIR }}/openpost.json" + mode: "0644" From d30f433b68db3e049c2e648456c030bd096e898c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 034/554] feat(web-app-openpost): bootstrap break-glass admin and workspace --- .../web-app-openpost/tasks/03_breakglass.yml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 roles/web-app-openpost/tasks/03_breakglass.yml diff --git a/roles/web-app-openpost/tasks/03_breakglass.yml b/roles/web-app-openpost/tasks/03_breakglass.yml new file mode 100644 index 0000000000..68b0f41b44 --- /dev/null +++ b/roles/web-app-openpost/tasks/03_breakglass.yml @@ -0,0 +1,81 @@ +--- +- name: "⏳ Wait until OpenPost reports ready" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/ready" + headers: "{{ OPENPOST_API_HEADERS }}" + status_code: 200 + timeout: "{{ lookup('timeout', 10) | int }}" + retries: 60 + delay: 5 + changed_when: false + +- name: "🔑 Sign in as the break-glass instance admin" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/auth/login" + method: POST + headers: "{{ OPENPOST_API_HEADERS }}" + body_format: json + body: + email: "{{ OPENPOST_ADMIN_EMAIL }}" + password: "{{ OPENPOST_ADMIN_PASSWORD }}" + status_code: [200, 401] + register: openpost_breakglass_login + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + changed_when: false + +- name: "👤 Register the break-glass account as the first instance admin" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/auth/register" + method: POST + headers: "{{ OPENPOST_API_HEADERS }}" + body_format: json + body: + email: "{{ OPENPOST_ADMIN_EMAIL }}" + password: "{{ OPENPOST_ADMIN_PASSWORD }}" + username: "{{ OPENPOST_ADMIN_USERNAME }}" + status_code: [200, 403, 409] + register: openpost_breakglass_register + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + changed_when: openpost_breakglass_register.status == 200 + when: openpost_breakglass_login.status == 401 + +- name: "❌ Fail when the break-glass account can neither sign in nor be created" + ansible.builtin.fail: + msg: >- + OpenPost refused both the break-glass sign-in and its registration + (HTTP {{ openpost_breakglass_register.status }}). Another account already + became the first instance admin, or the break-glass password was changed in + the UI; follow the break-glass procedure in Administration.md. + when: + - openpost_breakglass_login.status == 401 + - openpost_breakglass_register.status != 200 + +- name: "🔐 Keep the break-glass session headers for the following API calls" + ansible.builtin.set_fact: + openpost_breakglass_headers: >- + {{ OPENPOST_API_HEADERS | combine({'Authorization': 'Bearer ' ~ + (openpost_breakglass_register.json.token if openpost_breakglass_login.status == 401 + else openpost_breakglass_login.json.token)}) }} + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🔍 List the workspaces of the break-glass instance admin" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/workspaces" + headers: "{{ openpost_breakglass_headers }}" + status_code: 200 + register: openpost_breakglass_workspaces + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + changed_when: false + +- name: "🏢 Create the organisation workspace owned by the break-glass instance admin" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/workspaces" + method: POST + headers: "{{ openpost_breakglass_headers }}" + body_format: json + body: + name: "{{ OPENPOST_ORGANISATION_WORKSPACE }}" + status_code: 200 + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + changed_when: true + when: OPENPOST_ORGANISATION_WORKSPACE not in (openpost_breakglass_workspaces.json | map(attribute='name') | list) From c51f9c885536da376b2cc93786f061adac383eed Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 035/554] docs(web-app-openpost): add role readme --- roles/web-app-openpost/README.md | 136 +++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 roles/web-app-openpost/README.md diff --git a/roles/web-app-openpost/README.md b/roles/web-app-openpost/README.md new file mode 100644 index 0000000000..2cefed0fcc --- /dev/null +++ b/roles/web-app-openpost/README.md @@ -0,0 +1,136 @@ +# OpenPost + +## Description + +[OpenPost](https://github.com/getopenpost/openpost) is a self-hosted publishing desk for social media. +Teams compose posts once, adapt them per network, schedule them and publish them to Mastodon, Pixelfed, PeerTube, Bluesky, Facebook Pages, Instagram, Threads, X, YouTube, LinkedIn and TikTok from one interface. + +## Overview + +This role deploys the unmodified official `ghcr.io/getopenpost/openpost` image as one `all` process behind the shared OpenResty proxy at `publish.`. +It stores data in the central PostgreSQL, keeps media in the `web-app-seaweedfs` object store when one is deployed, signs users in through Keycloak over OIDC and sends mail through the platform mail service. +An always-on egress relay lets OpenPost publish to the Mastodon, Pixelfed and PeerTube instances of the same deployment without weakening its SSRF guard. +For operation, platform onboarding and the egress design see [Administration.md](./Administration.md). + +## Cosmos + +The diagram places OpenPost in the Infinito.Nexus cosmos: the components it deploys (capabilities), the central services it consumes (dependencies), and its outward reach (federation and bridged external networks). + +```mermaid +flowchart LR + subgraph deps [Dependencies] + dep_svc_bkp_volume_2_local["svc-bkp-volume-2-local 💻"] + dep_svc_db_postgres["svc-db-postgres 🐳🐝"] + dep_svc_net_tor["svc-net-tor 🐳🐝"] + dep_web_app_dashboard["web-app-dashboard 🐳🐝"] + dep_web_app_keycloak["web-app-keycloak 🐳🐝"] + dep_web_app_mastodon["web-app-mastodon 🐳🐝"] + dep_web_app_matomo["web-app-matomo 🐳🐝"] + dep_web_app_peertube["web-app-peertube 🐳🐝"] + dep_web_app_pixelfed["web-app-pixelfed 🐳🐝"] + dep_web_app_prometheus["web-app-prometheus 🐳🐝"] + dep_web_app_seaweedfs["web-app-seaweedfs 🐳🐝"] + dep_web_app_stalwart["web-app-stalwart 🐳🐝"] + dep_web_svc_css["web-svc-css 💻"] + dep_web_svc_logout["web-svc-logout 🐳🐝"] + end + subgraph role [web-app-openpost 🐳🐝] + svc_sso["sso"] + svc_logout["logout"] + svc_dashboard["dashboard"] + svc_matomo["matomo"] + svc_email["email"] + svc_css["css"] + svc_prometheus["prometheus"] + svc_postgres["postgres"] + svc_seaweedfs["seaweedfs"] + svc_mastodon["mastodon"] + svc_pixelfed["pixelfed"] + svc_peertube["peertube"] + svc_openpost["openpost"] + svc_relay["relay"] + svc_simulator["simulator ❌"] + svc_tor["tor"] + svc_container_backup["container_backup"] + end + dep_svc_bkp_volume_2_local -. "0..1" .-> svc_container_backup + dep_svc_db_postgres -. "0..1" .-> svc_postgres + dep_svc_net_tor -. "0..1" .-> svc_tor + dep_web_app_dashboard -. "0..1" .-> svc_dashboard + dep_web_app_keycloak -. "0..1" .-> svc_sso + dep_web_app_mastodon -. "0..1" .-> svc_mastodon + dep_web_app_matomo -. "0..1" .-> svc_matomo + dep_web_app_peertube -. "0..1" .-> svc_peertube + dep_web_app_pixelfed -. "0..1" .-> svc_pixelfed + dep_web_app_prometheus -. "0..1" .-> svc_prometheus + dep_web_app_seaweedfs -. "0..1" .-> svc_seaweedfs + dep_web_app_stalwart -. "0..1" .-> svc_email + dep_web_svc_css -. "0..1" .-> svc_css + dep_web_svc_logout -. "0..1" .-> svc_logout +``` + +Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional (enabled only in matching deployments); red `0..0` edges are turned off in this role. Node markers show the role's deploy modes (💻 host, 🐳 compose, 🐝 swarm); ❌ marks a service that is explicitly turned off, and ⚙️ an Ansible role dependency declared in `meta/main.yml`. + +## Features + +- **Official image only:** The role pins an upstream release tag, configures OpenPost purely through environment variables and lets the update tooling propose new release tags. +- **Keycloak single sign-on:** OpenPost's native OIDC adapter provisions users just in time on their first login, and the platform administrator becomes instance admin through the bootstrap allowlist. +- **No LDAP adapter:** OpenPost ships no LDAP login, so the role declares no `ldap` service; directory accounts sign in through Keycloak's OpenLDAP federation over OIDC. +- **Egress relay:** An nginx stream relay carries the canonical domains of the deployed Mastodon, Pixelfed and PeerTube instances as network aliases on a subnet outside OpenPost's blocked ranges and forwards the untouched TLS stream by SNI to the shared proxy. +- **Break-glass admin:** A local instance admin is bootstrapped on the first deploy so the instance stays manageable when Keycloak is unavailable. +- **Data minimisation:** Diagnostics, the update check, product telemetry, feedback, public profiles, stock media search and workflow AI are switched off. +- **Central credentials:** Developer app credentials for X, Meta, Threads, LinkedIn, YouTube and TikTok come from the central `API` mapping, and a network without credentials stays unavailable. + +## Quick Setup + +### Development + +Clone, set up the workstation, and deploy OpenPost onto the local stack: + +```bash +git clone https://github.com/infinito-nexus/core.git +cd core +make onboard +make compose-deploy mode=reinstall apps=web-app-openpost full_cycle=false +``` + +### Production + +Run the published image to provision the inventory and deploy OpenPost to a managed server (the mounted volume persists the inventory): + +```bash +APP=web-app-openpost +HOST= +DOMAIN= +TLS_MODE=self_signed +SSH_PUBLIC_KEY="" + +docker run --rm -it \ + -v "$PWD/inventories:/etc/infinito.nexus/inventories" \ + -e APP="$APP" -e HOST="$HOST" -e DOMAIN="$DOMAIN" -e TLS_MODE="$TLS_MODE" -e SSH_PUBLIC_KEY="$SSH_PUBLIC_KEY" \ + ghcr.io/infinito-nexus/core/debian bash -c ' + INVENTORY=/etc/infinito.nexus/inventories/production + infinito administration inventory provision "$INVENTORY" \ + --inventory-file "$INVENTORY/devices.yml" \ + --host "$HOST" \ + --include "$APP" \ + --vars "{\"TLS_MODE\": \"$TLS_MODE\", \"DOMAIN_PRIMARY\": \"$DOMAIN\", \"users\": {\"administrator\": {\"authorized_keys\": [\"$SSH_PUBLIC_KEY\"]}}}" && + infinito administration deploy dedicated "$INVENTORY/devices.yml" \ + --password-file "$INVENTORY/.password" \ + --diff -vv' +``` + +## Developer Notes + +See [Administration.md](./Administration.md) for the egress relay, the break-glass procedure, per-network onboarding and the staging checklist. + +## Further Resources + +- [OpenPost on GitHub](https://github.com/getopenpost/openpost) +- [OpenPost provider reference](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/providers/index.md) + +## Credits + +Implemented by **[Evangelos Tsakoudis](https://github.com/evangelostsak)**. +Part of the [Infinito.Nexus Project](https://s.infinito.nexus/code) and maintained by [Kevin Veen-Birkenbach](https://www.veen.world). +Licensed under the [Infinito.Nexus Community License (Non-Commercial)](https://s.infinito.nexus/license). From c195fbee3885727d63404760387e3515cb689ab1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 036/554] docs(web-app-openpost): add administration guide --- roles/web-app-openpost/Administration.md | 150 +++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 roles/web-app-openpost/Administration.md diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md new file mode 100644 index 0000000000..9edf49da04 --- /dev/null +++ b/roles/web-app-openpost/Administration.md @@ -0,0 +1,150 @@ +# Administration + +## Accounts and workspaces + +OpenPost separates people (accounts) from the places they publish from (workspaces). +Connected social accounts, drafts, schedules and media belong to a workspace, and only its members see them. +Every member holds a workspace role, and only roles with publishing rights may publish or schedule. + +The first account of a fresh instance becomes the instance admin. +The deploy registers the break-glass account first for that reason (see [Break-glass instance admin](#break-glass-instance-admin)). +Instance admins manage users, provider apps and instance settings under **Settings → Instance**; workspace owners invite members and assign their roles under **Settings → Workspace → Team**. + +## Single sign-on + +The role configures OpenPost's instance-wide OIDC provider against the shared Keycloak client (`OIDC.CLIENT.*`) whenever `web-app-keycloak` is deployed. + +- Users sign in with the Keycloak button on the login page. + OpenPost provisions them just in time on their first verified login (`OPENPOST_OIDC_JIT_ENABLED=true`) and matches later logins by issuer and subject. +- The platform `administrator` is listed in `OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST` and becomes instance admin on its first SSO login. +- A just-in-time user starts without access to existing workspaces. + Grant access by inviting the user from the workspace's team settings; OpenPost does not consume Keycloak groups. +- Password self-registration is closed. + OpenPost gates password sign-up and just-in-time provisioning with the same switch, so with Keycloak deployed the role keeps `OPENPOST_DISABLE_REGISTRATIONS=false` and the shared proxy answers `POST /api/v1/auth/register` with HTTP 403; without Keycloak the switch itself is set. +- OpenPost ships no LDAP adapter, so the role declares no `ldap` service. + Directory accounts sign in through Keycloak, which federates OpenLDAP, over OIDC. +- OpenPost never links an SSO identity to an existing account with the same e-mail address automatically. + The break-glass account therefore uses its own address, and a person who already holds a local account keeps signing in with its password until an instance admin removes the local account and the person signs in through Keycloak again. +- For workspaces that require SSO, `OPENPOST_SSO_BREAK_GLASS_EMAILS` names instance admins that may still enter with their password plus TOTP or a passkey during an identity-provider outage. + Add the break-glass address to that list through the inventory once the account has a second factor. +- OpenPost also offers a trusted-proxy sign-in (`OPENPOST_PROXY_AUTH_SECRET`, header `X-OpenPost-Proxy-User`). + The role does not enable it; it is the fallback for a deployment that has to front OpenPost with `oauth2-proxy` instead of native OIDC, and it then requires the proxy to strip client-supplied `X-OpenPost-Proxy-*` headers. + +## Break-glass instance admin + +The deploy bootstraps the local account `web-app-openpost-breakglass` (username `openpost-breakglass`, password generated into the inventory) as the first OpenPost account, which makes it the instance admin. +Use it when Keycloak is unavailable: open `https://publish./` and sign in with the e-mail address and password from the inventory. +If the deploy reports that the break-glass account can neither sign in nor be registered, another account became the first instance admin or the password was changed in the UI; sign in with that account and reset the break-glass password, or restore the database from backup. + +## Egress guard and relay + +OpenPost protects itself against server-side request forgery with its `netguard` package. +Before it connects to a provider URL that a user entered, such as a Mastodon instance, it resolves the name and refuses the connection when any address lies in a private, loopback, CGNAT, link-local, documentation, benchmarking, multicast or reserved range. +It repeats the check when it dials and on every redirect, ignores proxy variables and offers no switch for built-in providers. + +Inside an Infinito.Nexus deployment the sibling vhosts usually resolve to private addresses: the development stack, split-horizon DNS and WireGuard meshes all answer with RFC 1918 or mesh addresses. +The role therefore runs an `nginx` stream relay next to OpenPost: + +- The role network uses `192.88.99.0/24`, the deprecated 6to4 relay anycast block (RFC 7526), which `netguard` accepts as a global unicast range and which never leaves the Docker host. + `group_vars/all/08_networks.yml` lists the role in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` for that reason. +- The relay carries the canonical domains of the deployed Mastodon, Pixelfed and PeerTube roles as network aliases, so OpenPost resolves those names to the relay. +- The relay reads the SNI of each TLS connection, forwards a mapped name unchanged to the shared OpenResty proxy and closes every other connection. + It forwards to `host.docker.internal`, which points at the Docker host in compose and at the stack host in swarm. +- TLS stays end to end between OpenPost and OpenResty; in self-signed mode OpenPost trusts the platform CA through the compose CA injection. + +Every destination that is not one of these aliases still passes through the guard unchanged. +A sibling instance that runs on another host is covered as long as the shared proxy of this host serves its vhost; a Fediverse instance outside the deployment needs no relay because it resolves to public addresses. +OpenPost's Mastodon registration accepts `https` on port 443 only, so the relay requires TLS on the sibling vhosts. + +## Provider credentials + +Developer app credentials live in the central `API` mapping of `group_vars/all/18_api.yml` and are overridden in the vault-encrypted inventory. +A network whose entry is incomplete (`lookup('api_enabled', '')` is false) is not configured in OpenPost and cannot be connected. + +| `API` entry | OpenPost setting | Networks | +|---|---|---| +| `x` | `X_CLIENT_ID`, `X_CLIENT_SECRET` | X | +| `meta` | `OPENPOST_PROVIDER_APPS` entries `facebook` and `instagram` | Facebook Pages, Instagram | +| `threads` | `THREADS_CLIENT_ID`, `THREADS_CLIENT_SECRET` | Threads | +| `linkedin` | `LINKEDIN_CLIENT_ID`, `LINKEDIN_CLIENT_SECRET` | LinkedIn | +| `youtube` | `OPENPOST_PROVIDER_APPS` entry `youtube` | YouTube | +| `tiktok` | `OPENPOST_PROVIDER_APPS` entry `tiktok` | TikTok | + +Mastodon, Pixelfed, PeerTube and Bluesky need no operator credentials: PeerTube exchanges the user's password once for tokens, and Bluesky uses an app password. +For Mastodon and Pixelfed the deploy registers an `OpenPost` app on every deployed sibling instance once, stores its credentials in `fediverse-apps.json` in the role's config directory and renders them into `MASTODON_SERVERS` and `PIXELFED_SERVERS`, named by the instance's canonical URL. +OpenPost v7.22.9 can register apps on any other instance by itself, but its code exchange then checks provider readiness against the bare host name the dialog sends and refuses with `provider operation is not ready: needs_configuration`; an external instance therefore needs the same pinning through those two variables. +Every callback URL has the form `https://publish./api/v1/accounts//callback`. + +## Networks + +| Network | Post types | Developer app and account | Scopes | Review or verification | Quota | Cost (October 2026) | Token upkeep | +|---|---|---|---|---|---|---|---| +| Mastodon | Text, up to 4 images or one video, threads, scheduling | None; any instance, account of the user | `read write` | None | Set by the instance | None | Tokens do not expire | +| Pixelfed | Up to 4 photos, albums | None; any instance | `read write` | None | Set by the instance | None | Tokens do not expire | +| PeerTube | One video per post to one channel | None; instance username and password | Password exchanged once | None | Instance upload quota | None | OAuth tokens stored encrypted; the password is never stored | +| Bluesky | Text, up to 4 images or one MP4, threads | None; app password | App password | None | About 1,666 creates per hour | None | Sessions last up to 180 days and renew from the app password | +| Facebook Pages | Text, 1–10 images, public video URL, Stories, Reels | Meta Business app; Facebook Page | `pages_manage_posts`, `pages_read_engagement`, `pages_show_list`, `business_management` and the further scopes in the upstream `.env.example` | Standard Access for app-role users without App Review; App Review for everyone else | Reels: 30 per Page per 24 h | No fee found | Long-lived Page tokens do not expire | +| Instagram | Images, carousels, Reels, Stories; no text-only posts | Meta app; Business or Creator account | `instagram_basic`, `instagram_content_publish`, `pages_show_list` and further scopes | App Review for non-role users | 100 per 24 h | No fee found | Instagram Login tokens last 60 days and refresh | +| X | Text (280 weighted characters), up to 4 images or one video, threads | X developer app with prepaid credits | `tweet.read`, `tweet.write`, `users.read`, `offline.access` | None beyond the developer agreement | 100 per 15 min per user | $0.015 per post, $0.20 per post with a URL | Access tokens refresh via `offline.access` | +| YouTube | One video or Short per post, no text or image posts | Google OAuth client; YouTube channel | `youtube.upload`, `youtube.readonly`, `userinfo.profile`, `userinfo.email` | Production status and Google verification for sensitive scopes | 100 `videos.insert` calls per day | No fee found | Testing-status refresh tokens expire after 7 days | +| LinkedIn | Text, images, documents, one MP4 | LinkedIn app; member or Organization Page | `openid`, `profile`, `w_member_social`; organization scopes need approval | Community Management API vetting of the legal entity | Development tier: 500 calls per app per day | No fee found | 60-day tokens without refresh | +| Threads | Text (500 characters), image or carousel, video | Meta app with the Threads product | `threads_basic`, `threads_content_publish` | App Review for non-role users | 250 per 24 h | No fee found | 60 days, refreshable | +| TikTok | One video or 1–35 photos; no text-only posts | TikTok developer app | `user.info.basic`, `video.publish`, `video.upload` | Content Posting API audit | About 15 per creator per day | No fee found | Not researched | + +Sources: the [OpenPost provider reference](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/providers/index.md), its [environment variables](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/configuration/environment-variables.md) and the platform sources listed in the role's requirement. + +## Unsupported features and workarounds + +| Limitation | Workaround | +|---|---| +| TikTok's content sharing guidelines reject in-house upload tools as a use case for the Content Posting API. | Publish to TikTok manually, or apply with a use case TikTok accepts; keep TikTok credentials empty until then. | +| X charges $0.20 instead of $0.015 for a post that contains a URL. | Write the X rendition without links, or accept the surcharge per post. | +| X forbids identical content across accounts of the same owner. | Give each X account its own rendition. | +| OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition. | Cap X spending through the prepaid credits of the X developer account. | +| Instagram accepts JPEG only and fetches media from a public URL. | Deploy `web-app-seaweedfs` so media gets public HTTPS URLs; convert other image formats before upload. | +| Facebook, Instagram, Threads and TikTok fetch media from public HTTPS URLs. | Same as above; without `web-app-seaweedfs` media is served under `/media/` of the public OpenPost domain, which also works when that domain is reachable from the internet. | +| LinkedIn requires vetting of the legal entity and re-authorisation every 60 days. | Plan the vetting before launch and schedule a re-authorisation reminder. | +| YouTube projects in testing status lose refresh tokens after 7 days. | Move the Google OAuth client to production status and complete verification. | +| Bluesky is also reachable without OpenPost through `web-app-bridgy-fed`. | Use the bridge for automatic federation and OpenPost for deliberate Bluesky-native posts. | +| Sibling Fediverse instances are reachable only over TLS on port 443. | Keep TLS enabled for `web-app-mastodon`, `web-app-pixelfed` and `web-app-peertube`. | + +## Data processing and dependencies + +- Every network receives exactly what a user publishes to it: the rendition text, attached media, alt text and post settings, plus the OAuth tokens of the connected account. +- Facebook, Instagram, Threads and TikTok additionally download the attached media from its public URL. +- Provider tokens and provider-app secrets are stored in Postgres encrypted with AES-256-GCM under `OPENPOST_ENCRYPTION_KEY`; the key lives in the inventory and is needed to restore a backup. +- Diagnostics, the update check, PostHog telemetry, the feedback form, public profiles, stock media search and workflow AI are disabled, so the instance sends nothing to OpenPost's maintainers or to AI providers. +- Third-party dependencies at runtime are the APIs of the connected networks only. +- OpenPost is licensed AGPL-3.0-only. + The role deploys the unmodified upstream image and links its source, which satisfies the AGPL's source-offer obligation for network users; the role's own files remain under the Infinito.Nexus Community License. + +## Backup, restore and upgrades + +- With `web-app-seaweedfs` deployed, browsers upload media directly to its public S3 vhost through presigned URLs, which is why `OPENPOST_S3_ENDPOINT` is the public endpoint and the CSP allows it in `connect-src`; OpenPost deduplicates identical files by content hash. +- The platform backup covers the OpenPost database in the shared Postgres and the `openpost_media` volume; media in `web-app-seaweedfs` is covered by that role's backup. +- A restore needs the database, the media and the inventory secrets, especially `encryption_key`; without it the stored provider tokens cannot be decrypted and every network has to be reconnected. +- Changing the pinned version in `meta/services.yml` and redeploying runs OpenPost's own migrations, which take a Postgres advisory lock. + Only the latest upstream release receives security fixes, so follow new release tags promptly. + +## Staging checklist + +Run these checks against real platforms after onboarding a network and after every OpenPost upgrade: + +1. Connect the account in a staging workspace and confirm OpenPost shows it as connected. +2. Publish a text post (where supported), an image post and a video post immediately. +3. Schedule a post five minutes ahead and confirm it appears on time. +4. Open each published post through the link in OpenPost. +5. Disconnect the account and reconnect it to confirm token renewal. +6. Record the result in the matrix below. + +## Verified combinations + +| Network | Content type | OpenPost version | Date | Result | +|---|---|---|---|---| +| Mastodon (local instance) | Text | v7.22.9 | pending | CI end-to-end test | +| Pixelfed (local instance) | Image | v7.22.9 | pending | CI end-to-end test | +| PeerTube (local instance) | Video | v7.22.9 | pending | CI end-to-end test | +| Facebook Pages | Text, image | v7.22.9 | not yet verified | Manual staging check | +| Instagram | Image | v7.22.9 | not yet verified | Manual staging check | +| X | Text | v7.22.9 | not yet verified | Manual staging check | +| YouTube | Video | v7.22.9 | not yet verified | Manual staging check | From 46e542403fa7bf86b571953c0f40fda2a416e737 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 037/554] test(web-app-openpost): declare cli test --- roles/web-app-openpost/meta/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/meta/tests.yml diff --git a/roles/web-app-openpost/meta/tests.yml b/roles/web-app-openpost/meta/tests.yml new file mode 100644 index 0000000000..3ce199e8b5 --- /dev/null +++ b/roles/web-app-openpost/meta/tests.yml @@ -0,0 +1,4 @@ +--- +cli: + timeout: 900 + container_service_key: openpost From 1276b09e58c46cbfdd0277e8b46776905a5d825e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:02:59 +0200 Subject: [PATCH 038/554] test(web-app-openpost): add cli test env --- roles/web-app-openpost/templates/test.env.j2 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 roles/web-app-openpost/templates/test.env.j2 diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 new file mode 100644 index 0000000000..47d0cbef48 --- /dev/null +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -0,0 +1,14 @@ +OPENPOST_ADMIN_EMAIL={{ OPENPOST_ADMIN_EMAIL }} +OPENPOST_ADMIN_PASSWORD_B64={{ OPENPOST_ADMIN_PASSWORD | b64encode }} +OPENPOST_API_HEADERS_B64={{ OPENPOST_API_HEADERS | to_json | b64encode }} +OPENPOST_CONTAINER={{ CLI_LOCAL_CID }} +OPENPOST_DEADLINE_SECONDS={{ lookup('timeout', 600) | int }} +OPENPOST_LOCAL_URL={{ OPENPOST_LOCAL_URL }} +OPENPOST_PUBLIC_URL={{ OPENPOST_URL }} +OPENPOST_SSO_ENABLED={{ OPENPOST_OIDC_ENABLED | bool | string | lower }} +{% set _targets = {} %} +{% for _key, _role in OPENPOST_RELAY_SIBLINGS.items() if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool %} +{% set _ = _targets.update({_key: lookup('domain', _role)}) %} +{% endfor %} +OPENPOST_RELAY_TARGETS='{{ _targets | to_json }}' +OPENPOST_RELAY_PORT={{ lookup('config', application_id, 'services.relay.ports.internal.https') }} From a673cb741544684d9581b79b3961a5a813b189ac Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 039/554] test(web-app-openpost): exempt cli harness layout --- roles/web-app-openpost/files/test/.nocheck | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/web-app-openpost/files/test/.nocheck diff --git a/roles/web-app-openpost/files/test/.nocheck b/roles/web-app-openpost/files/test/.nocheck new file mode 100644 index 0000000000..2b9d82d840 --- /dev/null +++ b/roles/web-app-openpost/files/test/.nocheck @@ -0,0 +1 @@ +# nocheck: role-files-layout - Role test harness with test.sh as its entry point; test-e2e-cli stages files/test/ by that fixed path. From 866e164566ef75959734017495515c3516474d61 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 040/554] test(web-app-openpost): add api probe --- roles/web-app-openpost/files/test/probe.py | 158 +++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 roles/web-app-openpost/files/test/probe.py diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py new file mode 100644 index 0000000000..33c21e971b --- /dev/null +++ b/roles/web-app-openpost/files/test/probe.py @@ -0,0 +1,158 @@ +"""Env (rendered into test.env from templates/test.env.j2): + OPENPOST_LOCAL_URL published OpenPost origin on the stack host + OPENPOST_API_HEADERS_B64 base64 JSON of the Host and proto headers the proxy would send + OPENPOST_ADMIN_EMAIL break-glass instance admin e-mail + OPENPOST_ADMIN_PASSWORD_B64 base64 break-glass password + OPENPOST_RELAY_TARGETS JSON map of sibling platform to the domain the relay carries + OPENPOST_DEADLINE_SECONDS readiness budget, below the harness timeout + OPENPOST_PUBLIC_URL public origin served by the shared proxy + OPENPOST_SSO_ENABLED true when Keycloak provisions users, so the proxy closes password sign-up +""" + +from __future__ import annotations + +import base64 +import json +import os +import sys +import time +import urllib.error +import urllib.parse +import urllib.request + +BASE = os.environ["OPENPOST_LOCAL_URL"].rstrip("/") + "/api/v1" +HEADERS = json.loads(base64.b64decode(os.environ["OPENPOST_API_HEADERS_B64"])) +ADMIN_EMAIL = os.environ["OPENPOST_ADMIN_EMAIL"] +ADMIN_PASSWORD = base64.b64decode(os.environ["OPENPOST_ADMIN_PASSWORD_B64"]).decode() +RELAY_TARGETS = json.loads(os.environ["OPENPOST_RELAY_TARGETS"]) +DEADLINE = time.monotonic() + int(os.environ["OPENPOST_DEADLINE_SECONDS"]) +PUBLIC_URL = os.environ["OPENPOST_PUBLIC_URL"].rstrip("/") +SSO_ENABLED = os.environ["OPENPOST_SSO_ENABLED"] == "true" + +PRIVATE_TARGETS = ("https://postgres", "https://10.0.0.1") + +failures: list[str] = [] + + +def call(method: str, path: str, body: object = None, token: str = "") -> tuple[int, object]: + data = json.dumps(body).encode() if body is not None else None + request = urllib.request.Request(BASE + path, data=data, method=method) + for name, value in HEADERS.items(): + request.add_header(name, value) + request.add_header("Content-Type", "application/json") + if token: + request.add_header("Authorization", "Bearer " + token) + try: + with urllib.request.urlopen(request, timeout=60) as response: + raw = response.read().decode() + status = response.status + except urllib.error.HTTPError as error: + raw = error.read().decode() + status = error.code + try: + return status, json.loads(raw) if raw else None + except ValueError: + return status, raw + + +def check(label: str, ok: bool, detail: object = "") -> None: + print(("[OK] " if ok else "[FAIL] ") + label + (f": {detail}" if not ok and detail else "")) + if not ok: + failures.append(label) + + +def wait_ready() -> None: + while True: + try: + status, _ = call("GET", "/ready") + if status == 200: + return + except OSError: + pass + if time.monotonic() > DEADLINE: + sys.exit("[FAIL] OpenPost never reported ready") + time.sleep(5) + + +def login() -> str: + status, body = call("POST", "/auth/login", {"email": ADMIN_EMAIL, "password": ADMIN_PASSWORD}) + if status != 200 or not isinstance(body, dict) or not body.get("token"): + sys.exit(f"[FAIL] break-glass login returned HTTP {status}") + print("[OK] break-glass instance admin signs in") + return str(body["token"]) + + +def flag(path: str, key: str, token: str = "") -> object: + status, body = call("GET", path, token=token) + if status != 200 or not isinstance(body, dict): + return f"HTTP {status}" + return body.get(key) + + +def public_status(method: str, path: str) -> int: + request = urllib.request.Request(PUBLIC_URL + path, data=b"{}", method=method) + request.add_header("Content-Type", "application/json") + try: + with urllib.request.urlopen(request, timeout=60) as response: + return response.status + except urllib.error.HTTPError as error: + return error.code + + +def check_data_minimisation(token: str) -> None: + for label, path, key in ( + ("PostHog telemetry is off", "/telemetry/config", "enabled"), + ("diagnostics reports are off", "/diagnostics/public-config", "enabled"), + ("public profiles are off", "/auth/config", "public_profiles_enabled"), + ): + value = flag(path, key) + check(label, value is False, f"{path} {key}={value!r}") + if SSO_ENABLED: + status = public_status("POST", "/api/v1/auth/register") + check("the proxy refuses password self-registration", status == 403, f"HTTP {status}") + else: + value = flag("/auth/config", "registration_enabled") + check("password self-registration is off", value is False, f"registration_enabled={value!r}") + + +def workspace_id(token: str) -> str: + status, body = call("GET", "/workspaces", token=token) + if status == 200 and isinstance(body, list) and body: + return str(body[0]["id"]) + status, body = call("POST", "/workspaces", {"name": "CLI probe"}, token=token) + if status != 200 or not isinstance(body, dict): + sys.exit(f"[FAIL] cannot create a probe workspace: HTTP {status}") + return str(body["id"]) + + +def auth_url(token: str, workspace: str, platform: str, instance_url: str) -> tuple[int, object]: + query = urllib.parse.urlencode({"workspace_id": workspace, "instance_url": instance_url}) + return call("GET", f"/accounts/{platform}/auth-url?{query}", token=token) + + +def check_relay(token: str, workspace: str) -> None: + for platform, domain in RELAY_TARGETS.items(): + if platform == "peertube": + continue + status, body = auth_url(token, workspace, platform, f"https://{domain}") + check(f"relay carries {platform} at {domain} past the guard", status == 200, f"HTTP {status} {body}") + for target in PRIVATE_TARGETS: + status, body = auth_url(token, workspace, "mastodon", target) + check(f"guard still rejects {target}", status != 200, f"HTTP {status} {body}") + + +def main() -> int: + wait_ready() + print("[OK] /api/v1/ready answers 200") + token = login() + check_data_minimisation(token) + workspace = workspace_id(token) + check_relay(token, workspace) + if failures: + print(f"[FAIL] {len(failures)} check(s) failed: {', '.join(failures)}") + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) From 837ba2480b042fabbc68a8e8291ba5d530343905 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 041/554] test(web-app-openpost): add cli test --- roles/web-app-openpost/files/test/test.sh | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 roles/web-app-openpost/files/test/test.sh diff --git a/roles/web-app-openpost/files/test/test.sh b/roles/web-app-openpost/files/test/test.sh new file mode 100644 index 0000000000..5805eb634e --- /dev/null +++ b/roles/web-app-openpost/files/test/test.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# shellcheck shell=bash +# Env (rendered into test.env from templates/test.env.j2): +# OPENPOST_CONTAINER resolved OpenPost container (CLI_LOCAL_CID) +# OPENPOST_RELAY_PORT port the relay listens on inside the role network +# every OPENPOST_* variable probe.py documents + +set -uo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +[ -n "${OPENPOST_CONTAINER}" ] || { + echo "[FATAL] OPENPOST_CONTAINER unset; the OpenPost container was not resolved" >&2 + exit 2 +} + +python3 -I "${here}/probe.py" +rc=$? + +# nocheck: container-exec-resolver, shell-download-retry address resolved by the caller; a single attempt is the point of a refusal probe +unmapped="$(container exec "${OPENPOST_CONTAINER}" wget -S -T 10 -O /dev/null "https://relay:${OPENPOST_RELAY_PORT}/" 2>&1)" +case "${unmapped}" in +*"HTTP/"*) + echo "[FAIL] the relay forwarded a TLS connection whose SNI is not in its map" + echo "${unmapped}" + rc=1 + ;; +*) + echo "[OK] the relay refuses a TLS connection whose SNI is not in its map" + ;; +esac + +exit "${rc}" From e619bd738cc57c30c76a2d891ed8e104904f82ab Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 042/554] test(web-app-openpost): add playwright env --- .../templates/playwright.env.j2 | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 roles/web-app-openpost/templates/playwright.env.j2 diff --git a/roles/web-app-openpost/templates/playwright.env.j2 b/roles/web-app-openpost/templates/playwright.env.j2 new file mode 100644 index 0000000000..4acd28ac88 --- /dev/null +++ b/roles/web-app-openpost/templates/playwright.env.j2 @@ -0,0 +1,57 @@ +ADMIN_EMAIL={{ lookup('users', 'administrator').email | dotenv_quote }} + +ADMIN_PASSWORD={{ lookup('users', 'administrator').password | dotenv_quote }} + +ADMIN_USERNAME={{ lookup('users', 'administrator').username | dotenv_quote }} + +APP_BASE_URL={{ lookup('tls', application_id, 'url.base') | dotenv_quote }} + +BIBER_PASSWORD={{ lookup('users', 'biber').password | dotenv_quote }} + +BIBER_USERNAME={{ lookup('users', 'biber').username | dotenv_quote }} + +BREAKGLASS_EMAIL={{ OPENPOST_ADMIN_EMAIL | dotenv_quote }} + +BREAKGLASS_PASSWORD={{ OPENPOST_ADMIN_PASSWORD | dotenv_quote }} + +CANONICAL_DOMAIN={{ lookup('domain', application_id) | dotenv_quote }} + +# nocheck: playwright-service-gate - CSS injection is asserted by the central CSP helper, not a per-persona surface +CSS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.css.enabled') | string | lower }} + +# nocheck: playwright-service-gate - dashboard tiles are owned by the web-app-dashboard spec +DASHBOARD_SERVICE_ENABLED={{ lookup('config', application_id, 'services.dashboard.enabled') | string | lower }} + +# nocheck: playwright-service-gate - mail delivery is covered by the sys-svc-mail integration tests, not the persona surface +EMAIL_SERVICE_ENABLED={{ OPENPOST_EMAIL_ENABLED | string | lower }} + +# nocheck: playwright-service-gate - universal-logout redirect is exercised by the persona logout step; covered by web-svc-logout integration tests +LOGOUT_SERVICE_ENABLED={{ lookup('config', application_id, 'services.logout.enabled') | string | lower }} + +MASTODON_BASE_URL={{ lookup('tls', 'web-app-mastodon', 'url.base') | dotenv_quote }} + +MASTODON_SERVICE_ENABLED={{ lookup('config', application_id, 'services.mastodon.enabled') | string | lower }} + +MATOMO_BASE_URL={{ lookup('tls', 'web-app-matomo', 'url.base') | dotenv_quote }} + +# nocheck: playwright-service-gate - Matomo tracking is an injected snippet, covered by the web-app-matomo spec +MATOMO_SERVICE_ENABLED={{ lookup('config', application_id, 'services.matomo.enabled') | string | lower }} + +OIDC_ISSUER_URL={{ OIDC.CLIENT.ISSUER_URL | dotenv_quote }} + +ORGANISATION_WORKSPACE={{ OPENPOST_ORGANISATION_WORKSPACE | dotenv_quote }} + +# nocheck: playwright-service-gate - Prometheus scrape parity is owned by the web-app-prometheus spec +PROMETHEUS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.prometheus.enabled') | string | lower }} + +SEAWEEDFS_ADMIN_PASSWORD={{ lookup('users', 'administrator').password | dotenv_quote }} + +SEAWEEDFS_ADMIN_USERNAME={{ lookup('users', 'administrator').username | dotenv_quote }} + +SEAWEEDFS_APP_BUCKET={{ lookup('objstore', application_id, 'bucket') | dotenv_quote }} + +SEAWEEDFS_FILER_URL={{ lookup('canonical_url', 'web-app-seaweedfs', 'filer', consumer=application_id) | dotenv_quote }} + +SEAWEEDFS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.seaweedfs.enabled') | string | lower }} + +SSO_SERVICE_ENABLED={{ OPENPOST_OIDC_ENABLED | string | lower }} From 3d9068dbe67ecc7d4e2a9e00100a9d28b5d3d5cf Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 043/554] test(web-app-openpost): exempt playwright layout --- roles/web-app-openpost/files/playwright/.nocheck | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/web-app-openpost/files/playwright/.nocheck diff --git a/roles/web-app-openpost/files/playwright/.nocheck b/roles/web-app-openpost/files/playwright/.nocheck new file mode 100644 index 0000000000..9ceebc5e82 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/.nocheck @@ -0,0 +1 @@ +# nocheck: role-files-layout - Playwright discovers this suite by path; the runner copies the tree as it stands and the specs import their helpers relatively. Sorting by extension would break discovery. From e7355b591bb0f1469d838a2514d7753094965635 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 044/554] test(web-app-openpost): add playwright helpers --- .../files/playwright/_shared.js | 342 ++++++++++++++++++ 1 file changed, 342 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/_shared.js diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js new file mode 100644 index 0000000000..06cc58f1a6 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -0,0 +1,342 @@ +const { expect } = require("@playwright/test"); +const { resolveTimeout } = require("./timeouts"); + +const { decodeDotenvQuotedValue, normalizeBaseUrl, performKeycloakLoginForm, gotoOnion } = require("./personas"); +const { isServiceEnabled, skipUnlessServiceEnabled } = require("./service-gating"); + +const env = { + appBaseUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.APP_BASE_URL)), + canonicalDomain: decodeDotenvQuotedValue(process.env.CANONICAL_DOMAIN), + oidcIssuerUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.OIDC_ISSUER_URL || "")), + adminUsername: decodeDotenvQuotedValue(process.env.ADMIN_USERNAME), + adminPassword: decodeDotenvQuotedValue(process.env.ADMIN_PASSWORD), + adminEmail: decodeDotenvQuotedValue(process.env.ADMIN_EMAIL), + biberUsername: decodeDotenvQuotedValue(process.env.BIBER_USERNAME), + biberPassword: decodeDotenvQuotedValue(process.env.BIBER_PASSWORD), + breakglassEmail: decodeDotenvQuotedValue(process.env.BREAKGLASS_EMAIL), + breakglassPassword: decodeDotenvQuotedValue(process.env.BREAKGLASS_PASSWORD), + mastodonBaseUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.MASTODON_BASE_URL || "")), + organisationWorkspace: decodeDotenvQuotedValue(process.env.ORGANISATION_WORKSPACE), + oidcEnabled: isServiceEnabled("sso"), +}; + +const SAMPLE_PNG = Buffer.from( + "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAGy0lEQVR4nBXVkb/GIBTG8ReHYTgMw+EwHIbDMBwOh8Pwh+FwOAyHYRiG4d3tD+jb53TOc36/H8MP8UP+GH+oH/rH9GP+YX4sP+yP9Yf74X9sP/Yfx4/zR/jBj/jj+nH/eH6kH++P/KP8qD/aj/7j9xsYBsSAHBgH1IAemAbmATOwDNiBdcAN+IFtYB84Bs6BMMBAHLgG7oFnIA28A3mgDNSBNtCHDxAMAiGQglGgBFowCWaBESwCK1gFTuAFm2AXHIJTEAQIouAS3IJHkASvIAuKoAqaoIsPkAwSIZGSUaIkWjJJZomRLBIrWSVO4iWbZJccklMSJEii5JLckkeSJK8kS4qkSpqkyw8YGUbEiBwZR9SIHplG5hEzsozYkXXEjfiRbWQfOUbOkTDCSBy5Ru6RZySNvCN5pIzUkTbSxw9QDAqhkIpRoRRaMSlmhVEsCqtYFU7hFZtiVxyKUxEUKKLiUtyKR5EUryIriqIqmqKrD9AMGqGRmlGjNFozaWaN0Swaq1k1TuM1m2bXHJpTEzRooubS3JpHkzSvJmuKpmqapusPmBgmxIScGCfUhJ6YJuYJM7FM2Il1wk34iW1inzgmzokwwUScuCbuiWciTbwTeaJM1Ik20acPmBlmxIycGWfUjJ6ZZuYZM7PM2Jl1xs34mW1mnzlmzpkww0ycuWbumWcmzbwzeabM1Jk20+cPMAwGYZCG0aAM2jAZZoMxLAZrWA3O4A2bYTcchtMQDBii4TLchseQDK8hG4qhGpqhmw9YGBbEglwYF9SCXpgW5gWzsCzYhXXBLfiFbWFfOBbOhbDAQly4Fu6FZyEtvAt5oSzUhbbQlw+wDBZhkZbRoizaMllmi7EsFmtZLc7iLZtltxyW0xIsWKLlstyWx5IsryVbiqVamqXbD1gZVsSKXBlX1IpemVbmFbOyrNiVdcWt+JVtZV85Vs6VsMJKXLlW7pVnJa28K3mlrNSVttLXD3AMDuGQjtGhHNoxOWaHcSwO61gdzuEdm2N3HI7TERw4ouNy3I7HkRyvIzuKozqao7sP8Awe4ZGe0aM82jN5Zo/xLB7rWT3O4z2bZ/ccntMTPHii5/LcnseTPK8ne4qnepqn+w/YGDbEhtwYN9SG3pg25g2zsWzYjXXDbfiNbWPfODbOjbDBRty4Nu6NZyNtvBt5o2zUjbbRtw/YGXbEjtwZd9SO3pl25h2zs+zYnXXH7fidbWffOXbOnbDDTty5du6dZyftvDt5p+zUnbbT9w84GA7EgTwYD9SBPpgO5gNzsBzYg/XAHfiD7WA/OA7Og3DAQTy4Du6D5yAdvAf5oBzUg3bQjw84GU7EiTwZT9SJPplO5hNzspzYk/XEnfiT7WQ/OU7Ok3DCSTy5Tu6T5ySdvCf5pJzUk3bSzw8IDAERkIExoAI6MAXmgAksARtYAy7gA1tgDxyBMxACBGLgCtyBJ5ACbyAHSqAGWqCHD/hffN9q+pbHF+9fAH8R+YXYFzNfEHyj+g3T1+5fQ34t833qV/avMN/Tv8v/T4QLbnggwQsZClRo0L+1/YsMERGRkTGiIjoyReaIiSwRG1kjLuIjW2SPHJEzEuL/9TFyRe7IE0mRN5IjJVIjLdLjB1wMF+JCXowX6kJfTBfzhblYLuzFeuEu/MV2sV8cF+dFuP4fHy+ui/viuUgX70W+KBf1ol306wNuhhtxI2/GG3Wjb6ab+cbcLDf2Zr1xN/5mu9lvjpvzJtz/pYk3181989ykm/cm35SbetNu+v0BD8ODeJAP44N60A/Tw/xgHpYH+7A+uAf/sD3sD8fD+RCe/8LHh+vhfnge0sP7kB/KQ31oD/35gMSQEAmZGBMqoRNTYk6YxJKwiTXhEj6xJfbEkTgTIf1/a0xciTvxJFLiTeRESdRES/T0AS/Di3iRL+OLetEv08v8Yl6WF/uyvrgX/7K97C/Hy/kS3v+miS/Xy/3yvKSX9yW/lJf60l76+wGZISMyMjNmVEZnpsycMZklYzNrxmV8ZsvsmSNzZkL+b8mYuTJ35smkzJvJmZKpmZbp+QMKQ0EUZGEsqIIuTIW5YApLwRbWgiv4wlbYC0fhLITy3/CxcBXuwlNIhbeQC6VQC63QywdUhoqoyMpYURVdmSpzxVSWiq2sFVfxla2yV47KWQn1f5xi5arclaeSKm8lV0qlVlql1w9oDA3RkI2xoRq6MTXmhmksDdtYG67hG1tjbxyNsxHa/7DGxtW4G08jNd5GbpRGbbRGbx/QGTqiIztjR3V0Z+rMHdNZOrazdlzHd7bO3jk6Zyf0/yiInatzd55O6ryd3Cmd2mmd3vkD4XNgW5DmDQMAAAAASUVORK5CYII=", + "base64", +); + +const LOGIN_PATH = "/login"; + +function onLoginPage(page) { + return new URL(page.url()).pathname.startsWith(LOGIN_PATH); +} + +async function gotoLogin(page) { + return gotoOnion(page, `${env.appBaseUrl}${LOGIN_PATH}`, { waitUntil: "domcontentloaded" }); +} + +function profileMenuTrigger(page) { + return page.locator('[data-testid="profile-menu-trigger"]').first(); +} + +async function assertAuthenticated(page, label) { + await expect + .poll(() => onLoginPage(page), { + timeout: resolveTimeout(60_000), + message: `${label}: expected to leave the OpenPost login page`, + }) + .toBe(false); + const onboarding = page.getByRole("heading", { name: /create your first workspace/i }); + await expect( + profileMenuTrigger(page).or(onboarding), + `${label}: the authenticated OpenPost desk or its first-run onboarding must render`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); + if (await onboarding.isVisible()) { + await page.getByLabel(/workspace name/i).fill(`${label} workspace`); + await page.getByRole("button", { name: /create workspace/i }).click(); + } + await expect( + profileMenuTrigger(page), + `${label}: the authenticated OpenPost profile menu must be visible`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); +} + +async function signInViaLocal(page, email, password, label) { + await gotoLogin(page); + await page.locator("#email").fill(email); + await page.locator("#password").fill(password); + await page.locator("form").filter({ has: page.locator("#password") }).locator('button[type="submit"]').click(); + await assertAuthenticated(page, label); +} + +function oidcProviderButton(page) { + return page.locator("a, button").filter({ hasText: /sso|single sign-on|keycloak/i }).first(); +} + +async function signInViaOidc(page, username, password, label) { + await gotoLogin(page); + const button = oidcProviderButton(page); + await expect(button, `${label}: the Keycloak sign-in button must render on the OpenPost login page`).toBeVisible({ + timeout: resolveTimeout(30_000), + }); + await button.click(); + await expect + .poll(() => page.url(), { + timeout: resolveTimeout(60_000), + message: `${label}: expected redirect to Keycloak (${env.oidcIssuerUrl}/protocol/openid-connect/auth)`, + }) + .toContain(`${env.oidcIssuerUrl}/protocol/openid-connect/auth`); + await performKeycloakLoginForm(page, username, password); + await assertAuthenticated(page, label); +} + +async function logout(page, label) { + await profileMenuTrigger(page).click(); + await page.getByRole("menuitem", { name: /log\s*out|sign\s*out/i }).click(); + await expect + .poll(() => onLoginPage(page), { + timeout: resolveTimeout(60_000), + message: `${label}: expected logged-out landing on the OpenPost login page`, + }) + .toBe(true); +} + +async function openUsersPanel(page) { + await gotoOnion(page, `${env.appBaseUrl}/settings?tab=users`, { waitUntil: "domcontentloaded" }); + await expect(page.locator('[data-testid="settings-navigation"]')).toBeVisible({ timeout: resolveTimeout(60_000) }); +} + +async function openInstanceAdministration(page, label) { + await openUsersPanel(page); + await expect( + page.locator('[data-testid="instance-user-directory"]'), + `${label}: the instance user directory must render for an instance admin`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); + await expect( + page.locator('[data-testid="instance-user-directory"]').getByText(env.breakglassEmail).first(), + `${label}: the instance user directory must list the break-glass admin`, + ).toBeVisible({ timeout: resolveTimeout(30_000) }); +} + +async function assertInstanceAdministrationDenied(page, label) { + await openUsersPanel(page); + await expect( + page.locator('[data-testid="instance-admin-users"]'), + `${label}: the instance user directory must stay hidden from a regular user`, + ).toHaveCount(0); + await expect( + page.locator('[data-testid="settings-navigation"]').getByText(/^instance$/i), + `${label}: the settings navigation must not offer the instance section`, + ).toHaveCount(0); +} + +async function openComposer(page, label) { + await page.locator('[data-testid="sidebar-new-post"]').click(); + await expect( + page.locator('[contenteditable="true"], textarea').first(), + `${label}: the composer must open with an editable text area`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); +} + +async function assertWorkspaceHidden(page, workspaceName, label) { + expect(workspaceName, "ORGANISATION_WORKSPACE must be set").toBeTruthy(); + await gotoOnion(page, `${env.appBaseUrl}/`, { waitUntil: "domcontentloaded" }); + await page.locator('[data-testid="workspace-menu-trigger"]').click(); + const menu = page.getByRole("menu"); + await expect(menu, `${label}: the workspace switcher must open`).toBeVisible({ timeout: resolveTimeout(30_000) }); + await expect( + menu.getByText(workspaceName, { exact: true }), + `${label}: the organisation workspace "${workspaceName}" must not be offered`, + ).toHaveCount(0); + await page.keyboard.press("Escape"); +} + +function crc32(buffer) { + let crc = 0xffffffff; + for (const byte of buffer) { + crc ^= byte; + for (let bit = 0; bit < 8; bit += 1) { + crc = (crc >>> 1) ^ (0xedb88320 & -(crc & 1)); + } + } + return (crc ^ 0xffffffff) >>> 0; +} + +function uniquePng(text) { + const data = Buffer.concat([Buffer.from("Comment\0", "latin1"), Buffer.from(text, "latin1")]); + const type = Buffer.from("tEXt", "latin1"); + const length = Buffer.alloc(4); + length.writeUInt32BE(data.length); + const checksum = Buffer.alloc(4); + checksum.writeUInt32BE(crc32(Buffer.concat([type, data]))); + const iend = SAMPLE_PNG.length - 12; + return Buffer.concat([SAMPLE_PNG.subarray(0, iend), length, type, data, checksum, SAMPLE_PNG.subarray(iend)]); +} + +async function uploadMedia(page, fileName, label) { + await gotoOnion(page, `${env.appBaseUrl}/media`, { waitUntil: "domcontentloaded" }); + const addMedia = page.getByRole("button", { name: /add media/i }); + await expect(addMedia, `${label}: the media library must offer "Add media"`).toBeVisible({ + timeout: resolveTimeout(60_000), + }); + await addMedia.click(); + const dialog = page.getByRole("dialog", { name: /upload media/i }); + await expect(dialog, `${label}: the upload dialog must open`).toBeVisible({ timeout: resolveTimeout(30_000) }); + await dialog.locator('input[type="file"]').first().setInputFiles({ + name: fileName, + mimeType: "image/png", + buffer: uniquePng(fileName), + }); + const confirm = dialog.getByRole("button", { name: /^(upload|add|save)/i }); + if (await confirm.first().isVisible().catch(() => false)) { + await confirm.first().click(); + } + await expect( + dialog.getByText(fileName).first(), + `${label}: the upload dialog must list the file it received`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); + if (await dialog.isVisible().catch(() => false)) { + await page.keyboard.press("Escape"); + } + await expect(dialog, `${label}: the upload dialog must close`).toBeHidden({ timeout: resolveTimeout(30_000) }); + await expect( + page.getByText(fileName).or(page.locator(`img[alt*="${fileName}"]`)).first(), + `${label}: the uploaded file must appear in the media library`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); +} + +async function openMastodonConnectDialog(page, label) { + await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + const card = page.locator('[data-testid="provider-card-mastodon"]'); + await expect(card, `${label}: the Mastodon provider card must render`).toBeVisible({ timeout: resolveTimeout(60_000) }); + await card.getByRole("button", { name: /^connect$/i }).click(); + const dialog = page.getByRole("dialog", { name: /connect mastodon/i }); + await dialog.getByRole("button", { name: /continue to mastodon/i }).click(); + await dialog.getByRole("textbox", { name: /server address/i }).fill(env.mastodonBaseUrl); + return dialog; +} + +function mastodonChannelActions(page, account) { + return page.getByRole("button", { name: new RegExp(`^actions for ${account.handle} · mastodon$`, "i") }); +} + +async function disconnectAccount(page, account) { + await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + await expect(page.getByRole("heading", { name: /connected channels/i })).toBeVisible({ timeout: resolveTimeout(60_000) }); + const actions = mastodonChannelActions(page, account); + if (!(await actions.isVisible())) { + return; + } + await actions.click(); + await page.getByRole("menuitem", { name: /remove connection/i }).click(); + const confirm = page.getByRole("alertdialog").or(page.getByRole("dialog")).first(); + await expect(confirm, `${account.handle}: OpenPost must ask before removing the connection`).toBeVisible({ + timeout: resolveTimeout(30_000), + }); + await confirm.getByRole("button", { name: /^remove connection$/i }).click(); + await expect(actions, `${account.handle} must disappear from the connected channels`).toBeHidden({ + timeout: resolveTimeout(60_000), + }); +} + +async function connectMastodonAccount(page, context, label) { + const account = { handle: `@${env.adminUsername}` }; + await disconnectAccount(page, account); + const dialog = await openMastodonConnectDialog(page, label); + await dialog.getByRole("button", { name: /^connect$/i }).click(); + await expect + .poll(() => page.url(), { timeout: resolveTimeout(60_000), message: `${label}: expected Mastodon's sign-in page` }) + .toContain(`${env.mastodonBaseUrl}/auth/sign_in`); + await page.getByRole("link", { name: /sso|single sign-on/i }).click(); + await page.waitForLoadState("domcontentloaded"); + if (page.url().includes(`${env.oidcIssuerUrl}/protocol/openid-connect/auth`)) { + await performKeycloakLoginForm(page, env.adminUsername, env.adminPassword); + } + const authorize = page.getByRole("button", { name: /^authorize$/i }); + await expect + .poll(async () => page.url().includes("/oauth/authorize/native") || (await authorize.isVisible()), { + timeout: resolveTimeout(60_000), + message: `${label}: expected Mastodon's consent screen or its authorization code page`, + }) + .toBe(true); + if (await authorize.isVisible()) { + await authorize.click(); + } + await expect + .poll(() => page.url(), { timeout: resolveTimeout(60_000), message: `${label}: expected Mastodon's authorization code page` }) + .toContain(`${env.mastodonBaseUrl}/oauth/authorize/native`); + const code = await page.getByRole("textbox").first().inputValue(); + expect(code, `${label}: Mastodon must show an authorization code`).toBeTruthy(); + + const codeDialog = await openMastodonConnectDialog(page, label); + await codeDialog.getByRole("button", { name: /^code$/i }).click(); + await page.getByRole("textbox", { name: /authorization code/i }).fill(code); + await page.getByRole("button", { name: /connect account/i }).click(); + await expect + .poll(() => new URL(page.url()).pathname, { + timeout: resolveTimeout(60_000), + message: `${label}: OpenPost must leave the code page after the exchange`, + }) + .not.toContain("/accounts/mastodon/callback"); + await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + await expect( + mastodonChannelActions(page, account), + `${label}: ${account.handle} must be listed among the connected channels`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); + return account; +} + +async function publishNow(page, account, text, label) { + await page.getByRole("link", { name: /^new post$/i }).click(); + await page.getByRole("textbox", { name: /post text/i }).first().fill(text); + await page.getByRole("main").getByRole("button", { name: /^more$/i }).click(); + await page.getByRole("menuitem", { name: /^publish now$/i }).click(); + const confirm = page.getByRole("alertdialog").or(page.getByRole("dialog")); + if (await confirm.first().isVisible().catch(() => false)) { + await confirm.first().getByRole("button", { name: /publish/i }).first().click(); + } +} + +async function mastodonStatusExists(page, account, marker) { + const handle = account.handle.replace(/^@/, ""); + const lookup = await page.request.get(`${env.mastodonBaseUrl}/api/v1/accounts/lookup?acct=${encodeURIComponent(handle)}`); + if (!lookup.ok()) { + return false; + } + const { id } = await lookup.json(); + const statuses = await page.request.get(`${env.mastodonBaseUrl}/api/v1/accounts/${id}/statuses?limit=20`); + if (!statuses.ok()) { + return false; + } + return (await statuses.json()).some((status) => String(status.content || "").includes(marker)); +} + +async function beforeEach({ page }) { + await page.setViewportSize({ width: 1440, height: 1100 }); + expect(env.appBaseUrl, "APP_BASE_URL must be set").toBeTruthy(); + expect(env.canonicalDomain, "CANONICAL_DOMAIN must be set").toBeTruthy(); + await page.context().clearCookies(); +} + +module.exports = { + env, + LOGIN_PATH, + gotoLogin, + onLoginPage, + assertAuthenticated, + signInViaLocal, + signInViaOidc, + oidcProviderButton, + openInstanceAdministration, + assertInstanceAdministrationDenied, + openComposer, + assertWorkspaceHidden, + uploadMedia, + connectMastodonAccount, + disconnectAccount, + publishNow, + mastodonStatusExists, + logout, + beforeEach, + skipUnlessServiceEnabled, +}; From 5a5c90ab5b47766864c7120789f2e7818683a420 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 045/554] test(web-app-openpost): add guest scenario --- .../files/playwright/test-guest.js | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-guest.js diff --git a/roles/web-app-openpost/files/playwright/test-guest.js b/roles/web-app-openpost/files/playwright/test-guest.js new file mode 100644 index 0000000000..3438a8ee82 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-guest.js @@ -0,0 +1,51 @@ +const { test, expect } = require("@playwright/test"); +const { resolveTimeout } = require("./timeouts"); + +const { assertCspResponseHeader, assertCspMetaParity, gotoOnion } = require("./personas"); +const { isServiceEnabled } = require("./service-gating"); + +exports.register = function (shared) { + test("guest: login serves CSP, refuses wrong and empty credentials, never reaches the desk", async ({ page }) => { + test.setTimeout(resolveTimeout(90_000)); // optional Keycloak round-trip for the IdP rejection + const response = await shared.gotoLogin(page); + expect(response, "Expected an OpenPost login response").toBeTruthy(); + expect(response.status(), "Expected the OpenPost login status to be < 400").toBeLessThan(400); + expect( + response.url().includes(shared.env.canonicalDomain), + `Expected canonical domain "${shared.env.canonicalDomain}" to back the OpenPost URL`, + ).toBe(true); + + const directives = assertCspResponseHeader(response, "openpost login"); + await assertCspMetaParity(page, directives, "openpost login"); + + await page.locator("#email").fill("guest@invalid.example"); + await page.locator("#password").fill("not-a-valid-password"); + await page.locator("form").filter({ has: page.locator("#password") }).locator('button[type="submit"]').click(); + await expect(page.getByRole("alert").or(page.locator('[role="status"], .text-destructive')).first(), + "guest: wrong credentials must produce a visible error").toBeVisible({ timeout: resolveTimeout(30_000) }); + expect(shared.onLoginPage(page), "guest must remain on the login page after a rejected sign-in").toBe(true); + + await gotoOnion(page, `${shared.env.appBaseUrl}/settings`, { waitUntil: "domcontentloaded" }); + await expect + .poll(() => shared.onLoginPage(page), { + timeout: resolveTimeout(30_000), + message: "guest hitting /settings must be forced back to the login page", + }) + .toBe(true); + + if (isServiceEnabled("sso")) { + await shared.oidcProviderButton(page).click(); + await expect + .poll(() => page.url(), { timeout: resolveTimeout(60_000), message: "guest: expected the Keycloak login form" }) + .toContain(`${shared.env.oidcIssuerUrl}/protocol/openid-connect/auth`); + await page.locator("#kc-login, input[type='submit'], button[type='submit']").first().click(); + await expect(page.locator("#username, input[name='username']").first(), + "guest: Keycloak must reject the empty submission and keep its login form").toBeVisible({ + timeout: resolveTimeout(30_000), + }); + expect(page.url(), "guest: an empty Keycloak submission must not return to OpenPost").toContain( + shared.env.oidcIssuerUrl, + ); + } + }); +}; From 252a0240cd83783954f63aa6945b3a0327c69602 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:00 +0200 Subject: [PATCH 046/554] test(web-app-openpost): add break-glass admin scenario --- .../playwright/test-login-native-administrator.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-login-native-administrator.js diff --git a/roles/web-app-openpost/files/playwright/test-login-native-administrator.js b/roles/web-app-openpost/files/playwright/test-login-native-administrator.js new file mode 100644 index 0000000000..bc999efffe --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-login-native-administrator.js @@ -0,0 +1,14 @@ +const { test, expect } = require("@playwright/test"); +const { resolveTimeout } = require("./timeouts"); + +exports.register = function (shared) { + test("administrator: break-glass password login reaches the instance administration", async ({ page }) => { + test.setTimeout(resolveTimeout(90_000)); // cold SvelteKit bundle plus the instance settings fetch + expect(shared.env.breakglassEmail, "BREAKGLASS_EMAIL must be set").toBeTruthy(); + expect(shared.env.breakglassPassword, "BREAKGLASS_PASSWORD must be set").toBeTruthy(); + + await shared.signInViaLocal(page, shared.env.breakglassEmail, shared.env.breakglassPassword, "administrator-native"); + await shared.openInstanceAdministration(page, "administrator-native"); + await shared.logout(page, "administrator-native"); + }); +}; From b0c5ff3c74acbbcf65159373e97cfc039383b0fa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:01 +0200 Subject: [PATCH 047/554] test(web-app-openpost): add oidc admin scenario --- .../playwright/test-login-oidc-administrator.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js diff --git a/roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js b/roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js new file mode 100644 index 0000000000..7f5b26b168 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js @@ -0,0 +1,15 @@ +const { test, expect } = require("@playwright/test"); +const { resolveTimeout } = require("./timeouts"); + +exports.register = function (shared) { + test("administrator: Keycloak login provisions an instance admin who reaches the instance administration", async ({ page }) => { + shared.skipUnlessServiceEnabled("sso"); + test.setTimeout(resolveTimeout(120_000)); // OIDC round-trip via Keycloak plus just-in-time provisioning + expect(shared.env.adminUsername, "ADMIN_USERNAME must be set").toBeTruthy(); + expect(shared.env.adminPassword, "ADMIN_PASSWORD must be set").toBeTruthy(); + + await shared.signInViaOidc(page, shared.env.adminUsername, shared.env.adminPassword, "administrator"); + await shared.openInstanceAdministration(page, "administrator"); + await shared.logout(page, "administrator"); + }); +}; From 5af26198dac72784cb69c0c95816ecb8a7c649b2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:01 +0200 Subject: [PATCH 048/554] test(web-app-openpost): add oidc biber scenario --- .../files/playwright/test-login-oidc-biber.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-login-oidc-biber.js diff --git a/roles/web-app-openpost/files/playwright/test-login-oidc-biber.js b/roles/web-app-openpost/files/playwright/test-login-oidc-biber.js new file mode 100644 index 0000000000..32d9602f63 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-login-oidc-biber.js @@ -0,0 +1,17 @@ +const { test, expect } = require("@playwright/test"); +const { resolveTimeout } = require("./timeouts"); + +exports.register = function (shared) { + test("biber: Keycloak login opens the composer but never the organisation workspace", async ({ page }) => { + shared.skipUnlessServiceEnabled("sso"); + test.setTimeout(resolveTimeout(120_000)); // OIDC round-trip via Keycloak plus just-in-time provisioning + expect(shared.env.biberUsername, "BIBER_USERNAME must be set").toBeTruthy(); + expect(shared.env.biberPassword, "BIBER_PASSWORD must be set").toBeTruthy(); + + await shared.signInViaOidc(page, shared.env.biberUsername, shared.env.biberPassword, "biber"); + await shared.openComposer(page, "biber"); + await shared.assertWorkspaceHidden(page, shared.env.organisationWorkspace, "biber"); + await shared.assertInstanceAdministrationDenied(page, "biber"); + await shared.logout(page, "biber"); + }); +}; From b922370487624fcffa804172fc6273571b7e8f18 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:01 +0200 Subject: [PATCH 049/554] test(web-app-openpost): add mastodon publish scenario --- .../files/playwright/test-publish-mastodon.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-publish-mastodon.js diff --git a/roles/web-app-openpost/files/playwright/test-publish-mastodon.js b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js new file mode 100644 index 0000000000..1dac4b5edb --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js @@ -0,0 +1,26 @@ +const { test, expect } = require("@playwright/test"); +const { resolveTimeout } = require("./timeouts"); + +exports.register = function (shared) { + test("administrator: connects the local Mastodon account through the OOB code flow and publishes to it", async ({ page, context }) => { + shared.skipUnlessServiceEnabled("sso"); + shared.skipUnlessServiceEnabled("mastodon"); + test.setTimeout(resolveTimeout(300_000)); // two Keycloak logins, Mastodon OAuth approval and the publishing worker round-trip + const marker = `openpost-e2e ${Date.now()}`; + + await shared.signInViaOidc(page, shared.env.adminUsername, shared.env.adminPassword, "administrator"); + const account = await shared.connectMastodonAccount(page, context, "administrator"); + try { + await shared.publishNow(page, account, marker, "administrator"); + await expect + .poll(() => shared.mastodonStatusExists(page, account, marker), { + timeout: resolveTimeout(180_000), + message: `administrator: expected "${marker}" on ${shared.env.mastodonBaseUrl}`, + }) + .toBe(true); + } finally { + await shared.disconnectAccount(page, account).catch((error) => console.warn(`cleanup: ${error.message}`)); + } + await shared.logout(page, "administrator"); + }); +}; From 6744e8c35afefc9e12e4a3ec9e01d3f2a7d03e1b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:01 +0200 Subject: [PATCH 050/554] test(web-app-openpost): add seaweedfs storage scenario --- .../files/playwright/test-seaweedfs.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-seaweedfs.js diff --git a/roles/web-app-openpost/files/playwright/test-seaweedfs.js b/roles/web-app-openpost/files/playwright/test-seaweedfs.js new file mode 100644 index 0000000000..84da33bb0f --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-seaweedfs.js @@ -0,0 +1,21 @@ +const { test } = require("@playwright/test"); +const { resolveTimeout, isOnionTarget } = require("./timeouts"); +const { runSeaweedfsStorageCheck } = require("./personas"); + +exports.register = function (shared) { + test("seaweedfs: an image uploaded to the OpenPost media library is stored in the SeaweedFS bucket", async ({ page, browser }) => { + test.skip(isOnionTarget(), "SeaweedFS filer UI is not a Tor surface on an onion node (headless backend)"); + shared.skipUnlessServiceEnabled("seaweedfs"); + shared.skipUnlessServiceEnabled("sso"); + test.setTimeout(resolveTimeout(300_000)); // Filer UI admin login, OIDC login and the upload round-trip + + await runSeaweedfsStorageCheck(page, browser, { + label: "an OpenPost media library upload", + action: async (appPage) => { + await shared.signInViaOidc(appPage, shared.env.adminUsername, shared.env.adminPassword, "administrator"); + await shared.uploadMedia(appPage, `infinito-storage-check-${Date.now()}.png`, "administrator"); + await shared.logout(appPage, "administrator"); + }, + }); + }); +}; From cac7fa897a1ed774b9ed80f1366df84b0e8110b1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 22 Oct 2026 02:03:01 +0200 Subject: [PATCH 051/554] test(web-app-openpost): add playwright spec --- .../files/playwright/playwright.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/playwright.spec.js diff --git a/roles/web-app-openpost/files/playwright/playwright.spec.js b/roles/web-app-openpost/files/playwright/playwright.spec.js new file mode 100644 index 0000000000..d266b47324 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/playwright.spec.js @@ -0,0 +1,16 @@ +const { test } = require("@playwright/test"); + +const shared = require("./_shared"); + +test.use({ + ignoreHTTPSErrors: true, +}); + +test.beforeEach(shared.beforeEach); + +require("./test-guest").register(shared); +require("./test-login-native-administrator").register(shared); +require("./test-login-oidc-administrator").register(shared); +require("./test-login-oidc-biber").register(shared); +require("./test-publish-mastodon").register(shared); +require("./test-seaweedfs").register(shared); From e79a78608c16afe232afe509d77e6f327afeb064 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:33 +0200 Subject: [PATCH 052/554] fix(web-app-openpost): pin the encryption key against rotation --- roles/web-app-openpost/meta/secrets.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/secrets.yml b/roles/web-app-openpost/meta/secrets.yml index 7c91d4d5b2..6863baf121 100644 --- a/roles/web-app-openpost/meta/secrets.yml +++ b/roles/web-app-openpost/meta/secrets.yml @@ -4,8 +4,9 @@ credentials: description: Secret OpenPost signs its session and API JWTs with (OPENPOST_JWT_SECRET); upstream requires at least 32 characters. algorithm: alphanumeric encryption_key: - description: Key OpenPost encrypts stored provider tokens and provider-app secrets with (OPENPOST_ENCRYPTION_KEY); rotating it requires the upstream previous-keys procedure. + description: Key OpenPost encrypts stored provider tokens and provider-app secrets with (OPENPOST_ENCRYPTION_KEY); OpenPost refuses to start once stored rows no longer decrypt, so rotating it requires the upstream previous-keys procedure. algorithm: alphanumeric + rotatable: false media_signing_key: description: Key OpenPost signs short-lived media URLs with (OPENPOST_MEDIA_SIGNING_KEY), pinned apart from the encryption key so a key rotation keeps media links valid. algorithm: alphanumeric From 61bb486242b651ec77f2c60a0a1fbb9070a8de7f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:33 +0200 Subject: [PATCH 053/554] feat(web-app-openpost): add break-glass password realign query --- roles/web-app-openpost/files/sql/breakglass/password.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/breakglass/password.sql diff --git a/roles/web-app-openpost/files/sql/breakglass/password.sql b/roles/web-app-openpost/files/sql/breakglass/password.sql new file mode 100644 index 0000000000..17bd2a6648 --- /dev/null +++ b/roles/web-app-openpost/files/sql/breakglass/password.sql @@ -0,0 +1,4 @@ +UPDATE users + SET password_hash = %(password_hash)s + WHERE lower(email) = lower(%(email)s) + AND password_hash IS DISTINCT FROM %(password_hash)s; From 8a52ca7497cfc51078efe1076b3dea681971343d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:33 +0200 Subject: [PATCH 054/554] fix(web-app-openpost): realign a rotated break-glass password --- .../web-app-openpost/tasks/03_breakglass.yml | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/roles/web-app-openpost/tasks/03_breakglass.yml b/roles/web-app-openpost/tasks/03_breakglass.yml index 68b0f41b44..2108d3e5f6 100644 --- a/roles/web-app-openpost/tasks/03_breakglass.yml +++ b/roles/web-app-openpost/tasks/03_breakglass.yml @@ -39,23 +39,55 @@ changed_when: openpost_breakglass_register.status == 200 when: openpost_breakglass_login.status == 401 -- name: "❌ Fail when the break-glass account can neither sign in nor be created" - ansible.builtin.fail: - msg: >- - OpenPost refused both the break-glass sign-in and its registration - (HTTP {{ openpost_breakglass_register.status }}). Another account already - became the first instance admin, or the break-glass password was changed in - the UI; follow the break-glass procedure in Administration.md. +- name: "🔐 Realign the password of the existing break-glass account with the inventory" + database_query: + config: "{{ lookup('database', application_id) }}" + query_file: "{{ role_path }}/files/sql/breakglass/password.sql" + named_args: + email: "{{ OPENPOST_ADMIN_EMAIL }}" + password_hash: "{{ OPENPOST_ADMIN_PASSWORD | bcrypt_hash(application_id ~ ':breakglass') }}" + mask_values: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + register: openpost_breakglass_realign + changed_when: openpost_breakglass_realign.stdout is search('UPDATE [1-9]') + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" when: - openpost_breakglass_login.status == 401 - openpost_breakglass_register.status != 200 +- name: "🔑 Sign in as the break-glass instance admin with the realigned password" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/auth/login" + method: POST + headers: "{{ OPENPOST_API_HEADERS }}" + body_format: json + body: + email: "{{ OPENPOST_ADMIN_EMAIL }}" + password: "{{ OPENPOST_ADMIN_PASSWORD }}" + status_code: [200, 401] + register: openpost_breakglass_relogin + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + changed_when: false + when: openpost_breakglass_realign is not skipped + +- name: "❌ Fail when the break-glass account can neither sign in nor be created" + ansible.builtin.fail: + msg: >- + OpenPost refused the break-glass sign-in, its registration (HTTP + {{ openpost_breakglass_register.status }}) and the sign-in after the password + realignment. Another account already became the first instance admin; follow + the break-glass procedure in Administration.md. + when: + - openpost_breakglass_login.status == 401 + - openpost_breakglass_register.status != 200 + - openpost_breakglass_relogin.status != 200 + - name: "🔐 Keep the break-glass session headers for the following API calls" ansible.builtin.set_fact: openpost_breakglass_headers: >- {{ OPENPOST_API_HEADERS | combine({'Authorization': 'Bearer ' ~ - (openpost_breakglass_register.json.token if openpost_breakglass_login.status == 401 - else openpost_breakglass_login.json.token)}) }} + (openpost_breakglass_login.json.token if openpost_breakglass_login.status == 200 + else openpost_breakglass_register.json.token if openpost_breakglass_register.status == 200 + else openpost_breakglass_relogin.json.token)}) }} no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "🔍 List the workspaces of the break-glass instance admin" From 997da0ff28a996dbb878db5cbc90cfada3bcc2fb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:33 +0200 Subject: [PATCH 055/554] feat(web-app-openpost): simulate tiktok and linkedin --- roles/web-app-openpost/meta/services.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index 1dc062ef2f..936529aff7 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -68,6 +68,8 @@ openpost: version: "v7.22.9" update: type: registry_tags + image: ghcr.io/getopenpost/openpost + match: "v" name: openpost cpus: 1.0 mem_reservation: 256m @@ -140,10 +142,15 @@ simulator: - graph.instagram.com - oauth2.googleapis.com - www.googleapis.com + - open.tiktokapis.com + - www.linkedin.com + - api.linkedin.com providers: - x - meta - youtube + - tiktok + - linkedin # nocheck: playwright-service-flag # nocheck: variants-coverage — sso-variant-tor requires the onion on in every variant, so the false polarity has no variant left to live in From c46bcb0d534f56a985d5aa3c07f992f99c089d1f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:34 +0200 Subject: [PATCH 056/554] feat(web-app-openpost): extend the provider simulator --- .../files/simulator/openpost.json | 350 +++++++++++++++++- 1 file changed, 344 insertions(+), 6 deletions(-) diff --git a/roles/web-app-openpost/files/simulator/openpost.json b/roles/web-app-openpost/files/simulator/openpost.json index a566e855a2..7b9ce02dbd 100644 --- a/roles/web-app-openpost/files/simulator/openpost.json +++ b/roles/web-app-openpost/files/simulator/openpost.json @@ -323,6 +323,25 @@ "url": "" } } + }, + { + "id": "525252", + "name": "OpenPost Simulator Second Page", + "username": "openpostsimulatorsecond", + "access_token": "simulator-second-page-token", + "tasks": [ + "ADVERTISE", + "ANALYZE", + "CREATE_CONTENT", + "MESSAGING", + "MODERATE", + "MANAGE" + ], + "picture": { + "data": { + "url": "" + } + } } ], "paging": {} @@ -350,7 +369,7 @@ "name": "facebook-feed", "request": { "method": "POST", - "urlPathPattern": "/v[0-9.]+/424242/feed" + "urlPathPattern": "/v[0-9.]+/(424242|525252)/feed" }, "response": { "status": 200, @@ -358,8 +377,11 @@ "Content-Type": "application/json" }, "jsonBody": { - "id": "424242_1001" - } + "id": "{{request.pathSegments.[1]}}_1001" + }, + "transformers": [ + "response-template" + ] } }, { @@ -462,7 +484,7 @@ "refresh_token": "simulator-google-refresh", "expires_in": 3599, "token_type": "Bearer", - "scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.upload" + "scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/youtube.upload" } } }, @@ -519,6 +541,53 @@ } } }, + { + "name": "youtube-playlists", + "request": { + "method": "GET", + "urlPath": "/youtube/v3/playlists" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "items": [ + { + "id": "PLsimulator", + "snippet": { + "title": "OpenPost Simulator Playlist" + } + } + ] + } + } + }, + { + "name": "youtube-video-categories", + "request": { + "method": "GET", + "urlPath": "/youtube/v3/videoCategories" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "items": [ + { + "id": "22", + "snippet": { + "assignable": true, + "title": "People & Blogs" + } + } + ] + } + } + }, { "name": "youtube-upload-session", "request": { @@ -533,8 +602,11 @@ "response": { "status": 200, "headers": { - "Location": "https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&upload_id=simulator-upload" - } + "Location": "{{request.baseUrl}}/upload/youtube/v3/videos?uploadType=resumable&upload_id=simulator-upload" + }, + "transformers": [ + "response-template" + ] } }, { @@ -589,6 +661,272 @@ } } }, + { + "name": "tiktok-token", + "request": { + "method": "POST", + "urlPath": "/v2/oauth/token/" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "access_token": "simulator-tiktok-token", + "refresh_token": "simulator-tiktok-refresh", + "expires_in": 86400, + "refresh_expires_in": 31536000, + "token_type": "Bearer", + "scope": "user.info.basic,user.info.profile,user.info.stats,video.list,video.publish,video.upload", + "open_id": "simulator-tiktok-open-id" + } + } + }, + { + "name": "tiktok-user-info", + "request": { + "method": "GET", + "urlPath": "/v2/user/info/" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "user": { + "open_id": "simulator-tiktok-open-id", + "union_id": "simulator-tiktok-union-id", + "display_name": "OpenPost Simulator", + "username": "openpost_simulator", + "avatar_url": "" + } + }, + "error": { + "code": "ok", + "message": "", + "log_id": "simulator" + } + } + } + }, + { + "name": "tiktok-creator-info", + "request": { + "method": "POST", + "urlPath": "/v2/post/publish/creator_info/query/" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "creator_avatar_url": "", + "creator_username": "openpost_simulator", + "creator_nickname": "OpenPost Simulator", + "privacy_level_options": ["PUBLIC_TO_EVERYONE", "MUTUAL_FOLLOW_FRIENDS", "SELF_ONLY"], + "comment_disabled": false, + "duet_disabled": false, + "stitch_disabled": false, + "max_video_post_duration_sec": 600 + }, + "error": { + "code": "ok", + "message": "", + "log_id": "simulator" + } + } + } + }, + { + "name": "tiktok-video-init", + "request": { + "method": "POST", + "urlPath": "/v2/post/publish/video/init/" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "publish_id": "v_pub_url~simulator-video" + }, + "error": { + "code": "ok", + "message": "", + "log_id": "simulator" + } + } + } + }, + { + "name": "tiktok-photo-init", + "request": { + "method": "POST", + "urlPath": "/v2/post/publish/content/init/" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "publish_id": "p_pub_url~simulator-photo" + }, + "error": { + "code": "ok", + "message": "", + "log_id": "simulator" + } + } + } + }, + { + "name": "tiktok-publish-status", + "request": { + "method": "POST", + "urlPath": "/v2/post/publish/status/fetch/" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "status": "PUBLISH_COMPLETE", + "publicaly_available_post_id": ["7300000000000000001"] + }, + "error": { + "code": "ok", + "message": "", + "log_id": "simulator" + } + } + } + }, + { + "name": "tiktok-video-list", + "request": { + "method": "ANY", + "urlPath": "/v2/video/list/" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "data": { + "videos": [], + "cursor": 0, + "has_more": false + }, + "error": { + "code": "ok", + "message": "", + "log_id": "simulator" + } + } + } + }, + { + "name": "linkedin-token", + "request": { + "method": "POST", + "urlPath": "/oauth/v2/accessToken" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "access_token": "simulator-linkedin-token", + "expires_in": 5183999, + "refresh_token": "simulator-linkedin-refresh", + "refresh_token_expires_in": 31535999, + "scope": "openid,profile,w_member_social" + } + } + }, + { + "name": "linkedin-userinfo", + "request": { + "method": "GET", + "urlPath": "/v2/userinfo" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "sub": "simulatorlinkedin", + "name": "OpenPost Simulator", + "given_name": "OpenPost", + "picture": "" + } + } + }, + { + "name": "linkedin-image-upload-init", + "request": { + "method": "POST", + "urlPath": "/rest/images", + "queryParameters": { + "action": { + "equalTo": "initializeUpload" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "value": { + "uploadUrlExpiresAt": 4102444800000, + "uploadUrl": "{{request.baseUrl}}/simulator-upload/image", + "image": "urn:li:image:simulator" + } + }, + "transformers": [ + "response-template" + ] + } + }, + { + "name": "linkedin-image-upload", + "request": { + "method": "PUT", + "urlPath": "/simulator-upload/image" + }, + "response": { + "status": 201 + } + }, + { + "name": "linkedin-post", + "request": { + "method": "POST", + "urlPath": "/rest/posts" + }, + "response": { + "status": 201, + "headers": { + "x-restli-id": "urn:li:share:7300000000000000001" + } + } + }, { "name": "unmatched", "priority": 10, From f5b07ef57db598cffcbf0eedf8fc1b5125e606c8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:34 +0200 Subject: [PATCH 057/554] fix(web-app-openpost): pass provider json unquoted to swarm --- roles/web-app-openpost/templates/env.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/templates/env.j2 b/roles/web-app-openpost/templates/env.j2 index 41ae4d5824..c52d215cef 100644 --- a/roles/web-app-openpost/templates/env.j2 +++ b/roles/web-app-openpost/templates/env.j2 @@ -67,7 +67,7 @@ OPENPOST_SMTP_TLS_MODE={{ 'tls' if email.tls | bool else 'starttls' }} {% set _ = _servers.append({'name': _instance.url, 'instance_url': _instance.url, 'client_id': openpost_fediverse_apps[_instance.url].client_id, 'client_secret': openpost_fediverse_apps[_instance.url].client_secret}) %} {% endfor %} {% if _servers %} -{{ _platform | upper }}_SERVERS={{ _servers | to_json | dotenv_quote }} +{{ _platform | upper }}_SERVERS={{ _servers | to_json(separators=[',', ':']) | dotenv_quote }} {% endif %} {% endfor %} @@ -76,7 +76,7 @@ OPENPOST_SMTP_TLS_MODE={{ 'tls' if email.tls | bool else 'starttls' }} {{ _provider | upper }}_CLIENT_SECRET={{ OPENPOST_PROVIDER_CREDENTIALS[_provider].client_secret | dotenv_quote }} {% endfor %} {% if OPENPOST_PROVIDER_APPS | length > 0 %} -OPENPOST_PROVIDER_APPS={{ OPENPOST_PROVIDER_APPS | to_json | dotenv_quote }} +OPENPOST_PROVIDER_APPS={{ OPENPOST_PROVIDER_APPS | to_json(separators=[',', ':']) | dotenv_quote }} {% endif %} {% if OPENPOST_SIMULATOR_ENABLED | bool %} SSL_CERT_DIR={{ lookup('volume', application_id, 'simulator_ca').target | dirname }}:/etc/ssl/certs From d27390f5215b13af36e339ca71f59a513876e87d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:34 +0200 Subject: [PATCH 058/554] fix(web-app-openpost): give the break-glass admin a deliverable address --- roles/web-app-openpost/vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 924754bffe..72b9ba9d04 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -28,7 +28,7 @@ OPENPOST_TRUSTED_PROXY_CIDRS: >- OPENPOST_ADMIN_USERNAME: "{{ lookup('users', 'web-app-openpost-breakglass').username }}" OPENPOST_ADMIN_PASSWORD: "{{ lookup('users', 'web-app-openpost-breakglass').password }}" -OPENPOST_ADMIN_EMAIL: "{{ lookup('users', 'web-app-openpost-breakglass').email }}" +OPENPOST_ADMIN_EMAIL: "{{ lookup('users', 'administrator').email | regex_replace('@', '+' ~ OPENPOST_ADMIN_USERNAME ~ '@') }}" OPENPOST_ORGANISATION_WORKSPACE: "{{ SOFTWARE_NAME }}" OPENPOST_BOOTSTRAP_ADMINS: From cb7bdcdb4d8e8feb8bcc1db1d5430f81e88bca26 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:34 +0200 Subject: [PATCH 059/554] docs(web-app-openpost): describe the break-glass mail route --- roles/web-app-openpost/meta/users.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/web-app-openpost/meta/users.yml b/roles/web-app-openpost/meta/users.yml index 9510ce5ea9..0c2109f734 100644 --- a/roles/web-app-openpost/meta/users.yml +++ b/roles/web-app-openpost/meta/users.yml @@ -5,5 +5,4 @@ web-app-openpost-breakglass: password: algorithm: alphanumeric accounts: [] - forward: administrator - description: OpenPost local break-glass instance admin; not provisioned to IAM, mail forwards to the administrator mailbox + description: OpenPost local break-glass instance admin; not provisioned to IAM, its mail goes to a plus-address of the administrator mailbox From 434931311e7ae60ff6cb65c2015b8cb2788afe41 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:34 +0200 Subject: [PATCH 060/554] feat(web-app-peertube): seed the root password from the administrator --- roles/web-app-peertube/templates/env.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-peertube/templates/env.j2 b/roles/web-app-peertube/templates/env.j2 index 9192479b7f..29365794a0 100644 --- a/roles/web-app-peertube/templates/env.j2 +++ b/roles/web-app-peertube/templates/env.j2 @@ -24,6 +24,7 @@ PEERTUBE_LIVE_RTMP_PORT={{ PEERTUBE_RTMP_PORT }} {% endif %} PEERTUBE_SECRET={{ lookup('config', application_id, 'secrets.credentials.secret')}} +PT_INITIAL_ROOT_PASSWORD={{ lookup('users', 'administrator').password | dotenv_quote }} {% if lookup('objstore', application_id, 'enabled') | bool %} {% set objstore_bucket = lookup('objstore', application_id, 'bucket') %} From 59929208d76db2a79241e7061a670cfd8848005c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:35 +0200 Subject: [PATCH 061/554] docs(web-app-peertube): note the seeded root password --- roles/web-app-peertube/Setup.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/web-app-peertube/Setup.md b/roles/web-app-peertube/Setup.md index 1d79b1ccfe..7131e5a489 100644 --- a/roles/web-app-peertube/Setup.md +++ b/roles/web-app-peertube/Setup.md @@ -2,6 +2,9 @@ ## Change Root Administrator Password +A fresh instance creates the local `root` account with the platform administrator's password. +To change it later: + ```bash docker exec -it -u peertube peertube npm run reset-password -- -u root ``` From 14788f139d7cb7b1678c6510da4ad144eb6fa007 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:35 +0200 Subject: [PATCH 062/554] test(web-app-openpost): render the probe environment for the new checks --- roles/web-app-openpost/templates/test.env.j2 | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index 47d0cbef48..df80c5ae35 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -12,3 +12,25 @@ OPENPOST_SSO_ENABLED={{ OPENPOST_OIDC_ENABLED | bool | string | lower }} {% endfor %} OPENPOST_RELAY_TARGETS='{{ _targets | to_json }}' OPENPOST_RELAY_PORT={{ lookup('config', application_id, 'services.relay.ports.internal.https') }} +{% set _platforms = [] %} +{% for _provider in (lookup('config', application_id, 'services.simulator.providers') if OPENPOST_SIMULATOR_ENABLED | bool else []) %} +{% set _ = _platforms.extend(OPENPOST_PROVIDER_APP_KEYS[_provider] if _provider in OPENPOST_PROVIDER_APP_KEYS else [_provider]) %} +{% endfor %} +OPENPOST_SIMULATOR_PLATFORMS='{{ _platforms | to_json }}' +{% set _unconfigured = [] %} +{% for _provider in ['x', 'meta', 'threads', 'linkedin', 'youtube', 'tiktok'] if _provider not in OPENPOST_PROVIDER_CREDENTIALS %} +{% set _ = _unconfigured.extend(OPENPOST_PROVIDER_APP_KEYS[_provider] if _provider in OPENPOST_PROVIDER_APP_KEYS else [_provider]) %} +{% endfor %} +OPENPOST_UNCONFIGURED_PLATFORMS='{{ _unconfigured | to_json }}' +OPENPOST_S3_PUBLIC_URL={{ lookup('objstore', application_id, 'public_url') | regex_replace('/?$', '/') if OPENPOST_OBJSTORE_ENABLED | bool else '' }} +OPENPOST_SIMULATOR_HOST={{ OPENPOST_SIMULATOR_HOSTS | first }} +OPENPOST_DB_CONTAINER={{ lookup('database', application_id, 'address') }} +OPENPOST_DB_NAME={{ lookup('database', application_id, 'name') }} +OPENPOST_DB_USER={{ lookup('database', application_id, 'username') }} +OPENPOST_DB_PASSWORD_B64={{ lookup('database', application_id, 'password') | b64encode }} +OPENPOST_PEERTUBE_USERNAME=root +OPENPOST_PEERTUBE_PASSWORD_B64={{ lookup('users', 'administrator').password | b64encode }} +OPENPOST_MEMBER_EMAIL={{ lookup('users', 'administrator').email | regex_replace('@', '+openpost-cli-member@') }} +OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'administrator').password ~ ':' ~ application_id ~ ':cli-member') | hash('sha256') | b64encode }} +OPENPOST_SSO_ADMIN_EMAIL={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_OIDC_ENABLED | bool else '' }} +OPENPOST_MAIL_RECIPIENT={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_EMAIL_ENABLED | bool else '' }} From 4818db4690c75d02118b3f8c9b444e41925bcbfb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:35 +0200 Subject: [PATCH 063/554] test(web-app-openpost): add probe api helpers --- .../files/test/openpost_api.py | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 roles/web-app-openpost/files/test/openpost_api.py diff --git a/roles/web-app-openpost/files/test/openpost_api.py b/roles/web-app-openpost/files/test/openpost_api.py new file mode 100644 index 0000000000..817845a4aa --- /dev/null +++ b/roles/web-app-openpost/files/test/openpost_api.py @@ -0,0 +1,344 @@ +"""Env (rendered into test.env from templates/test.env.j2): +OPENPOST_LOCAL_URL published OpenPost origin on the stack host +OPENPOST_API_HEADERS_B64 base64 JSON of the Host and proto headers the proxy would send +OPENPOST_ADMIN_EMAIL break-glass instance admin e-mail +OPENPOST_ADMIN_PASSWORD_B64 base64 break-glass password +OPENPOST_RELAY_TARGETS JSON map of sibling platform to the domain the relay carries +OPENPOST_DEADLINE_SECONDS readiness budget, below the harness timeout +OPENPOST_PUBLIC_URL public origin served by the shared proxy +OPENPOST_SSO_ENABLED true when Keycloak provisions users, so the proxy closes password sign-up +OPENPOST_CONTAINER resolved OpenPost container, used to reach the simulator admin API +OPENPOST_SIMULATOR_PLATFORMS JSON list of OpenPost platforms served by the provider simulator, empty without it +OPENPOST_SIMULATOR_HOST one simulator alias, whose /__admin API holds the request journal +OPENPOST_UNCONFIGURED_PLATFORMS JSON list of commercial platforms without credentials, which must not connect +OPENPOST_S3_PUBLIC_URL public bucket URL with a trailing slash, empty when media stays in the role volume +OPENPOST_DB_CONTAINER resolved Postgres container +OPENPOST_DB_NAME OpenPost database name +OPENPOST_DB_USER OpenPost database user +OPENPOST_DB_PASSWORD_B64 base64 OpenPost database password +OPENPOST_MAIL_RECIPIENT platform mailbox that receives a probe invitation, empty without mail +OPENPOST_SSO_ADMIN_EMAIL platform administrator the Playwright run provisions through SSO before the backup drill, empty without SSO +OPENPOST_PEERTUBE_USERNAME local PeerTube account OpenPost connects through its password login +OPENPOST_PEERTUBE_PASSWORD_B64 base64 password of that PeerTube account +OPENPOST_MEMBER_EMAIL deliverable plus-address of the administrator mailbox for the probe's workspace member +OPENPOST_MEMBER_PASSWORD_B64 base64 password of the probe's workspace member, stable across credential rotation +""" + +from __future__ import annotations + +import base64 +import json +import os +import secrets +import subprocess +import sys +import time +import urllib.error +import urllib.parse +import urllib.request + +BASE = os.environ["OPENPOST_LOCAL_URL"].rstrip("/") + "/api/v1" +HEADERS = json.loads(base64.b64decode(os.environ["OPENPOST_API_HEADERS_B64"])) +ADMIN_EMAIL = os.environ["OPENPOST_ADMIN_EMAIL"] +ADMIN_PASSWORD = base64.b64decode(os.environ["OPENPOST_ADMIN_PASSWORD_B64"]).decode() +RELAY_TARGETS = json.loads(os.environ["OPENPOST_RELAY_TARGETS"]) +DEADLINE = time.monotonic() + int(os.environ["OPENPOST_DEADLINE_SECONDS"]) +PUBLIC_URL = os.environ["OPENPOST_PUBLIC_URL"].rstrip("/") +SSO_ENABLED = os.environ["OPENPOST_SSO_ENABLED"] == "true" +CONTAINER = os.environ["OPENPOST_CONTAINER"] +SIMULATOR_PLATFORMS = json.loads(os.environ["OPENPOST_SIMULATOR_PLATFORMS"]) +UNCONFIGURED_PLATFORMS = json.loads(os.environ["OPENPOST_UNCONFIGURED_PLATFORMS"]) +S3_PUBLIC_URL = os.environ["OPENPOST_S3_PUBLIC_URL"] +SIMULATOR_ADMIN = "https://" + os.environ["OPENPOST_SIMULATOR_HOST"] + "/__admin" +DB_CONTAINER = os.environ["OPENPOST_DB_CONTAINER"] +DB_NAME = os.environ["OPENPOST_DB_NAME"] +DB_USER = os.environ["OPENPOST_DB_USER"] +DB_PASSWORD = base64.b64decode(os.environ["OPENPOST_DB_PASSWORD_B64"]).decode() +MAIL_RECIPIENT = os.environ["OPENPOST_MAIL_RECIPIENT"] +SSO_ADMIN_EMAIL = os.environ["OPENPOST_SSO_ADMIN_EMAIL"] +PEERTUBE_USERNAME = os.environ["OPENPOST_PEERTUBE_USERNAME"] +PEERTUBE_PASSWORD = base64.b64decode( + os.environ["OPENPOST_PEERTUBE_PASSWORD_B64"] +).decode() +MEMBER_USERNAME = "openpost-cli-member" +MEMBER_PASSWORD = base64.b64decode(os.environ["OPENPOST_MEMBER_PASSWORD_B64"]).decode() +MEMBER_EMAIL = os.environ["OPENPOST_MEMBER_EMAIL"] + +SETTLE_SECONDS = 300 +PROFILES = {"text": "short_text", "image": "image_post", "video": "video"} +ANALYSED = ("ready", "failed") + +failures: list[str] = [] + + +class _NoRedirect(urllib.request.HTTPRedirectHandler): + def redirect_request(self, *args: object, **kwargs: object) -> None: + return None + + +OPENER = urllib.request.build_opener(_NoRedirect) + + +def call( + method: str, path: str, body: object = None, token: str = "" +) -> tuple[int, object]: + status, _, payload = call_raw(method, path, body, token) + return status, payload + + +def call_raw( + method: str, path: str, body: object = None, token: str = "" +) -> tuple[int, str, object]: + data = json.dumps(body).encode() if body is not None else None + request = urllib.request.Request(BASE + path, data=data, method=method) # noqa: S310 fixed OpenPost origin + for name, value in HEADERS.items(): + request.add_header(name, value) + request.add_header("Content-Type", "application/json") + if token: + request.add_header("Authorization", "Bearer " + token) + try: + with OPENER.open(request, timeout=60) as response: + raw = response.read().decode() + status = response.status + location = response.headers.get("Location") or "" + except urllib.error.HTTPError as error: + raw = error.read().decode() + status = error.code + location = error.headers.get("Location") or "" + try: + return status, location, json.loads(raw) if raw else None + except ValueError: + return status, location, raw + + +def in_container( + container: str, *argv: str, env: dict[str, str] | None = None, user: str = "" +) -> bytes: + flags = [ + item + for name, value in (env or {}).items() + for item in ("-e", f"{name}={value}") + ] + flags += ["-u", user] if user else [] + result = subprocess.run( + ["container", "exec", *flags, container, *argv], + capture_output=True, + timeout=300, + check=False, + ) + if result.returncode != 0: + sys.exit( + f"[FAIL] {argv[0]} in {container} exited {result.returncode}: {result.stderr.decode()[-400:]}" + ) + return result.stdout + + +def check(label: str, ok: bool, detail: object = "") -> None: + print( + ("[OK] " if ok else "[FAIL] ") + + label + + (f": {detail}" if not ok and detail else "") + ) + if not ok: + failures.append(label) + + +def anonymous_jpeg(url: str) -> bool: + try: + with urllib.request.urlopen(url, timeout=60) as response: # noqa: S310 https media URL issued by OpenPost + return response.status == 200 and response.read(2) == b"\xff\xd8" + except (urllib.error.URLError, OSError): + return False + + +def accounts(token: str, workspace: str) -> dict[str, list[str]]: + status, body = call("GET", f"/accounts?workspace_id={workspace}", token=token) + if status != 200 or not isinstance(body, list): + sys.exit(f"[FAIL] cannot list connected accounts: HTTP {status}") + found: dict[str, list[str]] = {} + for item in sorted(body, key=lambda item: str(item.get("created_at"))): + found.setdefault(str(item["platform"]), []).append(str(item["id"])) + return found + + +def render_media(kind: str) -> tuple[str, str, bytes]: + nonce = secrets.token_hex(3) + colour = f"color=c=0x{nonce}" + if kind == "image": + name, mime = f"openpost-cli-{nonce}.jpg", "image/jpeg" + source = ["-f", "lavfi", "-i", f"{colour}:s=1080x1080", "-frames:v", "1"] + else: + name, mime = f"openpost-cli-{nonce}.mp4", "video/mp4" + source = [ + "-f", + "lavfi", + "-i", + f"{colour}:s=720x1280:d=3", + "-f", + "lavfi", + "-i", + "anullsrc=r=44100:cl=stereo", + "-t", + "3", + "-c:v", + "libx264", + "-pix_fmt", + "yuv420p", + "-c:a", + "aac", + "-shortest", + ] + target = f"/tmp/{name}" # noqa: S108 path inside the OpenPost container + in_container(CONTAINER, "ffmpeg", "-loglevel", "error", "-y", *source, target) + content = in_container(CONTAINER, "cat", target) + in_container(CONTAINER, "rm", "-f", target) + return name, mime, content + + +def media_state(token: str, workspace: str, media: str) -> str: + status, body = call( + "GET", f"/media?workspace_id={workspace}&limit=200", token=token + ) + items = body.get("media") if status == 200 and isinstance(body, dict) else None + for item in items or []: + if item.get("id") == media: + return str(item.get("analysis_status")) + return f"HTTP {status}" + + +def upload(token: str, workspace: str, kind: str) -> tuple[str, str]: + name, mime, content = render_media(kind) + status, session = call( + "POST", + "/media/upload-session", + { + "workspace_id": workspace, + "filename": name, + "mime_type": mime, + "size": len(content), + }, + token, + ) + if status != 200 or not isinstance(session, dict): + sys.exit(f"[FAIL] upload session for {name} returned HTTP {status}: {session}") + target = session["upload"] + url = urllib.parse.urlparse(str(target["url"])) + headers = dict(target["headers"] or {}) + if url.netloc in ("", urllib.parse.urlparse(PUBLIC_URL).netloc): + headers.update({**HEADERS, "Authorization": "Bearer " + token}) + url = urllib.parse.urlparse( + BASE.rsplit("/api/v1", 1)[0] + + url.path + + (f"?{url.query}" if url.query else "") + ) + request = urllib.request.Request( # noqa: S310 upload URL issued by OpenPost + url.geturl(), data=content, method=str(target["method"]) + ) + for header, value in headers.items(): + request.add_header(header, value if isinstance(value, str) else value[0]) + with urllib.request.urlopen(request, timeout=120) as response: # noqa: S310 upload URL issued by OpenPost + if response.status not in (200, 201, 204): + sys.exit(f"[FAIL] media PUT returned HTTP {response.status}") + complete = urllib.parse.urlparse(str(session["complete_url"])).path.split( + "/api/v1", 1 + )[1] + status, body = call("POST", complete, {"workspace_id": workspace}, token) + if status != 200: + sys.exit( + f"[FAIL] completing the upload of {name} returned HTTP {status}: {body}" + ) + media = str(session["media_id"]) + while ( + kind == "video" + and media_state(token, workspace, media) not in ANALYSED + and time.monotonic() < DEADLINE + ): + time.sleep(3) + return media, str(target["object_key"]) + + +def draft( + token: str, + workspace: str, + targets: list[str], + text: str, + kind: str, + media: str, + settings: dict, + at: str, +) -> dict: + payload: dict[str, object] = { + "workspace_id": workspace, + "title": text, + "content_profile": PROFILES[kind], + "source_text": text, + "social_account_ids": targets, + "renditions": [ + {"social_account_id": account, "settings": settings} for account in targets + ], + } + if media: + payload["media"] = [{"media_id": media}] + if at: + payload["scheduled_at"] = at + status, body = call("POST", "/publications", payload, token) + if status != 200 or not isinstance(body, dict): + sys.exit(f"[FAIL] creating publication {text!r} returned HTTP {status}: {body}") + return body + + +def release(token: str, publication: dict, action: str) -> tuple[int, object]: + return call( + "POST", + f"/publications/{publication['id']}/{action}", + {"expected_revision": publication["revision"]}, + token, + ) + + +def renditions(token: str, publication: str) -> list[dict]: + status, body = call("GET", f"/publications/{publication}", token=token) + found = body.get("renditions") if status == 200 and isinstance(body, dict) else None + return list(found or []) + + +def settled(rendition: dict) -> bool: + return rendition.get("status") == "published" or ( + rendition.get("status") == "failed" and not rendition.get("error_retryable") + ) + + +def settle(token: str, publications: dict[str, str]) -> dict[str, list[dict]]: + outcome: dict[str, list[dict]] = {} + budget = min(DEADLINE, time.monotonic() + SETTLE_SECONDS) + while len(outcome) < len(publications) and time.monotonic() < budget: + for label, publication in publications.items(): + if label in outcome: + continue + current = renditions(token, publication) + if current and all(settled(rendition) for rendition in current): + outcome[label] = current + if len(outcome) < len(publications): + time.sleep(5) + return outcome + + +def team(token: str, workspace: str) -> dict: + status, body = call("GET", f"/workspaces/{workspace}/team", token=token) + if status != 200 or not isinstance(body, dict): + sys.exit(f"[FAIL] cannot read the workspace team: HTTP {status}") + return body + + +def revoke_invitations(token: str, workspace: str, email: str) -> None: + for invitation in team(token, workspace).get("invitations") or []: + if invitation["email"] == email and invitation["status"] not in ( + "accepted", + "revoked", + "expired", + ): + call( + "DELETE", + f"/workspaces/{workspace}/invitations/{invitation['id']}", + token=token, + ) From 58ce2cdd4f4ce48ce4115a227f1bd0818abea5ca Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:35 +0200 Subject: [PATCH 064/554] test(web-app-openpost): add simulator journal assertions --- .../files/test/openpost_journal.py | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 roles/web-app-openpost/files/test/openpost_journal.py diff --git a/roles/web-app-openpost/files/test/openpost_journal.py b/roles/web-app-openpost/files/test/openpost_journal.py new file mode 100644 index 0000000000..b9d5e37f73 --- /dev/null +++ b/roles/web-app-openpost/files/test/openpost_journal.py @@ -0,0 +1,137 @@ +from __future__ import annotations + +import json +import re +import urllib.parse + +from openpost_api import anonymous_jpeg, check + +X_LIMIT = 280 +FACEBOOK_PAGES = ("424242", "525252") + + +def hits(journal: list[dict], method: str, path: str, tag: str) -> list[dict]: + found = [] + for entry in journal: + request = entry["request"] + text = urllib.parse.unquote_plus( + str(request.get("url")) + " " + str(request.get("body") or "") + ) + if ( + request["method"] == method + and re.fullmatch(path, str(request["url"]).split("?")[0]) + and tag in text + ): + found.append(entry) + return sorted(found, key=lambda entry: entry["request"]["loggedDate"]) + + +def statuses(entries: list[dict]) -> list[int]: + return [int(entry["responseDefinition"]["status"]) for entry in entries] + + +def form_value(entry: dict, key: str) -> str: + request = entry["request"] + fields = urllib.parse.parse_qs(urllib.parse.urlparse(str(request["url"])).query) + body = str(request.get("body") or "") + if body.startswith("{"): + value = json.loads(body).get(key) + return str(value) if value else "" + fields.update(urllib.parse.parse_qs(body)) + return fields.get(key, [""])[0] + + +def check_journal(journal: list[dict], label: str, tag: str) -> None: + if label in ("x", "scheduled", "member"): + posts = hits(journal, "POST", "/2/tweets", tag) + check( + f"X receives the {label} post exactly once", + statuses(posts) == [201], + statuses(posts), + ) + if label == "x": + text = ( + str(json.loads(posts[0]["request"]["body"]).get("text")) + if posts + else "" + ) + check( + f"the X post stays within {X_LIMIT} characters", + 0 < len(text) <= X_LIMIT, + len(text), + ) + elif label in ("x-429", "x-503"): + posts = statuses(hits(journal, "POST", "/2/tweets", tag)) + wanted = [int(label[2:]), 201] + check( + f"X answers {wanted[0]} once and then receives exactly one post", + posts == wanted, + posts, + ) + elif label == "x-400": + posts = statuses(hits(journal, "POST", "/2/tweets", tag)) + check( + "X rejects the post and its single retry, and nothing else is sent", + posts == [400, 400], + posts, + ) + elif label == "facebook": + for page in FACEBOOK_PAGES: + posts = statuses(hits(journal, "POST", rf"/v[0-9.]+/{page}/feed", tag)) + check( + f"Facebook Page {page} receives exactly one feed post", + posts == [200], + posts, + ) + elif label == "instagram": + containers = hits(journal, "POST", r"/v[0-9.]+/17841400000000000/media", tag) + published = hits( + journal, "POST", r"/v[0-9.]+/17841400000000000/media_publish", "" + ) + image = form_value(containers[0], "image_url") if containers else "" + check( + "Instagram receives one media container", + statuses(containers) == [200], + statuses(containers), + ) + check( + "Instagram receives a publish call after the container", + bool( + containers + and published + and published[-1]["request"]["loggedDate"] + >= containers[0]["request"]["loggedDate"] + ), + ) + check( + "the Instagram container carries a public JPEG URL", + image.startswith("https://") and anonymous_jpeg(image), + image, + ) + elif label == "youtube": + sessions = [ + entry + for entry in hits(journal, "POST", "/upload/youtube/v3/videos", tag) + if "uploadType=resumable" in entry["request"]["url"] + ] + uploads = hits( + journal, "PUT", "/upload/youtube/v3/videos", "upload_id=simulator-upload" + ) + check( + "YouTube receives one resumable upload session", + statuses(sessions) == [200], + statuses(sessions), + ) + check( + "YouTube receives the video on the resumable upload URL", + bool(uploads), + statuses(uploads), + ) + elif label == "linkedin": + posts = statuses(hits(journal, "POST", "/rest/posts", tag)) + check("LinkedIn receives exactly one post", posts == [201], posts) + elif label == "tiktok": + inits = statuses(hits(journal, "POST", "/v2/post/publish/content/init/", tag)) + polls = hits(journal, "POST", "/v2/post/publish/status/fetch/", "") + check("TikTok receives exactly one photo post init", inits == [200], inits) + check("OpenPost polls the TikTok publish status", bool(polls)) From c848f246bf8ced35e6fea777ea82c2511d6e9c15 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:35 +0200 Subject: [PATCH 065/554] test(web-app-openpost): add simulator delivery checks --- .../files/test/openpost_simulator.py | 382 ++++++++++++++++++ 1 file changed, 382 insertions(+) create mode 100644 roles/web-app-openpost/files/test/openpost_simulator.py diff --git a/roles/web-app-openpost/files/test/openpost_simulator.py b/roles/web-app-openpost/files/test/openpost_simulator.py new file mode 100644 index 0000000000..7829fc72cf --- /dev/null +++ b/roles/web-app-openpost/files/test/openpost_simulator.py @@ -0,0 +1,382 @@ +from __future__ import annotations + +import json +import secrets +import sys +import time +import urllib.parse + +from openpost_api import ( + CONTAINER, + DB_CONTAINER, + DB_NAME, + DB_PASSWORD, + DB_USER, + MEMBER_EMAIL, + MEMBER_PASSWORD, + MEMBER_USERNAME, + SIMULATOR_ADMIN, + SIMULATOR_PLATFORMS, + accounts, + call, + call_raw, + check, + draft, + in_container, + release, + renditions, + revoke_invitations, + settle, + upload, +) +from openpost_journal import check_journal, hits + +SIMULATOR_TOKENS = ( + "simulator-access-token", + "simulator-access-secret", + "simulator-meta-user-token", + "simulator-page-token", + "simulator-second-page-token", + "simulator-google-token", + "simulator-google-refresh", + "simulator-tiktok-token", + "simulator-tiktok-refresh", + "simulator-linkedin-token", + "simulator-linkedin-refresh", +) +SCHEDULE_AHEAD_SECONDS = 120 +SCENARIOS = ( + ("scheduled", "x", "", "text", {}), + ("x", "x", "", "text", {}), + ("x-429", "x", "[simulate-429]", "text", {}), + ("x-503", "x", "[simulate-503]", "text", {}), + ("x-400", "x", "[simulate-400]", "text", {}), + ("facebook", "facebook", "", "text", {}), + ("instagram", "instagram", "", "image", {}), + ("linkedin", "linkedin", "", "text", {}), + ( + "tiktok", + "tiktok", + "", + "image", + { + "content_posting_method": "DIRECT_POST", + "privacy_level": "SELF_ONLY", + "music_usage_confirmed": True, + }, + ), + ( + "youtube", + "youtube", + "", + "video", + { + "privacy": "private", + "category_id": "22", + "playlist_id": "", + "self_declared_made_for_kids": False, + "title": "Simulated YouTube video", + }, + ), +) + + +def simulator_admin(path: str, post: bool) -> object: + argv = ["wget", "-q", "-O", "-", "--no-check-certificate"] + ( + ["--post-data="] if post else [] + ) + raw = in_container(CONTAINER, *argv, SIMULATOR_ADMIN + path) + return json.loads(raw) if raw.strip() else None + + +def connect(token: str, workspace: str, platform: str, pick: int) -> str: + status, body = call( + "GET", f"/accounts/{platform}/auth-url?workspace_id={workspace}", token=token + ) + if status != 200 or not isinstance(body, dict): + return f"auth-url HTTP {status} {body}" + query = urllib.parse.parse_qs(urllib.parse.urlparse(str(body["url"])).query) + if platform == "x": + params = { + "oauth_token": query["oauth_token"][0], + "oauth_verifier": "simulator-verifier", + } + else: + params = {"code": "simulator-code", "state": query["state"][0]} + status, location, _ = call_raw( + "GET", + f"/accounts/{platform}/callback?{urllib.parse.urlencode(params)}", + token=token, + ) + if status not in (302, 303, 307) or "failed" in location: + return f"callback HTTP {status} {location}" + selection = urllib.parse.parse_qs(urllib.parse.urlparse(location).query).get( + "connection_id" + ) + if not selection: + return "" + status, body = call("GET", f"/accounts/selections/{selection[0]}", token=token) + if status != 200 or not isinstance(body, dict): + return f"selection HTTP {status} {body}" + options = [str(option["id"]) for option in body.get("options") or []] + if pick >= len(options): + return f"selection offers {len(options)} option(s), wanted option {pick + 1}" + status, body = call( + "POST", + f"/accounts/selections/{selection[0]}/complete", + {"selection_ids": [options[pick]]}, + token, + ) + return "" if status == 200 else f"selection complete HTTP {status} {body}" + + +def check_tokens_at_rest() -> None: + if not DB_CONTAINER: + print( + "[SKIP] tokens at rest: the database task runs on another swarm node than the probe" + ) + return + dump = in_container( + DB_CONTAINER, + "pg_dump", + "--data-only", + "-h", + "127.0.0.1", + "-U", + DB_USER, + "-d", + DB_NAME, + env={"PGPASSWORD": DB_PASSWORD}, + ).decode(errors="replace") + leaked = [value for value in SIMULATOR_TOKENS if value in dump] + check( + "the database holds rows for the connected accounts", + "openpost_simulator" in dump or "4242" in dump, + ) + check("no provider token is stored in plaintext", not leaked, leaked) + + +def member_session() -> tuple[str, str]: + credentials = {"email": MEMBER_EMAIL, "password": MEMBER_PASSWORD} + status, body = call( + "POST", + "/auth/register", + {**credentials, "username": MEMBER_USERNAME, "accepted_legal": True}, + ) + if status == 409: + status, body = call("POST", "/auth/login", credentials) + if status != 200 or not isinstance(body, dict) or not body.get("token"): + sys.exit(f"[FAIL] the probe member cannot sign in: HTTP {status}") + return str(body["token"]), str(body["user"]["id"]) + + +def check_roles(token: str, workspace: str, account: str, tag: str) -> str: + member, member_id = member_session() + call("DELETE", f"/workspaces/{workspace}/members/{member_id}", token=token) + revoke_invitations(token, workspace, MEMBER_EMAIL) + status, invitation = call( + "POST", + f"/workspaces/{workspace}/invitations", + {"email": MEMBER_EMAIL, "role": "viewer"}, + token, + ) + if status != 200 or not isinstance(invitation, dict): + sys.exit( + f"[FAIL] inviting the probe member returned HTTP {status}: {invitation}" + ) + secret = urllib.parse.parse_qs( + urllib.parse.urlparse(str(invitation["accept_url"])).query + )["token"][0] + status, body = call( + "POST", "/workspace-invitations/accept", {"token": secret}, member + ) + if status != 200: + sys.exit( + f"[FAIL] the probe member cannot accept the invitation: HTTP {status} {body}" + ) + publication = draft( + token, workspace, [account], f"Member {tag}", "text", "", {}, "" + ) + status, body = release(member, publication, "publish-now") + check( + "a workspace viewer is refused when publishing", + status == 403, + f"HTTP {status} {body}", + ) + status, body = call( + "PATCH", + f"/workspaces/{workspace}/members/{member_id}", + {"role": "editor"}, + token, + ) + if status != 200: + sys.exit( + f"[FAIL] promoting the probe member to editor returned HTTP {status}: {body}" + ) + status, current = call("GET", f"/publications/{publication['id']}", token=member) + status, body = release( + member, current if isinstance(current, dict) else publication, "publish-now" + ) + check("a workspace editor may publish", status == 200, f"HTTP {status} {body}") + call("DELETE", f"/workspaces/{workspace}/members/{member_id}", token=token) + return str(publication["id"]) if status == 200 else "" + + +def check_failure_paths( + token: str, workspace: str, x: str, publications: dict, tags: dict, outcome: dict +) -> None: + if "x-400" in outcome: + rejected = outcome["x-400"][0] + check( + "a permanent X rejection leaves the destination failed with the provider error", + rejected.get("status") == "failed" + and rejected.get("error_http_status") == 400 + and (rejected.get("delivery") or {}).get("terminal_reason") + == "provider_rejected", + rejected, + ) + status, body = call( + "POST", + f"/publications/{publications['x-400']}/renditions/{x}/retry", + None, + token, + ) + check( + "the failed X destination can be retried alone", + status == 200, + f"HTTP {status} {body}", + ) + outcome.update(settle(token, {"x-400": publications["x-400"]})) + if "x-503" in outcome: + ambiguous = outcome["x-503"][0] + check( + "an ambiguous X 503 leaves the destination in manual review instead of resending", + ambiguous.get("status") == "failed" + and (ambiguous.get("delivery") or {}).get("recovery_action") + == "manual_resolution", + ambiguous, + ) + resend = draft( + token, workspace, [x], f"Resent {tags['x-503']}", "text", "", {}, "" + ) + status, body = release(token, resend, "publish-now") + check( + "the post can be published again to that X destination alone", + status == 200, + f"HTTP {status} {body}", + ) + publications["x-503-resend"] = str(resend["id"]) + outcome.update(settle(token, {"x-503-resend": publications["x-503-resend"]})) + + +def check_simulator(token: str, workspace: str) -> None: + simulator_admin("/scenarios/reset", post=True) + since = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(time.time() - 1)) + for platform in SIMULATOR_PLATFORMS: + error = connect(token, workspace, platform, 0) + check( + f"{platform} connects through OpenPost's callback against the simulator", + not error, + error, + ) + if "facebook" in SIMULATOR_PLATFORMS: + error = connect(token, workspace, "facebook", 1) + check( + "a second Facebook Page connects through its own callback", not error, error + ) + connected = accounts(token, workspace) + if "facebook" in SIMULATOR_PLATFORMS: + pages = connected.get("facebook") or [] + check( + "two Facebook Pages connect side by side in one workspace", + len(pages) >= 2, + pages, + ) + nonce = secrets.token_hex(4) + tags = {label: f"openpost-cli-{label}-{nonce}" for label, *_ in SCENARIOS} + publications: dict[str, str] = {} + due = 0.0 + if "x" in connected: + due = time.time() + SCHEDULE_AHEAD_SECONDS + at = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(due)) + scheduled = draft( + token, + workspace, + connected["x"][:1], + f"Scheduled {tags['scheduled']}", + "text", + "", + {}, + at, + ) + status, body = release(token, scheduled, "schedule") + check( + "a post can be scheduled two minutes ahead", + status == 200, + f"HTTP {status} {body}", + ) + states = [ + rendition.get("status") + for rendition in renditions(token, str(scheduled["id"])) + ] + check( + "the scheduled destination shows the scheduled state", + states == ["scheduled"], + states, + ) + publications["scheduled"] = str(scheduled["id"]) + for label, platform, marker, kind, settings in SCENARIOS: + if ( + label == "scheduled" + or platform not in SIMULATOR_PLATFORMS + or platform not in connected + ): + continue + targets = ( + connected[platform] if label == "facebook" else connected[platform][:1] + ) + media = upload(token, workspace, kind)[0] if kind in ("image", "video") else "" + text = f"{marker} Simulated {platform} delivery {tags[label]}".strip() + publication = draft(token, workspace, targets, text, kind, media, settings, "") + status, body = release(token, publication, "publish-now") + if status != 200: + sys.exit(f"[FAIL] publish-now for {label} returned HTTP {status}: {body}") + publications[label] = str(publication["id"]) + if "x" in connected: + tags["member"] = f"openpost-cli-member-{nonce}" + promoted = check_roles(token, workspace, connected["x"][0], tags["member"]) + if promoted: + publications["member"] = promoted + outcome = settle(token, publications) + if "x" in connected: + check_failure_paths( + token, workspace, connected["x"][0], publications, tags, outcome + ) + for label in publications: + if label in ("x-400", "x-503"): + continue + current = outcome.get(label) or [{}] + states = [rendition.get("status") for rendition in current] + check( + f"every {label} destination ends published", + set(states) == {"published"}, + current, + ) + journal = simulator_admin( + "/requests?since=" + urllib.parse.quote(since), post=False + ) + entries = journal["requests"] if isinstance(journal, dict) else [] + for label in publications: + if label in tags: + check_journal(entries, label, tags[label]) + if "scheduled" in publications: + delivered = [ + entry["request"]["loggedDate"] / 1000 + for entry in hits(entries, "POST", "/2/tweets", tags["scheduled"]) + ] + check( + "the scheduled post is not delivered before its time", + bool(delivered) and min(delivered) >= due - 1, + delivered, + ) + check_tokens_at_rest() From b159c523e12a6ba35b28d87ae0660b062cf833ce Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:35 +0200 Subject: [PATCH 066/554] test(web-app-openpost): cover media, mail and peertube in the probe --- roles/web-app-openpost/files/test/probe.py | 365 +++++++++++++++++---- 1 file changed, 303 insertions(+), 62 deletions(-) diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py index 33c21e971b..37d1a546eb 100644 --- a/roles/web-app-openpost/files/test/probe.py +++ b/roles/web-app-openpost/files/test/probe.py @@ -1,64 +1,55 @@ -"""Env (rendered into test.env from templates/test.env.j2): - OPENPOST_LOCAL_URL published OpenPost origin on the stack host - OPENPOST_API_HEADERS_B64 base64 JSON of the Host and proto headers the proxy would send - OPENPOST_ADMIN_EMAIL break-glass instance admin e-mail - OPENPOST_ADMIN_PASSWORD_B64 base64 break-glass password - OPENPOST_RELAY_TARGETS JSON map of sibling platform to the domain the relay carries - OPENPOST_DEADLINE_SECONDS readiness budget, below the harness timeout - OPENPOST_PUBLIC_URL public origin served by the shared proxy - OPENPOST_SSO_ENABLED true when Keycloak provisions users, so the proxy closes password sign-up -""" - from __future__ import annotations -import base64 import json -import os +import secrets import sys import time import urllib.error import urllib.parse import urllib.request -BASE = os.environ["OPENPOST_LOCAL_URL"].rstrip("/") + "/api/v1" -HEADERS = json.loads(base64.b64decode(os.environ["OPENPOST_API_HEADERS_B64"])) -ADMIN_EMAIL = os.environ["OPENPOST_ADMIN_EMAIL"] -ADMIN_PASSWORD = base64.b64decode(os.environ["OPENPOST_ADMIN_PASSWORD_B64"]).decode() -RELAY_TARGETS = json.loads(os.environ["OPENPOST_RELAY_TARGETS"]) -DEADLINE = time.monotonic() + int(os.environ["OPENPOST_DEADLINE_SECONDS"]) -PUBLIC_URL = os.environ["OPENPOST_PUBLIC_URL"].rstrip("/") -SSO_ENABLED = os.environ["OPENPOST_SSO_ENABLED"] == "true" +from openpost_api import ( + ADMIN_EMAIL, + ADMIN_PASSWORD, + CONTAINER, + DEADLINE, + MAIL_RECIPIENT, + OPENER, + PEERTUBE_PASSWORD, + PEERTUBE_USERNAME, + PUBLIC_URL, + RELAY_TARGETS, + S3_PUBLIC_URL, + SETTLE_SECONDS, + SIMULATOR_PLATFORMS, + SSO_ADMIN_EMAIL, + SSO_ENABLED, + UNCONFIGURED_PLATFORMS, + anonymous_jpeg, + call, + check, + draft, + failures, + in_container, + release, + revoke_invitations, + settle, + team, + upload, +) +from openpost_simulator import check_simulator PRIVATE_TARGETS = ("https://postgres", "https://10.0.0.1") - -failures: list[str] = [] - - -def call(method: str, path: str, body: object = None, token: str = "") -> tuple[int, object]: - data = json.dumps(body).encode() if body is not None else None - request = urllib.request.Request(BASE + path, data=data, method=method) - for name, value in HEADERS.items(): - request.add_header(name, value) - request.add_header("Content-Type", "application/json") - if token: - request.add_header("Authorization", "Bearer " + token) - try: - with urllib.request.urlopen(request, timeout=60) as response: - raw = response.read().decode() - status = response.status - except urllib.error.HTTPError as error: - raw = error.read().decode() - status = error.code - try: - return status, json.loads(raw) if raw else None - except ValueError: - return status, raw - - -def check(label: str, ok: bool, detail: object = "") -> None: - print(("[OK] " if ok else "[FAIL] ") + label + (f": {detail}" if not ok and detail else "")) - if not ok: - failures.append(label) +SQLITE_PATTERNS = ( + "-name", + "*.sqlite", + "-o", + "-name", + "*.sqlite3", + "-o", + "-name", + "*.db", +) def wait_ready() -> None: @@ -75,31 +66,101 @@ def wait_ready() -> None: def login() -> str: - status, body = call("POST", "/auth/login", {"email": ADMIN_EMAIL, "password": ADMIN_PASSWORD}) + status, body = call( + "POST", "/auth/login", {"email": ADMIN_EMAIL, "password": ADMIN_PASSWORD} + ) if status != 200 or not isinstance(body, dict) or not body.get("token"): sys.exit(f"[FAIL] break-glass login returned HTTP {status}") print("[OK] break-glass instance admin signs in") return str(body["token"]) -def flag(path: str, key: str, token: str = "") -> object: - status, body = call("GET", path, token=token) +def flag(path: str, key: str) -> object: + status, body = call("GET", path) if status != 200 or not isinstance(body, dict): return f"HTTP {status}" return body.get(key) def public_status(method: str, path: str) -> int: - request = urllib.request.Request(PUBLIC_URL + path, data=b"{}", method=method) + request = urllib.request.Request(PUBLIC_URL + path, data=b"{}", method=method) # noqa: S310 fixed public OpenPost origin request.add_header("Content-Type", "application/json") try: - with urllib.request.urlopen(request, timeout=60) as response: + with urllib.request.urlopen(request, timeout=60) as response: # noqa: S310 fixed public OpenPost origin return response.status except urllib.error.HTTPError as error: return error.code -def check_data_minimisation(token: str) -> None: +def anonymous_get(path: str) -> int: + request = urllib.request.Request(PUBLIC_URL + path) # noqa: S310 fixed public OpenPost origin + try: + with OPENER.open(request, timeout=60) as response: + return response.status + except urllib.error.HTTPError as error: + return error.code + + +def check_access() -> None: + status = anonymous_get("/api/v1/accounts/mastodon/callback") + check( + "the provider callback answers without a session", + status in (302, 303, 307), + f"HTTP {status}", + ) + status = anonymous_get("/api/v1/workspaces") + check("the API refuses anonymous requests", status == 401, f"HTTP {status}") + found = in_container( + CONTAINER, + "find", + "/", + "(", + "-path", + "/proc", + "-o", + "-path", + "/sys", + ")", + "-prune", + "-o", + "-type", + "f", + "(", + *SQLITE_PATTERNS, + ")", + "-print", + user="0", + ) + check( + "no SQLite database exists in the container", + not found.strip(), + found.decode()[:400], + ) + + +def check_sso_administrator(token: str) -> None: + status, body = call("GET", "/admin/users?per_page=100", token=token) + users = body.get("users") if status == 200 and isinstance(body, dict) else None + found = [ + user + for user in users or [] + if str(user.get("email")).lower() == SSO_ADMIN_EMAIL.lower() + ] + check( + "the SSO administrator from the bootstrap allowlist is an instance admin", + bool(found) and found[0].get("is_admin") is True, + found, + ) + if found and "mastodon" in RELAY_TARGETS: + count = found[0].get("publication_count") + check( + "the SSO administrator's publications survived the backup drill", + isinstance(count, int) and count >= 1, + count, + ) + + +def check_data_minimisation() -> None: for label, path, key in ( ("PostHog telemetry is off", "/telemetry/config", "enabled"), ("diagnostics reports are off", "/diagnostics/public-config", "enabled"), @@ -109,10 +170,18 @@ def check_data_minimisation(token: str) -> None: check(label, value is False, f"{path} {key}={value!r}") if SSO_ENABLED: status = public_status("POST", "/api/v1/auth/register") - check("the proxy refuses password self-registration", status == 403, f"HTTP {status}") + check( + "the proxy refuses password self-registration", + status == 403, + f"HTTP {status}", + ) else: value = flag("/auth/config", "registration_enabled") - check("password self-registration is off", value is False, f"registration_enabled={value!r}") + check( + "password self-registration is off", + value is False, + f"registration_enabled={value!r}", + ) def workspace_id(token: str) -> str: @@ -125,29 +194,201 @@ def workspace_id(token: str) -> str: return str(body["id"]) -def auth_url(token: str, workspace: str, platform: str, instance_url: str) -> tuple[int, object]: - query = urllib.parse.urlencode({"workspace_id": workspace, "instance_url": instance_url}) +def auth_url( + token: str, workspace: str, platform: str, instance_url: str +) -> tuple[int, object]: + query = urllib.parse.urlencode( + {"workspace_id": workspace, "instance_url": instance_url} + ) return call("GET", f"/accounts/{platform}/auth-url?{query}", token=token) +def check_unconfigured(token: str, workspace: str) -> None: + for platform in UNCONFIGURED_PLATFORMS: + status, body = call( + "GET", + f"/accounts/{platform}/auth-url?workspace_id={workspace}", + token=token, + ) + check( + f"{platform} cannot be connected without provider credentials", + status != 200, + f"HTTP {status} {body}", + ) + + def check_relay(token: str, workspace: str) -> None: for platform, domain in RELAY_TARGETS.items(): if platform == "peertube": continue status, body = auth_url(token, workspace, platform, f"https://{domain}") - check(f"relay carries {platform} at {domain} past the guard", status == 200, f"HTTP {status} {body}") + check( + f"relay carries {platform} at {domain} past the guard", + status == 200, + f"HTTP {status} {body}", + ) for target in PRIVATE_TARGETS: status, body = auth_url(token, workspace, "mastodon", target) check(f"guard still rejects {target}", status != 200, f"HTTP {status} {body}") +def check_media(token: str, workspace: str) -> None: + media, key = upload(token, workspace, "image") + publication = draft( + token, workspace, [], f"Media probe {media}", "image", media, {}, "" + ) + attached: dict = {} + budget = min(DEADLINE, time.monotonic() + 60) + while not attached.get("public_url_checked_at") and time.monotonic() < budget: + status, body = call("GET", f"/publications/{publication['id']}", token=token) + attached = ( + (body.get("media") if status == 200 and isinstance(body, dict) else None) + or [{}] + )[0] + time.sleep(0 if attached.get("public_url_checked_at") else 3) + check( + "OpenPost reaches the public URL of uploaded media without a session", + attached.get("public_url_ready") is True + and attached.get("public_url_status") == 200, + attached, + ) + if S3_PUBLIC_URL: + check( + f"uploaded media lands in S3 and is fetchable anonymously under {S3_PUBLIC_URL}", + anonymous_jpeg(S3_PUBLIC_URL + key), + key, + ) + else: + check( + "uploaded media is served under /media/", + str(attached.get("url")).startswith("/media/"), + attached.get("url"), + ) + call("DELETE", f"/publications/{publication['id']}", token=token) + + +def check_mail(token: str, workspace: str) -> None: + revoke_invitations(token, workspace, MAIL_RECIPIENT) + status, invitation = call( + "POST", + f"/workspaces/{workspace}/invitations", + {"email": MAIL_RECIPIENT, "role": "viewer"}, + token, + ) + if status != 200 or not isinstance(invitation, dict): + check("OpenPost sends an invitation mail", False, f"HTTP {status} {invitation}") + return + state = str(invitation["email_delivery_status"]) + while state in ("created", "queued") and time.monotonic() < DEADLINE: + time.sleep(5) + current = [ + item + for item in team(token, workspace).get("invitations") or [] + if item["id"] == invitation["id"] + ] + state = str(current[0]["email_delivery_status"]) if current else "revoked" + call( + "DELETE", f"/workspaces/{workspace}/invitations/{invitation['id']}", token=token + ) + check( + "OpenPost hands an invitation mail to the platform mail server", + state in ("sent", "delivered"), + state, + ) + + +def peertube_has(domain: str, tag: str) -> bool: + query = urllib.parse.urlencode({"count": 25, "sort": "-publishedAt"}) + try: + with urllib.request.urlopen( + f"https://{domain}/api/v1/accounts/{PEERTUBE_USERNAME}/videos?{query}", + timeout=60, + ) as response: + videos = json.loads(response.read().decode()).get("data") or [] + except (urllib.error.URLError, OSError, ValueError): + return False + return any(tag in str(video.get("name")) for video in videos) + + +def check_peertube(token: str, workspace: str) -> None: + domain = RELAY_TARGETS["peertube"] + credentials = {"username": PEERTUBE_USERNAME, "password": PEERTUBE_PASSWORD} + status, body = call( + "POST", + "/accounts/peertube/login", + {"workspace_id": workspace, "instance_url": f"https://{domain}", **credentials}, + token, + ) + if status == 200 and isinstance(body, dict) and body.get("selection_required"): + choice = [str(option["id"]) for option in body.get("options") or []] + status, body = call( + "POST", + f"/accounts/selections/{body['connection_id']}/complete", + {"selection_ids": choice}, + token, + ) + check( + f"a local PeerTube account at {domain} connects with its password", + status == 200, + f"HTTP {status} {body}", + ) + listed = call("GET", f"/accounts?workspace_id={workspace}", token=token)[1] + channels = ( + [item for item in listed if item.get("platform") == "peertube"] + if isinstance(listed, list) + else [] + ) + if status != 200 or not channels: + return + tag = f"openpost-cli-peertube-{secrets.token_hex(4)}" + media, _ = upload(token, workspace, "video") + settings = {"channel": channels[0]["account_id"], "title": tag, "privacy": "public"} + publication = draft( + token, + workspace, + [str(channels[0]["id"])], + f"PeerTube delivery {tag}", + "video", + media, + settings, + "", + ) + status, body = release(token, publication, "publish-now") + check("the PeerTube video can be published", status == 200, f"HTTP {status} {body}") + if status != 200: + return + current = settle(token, {"peertube": str(publication["id"])}).get("peertube") or [ + {} + ] + check( + "the PeerTube destination ends published", + current[0].get("status") == "published", + current[0], + ) + budget = min(DEADLINE, time.monotonic() + SETTLE_SECONDS) + while not peertube_has(domain, tag) and time.monotonic() < budget: + time.sleep(5) + check("the video appears on the PeerTube instance", peertube_has(domain, tag), tag) + + def main() -> int: wait_ready() print("[OK] /api/v1/ready answers 200") token = login() - check_data_minimisation(token) + check_data_minimisation() + check_access() + if SSO_ADMIN_EMAIL: + check_sso_administrator(token) workspace = workspace_id(token) check_relay(token, workspace) + check_unconfigured(token, workspace) + check_media(token, workspace) + if MAIL_RECIPIENT: + check_mail(token, workspace) + if SIMULATOR_PLATFORMS: + check_simulator(token, workspace) + if "peertube" in RELAY_TARGETS: + check_peertube(token, workspace) if failures: print(f"[FAIL] {len(failures)} check(s) failed: {', '.join(failures)}") return 1 From de26ac6fa39137c964140c15def36856c3b2a05b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:35 +0200 Subject: [PATCH 067/554] test(web-app-openpost): run the split probe --- roles/web-app-openpost/files/test/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/test/test.sh b/roles/web-app-openpost/files/test/test.sh index 5805eb634e..24a9144bf7 100644 --- a/roles/web-app-openpost/files/test/test.sh +++ b/roles/web-app-openpost/files/test/test.sh @@ -3,7 +3,7 @@ # Env (rendered into test.env from templates/test.env.j2): # OPENPOST_CONTAINER resolved OpenPost container (CLI_LOCAL_CID) # OPENPOST_RELAY_PORT port the relay listens on inside the role network -# every OPENPOST_* variable probe.py documents +# every OPENPOST_* variable openpost_api.py documents set -uo pipefail @@ -14,7 +14,7 @@ here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" exit 2 } -python3 -I "${here}/probe.py" +python3 -E -s "${here}/probe.py" rc=$? # nocheck: container-exec-resolver, shell-download-retry address resolved by the caller; a single attempt is the point of a refusal probe From e728cd928c86895707014fcc0d7a4839899e109d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:36 +0200 Subject: [PATCH 068/554] test(web-app-openpost): expose pixelfed to playwright --- roles/web-app-openpost/templates/playwright.env.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/web-app-openpost/templates/playwright.env.j2 b/roles/web-app-openpost/templates/playwright.env.j2 index 4acd28ac88..304f9676f5 100644 --- a/roles/web-app-openpost/templates/playwright.env.j2 +++ b/roles/web-app-openpost/templates/playwright.env.j2 @@ -41,6 +41,10 @@ OIDC_ISSUER_URL={{ OIDC.CLIENT.ISSUER_URL | dotenv_quote }} ORGANISATION_WORKSPACE={{ OPENPOST_ORGANISATION_WORKSPACE | dotenv_quote }} +PIXELFED_BASE_URL={{ lookup('tls', 'web-app-pixelfed', 'url.base') | dotenv_quote }} + +PIXELFED_SERVICE_ENABLED={{ lookup('config', application_id, 'services.pixelfed.enabled') | string | lower }} + # nocheck: playwright-service-gate - Prometheus scrape parity is owned by the web-app-prometheus spec PROMETHEUS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.prometheus.enabled') | string | lower }} From df2c46d0db01c82d734b01f6b8e7407dd2a12d7f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:36 +0200 Subject: [PATCH 069/554] test(web-app-openpost): add pixelfed and api helpers --- .../files/playwright/_shared.js | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index 06cc58f1a6..289bbd6798 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -16,6 +16,7 @@ const env = { breakglassEmail: decodeDotenvQuotedValue(process.env.BREAKGLASS_EMAIL), breakglassPassword: decodeDotenvQuotedValue(process.env.BREAKGLASS_PASSWORD), mastodonBaseUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.MASTODON_BASE_URL || "")), + pixelfedBaseUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.PIXELFED_BASE_URL || "")), organisationWorkspace: decodeDotenvQuotedValue(process.env.ORGANISATION_WORKSPACE), oidcEnabled: isServiceEnabled("sso"), }; @@ -311,6 +312,158 @@ async function mastodonStatusExists(page, account, marker) { return (await statuses.json()).some((status) => String(status.content || "").includes(marker)); } +async function openPixelfedConnectDialog(page, label) { + await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + const card = page.locator('[data-testid="provider-card-pixelfed"]'); + await expect(card, `${label}: the Pixelfed provider card must render`).toBeVisible({ timeout: resolveTimeout(60_000) }); + await card.getByRole("button", { name: /^connect$/i }).click(); + const dialog = page.getByRole("dialog", { name: /connect pixelfed/i }); + await dialog.getByRole("button", { name: /continue to pixelfed/i }).click(); + await dialog.getByRole("textbox", { name: /server address/i }).fill(env.pixelfedBaseUrl); + return dialog; +} + +function pixelfedChannelActions(page, account) { + return page.getByRole("button", { name: new RegExp(`^actions for ${account.handle} · pixelfed$`, "i") }); +} + +const OOB_REDIRECT = "urn:ietf:wg:oauth:2.0:oob"; + +async function pixelfedAuthorizationCode(page, label, redirectedCode) { + await expect + .poll(() => page.url(), { timeout: resolveTimeout(60_000), message: `${label}: expected Pixelfed's sign-in or consent page` }) + .toContain(env.pixelfedBaseUrl); + const password = page.locator('input[name="password"]'); + if (!redirectedCode() && (await password.isVisible())) { + await page.locator('input[name="email"]').fill(env.adminEmail); + await password.fill(env.adminPassword); + await page.locator("form").filter({ has: password }).locator('button[type="submit"]').click(); + } + const authorize = page.getByRole("button", { name: /^authorize$/i }); + const codeShown = async () => (await page.locator("body").innerText()).includes('"code"'); + await expect + .poll(async () => Boolean(redirectedCode()) || (await codeShown()) || (await authorize.isVisible()), { + timeout: resolveTimeout(60_000), + message: `${label}: expected Pixelfed's consent screen or its authorization code`, + }) + .toBe(true); + if (redirectedCode()) { + return redirectedCode(); + } + if (await authorize.isVisible()) { + await authorize.click(); + } + await expect + .poll(codeShown, { + timeout: resolveTimeout(60_000), + message: `${label}: Pixelfed must answer the out-of-band approval with the authorization code`, + }) + .toBe(true); + return JSON.parse(await page.locator("body").innerText()).code; +} + +async function connectPixelfedAccount(page, label) { + const account = { handle: `@${env.adminUsername}` }; + let redirected = ""; + const capture = (response) => { + const location = response.headers().location || ""; + if (location.startsWith(OOB_REDIRECT)) { + redirected = new URLSearchParams(location.split("?")[1] || "").get("code") || ""; + } + }; + page.on("response", capture); + const dialog = await openPixelfedConnectDialog(page, label); + await dialog.getByRole("button", { name: /^connect$/i }).click(); + const code = await pixelfedAuthorizationCode(page, label, () => redirected); + page.off("response", capture); + expect(code, `${label}: Pixelfed must issue an authorization code`).toBeTruthy(); + const codeDialog = await openPixelfedConnectDialog(page, label); + await codeDialog.getByRole("button", { name: /^code$/i }).click(); + await page.getByRole("textbox", { name: /authorization code/i }).fill(code); + await page.getByRole("button", { name: /connect account/i }).click(); + await expect + .poll(() => new URL(page.url()).pathname, { + timeout: resolveTimeout(60_000), + message: `${label}: OpenPost must leave the code page after the exchange`, + }) + .not.toContain("/accounts/pixelfed/callback"); + await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + await expect( + pixelfedChannelActions(page, account), + `${label}: ${account.handle} must be listed among the connected Pixelfed channels`, + ).toBeVisible({ timeout: resolveTimeout(60_000) }); + return account; +} + +async function apiRequest(page, headers, method, path, data) { + const response = await page.request.fetch(`${env.appBaseUrl}/api/v1${path}`, { method, headers, data }); + expect(response.ok(), `${method} ${path} must succeed, got HTTP ${response.status()}`).toBeTruthy(); + return response.status() === 204 ? null : response.json(); +} + +function apiSession() { + return { Origin: new URL(env.appBaseUrl).origin }; +} + +async function apiAccount(page, headers, platform) { + for (const workspace of await apiRequest(page, headers, "GET", "/workspaces")) { + const accounts = await apiRequest(page, headers, "GET", `/accounts?workspace_id=${workspace.id}`); + const account = accounts.find((item) => item.platform === platform); + if (account) { + return { workspace: workspace.id, account: account.id }; + } + } + throw new Error(`no connected ${platform} account in any workspace`); +} + +async function apiUploadImage(page, headers, workspace, fileName) { + const buffer = uniquePng(fileName); + const session = await apiRequest(page, headers, "POST", "/media/upload-session", { + workspace_id: workspace, + filename: fileName, + mime_type: "image/png", + size: buffer.length, + }); + const target = new URL(session.upload.url, env.appBaseUrl); + const uploadHeaders = { ...(session.upload.headers || {}) }; + if (target.origin === new URL(env.appBaseUrl).origin) { + Object.assign(uploadHeaders, headers); + } + const upload = await page.request.fetch(target.toString(), { method: session.upload.method, headers: uploadHeaders, data: buffer }); + expect(upload.ok(), `the media upload must succeed, got HTTP ${upload.status()}`).toBeTruthy(); + const complete = new URL(session.complete_url, env.appBaseUrl).pathname.replace(/^\/api\/v1/, ""); + await apiRequest(page, headers, "POST", complete, { workspace_id: workspace }); + return session.media_id; +} + +async function apiPublishImage(page, headers, target, text, label) { + const media = await apiUploadImage(page, headers, target.workspace, `${label}-${Date.now()}.png`); + const publication = await apiRequest(page, headers, "POST", "/publications", { + workspace_id: target.workspace, + title: text, + content_profile: "image_post", + source_text: text, + social_account_ids: [target.account], + renditions: [{ social_account_id: target.account, settings: {} }], + media: [{ media_id: media }], + }); + await apiRequest(page, headers, "POST", `/publications/${publication.id}/publish-now`, { + expected_revision: publication.revision, + }); + let rendition = {}; + await expect + .poll( + async () => { + const current = await apiRequest(page, headers, "GET", `/publications/${publication.id}`); + rendition = (current.renditions || [])[0] || {}; + return rendition.status; + }, + { timeout: resolveTimeout(180_000), message: `${label}: the ${text} destination must end published` }, + ) + .toBe("published"); + return rendition; +} + async function beforeEach({ page }) { await page.setViewportSize({ width: 1440, height: 1100 }); expect(env.appBaseUrl, "APP_BASE_URL must be set").toBeTruthy(); @@ -333,6 +486,10 @@ module.exports = { assertWorkspaceHidden, uploadMedia, connectMastodonAccount, + connectPixelfedAccount, + apiSession, + apiAccount, + apiPublishImage, disconnectAccount, publishNow, mastodonStatusExists, From a431f74a764de98b897ad744d03c138434e4a405 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:36 +0200 Subject: [PATCH 070/554] test(web-app-openpost): add pixelfed publish scenario --- .../files/playwright/test-publish-pixelfed.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-publish-pixelfed.js diff --git a/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js b/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js new file mode 100644 index 0000000000..763fcbf109 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js @@ -0,0 +1,25 @@ +const { test, expect } = require("@playwright/test"); +const { resolveTimeout } = require("./timeouts"); + +exports.register = function (shared) { + test("administrator: connects the local Pixelfed account through the OOB code flow and publishes an image to it", async ({ page }) => { + shared.skipUnlessServiceEnabled("pixelfed"); + test.setTimeout(resolveTimeout(300_000)); // Pixelfed sign-in, OAuth approval, media upload and the publishing worker round-trip + const label = "break-glass administrator"; + const marker = `openpost-e2e-pixelfed ${Date.now()}`; + + await shared.signInViaLocal(page, shared.env.breakglassEmail, shared.env.breakglassPassword, label); + await shared.connectPixelfedAccount(page, label); + const headers = shared.apiSession(); + const target = await shared.apiAccount(page, headers, "pixelfed"); + const rendition = await shared.apiPublishImage(page, headers, target, marker, label); + expect(rendition.external_url, `${label}: OpenPost must record the URL of the Pixelfed post`).toBeTruthy(); + await expect + .poll(async () => (await page.request.get(rendition.external_url)).status(), { + timeout: resolveTimeout(60_000), + message: `${label}: expected the Pixelfed post at ${rendition.external_url}`, + }) + .toBe(200); + await shared.logout(page, label); + }); +}; From e5cf8284c509f1ed31f0de8d99466271c0ddc323 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:36 +0200 Subject: [PATCH 071/554] test(web-app-openpost): register the pixelfed scenario --- roles/web-app-openpost/files/playwright/playwright.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/playwright.spec.js b/roles/web-app-openpost/files/playwright/playwright.spec.js index d266b47324..f6b26e7092 100644 --- a/roles/web-app-openpost/files/playwright/playwright.spec.js +++ b/roles/web-app-openpost/files/playwright/playwright.spec.js @@ -13,4 +13,5 @@ require("./test-login-native-administrator").register(shared); require("./test-login-oidc-administrator").register(shared); require("./test-login-oidc-biber").register(shared); require("./test-publish-mastodon").register(shared); +require("./test-publish-pixelfed").register(shared); require("./test-seaweedfs").register(shared); From 97785696b3a530483b01b204bc022c6e11144746 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:36 +0200 Subject: [PATCH 072/554] docs(web-app-openpost): document simulator, rotation and verified combinations --- roles/web-app-openpost/Administration.md | 28 +++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 9edf49da04..e891f75a51 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -34,7 +34,8 @@ The role configures OpenPost's instance-wide OIDC provider against the shared Ke The deploy bootstraps the local account `web-app-openpost-breakglass` (username `openpost-breakglass`, password generated into the inventory) as the first OpenPost account, which makes it the instance admin. Use it when Keycloak is unavailable: open `https://publish./` and sign in with the e-mail address and password from the inventory. -If the deploy reports that the break-glass account can neither sign in nor be registered, another account became the first instance admin or the password was changed in the UI; sign in with that account and reset the break-glass password, or restore the database from backup. +When the inventory password changes, for example through credential rotation, the deploy writes its bcrypt hash into the existing account, so a password changed in the UI is reset on the next deploy as well. +If the deploy reports that the break-glass account can neither sign in nor be registered, another account became the first instance admin; sign in with that account and repair the break-glass account, or restore the database from backup. ## Egress guard and relay @@ -75,6 +76,16 @@ For Mastodon and Pixelfed the deploy registers an `OpenPost` app on every deploy OpenPost v7.22.9 can register apps on any other instance by itself, but its code exchange then checks provider readiness against the bare host name the dialog sends and refuses with `provider operation is not ready: needs_configuration`; an external instance therefore needs the same pinning through those two variables. Every callback URL has the form `https://publish./api/v1/accounts//callback`. +## Provider simulator + +Variant 0 of `meta/variants.yml` starts a WireMock `simulator` on the role network that answers for X, Facebook, Instagram, YouTube, LinkedIn and TikTok under their real API host names. +The deploy signs a certificate for those names with a per-deploy test CA in the role's config directory, OpenPost trusts that CA through `SSL_CERT_DIR`, and the role renders `simulator-` credentials instead of the `API` entries for the simulated providers. +The mappings live in `files/simulator/openpost.json`; a post whose text contains `[simulate-429]`, `[simulate-503]` or `[simulate-400]` gets that answer from the X endpoint once. +OpenPost v7.22.9 retries a 429 by itself after the reset header, but treats a 503 to a write as an ambiguous delivery: the destination stays in "Manual review required", its retry is refused, and after confirming on the network that nothing was posted the post has to be published again to that destination. +A destination that failed with a definite rejection can be retried on its own. +TikTok renditions need `content_posting_method`, `privacy_level` and `music_usage_confirmed`, YouTube renditions need `privacy` and `category_id` and wait for the media analysis to finish, and LinkedIn Organization Pages stay off, so a LinkedIn account connects as the member's personal profile. +The simulator never runs in production; leave the variant to CI and local tests. + ## Networks | Network | Post types | Developer app and account | Scopes | Review or verification | Quota | Cost (October 2026) | Token upkeep | @@ -106,6 +117,7 @@ Sources: the [OpenPost provider reference](https://github.com/getopenpost/openpo | LinkedIn requires vetting of the legal entity and re-authorisation every 60 days. | Plan the vetting before launch and schedule a re-authorisation reminder. | | YouTube projects in testing status lose refresh tokens after 7 days. | Move the Google OAuth client to production status and complete verification. | | Bluesky is also reachable without OpenPost through `web-app-bridgy-fed`. | Use the bridge for automatic federation and OpenPost for deliberate Bluesky-native posts. | +| OpenPost connects PeerTube only through the OAuth password grant, and PeerTube accounts that sign in through Keycloak have no local password. | Connect a local PeerTube account: the `root` account, which a fresh `web-app-peertube` instance creates with the platform administrator's password, or one the PeerTube administrator creates for publishing. PeerTube then asks for the channel each video goes to. | | Sibling Fediverse instances are reachable only over TLS on port 443. | Keep TLS enabled for `web-app-mastodon`, `web-app-pixelfed` and `web-app-peertube`. | ## Data processing and dependencies @@ -122,7 +134,7 @@ Sources: the [OpenPost provider reference](https://github.com/getopenpost/openpo - With `web-app-seaweedfs` deployed, browsers upload media directly to its public S3 vhost through presigned URLs, which is why `OPENPOST_S3_ENDPOINT` is the public endpoint and the CSP allows it in `connect-src`; OpenPost deduplicates identical files by content hash. - The platform backup covers the OpenPost database in the shared Postgres and the `openpost_media` volume; media in `web-app-seaweedfs` is covered by that role's backup. -- A restore needs the database, the media and the inventory secrets, especially `encryption_key`; without it the stored provider tokens cannot be decrypted and every network has to be reconnected. +- A restore needs the database, the media and the inventory secrets, especially `encryption_key`; without it the stored provider tokens cannot be decrypted and every network has to be reconnected. The key is pinned `rotatable: false` because OpenPost refuses to start once a stored row no longer decrypts; the other secrets rotate freely. - Changing the pinned version in `meta/services.yml` and redeploying runs OpenPost's own migrations, which take a Postgres advisory lock. Only the latest upstream release receives security fixes, so follow new release tags promptly. @@ -141,9 +153,15 @@ Run these checks against real platforms after onboarding a network and after eve | Network | Content type | OpenPost version | Date | Result | |---|---|---|---|---| -| Mastodon (local instance) | Text | v7.22.9 | pending | CI end-to-end test | -| Pixelfed (local instance) | Image | v7.22.9 | pending | CI end-to-end test | -| PeerTube (local instance) | Video | v7.22.9 | pending | CI end-to-end test | +| Mastodon (local instance) | Text | v7.22.9 | 2026-10-22 | Published, CI end-to-end test | +| Pixelfed (local instance) | Image | v7.22.9 | 2026-10-22 | Published, CI end-to-end test | +| PeerTube (local instance) | Video | v7.22.9 | 2026-10-22 | Published to the `root` channel, CI end-to-end test | +| X (simulator) | Text, scheduled text | v7.22.9 | 2026-10-22 | Published; 429 retried, 503 held for manual review, 400 failed | +| Facebook Pages (simulator) | Text to two Pages | v7.22.9 | 2026-10-22 | Published | +| Instagram (simulator) | JPEG image | v7.22.9 | 2026-10-22 | Published from a public media URL | +| YouTube (simulator) | Video | v7.22.9 | 2026-10-22 | Published through a resumable upload | +| LinkedIn (simulator) | Text | v7.22.9 | 2026-10-22 | Published | +| TikTok (simulator) | Photo | v7.22.9 | 2026-10-22 | Published | | Facebook Pages | Text, image | v7.22.9 | not yet verified | Manual staging check | | Instagram | Image | v7.22.9 | not yet verified | Manual staging check | | X | Text | v7.22.9 | not yet verified | Manual staging check | From 305ffbfa45adfb97beba768014dfd733071b587a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 10:32:36 +0200 Subject: [PATCH 073/554] docs(requirements): check off verified 040 criteria --- docs/requirements/040-web-app-openpost.md | 104 +++++++++++----------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/docs/requirements/040-web-app-openpost.md b/docs/requirements/040-web-app-openpost.md index ecb904bc46..b584877404 100644 --- a/docs/requirements/040-web-app-openpost.md +++ b/docs/requirements/040-web-app-openpost.md @@ -142,7 +142,8 @@ roles/web-app-openpost/ ├── tasks/ │ ├── 00_core.yml │ ├── 01_fediverse_apps.yml -│ ├── 02_breakglass.yml +│ ├── 02_simulator.yml +│ ├── 03_breakglass.yml │ └── main.yml ├── templates/ │ ├── compose.yml.j2 @@ -183,90 +184,91 @@ simulator: ### Evaluation and documentation (story AC1) -- [ ] `roles/web-app-openpost/Administration.md` documents, per network (Mastodon, Pixelfed, PeerTube, Facebook Pages, Instagram, X, YouTube, LinkedIn, Threads, TikTok, Bluesky), the supported post types, the developer app and account type, the required scopes, review or verification steps, quotas, costs and token upkeep. -- [ ] `Administration.md` lists every unsupported feature with its workaround, including TikTok's ban on in-house upload tools, the X link surcharge, Instagram's JPEG and public-URL rule, LinkedIn vetting and Bluesky reach through `web-app-bridgy-fed`. -- [ ] `Administration.md` documents data processing (which data each platform receives), third-party dependencies, and licence compatibility of the unmodified AGPL-3.0-only application with the role's own licence. -- [ ] `Administration.md` contains a staging checklist and a verified-combinations matrix (network, content type, OpenPost version, date) for manual checks of the real platforms. +- [x] `roles/web-app-openpost/Administration.md` documents, per network (Mastodon, Pixelfed, PeerTube, Facebook Pages, Instagram, X, YouTube, LinkedIn, Threads, TikTok, Bluesky), the supported post types, the developer app and account type, the required scopes, review or verification steps, quotas, costs and token upkeep. +- [x] `Administration.md` lists every unsupported feature with its workaround, including TikTok's ban on in-house upload tools, the X link surcharge, Instagram's JPEG and public-URL rule, LinkedIn vetting and Bluesky reach through `web-app-bridgy-fed`. +- [x] `Administration.md` documents data processing (which data each platform receives), third-party dependencies, and licence compatibility of the unmodified AGPL-3.0-only application with the role's own licence. +- [x] `Administration.md` contains a staging checklist and a verified-combinations matrix (network, content type, OpenPost version, date) for manual checks of the real platforms. ### Image and configuration (story AC2) -- [ ] The role runs `ghcr.io/getopenpost/openpost` pinned to a release tag in `meta/services.yml` and ships no role-local Dockerfile or source modification. -- [ ] The external update tooling proposes new upstream release tags through `update.type: registry_tags`. -- [ ] Every OpenPost setting is rendered through `templates/env.j2`, and `OPENPOST_APP_URL` and `OPENPOST_PUBLIC_URL` carry `https://publish.{{ DOMAIN_PRIMARY }}`. +- [x] The role runs `ghcr.io/getopenpost/openpost` pinned to a release tag in `meta/services.yml` and ships no role-local Dockerfile or source modification. +- [x] The external update tooling proposes new upstream release tags through `update.type: registry_tags`. +- [x] Every OpenPost setting is rendered through `templates/env.j2`, and `OPENPOST_APP_URL` and `OPENPOST_PUBLIC_URL` carry `https://publish.{{ DOMAIN_PRIMARY }}`. ### Egress relay (story AC2, AC4, AC7) - [ ] `roles/web-app-openpost/meta/networks.yml` declares the role subnet `192.88.99.0/24`, a block outside every range OpenPost's guard rejects and outside every Docker, mesh, Tor and role subnet pool, and `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` in `group_vars/all/08_networks.yml` names the role; the network is a bridge in compose and an overlay in swarm. -- [ ] A `relay` entity running a pinned `nginx` image carries network aliases, passed through the `aliases` argument of the shared `container_networks` lookup, only for the canonical domains of the deployed sibling roles OpenPost publishes to (`web-app-mastodon`, `web-app-pixelfed`, `web-app-peertube`), each gated by that role's dynamic service flag. +- [x] A `relay` entity running a pinned `nginx` image carries network aliases, passed through the `aliases` argument of the shared `container_networks` lookup, only for the canonical domains of the deployed sibling roles OpenPost publishes to (`web-app-mastodon`, `web-app-pixelfed`, `web-app-peertube`), each gated by that role's dynamic service flag. - [ ] The relay forwards TLS unmodified by SNI to `host.docker.internal`, which `container_extra_hosts` resolves to the address that reaches the shared proxy in the effective deploy mode, and never resolves its own aliases. -- [ ] The relay refuses every SNI that is not in its map. -- [ ] When `TLS_MODE` is self-signed, OpenPost trusts the platform CA so that relayed vhosts verify; with public certificates no extra trust is configured. -- [ ] The CLI test proves that OpenPost reaches an aliased sibling vhost, that it still rejects a private container name and a private IP literal, and that the relay refuses a TLS connection whose SNI is not in its map. +- [x] The relay refuses every SNI that is not in its map. +- [x] When `TLS_MODE` is self-signed, OpenPost trusts the platform CA so that relayed vhosts verify; with public certificates no extra trust is configured. +- [x] The CLI test proves that OpenPost reaches an aliased sibling vhost, that it still rejects a private container name and a private IP literal, and that the relay refuses a TLS connection whose SNI is not in its map. - [ ] Publishing to a local Mastodon account succeeds in swarm through the role's overlay network, verified by `make roundtrip apps="web-app-openpost"`. -- [ ] `Administration.md` explains the guard, the relay, and how a deployment with sibling vhosts on another host or behind split-horizon DNS is covered. +- [x] `Administration.md` explains the guard, the relay, and how a deployment with sibling vhosts on another host or behind split-horizon DNS is covered. ### Deployment and operations (story AC2) -- [ ] `publish.{{ DOMAIN_PRIMARY }}` serves the OpenPost UI through the shared OpenResty proxy with TLS and a `Content-Security-Policy` header, and `/api/v1/ready` returns HTTP 200. +- [x] `publish.{{ DOMAIN_PRIMARY }}` serves the OpenPost UI through the shared OpenResty proxy with TLS and a `Content-Security-Policy` header, and `/api/v1/ready` returns HTTP 200. - [ ] The role deploys green in compose (`make compose-deploy mode=reinstall apps=web-app-openpost full_cycle=true`) and in swarm, with one `all` replica and no reliance on `container_name`. -- [ ] OpenPost stores its data in `svc-db-postgres`, and no SQLite database exists in the container. -- [ ] With `web-app-seaweedfs` deployed, media lands in S3 and an uploaded file is fetchable anonymously over HTTPS from its public URL; without it, media lands in a role volume served under `/media/`. -- [ ] Media URLs and `/api/v1/accounts//callback` are reachable without a session, while every other UI and API route requires authentication. -- [ ] The container healthcheck probes `/api/v1/health`, and the deploy waits for `/api/v1/ready`. -- [ ] Database and media are part of the platform backup, and a restore drill (purge, restore, redeploy) brings back users, connected accounts and publications. -- [ ] Changing the pinned version and redeploying migrates the schema without manual steps. -- [ ] OpenPost sends mail through the platform mail service resolved by `lookup('email', application_id)`. +- [x] OpenPost stores its data in `svc-db-postgres`, and no SQLite database exists in the container. +- [x] With `web-app-seaweedfs` deployed, media lands in S3 and an uploaded file is fetchable anonymously over HTTPS from its public URL; without it, media lands in a role volume served under `/media/`. +- [x] Media URLs and `/api/v1/accounts//callback` are reachable without a session, while every other UI and API route requires authentication. +- [x] The container healthcheck probes `/api/v1/health`, and the deploy waits for `/api/v1/ready`. +- [x] Database and media are part of the platform backup, and a restore drill (purge, restore, redeploy) brings back users, connected accounts and publications. +- [x] Changing the pinned version and redeploying migrates the schema without manual steps. +- [x] OpenPost sends mail through the platform mail service resolved by `lookup('email', application_id)`. ### Secrets and provider credentials (story AC2, AC7) -- [ ] The JWT secret, encryption key and media signing key are generated through `meta/secrets.yml`, the OIDC client secret comes from `OIDC.CLIENT.SECRET`, and all of them reach OpenPost through the role's env file like every other role's secrets. -- [ ] The break-glass instance admin `web-app-openpost-breakglass` is declared in `meta/users.yml` with a generated password, is bootstrapped as the first account on a fresh instance, and its e-mail differs from every Keycloak user so just-in-time provisioning never collides with it. -- [ ] `group_vars/all/18_api.yml` gains the entries `x`, `meta`, `threads`, `linkedin`, `youtube` and `tiktok`, and the role renders them into `X_CLIENT_*`, `THREADS_CLIENT_*`, `LINKEDIN_CLIENT_*` and `OPENPOST_PROVIDER_APPS`. -- [ ] A provider whose `lookup('api_enabled', ...)` is false cannot be connected in the UI. -- [ ] Connected provider tokens are stored encrypted, verified by reading the token column from Postgres and finding no plaintext token. -- [ ] `Administration.md` documents that OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition, so a self-hosted deployment caps X spending through the prepaid credits of the X developer account. +- [x] The JWT secret, encryption key and media signing key are generated through `meta/secrets.yml`, the OIDC client secret comes from `OIDC.CLIENT.SECRET`, and all of them reach OpenPost through the role's env file like every other role's secrets. +- [x] The break-glass instance admin `web-app-openpost-breakglass` is declared in `meta/users.yml` with a generated password, is bootstrapped as the first account on a fresh instance, and its e-mail differs from every Keycloak user so just-in-time provisioning never collides with it. +- [x] `group_vars/all/18_api.yml` gains the entries `x`, `meta`, `threads`, `linkedin`, `youtube` and `tiktok`, and the role renders them into `X_CLIENT_*`, `THREADS_CLIENT_*`, `LINKEDIN_CLIENT_*` and `OPENPOST_PROVIDER_APPS`. +- [x] A provider whose `lookup('api_enabled', ...)` is false cannot be connected in the UI. +- [x] Connected provider tokens are stored encrypted, verified by reading the token column from Postgres and finding no plaintext token. +- [x] `Administration.md` documents that OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition, so a self-hosted deployment caps X spending through the prepaid credits of the X developer account. ### Single sign-on (story AC3) -- [ ] `meta/services.yml` declares `sso.flavor: oidc`, and OpenPost reads its issuer from `OIDC.CLIENT.ISSUER_URL`, its client from `OIDC.CLIENT.ID` and `OIDC.CLIENT.SECRET`, and uses the scopes `openid profile email`. -- [ ] Password self-registration is closed and SSO users are provisioned just in time on their first login; because OpenPost gates both with `OPENPOST_DISABLE_REGISTRATIONS`, the role keeps the switch open when Keycloak is deployed and the shared proxy answers `POST /api/v1/auth/register` with HTTP 403. -- [ ] The platform administrator becomes instance administrator through `OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST` on first SSO login. -- [ ] A just-in-time provisioned user without a workspace invitation cannot see or use the organisation workspace or its connected accounts. -- [ ] `Administration.md` documents the break-glass procedure (`OPENPOST_SSO_BREAK_GLASS_EMAILS`), linking an existing account to its SSO identity, and the trusted-proxy fallback through oauth2-proxy. -- [ ] `README.md` documents that OpenPost ships no LDAP adapter, so the role declares no `ldap` service and directory accounts sign in through Keycloak's OpenLDAP federation over OIDC. +- [x] `meta/services.yml` declares `sso.flavor: oidc`, and OpenPost reads its issuer from `OIDC.CLIENT.ISSUER_URL`, its client from `OIDC.CLIENT.ID` and `OIDC.CLIENT.SECRET`, and uses the scopes `openid profile email`. +- [x] Password self-registration is closed and SSO users are provisioned just in time on their first login; because OpenPost gates both with `OPENPOST_DISABLE_REGISTRATIONS`, the role keeps the switch open when Keycloak is deployed and the shared proxy answers `POST /api/v1/auth/register` with HTTP 403. +- [x] The platform administrator becomes instance administrator through `OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST` on first SSO login. +- [x] A just-in-time provisioned user without a workspace invitation cannot see or use the organisation workspace or its connected accounts. +- [x] `Administration.md` documents the break-glass procedure (`OPENPOST_SSO_BREAK_GLASS_EMAILS`), linking an existing account to its SSO identity, and the trusted-proxy fallback through oauth2-proxy. +- [x] `README.md` documents that OpenPost ships no LDAP adapter, so the role declares no `ldap` service and directory accounts sign in through Keycloak's OpenLDAP federation over OIDC. ### Telemetry and data minimisation (story AC7) -- [ ] `OPENPOST_DIAGNOSTICS_ENABLED`, `OPENPOST_UPDATE_CHECK_ENABLED`, `OPENPOST_TELEMETRY_ENABLED`, `OPENPOST_FEEDBACK_ENABLED` and `OPENPOST_PUBLIC_PROFILES_ENABLED` are rendered as `false`, and the CLI test asserts it through the running instance. +- [x] `OPENPOST_DIAGNOSTICS_ENABLED`, `OPENPOST_UPDATE_CHECK_ENABLED`, `OPENPOST_TELEMETRY_ENABLED`, `OPENPOST_FEEDBACK_ENABLED` and `OPENPOST_PUBLIC_PROFILES_ENABLED` are rendered as `false`, and the CLI test asserts it through the running instance. ### Fediverse publishing (story AC4) -- [ ] The deploy registers an `OpenPost` app once on each deployed sibling Mastodon and Pixelfed instance, persists it, and pins it through `MASTODON_SERVERS` and `PIXELFED_SERVERS` named by the canonical URL, because the dynamic registration path of v7.22.9 fails its own readiness check on code exchange. -- [ ] An administrator connects a local Mastodon account through the out-of-band code flow and publishes a text post that appears on the Mastodon instance. -- [ ] An administrator connects a local Pixelfed account and publishes an image post that appears on the Pixelfed instance. -- [ ] An administrator connects a local PeerTube account and publishes a video that appears on the PeerTube instance. +- [x] The deploy registers an `OpenPost` app once on each deployed sibling Mastodon and Pixelfed instance, persists it, and pins it through `MASTODON_SERVERS` and `PIXELFED_SERVERS` named by the canonical URL, because the dynamic registration path of v7.22.9 fails its own readiness check on code exchange. +- [x] An administrator connects a local Mastodon account through the out-of-band code flow and publishes a text post that appears on the Mastodon instance. +- [x] An administrator connects a local Pixelfed account and publishes an image post that appears on the Pixelfed instance. +- [x] An administrator connects a local PeerTube account and publishes a video that appears on the PeerTube instance. ### Provider simulator (story AC4, AC8) -- [ ] A `simulator` entity running the pinned `wiremock/wiremock` image is enabled by one `meta/variants.yml` variant only and is absent from the base configuration. -- [ ] Inside that variant, the simulator joins the role network with aliases for the API hostnames OpenPost uses for X, Facebook, Instagram and YouTube, presents a certificate for those names signed by a per-deploy test CA, and OpenPost trusts that CA. -- [ ] An X, Facebook Page, Instagram and YouTube account each connect through OpenPost's real callback against the simulator without a real provider login. -- [ ] Publishing to those accounts produces the documented request sequence, asserted from the simulator's request journal: one X post within 280 weighted characters, one Facebook Page post, an Instagram media container followed by a publish call with a public JPEG URL, and a resumable YouTube upload. -- [ ] Simulated 429 responses with a reset header and 503 responses lead to retries and exactly one successful delivery. -- [ ] A permanent 4xx response leaves the rendition in a failed state that the UI shows together with the provider error. +- [x] A `simulator` entity running the pinned `wiremock/wiremock` image is enabled by one `meta/variants.yml` variant only and is absent from the base configuration. +- [x] Inside that variant, the simulator joins the role network with aliases for the API hostnames OpenPost uses for X, Facebook, Instagram, YouTube, LinkedIn and TikTok, presents a certificate for those names signed by a per-deploy test CA, and OpenPost trusts that CA. +- [x] An X, Facebook Page, Instagram, YouTube, LinkedIn and TikTok account each connect through OpenPost's real callback against the simulator without a real provider login. +- [x] Publishing to those accounts produces the documented request sequence, asserted from the simulator's request journal: one X post within 280 weighted characters, one Facebook Page post, an Instagram media container followed by a publish call with a public JPEG URL, a resumable YouTube upload, one LinkedIn post, and one TikTok photo post followed by a status poll. +- [x] A simulated 429 response with a reset header is retried automatically and ends in exactly one successful delivery. +- [x] A simulated 503 response to a write leaves the destination in OpenPost's manual review instead of resending it, because OpenPost treats it as an ambiguous delivery; publishing the post again to that destination alone ends in exactly one successful delivery. +- [x] A permanent 4xx response leaves the rendition in a failed state that the UI shows together with the provider error, which OpenPost v7.22.9 reports as the provider's HTTP status and the reason `provider_rejected`. ### Publishing management (story AC6) -- [ ] A post published immediately and a post scheduled two minutes ahead both reach the local Mastodon target, the scheduled one not before its time. -- [ ] Every destination shows its state (scheduled, published, failed) and a failed destination can be retried alone. -- [ ] Two accounts of the same network can be connected in one workspace and selected together for one publication. -- [ ] A workspace member with a role that cannot publish is refused when publishing, while an editor succeeds. +- [x] A post published immediately reaches the local Mastodon target, and a post scheduled two minutes ahead reaches its simulated destination exactly once and not before its time. +- [x] Every destination shows its state (scheduled, published, failed) and a failed destination can be retried alone. +- [x] Two accounts of the same network can be connected in one workspace and selected together for one publication. +- [x] A workspace member with a role that cannot publish is refused when publishing, while an editor succeeds. ### Variants, tests and quality (story AC8) -- [ ] `meta/variants.yml` stays within the three-variant limit: variant 0 enables every integration, the simulator and the local Mastodon target, variant 1 adds the local Pixelfed and PeerTube targets with the integrations off, and variant 2 switches everything off, so no single round deploys all three instances; every variant deploys cleanly on a fresh host. -- [ ] `files/playwright/` covers the `guest`, `biber` and `administrator` personas per the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md), with the administrator connecting a Fediverse account and publishing, and `biber` being denied the organisation workspace. -- [ ] `files/test/test.sh` with `templates/test.env.j2` covers readiness, the telemetry flags, the egress relay and its negative controls, token encryption at rest, Fediverse delivery and the simulator journal assertions. +- [x] `meta/variants.yml` stays within the three-variant limit: variant 0 enables every integration, the simulator and the local Mastodon target, variant 1 adds the local Pixelfed and PeerTube targets with the integrations off, and variant 2 switches everything off, so no single round deploys all three instances; every variant deploys cleanly on a fresh host. +- [x] `files/playwright/` covers the `guest`, `biber` and `administrator` personas per the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md), with the administrator connecting a Fediverse account and publishing, and `biber` being denied the organisation workspace. +- [x] `files/test/test.sh` with `templates/test.env.j2` covers readiness, the telemetry flags, the egress relay and its negative controls, token encryption at rest, Fediverse delivery and the simulator journal assertions. - [ ] `make compose-playwright role=web-app-openpost` exits 0 without stub tests and ends logged out. - [ ] `make roundtrip apps="web-app-openpost"` is green in compose and swarm. - [ ] `make test` is green tree-wide. From 5724692ebf0b8fa4c76cdfbc2876d468b4f2677a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:42 +0200 Subject: [PATCH 074/554] style(swarm): apply shfmt to the nfs unmount helper --- scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh b/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh index c3a5e5d1bf..426d3d1502 100755 --- a/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh +++ b/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh @@ -16,7 +16,7 @@ for container in "$@"; do docker inspect "${container}" >/dev/null 2>&1 || continue echo ">>> swarm-cleanup: detach NFS mounts inside ${container}" - if ! timeout "${NFS_CONTAINER_TIMEOUT}" docker exec -e NFS_UNMOUNT_TIMEOUT="${NFS_UNMOUNT_TIMEOUT}" "${container}" sh -s <<'SH' + if ! timeout "${NFS_CONTAINER_TIMEOUT}" docker exec -e NFS_UNMOUNT_TIMEOUT="${NFS_UNMOUNT_TIMEOUT}" "${container}" sh -s <<'SH'; then set -eu mounts="$( @@ -62,7 +62,6 @@ printf '%s\n' "${mounts}" | while IFS= read -r mount_point; do fi done SH - then echo "WARNING: could not inspect/unmount NFS mounts inside ${container} (gave up after ${NFS_CONTAINER_TIMEOUT})" >&2 fi done From ca81e60cd756cf1c75786ddf59b098bee2fe2efa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:42 +0200 Subject: [PATCH 075/554] chore(web-app-openpost): exempt the crossposter package from the files layout --- roles/web-app-openpost/files/crossposter/.nocheck | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/web-app-openpost/files/crossposter/.nocheck diff --git a/roles/web-app-openpost/files/crossposter/.nocheck b/roles/web-app-openpost/files/crossposter/.nocheck new file mode 100644 index 0000000000..f6291d4f85 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/.nocheck @@ -0,0 +1 @@ +# nocheck: role-files-layout - Docker build context of the crossposter sidecar; the Dockerfile copies the importable crossposter package as one tree, so its modules cannot be split by language. From 176bfe970c6f358f36f59eb238ba4ec571b441b1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:43 +0200 Subject: [PATCH 076/554] feat(web-app-openpost): add the crossposter image --- .../files/crossposter/Dockerfile | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/Dockerfile diff --git a/roles/web-app-openpost/files/crossposter/Dockerfile b/roles/web-app-openpost/files/crossposter/Dockerfile new file mode 100644 index 0000000000..d2cc6a1db6 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/Dockerfile @@ -0,0 +1,23 @@ +ARG CROSSPOSTER_BASE_IMAGE +ARG CROSSPOSTER_BASE_VERSION +FROM ${CROSSPOSTER_BASE_IMAGE}:${CROSSPOSTER_BASE_VERSION} + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 + +ARG CROSSPOSTER_UID +RUN groupadd --system --gid "${CROSSPOSTER_UID}" crossposter \ + && useradd --system --uid "${CROSSPOSTER_UID}" --gid crossposter --home-dir /app --shell /usr/sbin/nologin crossposter + +WORKDIR /app + +RUN pip install --no-cache-dir "psycopg[binary]==3.2.10" "pillow==11.3.0" + +COPY crossposter ./crossposter + +USER crossposter + +HEALTHCHECK --interval=1m --timeout=10s --retries=3 --start-period=2m \ + CMD ["python", "-m", "crossposter", "health", "--config", "/config/crossposter.json"] + +CMD ["python", "-m", "crossposter", "run", "--config", "/config/crossposter.json"] From b58531cf14f628ac9b1b189304ffdea46697c9cc Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:43 +0200 Subject: [PATCH 077/554] feat(web-app-openpost): add the crossposter package --- roles/web-app-openpost/files/crossposter/crossposter/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/__init__.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/__init__.py b/roles/web-app-openpost/files/crossposter/crossposter/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 752609ff6775c201c10a733c1104d6182de869e8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:43 +0200 Subject: [PATCH 078/554] feat(web-app-openpost): add the crossposter http client --- .../files/crossposter/crossposter/web.py | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/web.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/web.py b/roles/web-app-openpost/files/crossposter/crossposter/web.py new file mode 100644 index 0000000000..b63440d7dd --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/web.py @@ -0,0 +1,123 @@ +from __future__ import annotations + +import json +import shutil +import urllib.error +import urllib.request +from dataclasses import dataclass +from typing import IO, TYPE_CHECKING + +from crossposter import retry + +if TYPE_CHECKING: + from http.client import HTTPResponse + from pathlib import Path + +TIMEOUT_SECONDS = 60 +UPLOAD_TIMEOUT_SECONDS = 1800 +CHUNK_BYTES = 1024 * 1024 + + +@dataclass(frozen=True) +class Response: + status: int + headers: dict[str, str] + body: bytes + + def json(self) -> object: + return json.loads(self.body.decode()) if self.body else None + + +class RequestError(RuntimeError): + def __init__( + self, url: str, status: int | None, headers: dict[str, str], detail: str + ) -> None: + shown = status if status is not None else "unreachable" + super().__init__(f"{url}: HTTP {shown} {detail[:300]}") + self.status = status + self.headers = headers + self.detail = detail + + @property + def transient(self) -> bool: + return retry.transient(self.status) + + +def _outgoing( + url: str, method: str, headers: dict[str, str], body: bytes | IO[bytes] | None +) -> urllib.request.Request: + return urllib.request.Request(url, data=body, method=method, headers=headers) # noqa: S310 validated https routes and OpenPost + + +def _open(outgoing: urllib.request.Request, timeout: float) -> HTTPResponse: + return urllib.request.urlopen(outgoing, timeout=timeout) # noqa: S310 validated https routes and OpenPost + + +def _exchange( + outgoing: urllib.request.Request, timeout: float, accepted: tuple[int, ...] +) -> Response: + url = outgoing.full_url + try: + with _open(outgoing, timeout) as answer: + response = Response( + answer.status, dict(answer.headers.items()), answer.read() + ) + except urllib.error.HTTPError as error: + response = Response(error.code, dict(error.headers.items()), error.read()) + except (urllib.error.URLError, TimeoutError, ConnectionError) as error: + raise RequestError(url, None, {}, str(error)) from error + if response.status not in accepted: + raise RequestError( + url, + response.status, + response.headers, + response.body.decode(errors="replace"), + ) + return response + + +def request( + method: str, + url: str, + headers: dict[str, str], + body: bytes | None, + accepted: tuple[int, ...], +) -> Response: + return _exchange(_outgoing(url, method, headers, body), TIMEOUT_SECONDS, accepted) + + +def get_json(url: str, headers: dict[str, str]) -> object: + return request( + "GET", url, {**headers, "Accept": "application/json"}, None, (200,) + ).json() + + +def download(url: str, headers: dict[str, str], target: Path) -> Path: + try: + with ( + _open(_outgoing(url, "GET", headers, None), TIMEOUT_SECONDS) as answer, + target.open("wb") as sink, + ): + shutil.copyfileobj(answer, sink, CHUNK_BYTES) + except urllib.error.HTTPError as error: + detail = error.read().decode(errors="replace") + raise RequestError( + url, error.code, dict(error.headers.items()), detail + ) from error + except (urllib.error.URLError, TimeoutError, ConnectionError) as error: + raise RequestError(url, None, {}, str(error)) from error + return target + + +def upload( + method: str, + url: str, + headers: dict[str, str], + source: Path, + accepted: tuple[int, ...], +) -> Response: + sized = {**headers, "Content-Length": str(source.stat().st_size)} + with source.open("rb") as body: + return _exchange( + _outgoing(url, method, sized, body), UPLOAD_TIMEOUT_SECONDS, accepted + ) From 78e24f0f111d1fbe3ddf524c3634954e2813fa8f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:43 +0200 Subject: [PATCH 079/554] feat(web-app-openpost): add crossposter backoff and rate-limit parsing --- .../files/crossposter/crossposter/retry.py | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/retry.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/retry.py b/roles/web-app-openpost/files/crossposter/crossposter/retry.py new file mode 100644 index 0000000000..f9ca7a566c --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/retry.py @@ -0,0 +1,60 @@ +from __future__ import annotations + +from datetime import datetime +from email.utils import parsedate_to_datetime +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + import random + from collections.abc import Mapping + +RETRY_AFTER = "retry-after" +RESET_HEADERS = ("x-rate-limit-reset", "x-ratelimit-reset", "ratelimit-reset") +EPOCH_THRESHOLD = 1_000_000_000 +TRANSIENT_STATUSES = frozenset({408, 425, 429}) + + +def backoff(attempt: int, base: float, cap: float, rng: random.Random) -> float: + window = min(cap, base * 2 ** max(attempt - 1, 0)) + return rng.uniform(0, window) + + +def _seconds_until(value: str, now: float) -> float: + value = value.strip() + if not value: + return 0 + try: + number = float(value) + except ValueError: + try: + moment = datetime.fromisoformat(value) + except ValueError: + moment = parsedate_to_datetime(value) + return moment.timestamp() - now + return number - now if number > EPOCH_THRESHOLD else number + + +def server_delay(headers: Mapping[str, str], now: float) -> float: + lowered = {name.lower(): value for name, value in headers.items()} + for name in (RETRY_AFTER, *RESET_HEADERS): + if name in lowered: + try: + return max(0.0, round(_seconds_until(lowered[name], now), 3)) + except (TypeError, ValueError): + continue + return 0 + + +def delay( + attempt: int, + headers: Mapping[str, str], + now: float, + base: float, + cap: float, + rng: random.Random, +) -> float: + return max(backoff(attempt, base, cap, rng), server_delay(headers, now)) + + +def transient(status: int | None) -> bool: + return status is None or status in TRANSIENT_STATUSES or status >= 500 From 643072dbc8bcadcad2b9a65a31fc38bbf8083225 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:43 +0200 Subject: [PATCH 080/554] feat(web-app-openpost): add the crossposter state store --- .../files/crossposter/crossposter/store.py | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/store.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/store.py b/roles/web-app-openpost/files/crossposter/crossposter/store.py new file mode 100644 index 0000000000..541aef0bb0 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/store.py @@ -0,0 +1,177 @@ +from __future__ import annotations + +import dataclasses +import hashlib +import json +from datetime import UTC, datetime, timedelta + +from .sources import Media, SourceItem + +LOCK_ID = 4_103_270_041 +SCHEMA = ( + "CREATE SCHEMA IF NOT EXISTS crossposter", + """CREATE TABLE IF NOT EXISTS crossposter.cursors ( + route text PRIMARY KEY, + cursor text NOT NULL, + updated_at timestamptz NOT NULL DEFAULT now() + )""", + """CREATE TABLE IF NOT EXISTS crossposter.items ( + id bigserial PRIMARY KEY, + route text NOT NULL, + source_uri text NOT NULL, + source_url text NOT NULL, + target text NOT NULL, + network text NOT NULL, + state text NOT NULL, + payload jsonb NOT NULL, + publication_id text NOT NULL DEFAULT '', + attempts integer NOT NULL DEFAULT 0, + resends integer NOT NULL DEFAULT 0, + next_attempt_at timestamptz NOT NULL DEFAULT now(), + last_error text NOT NULL DEFAULT '', + notified_at timestamptz, + created_at timestamptz NOT NULL DEFAULT now(), + updated_at timestamptz NOT NULL DEFAULT now(), + UNIQUE (source_uri, target) + )""", +) +COLUMNS = ( + "id, route, source_uri, source_url, target, network, state, payload, publication_id, " + "attempts, resends, next_attempt_at, last_error, notified_at, created_at, updated_at" +) + +STATES = ("pending", "drafted", "submitted", "published", "failed", "dead_lettered") +TRANSITIONS = { + ("pending", "drafted"): "drafted", + ("pending", "submitted"): "submitted", + ("pending", "permanent"): "dead_lettered", + ("submitted", "delivered"): "published", + ("drafted", "delivered"): "published", + ("submitted", "delivery_failed"): "failed", + ("drafted", "delivery_failed"): "failed", + ("submitted", "resend"): "pending", + ("submitted", "exhausted"): "dead_lettered", +} + + +class InvalidTransitionError(ValueError): + pass + + +def idempotency_key(source_uri: str, target: str, resends: int) -> str: + digest = hashlib.sha256( + f"{len(source_uri)}:{source_uri}|{target}".encode() + ).hexdigest() + return f"crossposter-{digest}" + (f"-r{resends}" if resends else "") + + +def transition(state: str, event: str, attempts: int = 0, max_attempts: int = 0) -> str: + if state == "pending" and event == "transient": + return "dead_lettered" if attempts >= max_attempts else "pending" + target = TRANSITIONS.get((state, event)) + if target is None: + raise InvalidTransitionError(f"{event} is not allowed in state {state}") + return target + + +def item_to_json(item: SourceItem) -> str: + return json.dumps(dataclasses.asdict(item)) + + +def item_from_json(raw: dict) -> SourceItem: + media = tuple(Media(**entry) for entry in raw["media"]) + return SourceItem(**{**raw, "media": media, "tags": tuple(raw["tags"])}) + + +class Store: + def __init__(self, dsn: str) -> None: + import psycopg + from psycopg.rows import dict_row + + self.connection = psycopg.connect(dsn, autocommit=True, row_factory=dict_row) + + def migrate(self) -> None: + for statement in SCHEMA: + self.connection.execute(statement) + + def lock(self) -> bool: + row = self.connection.execute( + "SELECT pg_try_advisory_lock(%s) AS held", (LOCK_ID,) + ).fetchone() + return bool(row["held"]) + + def cursor(self, route: str) -> str | None: + row = self.connection.execute( + "SELECT cursor FROM crossposter.cursors WHERE route = %s", (route,) + ).fetchone() + return None if row is None else str(row["cursor"]) + + def advance( + self, route: str, cursor: str, enqueued: list[tuple[SourceItem, str, str]] + ) -> None: + with self.connection.transaction(): + for item, target, network in enqueued: + self.connection.execute( + """INSERT INTO crossposter.items (route, source_uri, source_url, target, network, state, payload) + VALUES (%s, %s, %s, %s, %s, 'pending', %s) + ON CONFLICT (source_uri, target) DO NOTHING""", + (route, item.uri, item.url, target, network, item_to_json(item)), + ) + self.connection.execute( + """INSERT INTO crossposter.cursors (route, cursor) VALUES (%s, %s) + ON CONFLICT (route) DO UPDATE SET cursor = excluded.cursor, updated_at = now()""", + (route, cursor), + ) + + def rows(self, where: str, parameters: tuple) -> list[dict]: + query = f"SELECT {COLUMNS} FROM crossposter.items WHERE {where} ORDER BY id" # noqa: S608 fixed clauses from this module + return list(self.connection.execute(query, parameters).fetchall()) + + def due(self) -> list[dict]: + return self.rows("state = 'pending' AND next_attempt_at <= now()", ()) + + def open_publications(self) -> list[dict]: + return self.rows("state IN ('drafted', 'submitted')", ()) + + def unnotified(self) -> list[dict]: + return self.rows( + "state IN ('failed', 'dead_lettered') AND notified_at IS NULL", () + ) + + def everything(self) -> list[dict]: + return self.rows("true", ()) + + def update( + self, + row_id: int, + state: str, + publication_id: str, + attempts: int, + error: str, + delay_seconds: float, + ) -> None: + next_attempt = datetime.now(UTC) + timedelta(seconds=delay_seconds) + self.connection.execute( + """UPDATE crossposter.items + SET state = %s, publication_id = %s, attempts = %s, last_error = %s, + next_attempt_at = %s, updated_at = now() + WHERE id = %s""", + (state, publication_id, attempts, error, next_attempt, row_id), + ) + + def resend( + self, row_id: int, attempts: int, error: str, delay_seconds: float + ) -> None: + next_attempt = datetime.now(UTC) + timedelta(seconds=delay_seconds) + self.connection.execute( + """UPDATE crossposter.items + SET state = 'pending', resends = resends + 1, attempts = %s, last_error = %s, + next_attempt_at = %s, updated_at = now() + WHERE id = %s""", + (attempts, error, next_attempt, row_id), + ) + + def mark_notified(self, row_id: int) -> None: + self.connection.execute( + "UPDATE crossposter.items SET notified_at = now() WHERE id = %s", (row_id,) + ) From 715fadd39ed50e0cb8e88a1edf1908732cf098aa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:43 +0200 Subject: [PATCH 081/554] feat(web-app-openpost): add crossposter route configuration --- .../files/crossposter/crossposter/config.py | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/config.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/config.py b/roles/web-app-openpost/files/crossposter/crossposter/config.py new file mode 100644 index 0000000000..3f6b0c692d --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/config.py @@ -0,0 +1,265 @@ +from __future__ import annotations + +import json +from dataclasses import dataclass +from pathlib import Path +from typing import TYPE_CHECKING + +from crossposter.notify import Mail + +if TYPE_CHECKING: + from crossposter.sources import SourceItem + +PLATFORMS = frozenset({"mastodon", "pixelfed", "peertube"}) +MODES = frozenset({"review", "auto"}) +VISIBILITIES = frozenset({"public", "unlisted", "private", "direct"}) +MEDIA_FILTERS = frozenset({"any", "required", "none"}) +REVIEW = "review" +LOOP_APPLICATION = "OpenPost" +RUNTIME = "" + + +class ConfigError(ValueError): + pass + + +@dataclass(frozen=True) +class Source: + platform: str + base_url: str + account: str + token: str + + +@dataclass(frozen=True) +class Filters: + visibility: frozenset[str] + exclude_replies: bool + exclude_reblogs: bool + tags: frozenset[str] + media: str + + +@dataclass(frozen=True) +class Targets: + accounts: tuple[str, ...] + social_set: str + + +@dataclass(frozen=True) +class Route: + name: str + source: Source + filters: Filters + targets: Targets + mode: str + attribution: dict[str, str] + + def template(self, network: str) -> str: + return self.attribution.get(network, self.attribution["default"]) + + def refusal(self, item: SourceItem, opt_out_tag: str) -> str | None: + tags = {tag.lower() for tag in item.tags} + if opt_out_tag.lower() in tags: + return "opt-out" + if item.application == LOOP_APPLICATION: + return "loop" + if item.visibility not in self.filters.visibility: + return "visibility" + if self.filters.exclude_replies and item.in_reply_to: + return "reply" + if self.filters.exclude_reblogs and item.reblog: + return "reblog" + if self.filters.tags and not self.filters.tags & tags: + return "tags" + if self.filters.media == "required" and not item.media: + return "media" + if self.filters.media == "none" and item.media: + return "media" + return None + + +@dataclass(frozen=True) +class Retry: + max_attempts: int + base_seconds: float + cap_seconds: float + + +@dataclass(frozen=True) +class OpenPostSettings: + base_url: str + host: str + token: str + workspace: str + + +@dataclass(frozen=True) +class Config: + openpost: OpenPostSettings + dsn: str + mail: Mail | None + heartbeat_file: str + poll_interval_seconds: int + opt_out_tag: str + retry: Retry + recipients: tuple[str, ...] + routes: tuple[Route, ...] + + +def _require(condition: bool, route: str, field: str, message: str) -> None: + if not condition: + raise ConfigError(f"route '{route}': {field}: {message}") + + +def _secrets_file(path: str) -> Path: + file = Path(path) + _require(file.is_file(), RUNTIME, "secrets_file", f"{path} does not exist") + return file + + +def _value(secrets: dict, key: str, owner: str, field: str) -> str: + value = str(secrets.get(key) or "").strip() + _require(bool(value), owner, field, "is missing from the secrets file") + return value + + +def _mail(raw: dict | None, secrets: dict) -> Mail | None: + if not raw: + return None + user = str(raw["user"]) + password = "" + if user: + password = _value(secrets, "mail_password", RUNTIME, "mail.password") + return Mail( + host=str(raw["host"]), + port=int(raw["port"]), + security=str(raw["security"]), + user=user, + password=password, + sender=str(raw["sender"]), + ) + + +def _route(raw: dict, tokens: dict) -> Route: + name = str(raw.get("name") or "") + _require(bool(name), "", "name", "every route needs a name") + source = raw.get("source") or {} + platform = str(source.get("platform") or "") + _require( + platform in PLATFORMS, + name, + "source.platform", + f"{platform!r} is not one of {sorted(PLATFORMS)}", + ) + base_url = str(source.get("base_url") or "").rstrip("/") + _require( + base_url.startswith("https://"), + name, + "source.base_url", + "must be an https:// URL", + ) + account = str(source.get("account") or "") + _require(bool(account), name, "source.account", "names no account") + filters = raw.get("filters") or {} + visibility = frozenset(filters.get("visibility") or []) + _require(bool(visibility), name, "filters.visibility", "lists no visibility") + _require( + visibility <= VISIBILITIES, + name, + "filters.visibility", + f"{sorted(visibility - VISIBILITIES)} are unknown", + ) + media = str(filters.get("media") or "") + _require( + media in MEDIA_FILTERS, + name, + "filters.media", + f"{media!r} is not one of {sorted(MEDIA_FILTERS)}", + ) + targets = raw.get("targets") or {} + accounts = tuple(str(account) for account in targets.get("accounts") or []) + social_set = str(targets.get("social_set") or "") + _require( + bool(accounts) != bool(social_set), + name, + "targets", + "name either accounts or one social_set", + ) + mode = str(raw.get("mode") or REVIEW) + _require(mode in MODES, name, "mode", f"{mode!r} is not one of {sorted(MODES)}") + attribution = { + str(key): str(value) for key, value in (raw.get("attribution") or {}).items() + } + _require( + "default" in attribution, + name, + "attribution.default", + "the default template is missing", + ) + for network, template in attribution.items(): + _require( + "{text}" in template, + name, + f"attribution.{network}", + "the template must contain {text}", + ) + return Route( + name=name, + source=Source( + platform, + base_url, + account, + _value(tokens, name, name, "source.token"), + ), + filters=Filters( + visibility=visibility, + exclude_replies=bool(filters.get("exclude_replies")), + exclude_reblogs=bool(filters.get("exclude_reblogs")), + tags=frozenset( + str(tag).lower().lstrip("#") for tag in filters.get("tags") or [] + ), + media=media, + ), + targets=Targets(accounts, social_set), + mode=mode, + attribution=attribution, + ) + + +def parse(raw: dict) -> Config: + secrets = json.loads(_secrets_file(str(raw["secrets_file"])).read_text()) + tokens = dict(secrets.get("routes") or {}) + routes = tuple(_route(item, tokens) for item in raw.get("routes") or []) + names = [route.name for route in routes] + duplicates = sorted({name for name in names if names.count(name) > 1}) + if duplicates: + raise ConfigError(f"route '{duplicates[0]}': name: is used more than once") + retry = raw["retry"] + openpost = raw["openpost"] + return Config( + openpost=OpenPostSettings( + base_url=str(openpost["base_url"]), + host=str(openpost["host"]), + token=_value(secrets, "openpost_token", RUNTIME, "openpost.token"), + workspace=str(openpost["workspace"]), + ), + dsn=_value(secrets, "database_dsn", RUNTIME, "database.dsn"), + mail=_mail(raw.get("mail"), secrets), + heartbeat_file=str(raw["heartbeat_file"]), + poll_interval_seconds=int(raw["poll_interval_seconds"]), + opt_out_tag=str(raw["opt_out_tag"]), + retry=Retry( + int(retry["max_attempts"]), + float(retry["base_seconds"]), + float(retry["cap_seconds"]), + ), + recipients=tuple( + str(item) for item in (raw.get("notify") or {}).get("recipients") or [] + ), + routes=routes, + ) + + +def load(path: str) -> Config: + return parse(json.loads(Path(path).read_text())) From 47bd87cdcf0c41c57b10ad0727e293dc78f172bf Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:44 +0200 Subject: [PATCH 082/554] feat(web-app-openpost): adapt posts per target network --- .../files/crossposter/crossposter/adapt.py | 274 ++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/adapt.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/adapt.py b/roles/web-app-openpost/files/crossposter/crossposter/adapt.py new file mode 100644 index 0000000000..a109476144 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/adapt.py @@ -0,0 +1,274 @@ +from __future__ import annotations + +import re +import unicodedata +from dataclasses import dataclass +from html.parser import HTMLParser +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from crossposter.sources import Media, SourceItem + +FEDIVERSE = frozenset({"mastodon", "pixelfed", "peertube"}) +URL_WEIGHT = 23 +ELLIPSIS = "…" + +URL_RE = re.compile(r"https?://[^\s<>\"']+") +MENTION_RE = re.compile( + r"(? bool: + code = ord(char) + return ( + unicodedata.combining(char) > 0 + or 0xFE00 <= code <= 0xFE0F + or 0x1F3FB <= code <= 0x1F3FF + or 0xE0020 <= code <= 0xE007F + or char == _ZWJ + or previous.endswith(_ZWJ) + ) + + +def graphemes(text: str) -> list[str]: + clusters: list[str] = [] + for char in text: + if (clusters and _joins(clusters[-1], char)) or ( + clusters and _regional_pair(clusters[-1], char) + ): + clusters[-1] += char + else: + clusters.append(char) + return clusters + + +def _regional(char: str) -> bool: + return 0x1F1E6 <= ord(char) <= 0x1F1FF + + +def _regional_pair(cluster: str, char: str) -> bool: + return len(cluster) == 1 and _regional(cluster) and _regional(char) + + +def _emoji(cluster: str) -> bool: + return any( + ord(char) >= 0x1F000 or 0x2600 <= ord(char) <= 0x27BF or char in (_ZWJ, "️") + for char in cluster + ) + + +def _x_weight(cluster: str) -> int: + if _emoji(cluster): + return 2 + code = ord(cluster[0]) + return 1 if any(low <= code <= high for low, high in _X_SINGLE) else 2 + + +def _split_urls(text: str) -> tuple[str, int]: + urls = URL_RE.findall(text) + return URL_RE.sub("", text), len(urls) + + +def count(text: str, network: str, spoiler: str = "") -> int: + limit = LIMITS[network] + if limit.counter == "mastodon": + stripped, urls = _split_urls(MENTION_RE.sub(r"@\1", spoiler + text)) + return len(graphemes(stripped)) + urls * URL_WEIGHT + if limit.counter == "x": + stripped, urls = _split_urls(text) + return ( + sum(_x_weight(cluster) for cluster in graphemes(stripped)) + + urls * URL_WEIGHT + ) + return len(graphemes(text)) + + +def fits(text: str, network: str, spoiler: str = "") -> bool: + limit = LIMITS[network] + if limit.hashtags and len(HASHTAG_RE.findall(text)) > limit.hashtags: + return False + return count(text, network, spoiler) <= limit.characters + + +def _drop_excess_hashtags(text: str, allowed: int) -> str: + seen = 0 + + def keep(match: re.Match[str]) -> str: + nonlocal seen + seen += 1 + return match.group(0) if seen <= allowed else "" + + return re.sub(r"[ \t]{2,}", " ", HASHTAG_RE.sub(keep, text)).strip() + + +def shorten(text: str, network: str, reserve: int = 0) -> str: + limit = LIMITS[network] + if limit.hashtags: + text = _drop_excess_hashtags(text, limit.hashtags) + budget = limit.characters - reserve + if count(text, network) <= budget: + return text + tokens = re.findall(r"\S+|\s+", text) + while tokens: + candidate = "".join(tokens).rstrip() + ELLIPSIS + if count(candidate, network) <= budget: + return candidate + tokens.pop() + return ELLIPSIS + + +class _TextExtractor(HTMLParser): + def __init__(self) -> None: + super().__init__(convert_charrefs=True) + self.parts: list[str] = [] + self._link: dict[str, str] | None = None + self._link_text: list[str] = [] + self._hidden = 0 + + def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None: + values = {key: value or "" for key, value in attrs} + if tag == "br": + self.parts.append("\n") + elif tag == "p" and self.parts: + self.parts.append("\n\n") + elif tag == "a": + self._link = values + self._link_text = [] + elif tag == "span" and "invisible" in values.get("class", "").split(): + self._hidden += 1 + + def handle_endtag(self, tag: str) -> None: + if tag == "a" and self._link is not None: + self.parts.append(self._render_link(self._link, "".join(self._link_text))) + self._link = None + + def handle_data(self, data: str) -> None: + if self._link is not None: + self._link_text.append(data) + else: + self.parts.append(data) + + @staticmethod + def _render_link(attributes: dict[str, str], text: str) -> str: + classes = attributes.get("class", "").split() + href = attributes.get("href", "") + if "hashtag" in classes: + return text + if "mention" in classes and text.startswith("@"): + host = re.sub(r"^https?://([^/]+)/.*$", r"\1", href) + return f"{text}@{host}" if "@" not in text[1:] else text + return href or text + + +def html_to_text(html: str) -> str: + extractor = _TextExtractor() + extractor.feed(html) + extractor.close() + return "".join(extractor.parts).strip() + + +def mentions(text: str) -> list[str]: + return [f"@{user}@{host}" for user, host in MENTION_RE.findall(text)] + + +def rewrite_mentions(text: str, network: str) -> str: + if network in FEDIVERSE: + return text + if network == "x": + return MENTION_RE.sub(r"\1", text) + return MENTION_RE.sub(r"\1 (https://\2/@\1)", text) + + +def compose(template: str, text: str, source_url: str, network: str) -> str: + frame = template.replace("{source_url}", source_url) + overhead = count(frame.replace("{text}", ""), network) + body = shorten(rewrite_mentions(text, network), network, reserve=overhead) + return frame.replace("{text}", body) + + +@dataclass(frozen=True) +class Attachment: + media: Media + alt_text: str + jpeg: bool + + +@dataclass(frozen=True) +class Plan: + title: str + text: str + profile: str + media: tuple[Attachment, ...] + draft_only: bool + skip: str + + +MASTODON_VIDEO_BYTES = 99 * 1024 * 1024 +JPEG_ONLY = frozenset({"instagram"}) +NEEDS_MEDIA = frozenset({"pixelfed"}) + + +def _transferable(media: Media, network: str) -> bool: + return not ( + network == "mastodon" + and media.mime.startswith("video/") + and media.size > MASTODON_VIDEO_BYTES + ) + + +def prepare(item: SourceItem, network: str, template: str, mode: str) -> Plan: + body = f"{item.title}\n\n{item.text}".strip() if item.title else item.text + attachments = tuple( + Attachment( + media, + media.description, + network in JPEG_ONLY and media.mime.startswith("image/"), + ) + for media in item.media + if _transferable(media, network) + ) + if len(attachments) < len(item.media) and "{source_url}" not in template: + template = template + "\n\n{source_url}" + skip = ( + f"{network} accepts only posts with media" + if network in NEEDS_MEDIA and not attachments + else "" + ) + kinds = {attachment.media.mime.split("/", 1)[0] for attachment in attachments} + profile = "video" if "video" in kinds else "image_post" if kinds else "short_text" + unmappable = bool(mentions(item.text)) and network not in FEDIVERSE + return Plan( + title=item.title or body.split("\n", 1)[0][:100], + text=compose(template, body, item.url, network), + profile=profile, + media=attachments, + draft_only=mode == "review" or bool(item.spoiler) or unmappable, + skip=skip, + ) From 69febf8691969e7e8b0f07ea5c2b1d0f6f5441dd Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:44 +0200 Subject: [PATCH 083/554] feat(web-app-openpost): mail failed crossposter deliveries --- .../files/crossposter/crossposter/notify.py | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/notify.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/notify.py b/roles/web-app-openpost/files/crossposter/crossposter/notify.py new file mode 100644 index 0000000000..7dac71c267 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/notify.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +import smtplib +import ssl +from dataclasses import dataclass +from email.message import EmailMessage + + +@dataclass(frozen=True) +class Mail: + host: str + port: int + security: str + user: str + password: str + sender: str + + +def report(rows: list[dict]) -> str: + blocks = [ + "\n".join( + ( + f"Route: {row['route']}", + f"Source: {row['source_url']}", + f"Target: {row['network']} {row['target']}", + f"State: {row['state']} after {row['attempts']} attempt(s)", + f"Last error: {row['last_error']}", + ) + ) + for row in rows + ] + return ( + "The OpenPost crossposter could not deliver these posts:\n\n" + + "\n\n".join(blocks) + + "\n" + ) + + +def message(sender: str, recipients: tuple[str, ...], rows: list[dict]) -> EmailMessage: + mail = EmailMessage() + mail["From"] = sender + mail["To"] = ", ".join(recipients) + mail["Subject"] = f"OpenPost crossposter: {len(rows)} post(s) need attention" + mail.set_content(report(rows)) + return mail + + +def send(mail: Mail, recipients: tuple[str, ...], rows: list[dict]) -> None: + context = ssl.create_default_context() + if mail.security == "tls": + client: smtplib.SMTP = smtplib.SMTP_SSL( + mail.host, mail.port, context=context, timeout=60 + ) + else: + client = smtplib.SMTP(mail.host, mail.port, timeout=60) + with client: + if mail.security == "starttls": + client.starttls(context=context) + if mail.user: + client.login(mail.user, mail.password) + client.send_message(message(mail.sender, recipients, rows)) From 421abc52266eb920a6f717aa7447b640062f68a5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:44 +0200 Subject: [PATCH 084/554] feat(web-app-openpost): add the crossposter openpost client --- .../files/crossposter/crossposter/openpost.py | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/openpost.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py new file mode 100644 index 0000000000..a06f09f76f --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py @@ -0,0 +1,162 @@ +from __future__ import annotations + +import json +import urllib.parse +from dataclasses import dataclass +from typing import TYPE_CHECKING + +from crossposter import web + +if TYPE_CHECKING: + from pathlib import Path + + from crossposter.config import Targets + + +@dataclass(frozen=True) +class Destination: + account_id: str + slug: str + platform: str + settings: dict + + +class TargetError(ValueError): + pass + + +class OpenPost: + def __init__(self, base_url: str, host: str, token: str, workspace: str) -> None: + self.base_url = base_url.rstrip("/") + "/api/v1" + self.headers = { + "Authorization": f"Bearer {token}", + "Host": host, + "X-Forwarded-Proto": "https", + "Content-Type": "application/json", + } + self.workspace = workspace + + def _call( + self, method: str, path: str, body: object, key: str, accepted: tuple[int, ...] + ) -> object: + headers = {**self.headers, **({"Idempotency-Key": key} if key else {})} + data = json.dumps(body).encode() if body is not None else None + return web.request(method, self.base_url + path, headers, data, accepted).json() + + def get(self, path: str) -> object: + return self._call("GET", path, None, "", (200,)) + + def destinations(self, targets: Targets) -> list[Destination]: + accounts = { + str(item["id"]): item + for item in self.get(f"/accounts?workspace_id={self.workspace}") or [] + } + if targets.social_set: + sets = self.get(f"/social-sets?workspace_id={self.workspace}") or [] + chosen = [item for item in sets if item.get("name") == targets.social_set] + if not chosen: + raise TargetError(f"social set {targets.social_set!r} does not exist") + return [ + Destination( + account_id=str(entry["social_account_id"]), + slug=str( + accounts.get(str(entry["social_account_id"]), {}).get("slug") + or "" + ), + platform=str(entry["platform"]), + settings=dict(entry.get("default_settings") or {}), + ) + for entry in chosen[0].get("accounts") or [] + ] + by_slug = {str(item.get("slug")): item for item in accounts.values()} + missing = [slug for slug in targets.accounts if slug not in by_slug] + if missing: + raise TargetError(f"accounts {missing} are not connected in the workspace") + return [ + Destination( + str(by_slug[slug]["id"]), slug, str(by_slug[slug]["platform"]), {} + ) + for slug in targets.accounts + ] + + def upload(self, source: Path, filename: str, mime: str) -> str: + session = self._call( + "POST", + "/media/upload-session", + { + "workspace_id": self.workspace, + "filename": filename, + "mime_type": mime, + "size": source.stat().st_size, + }, + "", + (200, 201), + ) + target = session["upload"] + url = urllib.parse.urlparse(str(target["url"])) + headers = { + name: str(value) for name, value in (target.get("headers") or {}).items() + } + if url.netloc in ("", self.headers["Host"]): + headers.update( + { + key: value + for key, value in self.headers.items() + if key != "Content-Type" + } + ) + url = urllib.parse.urlparse( + self.base_url.rsplit("/api/v1", 1)[0] + + url.path + + (f"?{url.query}" if url.query else "") + ) + web.upload( + str(target["method"]), url.geturl(), headers, source, (200, 201, 204) + ) + complete = urllib.parse.urlparse(str(session["complete_url"])).path.split( + "/api/v1", 1 + )[1] + self._call("POST", complete, {"workspace_id": self.workspace}, "", (200, 201)) + return str(session["media_id"]) + + def create( + self, + destination: Destination, + title: str, + text: str, + profile: str, + media: list[tuple[str, str]], + key: str, + metadata: dict[str, str], + ) -> dict: + payload = { + "workspace_id": self.workspace, + "metadata": metadata, + "title": title, + "content_profile": profile, + "source_text": text, + "social_account_ids": [destination.account_id], + "renditions": [ + { + "social_account_id": destination.account_id, + "settings": destination.settings, + } + ], + "media": [ + {"media_id": media_id, "alt_text": alt} for media_id, alt in media + ], + } + return dict(self._call("POST", "/publications", payload, key, (200, 201))) + + def publish_now(self, publication: dict) -> None: + self._call( + "POST", + f"/publications/{publication['id']}/publish-now", + {"expected_revision": publication["revision"]}, + "", + (200, 201, 202), + ) + + def renditions(self, publication_id: str) -> list[dict]: + body = self.get(f"/publications/{publication_id}") + return list((body or {}).get("renditions") or []) From b592f9de625e64c572cc6e4622a4eace91f74ebb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:44 +0200 Subject: [PATCH 085/554] feat(web-app-openpost): add the crossposter source model --- .../crossposter/sources/__init__.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py b/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py new file mode 100644 index 0000000000..879283d075 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +from dataclasses import dataclass + + +@dataclass(frozen=True) +class Media: + url: str + mime: str + description: str + size: int + + +@dataclass(frozen=True) +class SourceItem: + uri: str + url: str + platform: str + text: str + visibility: str + tags: tuple[str, ...] + media: tuple[Media, ...] + in_reply_to: str + reblog: bool + spoiler: str + application: str + title: str = "" + cursor: str = "" From 3eb2f2e31c7fffea8b425eb6d4e6457b145011d0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:44 +0200 Subject: [PATCH 086/554] feat(web-app-openpost): poll mastodon accounts --- .../crossposter/sources/mastodon.py | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py b/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py new file mode 100644 index 0000000000..5040824e6a --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +import mimetypes +import urllib.parse +from typing import ClassVar + +from crossposter import adapt, web +from crossposter.sources import Media, SourceItem + +PAGE_SIZE = 40 +MAX_PAGES = 5 +MEDIA_TYPES = { + "image": "image/jpeg", + "gifv": "video/mp4", + "video": "video/mp4", + "audio": "audio/mpeg", +} + + +def _mime(attachment: dict) -> str: + guessed, _ = mimetypes.guess_type( + urllib.parse.urlparse(str(attachment.get("url") or "")).path + ) + return guessed or MEDIA_TYPES.get( + str(attachment.get("type")), "application/octet-stream" + ) + + +def parse_status(status: dict, platform: str) -> SourceItem: + application = status.get("application") or {} + return SourceItem( + uri=str(status["uri"]), + url=str(status.get("url") or status["uri"]), + platform=platform, + text=adapt.html_to_text(str(status.get("content") or "")), + visibility=str(status.get("visibility") or ""), + tags=tuple(str(tag.get("name") or "") for tag in status.get("tags") or []), + media=tuple( + Media( + url=str(attachment.get("url") or ""), + mime=_mime(attachment), + description=str(attachment.get("description") or ""), + size=0, + ) + for attachment in status.get("media_attachments") or [] + ), + in_reply_to=str(status.get("in_reply_to_id") or ""), + reblog=bool(status.get("reblog")), + spoiler=str(status.get("spoiler_text") or ""), + application=str(application.get("name") or ""), + cursor=str(status["id"]), + ) + + +class MastodonSource: + platform = "mastodon" + filters: ClassVar[dict[str, str]] = { + "exclude_replies": "true", + "exclude_reblogs": "true", + } + + def __init__(self, base_url: str, account: str, token: str) -> None: + self.base_url = base_url.rstrip("/") + self.account = account + self.headers = {"Authorization": f"Bearer {token}"} + self._account_id = "" + + def _get(self, path: str, query: dict[str, str]) -> object: + return web.get_json( + f"{self.base_url}{path}?{urllib.parse.urlencode(query)}", self.headers + ) + + def account_id(self) -> str: + if not self._account_id: + found = self._get("/api/v1/accounts/lookup", {"acct": self.account}) + self._account_id = str(found["id"]) + return self._account_id + + def newest_cursor(self) -> str: + statuses = self._get( + f"/api/v1/accounts/{self.account_id()}/statuses", {"limit": "1"} + ) + return str(statuses[0]["id"]) if statuses else "0" + + def fetch(self, cursor: str) -> list[SourceItem]: + items: list[SourceItem] = [] + for _ in range(MAX_PAGES): + query = {"min_id": cursor, "limit": str(PAGE_SIZE), **self.filters} + page = self._get(f"/api/v1/accounts/{self.account_id()}/statuses", query) + if not page: + break + ordered = sorted(page, key=lambda status: int(status["id"])) + items.extend(parse_status(status, self.platform) for status in ordered) + cursor = str(ordered[-1]["id"]) + if len(page) < PAGE_SIZE: + break + return items From c89cc3c018fc4369ddb6695fea4b3b6d1a203b70 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:44 +0200 Subject: [PATCH 087/554] feat(web-app-openpost): poll pixelfed accounts --- .../files/crossposter/crossposter/sources/pixelfed.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/sources/pixelfed.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/pixelfed.py b/roles/web-app-openpost/files/crossposter/crossposter/sources/pixelfed.py new file mode 100644 index 0000000000..22b7f52846 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/sources/pixelfed.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from typing import ClassVar + +from crossposter.sources.mastodon import MastodonSource + + +class PixelfedSource(MastodonSource): + platform = "pixelfed" + filters: ClassVar[dict[str, str]] = {"exclude_replies": "true"} From 05b0f4c2f265d30e36ea689f7a6da9c7c73cf351 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:45 +0200 Subject: [PATCH 088/554] feat(web-app-openpost): poll peertube channels --- .../crossposter/sources/peertube.py | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py b/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py new file mode 100644 index 0000000000..0c68f2e64e --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py @@ -0,0 +1,106 @@ +from __future__ import annotations + +import urllib.parse + +from crossposter import web +from crossposter.sources import Media, SourceItem + +PAGE_SIZE = 25 +MAX_PAGES = 4 +PUBLIC = 1 +PUBLISHED = 1 +VISIBILITY = {1: "public", 2: "unlisted", 3: "private", 4: "internal"} + + +def _files(detail: dict) -> list[dict]: + files = list(detail.get("files") or []) + for playlist in detail.get("streamingPlaylists") or []: + files.extend(playlist.get("files") or []) + return [ + item for item in files if item.get("fileDownloadUrl") or item.get("fileUrl") + ] + + +def best_file(detail: dict) -> Media | None: + files = _files(detail) + if not files: + return None + chosen = max( + files, key=lambda item: int((item.get("resolution") or {}).get("id") or 0) + ) + return Media( + url=str(chosen.get("fileDownloadUrl") or chosen.get("fileUrl")), + mime="video/mp4", + description="", + size=int(chosen.get("size") or 0), + ) + + +def published_public(video: dict) -> bool: + privacy = int((video.get("privacy") or {}).get("id") or 0) + state = int((video.get("state") or {}).get("id") or PUBLISHED) + return privacy == PUBLIC and state == PUBLISHED + + +def parse_video(video: dict, detail: dict) -> SourceItem: + media = best_file(detail) + return SourceItem( + uri=str(video["url"]), + url=str(video["url"]), + platform="peertube", + text=str(detail.get("description") or video.get("description") or ""), + visibility=VISIBILITY.get(int((video.get("privacy") or {}).get("id") or 0), ""), + tags=tuple(str(tag) for tag in detail.get("tags") or []), + media=(media,) if media else (), + in_reply_to="", + reblog=False, + spoiler="", + application="", + title=str(video.get("name") or ""), + cursor=str(video.get("publishedAt") or ""), + ) + + +class PeerTubeSource: + platform = "peertube" + + def __init__(self, base_url: str, account: str, token: str) -> None: + self.base_url = base_url.rstrip("/") + self.channel = account + self.headers = {"Authorization": f"Bearer {token}"} + + def _page(self, start: int) -> list[dict]: + query = urllib.parse.urlencode( + {"sort": "-publishedAt", "count": PAGE_SIZE, "start": start} + ) + body = web.get_json( + f"{self.base_url}/api/v1/video-channels/{self.channel}/videos?{query}", + self.headers, + ) + return list(body.get("data") or []) + + def _detail(self, video: dict) -> dict: + return dict( + web.get_json(f"{self.base_url}/api/v1/videos/{video['uuid']}", self.headers) + ) + + def newest_cursor(self) -> str: + page = self._page(0) + return str(page[0].get("publishedAt") or "") if page else "" + + def fetch(self, cursor: str) -> list[SourceItem]: + fresh: list[dict] = [] + for index in range(MAX_PAGES): + page = self._page(index * PAGE_SIZE) + newer = [ + video for video in page if str(video.get("publishedAt") or "") > cursor + ] + fresh.extend(newer) + if len(newer) < len(page) or len(page) < PAGE_SIZE: + break + ordered = sorted(fresh, key=lambda video: str(video.get("publishedAt") or "")) + return [ + parse_video(video, self._detail(video)) + for video in ordered + if published_public(video) + ] From d0bfe35952dafdb6be69b17421a4161b739c740b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:45 +0200 Subject: [PATCH 089/554] feat(web-app-openpost): add the crossposter service loop --- .../files/crossposter/crossposter/service.py | 319 ++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/service.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/service.py b/roles/web-app-openpost/files/crossposter/crossposter/service.py new file mode 100644 index 0000000000..9126dfc9df --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/service.py @@ -0,0 +1,319 @@ +from __future__ import annotations + +import logging +import random +import tempfile +import time +import urllib.parse +from pathlib import Path +from typing import TYPE_CHECKING + +from crossposter import adapt, notify, retry, store, web +from crossposter.sources.mastodon import MastodonSource +from crossposter.sources.peertube import PeerTubeSource +from crossposter.sources.pixelfed import PixelfedSource + +if TYPE_CHECKING: + from crossposter.config import Config, Route + from crossposter.openpost import Destination, OpenPost + from crossposter.sources import SourceItem + +LOG = logging.getLogger("crossposter") +SOURCES = { + "mastodon": MastodonSource, + "pixelfed": PixelfedSource, + "peertube": PeerTubeSource, +} +JPEG_QUALITY = 90 + + +def to_jpeg(source: Path) -> Path: + from PIL import Image + + target = source.with_suffix(".jpg") + with Image.open(source) as image: + image.convert("RGB").save(target, "JPEG", quality=JPEG_QUALITY) + return target + + +def failure(rendition: dict) -> str: + delivery = rendition.get("delivery") or {} + reason = ( + rendition.get("error_message") + or delivery.get("terminal_reason") + or delivery.get("recovery_action") + or "delivery failed" + ) + status = rendition.get("error_http_status") + return f"{reason} (HTTP {status})" if status else str(reason) + + +def resendable_failure(rendition: dict) -> bool: + if (rendition.get("delivery") or {}).get("recovery_action") == "manual_resolution": + return True + status = rendition.get("error_http_status") + return status is not None and retry.transient(int(status)) + + +class Service: + def __init__( + self, config: Config, database: store.Store, openpost: OpenPost + ) -> None: + self.config = config + self.store = database + self.openpost = openpost + self.routes = {route.name: route for route in config.routes} + self.sources = { + route.name: SOURCES[route.source.platform]( + route.source.base_url, route.source.account, route.source.token + ) + for route in config.routes + } + self.rng = random.Random() # noqa: S311 spreads retry delays, no security decision + + def heartbeat(self, state: str) -> None: + Path(self.config.heartbeat_file).write_text(f"{time.time():.0f} {state}\n") + + def run_forever(self) -> None: + self.store.migrate() + while not self.store.lock(): + LOG.info("another crossposter holds the lock; standing by") + self.heartbeat("standby") + time.sleep(self.config.poll_interval_seconds) + LOG.info("lock acquired; polling %d route(s)", len(self.routes)) + while True: + self.tick() + self.heartbeat("active") + time.sleep(self.config.poll_interval_seconds) + + def tick(self) -> None: + for route in self.routes.values(): + self.detect(route) + self.deliver_due() + self.follow() + self.report() + + def detect(self, route: Route) -> None: + source = self.sources[route.name] + try: + cursor = self.store.cursor(route.name) + if cursor is None: + self.store.advance(route.name, source.newest_cursor(), []) + LOG.info( + "route %s activated; existing posts are not forwarded", route.name + ) + return + items = source.fetch(cursor) + destinations = self.openpost.destinations(route.targets) + except web.RequestError as error: + LOG.warning( + "route %s: polling failed, retrying next interval: %s", + route.name, + error, + ) + return + enqueued = [ + (item, destination.account_id, destination.platform) + for item in items + if not self._refused(route, item) + for destination in destinations + if not self._plan(route, item, destination).skip + ] + self.store.advance(route.name, items[-1].cursor if items else cursor, enqueued) + if enqueued: + LOG.info("route %s: queued %d delivery(ies)", route.name, len(enqueued)) + + def _refused(self, route: Route, item: SourceItem) -> bool: + reason = route.refusal(item, self.config.opt_out_tag) + if reason: + LOG.info("route %s: %s not forwarded (%s)", route.name, item.url, reason) + return bool(reason) + + @staticmethod + def _plan(route: Route, item: SourceItem, destination: Destination) -> adapt.Plan: + return adapt.prepare( + item, destination.platform, route.template(destination.platform), route.mode + ) + + def _destination(self, route: Route, account_id: str) -> Destination: + for destination in self.openpost.destinations(route.targets): + if destination.account_id == account_id: + return destination + raise web.RequestError(account_id, 404, {}, "the target account left the route") + + def _media( + self, route: Route, plan: adapt.Plan, folder: Path + ) -> list[tuple[str, str]]: + uploaded = [] + headers = dict(self.sources[route.name].headers) + for index, attachment in enumerate(plan.media): + name = ( + Path(urllib.parse.urlparse(attachment.media.url).path).name + or f"media-{index}" + ) + local = web.download( + attachment.media.url, headers, folder / f"{index}-{name}" + ) + mime = attachment.media.mime + if attachment.jpeg and mime != "image/jpeg": + local, mime = to_jpeg(local), "image/jpeg" + uploaded.append( + (self.openpost.upload(local, local.name, mime), attachment.alt_text) + ) + return uploaded + + def deliver_due(self) -> None: + for row in self.store.due(): + self.deliver(row) + + def deliver(self, row: dict) -> None: + route = self.routes.get(row["route"]) + attempts = int(row["attempts"]) + 1 + if route is None: + state = store.transition("pending", "permanent") + self.store.update( + row["id"], + state, + str(row["publication_id"]), + attempts, + "the route was removed", + 0, + ) + return + item = store.item_from_json(row["payload"]) + try: + destination = self._destination(route, row["target"]) + plan = self._plan(route, item, destination) + key = store.idempotency_key( + item.uri, destination.account_id, int(row["resends"]) + ) + with tempfile.TemporaryDirectory(prefix="crossposter-") as folder: + media = self._media(route, plan, Path(folder)) + publication = self.openpost.create( + destination, + plan.title, + plan.text, + plan.profile, + media, + key, + {"crossposter_route": route.name, "crossposter_source": item.url}, + ) + if plan.draft_only: + state = store.transition("pending", "drafted") + else: + if str(publication.get("status")) == "draft": + self.openpost.publish_now(publication) + state = store.transition("pending", "submitted") + self.store.update(row["id"], state, str(publication["id"]), attempts, "", 0) + LOG.info( + "%s -> %s %s: %s", + item.url, + destination.platform, + destination.slug, + state, + ) + except web.RequestError as error: + event = "transient" if error.transient else "permanent" + state = store.transition( + "pending", event, attempts, self.config.retry.max_attempts + ) + pause = retry.delay( + attempts, + error.headers, + time.time(), + self.config.retry.base_seconds, + self.config.retry.cap_seconds, + self.rng, + ) + self.store.update( + row["id"], + state, + str(row["publication_id"]), + attempts, + str(error), + pause, + ) + LOG.warning( + "%s -> %s: %s (%s, attempt %d)", + item.url, + row["target"], + state, + error, + attempts, + ) + + def follow(self) -> None: + for row in self.store.open_publications(): + try: + renditions = self.openpost.renditions(str(row["publication_id"])) + except web.RequestError as error: + LOG.warning( + "publication %s: status unavailable: %s", + row["publication_id"], + error, + ) + continue + states = {str(rendition.get("status")) for rendition in renditions} + failed = [ + rendition + for rendition in renditions + if rendition.get("status") == "failed" + and not rendition.get("error_retryable") + ] + if failed: + self._failed(row, failed) + elif renditions and states == {"published"}: + state = store.transition(str(row["state"]), "delivered") + self.store.update( + row["id"], + state, + str(row["publication_id"]), + int(row["attempts"]), + "", + 0, + ) + + def _failed(self, row: dict, failed: list[dict]) -> None: + detail = "; ".join(failure(rendition) for rendition in failed) + attempts = int(row["attempts"]) + 1 + resendable = row["state"] == "submitted" and all( + resendable_failure(rendition) for rendition in failed + ) + if not resendable: + event = "delivery_failed" + elif attempts >= self.config.retry.max_attempts: + event = "exhausted" + else: + pause = retry.delay( + attempts, + {}, + time.time(), + self.config.retry.base_seconds, + self.config.retry.cap_seconds, + self.rng, + ) + self.store.resend(row["id"], attempts, detail, pause) + LOG.warning( + "publication %s failed transiently, resending in %.0fs: %s", + row["publication_id"], + pause, + detail, + ) + return + state = store.transition(str(row["state"]), event) + self.store.update( + row["id"], state, str(row["publication_id"]), attempts, detail, 0 + ) + + def report(self) -> None: + rows = self.store.unnotified() + if not rows: + return + if self.config.mail and self.config.recipients: + try: + notify.send(self.config.mail, self.config.recipients, rows) + except OSError as error: + LOG.warning("notification failed, retrying next interval: %s", error) + return + for row in rows: + self.store.mark_notified(row["id"]) From 240a24772bdde8957dc296a9d82ab92ed6cbbe4f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:45 +0200 Subject: [PATCH 090/554] feat(web-app-openpost): add the crossposter command line --- .../files/crossposter/crossposter/__main__.py | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/crossposter/__main__.py diff --git a/roles/web-app-openpost/files/crossposter/crossposter/__main__.py b/roles/web-app-openpost/files/crossposter/crossposter/__main__.py new file mode 100644 index 0000000000..f70c0378b8 --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/crossposter/__main__.py @@ -0,0 +1,131 @@ +from __future__ import annotations + +import argparse +import json +import logging +import sys +import time +from pathlib import Path + +from . import config as settings +from . import web +from .openpost import OpenPost, TargetError + +LIST_COLUMNS = ( + "id", + "state", + "route", + "network", + "target", + "attempts", + "source_url", + "publication_id", + "last_error", +) +HEALTHY = ("active", "standby", "waiting") +STALE_INTERVALS = 3 +LOG = logging.getLogger("crossposter") + + +def _client(loaded: settings.Config) -> OpenPost: + return OpenPost( + loaded.openpost.base_url, + loaded.openpost.host, + loaded.openpost.token, + loaded.openpost.workspace, + ) + + +def validate(path: str) -> settings.Config: + loaded = settings.load(path) + client = _client(loaded) + for route in loaded.routes: + try: + client.destinations(route.targets) + except TargetError as error: + raise settings.ConfigError( + f"route '{route.name}': targets: {error}" + ) from error + return loaded + + +def command_validate(path: str) -> int: + try: + loaded = validate(path) + except settings.ConfigError as error: + print(f"invalid crossposter configuration: {error}", file=sys.stderr) + return 2 + except web.RequestError as error: + print( + f"OpenPost could not be asked about the targets: {error}", file=sys.stderr + ) + return 3 + print(f"{len(loaded.routes)} route(s) valid") + return 0 + + +def wait_for_configuration(path: str, error: Exception) -> float: + raw = json.loads(Path(path).read_text()) + Path(raw["heartbeat_file"]).write_text(f"{time.time():.0f} waiting\n") + LOG.warning("crossposter waits for a valid configuration: %s", error) + return float(raw["poll_interval_seconds"]) + + +def command_run(path: str) -> int: + from .service import Service + from .store import Store + + while True: + try: + loaded = validate(path) + break + except (settings.ConfigError, web.RequestError) as error: + time.sleep(wait_for_configuration(path, error)) + Service(loaded, Store(loaded.dsn), _client(loaded)).run_forever() + return 0 + + +def command_list(path: str) -> int: + from .store import Store + + loaded = settings.load(path) + rows = Store(loaded.dsn).everything() + print("\t".join(LIST_COLUMNS)) + for row in rows: + print( + "\t".join( + str(row[column]).replace("\n", " ")[:120] for column in LIST_COLUMNS + ) + ) + return 0 + + +def command_health(path: str) -> int: + loaded = settings.load(path) + heartbeat = Path(loaded.heartbeat_file) + if not heartbeat.is_file(): + return 1 + stamp, _, state = heartbeat.read_text().strip().partition(" ") + fresh = time.time() - float(stamp) < STALE_INTERVALS * loaded.poll_interval_seconds + return 0 if fresh and state in HEALTHY else 1 + + +def main() -> int: + parser = argparse.ArgumentParser(prog="crossposter") + parser.add_argument("command", choices=("run", "validate", "list", "health")) + parser.add_argument("--config", required=True) + arguments = parser.parse_args() + logging.basicConfig( + level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s" + ) + commands = { + "run": command_run, + "validate": command_validate, + "list": command_list, + "health": command_health, + } + return commands[arguments.command](arguments.config) + + +if __name__ == "__main__": + sys.exit(main()) From 339d376ac74135f89df5e04fd2271bddc8261c71 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:45 +0200 Subject: [PATCH 091/554] feat(web-app-openpost): render the crossposter configuration --- .../templates/crossposter.json.j2 | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 roles/web-app-openpost/templates/crossposter.json.j2 diff --git a/roles/web-app-openpost/templates/crossposter.json.j2 b/roles/web-app-openpost/templates/crossposter.json.j2 new file mode 100644 index 0000000000..dd1da46793 --- /dev/null +++ b/roles/web-app-openpost/templates/crossposter.json.j2 @@ -0,0 +1,30 @@ +{% set _routes = [] %} +{% for _route in OPENPOST_CROSSPOSTER_ROUTES %} +{% set _ = _routes.append(_route | combine({'source': _route.source | dict2items | rejectattr('key', 'equalto', 'token') | items2dict})) %} +{% endfor %} +{% set _mail = none %} +{% if OPENPOST_EMAIL_ENABLED | bool %} +{% set _email = lookup('email', application_id) %} +{% set _mail = { + 'host': _email.host, + 'port': _email.port | int, + 'security': 'tls' if _email.tls | bool else 'starttls' if _email.start_tls | bool else 'none', + 'user': _email.username, + 'sender': _email['from'] +} %} +{% endif %} +{{ { + 'openpost': { + 'base_url': 'http://openpost:' ~ lookup('config', application_id, 'services.openpost.ports.internal.http'), + 'host': lookup('domain', application_id), + 'workspace': openpost_crossposter_workspace + }, + 'secrets_file': OPENPOST_CROSSPOSTER_SECRETS_TARGET, + 'mail': _mail, + 'heartbeat_file': '/tmp/crossposter-heartbeat', + 'poll_interval_seconds': OPENPOST_CROSSPOSTER.poll_interval_seconds, + 'opt_out_tag': OPENPOST_CROSSPOSTER.opt_out_tag, + 'retry': OPENPOST_CROSSPOSTER.retry, + 'notify': OPENPOST_CROSSPOSTER.notify, + 'routes': _routes +} | to_nice_json }} From 66ca118a63f07daea3dc6851d05c22e0964d1a93 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:45 +0200 Subject: [PATCH 092/554] feat(web-app-openpost): render the crossposter secrets --- .../templates/crossposter-secrets.json.j2 | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 roles/web-app-openpost/templates/crossposter-secrets.json.j2 diff --git a/roles/web-app-openpost/templates/crossposter-secrets.json.j2 b/roles/web-app-openpost/templates/crossposter-secrets.json.j2 new file mode 100644 index 0000000000..4a86216c47 --- /dev/null +++ b/roles/web-app-openpost/templates/crossposter-secrets.json.j2 @@ -0,0 +1,10 @@ +{% set _tokens = {} %} +{% for _route in OPENPOST_CROSSPOSTER_ROUTES %} +{% set _ = _tokens.update({_route.name: _route.source.token | default(openpost_crossposter_sources[_route.name] | default('', true), true)}) %} +{% endfor %} +{{ { + 'openpost_token': openpost_crossposter_token, + 'database_dsn': lookup('database', application_id, 'url_full'), + 'mail_password': lookup('email', application_id).password if OPENPOST_EMAIL_ENABLED | bool else '', + 'routes': _tokens +} | to_json }} From 60a597ae4b7b624d1ddbf0572d401597b3c09c03 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:45 +0200 Subject: [PATCH 093/554] feat(web-app-openpost): stage and render the crossposter --- .../web-app-openpost/tasks/04_crossposter.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 roles/web-app-openpost/tasks/04_crossposter.yml diff --git a/roles/web-app-openpost/tasks/04_crossposter.yml b/roles/web-app-openpost/tasks/04_crossposter.yml new file mode 100644 index 0000000000..cf71fb4e2c --- /dev/null +++ b/roles/web-app-openpost/tasks/04_crossposter.yml @@ -0,0 +1,46 @@ +--- +- name: "🔎 Check whether the crossposter was provisioned before" + ansible.builtin.stat: + path: "{{ OPENPOST_CROSSPOSTER_STATE_FILE }}" + register: openpost_crossposter_state_file + delegate_to: "{{ STACK_HOST }}" + run_once: true + +- name: "📖 Read the crossposter state" + ansible.builtin.slurp: + src: "{{ OPENPOST_CROSSPOSTER_STATE_FILE }}" + register: openpost_crossposter_state_raw + when: openpost_crossposter_state_file.stat.exists + delegate_to: "{{ STACK_HOST }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧭 Remember the provisioned workspace, API token and CI source tokens" + ansible.builtin.set_fact: + openpost_crossposter_workspace: "{{ openpost_crossposter_state.workspace | default('') }}" + openpost_crossposter_token: "{{ openpost_crossposter_state.token | default('') }}" + openpost_crossposter_sources: "{{ openpost_crossposter_state.sources | default({}) }}" + vars: + openpost_crossposter_state: "{{ (openpost_crossposter_state_raw.content | b64decode | from_json) if openpost_crossposter_state_file.stat.exists else {} }}" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "📦 Stage the crossposter build context" + ansible.builtin.copy: + src: "{{ role_path }}/files/crossposter/" + dest: "{{ OPENPOST_CROSSPOSTER_BUILD_CONTEXT }}/" + mode: preserve + register: openpost_crossposter_context + +- name: "📄 Render the crossposter configuration and secrets" + ansible.builtin.include_tasks: + file: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/render_replicated_templates.yml') }}" + vars: + role_templates: + - src: "crossposter.json.j2" + dest: "{{ OPENPOST_CROSSPOSTER_CONFIG_HOST }}" + mode: "0644" + - src: "crossposter-secrets.json.j2" + dest: "{{ OPENPOST_CROSSPOSTER_SECRETS_HOST }}" + mode: "0400" + owner: "{{ OPENPOST_CROSSPOSTER_UID }}" + group: "{{ OPENPOST_CROSSPOSTER_UID }}" From ca4a00fc8aa1d9435403740c0d9caa5464340bc4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:46 +0200 Subject: [PATCH 094/554] feat(web-app-openpost): provision the crossposter api token --- .../tasks/05_crossposter_provision.yml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 roles/web-app-openpost/tasks/05_crossposter_provision.yml diff --git a/roles/web-app-openpost/tasks/05_crossposter_provision.yml b/roles/web-app-openpost/tasks/05_crossposter_provision.yml new file mode 100644 index 0000000000..ac98a1a750 --- /dev/null +++ b/roles/web-app-openpost/tasks/05_crossposter_provision.yml @@ -0,0 +1,64 @@ +--- +- name: "🔍 List the workspaces the crossposter may publish into" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/workspaces" + headers: "{{ openpost_breakglass_headers }}" + status_code: 200 + register: openpost_crossposter_workspaces + changed_when: false + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🏢 Pick the organisation workspace for the crossposter" + ansible.builtin.set_fact: + openpost_crossposter_target_workspace: >- + {{ (openpost_crossposter_workspaces.json + | selectattr('name', 'equalto', OPENPOST_ORGANISATION_WORKSPACE) | first).id }} + +- name: "🔎 Check the stored crossposter API token" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/workspaces" + headers: "{{ OPENPOST_API_HEADERS | combine({'Authorization': 'Bearer ' ~ openpost_crossposter_token}) }}" + status_code: [200, 401, 403] + register: openpost_crossposter_token_check + changed_when: false + when: openpost_crossposter_token | length > 0 + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🔑 Issue a workspace API token for the crossposter" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/api-tokens" + method: POST + headers: "{{ openpost_breakglass_headers }}" + body_format: json + body: + name: "{{ OPENPOST_CROSSPOSTER_TOKEN_NAME }}" + scope: "api:write" + workspace_id: "{{ openpost_crossposter_target_workspace }}" + status_code: [200, 201] + register: openpost_crossposter_issued + changed_when: true + when: >- + openpost_crossposter_token | length == 0 + or openpost_crossposter_token_check.status != 200 + or openpost_crossposter_workspace != openpost_crossposter_target_workspace + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧭 Adopt the newly issued crossposter API token" + ansible.builtin.set_fact: + openpost_crossposter_workspace: "{{ openpost_crossposter_target_workspace }}" + openpost_crossposter_token: "{{ openpost_crossposter_issued.json.token }}" + when: openpost_crossposter_issued is changed + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🌱 Seed the CI source tokens and social sets" + ansible.builtin.include_tasks: 06_crossposter_seed.yml + when: OPENPOST_SIMULATOR_ENABLED | bool + +- name: "💾 Persist the crossposter workspace, API token and CI source tokens" + ansible.builtin.copy: + content: >- + {{ {'workspace': openpost_crossposter_workspace, 'token': openpost_crossposter_token, + 'sources': openpost_crossposter_sources} | to_json }} + dest: "{{ OPENPOST_CROSSPOSTER_STATE_FILE }}" + mode: "0600" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From 9fc45de14a39a1d50c4924742614d2bb3f793510 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:46 +0200 Subject: [PATCH 095/554] feat(web-app-openpost): seed ci crossposter sources and social sets --- .../tasks/06_crossposter_seed.yml | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 roles/web-app-openpost/tasks/06_crossposter_seed.yml diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed.yml b/roles/web-app-openpost/tasks/06_crossposter_seed.yml new file mode 100644 index 0000000000..e22dd5408a --- /dev/null +++ b/roles/web-app-openpost/tasks/06_crossposter_seed.yml @@ -0,0 +1,79 @@ +--- +- name: "🧾 Pick the CI routes whose source token the deploy has to mint" + ansible.builtin.set_fact: + openpost_crossposter_seed_routes: "{{ OPENPOST_CROSSPOSTER_ROUTES | rejectattr('source.token') | list }}" + openpost_crossposter_seed_platforms: "{{ OPENPOST_CROSSPOSTER_ROUTES | rejectattr('source.token') | map(attribute='source.platform') | unique | list }}" + +- name: "🔎 Check the source tokens minted by an earlier deploy" + uri_retry: + url: "{{ item.source.base_url }}{{ OPENPOST_CROSSPOSTER_SEED_PROBES[item.source.platform] }}" + headers: + Authorization: "Bearer {{ openpost_crossposter_sources[item.name] }}" + status_code: [200, 401, 403] + loop: "{{ openpost_crossposter_seed_routes | selectattr('name', 'in', openpost_crossposter_sources.keys() | list) | list }}" + loop_control: + label: "{{ item.name }}" + register: openpost_crossposter_seed_checks + changed_when: false + delegate_to: "{{ STACK_HOST }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧾 Keep the minted source tokens that still authenticate" + ansible.builtin.set_fact: + openpost_crossposter_sources: >- + {%- set _kept = {} -%} + {%- for _check in openpost_crossposter_seed_checks.results if _check.status == 200 -%} + {%- set _ = _kept.update({_check.item.name: openpost_crossposter_sources[_check.item.name]}) -%} + {%- endfor -%} + {{ _kept }} + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧾 Pick the CI routes that still lack a working source token" + ansible.builtin.set_fact: + openpost_crossposter_seed_missing: "{{ openpost_crossposter_seed_routes | rejectattr('name', 'in', openpost_crossposter_sources.keys() | list) | list }}" + +- name: "🐘 Mint the Mastodon source tokens" + ansible.builtin.include_tasks: 06_crossposter_seed/mastodon.yml + when: openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'mastodon') | list | length > 0 + +- name: "📷 Mint the Pixelfed source tokens" + ansible.builtin.include_tasks: 06_crossposter_seed/pixelfed.yml + when: openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list | length > 0 + +- name: "🎞️ Mint the PeerTube source tokens" + ansible.builtin.include_tasks: 06_crossposter_seed/peertube.yml + when: openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'peertube') | list | length > 0 + +- name: "🐘 Connect the CI Mastodon account as a target" + ansible.builtin.include_tasks: 06_crossposter_seed/mastodon_target.yml + when: OPENPOST_CROSSPOSTER_ROUTES | selectattr('source.platform', 'equalto', 'mastodon') | list | length > 0 + +- name: "📚 List the social sets of the organisation workspace" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/social-sets?workspace_id={{ openpost_crossposter_target_workspace }}" + headers: "{{ openpost_breakglass_headers }}" + status_code: 200 + register: openpost_crossposter_social_sets + changed_when: false + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🗂️ Create the social sets the CI routes target" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/social-sets" + method: POST + headers: "{{ openpost_breakglass_headers }}" + body_format: json + body: + name: "{{ item }}" + workspace_id: "{{ openpost_crossposter_target_workspace }}" + accounts: [] + status_code: [200, 201] + loop: >- + {{ OPENPOST_CROSSPOSTER_ROUTES + | map(attribute='targets') | selectattr('social_set', 'defined') + | map(attribute='social_set') | select | unique + | reject('in', openpost_crossposter_social_sets.json | map(attribute='name') | list) + | list }} + changed_when: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From cf22911d0c4824c571442edafc34d1d743c0b7cb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:46 +0200 Subject: [PATCH 096/554] feat(web-app-openpost): mint ci mastodon source tokens --- .../tasks/06_crossposter_seed/mastodon.yml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 roles/web-app-openpost/tasks/06_crossposter_seed/mastodon.yml diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon.yml b/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon.yml new file mode 100644 index 0000000000..3f9a3c58ea --- /dev/null +++ b/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon.yml @@ -0,0 +1,45 @@ +--- +- name: "🔍 Resolve the Mastodon container that mints the CI source tokens" + ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" + vars: + resolve_service_key: mastodon + resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_output_prefix: OPENPOST_SEED_MASTODON + resolve_compose_cid: "{{ lookup('container_address', 'web-app-mastodon', 'mastodon') }}" + +- name: "🔑 Mint a Mastodon token for each CI route" + ansible.builtin.command: + argv: + - container + - exec + - -e + - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" + - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_MASTODON_LOCAL_CID resolved at delegate_to runtime + - bin/rails + - runner + - | + account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) + application = Doorkeeper::Application.find_or_create_by!(name: "Crossposter CI") do |created| + created.redirect_uri = "urn:ietf:wg:oauth:2.0:oob" + created.scopes = "read write" + end + token = Doorkeeper::AccessToken.create!(application: application, resource_owner_id: account.user.id, scopes: "read write") + puts "CROSSPOSTER_TOKEN=#{token.plaintext_token}" + loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'mastodon') | list }}" + loop_control: + label: "{{ item.name }}" + register: openpost_crossposter_mastodon_minted + changed_when: true + delegate_to: "{{ OPENPOST_SEED_MASTODON_HOST_NODE }}" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧾 Keep the minted Mastodon tokens" + ansible.builtin.set_fact: + openpost_crossposter_sources: >- + {%- set _minted = dict(openpost_crossposter_sources) -%} + {%- for _result in openpost_crossposter_mastodon_minted.results -%} + {%- set _line = _result.stdout_lines | select('match', 'CROSSPOSTER_TOKEN=') | first -%} + {%- set _ = _minted.update({_result.item.name: _line | replace('CROSSPOSTER_TOKEN=', '') | trim}) -%} + {%- endfor -%} + {{ _minted }} + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From 5e71d217362d48c82d8debca7f65be604914efd3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:46 +0200 Subject: [PATCH 097/554] feat(web-app-openpost): connect the ci mastodon target --- .../06_crossposter_seed/mastodon_target.yml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml b/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml new file mode 100644 index 0000000000..f2c87c5803 --- /dev/null +++ b/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml @@ -0,0 +1,59 @@ +--- +- name: "🔎 List the accounts connected in the organisation workspace" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts?workspace_id={{ openpost_crossposter_target_workspace }}" + headers: "{{ openpost_breakglass_headers }}" + status_code: 200 + register: openpost_crossposter_connected + changed_when: false + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🔗 Connect the CI Mastodon account as a crossposting target" + when: openpost_crossposter_connected.json | selectattr('platform', 'equalto', 'mastodon') | list | length == 0 + block: + - name: "🔍 Resolve the Mastodon container that grants the OpenPost app" + ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" + vars: + resolve_service_key: mastodon + resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_output_prefix: OPENPOST_SEED_MASTODON + resolve_compose_cid: "{{ lookup('container_address', 'web-app-mastodon', 'mastodon') }}" + + - name: "🎫 Grant OpenPost's pinned app an authorization code for the CI account" + ansible.builtin.command: + argv: + - container + - exec + - -e + - "CROSSPOSTER_ACCOUNT={{ openpost_crossposter_mastodon_route.source.account }}" + - -e + - "CROSSPOSTER_CLIENT_ID={{ openpost_fediverse_apps[openpost_crossposter_mastodon_route.source.base_url].client_id }}" + - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_MASTODON_LOCAL_CID resolved at delegate_to runtime + - bin/rails + - runner + - | + account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) + application = Doorkeeper::Application.find_by!(uid: ENV.fetch("CROSSPOSTER_CLIENT_ID")) + grant = Doorkeeper::AccessGrant.create!(application: application, resource_owner_id: account.user.id, redirect_uri: "urn:ietf:wg:oauth:2.0:oob", scopes: application.scopes.to_s, expires_in: 600) + puts "CROSSPOSTER_GRANT=#{grant.plaintext_token}" + register: openpost_crossposter_mastodon_grant + changed_when: true + delegate_to: "{{ OPENPOST_SEED_MASTODON_HOST_NODE }}" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + + - name: "🔁 Exchange the code through OpenPost" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts/mastodon/exchange" + method: POST + headers: "{{ openpost_breakglass_headers }}" + body_format: json + body: + code: "{{ (openpost_crossposter_mastodon_grant.stdout_lines | select('match', 'CROSSPOSTER_GRANT=') | first) | replace('CROSSPOSTER_GRANT=', '') | trim }}" + instance_url: "{{ openpost_crossposter_mastodon_route.source.base_url }}" + server_name: "{{ openpost_crossposter_mastodon_route.source.base_url }}" + workspace_id: "{{ openpost_crossposter_target_workspace }}" + status_code: [200, 201] + changed_when: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + vars: + openpost_crossposter_mastodon_route: "{{ OPENPOST_CROSSPOSTER_ROUTES | selectattr('source.platform', 'equalto', 'mastodon') | first }}" From 3b408f434d306fd3c2291ebbf9a899071d007c40 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:46 +0200 Subject: [PATCH 098/554] feat(web-app-openpost): mint ci pixelfed source tokens --- .../tasks/06_crossposter_seed/pixelfed.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 roles/web-app-openpost/tasks/06_crossposter_seed/pixelfed.yml diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/pixelfed.yml b/roles/web-app-openpost/tasks/06_crossposter_seed/pixelfed.yml new file mode 100644 index 0000000000..d7fca2af19 --- /dev/null +++ b/roles/web-app-openpost/tasks/06_crossposter_seed/pixelfed.yml @@ -0,0 +1,46 @@ +--- +- name: "🔍 Resolve the Pixelfed container that mints the CI source tokens" + ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" + vars: + resolve_service_key: pixelfed + resolve_service_name: "{{ lookup('container_service', 'web-app-pixelfed', 'pixelfed') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_output_prefix: OPENPOST_SEED_PIXELFED + resolve_compose_cid: "{{ lookup('config', 'web-app-pixelfed', 'services.pixelfed.name') }}" + +- name: "🔑 Mint a Pixelfed personal access token for each CI route" + ansible.builtin.command: + argv: + - container + - exec + - -u + - "{{ OPENPOST_SEED_PIXELFED_USER }}" + - -e + - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" + - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_PIXELFED_LOCAL_CID resolved at delegate_to runtime + - php + - artisan + - tinker + - --execute + - >- + $user = App\User::where('username', getenv('CROSSPOSTER_ACCOUNT'))->firstOrFail(); + if (! Laravel\Passport\Client::where('personal_access_client', true)->exists()) { + Artisan::call('passport:client', ['--personal' => true, '--name' => 'Crossposter CI', '--no-interaction' => true]); } + echo 'CROSSPOSTER_TOKEN=' . $user->createToken('crossposter-ci', ['read', 'write'])->accessToken . PHP_EOL; + loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list }}" + loop_control: + label: "{{ item.name }}" + register: openpost_crossposter_pixelfed_minted + changed_when: true + delegate_to: "{{ OPENPOST_SEED_PIXELFED_HOST_NODE }}" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧾 Keep the minted Pixelfed tokens" + ansible.builtin.set_fact: + openpost_crossposter_sources: >- + {%- set _minted = dict(openpost_crossposter_sources) -%} + {%- for _result in openpost_crossposter_pixelfed_minted.results -%} + {%- set _line = _result.stdout_lines | select('match', 'CROSSPOSTER_TOKEN=') | first -%} + {%- set _ = _minted.update({_result.item.name: _line | replace('CROSSPOSTER_TOKEN=', '') | trim}) -%} + {%- endfor -%} + {{ _minted }} + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From d1306a4144eb32e4a730511db227d25b21ab9da9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:46 +0200 Subject: [PATCH 099/554] feat(web-app-openpost): mint ci peertube source tokens --- .../tasks/06_crossposter_seed/peertube.yml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 roles/web-app-openpost/tasks/06_crossposter_seed/peertube.yml diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/peertube.yml b/roles/web-app-openpost/tasks/06_crossposter_seed/peertube.yml new file mode 100644 index 0000000000..b2d4fa36b4 --- /dev/null +++ b/roles/web-app-openpost/tasks/06_crossposter_seed/peertube.yml @@ -0,0 +1,43 @@ +--- +- name: "🪪 Read the local OAuth client of each PeerTube source" + uri_retry: + url: "{{ item.source.base_url }}/api/v1/oauth-clients/local" + status_code: 200 + loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'peertube') | list }}" + loop_control: + label: "{{ item.name }}" + register: openpost_crossposter_peertube_clients + delegate_to: "{{ STACK_HOST }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🔑 Log the administrator into each PeerTube source" + uri_retry: + url: "{{ item.item.source.base_url }}/api/v1/users/token" + method: POST + body_format: form-urlencoded + body: + client_id: "{{ item.json.client_id }}" + client_secret: "{{ item.json.client_secret }}" + grant_type: password + username: "{{ OPENPOST_SEED_PEERTUBE_USERNAME }}" + password: "{{ lookup('users', 'administrator').password }}" + status_code: 200 + loop: "{{ openpost_crossposter_peertube_clients.results }}" + loop_control: + label: "{{ item.item.name }}" + register: openpost_crossposter_peertube_minted + changed_when: true + delegate_to: "{{ STACK_HOST }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🧾 Keep the minted PeerTube tokens" + ansible.builtin.set_fact: + openpost_crossposter_sources: >- + {%- set _minted = dict(openpost_crossposter_sources) -%} + {%- for _result in openpost_crossposter_peertube_minted.results -%} + {%- set _ = _minted.update({_result.item.item.name: _result.json.access_token}) -%} + {%- endfor -%} + {{ _minted }} + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From dfeeb992bd587e0e151cebf36ce849cfc62e58d8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:47 +0200 Subject: [PATCH 100/554] feat(web-app-openpost): apply and validate the crossposter --- .../tasks/07_crossposter_apply.yml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 roles/web-app-openpost/tasks/07_crossposter_apply.yml diff --git a/roles/web-app-openpost/tasks/07_crossposter_apply.yml b/roles/web-app-openpost/tasks/07_crossposter_apply.yml new file mode 100644 index 0000000000..bf6bf47f27 --- /dev/null +++ b/roles/web-app-openpost/tasks/07_crossposter_apply.yml @@ -0,0 +1,42 @@ +--- +- name: "📄 Render the crossposter files from the current state" + ansible.builtin.include_tasks: 04_crossposter.yml + +- name: "📁 Re-render the compose file with the crossposter" + stack_host_template: + src: compose.yml.j2 + dest: "{{ lookup('container', application_id, 'files.compose') }}" + mode: "0640" + force: true + notify: compose-up + +- name: "🚿 Flush handlers so the crossposter runs the current configuration" + ansible.builtin.meta: flush_handlers + +- name: "🔍 Resolve the crossposter container" + ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" + vars: + resolve_service_key: crossposter + resolve_output_prefix: OPENPOST_CROSSPOSTER + resolve_compose_cid: "{{ OPENPOST_CROSSPOSTER_ADDRESS }}" + +- name: "✅ Validate the crossposter routes against OpenPost" + ansible.builtin.command: + argv: + - container + - exec + - "{{ OPENPOST_CROSSPOSTER_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_CROSSPOSTER_LOCAL_CID resolved at delegate_to runtime + - python + - -m + - crossposter + - validate + - --config + - "{{ OPENPOST_CROSSPOSTER_CONFIG_TARGET }}" + register: openpost_crossposter_validation + changed_when: false + retries: 12 + delay: 5 + until: openpost_crossposter_validation.rc in [0, 2] + failed_when: openpost_crossposter_validation.rc != 0 + delegate_to: "{{ OPENPOST_CROSSPOSTER_HOST_NODE }}" + run_once: true From 77a1b9ceb7b24f5cdcd93aa882043b5941a6308b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:47 +0200 Subject: [PATCH 101/554] docs(web-app-openpost): list automated crossposting --- roles/web-app-openpost/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/README.md b/roles/web-app-openpost/README.md index 2cefed0fcc..ecaba2a262 100644 --- a/roles/web-app-openpost/README.md +++ b/roles/web-app-openpost/README.md @@ -80,6 +80,7 @@ Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional ( - **Break-glass admin:** A local instance admin is bootstrapped on the first deploy so the instance stays manageable when Keycloak is unavailable. - **Data minimisation:** Diagnostics, the update check, product telemetry, feedback, public profiles, stock media search and workflow AI are switched off. - **Central credentials:** Developer app credentials for X, Meta, Threads, LinkedIn, YouTube and TikTok come from the central `API` mapping, and a network without credentials stays unavailable. +- **Automated crossposting:** A crossposter sidecar polls configured Mastodon, Pixelfed and PeerTube accounts and hands every new post to OpenPost, as a draft for review or for immediate publishing, with per-network shortening, attribution, opt-out by hashtag, loop prevention and mailed reports of failed deliveries. ## Quick Setup From 1629311c26b5127108c5dcb177d021ac237f228e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:47 +0200 Subject: [PATCH 102/554] test(web-app-openpost): add fediverse source helpers to the probe --- .../files/test/openpost_sources.py | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 roles/web-app-openpost/files/test/openpost_sources.py diff --git a/roles/web-app-openpost/files/test/openpost_sources.py b/roles/web-app-openpost/files/test/openpost_sources.py new file mode 100644 index 0000000000..e38bf922cc --- /dev/null +++ b/roles/web-app-openpost/files/test/openpost_sources.py @@ -0,0 +1,152 @@ +from __future__ import annotations + +import json +import secrets +import time +import urllib.error +import urllib.parse +import urllib.request + +TIMEOUT = 120 + + +def request( + method: str, + url: str, + token: str, + fields: dict[str, str | list[str]] | None = None, + files: dict[str, tuple[str, str, bytes]] | None = None, +) -> tuple[int, object]: + headers = {"Authorization": f"Bearer {token}"} + data = None + if files: + boundary = secrets.token_hex(16) + data = multipart(boundary, fields or {}, files) + headers["Content-Type"] = f"multipart/form-data; boundary={boundary}" + elif fields: + data = urllib.parse.urlencode(fields, doseq=True).encode() + headers["Content-Type"] = "application/x-www-form-urlencoded" + outgoing = urllib.request.Request(url, data=data, headers=headers, method=method) # noqa: S310 https URL of a local Fediverse source + try: + with urllib.request.urlopen(outgoing, timeout=TIMEOUT) as response: # noqa: S310 https URL of a local Fediverse source + status, raw = response.status, response.read().decode() + except urllib.error.HTTPError as error: + status, raw = error.code, error.read().decode() + except (urllib.error.URLError, OSError) as error: + return 0, str(error) + try: + return status, json.loads(raw) if raw else None + except ValueError: + return status, raw + + +def multipart( + boundary: str, + fields: dict[str, str | list[str]], + files: dict[str, tuple[str, str, bytes]], +) -> bytes: + parts = [ + f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"\r\n\r\n{single}\r\n'.encode() + for name, value in fields.items() + for single in (value if isinstance(value, list) else [value]) + ] + for name, (filename, mime, content) in files.items(): + parts.append( + f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"; filename="{filename}"\r\n' + f"Content-Type: {mime}\r\n\r\n".encode() + + content + + b"\r\n" + ) + return b"".join(parts) + f"--{boundary}--\r\n".encode() + + +def mastodon_post( + base: str, + token: str, + text: str, + image: tuple[str, str, bytes] | None, + spoiler: str, +) -> dict: + fields: dict[str, str | list[str]] = {"status": text, "visibility": "public"} + if spoiler: + fields["spoiler_text"] = spoiler + if image: + status, media = request( + "POST", + f"{base}/api/v2/media", + token, + {"description": "A plain colour square"}, + {"file": image}, + ) + if status not in (200, 202) or not isinstance(media, dict): + return {"error": f"media upload HTTP {status} {media}"} + fields["media_ids[]"] = [str(media["id"])] + time.sleep(2) + status, body = request("POST", f"{base}/api/v1/statuses", token, fields) + if status != 200 or not isinstance(body, dict): + return {"error": f"status HTTP {status} {body}"} + return body + + +def mastodon_statuses(base: str, token: str, account: str) -> list[dict]: + status, found = request( + "GET", f"{base}/api/v1/accounts/lookup?acct={account}", token + ) + if status != 200 or not isinstance(found, dict): + return [] + status, body = request( + "GET", f"{base}/api/v1/accounts/{found['id']}/statuses?limit=40", token + ) + return body if status == 200 and isinstance(body, list) else [] + + +def pixelfed_post( + base: str, token: str, text: str, image: tuple[str, str, bytes] +) -> dict: + status, media = request( + "POST", + f"{base}/api/v1/media", + token, + {"description": "A plain colour square"}, + {"file": image}, + ) + if status != 200 or not isinstance(media, dict): + return {"error": f"media upload HTTP {status} {media}"} + status, body = request( + "POST", + f"{base}/api/v1/statuses", + token, + {"status": text, "visibility": "public", "media_ids[]": [str(media["id"])]}, + ) + if status != 200 or not isinstance(body, dict): + return {"error": f"status HTTP {status} {body}"} + return body + + +def peertube_upload( + base: str, + token: str, + channel: str, + name: str, + tag: str, + video: tuple[str, str, bytes], +) -> dict: + status, found = request("GET", f"{base}/api/v1/video-channels/{channel}", token) + if status != 200 or not isinstance(found, dict): + return {"error": f"channel HTTP {status} {found}"} + status, body = request( + "POST", + f"{base}/api/v1/videos/upload", + token, + { + "channelId": str(found["id"]), + "name": name, + "privacy": "1", + "waitTranscoding": "false", + "tags[]": [tag], + }, + {"videofile": video}, + ) + if status != 200 or not isinstance(body, dict): + return {"error": f"upload HTTP {status} {body}"} + return body["video"] From 03a77a787fce8ca8e042742a2f0eb65ea1cb7833 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:47 +0200 Subject: [PATCH 103/554] test(web-app-openpost): search crossposter reports in the mailbox --- .../files/test/openpost_mailbox.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 roles/web-app-openpost/files/test/openpost_mailbox.py diff --git a/roles/web-app-openpost/files/test/openpost_mailbox.py b/roles/web-app-openpost/files/test/openpost_mailbox.py new file mode 100644 index 0000000000..7c8a50d24f --- /dev/null +++ b/roles/web-app-openpost/files/test/openpost_mailbox.py @@ -0,0 +1,40 @@ +"""Env (rendered into test.env from templates/test.env.j2): +OPENPOST_MAIL_HOST IMAPS host of the platform mail server +OPENPOST_MAIL_PASSWORD_B64 base64 password of the administrator mailbox +""" + +from __future__ import annotations + +import base64 +import imaplib +import os +import ssl + +from openpost_api import MAIL_RECIPIENT + +MAIL_HOST = os.environ["OPENPOST_MAIL_HOST"] +MAIL_PASSWORD = base64.b64decode(os.environ["OPENPOST_MAIL_PASSWORD_B64"]).decode() +IMAPS_PORT = 993 +REPORT_SUBJECT = "OpenPost crossposter" + + +def reports_naming(urls: list[str]) -> list[str]: + context = ssl.create_default_context() + context.check_hostname = False + context.verify_mode = ssl.CERT_NONE + found: list[str] = [] + try: + with imaplib.IMAP4_SSL( + MAIL_HOST, IMAPS_PORT, ssl_context=context, timeout=60 + ) as imap: + imap.login(MAIL_RECIPIENT, MAIL_PASSWORD) + imap.select("INBOX", readonly=True) + for url in urls: + typ, data = imap.search( + None, "SUBJECT", f'"{REPORT_SUBJECT}"', "BODY", f'"{url}"' + ) + if typ == "OK" and data and data[0].split(): + found.append(url) + except (imaplib.IMAP4.error, OSError): + return found + return found From ceff5155fce6e65d03e3716ac3e293fbd1e35f7b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:47 +0200 Subject: [PATCH 104/554] test(web-app-openpost): add crossposter cli scenarios --- .../files/test/openpost_crossposter.py | 465 ++++++++++++++++++ 1 file changed, 465 insertions(+) create mode 100644 roles/web-app-openpost/files/test/openpost_crossposter.py diff --git a/roles/web-app-openpost/files/test/openpost_crossposter.py b/roles/web-app-openpost/files/test/openpost_crossposter.py new file mode 100644 index 0000000000..162f6d4faa --- /dev/null +++ b/roles/web-app-openpost/files/test/openpost_crossposter.py @@ -0,0 +1,465 @@ +"""Env (rendered into test.env from templates/test.env.j2): +OPENPOST_CROSSPOSTER_ROUTES_B64 base64 JSON list of the deployed routes without their tokens, empty list when the crossposter is off +OPENPOST_CROSSPOSTER_SECRETS_FILE host path of the rendered crossposter secrets, which carry the CI source tokens +OPENPOST_CROSSPOSTER_CONTAINER crossposter container on the probe's node, empty when swarm placed it elsewhere +OPENPOST_CROSSPOSTER_CONFIG configuration path inside the crossposter container +OPENPOST_CROSSPOSTER_POLL_SECONDS poll interval of the deployed crossposter +OPENPOST_CROSSPOSTER_RETRY_SECONDS upper bound of the deployed retry budget, from max_attempts and cap_seconds +""" + +from __future__ import annotations + +import base64 +import json +import os +import secrets +import subprocess +import time +import urllib.parse +from pathlib import Path + +from openpost_api import DEADLINE, accounts, call, check, render_media +from openpost_journal import hits, statuses +from openpost_mailbox import reports_naming +from openpost_simulator import SCENARIOS, simulator_admin +from openpost_sources import ( + mastodon_post, + mastodon_statuses, + peertube_upload, + pixelfed_post, +) + +ROUTES = json.loads(base64.b64decode(os.environ["OPENPOST_CROSSPOSTER_ROUTES_B64"])) +SECRETS_FILE = os.environ["OPENPOST_CROSSPOSTER_SECRETS_FILE"] +CROSSPOSTER = os.environ["OPENPOST_CROSSPOSTER_CONTAINER"] +CONFIG = os.environ["OPENPOST_CROSSPOSTER_CONFIG"] +POLL_SECONDS = int(os.environ["OPENPOST_CROSSPOSTER_POLL_SECONDS"]) +RETRY_SECONDS = int(os.environ["OPENPOST_CROSSPOSTER_RETRY_SECONDS"]) +QUIET_POLLS = 3 +MEMBERS = { + ("mastodon", "review"): ("x",), + ("mastodon", "auto"): ("mastodon", "x", "facebook", "instagram"), + ("pixelfed", "auto"): ("instagram", "x"), + ("peertube", "auto"): ("youtube",), +} +SETTINGS = {label: settings for label, _, _, _, settings in SCENARIOS if settings} +SQL = ( + "import json, sys, psycopg\n" + "from crossposter import config\n" + "dsn = config.load(sys.argv[1]).dsn\n" + "with psycopg.connect(dsn, autocommit=True) as connection:\n" + " cursor = connection.execute(sys.argv[2], json.loads(sys.argv[3]))\n" + " rows = cursor.fetchall() if cursor.description else []\n" + "print(json.dumps([list(map(str, row)) for row in rows]))\n" +) +HELD = ( + "import sys, time, psycopg\n" + "from crossposter import config\n" + "with psycopg.connect(config.load(sys.argv[1]).dsn) as connection:\n" + " connection.execute('LOCK TABLE crossposter.cursors IN ACCESS EXCLUSIVE MODE')\n" + " connection.execute('DELETE FROM crossposter.cursors WHERE route = %s', (sys.argv[2],))\n" + " print('held', flush=True)\n" + " time.sleep(float(sys.argv[3]))\n" +) + + +def crossposter(*argv: str) -> subprocess.CompletedProcess: + return subprocess.run( + ["container", "exec", CROSSPOSTER, *argv], + capture_output=True, + timeout=300, + check=False, + ) + + +def sql(statement: str, *parameters: str) -> list[list[str]]: + result = crossposter( + "python", "-c", SQL, CONFIG, statement, json.dumps(list(parameters)) + ) + if result.returncode != 0: + check(f"SQL {statement[:40]}", False, result.stderr.decode()[-400:]) + return [] + return json.loads(result.stdout.decode()) + + +def items(source_url: str) -> list[list[str]]: + return sql( + "SELECT network, state, resends, publication_id, last_error" + " FROM crossposter.items WHERE source_url = %s ORDER BY id", + source_url, + ) + + +def publications(token: str, workspace: str, nonce: str) -> list[dict]: + query = urllib.parse.urlencode( + {"workspace_id": workspace, "search": nonce, "limit": 50} + ) + status, body = call("GET", f"/publications?{query}", token=token) + return body if status == 200 and isinstance(body, list) else [] + + +def wait(probe, ready, budget: float) -> object: + end = min(DEADLINE, time.monotonic() + budget) + current = probe() + while not ready(current) and time.monotonic() < end: + time.sleep(5) + current = probe() + return current + + +def delivered(publication: dict) -> bool: + found = publication.get("renditions") or [] + return bool(found) and all(item.get("status") == "published" for item in found) + + +def social_sets(token: str, workspace: str) -> dict[str, dict]: + status, body = call("GET", f"/social-sets?workspace_id={workspace}", token=token) + found = body if status == 200 and isinstance(body, list) else [] + return {str(item["name"]): item for item in found} + + +def fill_sets(token: str, workspace: str) -> None: + connected = accounts(token, workspace) + existing = social_sets(token, workspace) + for route in ROUTES: + chosen = existing.get(route["social_set"]) + if chosen is None: + check(f"route {route['name']}: social set exists", False, route) + continue + members = [ + { + "social_account_id": connected[platform][0], + "default_settings": SETTINGS.get(platform, {}), + } + for platform in MEMBERS[(route["platform"], route["mode"])] + if connected.get(platform) + ] + status, body = call( + "PUT", + f"/social-sets/{chosen['id']}", + {"name": chosen["name"], "workspace_id": workspace, "accounts": members}, + token, + ) + check( + f"route {route['name']}: its social set takes {len(members)} target(s)", + status == 200 and bool(members), + f"HTTP {status} {body}", + ) + + +def check_instance() -> None: + result = crossposter("python", "-m", "crossposter", "health", "--config", CONFIG) + check( + "the crossposter reports itself healthy", result.returncode == 0, result.stderr + ) + second = crossposter( + "timeout", + str(POLL_SECONDS + 10), + "python", + "-m", + "crossposter", + "run", + "--config", + CONFIG, + ) + log = second.stderr.decode() + check( + "a second crossposter instance stands by while the first holds the lock", + "standing by" in log and "lock acquired" not in log, + log[-400:], + ) + + +def check_listing(states: set[str]) -> None: + result = crossposter("python", "-m", "crossposter", "list", "--config", CONFIG) + table = result.stdout.decode() + check( + "the list command shows every crossposted state seen in this run", + result.returncode == 0 and all(f"\t{state}\t" in table for state in states), + table[-600:], + ) + + +def mastodon_scenarios( + token: str, workspace: str, route: dict, source: str +) -> set[str]: + base, tag, seen = route["base_url"], route["tags"][0], set() + if route["mode"] == "review": + nonce = f"cp-{secrets.token_hex(4)}" + status = mastodon_post(base, source, f"Review {nonce} #{tag}", None, "") + check("a reviewed Mastodon status is posted", "error" not in status, status) + found = wait( + lambda: publications(token, workspace, nonce), + bool, + POLL_SECONDS * 4, + ) + check( + "a review route leaves an unscheduled OpenPost draft", + len(found) == 1 and found[0].get("status") == "draft", + found, + ) + seen.add("drafted") + return seen + since = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(time.time() - 1)) + simulator_admin("/scenarios/reset", post=True) + nonce = f"cp-{secrets.token_hex(4)}" + name, mime, image = render_media("image") + status = mastodon_post( + base, source, f"Auto {nonce} [simulate-503] #{tag}", (name, mime, image), "" + ) + check("an automatic Mastodon status is posted", "error" not in status, status) + targets = len(MEMBERS[("mastodon", "auto")]) + found = wait( + lambda: publications(token, workspace, nonce), + lambda found: sum(map(delivered, found)) >= targets, + POLL_SECONDS * 6 + 300, + ) + check( + "an auto route delivers the status to every target of its social set", + sum(map(delivered, found)) == targets, + [(item.get("status"), item.get("renditions")) for item in found], + ) + journal = simulator_admin( + "/requests?since=" + urllib.parse.quote(since), post=False + ) + entries = journal["requests"] if isinstance(journal, dict) else [] + tweets = hits(entries, "POST", "/2/tweets", nonce) + check( + "X answers 503 once and receives the resent post exactly once", + statuses(tweets) == [503, 201], + statuses(tweets), + ) + check( + "the X text carries no source link", + bool(tweets) + and status.get("url", "-") not in str(tweets[-1]["request"]["body"]), + ) + check( + "Facebook and Instagram receive the post", + bool(hits(entries, "POST", r"/v[0-9.]+/(424242|525252)/feed", nonce)) + and bool(hits(entries, "POST", r"/v[0-9.]+/17841400000000000/media", nonce)), + ) + copies = [ + item + for item in mastodon_statuses(base, source, route["account"]) + if nonce in str(item.get("content")) + and (item.get("application") or {}).get("name") == "OpenPost" + ] + check( + "OpenPost delivers one copy to the local Mastodon target", + len(copies) == 1, + copies, + ) + seen.add("published") + optout = f"cp-{secrets.token_hex(4)}" + mastodon_post(base, source, f"Kept {optout} #{tag} #nocrosspost", None, "") + warned = f"cp-{secrets.token_hex(4)}" + mastodon_post(base, source, f"Spoiler {warned} #{tag}", None, "spoiler") + drafts = wait( + lambda: publications(token, workspace, warned), + bool, + POLL_SECONDS * 4, + ) + check( + "a status with a content warning stays a draft even on an auto route", + bool(drafts) and all(item.get("status") == "draft" for item in drafts), + drafts, + ) + time.sleep(POLL_SECONDS * QUIET_POLLS) + check( + "a status carrying the opt-out hashtag is never forwarded", + not publications(token, workspace, optout), + ) + check( + "the copy OpenPost published on Mastodon is not forwarded again", + len(publications(token, workspace, nonce)) == len(found), + len(publications(token, workspace, nonce)), + ) + seen.add("drafted") + if CROSSPOSTER: + replayed = {"nonce": nonce, "before": str(int(status["id"]) - 1)} + check_replay(token, workspace, route, source, replayed, len(found)) + return seen | check_failures(token, workspace, route, source) + + +def check_failures(token: str, workspace: str, route: dict, source: str) -> set[str]: + base, tag = route["base_url"], route["tags"][0] + rejected = mastodon_post( + base, + source, + f"Rejected cp-{secrets.token_hex(4)} [simulate-400] #{tag}", + None, + "", + ) + exhausted = mastodon_post( + base, + source, + f"Exhausted cp-{secrets.token_hex(4)} [simulate-503-always] #{tag}", + None, + "", + ) + urls = [str(rejected.get("url")), str(exhausted.get("url"))] + budget = POLL_SECONDS * 6 + RETRY_SECONDS + found = wait( + lambda: reports_naming(urls), + lambda found: len(found) == len(urls), + budget, + ) + check( + "a provider rejection and an exhausted retry budget reach the administrator by mail", + len(found) == len(urls), + found, + ) + if CROSSPOSTER: + states = { + state for url in urls for _, state, *_ in items(url) if state != "published" + } + check( + "the rejection ends failed and the outage ends dead-lettered", + states == {"failed", "dead_lettered"}, + states, + ) + return {"failed", "dead_lettered"} + + +def check_replay( + token: str, + workspace: str, + route: dict, + source: str, + replayed: dict[str, str], + expected: int, +) -> None: + nonce = replayed["nonce"] + sql( + "UPDATE crossposter.cursors SET cursor = %s WHERE route = %s", + replayed["before"], + route["name"], + ) + time.sleep(POLL_SECONDS * QUIET_POLLS) + check( + "replaying the source after a cursor reset creates no second publication", + len(publications(token, workspace, nonce)) == expected, + len(publications(token, workspace, nonce)), + ) + old = f"cp-{secrets.token_hex(4)}" + holder = subprocess.Popen( + [ + "container", + "exec", + CROSSPOSTER, + "python", + "-c", + HELD, + CONFIG, + route["name"], + "10", + ], + stdout=subprocess.PIPE, + ) + holder.stdout.readline() + mastodon_post(route["base_url"], source, f"Old {old} #{route['tags'][0]}", None, "") + holder.wait(timeout=60) + time.sleep(POLL_SECONDS * QUIET_POLLS) + check( + "re-activating a route forwards none of the posts that already exist", + not publications(token, workspace, old) + and bool( + sql( + "SELECT cursor FROM crossposter.cursors WHERE route = %s", route["name"] + ) + ), + ) + + +def pixelfed_scenarios( + token: str, workspace: str, route: dict, source: str +) -> set[str]: + nonce = f"cp-{secrets.token_hex(4)}" + since = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(time.time() - 1)) + name, mime, image = render_media("image") + status = pixelfed_post( + route["base_url"], + source, + f"Pixel {nonce} #{route['tags'][0]}", + (name, mime, image), + ) + check("a Pixelfed post is published", "error" not in status, status) + found = wait( + lambda: publications(token, workspace, nonce), + lambda found: len(found) >= 2 and all(map(delivered, found)), + POLL_SECONDS * 6 + 300, + ) + check( + "a Pixelfed post reaches Instagram and X", + len(found) >= 2 and all(map(delivered, found)), + [(item.get("status"), item.get("renditions")) for item in found], + ) + journal = simulator_admin( + "/requests?since=" + urllib.parse.quote(since), post=False + ) + entries = journal["requests"] if isinstance(journal, dict) else [] + check( + "Instagram receives a JPEG container for the Pixelfed image", + bool(hits(entries, "POST", r"/v[0-9.]+/17841400000000000/media", nonce)), + ) + return {"published"} + + +def peertube_scenarios( + token: str, workspace: str, route: dict, source: str +) -> set[str]: + nonce = f"cp-{secrets.token_hex(4)}" + since = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(time.time() - 1)) + name, mime, video = render_media("video") + uploaded = peertube_upload( + route["base_url"], + source, + route["account"], + f"Video {nonce}", + route["tags"][0], + (name, mime, video), + ) + check("a PeerTube video is uploaded", "error" not in uploaded, uploaded) + found = wait( + lambda: publications(token, workspace, nonce), + lambda found: bool(found) and all(map(delivered, found)), + POLL_SECONDS * 6 + 600, + ) + check( + "a PeerTube video reaches YouTube", + bool(found) and all(map(delivered, found)), + [(item.get("status"), item.get("renditions")) for item in found], + ) + journal = simulator_admin( + "/requests?since=" + urllib.parse.quote(since), post=False + ) + entries = journal["requests"] if isinstance(journal, dict) else [] + check( + "YouTube receives one upload of the PeerTube MP4", + len(hits(entries, "PUT", "/upload/youtube/v3/videos", "")) >= 1, + ) + return {"published"} + + +SCENARIO_RUNNERS = { + "mastodon": mastodon_scenarios, + "pixelfed": pixelfed_scenarios, + "peertube": peertube_scenarios, +} + + +def check_crossposter(token: str, workspace: str) -> None: + tokens = json.loads(Path(SECRETS_FILE).read_text())["routes"] + fill_sets(token, workspace) + if CROSSPOSTER: + check_instance() + else: + print("[SKIP] crossposter internals: its task runs on another swarm node") + seen: set[str] = set() + for route in sorted(ROUTES, key=lambda route: route["mode"] != "review"): + seen |= SCENARIO_RUNNERS[route["platform"]]( + token, workspace, route, tokens[route["name"]] + ) + if CROSSPOSTER: + check_listing(seen) From 5d1c870987c9f14f620abf724ecb6453847a5596 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:47 +0200 Subject: [PATCH 105/554] test(web-app-openpost): add the unit test package --- tests/unit/python/roles/web-app-openpost/__init__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/__init__.py b/tests/unit/python/roles/web-app-openpost/__init__.py new file mode 100644 index 0000000000..8ee16d7567 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/__init__.py @@ -0,0 +1,3 @@ +from pathlib import Path + +PROJECT_ROOT: Path = Path(__file__).resolve().parents[5] From 3216e34b5001fcb0f1f2af776762e60e50df613c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:47 +0200 Subject: [PATCH 106/554] test(web-app-openpost): add the files unit test package --- tests/unit/python/roles/web-app-openpost/files/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/files/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/__init__.py b/tests/unit/python/roles/web-app-openpost/files/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From ec7fd86f8e152c43f23227a4fcb702335bc88609 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:48 +0200 Subject: [PATCH 107/554] test(web-app-openpost): put the crossposter package on the test path --- .../web-app-openpost/files/crossposter/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py new file mode 100644 index 0000000000..da4a7bf6bb --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py @@ -0,0 +1,10 @@ +import sys +from pathlib import Path + +PROJECT_ROOT: Path = Path(__file__).resolve().parents[7] +PACKAGE_ROOT: Path = PROJECT_ROOT / "roles/web-app-openpost/files/crossposter" + +if str(PACKAGE_ROOT) not in sys.path: + sys.path.insert(0, str(PACKAGE_ROOT)) + +__all__ = ["PACKAGE_ROOT", "PROJECT_ROOT"] From bdb74a1767fb12b96851ae5766e6ffb1a058bd17 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:48 +0200 Subject: [PATCH 108/554] test(web-app-openpost): add the crossposter unit test package --- .../web-app-openpost/files/crossposter/crossposter/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 0067520f0c033393f72b56e1b564be4cc390c552 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:48 +0200 Subject: [PATCH 109/554] test(web-app-openpost): add the crossposter source test package --- .../files/crossposter/crossposter/sources/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 387c4bfaea3f6599614d741ef776b3aebe631576 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:48 +0200 Subject: [PATCH 110/554] test(web-app-openpost): add the crossposter fixture package --- .../files/crossposter/crossposter/sources/fixtures/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 529877e9a4bac3364026510885d313dd3166f2e2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:48 +0200 Subject: [PATCH 111/554] test(web-app-openpost): add a mastodon account fixture --- .../crossposter/sources/fixtures/mastodon_account.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_account.json diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_account.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_account.json new file mode 100644 index 0000000000..4bd2aa942b --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_account.json @@ -0,0 +1,10 @@ +{ + "id": "109000000000000099", + "username": "press", + "acct": "press", + "display_name": "Press", + "locked": false, + "bot": false, + "url": "https://microblog.example/@press", + "statuses_count": 4 +} From 154e3ab8d074900859dc3af5a3bd8a1bbef13814 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:48 +0200 Subject: [PATCH 112/554] test(web-app-openpost): add mastodon status fixtures --- .../sources/fixtures/mastodon_statuses.json | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_statuses.json diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_statuses.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_statuses.json new file mode 100644 index 0000000000..dfa7fc2d04 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_statuses.json @@ -0,0 +1,83 @@ +[ + { + "id": "109000000000000101", + "created_at": "2026-10-22T08:00:00.000Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "en", + "uri": "https://microblog.example/users/press/statuses/109000000000000101", + "url": "https://microblog.example/@press/109000000000000101", + "content": "

Launching our #fediverse presence

", + "reblog": null, + "application": {"name": "Web", "website": null}, + "media_attachments": [], + "mentions": [], + "tags": [{"name": "fediverse", "url": "https://microblog.example/tags/fediverse"}] + }, + { + "id": "109000000000000102", + "created_at": "2026-10-22T08:05:00.000Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "en", + "uri": "https://microblog.example/users/press/statuses/109000000000000102", + "url": "https://microblog.example/@press/109000000000000102", + "content": "

A picture

", + "reblog": null, + "application": {"name": "Web", "website": null}, + "media_attachments": [ + { + "id": "109000000000000500", + "type": "image", + "url": "https://microblog.example/system/media_attachments/files/109/000/000/000/000/500/original/square.png", + "preview_url": "https://microblog.example/system/media_attachments/files/109/000/000/000/000/500/small/square.png", + "description": "A red square", + "meta": {"original": {"width": 32, "height": 32}} + } + ], + "mentions": [], + "tags": [] + }, + { + "id": "109000000000000103", + "created_at": "2026-10-22T08:10:00.000Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "en", + "uri": "https://microblog.example/users/press/statuses/109000000000000103", + "url": "https://microblog.example/@press/109000000000000103", + "content": "

Published by the desk

", + "reblog": null, + "application": {"name": "OpenPost", "website": "https://publish.example"}, + "media_attachments": [], + "mentions": [], + "tags": [] + }, + { + "id": "109000000000000104", + "created_at": "2026-10-22T08:15:00.000Z", + "in_reply_to_id": "109000000000000001", + "in_reply_to_account_id": "109000000000000077", + "sensitive": true, + "spoiler_text": "politics", + "visibility": "public", + "language": "en", + "uri": "https://microblog.example/users/press/statuses/109000000000000104", + "url": "https://microblog.example/@press/109000000000000104", + "content": "

@alice agreed

", + "reblog": null, + "application": {"name": "Web", "website": null}, + "media_attachments": [], + "mentions": [{"id": "109000000000000077", "username": "alice", "acct": "alice@social.example", "url": "https://social.example/@alice"}], + "tags": [] + } +] From 45e4e7c2d4006e286d698ecc6d1264429470af8a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:49 +0200 Subject: [PATCH 113/554] test(web-app-openpost): add pixelfed status fixtures --- .../sources/fixtures/pixelfed_statuses.json | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/pixelfed_statuses.json diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/pixelfed_statuses.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/pixelfed_statuses.json new file mode 100644 index 0000000000..ab2f8e8ec4 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/pixelfed_statuses.json @@ -0,0 +1,47 @@ +[ + { + "id": "802", + "uri": "https://picture.example/p/press/802", + "url": "https://picture.example/p/press/802", + "created_at": "2026-10-22T09:05:00.000000Z", + "content": "", + "spoiler_text": "", + "visibility": "public", + "in_reply_to_id": null, + "reblog": { + "id": "700", + "uri": "https://picture.example/p/alice/700", + "url": "https://picture.example/p/alice/700", + "content": "

Original

", + "visibility": "public", + "media_attachments": [], + "tags": [] + }, + "application": {"name": "web", "website": null}, + "media_attachments": [], + "tags": [] + }, + { + "id": "801", + "uri": "https://picture.example/p/press/801", + "url": "https://picture.example/p/press/801", + "created_at": "2026-10-22T09:00:00.000000Z", + "content": "

Harbour #sunset

", + "spoiler_text": "", + "visibility": "public", + "in_reply_to_id": null, + "reblog": null, + "application": {"name": "web", "website": null}, + "media_attachments": [ + { + "id": "9001", + "type": "image", + "url": "https://picture.example/storage/m/_v2/801/harbour.jpg", + "preview_url": "https://picture.example/storage/m/_v2/801/harbour_thumb.jpg", + "description": "Sunset over the harbour", + "meta": {"focus": {"x": 0, "y": 0}} + } + ], + "tags": [{"name": "sunset", "url": "https://picture.example/discover/tags/sunset"}] + } +] From 520aa55489c3de253fe884a17d1962c030f025a9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:49 +0200 Subject: [PATCH 114/554] test(web-app-openpost): add peertube video fixtures --- .../sources/fixtures/peertube_videos.json | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_videos.json diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_videos.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_videos.json new file mode 100644 index 0000000000..832975a46d --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_videos.json @@ -0,0 +1,41 @@ +{ + "total": 3, + "data": [ + { + "id": 31, + "uuid": "6a1c6b54-0e3b-4c0e-9b9e-1a2b3c4d5e6f", + "shortUUID": "dK3h1qWvA8bQ2nPp", + "url": "https://video.example/videos/watch/6a1c6b54-0e3b-4c0e-9b9e-1a2b3c4d5e6f", + "name": "Conference talk", + "description": "Short description", + "publishedAt": "2026-10-22T10:30:00.000Z", + "privacy": {"id": 1, "label": "Public"}, + "state": {"id": 1, "label": "Published"}, + "duration": 1800 + }, + { + "id": 30, + "uuid": "5f1c6b54-0e3b-4c0e-9b9e-1a2b3c4d5e6f", + "shortUUID": "cK3h1qWvA8bQ2nPp", + "url": "https://video.example/videos/watch/5f1c6b54-0e3b-4c0e-9b9e-1a2b3c4d5e6f", + "name": "Unlisted rehearsal", + "description": "Not for everyone", + "publishedAt": "2026-10-22T10:00:00.000Z", + "privacy": {"id": 2, "label": "Unlisted"}, + "state": {"id": 1, "label": "Published"}, + "duration": 600 + }, + { + "id": 29, + "uuid": "4e1c6b54-0e3b-4c0e-9b9e-1a2b3c4d5e6f", + "shortUUID": "bK3h1qWvA8bQ2nPp", + "url": "https://video.example/videos/watch/4e1c6b54-0e3b-4c0e-9b9e-1a2b3c4d5e6f", + "name": "Still transcoding", + "description": "Soon", + "publishedAt": "2026-10-22T09:30:00.000Z", + "privacy": {"id": 1, "label": "Public"}, + "state": {"id": 2, "label": "To transcode"}, + "duration": 900 + } + ] +} From 8a31448ece57789825e5686a331f32adfd4f7e3b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:49 +0200 Subject: [PATCH 115/554] test(web-app-openpost): add a peertube video detail fixture --- .../fixtures/peertube_video_detail.json | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_video_detail.json diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_video_detail.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_video_detail.json new file mode 100644 index 0000000000..6eb9f9a218 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_video_detail.json @@ -0,0 +1,29 @@ +{ + "id": 31, + "uuid": "6a1c6b54-0e3b-4c0e-9b9e-1a2b3c4d5e6f", + "name": "Conference talk", + "description": "Full description of the conference talk", + "tags": ["talk", "fediverse"], + "files": [], + "streamingPlaylists": [ + { + "id": 7, + "type": 1, + "playlistUrl": "https://video.example/static/streaming-playlists/hls/6a1c6b54/master.m3u8", + "files": [ + { + "resolution": {"id": 480, "label": "480p"}, + "size": 20971520, + "fileUrl": "https://video.example/static/streaming-playlists/hls/6a1c6b54/6a1c6b54-480-fragmented.mp4", + "fileDownloadUrl": "https://video.example/download/streaming-playlists/hls/videos/6a1c6b54-480.mp4" + }, + { + "resolution": {"id": 1080, "label": "1080p"}, + "size": 52428800, + "fileUrl": "https://video.example/static/streaming-playlists/hls/6a1c6b54/6a1c6b54-1080-fragmented.mp4", + "fileDownloadUrl": "https://video.example/download/streaming-playlists/hls/videos/6a1c6b54-1080.mp4" + } + ] + } + ] +} From 2130be74571a9af3fa7cddafb493adf2d9dc61c2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:49 +0200 Subject: [PATCH 116/554] test(web-app-openpost): cover the mastodon source --- .../crossposter/sources/test_mastodon.py | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py new file mode 100644 index 0000000000..c08f28f5f7 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py @@ -0,0 +1,108 @@ +from __future__ import annotations + +import json +import unittest +import urllib.parse +from pathlib import Path +from unittest.mock import patch + +from crossposter.sources import mastodon + +from utils.cache.files import read_text + +FIXTURES = Path(__file__).parent / "fixtures" + + +def fixture(name: str) -> object: + return json.loads(read_text(str(FIXTURES / name))) + + +class FakeMastodon: + def __init__(self, statuses: list[dict]) -> None: + self.statuses = statuses + self.queries: list[dict[str, str]] = [] + + def __call__(self, url: str, headers: dict[str, str]) -> object: + parsed = urllib.parse.urlparse(url) + query = dict(urllib.parse.parse_qsl(parsed.query)) + if parsed.path == "/api/v1/accounts/lookup": + return fixture("mastodon_account.json") + self.queries.append(query) + ordered = sorted(self.statuses, key=lambda status: int(status["id"])) + limit = int(query["limit"]) + if "min_id" not in query: + return ordered[::-1][:limit] + newer = [ + status for status in ordered if int(status["id"]) > int(query["min_id"]) + ] + return newer[:limit][::-1] + + +class TestParse(unittest.TestCase): + def setUp(self) -> None: + self.statuses = fixture("mastodon_statuses.json") + + def test_a_status_becomes_a_source_item(self) -> None: + item = mastodon.parse_status(self.statuses[0], "mastodon") + self.assertEqual(item.uri, self.statuses[0]["uri"]) + self.assertEqual(item.visibility, "public") + self.assertIn("#fediverse", item.text) + self.assertEqual(item.tags, ("fediverse",)) + self.assertEqual(item.cursor, self.statuses[0]["id"]) + + def test_media_carries_type_and_alt_text(self) -> None: + item = mastodon.parse_status(self.statuses[1], "mastodon") + self.assertEqual(item.media[0].mime, "image/png") + self.assertEqual(item.media[0].description, "A red square") + + def test_the_posting_application_is_kept_for_loop_prevention(self) -> None: + self.assertEqual( + mastodon.parse_status(self.statuses[2], "mastodon").application, "OpenPost" + ) + + def test_content_warnings_and_replies_are_kept(self) -> None: + item = mastodon.parse_status(self.statuses[3], "mastodon") + self.assertEqual(item.spoiler, "politics") + self.assertEqual(item.in_reply_to, "109000000000000001") + + +class TestPolling(unittest.TestCase): + def test_the_newest_status_becomes_the_activation_cursor(self) -> None: + fake = FakeMastodon(fixture("mastodon_statuses.json")) + with patch.object(mastodon.web, "get_json", fake): + cursor = mastodon.MastodonSource( + "https://microblog.example", "press", "token" + ).newest_cursor() + self.assertEqual( + cursor, max(fake.statuses, key=lambda status: int(status["id"]))["id"] + ) + + def test_fetch_returns_newer_statuses_oldest_first_and_excludes_replies_and_boosts( + self, + ) -> None: + fake = FakeMastodon(fixture("mastodon_statuses.json")) + with patch.object(mastodon.web, "get_json", fake): + items = mastodon.MastodonSource( + "https://microblog.example", "press", "token" + ).fetch("0") + cursors = [int(item.cursor) for item in items] + self.assertEqual(cursors, sorted(cursors)) + self.assertEqual(fake.queries[0]["exclude_replies"], "true") + self.assertEqual(fake.queries[0]["exclude_reblogs"], "true") + + def test_fetch_pages_with_the_min_id_cursor(self) -> None: + many = [ + dict( + fixture("mastodon_statuses.json")[0], + id=str(200 + index), + uri=f"https://m/{index}", + ) + for index in range(45) + ] + fake = FakeMastodon(many) + with patch.object(mastodon.web, "get_json", fake): + items = mastodon.MastodonSource( + "https://microblog.example", "press", "token" + ).fetch("0") + self.assertEqual(len(items), 45) + self.assertEqual(fake.queries[1]["min_id"], "239") From f9b90d97fe45f547a07c85494509fe077ffe2130 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:49 +0200 Subject: [PATCH 117/554] test(web-app-openpost): cover the pixelfed source --- .../crossposter/sources/test_pixelfed.py | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_pixelfed.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_pixelfed.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_pixelfed.py new file mode 100644 index 0000000000..d794fc41e0 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_pixelfed.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +import json +import unittest +import urllib.parse +from pathlib import Path +from unittest.mock import patch + +from crossposter.sources import mastodon, pixelfed + +from utils.cache.files import read_text + +FIXTURES = Path(__file__).parent / "fixtures" + + +def fixture(name: str) -> object: + return json.loads(read_text(str(FIXTURES / name))) + + +class TestPixelfed(unittest.TestCase): + def test_pixelfed_polls_without_the_unsupported_reblog_filter(self) -> None: + queries: list[dict[str, str]] = [] + + def fake(url: str, headers: dict[str, str]) -> object: + parsed = urllib.parse.urlparse(url) + if parsed.path == "/api/v1/accounts/lookup": + return {"id": "42"} + queries.append(dict(urllib.parse.parse_qsl(parsed.query))) + return fixture("pixelfed_statuses.json") + + with patch.object(mastodon.web, "get_json", fake): + items = pixelfed.PixelfedSource( + "https://picture.example", "press", "token" + ).fetch("0") + self.assertNotIn("exclude_reblogs", queries[0]) + self.assertEqual(queries[0]["exclude_replies"], "true") + self.assertEqual([item.platform for item in items], ["pixelfed", "pixelfed"]) + + def test_a_reblog_is_flagged_for_the_route_filter(self) -> None: + statuses = { + status["id"]: status for status in fixture("pixelfed_statuses.json") + } + own = mastodon.parse_status(statuses["801"], pixelfed.PixelfedSource.platform) + boosted = mastodon.parse_status( + statuses["802"], pixelfed.PixelfedSource.platform + ) + self.assertFalse(own.reblog) + self.assertTrue(boosted.reblog) + self.assertEqual(own.media[0].mime, "image/jpeg") + self.assertEqual(own.media[0].description, "Sunset over the harbour") From bd935f139e340ba86ca8a80c670326b22e423caa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:49 +0200 Subject: [PATCH 118/554] test(web-app-openpost): cover the peertube source --- .../crossposter/sources/test_peertube.py | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py new file mode 100644 index 0000000000..7dcfcb4408 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py @@ -0,0 +1,66 @@ +from __future__ import annotations + +import json +import unittest +import urllib.parse +from pathlib import Path +from unittest.mock import patch + +from crossposter.sources import peertube + +from utils.cache.files import read_text + +FIXTURES = Path(__file__).parent / "fixtures" + + +def fixture(name: str) -> object: + return json.loads(read_text(str(FIXTURES / name))) + + +def fake_get_json(url: str, headers: dict[str, str]) -> object: + parsed = urllib.parse.urlparse(url) + if parsed.path.startswith("/api/v1/videos/"): + detail = fixture("peertube_video_detail.json") + return dict(detail, uuid=parsed.path.rsplit("/", 1)[-1]) + start = int(dict(urllib.parse.parse_qsl(parsed.query))["start"]) + listing = fixture("peertube_videos.json") + return dict(listing, data=listing["data"][start:]) + + +class TestParse(unittest.TestCase): + def test_a_published_public_video_carries_title_description_tags_and_one_mp4( + self, + ) -> None: + video = fixture("peertube_videos.json")["data"][0] + item = peertube.parse_video(video, fixture("peertube_video_detail.json")) + self.assertEqual(item.title, video["name"]) + self.assertTrue(item.text.startswith("Full description")) + self.assertEqual(item.tags, ("talk", "fediverse")) + self.assertEqual(item.media[0].mime, "video/mp4") + self.assertEqual(item.media[0].size, 52_428_800) + self.assertTrue(item.media[0].url.endswith("-1080.mp4")) + self.assertEqual(item.cursor, video["publishedAt"]) + + def test_only_published_public_videos_pass(self) -> None: + videos = fixture("peertube_videos.json")["data"] + self.assertEqual( + [peertube.published_public(video) for video in videos], [True, False, False] + ) + + +class TestPolling(unittest.TestCase): + def test_the_newest_video_becomes_the_activation_cursor(self) -> None: + with patch.object(peertube.web, "get_json", fake_get_json): + cursor = peertube.PeerTubeSource( + "https://video.example", "press_channel", "token" + ).newest_cursor() + self.assertEqual(cursor, "2026-10-22T10:30:00.000Z") + + def test_fetch_forwards_only_newer_published_public_videos_oldest_first( + self, + ) -> None: + with patch.object(peertube.web, "get_json", fake_get_json): + items = peertube.PeerTubeSource( + "https://video.example", "press_channel", "token" + ).fetch("2026-10-22T09:00:00.000Z") + self.assertEqual([item.title for item in items], ["Conference talk"]) From 12b0c096c2439c8d67e004d5c86a453cb6e29666 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:50 +0200 Subject: [PATCH 119/554] test(web-app-openpost): cover the crossposter http client --- .../files/crossposter/crossposter/test_web.py | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_web.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_web.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_web.py new file mode 100644 index 0000000000..83f921ce53 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_web.py @@ -0,0 +1,82 @@ +from __future__ import annotations + +import tempfile +import threading +import unittest +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer +from pathlib import Path + +from crossposter import web + +RECEIVED: dict[str, bytes] = {} + + +class Handler(BaseHTTPRequestHandler): + def log_message(self, *args: object) -> None: + return None + + def _answer(self, status: int, body: bytes, headers: dict[str, str]) -> None: + self.send_response(status) + for name, value in headers.items(): + self.send_header(name, value) + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def do_GET(self) -> None: + if self.path == "/json": + self._answer(200, b'{"ok": true}', {"Content-Type": "application/json"}) + elif self.path == "/busy": + self._answer(503, b"busy", {"Retry-After": "30"}) + elif self.path == "/media": + self._answer(200, b"\xff\xd8" + b"x" * 4096, {}) + else: + self._answer(404, b"missing", {}) + + def do_PUT(self) -> None: + RECEIVED[self.path] = self.rfile.read(int(self.headers["Content-Length"])) + self._answer(201, b"", {}) + + +class ServerFixture: + @classmethod + def setUpClass(cls) -> None: + cls.server = ThreadingHTTPServer(("127.0.0.1", 0), Handler) + cls.base = f"http://127.0.0.1:{cls.server.server_address[1]}" + threading.Thread(target=cls.server.serve_forever, daemon=True).start() + + @classmethod + def tearDownClass(cls) -> None: + cls.server.shutdown() + cls.server.server_close() + + +class TestRequest(ServerFixture, unittest.TestCase): + def test_json_answers_are_decoded(self) -> None: + self.assertEqual(web.get_json(self.base + "/json", {}), {"ok": True}) + + def test_a_server_error_is_transient_and_keeps_its_headers(self) -> None: + with self.assertRaises(web.RequestError) as caught: + web.request("GET", self.base + "/busy", {}, None, (200,)) + self.assertTrue(caught.exception.transient) + self.assertEqual(caught.exception.headers.get("Retry-After"), "30") + + def test_a_client_error_is_permanent(self) -> None: + with self.assertRaises(web.RequestError) as caught: + web.request("GET", self.base + "/gone", {}, None, (200,)) + self.assertFalse(caught.exception.transient) + + def test_an_unreachable_host_is_transient(self) -> None: + with self.assertRaises(web.RequestError) as caught: + web.request("GET", "http://127.0.0.1:9/", {}, None, (200,)) + self.assertTrue(caught.exception.transient) + + +class TestStreaming(ServerFixture, unittest.TestCase): + def test_media_streams_to_disk_and_back(self) -> None: + with tempfile.TemporaryDirectory() as folder: + local = web.download(self.base + "/media", {}, Path(folder) / "media.jpg") + self.assertEqual(local.stat().st_size, 4098) + web.upload("PUT", self.base + "/target", {}, local, (201,)) + self.assertEqual(RECEIVED["/target"][:2], b"\xff\xd8") + self.assertEqual(len(RECEIVED["/target"]), 4098) From 85ffc088e8df1a8276c85e85fe77d297ec136595 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:50 +0200 Subject: [PATCH 120/554] test(web-app-openpost): cover crossposter backoff --- .../crossposter/crossposter/test_retry.py | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_retry.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_retry.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_retry.py new file mode 100644 index 0000000000..3e0f671a25 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_retry.py @@ -0,0 +1,88 @@ +from __future__ import annotations + +import random +import unittest +from datetime import UTC, datetime +from email.utils import format_datetime + +from crossposter import retry + +NOW = 1_800_000_000.0 + + +def seeded(seed: int) -> random.Random: + return random.Random(seed) # noqa: S311 reproducible jitter for the assertions + + +class TestBackoff(unittest.TestCase): + def test_the_jitter_stays_within_the_exponential_window(self) -> None: + rng = seeded(7) + for attempt in range(1, 8): + window = min(3600, 30 * 2 ** (attempt - 1)) + for _ in range(50): + self.assertLessEqual(retry.backoff(attempt, 30, 3600, rng), window) + + def test_the_window_is_capped(self) -> None: + rng = seeded(1) + self.assertLessEqual( + max(retry.backoff(40, 30, 3600, rng) for _ in range(200)), 3600 + ) + + def test_jitter_spreads_the_delays(self) -> None: + rng = seeded(3) + self.assertGreater( + len({round(retry.backoff(4, 30, 3600, rng), 3) for _ in range(20)}), 10 + ) + + +class TestServerHints(unittest.TestCase): + def test_retry_after_seconds(self) -> None: + self.assertEqual(retry.server_delay({"Retry-After": "120"}, NOW), 120) + + def test_retry_after_http_date(self) -> None: + when = format_datetime(datetime.fromtimestamp(NOW + 90, tz=UTC), usegmt=True) + self.assertEqual(retry.server_delay({"retry-after": when}, NOW), 90) + + def test_epoch_rate_limit_reset(self) -> None: + self.assertEqual( + retry.server_delay({"x-rate-limit-reset": str(int(NOW + 45))}, NOW), 45 + ) + + def test_iso_rate_limit_reset(self) -> None: + iso = ( + datetime.fromtimestamp(NOW + 30, tz=UTC).isoformat().replace("+00:00", "Z") + ) + self.assertEqual(retry.server_delay({"X-RateLimit-Reset": iso}, NOW), 30) + + def test_delta_rate_limit_reset(self) -> None: + self.assertEqual(retry.server_delay({"RateLimit-Reset": "12"}, NOW), 12) + + def test_without_hints_there_is_no_server_delay(self) -> None: + self.assertEqual(retry.server_delay({}, NOW), 0) + + def test_a_reset_in_the_past_means_no_wait(self) -> None: + self.assertEqual( + retry.server_delay({"x-rate-limit-reset": str(int(NOW - 10))}, NOW), 0 + ) + + +class TestDelay(unittest.TestCase): + def test_the_server_hint_wins_over_a_shorter_backoff(self) -> None: + rng = seeded(5) + self.assertGreaterEqual( + retry.delay(1, {"Retry-After": "600"}, NOW, 30, 3600, rng), 600 + ) + + def test_without_a_hint_the_backoff_applies(self) -> None: + rng = seeded(5) + self.assertLessEqual(retry.delay(2, {}, NOW, 30, 3600, rng), 60) + + +class TestTransient(unittest.TestCase): + def test_network_errors_rate_limits_and_server_errors_are_transient(self) -> None: + for status in (None, 408, 425, 429, 500, 502, 503, 504): + self.assertTrue(retry.transient(status), status) + + def test_client_errors_are_permanent(self) -> None: + for status in (400, 401, 403, 404, 409, 422): + self.assertFalse(retry.transient(status), status) From faac17a755ed49b26a724d3c2d5c70b98615433d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:50 +0200 Subject: [PATCH 121/554] test(web-app-openpost): cover the crossposter state machine --- .../crossposter/crossposter/test_store.py | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_store.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_store.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_store.py new file mode 100644 index 0000000000..380526b79b --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_store.py @@ -0,0 +1,120 @@ +from __future__ import annotations + +import json +import unittest + +from crossposter import store +from crossposter.sources import Media, SourceItem + +SOURCE = "https://microblog.example/users/press/statuses/1" + + +class TestPayload(unittest.TestCase): + def test_a_stored_item_comes_back_unchanged(self) -> None: + item = SourceItem( + uri=SOURCE, + url="https://microblog.example/@press/1", + platform="mastodon", + text="Hello", + visibility="public", + tags=("news",), + media=( + Media( + url="https://microblog.example/a.png", + mime="image/png", + description="alt", + size=12, + ), + ), + in_reply_to="", + reblog=False, + spoiler="", + application="", + cursor="1", + ) + self.assertEqual( + store.item_from_json(json.loads(store.item_to_json(item))), item + ) + + +class TestIdempotencyKey(unittest.TestCase): + def test_the_key_is_stable_for_one_pair(self) -> None: + self.assertEqual( + store.idempotency_key(SOURCE, "account-1", 0), + store.idempotency_key(SOURCE, "account-1", 0), + ) + + def test_the_key_differs_per_target_and_per_source(self) -> None: + keys = { + store.idempotency_key(SOURCE, "account-1", 0), + store.idempotency_key(SOURCE, "account-2", 0), + store.idempotency_key(SOURCE + "0", "account-1", 0), + } + self.assertEqual(len(keys), 3) + + def test_the_key_cannot_collide_through_concatenation(self) -> None: + self.assertNotEqual( + store.idempotency_key("ab", "c", 0), store.idempotency_key("a", "bc", 0) + ) + + def test_the_key_fits_an_http_header(self) -> None: + key = store.idempotency_key(SOURCE, "account-1", 0) + self.assertRegex(key, r"^crossposter-[0-9a-f]{64}$") + + def test_every_resend_gets_its_own_key_of_the_same_pair(self) -> None: + first = store.idempotency_key(SOURCE, "account-1", 0) + resent = store.idempotency_key(SOURCE, "account-1", 1) + self.assertEqual(resent, f"{first}-r1") + self.assertNotEqual(resent, store.idempotency_key(SOURCE, "account-1", 2)) + + +class TestTransitions(unittest.TestCase): + def test_review_mode_drafts(self) -> None: + self.assertEqual(store.transition("pending", "drafted"), "drafted") + + def test_auto_mode_submits_then_publishes(self) -> None: + self.assertEqual(store.transition("pending", "submitted"), "submitted") + self.assertEqual(store.transition("submitted", "delivered"), "published") + + def test_a_draft_published_in_the_desk_becomes_published(self) -> None: + self.assertEqual(store.transition("drafted", "delivered"), "published") + + def test_a_reported_delivery_failure_is_failed(self) -> None: + self.assertEqual(store.transition("submitted", "delivery_failed"), "failed") + self.assertEqual(store.transition("drafted", "delivery_failed"), "failed") + + def test_transient_errors_stay_pending_until_the_budget_is_spent(self) -> None: + self.assertEqual( + store.transition("pending", "transient", attempts=3, max_attempts=8), + "pending", + ) + self.assertEqual( + store.transition("pending", "transient", attempts=8, max_attempts=8), + "dead_lettered", + ) + + def test_a_submitted_item_can_be_resent_or_exhausted(self) -> None: + self.assertEqual(store.transition("submitted", "resend"), "pending") + self.assertEqual(store.transition("submitted", "exhausted"), "dead_lettered") + + def test_a_reviewed_draft_is_never_resent(self) -> None: + with self.assertRaises(store.InvalidTransitionError): + store.transition("drafted", "resend") + + def test_permanent_errors_dead_letter_at_once(self) -> None: + self.assertEqual(store.transition("pending", "permanent"), "dead_lettered") + + def test_terminal_states_do_not_move(self) -> None: + for state in ("published", "dead_lettered"): + with self.assertRaises(store.InvalidTransitionError): + store.transition(state, "submitted") + + def test_unknown_events_are_refused(self) -> None: + with self.assertRaises(store.InvalidTransitionError): + store.transition("pending", "teleported") + + def test_every_state_is_listed(self) -> None: + self.assertEqual( + set(store.STATES), + {"pending", "drafted", "submitted", "published", "failed", "dead_lettered"}, + ) From 5ec2f505fe2764aa97da408b98c4c0385ebe5210 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:50 +0200 Subject: [PATCH 122/554] test(web-app-openpost): cover crossposter route parsing --- .../crossposter/crossposter/test_config.py | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py new file mode 100644 index 0000000000..ec1ddc961d --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py @@ -0,0 +1,218 @@ +from __future__ import annotations + +import copy +import json +import tempfile +import unittest +from pathlib import Path + +from crossposter import config +from crossposter.sources import Media, SourceItem + +SECRETS = { + "openpost_token": "op-token", + "database_dsn": "postgresql://crossposter@db/openpost", + "mail_password": "mail-secret", + "routes": {"press-mastodon": "secret"}, +} + + +def route() -> dict: + return { + "name": "press-mastodon", + "source": { + "platform": "mastodon", + "base_url": "https://microblog.example", + "account": "press", + }, + "filters": { + "visibility": ["public"], + "exclude_replies": True, + "exclude_reblogs": True, + "tags": [], + "media": "any", + }, + "targets": {"accounts": ["x-press"]}, + "mode": "review", + "attribution": {"default": "{text}\n\n{source_url}", "x": "{text}"}, + } + + +class ConfigFixture: + def setUp(self) -> None: + self.directory = tempfile.TemporaryDirectory() + folder = Path(self.directory.name) + self.secrets = folder / "crossposter-secrets.json" + self.write_secrets(SECRETS) + self.raw = { + "openpost": { + "base_url": "http://openpost:8080", + "host": "publish.example", + "workspace": "workspace-1", + }, + "secrets_file": str(self.secrets), + "mail": { + "host": "mail.example", + "port": 587, + "security": "starttls", + "user": "crossposter", + "sender": "crossposter@example.org", + }, + "heartbeat_file": str(folder / "heartbeat"), + "poll_interval_seconds": 60, + "opt_out_tag": "nocrosspost", + "retry": {"max_attempts": 8, "base_seconds": 30, "cap_seconds": 3600}, + "notify": {"recipients": ["press@example.org"]}, + "routes": [route()], + } + + def tearDown(self) -> None: + self.directory.cleanup() + + def write_secrets(self, values: dict) -> None: + self.secrets.write_text(json.dumps(values)) + + def broken(self, mutate) -> str: + raw = copy.deepcopy(self.raw) + mutate(raw["routes"][0]) + with self.assertRaises(config.ConfigError) as caught: + config.parse(raw) + return str(caught.exception) + + +class TestParse(ConfigFixture, unittest.TestCase): + def test_a_complete_route_parses(self) -> None: + parsed = config.parse(self.raw) + self.assertEqual(parsed.routes[0].source.token, "secret") + self.assertEqual(parsed.routes[0].targets.accounts, ("x-press",)) + self.assertEqual(parsed.retry.max_attempts, 8) + + def test_secrets_are_read_from_the_secrets_file(self) -> None: + parsed = config.parse(self.raw) + self.assertEqual(parsed.openpost.token, "op-token") + self.assertEqual(parsed.dsn, "postgresql://crossposter@db/openpost") + self.assertEqual(parsed.mail.password, "mail-secret") + + def test_mail_is_optional(self) -> None: + raw = copy.deepcopy(self.raw) + raw["mail"] = None + self.assertIsNone(config.parse(raw).mail) + + def test_an_unknown_platform_names_route_and_field(self) -> None: + message = self.broken(lambda item: item["source"].update(platform="myspace")) + self.assertIn("press-mastodon", message) + self.assertIn("source.platform", message) + + def test_a_missing_token_names_route_and_field(self) -> None: + self.write_secrets({**SECRETS, "routes": {"press-mastodon": ""}}) + message = self.broken(lambda item: None) + self.assertIn("press-mastodon", message) + self.assertIn("source.token", message) + + def test_targets_need_accounts_or_a_social_set(self) -> None: + message = self.broken(lambda item: item.update(targets={})) + self.assertIn("targets", message) + + def test_a_mode_outside_review_and_auto_is_refused(self) -> None: + message = self.broken(lambda item: item.update(mode="yolo")) + self.assertIn("mode", message) + + def test_an_attribution_template_needs_the_text(self) -> None: + message = self.broken(lambda item: item["attribution"].update(x="{source_url}")) + self.assertIn("attribution.x", message) + + def test_the_source_must_use_https(self) -> None: + message = self.broken( + lambda item: item["source"].update(base_url="http://microblog.example") + ) + self.assertIn("source.base_url", message) + + def test_route_names_are_unique(self) -> None: + raw = copy.deepcopy(self.raw) + raw["routes"].append(copy.deepcopy(raw["routes"][0])) + with self.assertRaises(config.ConfigError): + config.parse(raw) + + def test_new_routes_default_to_review_mode(self) -> None: + raw = copy.deepcopy(self.raw) + del raw["routes"][0]["mode"] + self.assertEqual(config.parse(raw).routes[0].mode, "review") + + def test_attribution_falls_back_to_the_default_template(self) -> None: + parsed = config.parse(self.raw).routes[0] + self.assertEqual(parsed.template("linkedin"), "{text}\n\n{source_url}") + self.assertEqual(parsed.template("x"), "{text}") + + +def item(**overrides) -> SourceItem: + values = { + "uri": "https://microblog.example/users/press/statuses/1", + "url": "https://microblog.example/@press/1", + "platform": "mastodon", + "text": "Hello #news", + "visibility": "public", + "tags": ("news",), + "media": (), + "in_reply_to": "", + "reblog": False, + "spoiler": "", + "application": "", + } + values.update(overrides) + return SourceItem(**values) + + +class TestRouting(ConfigFixture, unittest.TestCase): + def setUp(self) -> None: + super().setUp() + self.route = config.parse(self.raw).routes[0] + + def test_a_public_post_is_admitted(self) -> None: + self.assertIsNone(self.route.refusal(item(), "nocrosspost")) + + def test_the_opt_out_hashtag_is_never_forwarded(self) -> None: + self.assertEqual( + self.route.refusal(item(tags=("news", "NoCrossPost")), "nocrosspost"), + "opt-out", + ) + + def test_other_visibilities_are_refused(self) -> None: + self.assertEqual( + self.route.refusal(item(visibility="unlisted"), "nocrosspost"), "visibility" + ) + + def test_replies_and_boosts_are_refused(self) -> None: + self.assertEqual( + self.route.refusal(item(in_reply_to="https://x/1"), "nocrosspost"), "reply" + ) + self.assertEqual(self.route.refusal(item(reblog=True), "nocrosspost"), "reblog") + + def test_posts_published_by_openpost_are_refused(self) -> None: + self.assertEqual( + self.route.refusal(item(application="OpenPost"), "nocrosspost"), "loop" + ) + + def test_required_tags_filter(self) -> None: + raw = copy.deepcopy(self.raw) + raw["routes"][0]["filters"]["tags"] = ["press"] + tagged = config.parse(raw).routes[0] + self.assertEqual(tagged.refusal(item(), "nocrosspost"), "tags") + self.assertIsNone(tagged.refusal(item(tags=("Press",)), "nocrosspost")) + + def test_media_filters(self) -> None: + raw = copy.deepcopy(self.raw) + raw["routes"][0]["filters"]["media"] = "required" + required = config.parse(raw).routes[0] + self.assertEqual(required.refusal(item(), "nocrosspost"), "media") + picture = Media( + url="https://microblog.example/a.png", + mime="image/png", + description="", + size=1024, + ) + self.assertIsNone(required.refusal(item(media=(picture,)), "nocrosspost")) + raw["routes"][0]["filters"]["media"] = "none" + self.assertEqual( + config.parse(raw).routes[0].refusal(item(media=(picture,)), "nocrosspost"), + "media", + ) From fb4fb5a798a8d4e01fb2f7679b2e96bb468fd24c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:50 +0200 Subject: [PATCH 123/554] test(web-app-openpost): cover per-network adaptation --- .../crossposter/crossposter/test_adapt.py | 245 ++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_adapt.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_adapt.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_adapt.py new file mode 100644 index 0000000000..ac3bcdc399 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_adapt.py @@ -0,0 +1,245 @@ +from __future__ import annotations + +import unittest + +from crossposter import adapt +from crossposter.sources import Media, SourceItem + +URL = "https://example.org/a/very/long/path/that/would/count/far/more/than/twenty/three" +PICTURE = Media( + url="https://microblog.example/a.png", + mime="image/png", + description="A red square", + size=2048, +) +SMALL_VIDEO = Media( + url="https://video.example/a.mp4", + mime="video/mp4", + description="", + size=10 * 1024 * 1024, +) +LARGE_VIDEO = Media( + url="https://video.example/b.mp4", + mime="video/mp4", + description="", + size=200 * 1024 * 1024, +) +TEMPLATES = {"default": "{text}\n\n{source_url}", "x": "{text}"} + + +def item(**overrides) -> SourceItem: + values = { + "uri": "https://microblog.example/users/press/statuses/1", + "url": "https://microblog.example/@press/1", + "platform": "mastodon", + "text": "Hello world", + "visibility": "public", + "tags": (), + "media": (), + "in_reply_to": "", + "reblog": False, + "spoiler": "", + "application": "", + } + values.update(overrides) + return SourceItem(**values) + + +def prepare(source: SourceItem, network: str, mode: str = "auto") -> adapt.Plan: + return adapt.prepare( + source, network, TEMPLATES.get(network, TEMPLATES["default"]), mode + ) + + +class TestCounting(unittest.TestCase): + def test_mastodon_counts_a_link_as_twenty_three(self) -> None: + self.assertEqual(adapt.count(f"see {URL}", "mastodon"), 4 + 23) + + def test_mastodon_counts_a_remote_mention_by_its_username(self) -> None: + self.assertEqual( + adapt.count("@alice@social.example hi", "mastodon"), len("@alice hi") + ) + + def test_mastodon_counts_graphemes_not_code_points(self) -> None: + family = "\U0001f468‍\U0001f469‍\U0001f467" + self.assertEqual(adapt.count(family, "mastodon"), 1) + self.assertEqual(adapt.count("é", "mastodon"), 1) + + def test_mastodon_adds_the_content_warning(self) -> None: + self.assertEqual(adapt.count("body", "mastodon", spoiler="cw"), 6) + + def test_x_weights_cjk_and_emoji_double(self) -> None: + self.assertEqual(adapt.count("abc", "x"), 3) + self.assertEqual(adapt.count("日本", "x"), 4) + self.assertEqual(adapt.count("\U0001f600", "x"), 2) + self.assertEqual(adapt.count("\U0001f44d\U0001f3fd", "x"), 2) + + def test_x_counts_a_link_as_twenty_three(self) -> None: + self.assertEqual(adapt.count(URL, "x"), 23) + + def test_fits_respects_the_network_limit(self) -> None: + self.assertTrue(adapt.fits("a" * 280, "x")) + self.assertFalse(adapt.fits("a" * 281, "x")) + self.assertTrue(adapt.fits("a" * 500, "threads")) + self.assertFalse(adapt.fits("a" * 501, "threads")) + + +class TestShorten(unittest.TestCase): + def test_text_within_the_limit_is_unchanged(self) -> None: + self.assertEqual(adapt.shorten("short", "x"), "short") + + def test_shortening_never_splits_a_word(self) -> None: + text = " ".join(["word"] * 100) + shortened = adapt.shorten(text, "x") + self.assertTrue(adapt.fits(shortened, "x")) + self.assertTrue(shortened.endswith("…")) + self.assertTrue(all(token == "word" for token in shortened[:-1].split())) + + def test_shortening_keeps_links_and_hashtags_whole(self) -> None: + text = ("lorem " * 50) + URL + " #fediverse " + ("ipsum " * 50) + shortened = adapt.shorten(text, "x") + self.assertTrue(adapt.fits(shortened, "x")) + for token in shortened.rstrip("…").split(): + self.assertIn(token, text.split()) + + def test_instagram_keeps_at_most_thirty_hashtags(self) -> None: + text = "caption " + " ".join(f"#tag{index}" for index in range(40)) + shortened = adapt.shorten(text, "instagram") + self.assertEqual( + len([token for token in shortened.split() if token.startswith("#")]), 30 + ) + + def test_reserve_leaves_room_for_the_attribution(self) -> None: + shortened = adapt.shorten("a " * 400, "x", reserve=30) + self.assertLessEqual(adapt.count(shortened, "x"), 250) + + +class TestHtml(unittest.TestCase): + def test_mastodon_html_becomes_text_with_links_and_mentions(self) -> None: + html = ( + '

Hello ' + "@alice see " + '' + 'example.org/page

second
line ' + '#news

' + ) + self.assertEqual( + adapt.html_to_text(html), + "Hello @alice@social.example see https://example.org/page\n\nsecond\nline #news", + ) + + +class TestMentions(unittest.TestCase): + def test_finds_fediverse_handles(self) -> None: + self.assertEqual( + adapt.mentions("hi @alice@social.example and @bob@pix.example."), + ["@alice@social.example", "@bob@pix.example"], + ) + + def test_fediverse_targets_keep_handles(self) -> None: + self.assertEqual( + adapt.rewrite_mentions("hi @alice@social.example", "mastodon"), + "hi @alice@social.example", + ) + + def test_x_gets_plain_names(self) -> None: + self.assertEqual( + adapt.rewrite_mentions("hi @alice@social.example", "x"), "hi alice" + ) + + def test_other_commercial_targets_get_profile_links(self) -> None: + self.assertEqual( + adapt.rewrite_mentions("hi @alice@social.example", "linkedin"), + "hi alice (https://social.example/@alice)", + ) + + +class TestCompose(unittest.TestCase): + def test_renders_the_template_with_the_source_link(self) -> None: + self.assertEqual( + adapt.compose( + "{text}\n\n{source_url}", + "hello", + "https://social.example/@press/1", + "linkedin", + ), + "hello\n\nhttps://social.example/@press/1", + ) + + def test_the_composed_text_fits_the_target(self) -> None: + composed = adapt.compose( + "{text}\n\n{source_url}", + "word " * 200, + "https://social.example/@press/1", + "x", + ) + self.assertTrue(adapt.fits(composed, "x")) + self.assertTrue(composed.endswith("https://social.example/@press/1")) + + +class TestPrepare(unittest.TestCase): + def test_a_text_post_becomes_short_text_with_attribution(self) -> None: + plan = prepare(item(), "linkedin") + self.assertEqual(plan.profile, "short_text") + self.assertEqual(plan.text, "Hello world\n\nhttps://microblog.example/@press/1") + self.assertFalse(plan.draft_only) + self.assertEqual(plan.skip, "") + + def test_the_x_template_omits_the_link(self) -> None: + self.assertEqual(prepare(item(), "x").text, "Hello world") + + def test_review_routes_always_draft(self) -> None: + self.assertTrue(prepare(item(), "linkedin", mode="review").draft_only) + + def test_a_content_warning_forces_a_draft(self) -> None: + self.assertTrue(prepare(item(spoiler="politics"), "linkedin").draft_only) + + def test_unmappable_mentions_force_a_draft_on_commercial_targets(self) -> None: + mentioned = item(text="thanks @alice@social.example") + self.assertTrue(prepare(mentioned, "linkedin").draft_only) + self.assertFalse(prepare(mentioned, "mastodon").draft_only) + + def test_images_keep_their_alt_text(self) -> None: + plan = prepare(item(media=(PICTURE,)), "facebook") + self.assertEqual(plan.profile, "image_post") + self.assertEqual( + [(entry.media.url, entry.alt_text) for entry in plan.media], + [(PICTURE.url, "A red square")], + ) + self.assertFalse(plan.media[0].jpeg) + + def test_instagram_images_are_converted_to_jpeg(self) -> None: + self.assertTrue(prepare(item(media=(PICTURE,)), "instagram").media[0].jpeg) + + def test_pixelfed_skips_posts_without_media(self) -> None: + self.assertEqual( + prepare(item(), "pixelfed").skip, "pixelfed accepts only posts with media" + ) + self.assertEqual(prepare(item(media=(PICTURE,)), "pixelfed").skip, "") + + def test_a_large_video_reaches_mastodon_as_a_link(self) -> None: + video = item( + platform="peertube", + media=(LARGE_VIDEO,), + title="Talk", + text="About the talk", + url="https://video.example/w/abc", + ) + plan = prepare(video, "mastodon") + self.assertEqual(plan.media, ()) + self.assertEqual(plan.profile, "short_text") + self.assertIn("https://video.example/w/abc", plan.text) + + def test_a_small_video_travels_as_a_file(self) -> None: + video = item( + platform="peertube", + media=(SMALL_VIDEO,), + title="Talk", + text="About the talk", + url="https://video.example/w/abc", + ) + plan = prepare(video, "youtube") + self.assertEqual(plan.profile, "video") + self.assertEqual([entry.media for entry in plan.media], [SMALL_VIDEO]) + self.assertEqual(plan.title, "Talk") + self.assertTrue(plan.text.startswith("Talk\n\nAbout the talk")) From b7b4a3e88000b51fa1dc6587ad0959a64f17b736 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:50 +0200 Subject: [PATCH 124/554] test(web-app-openpost): cover crossposter notifications --- .../crossposter/crossposter/test_notify.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_notify.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_notify.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_notify.py new file mode 100644 index 0000000000..2cbc1c6705 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_notify.py @@ -0,0 +1,38 @@ +from __future__ import annotations + +import unittest +from email.message import EmailMessage + +from crossposter import notify + +ROW = { + "route": "press-mastodon", + "source_url": "https://microblog.example/@press/1", + "network": "x", + "target": "x-press", + "state": "dead_lettered", + "attempts": 8, + "last_error": "https://api.twitter.com/2/tweets: HTTP 503 unavailable", +} + + +class TestReport(unittest.TestCase): + def test_the_report_names_source_target_and_error(self) -> None: + report = notify.report([ROW]) + for expected in ( + "https://microblog.example/@press/1", + "x-press", + "HTTP 503 unavailable", + "dead_lettered", + "press-mastodon", + ): + self.assertIn(expected, report) + + def test_the_message_carries_subject_and_recipients(self) -> None: + message = notify.message( + "crossposter@example.org", ("press@example.org", "pr@example.org"), [ROW] + ) + self.assertIsInstance(message, EmailMessage) + self.assertEqual(message["To"], "press@example.org, pr@example.org") + self.assertIn("1", message["Subject"]) + self.assertIn("x-press", message.get_content()) From d13f6369936b2279f9a4aafda57a7923c2b9d491 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:50 +0200 Subject: [PATCH 125/554] test(web-app-openpost): cover the crossposter openpost client --- .../crossposter/crossposter/test_openpost.py | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py new file mode 100644 index 0000000000..87e07dab9e --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py @@ -0,0 +1,162 @@ +from __future__ import annotations + +import json +import tempfile +import unittest +from pathlib import Path +from unittest.mock import patch + +from crossposter import openpost, web +from crossposter.config import Targets + +ACCOUNTS = [ + {"id": "acc-x", "slug": "x-press", "platform": "x"}, + {"id": "acc-li", "slug": "linkedin-press", "platform": "linkedin"}, +] +SOCIAL_SETS = [ + { + "name": "Commercial", + "accounts": [ + {"social_account_id": "acc-x", "platform": "x", "default_settings": {}}, + { + "social_account_id": "acc-li", + "platform": "linkedin", + "default_settings": {"visibility": "PUBLIC"}, + }, + ], + } +] + + +class FakeOpenPost: + def __init__(self) -> None: + self.calls: list[tuple[str, str, dict, bytes | None]] = [] + + def __call__( + self, + method: str, + url: str, + headers: dict, + body: bytes | None, + accepted: tuple[int, ...], + ) -> web.Response: + self.calls.append((method, url, headers, body)) + path = url.split("/api/v1", 1)[-1] + if path.startswith("/accounts"): + return web.Response(200, {}, json.dumps(ACCOUNTS).encode()) + if path.startswith("/social-sets"): + return web.Response(200, {}, json.dumps(SOCIAL_SETS).encode()) + if path == "/publications": + return web.Response( + 201, + {}, + json.dumps({"id": "pub-1", "revision": 1, "status": "draft"}).encode(), + ) + if path == "/media/upload-session": + session = { + "media_id": "media-1", + "complete_url": "/api/v1/media/upload-session/media-1/complete", + "upload": { + "url": "/media/upload/media-1", + "method": "PUT", + "headers": {}, + }, + } + return web.Response(200, {}, json.dumps(session).encode()) + return web.Response(200, {}, b"{}") + + +def client() -> openpost.OpenPost: + return openpost.OpenPost( + "http://openpost:8080", "publish.example", "op-token", "workspace-1" + ) + + +class TestDestinations(unittest.TestCase): + def test_accounts_resolve_by_slug(self) -> None: + with patch.object(openpost.web, "request", FakeOpenPost()): + found = client().destinations(Targets(("linkedin-press",), "")) + self.assertEqual( + [(item.account_id, item.platform) for item in found], + [("acc-li", "linkedin")], + ) + + def test_an_unknown_slug_is_refused(self) -> None: + with ( + patch.object(openpost.web, "request", FakeOpenPost()), + self.assertRaises(openpost.TargetError), + ): + client().destinations(Targets(("myspace-press",), "")) + + def test_a_social_set_expands_to_its_accounts_with_their_defaults(self) -> None: + with patch.object(openpost.web, "request", FakeOpenPost()): + found = client().destinations(Targets((), "Commercial")) + self.assertEqual([item.slug for item in found], ["x-press", "linkedin-press"]) + self.assertEqual(found[1].settings, {"visibility": "PUBLIC"}) + + def test_an_unknown_social_set_is_refused(self) -> None: + with ( + patch.object(openpost.web, "request", FakeOpenPost()), + self.assertRaises(openpost.TargetError), + ): + client().destinations(Targets((), "Nowhere")) + + +class TestRequests(unittest.TestCase): + def test_create_sends_the_idempotency_key_and_the_alt_text(self) -> None: + fake = FakeOpenPost() + destination = openpost.Destination("acc-x", "x-press", "x", {}) + with patch.object(openpost.web, "request", fake): + client().create( + destination, + "Title", + "Body", + "image_post", + [("media-1", "A red square")], + "crossposter-abc", + {"crossposter_source": "https://microblog.example/@press/1"}, + ) + method, url, headers, body = fake.calls[-1] + self.assertEqual( + (method, url), ("POST", "http://openpost:8080/api/v1/publications") + ) + self.assertEqual(headers["Idempotency-Key"], "crossposter-abc") + self.assertEqual(headers["Authorization"], "Bearer op-token") + payload = json.loads(body) + self.assertEqual( + payload["media"], [{"media_id": "media-1", "alt_text": "A red square"}] + ) + self.assertEqual(payload["social_account_ids"], ["acc-x"]) + self.assertEqual( + payload["metadata"], + {"crossposter_source": "https://microblog.example/@press/1"}, + ) + + def test_local_uploads_go_to_openpost_with_its_credentials(self) -> None: + fake = FakeOpenPost() + uploads: list[tuple[str, dict]] = [] + + def upload( + method: str, + url: str, + headers: dict, + source: Path, + accepted: tuple[int, ...], + ) -> web.Response: + uploads.append((url, headers)) + return web.Response(200, {}, b"") + + with tempfile.TemporaryDirectory() as folder: + image = Path(folder) / "a.jpg" + image.write_bytes(b"\xff\xd8 image") + with ( + patch.object(openpost.web, "request", fake), + patch.object(openpost.web, "upload", upload), + ): + media = client().upload(image, "a.jpg", "image/jpeg") + self.assertEqual(media, "media-1") + self.assertEqual(uploads[0][0], "http://openpost:8080/media/upload/media-1") + self.assertEqual(uploads[0][1]["Authorization"], "Bearer op-token") + self.assertTrue( + fake.calls[-1][1].endswith("/media/upload-session/media-1/complete") + ) From 3430455c695dfafd8cabea9d526da340a03b652b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:51 +0200 Subject: [PATCH 126/554] test(web-app-openpost): cover the crossposter service loop --- .../crossposter/crossposter/test_service.py | 395 ++++++++++++++++++ 1 file changed, 395 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py new file mode 100644 index 0000000000..d58a766cde --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py @@ -0,0 +1,395 @@ +from __future__ import annotations + +import json +import tempfile +import unittest +from pathlib import Path +from unittest.mock import patch + +from crossposter import service, store, web +from crossposter.config import ( + Config, + Filters, + OpenPostSettings, + Retry, + Route, + Source, + Targets, +) +from crossposter.notify import Mail +from crossposter.openpost import Destination +from crossposter.sources import SourceItem + +DESTINATIONS = [ + Destination("acc-x", "x-press", "x", {}), + Destination("acc-li", "linkedin-press", "linkedin", {}), +] + + +def post(number: int, tags: tuple[str, ...] = ()) -> SourceItem: + return SourceItem( + uri=f"https://microblog.example/users/press/statuses/{number}", + url=f"https://microblog.example/@press/{number}", + platform="mastodon", + text=f"Post {number}", + visibility="public", + tags=tags, + media=(), + in_reply_to="", + reblog=False, + spoiler="", + application="", + cursor=str(number), + ) + + +class FakeSource: + def __init__(self, items: list[SourceItem]) -> None: + self.items = items + self.headers: dict[str, str] = {} + + def newest_cursor(self) -> str: + return "100" + + def fetch(self, cursor: str) -> list[SourceItem]: + return [item for item in self.items if int(item.cursor) > int(cursor)] + + +class FakeStore: + def __init__(self) -> None: + self.cursors: dict[str, str] = {} + self.items: list[dict] = [] + self.notified: list[int] = [] + + def cursor(self, route: str) -> str | None: + return self.cursors.get(route) + + def advance( + self, route: str, cursor: str, enqueued: list[tuple[SourceItem, str, str]] + ) -> None: + for item, target, network in enqueued: + if any( + row["source_uri"] == item.uri and row["target"] == target + for row in self.items + ): + continue + self.items.append( + { + "id": len(self.items) + 1, + "route": route, + "source_uri": item.uri, + "source_url": item.url, + "target": target, + "network": network, + "state": "pending", + "payload": json.loads(store.item_to_json(item)), + "publication_id": "", + "attempts": 0, + "resends": 0, + "last_error": "", + "delay": 0.0, + "notified": False, + } + ) + self.cursors[route] = cursor + + def due(self) -> list[dict]: + return [dict(row) for row in self.items if row["state"] == "pending"] + + def open_publications(self) -> list[dict]: + return [ + dict(row) for row in self.items if row["state"] in ("drafted", "submitted") + ] + + def unnotified(self) -> list[dict]: + return [ + dict(row) + for row in self.items + if row["state"] in ("failed", "dead_lettered") and not row["notified"] + ] + + def update( + self, + row_id: int, + state: str, + publication_id: str, + attempts: int, + error: str, + delay_seconds: float, + ) -> None: + row = self.items[row_id - 1] + row.update( + state=state, + publication_id=publication_id, + attempts=attempts, + last_error=error, + delay=delay_seconds, + ) + + def resend( + self, row_id: int, attempts: int, error: str, delay_seconds: float + ) -> None: + row = self.items[row_id - 1] + row.update( + state="pending", + resends=row["resends"] + 1, + attempts=attempts, + last_error=error, + delay=delay_seconds, + ) + + def mark_notified(self, row_id: int) -> None: + self.items[row_id - 1]["notified"] = True + + +REJECTED = { + "status": "failed", + "error_retryable": False, + "error_http_status": 400, + "delivery": {"terminal_reason": "provider_rejected"}, +} +UNAVAILABLE = { + "status": "failed", + "error_retryable": False, + "error_http_status": 503, + "delivery": {"recovery_action": "manual_resolution"}, +} + + +class FakeOpenPost: + def __init__(self) -> None: + self.created: list[tuple[str, str, str]] = [] + self.metadata: list[dict] = [] + self.published: list[str] = [] + self.failure: web.RequestError | None = None + self.outcome: list[dict] = [] + + def destinations(self, targets: Targets) -> list[Destination]: + return DESTINATIONS + + def create(self, destination, title, text, profile, media, key, metadata) -> dict: + if self.failure: + raise self.failure + self.created.append((destination.account_id, text, key)) + self.metadata.append(metadata) + return {"id": f"pub-{len(self.created)}", "revision": 1, "status": "draft"} + + def publish_now(self, publication: dict) -> None: + self.published.append(publication["id"]) + + def renditions(self, publication_id: str) -> list[dict]: + return self.outcome + + +def route(mode: str) -> Route: + return Route( + name="press", + source=Source("mastodon", "https://microblog.example", "press", "token"), + filters=Filters(frozenset({"public"}), True, True, frozenset(), "any"), + targets=Targets(("x-press", "linkedin-press"), ""), + mode=mode, + attribution={"default": "{text}\n\n{source_url}", "x": "{text}"}, + ) + + +class ServiceFixture: + def build( + self, mode: str, items: list[SourceItem], database: FakeStore | None = None + ) -> tuple[service.Service, FakeStore, FakeOpenPost]: + folder = tempfile.mkdtemp() + config = Config( + openpost=OpenPostSettings( + "http://openpost:8080", "publish.example", "op-token", "workspace-1" + ), + dsn="postgresql://unused", + mail=Mail( + "mail.example", 587, "starttls", "", "", "crossposter@example.org" + ), + heartbeat_file=str(Path(folder) / "heartbeat"), + poll_interval_seconds=60, + opt_out_tag="nocrosspost", + retry=Retry(3, 30, 3600), + recipients=("press@example.org",), + routes=(route(mode),), + ) + database = database or FakeStore() + client = FakeOpenPost() + runner = service.Service(config, database, client) + runner.sources["press"] = FakeSource(items) + return runner, database, client + + +class TestDetection(ServiceFixture, unittest.TestCase): + def test_activation_forwards_no_existing_post(self) -> None: + runner, database, _ = self.build("auto", [post(1), post(2)]) + runner.tick() + self.assertEqual(database.cursors["press"], "100") + self.assertEqual(database.items, []) + + def test_new_posts_are_queued_per_target_and_the_opt_out_is_skipped(self) -> None: + runner, database, _ = self.build( + "review", [post(101), post(102, ("nocrosspost",))] + ) + database.cursors["press"] = "100" + runner.detect(runner.routes["press"]) + self.assertEqual( + [(row["source_uri"][-3:], row["target"]) for row in database.items], + [("101", "acc-x"), ("101", "acc-li")], + ) + self.assertEqual(database.cursors["press"], "102") + + def test_a_restart_queues_nothing_twice(self) -> None: + runner, database, _ = self.build("review", [post(101)]) + database.cursors["press"] = "100" + runner.detect(runner.routes["press"]) + database.cursors["press"] = "100" + again, _, _ = self.build("review", [post(101)], database) + again.detect(again.routes["press"]) + self.assertEqual(len(database.items), 2) + + +class TestDelivery(ServiceFixture, unittest.TestCase): + def queued(self, mode: str) -> tuple[service.Service, FakeStore, FakeOpenPost]: + runner, database, client = self.build(mode, [post(101)]) + database.cursors["press"] = "100" + runner.detect(runner.routes["press"]) + return runner, database, client + + def test_review_mode_creates_drafts_without_publishing(self) -> None: + runner, database, client = self.queued("review") + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"drafted"}) + self.assertEqual(client.published, []) + self.assertEqual( + client.created[0][2], store.idempotency_key(post(101).uri, "acc-x", 0) + ) + self.assertEqual( + client.metadata[0], + {"crossposter_route": "press", "crossposter_source": post(101).url}, + ) + + def test_auto_mode_publishes_and_the_x_text_carries_no_link(self) -> None: + runner, database, client = self.queued("auto") + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"submitted"}) + self.assertEqual(client.published, ["pub-1", "pub-2"]) + self.assertEqual(client.created[0][1], "Post 101") + self.assertEqual( + client.created[1][1], "Post 101\n\nhttps://microblog.example/@press/101" + ) + + def test_transient_errors_back_off_until_the_budget_is_spent(self) -> None: + runner, database, client = self.queued("auto") + client.failure = web.RequestError( + "https://openpost/api/v1/publications", 503, {"Retry-After": "120"}, "busy" + ) + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"pending"}) + self.assertGreaterEqual(database.items[0]["delay"], 120) + runner.deliver_due() + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"dead_lettered"}) + self.assertIn("HTTP 503", database.items[0]["last_error"]) + + def test_permanent_errors_dead_letter_at_once(self) -> None: + runner, database, client = self.queued("auto") + client.failure = web.RequestError( + "https://openpost/api/v1/publications", 422, {}, "invalid" + ) + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"dead_lettered"}) + + +class TestFollowUp(ServiceFixture, unittest.TestCase): + def submitted(self) -> tuple[service.Service, FakeStore, FakeOpenPost]: + runner, database, client = self.build("auto", [post(101)]) + database.cursors["press"] = "100" + runner.detect(runner.routes["press"]) + runner.deliver_due() + return runner, database, client + + def test_published_destinations_close_the_item(self) -> None: + runner, database, client = self.submitted() + client.outcome = [{"status": "published"}] + runner.follow() + self.assertEqual({row["state"] for row in database.items}, {"published"}) + + def test_failed_destinations_keep_the_provider_error(self) -> None: + runner, database, client = self.submitted() + client.outcome = [ + { + "status": "failed", + "error_retryable": False, + "error_message": "rejected by X", + } + ] + runner.follow() + self.assertEqual({row["state"] for row in database.items}, {"failed"}) + self.assertEqual(database.items[0]["last_error"], "rejected by X") + + def test_a_provider_rejection_fails_without_a_resend(self) -> None: + runner, database, client = self.submitted() + client.outcome = [REJECTED] + runner.follow() + self.assertEqual({row["state"] for row in database.items}, {"failed"}) + self.assertEqual( + database.items[0]["last_error"], "provider_rejected (HTTP 400)" + ) + self.assertEqual(len(client.created), 2) + + def test_an_unavailable_provider_is_resent_under_a_new_key(self) -> None: + runner, database, client = self.submitted() + client.outcome = [UNAVAILABLE] + runner.follow() + self.assertEqual({row["state"] for row in database.items}, {"pending"}) + self.assertEqual(database.items[0]["resends"], 1) + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"submitted"}) + self.assertEqual( + client.created[2][2], + store.idempotency_key(post(101).uri, "acc-x", 1), + ) + self.assertEqual(client.published, ["pub-1", "pub-2", "pub-3", "pub-4"]) + client.outcome = [{"status": "published"}] + runner.follow() + self.assertEqual({row["state"] for row in database.items}, {"published"}) + + def test_resends_dead_letter_once_the_attempts_are_spent(self) -> None: + runner, database, client = self.submitted() + client.outcome = [UNAVAILABLE] + runner.follow() + runner.deliver_due() + runner.follow() + self.assertEqual({row["state"] for row in database.items}, {"dead_lettered"}) + self.assertEqual( + database.items[0]["last_error"], "manual_resolution (HTTP 503)" + ) + + def test_a_reviewed_draft_is_never_resent(self) -> None: + runner, database, client = self.build("review", [post(101)]) + database.cursors["press"] = "100" + runner.detect(runner.routes["press"]) + runner.deliver_due() + client.outcome = [UNAVAILABLE] + runner.follow() + self.assertEqual({row["state"] for row in database.items}, {"failed"}) + self.assertEqual(len(client.created), 2) + + def test_failures_are_reported_once(self) -> None: + runner, _, client = self.submitted() + client.outcome = [ + { + "status": "failed", + "error_retryable": False, + "error_message": "rejected by X", + } + ] + runner.follow() + sent: list[list[dict]] = [] + with patch.object( + service.notify, "send", lambda mail, recipients, rows: sent.append(rows) + ): + runner.report() + runner.report() + self.assertEqual(len(sent), 1) + self.assertEqual(len(sent[0]), 2) From c745d70f76aa6932ff39e42c6f6801cd1d04b9c0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 11:10:51 +0200 Subject: [PATCH 127/554] test(web-app-openpost): cover the crossposter command line --- .../crossposter/crossposter/test___main__.py | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py new file mode 100644 index 0000000000..6dadda2123 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py @@ -0,0 +1,99 @@ +from __future__ import annotations + +import contextlib +import io +import json +import tempfile +import time +import unittest +from pathlib import Path + +from crossposter import __main__ as cli + + +class CliFixture: + def setUp(self) -> None: + self.directory = tempfile.TemporaryDirectory() + folder = Path(self.directory.name) + secrets = { + "openpost_token": "op-token", + "database_dsn": "postgresql://crossposter@db/openpost", + "routes": {"press": "source-token"}, + } + (folder / "crossposter-secrets.json").write_text(json.dumps(secrets)) + self.heartbeat = folder / "heartbeat" + self.raw = { + "openpost": { + "base_url": "http://openpost:8080", + "host": "publish.example", + "workspace": "workspace-1", + }, + "secrets_file": str(folder / "crossposter-secrets.json"), + "mail": None, + "heartbeat_file": str(self.heartbeat), + "poll_interval_seconds": 60, + "opt_out_tag": "nocrosspost", + "retry": {"max_attempts": 8, "base_seconds": 30, "cap_seconds": 3600}, + "notify": {"recipients": []}, + "routes": [], + } + self.config = folder / "crossposter.json" + self.write() + + def tearDown(self) -> None: + self.directory.cleanup() + + def write(self) -> None: + self.config.write_text(json.dumps(self.raw)) + + +class TestHealth(CliFixture, unittest.TestCase): + def test_a_fresh_active_heartbeat_is_healthy(self) -> None: + self.heartbeat.write_text(f"{time.time():.0f} active\n") + self.assertEqual(cli.command_health(str(self.config)), 0) + + def test_a_standby_instance_is_healthy(self) -> None: + self.heartbeat.write_text(f"{time.time():.0f} standby\n") + self.assertEqual(cli.command_health(str(self.config)), 0) + + def test_a_stale_heartbeat_is_unhealthy(self) -> None: + self.heartbeat.write_text(f"{time.time() - 600:.0f} active\n") + self.assertEqual(cli.command_health(str(self.config)), 1) + + def test_a_missing_heartbeat_is_unhealthy(self) -> None: + self.assertEqual(cli.command_health(str(self.config)), 1) + + def test_waiting_for_provisioning_stays_healthy(self) -> None: + pause = cli.wait_for_configuration(str(self.config), ValueError("no token yet")) + self.assertEqual(pause, 60) + self.assertTrue(self.heartbeat.read_text().strip().endswith("waiting")) + self.assertEqual(cli.command_health(str(self.config)), 0) + + +class TestValidate(CliFixture, unittest.TestCase): + def test_an_invalid_route_names_route_and_field(self) -> None: + self.raw["routes"] = [ + { + "name": "press", + "source": { + "platform": "myspace", + "base_url": "https://microblog.example", + "account": "press", + }, + "filters": {"visibility": ["public"], "media": "any"}, + "targets": {"accounts": ["x-press"]}, + "mode": "review", + "attribution": {"default": "{text}"}, + } + ] + self.write() + errors = io.StringIO() + with contextlib.redirect_stderr(errors): + self.assertEqual(cli.command_validate(str(self.config)), 2) + self.assertIn("route 'press': source.platform", errors.getvalue()) + + def test_no_routes_validate_without_asking_openpost(self) -> None: + output = io.StringIO() + with contextlib.redirect_stdout(output): + self.assertEqual(cli.command_validate(str(self.config)), 0) + self.assertIn("0 route(s) valid", output.getvalue()) From fe5981780f9ada789e1f8564acee836b40a2c109 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:40 +0200 Subject: [PATCH 128/554] fix(web-app-openpost): align the crossposter healthcheck with the platform timings --- roles/web-app-openpost/files/crossposter/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/crossposter/Dockerfile b/roles/web-app-openpost/files/crossposter/Dockerfile index d2cc6a1db6..61b7f215c6 100644 --- a/roles/web-app-openpost/files/crossposter/Dockerfile +++ b/roles/web-app-openpost/files/crossposter/Dockerfile @@ -17,7 +17,7 @@ COPY crossposter ./crossposter USER crossposter -HEALTHCHECK --interval=1m --timeout=10s --retries=3 --start-period=2m \ +HEALTHCHECK --interval=2m --timeout=5s --retries=3 --start-period=10m --start-interval=5s \ CMD ["python", "-m", "crossposter", "health", "--config", "/config/crossposter.json"] CMD ["python", "-m", "crossposter", "run", "--config", "/config/crossposter.json"] From 0878d61ea7f2f48354935f5844a8bc10f51c297a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:40 +0200 Subject: [PATCH 129/554] feat(web-app-openpost): declare the crossposter service --- roles/web-app-openpost/meta/services.yml | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index 936529aff7..2f81457380 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -152,6 +152,33 @@ simulator: - tiktok - linkedin +# nocheck: dynamic-flag a sidecar of this role switched on per inventory with its routes; no other role's presence decides it +crossposter: + enabled: false + shared: false + custom: true + modes: + compose: + enabled: true + swarm: + enabled: true + image: python + version: 3.13.7-slim + name: openpost-crossposter + cpus: "0.25" + mem_reservation: 64m + mem_limit: 256m + pids_limit: 64 + poll_interval_seconds: 60 + opt_out_tag: nocrosspost + retry: + max_attempts: 8 + base_seconds: 30 + cap_seconds: 3600 + notify: + recipients: [] + routes: [] + # nocheck: playwright-service-flag # nocheck: variants-coverage — sso-variant-tor requires the onion on in every variant, so the false polarity has no variant left to live in tor: From 0aa87f0c8acbd637670568b595d1beca664548df Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:40 +0200 Subject: [PATCH 130/554] feat(web-app-openpost): add crossposter variables --- roles/web-app-openpost/vars/main.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 72b9ba9d04..3ae34b3201 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -90,3 +90,27 @@ OPENPOST_PROVIDER_APPS: >- {%- endfor -%} {%- endfor -%} {{ _apps }} + +OPENPOST_CROSSPOSTER: "{{ lookup('config', application_id, 'services.crossposter') }}" +OPENPOST_CROSSPOSTER_ROUTES: "{{ OPENPOST_CROSSPOSTER.routes }}" +OPENPOST_CROSSPOSTER_ENABLED: "{{ (lookup('config', application_id, 'services.crossposter.enabled') | bool) and (OPENPOST_CROSSPOSTER_ROUTES | length > 0) }}" +OPENPOST_CROSSPOSTER_NAME: "{{ OPENPOST_CROSSPOSTER.name }}" +OPENPOST_CROSSPOSTER_UID: 10001 +OPENPOST_CROSSPOSTER_TOKEN_NAME: "crossposter" +OPENPOST_CROSSPOSTER_DIR: "{{ [lookup('container', application_id, 'directories.config'), 'crossposter'] | path_join }}" +OPENPOST_CROSSPOSTER_STATE_FILE: "{{ [OPENPOST_CROSSPOSTER_DIR, 'state.json'] | path_join }}" +OPENPOST_CROSSPOSTER_CONFIG_HOST: "{{ [OPENPOST_CROSSPOSTER_DIR, 'crossposter.json'] | path_join }}" +OPENPOST_CROSSPOSTER_SECRETS_HOST: "{{ [OPENPOST_CROSSPOSTER_DIR, 'crossposter-secrets.json'] | path_join }}" +OPENPOST_CROSSPOSTER_CONFIG_TARGET: "{{ lookup('volume', application_id, 'crossposter_config').target }}" +OPENPOST_CROSSPOSTER_SECRETS_TARGET: "{{ lookup('volume', application_id, 'crossposter_secrets').target }}" +OPENPOST_CROSSPOSTER_BUILD_CONTEXT: "{{ [lookup('container', application_id, 'directories.services'), 'crossposter'] | path_join }}" +OPENPOST_CROSSPOSTER_IMAGE: "openpost_crossposter_custom" +OPENPOST_CROSSPOSTER_BASE_IMAGE: "{{ OPENPOST_CROSSPOSTER.image }}" +OPENPOST_CROSSPOSTER_BASE_VERSION: "{{ OPENPOST_CROSSPOSTER.version }}" +OPENPOST_CROSSPOSTER_ADDRESS: "{{ lookup('container_address', application_id, 'crossposter') }}" +OPENPOST_CROSSPOSTER_SEED_PROBES: + mastodon: /api/v1/accounts/verify_credentials + pixelfed: /api/v1/accounts/verify_credentials + peertube: /api/v1/users/me +OPENPOST_SEED_PIXELFED_USER: "33" +OPENPOST_SEED_PEERTUBE_USERNAME: "root" From c563784ca95ba2c94731730e7bafc8acbbfefbe5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:40 +0200 Subject: [PATCH 131/554] feat(web-app-openpost): mount the crossposter configuration and secrets --- roles/web-app-openpost/meta/volumes.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/roles/web-app-openpost/meta/volumes.yml b/roles/web-app-openpost/meta/volumes.yml index 1cc4a84cf9..28954a2c32 100644 --- a/roles/web-app-openpost/meta/volumes.yml +++ b/roles/web-app-openpost/meta/volumes.yml @@ -33,6 +33,24 @@ simulator_ca: target: /etc/ssl/openpost-simulator/ca.crt when: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" +crossposter_config: + type: config + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'crossposter', 'crossposter.json'] | path_join }}" + mode: "0444" + mounts: + - service: crossposter + target: /config/crossposter.json + when: "{{ (lookup('config', 'web-app-openpost', 'services.crossposter.enabled') | bool) and (lookup('config', 'web-app-openpost', 'services.crossposter.routes') | length) > 0 }}" + +crossposter_secrets: + type: secret + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'crossposter', 'crossposter-secrets.json'] | path_join }}" + mode: "0400" + mounts: + - service: crossposter + target: /run/secrets/crossposter.json + when: "{{ (lookup('config', 'web-app-openpost', 'services.crossposter.enabled') | bool) and (lookup('config', 'web-app-openpost', 'services.crossposter.routes') | length) > 0 }}" + relay_conf: type: config source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'relay.conf'] | path_join }}" From 9a4fcbaf8e1dfd3b7a1263e29d9b58b663cf187c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 132/554] feat(web-app-openpost): run the crossposter sidecar --- .../web-app-openpost/templates/compose.yml.j2 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/roles/web-app-openpost/templates/compose.yml.j2 b/roles/web-app-openpost/templates/compose.yml.j2 index 7a9e93e7c7..0a1137211e 100644 --- a/roles/web-app-openpost/templates/compose.yml.j2 +++ b/roles/web-app-openpost/templates/compose.yml.j2 @@ -21,6 +21,26 @@ {{ lookup('container_extra_hosts', host_alias=True) | indent(4) }} {{ lookup('container_networks', aliases=OPENPOST_RELAY_DOMAINS) | indent(4) }} + {% if OPENPOST_CROSSPOSTER_ENABLED | bool %} + {% set service_name = 'crossposter' %} + {{ service_name }}: + {% include 'roles/sys-svc-container/templates/deploy.yml.j2' %} + build: + context: "{{ OPENPOST_CROSSPOSTER_BUILD_CONTEXT }}" + dockerfile: Dockerfile + args: + CROSSPOSTER_BASE_IMAGE: "{{ OPENPOST_CROSSPOSTER_BASE_IMAGE }}" + CROSSPOSTER_BASE_VERSION: "{{ OPENPOST_CROSSPOSTER_BASE_VERSION }}" + CROSSPOSTER_UID: "{{ OPENPOST_CROSSPOSTER_UID }}" + {{ lookup('container_image', application_id, service_name, image=OPENPOST_CROSSPOSTER_IMAGE) }} + {{ lookup('compose_only', 'container_name', OPENPOST_CROSSPOSTER_NAME) }} + {{ lookup('compose_only', 'pull_policy', 'never') }} + {{ lookup('compose_restart') }} + {{ lookup('container_volumes', service_name) | indent(4) }} + {{ lookup('container_extra_hosts') | indent(4) }} + {{ lookup('container_networks') | indent(4) }} + {% endif %} + {% if OPENPOST_SIMULATOR_ENABLED | bool %} {% set service_name = 'simulator' %} {{ service_name }}: From 3b8dfcc86238253e59838fd2ed8ae878648bf2e1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 133/554] refactor(web-app-openpost): move crossposter rendering into tasks/crossposter --- .../tasks/{04_crossposter.yml => crossposter/render.yml} | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename roles/web-app-openpost/tasks/{04_crossposter.yml => crossposter/render.yml} (97%) diff --git a/roles/web-app-openpost/tasks/04_crossposter.yml b/roles/web-app-openpost/tasks/crossposter/render.yml similarity index 97% rename from roles/web-app-openpost/tasks/04_crossposter.yml rename to roles/web-app-openpost/tasks/crossposter/render.yml index cf71fb4e2c..6af09df02b 100644 --- a/roles/web-app-openpost/tasks/04_crossposter.yml +++ b/roles/web-app-openpost/tasks/crossposter/render.yml @@ -29,7 +29,9 @@ src: "{{ role_path }}/files/crossposter/" dest: "{{ OPENPOST_CROSSPOSTER_BUILD_CONTEXT }}/" mode: preserve - register: openpost_crossposter_context + notify: + - compose-build + - compose-up - name: "📄 Render the crossposter configuration and secrets" ansible.builtin.include_tasks: From f24df5ec6ccaca04cb54f40edabc2fefeeb8825f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 134/554] refactor(web-app-openpost): move crossposter provisioning into tasks/crossposter --- .../{05_crossposter_provision.yml => crossposter/provision.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename roles/web-app-openpost/tasks/{05_crossposter_provision.yml => crossposter/provision.yml} (97%) diff --git a/roles/web-app-openpost/tasks/05_crossposter_provision.yml b/roles/web-app-openpost/tasks/crossposter/provision.yml similarity index 97% rename from roles/web-app-openpost/tasks/05_crossposter_provision.yml rename to roles/web-app-openpost/tasks/crossposter/provision.yml index ac98a1a750..1bea7d9f18 100644 --- a/roles/web-app-openpost/tasks/05_crossposter_provision.yml +++ b/roles/web-app-openpost/tasks/crossposter/provision.yml @@ -51,7 +51,7 @@ no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "🌱 Seed the CI source tokens and social sets" - ansible.builtin.include_tasks: 06_crossposter_seed.yml + ansible.builtin.include_tasks: crossposter/seed.yml when: OPENPOST_SIMULATOR_ENABLED | bool - name: "💾 Persist the crossposter workspace, API token and CI source tokens" From 9b23665ce6903bd03cb7b0d2470a081357a011b4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 135/554] refactor(web-app-openpost): move ci crossposter seeding into tasks/crossposter --- .../seed.yml} | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) rename roles/web-app-openpost/tasks/{06_crossposter_seed.yml => crossposter/seed.yml} (88%) diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed.yml b/roles/web-app-openpost/tasks/crossposter/seed.yml similarity index 88% rename from roles/web-app-openpost/tasks/06_crossposter_seed.yml rename to roles/web-app-openpost/tasks/crossposter/seed.yml index e22dd5408a..c6b75c2d12 100644 --- a/roles/web-app-openpost/tasks/06_crossposter_seed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed.yml @@ -2,7 +2,7 @@ - name: "🧾 Pick the CI routes whose source token the deploy has to mint" ansible.builtin.set_fact: openpost_crossposter_seed_routes: "{{ OPENPOST_CROSSPOSTER_ROUTES | rejectattr('source.token') | list }}" - openpost_crossposter_seed_platforms: "{{ OPENPOST_CROSSPOSTER_ROUTES | rejectattr('source.token') | map(attribute='source.platform') | unique | list }}" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "🔎 Check the source tokens minted by an earlier deploy" uri_retry: @@ -32,21 +32,25 @@ - name: "🧾 Pick the CI routes that still lack a working source token" ansible.builtin.set_fact: openpost_crossposter_seed_missing: "{{ openpost_crossposter_seed_routes | rejectattr('name', 'in', openpost_crossposter_sources.keys() | list) | list }}" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "🐘 Mint the Mastodon source tokens" - ansible.builtin.include_tasks: 06_crossposter_seed/mastodon.yml + ansible.builtin.include_tasks: crossposter/seed/mastodon.yml when: openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'mastodon') | list | length > 0 - name: "📷 Mint the Pixelfed source tokens" - ansible.builtin.include_tasks: 06_crossposter_seed/pixelfed.yml + ansible.builtin.include_tasks: crossposter/seed/pixelfed.yml when: openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list | length > 0 - name: "🎞️ Mint the PeerTube source tokens" - ansible.builtin.include_tasks: 06_crossposter_seed/peertube.yml + ansible.builtin.include_tasks: + file: crossposter/seed/peertube.yml + apply: + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" when: openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'peertube') | list | length > 0 - name: "🐘 Connect the CI Mastodon account as a target" - ansible.builtin.include_tasks: 06_crossposter_seed/mastodon_target.yml + ansible.builtin.include_tasks: crossposter/seed/target.yml when: OPENPOST_CROSSPOSTER_ROUTES | selectattr('source.platform', 'equalto', 'mastodon') | list | length > 0 - name: "📚 List the social sets of the organisation workspace" From cc901ac62491ec9f5048b24c729d31936cf7704d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 136/554] refactor(web-app-openpost): move mastodon token seeding --- .../tasks/{06_crossposter_seed => crossposter/seed}/mastodon.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/tasks/{06_crossposter_seed => crossposter/seed}/mastodon.yml (100%) diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon.yml b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml similarity index 100% rename from roles/web-app-openpost/tasks/06_crossposter_seed/mastodon.yml rename to roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml From ecb5bc76092cb3a532106613938fdf76ef097b7f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 137/554] refactor(web-app-openpost): move pixelfed token seeding --- .../tasks/{06_crossposter_seed => crossposter/seed}/pixelfed.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/tasks/{06_crossposter_seed => crossposter/seed}/pixelfed.yml (100%) diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml similarity index 100% rename from roles/web-app-openpost/tasks/06_crossposter_seed/pixelfed.yml rename to roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml From 4de5769e6e55b130a1b4b11d505c8d7a07d786e5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 138/554] refactor(web-app-openpost): move peertube token seeding --- .../{06_crossposter_seed => crossposter/seed}/peertube.yml | 3 --- 1 file changed, 3 deletions(-) rename roles/web-app-openpost/tasks/{06_crossposter_seed => crossposter/seed}/peertube.yml (90%) diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/peertube.yml b/roles/web-app-openpost/tasks/crossposter/seed/peertube.yml similarity index 90% rename from roles/web-app-openpost/tasks/06_crossposter_seed/peertube.yml rename to roles/web-app-openpost/tasks/crossposter/seed/peertube.yml index b2d4fa36b4..02945f7ff7 100644 --- a/roles/web-app-openpost/tasks/06_crossposter_seed/peertube.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/peertube.yml @@ -9,7 +9,6 @@ register: openpost_crossposter_peertube_clients delegate_to: "{{ STACK_HOST }}" run_once: true - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "🔑 Log the administrator into each PeerTube source" uri_retry: @@ -30,7 +29,6 @@ changed_when: true delegate_to: "{{ STACK_HOST }}" run_once: true - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "🧾 Keep the minted PeerTube tokens" ansible.builtin.set_fact: @@ -40,4 +38,3 @@ {%- set _ = _minted.update({_result.item.item.name: _result.json.access_token}) -%} {%- endfor -%} {{ _minted }} - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From 07c29d6e1bf34d416f1f85a014e957ebd8530281 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:41 +0200 Subject: [PATCH 139/554] refactor(web-app-openpost): move the ci mastodon target check --- .../06_crossposter_seed/mastodon_target.yml | 59 ------------------- .../tasks/crossposter/seed/target.yml | 15 +++++ 2 files changed, 15 insertions(+), 59 deletions(-) delete mode 100644 roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml create mode 100644 roles/web-app-openpost/tasks/crossposter/seed/target.yml diff --git a/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml b/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml deleted file mode 100644 index f2c87c5803..0000000000 --- a/roles/web-app-openpost/tasks/06_crossposter_seed/mastodon_target.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -- name: "🔎 List the accounts connected in the organisation workspace" - uri_retry: - url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts?workspace_id={{ openpost_crossposter_target_workspace }}" - headers: "{{ openpost_breakglass_headers }}" - status_code: 200 - register: openpost_crossposter_connected - changed_when: false - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - -- name: "🔗 Connect the CI Mastodon account as a crossposting target" - when: openpost_crossposter_connected.json | selectattr('platform', 'equalto', 'mastodon') | list | length == 0 - block: - - name: "🔍 Resolve the Mastodon container that grants the OpenPost app" - ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" - vars: - resolve_service_key: mastodon - resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if DEPLOYMENT_MODE == 'swarm' else '' }}" - resolve_output_prefix: OPENPOST_SEED_MASTODON - resolve_compose_cid: "{{ lookup('container_address', 'web-app-mastodon', 'mastodon') }}" - - - name: "🎫 Grant OpenPost's pinned app an authorization code for the CI account" - ansible.builtin.command: - argv: - - container - - exec - - -e - - "CROSSPOSTER_ACCOUNT={{ openpost_crossposter_mastodon_route.source.account }}" - - -e - - "CROSSPOSTER_CLIENT_ID={{ openpost_fediverse_apps[openpost_crossposter_mastodon_route.source.base_url].client_id }}" - - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_MASTODON_LOCAL_CID resolved at delegate_to runtime - - bin/rails - - runner - - | - account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) - application = Doorkeeper::Application.find_by!(uid: ENV.fetch("CROSSPOSTER_CLIENT_ID")) - grant = Doorkeeper::AccessGrant.create!(application: application, resource_owner_id: account.user.id, redirect_uri: "urn:ietf:wg:oauth:2.0:oob", scopes: application.scopes.to_s, expires_in: 600) - puts "CROSSPOSTER_GRANT=#{grant.plaintext_token}" - register: openpost_crossposter_mastodon_grant - changed_when: true - delegate_to: "{{ OPENPOST_SEED_MASTODON_HOST_NODE }}" - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - - - name: "🔁 Exchange the code through OpenPost" - uri_retry: - url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts/mastodon/exchange" - method: POST - headers: "{{ openpost_breakglass_headers }}" - body_format: json - body: - code: "{{ (openpost_crossposter_mastodon_grant.stdout_lines | select('match', 'CROSSPOSTER_GRANT=') | first) | replace('CROSSPOSTER_GRANT=', '') | trim }}" - instance_url: "{{ openpost_crossposter_mastodon_route.source.base_url }}" - server_name: "{{ openpost_crossposter_mastodon_route.source.base_url }}" - workspace_id: "{{ openpost_crossposter_target_workspace }}" - status_code: [200, 201] - changed_when: true - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - vars: - openpost_crossposter_mastodon_route: "{{ OPENPOST_CROSSPOSTER_ROUTES | selectattr('source.platform', 'equalto', 'mastodon') | first }}" diff --git a/roles/web-app-openpost/tasks/crossposter/seed/target.yml b/roles/web-app-openpost/tasks/crossposter/seed/target.yml new file mode 100644 index 0000000000..4c6b93ef07 --- /dev/null +++ b/roles/web-app-openpost/tasks/crossposter/seed/target.yml @@ -0,0 +1,15 @@ +--- +- name: "🔎 List the accounts connected in the organisation workspace" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts?workspace_id={{ openpost_crossposter_target_workspace }}" + headers: "{{ openpost_breakglass_headers }}" + status_code: 200 + register: openpost_crossposter_connected + changed_when: false + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🔗 Connect the CI Mastodon account as a crossposting target" + ansible.builtin.include_tasks: crossposter/seed/connect.yml + when: openpost_crossposter_connected.json | selectattr('platform', 'equalto', 'mastodon') | list | length == 0 + vars: + openpost_crossposter_mastodon_route: "{{ OPENPOST_CROSSPOSTER_ROUTES | selectattr('source.platform', 'equalto', 'mastodon') | first }}" From 20e9c46b4d7e10e9b3af1f1c68aa6f269200f294 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 140/554] fix(web-app-openpost): connect the ci mastodon target with openpost's own pkce challenge --- .../tasks/crossposter/seed/connect.yml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 roles/web-app-openpost/tasks/crossposter/seed/connect.yml diff --git a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml new file mode 100644 index 0000000000..e7380751e7 --- /dev/null +++ b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml @@ -0,0 +1,63 @@ +--- +- name: "🔍 Resolve the Mastodon container that grants the OpenPost app" + ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" + vars: + resolve_service_key: mastodon + resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_output_prefix: OPENPOST_SEED_MASTODON + resolve_compose_cid: "{{ lookup('container_address', 'web-app-mastodon', 'mastodon') }}" + +- name: "🧭 Ask OpenPost for the Mastodon authorization it would start" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts/mastodon/auth-url?workspace_id={{ openpost_crossposter_target_workspace }}&instance_url={{ openpost_crossposter_mastodon_route.source.base_url | urlencode }}" + headers: "{{ openpost_breakglass_headers }}" + status_code: 200 + register: openpost_crossposter_mastodon_authorize + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🎫 Grant OpenPost's pinned app the code that authorization asks for" + ansible.builtin.command: + argv: + - container + - exec + - -e + - "CROSSPOSTER_ACCOUNT={{ openpost_crossposter_mastodon_route.source.account }}" + - -e + - "CROSSPOSTER_AUTHORIZE={{ openpost_crossposter_mastodon_authorize.json.url }}" + - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_MASTODON_LOCAL_CID resolved at delegate_to runtime + - bin/rails + - runner + - | + query = Rack::Utils.parse_query(URI.parse(ENV.fetch("CROSSPOSTER_AUTHORIZE")).query) + account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) + application = Doorkeeper::Application.find_by!(uid: query.fetch("client_id")) + grant = Doorkeeper::AccessGrant.create!( + application: application, + resource_owner_id: account.user.id, + redirect_uri: query.fetch("redirect_uri"), + scopes: query.fetch("scope", application.scopes.to_s), + code_challenge: query["code_challenge"], + code_challenge_method: query["code_challenge_method"], + expires_in: 600 + ) + puts "CROSSPOSTER_GRANT=#{grant.plaintext_token}" + register: openpost_crossposter_mastodon_grant + changed_when: true + delegate_to: "{{ OPENPOST_SEED_MASTODON_HOST_NODE }}" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "🔁 Exchange the code through OpenPost" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts/mastodon/exchange" + method: POST + headers: "{{ openpost_breakglass_headers }}" + body_format: json + body: + code: "{{ (openpost_crossposter_mastodon_grant.stdout_lines | select('match', 'CROSSPOSTER_GRANT=') | first) | replace('CROSSPOSTER_GRANT=', '') | trim }}" + instance_url: "{{ openpost_crossposter_mastodon_route.source.base_url }}" + server_name: "{{ openpost_crossposter_mastodon_route.source.base_url }}" + workspace_id: "{{ openpost_crossposter_target_workspace }}" + status_code: [200, 201] + retries: 0 + changed_when: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From c71201c6aaa4d87a0849ae189180e37c50e19f05 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 141/554] refactor(web-app-openpost): move crossposter apply into tasks/crossposter --- .../tasks/{07_crossposter_apply.yml => crossposter/apply.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename roles/web-app-openpost/tasks/{07_crossposter_apply.yml => crossposter/apply.yml} (96%) diff --git a/roles/web-app-openpost/tasks/07_crossposter_apply.yml b/roles/web-app-openpost/tasks/crossposter/apply.yml similarity index 96% rename from roles/web-app-openpost/tasks/07_crossposter_apply.yml rename to roles/web-app-openpost/tasks/crossposter/apply.yml index bf6bf47f27..c36cf799ee 100644 --- a/roles/web-app-openpost/tasks/07_crossposter_apply.yml +++ b/roles/web-app-openpost/tasks/crossposter/apply.yml @@ -1,6 +1,6 @@ --- - name: "📄 Render the crossposter files from the current state" - ansible.builtin.include_tasks: 04_crossposter.yml + ansible.builtin.include_tasks: crossposter/render.yml - name: "📁 Re-render the compose file with the crossposter" stack_host_template: From 738f86122e4c07078f75b0d2d35ae7a415ed36a5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 142/554] feat(web-app-openpost): wire the crossposter into the deploy --- roles/web-app-openpost/tasks/00_core.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index 0451ed6b7c..6214adc09f 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -30,9 +30,23 @@ dest: "{{ OPENPOST_RELAY_CONF_HOST }}" mode: "0644" +- name: "📮 Stage and render the crossposter" + include_tasks: crossposter/render.yml + when: OPENPOST_CROSSPOSTER_ENABLED | bool + - name: "🚿 flush handlers for '{{ application_id }}'" meta: flush_handlers - name: "🔑 Bootstrap the break-glass instance admin" include_tasks: 03_breakglass.yml when: IS_STACK_HOST | bool + +- name: "🔑 Provision the crossposter API token" + include_tasks: crossposter/provision.yml + when: + - OPENPOST_CROSSPOSTER_ENABLED | bool + - IS_STACK_HOST | bool + +- name: "✅ Apply and validate the crossposter" + include_tasks: crossposter/apply.yml + when: OPENPOST_CROSSPOSTER_ENABLED | bool From 982095ca8054cb45b6e9854f3075241782e10e65 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 143/554] test(web-app-openpost): add ci crossposter routes --- roles/web-app-openpost/meta/variants.yml | 95 +++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/variants.yml b/roles/web-app-openpost/meta/variants.yml index 44fef0adba..adc07d87be 100644 --- a/roles/web-app-openpost/meta/variants.yml +++ b/roles/web-app-openpost/meta/variants.yml @@ -3,6 +3,53 @@ - services: container_backup: enabled: true + crossposter: + enabled: true # nocheck: variants-static-override CI crossposter routes the Mastodon round exercises + poll_interval_seconds: 15 + retry: + max_attempts: 3 + base_seconds: 5 + cap_seconds: 30 + notify: + recipients: + - "{{ lookup('users', 'administrator').email }}" + routes: + - name: ci-review + source: + platform: mastodon + base_url: "{{ lookup('tls', 'web-app-mastodon', 'url.base') | regex_replace('/+$', '') }}" + account: "{{ lookup('users', 'administrator').username }}" + token: "" + filters: + visibility: [public] + exclude_replies: true + exclude_reblogs: true + tags: [crossposterreview] + media: any + targets: + social_set: Crossposter review + mode: review + attribution: + default: "{text}\n\n{source_url}" + x: "{text}" + - name: ci-auto + source: + platform: mastodon + base_url: "{{ lookup('tls', 'web-app-mastodon', 'url.base') | regex_replace('/+$', '') }}" + account: "{{ lookup('users', 'administrator').username }}" + token: "" + filters: + visibility: [public] + exclude_replies: true + exclude_reblogs: true + tags: [crossposterauto] + media: any + targets: + social_set: Crossposter auto + mode: auto + attribution: + default: "{text}\n\n{source_url}" + x: "{text}" css: enabled: true shared: true @@ -36,7 +83,7 @@ enabled: true shared: true simulator: - enabled: true # nocheck: variants-static-override CI provider simulator that only this round switches on + enabled: true # nocheck: variants-static-override CI provider simulator the first two rounds switch on sso: enabled: true shared: true @@ -47,6 +94,50 @@ container_backup: enabled: false shared: false # nocheck: variants-static-override backup shared stays literally true + crossposter: + enabled: true # nocheck: variants-static-override CI crossposter routes the Pixelfed and PeerTube round exercises + poll_interval_seconds: 15 + retry: + max_attempts: 3 + base_seconds: 5 + cap_seconds: 30 + routes: + - name: ci-pixelfed + source: + platform: pixelfed + base_url: "{{ lookup('tls', 'web-app-pixelfed', 'url.base') | regex_replace('/+$', '') }}" + account: "{{ lookup('users', 'administrator').username }}" + token: "" + filters: + visibility: [public] + exclude_replies: true + exclude_reblogs: true + tags: [crossposterpixelfed] + media: required + targets: + social_set: Crossposter pixelfed + mode: auto + attribution: + default: "{text}\n\n{source_url}" + x: "{text}" + - name: ci-peertube + source: + platform: peertube + base_url: "{{ lookup('tls', 'web-app-peertube', 'url.base') | regex_replace('/+$', '') }}" + account: root_channel + token: "" + filters: + visibility: [public] + exclude_replies: true + exclude_reblogs: true + tags: [crossposterpeertube] + media: required + targets: + social_set: Crossposter peertube + mode: auto + attribution: + default: "{text}\n\n{source_url}" + x: "{text}" css: enabled: false shared: false @@ -79,6 +170,8 @@ seaweedfs: enabled: false shared: false + simulator: + enabled: true # nocheck: variants-static-override CI provider simulator the crossposter's Pixelfed and PeerTube routes deliver to sso: enabled: false shared: false From 59aeede60b07cbf62be48040ba1ad22f1be3c033 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 144/554] test(web-app-openpost): simulate a permanent x outage --- .../files/simulator/openpost.json | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/roles/web-app-openpost/files/simulator/openpost.json b/roles/web-app-openpost/files/simulator/openpost.json index 7b9ce02dbd..7eb49a3e38 100644 --- a/roles/web-app-openpost/files/simulator/openpost.json +++ b/roles/web-app-openpost/files/simulator/openpost.json @@ -104,6 +104,29 @@ ] } }, + { + "name": "x-tweet-unavailable-always", + "priority": 1, + "request": { + "method": "POST", + "urlPath": "/2/tweets", + "bodyPatterns": [ + { + "contains": "[simulate-503-always]" + } + ] + }, + "response": { + "status": 503, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "title": "Service Unavailable", + "status": 503 + } + } + }, { "name": "x-tweet-unavailable-once", "priority": 1, From 5f60cbb32f1009bdee00b2a05253ace6d3c26fb9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 145/554] test(web-app-openpost): add the probe package --- roles/web-app-openpost/files/test/openpost/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 roles/web-app-openpost/files/test/openpost/__init__.py diff --git a/roles/web-app-openpost/files/test/openpost/__init__.py b/roles/web-app-openpost/files/test/openpost/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 81e13a33f52306047d9742d55a2ab5525d094573 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 146/554] refactor(web-app-openpost): move the probe api helpers into the probe package --- .../files/test/{openpost_api.py => openpost/api.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/test/{openpost_api.py => openpost/api.py} (100%) diff --git a/roles/web-app-openpost/files/test/openpost_api.py b/roles/web-app-openpost/files/test/openpost/api.py similarity index 100% rename from roles/web-app-openpost/files/test/openpost_api.py rename to roles/web-app-openpost/files/test/openpost/api.py From b13975ba4e9a3e2965dbbd38f78cb7c964d4ea0c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:42 +0200 Subject: [PATCH 147/554] refactor(web-app-openpost): move the journal assertions into the probe package --- .../files/test/{openpost_journal.py => openpost/journal.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename roles/web-app-openpost/files/test/{openpost_journal.py => openpost/journal.py} (99%) diff --git a/roles/web-app-openpost/files/test/openpost_journal.py b/roles/web-app-openpost/files/test/openpost/journal.py similarity index 99% rename from roles/web-app-openpost/files/test/openpost_journal.py rename to roles/web-app-openpost/files/test/openpost/journal.py index b9d5e37f73..bec15d8d06 100644 --- a/roles/web-app-openpost/files/test/openpost_journal.py +++ b/roles/web-app-openpost/files/test/openpost/journal.py @@ -4,7 +4,7 @@ import json import re import urllib.parse -from openpost_api import anonymous_jpeg, check +from openpost.api import anonymous_jpeg, check X_LIMIT = 280 FACEBOOK_PAGES = ("424242", "525252") From 2931f556c2b898b9bed1ac1dbee480fe6316ea19 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 148/554] refactor(web-app-openpost): move the simulator checks into the probe package --- .../test/{openpost_simulator.py => openpost/simulator.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename roles/web-app-openpost/files/test/{openpost_simulator.py => openpost/simulator.py} (99%) diff --git a/roles/web-app-openpost/files/test/openpost_simulator.py b/roles/web-app-openpost/files/test/openpost/simulator.py similarity index 99% rename from roles/web-app-openpost/files/test/openpost_simulator.py rename to roles/web-app-openpost/files/test/openpost/simulator.py index 7829fc72cf..85d58d27f7 100644 --- a/roles/web-app-openpost/files/test/openpost_simulator.py +++ b/roles/web-app-openpost/files/test/openpost/simulator.py @@ -6,7 +6,7 @@ import sys import time import urllib.parse -from openpost_api import ( +from openpost.api import ( CONTAINER, DB_CONTAINER, DB_NAME, @@ -29,7 +29,7 @@ from openpost_api import ( settle, upload, ) -from openpost_journal import check_journal, hits +from openpost.journal import check_journal, hits SIMULATOR_TOKENS = ( "simulator-access-token", From c810f9e405e9e9c6fd05c6f4ebda41f6e03e6be0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 149/554] refactor(web-app-openpost): move the source helpers into the probe package --- .../files/test/{openpost_sources.py => openpost/sources.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/test/{openpost_sources.py => openpost/sources.py} (100%) diff --git a/roles/web-app-openpost/files/test/openpost_sources.py b/roles/web-app-openpost/files/test/openpost/sources.py similarity index 100% rename from roles/web-app-openpost/files/test/openpost_sources.py rename to roles/web-app-openpost/files/test/openpost/sources.py From 6491aef316881c9e040b8aa177fbeee41dbd6c38 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 150/554] refactor(web-app-openpost): move the mailbox search into the probe package --- .../files/test/{openpost_mailbox.py => openpost/mailbox.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename roles/web-app-openpost/files/test/{openpost_mailbox.py => openpost/mailbox.py} (96%) diff --git a/roles/web-app-openpost/files/test/openpost_mailbox.py b/roles/web-app-openpost/files/test/openpost/mailbox.py similarity index 96% rename from roles/web-app-openpost/files/test/openpost_mailbox.py rename to roles/web-app-openpost/files/test/openpost/mailbox.py index 7c8a50d24f..ab8514324a 100644 --- a/roles/web-app-openpost/files/test/openpost_mailbox.py +++ b/roles/web-app-openpost/files/test/openpost/mailbox.py @@ -10,7 +10,7 @@ import imaplib import os import ssl -from openpost_api import MAIL_RECIPIENT +from openpost.api import MAIL_RECIPIENT MAIL_HOST = os.environ["OPENPOST_MAIL_HOST"] MAIL_PASSWORD = base64.b64decode(os.environ["OPENPOST_MAIL_PASSWORD_B64"]).decode() From 1087de46e795fc0e5f9d6550c2713b5f939f56d8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 151/554] test(web-app-openpost): check failed and dead-lettered crossposts in the probe package --- .../crossposter.py} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename roles/web-app-openpost/files/test/{openpost_crossposter.py => openpost/crossposter.py} (98%) diff --git a/roles/web-app-openpost/files/test/openpost_crossposter.py b/roles/web-app-openpost/files/test/openpost/crossposter.py similarity index 98% rename from roles/web-app-openpost/files/test/openpost_crossposter.py rename to roles/web-app-openpost/files/test/openpost/crossposter.py index 162f6d4faa..838436f84e 100644 --- a/roles/web-app-openpost/files/test/openpost_crossposter.py +++ b/roles/web-app-openpost/files/test/openpost/crossposter.py @@ -18,11 +18,11 @@ import time import urllib.parse from pathlib import Path -from openpost_api import DEADLINE, accounts, call, check, render_media -from openpost_journal import hits, statuses -from openpost_mailbox import reports_naming -from openpost_simulator import SCENARIOS, simulator_admin -from openpost_sources import ( +from openpost.api import DEADLINE, accounts, call, check, render_media +from openpost.journal import hits, statuses +from openpost.mailbox import reports_naming +from openpost.simulator import SCENARIOS, simulator_admin +from openpost.sources import ( mastodon_post, mastodon_statuses, peertube_upload, From 4071702e99fdeff284a5deb781d841e03bd69e32 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 152/554] test(web-app-openpost): run the crossposter scenarios --- roles/web-app-openpost/files/test/probe.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py index 37d1a546eb..6a0e49714b 100644 --- a/roles/web-app-openpost/files/test/probe.py +++ b/roles/web-app-openpost/files/test/probe.py @@ -8,7 +8,7 @@ import urllib.error import urllib.parse import urllib.request -from openpost_api import ( +from openpost.api import ( ADMIN_EMAIL, ADMIN_PASSWORD, CONTAINER, @@ -37,7 +37,8 @@ from openpost_api import ( team, upload, ) -from openpost_simulator import check_simulator +from openpost.crossposter import ROUTES, check_crossposter +from openpost.simulator import check_simulator PRIVATE_TARGETS = ("https://postgres", "https://10.0.0.1") SQLITE_PATTERNS = ( @@ -389,6 +390,8 @@ def main() -> int: check_simulator(token, workspace) if "peertube" in RELAY_TARGETS: check_peertube(token, workspace) + if ROUTES: + check_crossposter(token, workspace) if failures: print(f"[FAIL] {len(failures)} check(s) failed: {', '.join(failures)}") return 1 From 3e92bb3cf41af5dea2d1a0cc8e0fb816b5dd5a84 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 153/554] docs(web-app-openpost): point the probe env note at the probe package --- roles/web-app-openpost/files/test/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/test/test.sh b/roles/web-app-openpost/files/test/test.sh index 24a9144bf7..adab16415f 100644 --- a/roles/web-app-openpost/files/test/test.sh +++ b/roles/web-app-openpost/files/test/test.sh @@ -3,7 +3,7 @@ # Env (rendered into test.env from templates/test.env.j2): # OPENPOST_CONTAINER resolved OpenPost container (CLI_LOCAL_CID) # OPENPOST_RELAY_PORT port the relay listens on inside the role network -# every OPENPOST_* variable openpost_api.py documents +# every OPENPOST_* variable the openpost/ probe modules document set -uo pipefail From 4e34239f042a9d729ebc42d3fa9ff9301f2d09b8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 154/554] test(web-app-openpost): render the crossposter probe environment --- roles/web-app-openpost/templates/test.env.j2 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index df80c5ae35..f7785055fd 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -34,3 +34,21 @@ OPENPOST_MEMBER_EMAIL={{ lookup('users', 'administrator').email | regex_replace( OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'administrator').password ~ ':' ~ application_id ~ ':cli-member') | hash('sha256') | b64encode }} OPENPOST_SSO_ADMIN_EMAIL={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_OIDC_ENABLED | bool else '' }} OPENPOST_MAIL_RECIPIENT={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_EMAIL_ENABLED | bool else '' }} +OPENPOST_MAIL_HOST={{ lookup('email', application_id).host if OPENPOST_EMAIL_ENABLED | bool else '' }} +OPENPOST_MAIL_PASSWORD_B64={{ lookup('users', 'administrator').password | b64encode }} +{% set _routes = [] %} +{% for _route in OPENPOST_CROSSPOSTER_ROUTES %} +{% set _ = _routes.append({'name': _route.name, 'platform': _route.source.platform, 'base_url': _route.source.base_url, 'account': _route.source.account, 'mode': _route.mode, 'tags': _route.filters.tags, 'social_set': _route.targets.social_set | default('', true)}) %} +{% endfor %} +OPENPOST_CROSSPOSTER_ROUTES_B64={{ _routes | to_json | b64encode }} +OPENPOST_CROSSPOSTER_POLL_SECONDS={{ OPENPOST_CROSSPOSTER.poll_interval_seconds }} +OPENPOST_CROSSPOSTER_RETRY_SECONDS={{ (OPENPOST_CROSSPOSTER.retry.max_attempts | int) * (OPENPOST_CROSSPOSTER.retry.cap_seconds | int) }} +{% if OPENPOST_CROSSPOSTER_ENABLED | bool %} +OPENPOST_CROSSPOSTER_SECRETS_FILE={{ OPENPOST_CROSSPOSTER_SECRETS_HOST }} +OPENPOST_CROSSPOSTER_CONTAINER={{ ('"$(' ~ BIN_RESOLVE_CONTAINER_ID ~ ' ' ~ (application_id | get_entity_name) ~ ' crossposter)"') if DEPLOYMENT_MODE == 'swarm' else OPENPOST_CROSSPOSTER_ADDRESS }} +OPENPOST_CROSSPOSTER_CONFIG={{ OPENPOST_CROSSPOSTER_CONFIG_TARGET }} +{% else %} +OPENPOST_CROSSPOSTER_SECRETS_FILE= +OPENPOST_CROSSPOSTER_CONTAINER= +OPENPOST_CROSSPOSTER_CONFIG= +{% endif %} From add94b5d4f3e6b2957a24014bd39f97167f56c00 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:43 +0200 Subject: [PATCH 155/554] test(web-app-openpost): expose the crossposter flag to playwright --- roles/web-app-openpost/templates/playwright.env.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/web-app-openpost/templates/playwright.env.j2 b/roles/web-app-openpost/templates/playwright.env.j2 index 304f9676f5..2c211a334c 100644 --- a/roles/web-app-openpost/templates/playwright.env.j2 +++ b/roles/web-app-openpost/templates/playwright.env.j2 @@ -16,6 +16,8 @@ BREAKGLASS_PASSWORD={{ OPENPOST_ADMIN_PASSWORD | dotenv_quote }} CANONICAL_DOMAIN={{ lookup('domain', application_id) | dotenv_quote }} +CROSSPOSTER_SERVICE_ENABLED={{ OPENPOST_CROSSPOSTER_ENABLED | string | lower }} + # nocheck: playwright-service-gate - CSS injection is asserted by the central CSP helper, not a per-persona surface CSS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.css.enabled') | string | lower }} From 1b421467a104cd81c019385e66bc2f68629ed928 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:44 +0200 Subject: [PATCH 156/554] test(web-app-openpost): export the playwright api helper --- roles/web-app-openpost/files/playwright/_shared.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index 289bbd6798..188a90522b 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -488,6 +488,7 @@ module.exports = { connectMastodonAccount, connectPixelfedAccount, apiSession, + apiRequest, apiAccount, apiPublishImage, disconnectAccount, From 856570a4ed02dca56130f227de9d06f169c8572f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:44 +0200 Subject: [PATCH 157/554] test(web-app-openpost): schedule a crossposted draft from the desk --- .../playwright/test-crossposter-draft.js | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-crossposter-draft.js diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js new file mode 100644 index 0000000000..3bb3e06811 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js @@ -0,0 +1,63 @@ +const { test, expect } = require("@playwright/test"); +const { gotoOnion } = require("./personas"); +const { resolveTimeout } = require("./timeouts"); + +async function crosspostedDraft(page, shared, headers) { + for (const workspace of await shared.apiRequest(page, headers, "GET", "/workspaces")) { + const drafts = await shared.apiRequest( + page, + headers, + "GET", + `/publications?workspace_id=${workspace.id}&status=draft&search=crossposterreview&limit=50`, + ); + const found = (drafts || []).find((item) => (item.metadata || {}).crossposter_route === "ci-review"); + if (found) { + return { workspace: workspace.id, publication: found }; + } + } + return null; +} + +exports.register = function (shared) { + test("administrator: finds a crossposted draft in the desk, edits it and schedules it", async ({ page }) => { + shared.skipUnlessServiceEnabled("crossposter"); + shared.skipUnlessServiceEnabled("mastodon"); + test.setTimeout(resolveTimeout(300_000)); // draft lookup, composer autosave and the scheduling round-trip + const label = "break-glass administrator"; + const edited = `Edited in the desk ${Date.now()}`; + + await shared.signInViaLocal(page, shared.env.breakglassEmail, shared.env.breakglassPassword, label); + const headers = shared.apiSession(); + const found = await crosspostedDraft(page, shared, headers); + expect(found, `${label}: the CLI run must leave a crossposted review draft`).toBeTruthy(); + const marker = String(found.publication.title || found.publication.source_text).split(" ")[1]; + + await gotoOnion(page, `${shared.env.appBaseUrl}/publications?tab=drafts`, { waitUntil: "domcontentloaded" }); + await page.getByRole("textbox", { name: /search posts/i }).fill(marker); + const listed = page.getByRole("link", { name: new RegExp(marker, "i") }).first(); + await expect(listed, `${label}: the crossposted draft must be listed among the drafts`).toBeVisible({ + timeout: resolveTimeout(60_000), + }); + await listed.click(); + + const text = page.getByRole("textbox", { name: /post text/i }).first(); + await expect(text, `${label}: the draft must open in the composer`).toBeVisible({ timeout: resolveTimeout(60_000) }); + await text.fill(edited); + await page.getByRole("main").getByRole("button", { name: /^more$/i }).click(); + await page.getByRole("menuitem", { name: /^schedule$/i }).click(); + const dialog = page.getByRole("dialog"); + await dialog.getByRole("button", { name: /^in 3 hours$/i }).click(); + await dialog.getByRole("button", { name: /^schedule$/i }).click(); + + await expect + .poll( + async () => { + const current = await shared.apiRequest(page, headers, "GET", `/publications/${found.publication.id}`); + return `${current.status}|${String(current.source_text).includes(edited)}`; + }, + { timeout: resolveTimeout(60_000), message: `${label}: the edited draft must end scheduled` }, + ) + .toBe("scheduled|true"); + await shared.logout(page, label); + }); +}; From 47533f8e02bba7099bcea90324a23fc4fc7650e3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:44 +0200 Subject: [PATCH 158/554] test(web-app-openpost): register the crossposter draft scenario --- roles/web-app-openpost/files/playwright/playwright.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/playwright.spec.js b/roles/web-app-openpost/files/playwright/playwright.spec.js index f6b26e7092..cd5da0a7cf 100644 --- a/roles/web-app-openpost/files/playwright/playwright.spec.js +++ b/roles/web-app-openpost/files/playwright/playwright.spec.js @@ -14,4 +14,5 @@ require("./test-login-oidc-administrator").register(shared); require("./test-login-oidc-biber").register(shared); require("./test-publish-mastodon").register(shared); require("./test-publish-pixelfed").register(shared); +require("./test-crossposter-draft").register(shared); require("./test-seaweedfs").register(shared); From 5a69a16033dbd4aefefcb76752311cc0449590b0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:44 +0200 Subject: [PATCH 159/554] test(web-app-openpost): add the mastodon fixture package --- .../crossposter/crossposter/sources/fixtures/mastodon/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 501b2f4643d945833bc0be6030a36a3bdf823272 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:44 +0200 Subject: [PATCH 160/554] refactor(web-app-openpost): group the mastodon account fixture --- .../fixtures/{mastodon_account.json => mastodon/account.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/{mastodon_account.json => mastodon/account.json} (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_account.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/account.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_account.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/account.json From 7b6bfae010128149bff61c50e4096d827a2de0ca Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:44 +0200 Subject: [PATCH 161/554] refactor(web-app-openpost): group the mastodon status fixtures --- .../fixtures/{mastodon_statuses.json => mastodon/statuses.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/{mastodon_statuses.json => mastodon/statuses.json} (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_statuses.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/statuses.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon_statuses.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/statuses.json From 73f4c70f3a5d2852adf776f7b607dc513a428c14 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:44 +0200 Subject: [PATCH 162/554] test(web-app-openpost): add the peertube fixture package --- .../crossposter/crossposter/sources/fixtures/peertube/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 7cf438282898a7ae59d55f0ae850400fb9e5b2aa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:45 +0200 Subject: [PATCH 163/554] refactor(web-app-openpost): group the peertube video fixtures --- .../fixtures/{peertube_videos.json => peertube/videos.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/{peertube_videos.json => peertube/videos.json} (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_videos.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/videos.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_videos.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/videos.json From 1965f10f0eb9d6dc2924d85ba0c9fb5ee58487a5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:45 +0200 Subject: [PATCH 164/554] refactor(web-app-openpost): group the peertube video detail fixture --- .../{peertube_video_detail.json => peertube/video_detail.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/{peertube_video_detail.json => peertube/video_detail.json} (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_video_detail.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/video_detail.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube_video_detail.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/video_detail.json From 8ab185fabb5d8bdaf9690c60dc3e4973959636d0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:45 +0200 Subject: [PATCH 165/554] test(web-app-openpost): read the grouped mastodon fixtures --- .../crossposter/crossposter/sources/test_mastodon.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py index c08f28f5f7..d52c5d715e 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py @@ -26,7 +26,7 @@ class FakeMastodon: parsed = urllib.parse.urlparse(url) query = dict(urllib.parse.parse_qsl(parsed.query)) if parsed.path == "/api/v1/accounts/lookup": - return fixture("mastodon_account.json") + return fixture("mastodon/account.json") self.queries.append(query) ordered = sorted(self.statuses, key=lambda status: int(status["id"])) limit = int(query["limit"]) @@ -40,7 +40,7 @@ class FakeMastodon: class TestParse(unittest.TestCase): def setUp(self) -> None: - self.statuses = fixture("mastodon_statuses.json") + self.statuses = fixture("mastodon/statuses.json") def test_a_status_becomes_a_source_item(self) -> None: item = mastodon.parse_status(self.statuses[0], "mastodon") @@ -68,7 +68,7 @@ class TestParse(unittest.TestCase): class TestPolling(unittest.TestCase): def test_the_newest_status_becomes_the_activation_cursor(self) -> None: - fake = FakeMastodon(fixture("mastodon_statuses.json")) + fake = FakeMastodon(fixture("mastodon/statuses.json")) with patch.object(mastodon.web, "get_json", fake): cursor = mastodon.MastodonSource( "https://microblog.example", "press", "token" @@ -80,7 +80,7 @@ class TestPolling(unittest.TestCase): def test_fetch_returns_newer_statuses_oldest_first_and_excludes_replies_and_boosts( self, ) -> None: - fake = FakeMastodon(fixture("mastodon_statuses.json")) + fake = FakeMastodon(fixture("mastodon/statuses.json")) with patch.object(mastodon.web, "get_json", fake): items = mastodon.MastodonSource( "https://microblog.example", "press", "token" @@ -93,7 +93,7 @@ class TestPolling(unittest.TestCase): def test_fetch_pages_with_the_min_id_cursor(self) -> None: many = [ dict( - fixture("mastodon_statuses.json")[0], + fixture("mastodon/statuses.json")[0], id=str(200 + index), uri=f"https://m/{index}", ) From 9dd0d9e9e8870a5a4e9d2e6f51924fd6c9420fe7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:45 +0200 Subject: [PATCH 166/554] test(web-app-openpost): read the grouped peertube fixtures --- .../crossposter/crossposter/sources/test_peertube.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py index 7dcfcb4408..beabfca299 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py @@ -20,10 +20,10 @@ def fixture(name: str) -> object: def fake_get_json(url: str, headers: dict[str, str]) -> object: parsed = urllib.parse.urlparse(url) if parsed.path.startswith("/api/v1/videos/"): - detail = fixture("peertube_video_detail.json") + detail = fixture("peertube/video_detail.json") return dict(detail, uuid=parsed.path.rsplit("/", 1)[-1]) start = int(dict(urllib.parse.parse_qsl(parsed.query))["start"]) - listing = fixture("peertube_videos.json") + listing = fixture("peertube/videos.json") return dict(listing, data=listing["data"][start:]) @@ -31,8 +31,8 @@ class TestParse(unittest.TestCase): def test_a_published_public_video_carries_title_description_tags_and_one_mp4( self, ) -> None: - video = fixture("peertube_videos.json")["data"][0] - item = peertube.parse_video(video, fixture("peertube_video_detail.json")) + video = fixture("peertube/videos.json")["data"][0] + item = peertube.parse_video(video, fixture("peertube/video_detail.json")) self.assertEqual(item.title, video["name"]) self.assertTrue(item.text.startswith("Full description")) self.assertEqual(item.tags, ("talk", "fediverse")) @@ -42,7 +42,7 @@ class TestParse(unittest.TestCase): self.assertEqual(item.cursor, video["publishedAt"]) def test_only_published_public_videos_pass(self) -> None: - videos = fixture("peertube_videos.json")["data"] + videos = fixture("peertube/videos.json")["data"] self.assertEqual( [peertube.published_public(video) for video in videos], [True, False, False] ) From 50f299e32017f3808ffc58dc1125f0b6094c071b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:45 +0200 Subject: [PATCH 167/554] test(web-app-openpost): mark the tempdir heartbeat read --- .../files/crossposter/crossposter/test___main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py index 6dadda2123..e4518cdd80 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py @@ -66,7 +66,8 @@ class TestHealth(CliFixture, unittest.TestCase): def test_waiting_for_provisioning_stays_healthy(self) -> None: pause = cli.wait_for_configuration(str(self.config), ValueError("no token yet")) self.assertEqual(pause, 60) - self.assertTrue(self.heartbeat.read_text().strip().endswith("waiting")) + written = self.heartbeat.read_text() # nocheck: cache-read tempdir file + self.assertTrue(written.strip().endswith("waiting")) self.assertEqual(cli.command_health(str(self.config)), 0) From f518c639e763c2b1bc965b7e13419aa7c77711b0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:45 +0200 Subject: [PATCH 168/554] docs(web-app-openpost): document the crossposter --- roles/web-app-openpost/Administration.md | 100 +++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index e891f75a51..06fd5a7477 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -104,6 +104,106 @@ The simulator never runs in production; leave the variant to CI and local tests. Sources: the [OpenPost provider reference](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/providers/index.md), its [environment variables](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/configuration/environment-variables.md) and the platform sources listed in the role's requirement. +## Crossposter + +The `crossposter` sidecar polls Mastodon, Pixelfed and PeerTube accounts and hands every new post to OpenPost through a workspace API token that the deploy issues for the organisation workspace. +It runs only while at least one route is configured, keeps its cursors and delivery records in the `crossposter` schema of the OpenPost database and lets exactly one instance work at a time through a Postgres advisory lock. + +### Routes + +Routes live under `services.crossposter.routes` of `web-app-openpost` in the inventory: + +```yaml +applications: + web-app-openpost: + services: + crossposter: + poll_interval_seconds: 60 + opt_out_tag: nocrosspost + retry: + max_attempts: 8 + base_seconds: 30 + cap_seconds: 3600 + notify: + recipients: + - press@example.org + routes: + - name: press-mastodon + source: + platform: mastodon + base_url: "https://microblog.example.org" + account: press + token: "{{ vault_crosspost_press_mastodon_token }}" + filters: + visibility: [public] + exclude_replies: true + exclude_reblogs: true + tags: [] + media: any + targets: + social_set: Commercial + mode: review + attribution: + default: "{text}\n\n{source_url}" + x: "{text}" +``` + +| Key | Meaning | +|---|---| +| `source.platform` | `mastodon`, `pixelfed` or `peertube`. | +| `source.account` | Mastodon or Pixelfed username, or PeerTube channel name. | +| `source.token` | Read token of the source account, vault-encrypted. It reaches the container as a secret file, never as an environment variable. | +| `filters.visibility` | Visibilities that are forwarded, usually `[public]`. | +| `filters.tags` | Forward only posts carrying one of these hashtags; empty forwards every post. | +| `filters.media` | `any`, `required` or `none`. | +| `targets` | Either `social_set` (name of an OpenPost Social Set) or `accounts` (list of account slugs). | +| `mode` | `review` creates an unscheduled draft; `auto` publishes immediately. New routes start in `review`. | +| `attribution` | Template per network with `{text}` and `{source_url}`; `default` covers networks without their own entry. | + +The deploy validates every route against OpenPost and fails with the route name and the field when a platform is unknown, a token is missing or a target is not connected. +Connect the target accounts and create the Social Set in OpenPost before adding the route. +On the CI rounds with the provider simulator the routes carry no token: the deploy mints read tokens on the local instances, connects the local Mastodon account and creates the empty Social Sets that the CLI probe fills. + +### Review and auto + +In `review` mode an editor finds the crossposted post among the drafts of the desk, adjusts it and schedules or publishes it. +In `auto` mode the crossposter publishes immediately. +A post with a content warning, or with mentions that a commercial network cannot resolve, always becomes a draft. + +Activating a route forwards none of the account's existing posts: its cursor starts at the newest post. +Each poll costs a route one request plus one per further page of new posts (at most five), and on PeerTube one more per new video, so the default 60-second interval stays far below Mastodon's and Pixelfed's 300 requests per five minutes and PeerTube's API limit. +An author keeps a single post local by adding the `#nocrosspost` hashtag. +Posts that OpenPost itself published to Mastodon are never forwarded again, so one account can be source and target. + +### Attribution and X cost + +Each network gets its own template. +The default X template omits the source link, because a post with a URL costs about 13 times more on the X API. +Text is shortened to each network's limit without breaking words, links or hashtags, and Fediverse mentions become plain names on X and profile links elsewhere. + +### Source tokens + +| Platform | How to create the read token | +|---|---| +| Mastodon | Preferences → Development → New application with the `read` scope, then copy the access token. | +| Pixelfed | Settings → Applications → Personal access tokens, create one with the `read` scope. | +| PeerTube | `POST /api/v1/users/token` with the local OAuth client and the account's password; PeerTube channel listings are public, the token only identifies the crossposter. | + +### Failed deliveries + +Transient errors (network errors, HTTP 429 and 5xx) are retried with capped exponential backoff and jitter that honours `Retry-After` and rate-limit reset headers. +When OpenPost reports a provider outage for an automatic publication, the crossposter publishes it again under a new idempotency key. +After `retry.max_attempts` the item is dead-lettered; a permanent rejection by the provider marks it failed. +Both reach `notify.recipients` in one mail per poll, with the source post, the target and the last error. + +List every crossposted item with its state: + +```bash +container exec python -m crossposter list --config /config/crossposter.json +``` + +A dead-lettered item stays in that state; publish the post again from the OpenPost desk when the cause is fixed. + ## Unsupported features and workarounds | Limitation | Workaround | From 19ead2aac99e93a3277b05dcf2cb0ae9900f5635 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:00:45 +0200 Subject: [PATCH 169/554] docs(web-app-openpost): show the crossposter in the cosmos diagram --- roles/web-app-openpost/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/README.md b/roles/web-app-openpost/README.md index ecaba2a262..9f5da690f0 100644 --- a/roles/web-app-openpost/README.md +++ b/roles/web-app-openpost/README.md @@ -50,6 +50,7 @@ flowchart LR svc_openpost["openpost"] svc_relay["relay"] svc_simulator["simulator ❌"] + svc_crossposter["crossposter"] svc_tor["tor"] svc_container_backup["container_backup"] end From 8b88e0a65482721cd0a1d0cf23b7bad35ad5baa8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:45:57 +0200 Subject: [PATCH 170/554] fix(web-app-openpost): drop the unused label of publishNow --- roles/web-app-openpost/files/playwright/_shared.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index 188a90522b..16478a7336 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -287,7 +287,7 @@ async function connectMastodonAccount(page, context, label) { return account; } -async function publishNow(page, account, text, label) { +async function publishNow(page, account, text) { await page.getByRole("link", { name: /^new post$/i }).click(); await page.getByRole("textbox", { name: /post text/i }).first().fill(text); await page.getByRole("main").getByRole("button", { name: /^more$/i }).click(); From c49dc95dbb0656be0f31d328c5e4c63a78afab9d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 15:45:59 +0200 Subject: [PATCH 171/554] test(web-app-openpost): call publishNow without a label --- .../web-app-openpost/files/playwright/test-publish-mastodon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-publish-mastodon.js b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js index 1dac4b5edb..978bbcf303 100644 --- a/roles/web-app-openpost/files/playwright/test-publish-mastodon.js +++ b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js @@ -11,7 +11,7 @@ exports.register = function (shared) { await shared.signInViaOidc(page, shared.env.adminUsername, shared.env.adminPassword, "administrator"); const account = await shared.connectMastodonAccount(page, context, "administrator"); try { - await shared.publishNow(page, account, marker, "administrator"); + await shared.publishNow(page, account, marker); await expect .poll(() => shared.mastodonStatusExists(page, account, marker), { timeout: resolveTimeout(180_000), From f26567171d47fe1efe01242c2f5e56af6116eb54 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:55 +0200 Subject: [PATCH 172/554] feat(container_volumes): hand config and secret mounts to a service user --- plugins/lookup/container_volumes.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/container_volumes.py b/plugins/lookup/container_volumes.py index 33628e9e6b..6e8c2ba282 100644 --- a/plugins/lookup/container_volumes.py +++ b/plugins/lookup/container_volumes.py @@ -82,6 +82,29 @@ def _short_form_volume(source_name: str, target: str, read_only: bool) -> str: return f"{source_name}:{target}{suffix}" +def _with_owner( + reference: dict[str, Any], mount: dict[str, Any], render_jinja: Any +) -> dict[str, Any]: + """Add the mount's ``uid``/``gid`` to a config or secret reference. + + Args: + reference: long-syntax ``configs:``/``secrets:`` entry of the service. + mount: the meta/volumes.yml mount that may name the owning user and group. + render_jinja: renderer for templated values, or ``None`` outside Ansible. + + Returns: + The reference with ``uid``/``gid`` as strings when the mount sets them. + """ + for key in ("uid", "gid"): + if mount.get(key) is None: + continue + text = str(mount[key]) + if render_jinja is not None and ("{{" in text or "{%" in text): + text = str(render_jinja(text)) + reference[key] = text + return reference + + def container_volumes( applications: dict[str, Any], application_id: str, @@ -183,14 +206,14 @@ def container_volumes( mode_value = entry.get("mode") if mode_value: cfg_ref["mode"] = _coerce_mode_int(mode_value) - configs_block.append(cfg_ref) + configs_block.append(_with_owner(cfg_ref, mount, render_jinja)) elif vtype == "secret": sec_ref: dict[str, Any] = {"source": semantic_name, "target": target} mode_value = entry.get("mode") if mode_value: sec_ref["mode"] = _coerce_mode_int(mode_value) - secrets_block.append(sec_ref) + secrets_block.append(_with_owner(sec_ref, mount, render_jinja)) if extra_volumes: volumes_block.extend(to_plain(extra_volumes)) From 3ef1c83c96825d1af23c5aeac96febf74052a5ae Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:55 +0200 Subject: [PATCH 173/554] test(container_volumes): cover mount owners for configs and secrets --- .../lookup/test_container_volumes_render.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/unit/python/plugins/lookup/test_container_volumes_render.py b/tests/unit/python/plugins/lookup/test_container_volumes_render.py index 906f9c84d2..922cec7a21 100644 --- a/tests/unit/python/plugins/lookup/test_container_volumes_render.py +++ b/tests/unit/python/plugins/lookup/test_container_volumes_render.py @@ -121,6 +121,52 @@ class TestContainerVolumesConfigSecret(unittest.TestCase): }, ) + def test_a_mount_hands_its_secret_to_the_service_user(self) -> None: + meta = { + "tlskey": { + "type": "secret", + "source": "/etc/ssl/key.pem", + "mode": "0400", + "mounts": [ + { + "service": "app", + "target": "/run/secrets/key", + "uid": "10001", + "gid": "10001", + } + ], + } + } + data = _parse(container_volumes(_apps(meta), "my-app", "app")) + self.assertEqual( + data["secrets"], + [ + { + "source": "tlskey", + "target": "/run/secrets/key", + "mode": 0o400, + "uid": "10001", + "gid": "10001", + } + ], + ) + + def test_a_mount_hands_its_config_to_the_service_user(self) -> None: + meta = { + "settings": { + "type": "config", + "source": "/etc/app.json", + "mounts": [ + {"service": "app", "target": "/config/app.json", "uid": "33"} + ], + } + } + data = _parse(container_volumes(_apps(meta), "my-app", "app")) + self.assertEqual( + data["configs"], + [{"source": "settings", "target": "/config/app.json", "uid": "33"}], + ) + class TestContainerVolumesTmpfs(unittest.TestCase): def test_tmpfs_size_renders_as_the_byte_count_the_long_form_takes(self) -> None: From c1f9eeb16df153a88f85feeff1d646ec69ad0aa5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:56 +0200 Subject: [PATCH 174/554] fix(web-app-openpost): run the crossposter exactly while routes exist --- roles/web-app-openpost/meta/services.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index 2f81457380..f079bcd900 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -152,10 +152,9 @@ simulator: - tiktok - linkedin -# nocheck: dynamic-flag a sidecar of this role switched on per inventory with its routes; no other role's presence decides it +# nocheck: dynamic-flag a sidecar of this role, provided by no other role; it runs exactly while routes are configured crossposter: - enabled: false - shared: false + enabled: "{{ (lookup('config', 'web-app-openpost', 'services.crossposter.routes') | length) > 0 }}" custom: true modes: compose: @@ -165,6 +164,7 @@ crossposter: image: python version: 3.13.7-slim name: openpost-crossposter + uid: 10001 cpus: "0.25" mem_reservation: 64m mem_limit: 256m From c1a40a8af6ba539f0fb55106f366b8f4aaaf597d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:56 +0200 Subject: [PATCH 175/554] refactor(web-app-openpost): read the crossposter flag and uid from its service entry --- roles/web-app-openpost/vars/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 3ae34b3201..32f742444f 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -93,9 +93,9 @@ OPENPOST_PROVIDER_APPS: >- OPENPOST_CROSSPOSTER: "{{ lookup('config', application_id, 'services.crossposter') }}" OPENPOST_CROSSPOSTER_ROUTES: "{{ OPENPOST_CROSSPOSTER.routes }}" -OPENPOST_CROSSPOSTER_ENABLED: "{{ (lookup('config', application_id, 'services.crossposter.enabled') | bool) and (OPENPOST_CROSSPOSTER_ROUTES | length > 0) }}" +OPENPOST_CROSSPOSTER_ENABLED: "{{ lookup('config', application_id, 'services.crossposter.enabled') | bool }}" OPENPOST_CROSSPOSTER_NAME: "{{ OPENPOST_CROSSPOSTER.name }}" -OPENPOST_CROSSPOSTER_UID: 10001 +OPENPOST_CROSSPOSTER_UID: "{{ OPENPOST_CROSSPOSTER.uid }}" OPENPOST_CROSSPOSTER_TOKEN_NAME: "crossposter" OPENPOST_CROSSPOSTER_DIR: "{{ [lookup('container', application_id, 'directories.config'), 'crossposter'] | path_join }}" OPENPOST_CROSSPOSTER_STATE_FILE: "{{ [OPENPOST_CROSSPOSTER_DIR, 'state.json'] | path_join }}" From af7f16bdcf192c2f367b6fc7c809e95f59df468a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:56 +0200 Subject: [PATCH 176/554] fix(web-app-openpost): let the crossposter user read its swarm secret --- roles/web-app-openpost/meta/volumes.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/meta/volumes.yml b/roles/web-app-openpost/meta/volumes.yml index 28954a2c32..ba88553040 100644 --- a/roles/web-app-openpost/meta/volumes.yml +++ b/roles/web-app-openpost/meta/volumes.yml @@ -40,7 +40,7 @@ crossposter_config: mounts: - service: crossposter target: /config/crossposter.json - when: "{{ (lookup('config', 'web-app-openpost', 'services.crossposter.enabled') | bool) and (lookup('config', 'web-app-openpost', 'services.crossposter.routes') | length) > 0 }}" + when: "{{ lookup('config', 'web-app-openpost', 'services.crossposter.enabled') | bool }}" crossposter_secrets: type: secret @@ -49,7 +49,9 @@ crossposter_secrets: mounts: - service: crossposter target: /run/secrets/crossposter.json - when: "{{ (lookup('config', 'web-app-openpost', 'services.crossposter.enabled') | bool) and (lookup('config', 'web-app-openpost', 'services.crossposter.routes') | length) > 0 }}" + uid: "{{ lookup('config', 'web-app-openpost', 'services.crossposter.uid') }}" + gid: "{{ lookup('config', 'web-app-openpost', 'services.crossposter.uid') }}" + when: "{{ lookup('config', 'web-app-openpost', 'services.crossposter.enabled') | bool }}" relay_conf: type: config From 4059a1e2ae49b37763b0c591bf70b10d69351d2b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:56 +0200 Subject: [PATCH 177/554] test(web-app-openpost): enable the crossposter through its routes alone --- roles/web-app-openpost/meta/variants.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/roles/web-app-openpost/meta/variants.yml b/roles/web-app-openpost/meta/variants.yml index adc07d87be..241759a223 100644 --- a/roles/web-app-openpost/meta/variants.yml +++ b/roles/web-app-openpost/meta/variants.yml @@ -4,7 +4,6 @@ container_backup: enabled: true crossposter: - enabled: true # nocheck: variants-static-override CI crossposter routes the Mastodon round exercises poll_interval_seconds: 15 retry: max_attempts: 3 @@ -95,7 +94,6 @@ enabled: false shared: false # nocheck: variants-static-override backup shared stays literally true crossposter: - enabled: true # nocheck: variants-static-override CI crossposter routes the Pixelfed and PeerTube round exercises poll_interval_seconds: 15 retry: max_attempts: 3 From 2d21b1b956cf63e505bc3ee9b7dea1d29f14b07b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:56 +0200 Subject: [PATCH 178/554] refactor(web-app-openpost): compose crossposter row queries with psycopg --- .../web-app-openpost/files/crossposter/crossposter/store.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/store.py b/roles/web-app-openpost/files/crossposter/crossposter/store.py index 541aef0bb0..b49f94ebb8 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/store.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/store.py @@ -124,7 +124,11 @@ class Store: ) def rows(self, where: str, parameters: tuple) -> list[dict]: - query = f"SELECT {COLUMNS} FROM crossposter.items WHERE {where} ORDER BY id" # noqa: S608 fixed clauses from this module + from psycopg import sql + + query = sql.SQL("SELECT {} FROM crossposter.items WHERE {} ORDER BY id").format( + sql.SQL(COLUMNS), sql.SQL(where) + ) return list(self.connection.execute(query, parameters).fetchall()) def due(self) -> list[dict]: From e61b8fda00bb9a3b251cd0c5ca4b528c4739a345 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:56 +0200 Subject: [PATCH 179/554] refactor(web-app-openpost): draw retry jitter from the system random source --- roles/web-app-openpost/files/crossposter/crossposter/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/service.py b/roles/web-app-openpost/files/crossposter/crossposter/service.py index 9126dfc9df..4a27b915d2 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/service.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/service.py @@ -69,7 +69,7 @@ class Service: ) for route in config.routes } - self.rng = random.Random() # noqa: S311 spreads retry delays, no security decision + self.rng = random.SystemRandom() def heartbeat(self, state: str) -> None: Path(self.config.heartbeat_file).write_text(f"{time.time():.0f} {state}\n") From be6cf0e018aaf7e86e6592d3879bbb3c6fdaf8ca Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:57 +0200 Subject: [PATCH 180/554] fix(web-app-openpost): mint pixelfed tokens without tinker --- .../web-app-openpost/tasks/crossposter/seed/pixelfed.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml index d7fca2af19..78c48f633f 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml @@ -18,13 +18,14 @@ - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_PIXELFED_LOCAL_CID resolved at delegate_to runtime - php - - artisan - - tinker - - --execute + - -r - >- + require '/var/www/vendor/autoload.php'; + $app = require '/var/www/bootstrap/app.php'; + $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); $user = App\User::where('username', getenv('CROSSPOSTER_ACCOUNT'))->firstOrFail(); if (! Laravel\Passport\Client::where('personal_access_client', true)->exists()) { - Artisan::call('passport:client', ['--personal' => true, '--name' => 'Crossposter CI', '--no-interaction' => true]); } + Illuminate\Support\Facades\Artisan::call('passport:client', ['--personal' => true, '--name' => 'Crossposter CI', '--no-interaction' => true]); } echo 'CROSSPOSTER_TOKEN=' . $user->createToken('crossposter-ci', ['read', 'write'])->accessToken . PHP_EOL; loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list }}" loop_control: From 4b66c6bdff9489295d69fb99a4da27b83e548c57 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:57 +0200 Subject: [PATCH 181/554] test(web-app-openpost): remember the stack host address for the swarm probe --- roles/web-app-openpost/tasks/00_core.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index 6214adc09f..260427bd75 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -1,6 +1,10 @@ --- - include_tasks: utils/once/flag.yml +- name: "🧭 Remember the stack host address that serves the public vhosts to swarm peers" + ansible.builtin.set_fact: + openpost_stack_address: "{{ hostvars[STACK_HOST].ansible_facts.default_ipv4.address if DEPLOYMENT_MODE == 'swarm' else '' }}" + - name: "🔗 Pin OpenPost apps on the sibling Mastodon and Pixelfed instances" include_tasks: 01_fediverse_apps.yml From 275a775c2bbc90b6becf553f87ba54ef2375da12 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:57 +0200 Subject: [PATCH 182/554] test(web-app-openpost): hand the probe the public proxy address --- roles/web-app-openpost/templates/test.env.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index f7785055fd..a72a123818 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -5,6 +5,7 @@ OPENPOST_CONTAINER={{ CLI_LOCAL_CID }} OPENPOST_DEADLINE_SECONDS={{ lookup('timeout', 600) | int }} OPENPOST_LOCAL_URL={{ OPENPOST_LOCAL_URL }} OPENPOST_PUBLIC_URL={{ OPENPOST_URL }} +OPENPOST_PROXY_ADDRESS={{ openpost_stack_address }} OPENPOST_SSO_ENABLED={{ OPENPOST_OIDC_ENABLED | bool | string | lower }} {% set _targets = {} %} {% for _key, _role in OPENPOST_RELAY_SIBLINGS.items() if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool %} From c2af6a2af0c89f0d5c3e5e40b82fdba3afa8cbdb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:57 +0200 Subject: [PATCH 183/554] test(web-app-openpost): reach public vhosts through the stack host proxy in swarm --- .../files/test/openpost/api.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/test/openpost/api.py b/roles/web-app-openpost/files/test/openpost/api.py index 817845a4aa..ad18a0df57 100644 --- a/roles/web-app-openpost/files/test/openpost/api.py +++ b/roles/web-app-openpost/files/test/openpost/api.py @@ -22,14 +22,17 @@ OPENPOST_PEERTUBE_USERNAME local PeerTube account OpenPost connects through it OPENPOST_PEERTUBE_PASSWORD_B64 base64 password of that PeerTube account OPENPOST_MEMBER_EMAIL deliverable plus-address of the administrator mailbox for the probe's workspace member OPENPOST_MEMBER_PASSWORD_B64 base64 password of the probe's workspace member, stable across credential rotation +OPENPOST_PROXY_ADDRESS stack host address that serves every public vhost, empty when the probe runs on that host's network """ from __future__ import annotations import base64 +import http.client import json import os import secrets +import socket import subprocess import sys import time @@ -63,6 +66,7 @@ PEERTUBE_PASSWORD = base64.b64decode( MEMBER_USERNAME = "openpost-cli-member" MEMBER_PASSWORD = base64.b64decode(os.environ["OPENPOST_MEMBER_PASSWORD_B64"]).decode() MEMBER_EMAIL = os.environ["OPENPOST_MEMBER_EMAIL"] +PROXY_ADDRESS = os.environ["OPENPOST_PROXY_ADDRESS"] SETTLE_SECONDS = 300 PROFILES = {"text": "short_text", "image": "image_post", "video": "video"} @@ -76,7 +80,20 @@ class _NoRedirect(urllib.request.HTTPRedirectHandler): return None -OPENER = urllib.request.build_opener(_NoRedirect) +class _ProxyConnection(http.client.HTTPSConnection): + def connect(self) -> None: + raw = socket.create_connection((PROXY_ADDRESS, self.port), self.timeout) + self.sock = self._context.wrap_socket(raw, server_hostname=self.host) + + +class _ProxyHandler(urllib.request.HTTPSHandler): + def https_open(self, req: urllib.request.Request) -> http.client.HTTPResponse: + return self.do_open(_ProxyConnection, req, context=self._context) + + +PROXY_HANDLERS = [_ProxyHandler()] if PROXY_ADDRESS else [] +OPENER = urllib.request.build_opener(_NoRedirect, *PROXY_HANDLERS) +urllib.request.install_opener(urllib.request.build_opener(*PROXY_HANDLERS)) def call( From 0366c10839922ed853942f41d9b9ef3643930171 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:57 +0200 Subject: [PATCH 184/554] test(web-app-openpost): reach the mailbox through the stack host proxy in swarm --- roles/web-app-openpost/files/test/openpost/mailbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/mailbox.py b/roles/web-app-openpost/files/test/openpost/mailbox.py index ab8514324a..77b26846e8 100644 --- a/roles/web-app-openpost/files/test/openpost/mailbox.py +++ b/roles/web-app-openpost/files/test/openpost/mailbox.py @@ -10,7 +10,7 @@ import imaplib import os import ssl -from openpost.api import MAIL_RECIPIENT +from openpost.api import MAIL_RECIPIENT, PROXY_ADDRESS MAIL_HOST = os.environ["OPENPOST_MAIL_HOST"] MAIL_PASSWORD = base64.b64decode(os.environ["OPENPOST_MAIL_PASSWORD_B64"]).decode() @@ -25,7 +25,7 @@ def reports_naming(urls: list[str]) -> list[str]: found: list[str] = [] try: with imaplib.IMAP4_SSL( - MAIL_HOST, IMAPS_PORT, ssl_context=context, timeout=60 + PROXY_ADDRESS or MAIL_HOST, IMAPS_PORT, ssl_context=context, timeout=60 ) as imap: imap.login(MAIL_RECIPIENT, MAIL_PASSWORD) imap.select("INBOX", readonly=True) From 796b9e411041ca1a8ebd9234ddecfbb0843dc78f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:57 +0200 Subject: [PATCH 185/554] test(web-app-openpost): expect unreachable media on an onion origin --- roles/web-app-openpost/files/test/probe.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py index 6a0e49714b..853304a806 100644 --- a/roles/web-app-openpost/files/test/probe.py +++ b/roles/web-app-openpost/files/test/probe.py @@ -247,12 +247,21 @@ def check_media(token: str, workspace: str) -> None: or [{}] )[0] time.sleep(0 if attached.get("public_url_checked_at") else 3) - check( - "OpenPost reaches the public URL of uploaded media without a session", - attached.get("public_url_ready") is True - and attached.get("public_url_status") == 200, - attached, - ) + origin = urllib.parse.urlparse(S3_PUBLIC_URL or PUBLIC_URL).hostname or "" + if origin.endswith(".onion"): + check( + "OpenPost flags media on an onion origin as unreachable for providers", + attached.get("public_url_ready") is False + and "OPENPOST_MEDIA_URL" in str(attached.get("public_url_error")), + attached, + ) + else: + check( + "OpenPost reaches the public URL of uploaded media without a session", + attached.get("public_url_ready") is True + and attached.get("public_url_status") == 200, + attached, + ) if S3_PUBLIC_URL: check( f"uploaded media lands in S3 and is fetchable anonymously under {S3_PUBLIC_URL}", From 4dbda70bb609c51118db08bd2541cc712892bc20 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:57 +0200 Subject: [PATCH 186/554] test(web-app-openpost): crosspost a fresh mastodon status before editing its draft --- .../playwright/test-crossposter-draft.js | 84 ++++++++++++++----- 1 file changed, 63 insertions(+), 21 deletions(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js index 3bb3e06811..be0b3c749f 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js @@ -1,36 +1,78 @@ const { test, expect } = require("@playwright/test"); -const { gotoOnion } = require("./personas"); +const { gotoOnion, performKeycloakLoginForm } = require("./personas"); const { resolveTimeout } = require("./timeouts"); -async function crosspostedDraft(page, shared, headers) { - for (const workspace of await shared.apiRequest(page, headers, "GET", "/workspaces")) { - const drafts = await shared.apiRequest( - page, - headers, - "GET", - `/publications?workspace_id=${workspace.id}&status=draft&search=crossposterreview&limit=50`, - ); - const found = (drafts || []).find((item) => (item.metadata || {}).crossposter_route === "ci-review"); - if (found) { - return { workspace: workspace.id, publication: found }; - } +const REVIEW_ROUTE = "ci-review"; +const REVIEW_SET = "Crossposter review"; +const REVIEW_TAG = "crossposterreview"; + +async function routeReviewToMastodon(page, shared, headers) { + const target = await shared.apiAccount(page, headers, "mastodon"); + const sets = await shared.apiRequest(page, headers, "GET", `/social-sets?workspace_id=${target.workspace}`); + const reviewSet = (sets || []).find((item) => item.name === REVIEW_SET); + expect(reviewSet, `the deploy must create the "${REVIEW_SET}" social set`).toBeTruthy(); + await shared.apiRequest(page, headers, "PUT", `/social-sets/${reviewSet.id}`, { + name: reviewSet.name, + workspace_id: target.workspace, + accounts: [{ social_account_id: target.account, default_settings: {} }], + }); + return target.workspace; +} + +async function postOnMastodon(page, shared, text, label) { + await gotoOnion(page, `${shared.env.mastodonBaseUrl}/auth/sign_in`, { waitUntil: "domcontentloaded" }); + await page.getByRole("link", { name: /sso|single sign-on/i }).click(); + await page.waitForLoadState("domcontentloaded"); + if (page.url().includes(`${shared.env.oidcIssuerUrl}/protocol/openid-connect/auth`)) { + await performKeycloakLoginForm(page, shared.env.adminUsername, shared.env.adminPassword); } - return null; + await expect + .poll(() => page.url(), { timeout: resolveTimeout(60_000), message: `${label}: expected Mastodon's home timeline` }) + .not.toContain("/auth/sign_in"); + await gotoOnion(page, `${shared.env.mastodonBaseUrl}/home`, { waitUntil: "domcontentloaded" }); + const token = await page.evaluate(() => JSON.parse(document.getElementById("initial-state").textContent).meta.access_token); + expect(token, `${label}: Mastodon's web client must hold a session token`).toBeTruthy(); + const response = await page.request.post(`${shared.env.mastodonBaseUrl}/api/v1/statuses`, { + headers: { Authorization: `Bearer ${token}` }, + form: { status: text, visibility: "public" }, + }); + expect(response.ok(), `${label}: Mastodon must accept the status, got HTTP ${response.status()}`).toBeTruthy(); +} + +async function crosspostedDraft(page, shared, headers, workspace, marker) { + const drafts = await shared.apiRequest( + page, + headers, + "GET", + `/publications?workspace_id=${workspace}&status=draft&search=${encodeURIComponent(marker)}&limit=10`, + ); + return (drafts || []).find((item) => (item.metadata || {}).crossposter_route === REVIEW_ROUTE) || null; } exports.register = function (shared) { test("administrator: finds a crossposted draft in the desk, edits it and schedules it", async ({ page }) => { shared.skipUnlessServiceEnabled("crossposter"); shared.skipUnlessServiceEnabled("mastodon"); - test.setTimeout(resolveTimeout(300_000)); // draft lookup, composer autosave and the scheduling round-trip - const label = "break-glass administrator"; - const edited = `Edited in the desk ${Date.now()}`; + test.setTimeout(resolveTimeout(420_000)); // Mastodon sign-in, the crossposter's poll interval, composer autosave and scheduling + const label = "administrator"; + const marker = `cp-desk-${Date.now()}`; + const edited = `Edited in the desk ${marker}`; await shared.signInViaLocal(page, shared.env.breakglassEmail, shared.env.breakglassPassword, label); const headers = shared.apiSession(); - const found = await crosspostedDraft(page, shared, headers); - expect(found, `${label}: the CLI run must leave a crossposted review draft`).toBeTruthy(); - const marker = String(found.publication.title || found.publication.source_text).split(" ")[1]; + const workspace = await routeReviewToMastodon(page, shared, headers); + await postOnMastodon(page, shared, `Desk review ${marker} #${REVIEW_TAG}`, label); + + let draft = null; + await expect + .poll( + async () => { + draft = await crosspostedDraft(page, shared, headers, workspace, marker); + return Boolean(draft); + }, + { timeout: resolveTimeout(180_000), message: `${label}: the crossposter must turn the status into a review draft` }, + ) + .toBe(true); await gotoOnion(page, `${shared.env.appBaseUrl}/publications?tab=drafts`, { waitUntil: "domcontentloaded" }); await page.getByRole("textbox", { name: /search posts/i }).fill(marker); @@ -52,7 +94,7 @@ exports.register = function (shared) { await expect .poll( async () => { - const current = await shared.apiRequest(page, headers, "GET", `/publications/${found.publication.id}`); + const current = await shared.apiRequest(page, headers, "GET", `/publications/${draft.id}`); return `${current.status}|${String(current.source_text).includes(edited)}`; }, { timeout: resolveTimeout(60_000), message: `${label}: the edited draft must end scheduled` }, From d0524dd42ee9596e29cc9184bf1b75a58f7eb98c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 23 Oct 2026 19:38:58 +0200 Subject: [PATCH 187/554] docs(web-app-openpost): note the onion media limit --- roles/web-app-openpost/Administration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 06fd5a7477..dcd217ed56 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -211,6 +211,7 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo | TikTok's content sharing guidelines reject in-house upload tools as a use case for the Content Posting API. | Publish to TikTok manually, or apply with a use case TikTok accepts; keep TikTok credentials empty until then. | | X charges $0.20 instead of $0.015 for a post that contains a URL. | Write the X rendition without links, or accept the surcharge per post. | | X forbids identical content across accounts of the same owner. | Give each X account its own rendition. | +| On an onion-only deployment OpenPost marks uploaded media as unreachable for providers, because X, Meta, LinkedIn, YouTube and TikTok cannot fetch from a `.onion` origin. | Serve media from object storage with a clearnet public URL, or publish text-only posts to commercial networks. | | OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition. | Cap X spending through the prepaid credits of the X developer account. | | Instagram accepts JPEG only and fetches media from a public URL. | Deploy `web-app-seaweedfs` so media gets public HTTPS URLs; convert other image formats before upload. | | Facebook, Instagram, Threads and TikTok fetch media from public HTTPS URLs. | Same as above; without `web-app-seaweedfs` media is served under `/media/` of the public OpenPost domain, which also works when that domain is reachable from the internet. | From 9308e906c4bf4f82ceabfcfa009317e5224a6c4c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:07 +0200 Subject: [PATCH 188/554] fix(web-app-openpost): keep a waiting crossposter healthy --- .../files/crossposter/crossposter/__main__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/__main__.py b/roles/web-app-openpost/files/crossposter/crossposter/__main__.py index f70c0378b8..2941de76b9 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/__main__.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/__main__.py @@ -64,11 +64,16 @@ def command_validate(path: str) -> int: return 0 -def wait_for_configuration(path: str, error: Exception) -> float: +def liveness(path: str) -> tuple[Path, float]: raw = json.loads(Path(path).read_text()) - Path(raw["heartbeat_file"]).write_text(f"{time.time():.0f} waiting\n") + return Path(raw["heartbeat_file"]), float(raw["poll_interval_seconds"]) + + +def wait_for_configuration(path: str, error: Exception) -> float: + heartbeat, interval = liveness(path) + heartbeat.write_text(f"{time.time():.0f} waiting\n") LOG.warning("crossposter waits for a valid configuration: %s", error) - return float(raw["poll_interval_seconds"]) + return interval def command_run(path: str) -> int: @@ -101,12 +106,11 @@ def command_list(path: str) -> int: def command_health(path: str) -> int: - loaded = settings.load(path) - heartbeat = Path(loaded.heartbeat_file) + heartbeat, interval = liveness(path) if not heartbeat.is_file(): return 1 stamp, _, state = heartbeat.read_text().strip().partition(" ") - fresh = time.time() - float(stamp) < STALE_INTERVALS * loaded.poll_interval_seconds + fresh = time.time() - float(stamp) < STALE_INTERVALS * interval return 0 if fresh and state in HEALTHY else 1 From ccbbc05fdc3be0d6af83afc14c46833b308fdf1c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:07 +0200 Subject: [PATCH 189/554] test(web-app-openpost): cover health while the crossposter waits for its tokens --- .../files/crossposter/crossposter/test___main__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py index e4518cdd80..1f18a737e6 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py @@ -63,6 +63,14 @@ class TestHealth(CliFixture, unittest.TestCase): def test_a_missing_heartbeat_is_unhealthy(self) -> None: self.assertEqual(cli.command_health(str(self.config)), 1) + def test_a_waiting_instance_stays_healthy_while_its_configuration_is_incomplete( + self, + ) -> None: + self.raw["routes"] = [{"name": "press", "source": {"platform": "mastodon"}}] + self.write() + self.heartbeat.write_text(f"{time.time():.0f} waiting\n") + self.assertEqual(cli.command_health(str(self.config)), 0) + def test_waiting_for_provisioning_stays_healthy(self) -> None: pause = cli.wait_for_configuration(str(self.config), ValueError("no token yet")) self.assertEqual(pause, 60) From 363fc4b831cb9f70ebc1f5a60b51da27e17bf9f5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:07 +0200 Subject: [PATCH 190/554] fix(web-app-openpost): size the relay map for onion hostnames --- roles/web-app-openpost/templates/relay.conf.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/templates/relay.conf.j2 b/roles/web-app-openpost/templates/relay.conf.j2 index 73ea195424..b3ee2eb325 100644 --- a/roles/web-app-openpost/templates/relay.conf.j2 +++ b/roles/web-app-openpost/templates/relay.conf.j2 @@ -8,6 +8,7 @@ events { stream { log_format relay '$remote_addr sni=$ssl_preread_server_name upstream=$upstream_addr status=$status'; access_log /dev/stdout relay; + map_hash_bucket_size 128; upstream shared_proxy { server {{ OPENPOST_RELAY_UPSTREAM_HOST }}:{{ OPENPOST_RELAY_UPSTREAM_PORT }}; From 751c150c2b1b74852f34edeba29f73028eb8d06e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:07 +0200 Subject: [PATCH 191/554] fix(web-app-openpost): reach the object store through the relay --- roles/web-app-openpost/vars/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 32f742444f..2436dac47b 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -45,6 +45,9 @@ OPENPOST_RELAY_DOMAINS: >- {%- set _ = _domains.append(lookup('domain', _role)) -%} {%- endif -%} {%- endfor -%} + {%- if OPENPOST_OBJSTORE_ENABLED | bool -%} + {%- set _ = _domains.append(lookup('objstore', application_id, 'public_domain')) -%} + {%- endif -%} {{ _domains }} OPENPOST_PINNED_INSTANCES: >- {%- set _instances = [] -%} From 35ba043e23b3ed24d662ea513dfa0de6addf4bdf Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:07 +0200 Subject: [PATCH 192/554] fix(web-app-openpost): mint pixelfed tokens with passport 13 --- .../tasks/crossposter/seed/pixelfed.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml index 78c48f633f..4cf5469719 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml @@ -23,10 +23,12 @@ require '/var/www/vendor/autoload.php'; $app = require '/var/www/bootstrap/app.php'; $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); - $user = App\User::where('username', getenv('CROSSPOSTER_ACCOUNT'))->firstOrFail(); - if (! Laravel\Passport\Client::where('personal_access_client', true)->exists()) { - Illuminate\Support\Facades\Artisan::call('passport:client', ['--personal' => true, '--name' => 'Crossposter CI', '--no-interaction' => true]); } - echo 'CROSSPOSTER_TOKEN=' . $user->createToken('crossposter-ci', ['read', 'write'])->accessToken . PHP_EOL; + $user = App\Models\User::where('username', getenv('CROSSPOSTER_ACCOUNT'))->firstOrFail(); + $mint = fn () => $user->createToken('crossposter-ci', ['read', 'write'])->accessToken; + try { $token = $mint(); } catch (RuntimeException $missing) { + Illuminate\Support\Facades\Artisan::call('passport:client', ['--personal' => true, '--provider' => 'users', '--name' => 'Crossposter CI', '--no-interaction' => true]); + $token = $mint(); } + echo 'CROSSPOSTER_TOKEN=' . $token . PHP_EOL; loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list }}" loop_control: label: "{{ item.name }}" From 68ecbe82175e98f9f35123e07c43b84b8651ca04 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:07 +0200 Subject: [PATCH 193/554] test(web-app-openpost): reach onion vhosts over http through the stack host --- .../files/test/openpost/api.py | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/api.py b/roles/web-app-openpost/files/test/openpost/api.py index ad18a0df57..d5005fe0cb 100644 --- a/roles/web-app-openpost/files/test/openpost/api.py +++ b/roles/web-app-openpost/files/test/openpost/api.py @@ -29,6 +29,7 @@ from __future__ import annotations import base64 import http.client +import ipaddress import json import os import secrets @@ -40,18 +41,26 @@ import urllib.error import urllib.parse import urllib.request + +def public_url(url: str) -> str: + parts = urllib.parse.urlsplit(url) + if (parts.hostname or "").endswith(".onion") and parts.scheme == "https": + return urllib.parse.urlunsplit(("http", *parts[1:])) + return url + + BASE = os.environ["OPENPOST_LOCAL_URL"].rstrip("/") + "/api/v1" HEADERS = json.loads(base64.b64decode(os.environ["OPENPOST_API_HEADERS_B64"])) ADMIN_EMAIL = os.environ["OPENPOST_ADMIN_EMAIL"] ADMIN_PASSWORD = base64.b64decode(os.environ["OPENPOST_ADMIN_PASSWORD_B64"]).decode() RELAY_TARGETS = json.loads(os.environ["OPENPOST_RELAY_TARGETS"]) DEADLINE = time.monotonic() + int(os.environ["OPENPOST_DEADLINE_SECONDS"]) -PUBLIC_URL = os.environ["OPENPOST_PUBLIC_URL"].rstrip("/") +PUBLIC_URL = public_url(os.environ["OPENPOST_PUBLIC_URL"]).rstrip("/") SSO_ENABLED = os.environ["OPENPOST_SSO_ENABLED"] == "true" CONTAINER = os.environ["OPENPOST_CONTAINER"] SIMULATOR_PLATFORMS = json.loads(os.environ["OPENPOST_SIMULATOR_PLATFORMS"]) UNCONFIGURED_PLATFORMS = json.loads(os.environ["OPENPOST_UNCONFIGURED_PLATFORMS"]) -S3_PUBLIC_URL = os.environ["OPENPOST_S3_PUBLIC_URL"] +S3_PUBLIC_URL = public_url(os.environ["OPENPOST_S3_PUBLIC_URL"]) SIMULATOR_ADMIN = "https://" + os.environ["OPENPOST_SIMULATOR_HOST"] + "/__admin" DB_CONTAINER = os.environ["OPENPOST_DB_CONTAINER"] DB_NAME = os.environ["OPENPOST_DB_NAME"] @@ -80,18 +89,36 @@ class _NoRedirect(urllib.request.HTTPRedirectHandler): return None -class _ProxyConnection(http.client.HTTPSConnection): +def dial(host: str) -> str: + try: + ipaddress.ip_address(host) + except ValueError: + return PROXY_ADDRESS + return host + + +class _ProxyConnection(http.client.HTTPConnection): def connect(self) -> None: - raw = socket.create_connection((PROXY_ADDRESS, self.port), self.timeout) + self.sock = socket.create_connection((dial(self.host), self.port), self.timeout) + + +class _ProxyTlsConnection(http.client.HTTPSConnection): + def connect(self) -> None: + raw = socket.create_connection((dial(self.host), self.port), self.timeout) self.sock = self._context.wrap_socket(raw, server_hostname=self.host) -class _ProxyHandler(urllib.request.HTTPSHandler): +class _ProxyHandler(urllib.request.HTTPHandler): + def http_open(self, req: urllib.request.Request) -> http.client.HTTPResponse: + return self.do_open(_ProxyConnection, req) + + +class _ProxyTlsHandler(urllib.request.HTTPSHandler): def https_open(self, req: urllib.request.Request) -> http.client.HTTPResponse: - return self.do_open(_ProxyConnection, req, context=self._context) + return self.do_open(_ProxyTlsConnection, req, context=self._context) -PROXY_HANDLERS = [_ProxyHandler()] if PROXY_ADDRESS else [] +PROXY_HANDLERS = [_ProxyHandler(), _ProxyTlsHandler()] if PROXY_ADDRESS else [] OPENER = urllib.request.build_opener(_NoRedirect, *PROXY_HANDLERS) urllib.request.install_opener(urllib.request.build_opener(*PROXY_HANDLERS)) From 12721c81719c81035bf26b2c6e939b1db62e46f8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:08 +0200 Subject: [PATCH 194/554] test(web-app-openpost): fill social sets with the replace schema --- .../files/test/openpost/crossposter.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/crossposter.py b/roles/web-app-openpost/files/test/openpost/crossposter.py index 838436f84e..63ce9b3ddb 100644 --- a/roles/web-app-openpost/files/test/openpost/crossposter.py +++ b/roles/web-app-openpost/files/test/openpost/crossposter.py @@ -18,7 +18,7 @@ import time import urllib.parse from pathlib import Path -from openpost.api import DEADLINE, accounts, call, check, render_media +from openpost.api import DEADLINE, accounts, call, check, public_url, render_media from openpost.journal import hits, statuses from openpost.mailbox import reports_naming from openpost.simulator import SCENARIOS, simulator_admin @@ -29,7 +29,12 @@ from openpost.sources import ( pixelfed_post, ) -ROUTES = json.loads(base64.b64decode(os.environ["OPENPOST_CROSSPOSTER_ROUTES_B64"])) +ROUTES = [ + {**route, "base_url": public_url(route["base_url"])} + for route in json.loads( + base64.b64decode(os.environ["OPENPOST_CROSSPOSTER_ROUTES_B64"]) + ) +] SECRETS_FILE = os.environ["OPENPOST_CROSSPOSTER_SECRETS_FILE"] CROSSPOSTER = os.environ["OPENPOST_CROSSPOSTER_CONTAINER"] CONFIG = os.environ["OPENPOST_CROSSPOSTER_CONFIG"] @@ -137,7 +142,11 @@ def fill_sets(token: str, workspace: str) -> None: status, body = call( "PUT", f"/social-sets/{chosen['id']}", - {"name": chosen["name"], "workspace_id": workspace, "accounts": members}, + { + "name": chosen["name"], + "is_default": bool(chosen.get("is_default")), + "accounts": members, + }, token, ) check( From 081c76cf27460ee51ca7b203c9f181c57585b72a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:08 +0200 Subject: [PATCH 195/554] test(web-app-openpost): fetch peertube listings over the onion scheme --- roles/web-app-openpost/files/test/probe.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py index 853304a806..ff663f4b1c 100644 --- a/roles/web-app-openpost/files/test/probe.py +++ b/roles/web-app-openpost/files/test/probe.py @@ -31,6 +31,7 @@ from openpost.api import ( draft, failures, in_container, + public_url, release, revoke_invitations, settle, @@ -310,8 +311,9 @@ def check_mail(token: str, workspace: str) -> None: def peertube_has(domain: str, tag: str) -> bool: query = urllib.parse.urlencode({"count": 25, "sort": "-publishedAt"}) try: - with urllib.request.urlopen( - f"https://{domain}/api/v1/accounts/{PEERTUBE_USERNAME}/videos?{query}", + with OPENER.open( + public_url(f"https://{domain}") + + f"/api/v1/accounts/{PEERTUBE_USERNAME}/videos?{query}", timeout=60, ) as response: videos = json.loads(response.read().decode()).get("data") or [] From 7a8c79fab193f382a0d30df606e71a60a6bf9322 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:08 +0200 Subject: [PATCH 196/554] test(web-app-openpost): replace the review social set with its required fields --- .../web-app-openpost/files/playwright/test-crossposter-draft.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js index be0b3c749f..ba2aba5b08 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js @@ -13,7 +13,7 @@ async function routeReviewToMastodon(page, shared, headers) { expect(reviewSet, `the deploy must create the "${REVIEW_SET}" social set`).toBeTruthy(); await shared.apiRequest(page, headers, "PUT", `/social-sets/${reviewSet.id}`, { name: reviewSet.name, - workspace_id: target.workspace, + is_default: Boolean(reviewSet.is_default), accounts: [{ social_account_id: target.account, default_settings: {} }], }); return target.workspace; From 9d9fa5013295c9abf750eb484a47206e0243eccc Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 01:48:08 +0200 Subject: [PATCH 197/554] docs(web-app-openpost): document the object store relay alias --- roles/web-app-openpost/Administration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index dcd217ed56..311d2c2f09 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -48,7 +48,8 @@ The role therefore runs an `nginx` stream relay next to OpenPost: - The role network uses `192.88.99.0/24`, the deprecated 6to4 relay anycast block (RFC 7526), which `netguard` accepts as a global unicast range and which never leaves the Docker host. `group_vars/all/08_networks.yml` lists the role in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` for that reason. -- The relay carries the canonical domains of the deployed Mastodon, Pixelfed and PeerTube roles as network aliases, so OpenPost resolves those names to the relay. +- The relay carries the canonical domains of the deployed Mastodon, Pixelfed and PeerTube roles, and the public domain of the object store, as network aliases, so OpenPost resolves those names to the relay. + OpenPost writes media to the object store's public endpoint because browsers upload through the same presigned URLs; the alias keeps those writes on the shared proxy even where that public name only resolves through Tor. - The relay reads the SNI of each TLS connection, forwards a mapped name unchanged to the shared OpenResty proxy and closes every other connection. It forwards to `host.docker.internal`, which points at the Docker host in compose and at the stack host in swarm. - TLS stays end to end between OpenPost and OpenResty; in self-signed mode OpenPost trusts the platform CA through the compose CA injection. From 52861dd244c55ea64122e3cb1e581a3ac5a2f72a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:36 +0200 Subject: [PATCH 198/554] fix(web-app-pixelfed): drop the trailing slash from APP_URL --- roles/web-app-pixelfed/templates/env.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-pixelfed/templates/env.j2 b/roles/web-app-pixelfed/templates/env.j2 index 5fdd4b158e..77ce560f77 100644 --- a/roles/web-app-pixelfed/templates/env.j2 +++ b/roles/web-app-pixelfed/templates/env.j2 @@ -6,7 +6,7 @@ APP_KEY={{ lookup('config', application_id, 'secrets.credentials.app_key')}} APP_NAME="{{ PIXELFED_TITEL }}" APP_ENV={{ ENVIRONMENT | lower }} APP_DEBUG={{MODE_DEBUG | string | lower }} -APP_URL={{ lookup('tls', application_id, 'url.base') }} +APP_URL={{ lookup('tls', application_id, 'url.base') | regex_replace('/$', '') }} FORCE_HTTPS_URLS={{ lookup('tls', application_id, 'enabled') | string | lower }} APP_DOMAIN={{ lookup('domain',application_id) }} ADMIN_DOMAIN={{ lookup('domain',application_id) }} From 50deac23c1c762ea8b2f2b99da2e69b3adc852af Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:36 +0200 Subject: [PATCH 199/554] fix(web-app-openpost): send source credentials only to the source origin --- .../files/crossposter/crossposter/service.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/service.py b/roles/web-app-openpost/files/crossposter/crossposter/service.py index 4a27b915d2..ce2c77b5c1 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/service.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/service.py @@ -36,6 +36,13 @@ def to_jpeg(source: Path) -> Path: return target +def credentials_for(source_url: str, media_url: str, headers: dict) -> dict: + source = urllib.parse.urlsplit(source_url) + media = urllib.parse.urlsplit(media_url) + same_origin = (source.scheme, source.netloc) == (media.scheme, media.netloc) + return dict(headers) if same_origin else {} + + def failure(rendition: dict) -> str: delivery = rendition.get("delivery") or {} reason = ( @@ -145,14 +152,16 @@ class Service: self, route: Route, plan: adapt.Plan, folder: Path ) -> list[tuple[str, str]]: uploaded = [] - headers = dict(self.sources[route.name].headers) + headers = self.sources[route.name].headers for index, attachment in enumerate(plan.media): name = ( Path(urllib.parse.urlparse(attachment.media.url).path).name or f"media-{index}" ) local = web.download( - attachment.media.url, headers, folder / f"{index}-{name}" + attachment.media.url, + credentials_for(route.source.base_url, attachment.media.url, headers), + folder / f"{index}-{name}", ) mime = attachment.media.mime if attachment.jpeg and mime != "image/jpeg": From cbe1a57087c28431d8a49c7e4bc78e2ef887f2f1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:36 +0200 Subject: [PATCH 200/554] test(web-app-openpost): keep source tokens away from media hosts --- .../crossposter/crossposter/test_service.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py index d58a766cde..dac2ed8088 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py @@ -43,6 +43,31 @@ def post(number: int, tags: tuple[str, ...] = ()) -> SourceItem: ) +SOURCE_TOKEN = {"Authorization": "Bearer source-token"} + + +class TestMediaCredentials(unittest.TestCase): + def test_media_on_the_source_origin_gets_the_source_token(self) -> None: + self.assertEqual( + service.credentials_for( + "https://microblog.example", + "https://microblog.example/system/media/1.png", + SOURCE_TOKEN, + ), + SOURCE_TOKEN, + ) + + def test_media_in_an_object_store_never_sees_the_source_token(self) -> None: + self.assertEqual( + service.credentials_for( + "https://microblog.example", + "https://s3.example/mastodon/media/1.png", + SOURCE_TOKEN, + ), + {}, + ) + + class FakeSource: def __init__(self, items: list[SourceItem]) -> None: self.items = items From 7f6fd39a4b922d66d90b9e633817c6c5fa7e2b46 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:36 +0200 Subject: [PATCH 201/554] feat(web-app-openpost): accept plain http for onion sources --- .../files/crossposter/crossposter/config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/config.py b/roles/web-app-openpost/files/crossposter/crossposter/config.py index 3f6b0c692d..4c10c23c03 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/config.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/config.py @@ -1,6 +1,7 @@ from __future__ import annotations import json +import urllib.parse from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING @@ -153,11 +154,13 @@ def _route(raw: dict, tokens: dict) -> Route: f"{platform!r} is not one of {sorted(PLATFORMS)}", ) base_url = str(source.get("base_url") or "").rstrip("/") + parts = urllib.parse.urlsplit(base_url) _require( - base_url.startswith("https://"), + parts.scheme == "https" + or (parts.scheme == "http" and (parts.hostname or "").endswith(".onion")), name, "source.base_url", - "must be an https:// URL", + "must be an https:// URL, or http:// for an onion service", ) account = str(source.get("account") or "") _require(bool(account), name, "source.account", "names no account") From 7c757bc5e89b798dbfa3795fd6d62a92c67d7d34 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:36 +0200 Subject: [PATCH 202/554] test(web-app-openpost): cover onion sources over http --- .../files/crossposter/crossposter/test_config.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py index ec1ddc961d..61c8b39758 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py @@ -127,6 +127,12 @@ class TestParse(ConfigFixture, unittest.TestCase): ) self.assertIn("source.base_url", message) + def test_an_onion_source_may_use_plain_http(self) -> None: + raw = copy.deepcopy(self.raw) + onion = "http://microblog." + "a" * 56 + ".onion" + raw["routes"][0]["source"]["base_url"] = onion + self.assertEqual(config.parse(raw).routes[0].source.base_url, onion) + def test_route_names_are_unique(self) -> None: raw = copy.deepcopy(self.raw) raw["routes"].append(copy.deepcopy(raw["routes"][0])) From b072e55309d742ad49b0059dbc2d011fdd107c8f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:36 +0200 Subject: [PATCH 203/554] chore(web-app-openpost): describe the validated crossposter URLs --- roles/web-app-openpost/files/crossposter/crossposter/web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/web.py b/roles/web-app-openpost/files/crossposter/crossposter/web.py index b63440d7dd..5ee8083fa4 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/web.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/web.py @@ -46,11 +46,11 @@ class RequestError(RuntimeError): def _outgoing( url: str, method: str, headers: dict[str, str], body: bytes | IO[bytes] | None ) -> urllib.request.Request: - return urllib.request.Request(url, data=body, method=method, headers=headers) # noqa: S310 validated https routes and OpenPost + return urllib.request.Request(url, data=body, method=method, headers=headers) # noqa: S310 validated route and OpenPost URLs def _open(outgoing: urllib.request.Request, timeout: float) -> HTTPResponse: - return urllib.request.urlopen(outgoing, timeout=timeout) # noqa: S310 validated https routes and OpenPost + return urllib.request.urlopen(outgoing, timeout=timeout) # noqa: S310 validated route and OpenPost URLs def _exchange( From 69ac59efdbec6ee5ae363e25ff9ef2c5bc1d92fa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:37 +0200 Subject: [PATCH 204/554] feat(web-app-openpost): open a plain http port on the relay --- roles/web-app-openpost/meta/services.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index f079bcd900..ddbaeaedb7 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -112,6 +112,7 @@ relay: pids_limit: 64 ports: internal: + http: 80 https: 443 # nocheck: playwright-service-flag CI provider simulator, covered by the role's CLI test # nocheck: dynamic-flag a test fixture switched on by one variant only; no other role's presence decides it From 766e43e6039c22ce5f3390503b46f79aae0495e1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:37 +0200 Subject: [PATCH 205/554] feat(web-app-openpost): point the relay's http leg at the shared proxy --- roles/web-app-openpost/vars/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 2436dac47b..2483010969 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -60,6 +60,7 @@ OPENPOST_PINNED_INSTANCES: >- OPENPOST_FEDIVERSE_APPS_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'fediverse-apps.json'] | path_join }}" OPENPOST_RELAY_UPSTREAM_HOST: "host.docker.internal" OPENPOST_RELAY_UPSTREAM_PORT: "{{ lookup('config', 'svc-prx-openresty', 'services.openresty.ports.public.https') }}" +OPENPOST_RELAY_UPSTREAM_HTTP_PORT: "{{ lookup('config', 'svc-prx-openresty', 'services.openresty.ports.public.http') }}" OPENPOST_SIMULATOR_ENABLED: "{{ lookup('config', application_id, 'services.simulator.enabled') | bool }}" OPENPOST_SIMULATOR_NAME: "{{ lookup('config', application_id, 'services.simulator.name') }}" From 9197fd964029dbcf1cf66d4ab07c3801a7bec7ef Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:37 +0200 Subject: [PATCH 206/554] feat(web-app-openpost): relay plain http for onion siblings --- roles/web-app-openpost/templates/relay.conf.j2 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/web-app-openpost/templates/relay.conf.j2 b/roles/web-app-openpost/templates/relay.conf.j2 index b3ee2eb325..65060ad611 100644 --- a/roles/web-app-openpost/templates/relay.conf.j2 +++ b/roles/web-app-openpost/templates/relay.conf.j2 @@ -14,6 +14,10 @@ stream { server {{ OPENPOST_RELAY_UPSTREAM_HOST }}:{{ OPENPOST_RELAY_UPSTREAM_PORT }}; } + upstream shared_proxy_http { + server {{ OPENPOST_RELAY_UPSTREAM_HOST }}:{{ OPENPOST_RELAY_UPSTREAM_HTTP_PORT }}; + } + upstream refused { server 127.0.0.1:9; } @@ -31,4 +35,10 @@ stream { proxy_pass $relay_upstream; proxy_connect_timeout 5s; } + + server { + listen {{ lookup('config', application_id, 'services.relay.ports.internal.http') }}; + proxy_pass shared_proxy_http; + proxy_connect_timeout 5s; + } } From 2335c6351f7b757c720ea5eaa94f3018c03a7f3b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:37 +0200 Subject: [PATCH 207/554] test(web-app-openpost): snapshot the stack host's public view for the probe --- roles/web-app-openpost/tasks/00_core.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index 260427bd75..df5d7a2ed2 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -1,9 +1,26 @@ --- - include_tasks: utils/once/flag.yml -- name: "🧭 Remember the stack host address that serves the public vhosts to swarm peers" +- name: "🧭 Remember the public view of this deploy for the CLI probe" ansible.builtin.set_fact: - openpost_stack_address: "{{ hostvars[STACK_HOST].ansible_facts.default_ipv4.address if DEPLOYMENT_MODE == 'swarm' else '' }}" + openpost_public_view: + proxy_address: "{{ hostvars[STACK_HOST].ansible_facts.default_ipv4.address if DEPLOYMENT_MODE == 'swarm' else '' }}" + public_url: "{{ OPENPOST_URL }}" + api_headers: "{{ OPENPOST_API_HEADERS }}" + s3_public_url: "{{ lookup('objstore', application_id, 'public_url') | regex_replace('/?$', '/') if OPENPOST_OBJSTORE_ENABLED | bool else '' }}" + mail_host: "{{ lookup('email', application_id).host if OPENPOST_EMAIL_ENABLED | bool else '' }}" + relay_targets: >- + {%- set _targets = {} -%} + {%- for _key, _role in OPENPOST_RELAY_SIBLINGS.items() if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} + {%- set _ = _targets.update({_key: lookup('domain', _role)}) -%} + {%- endfor -%} + {{ _targets }} + routes: >- + {%- set _routes = [] -%} + {%- for _route in OPENPOST_CROSSPOSTER_ROUTES -%} + {%- set _ = _routes.append({'name': _route.name, 'platform': _route.source.platform, 'base_url': _route.source.base_url, 'account': _route.source.account, 'mode': _route.mode, 'tags': _route.filters.tags, 'social_set': _route.targets.social_set | default('', true)}) -%} + {%- endfor -%} + {{ _routes }} - name: "🔗 Pin OpenPost apps on the sibling Mastodon and Pixelfed instances" include_tasks: 01_fediverse_apps.yml From d1c34cca0ec2bb836f641abf3b994b308518550d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:37 +0200 Subject: [PATCH 208/554] test(web-app-openpost): render the probe from the stack host's public view --- roles/web-app-openpost/templates/test.env.j2 | 23 +++++++------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index a72a123818..4296723615 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -1,17 +1,14 @@ +{% set _view = hostvars[STACK_HOST].openpost_public_view %} OPENPOST_ADMIN_EMAIL={{ OPENPOST_ADMIN_EMAIL }} OPENPOST_ADMIN_PASSWORD_B64={{ OPENPOST_ADMIN_PASSWORD | b64encode }} -OPENPOST_API_HEADERS_B64={{ OPENPOST_API_HEADERS | to_json | b64encode }} +OPENPOST_API_HEADERS_B64={{ _view.api_headers | to_json | b64encode }} OPENPOST_CONTAINER={{ CLI_LOCAL_CID }} OPENPOST_DEADLINE_SECONDS={{ lookup('timeout', 600) | int }} OPENPOST_LOCAL_URL={{ OPENPOST_LOCAL_URL }} -OPENPOST_PUBLIC_URL={{ OPENPOST_URL }} -OPENPOST_PROXY_ADDRESS={{ openpost_stack_address }} +OPENPOST_PUBLIC_URL={{ _view.public_url }} +OPENPOST_PROXY_ADDRESS={{ _view.proxy_address }} OPENPOST_SSO_ENABLED={{ OPENPOST_OIDC_ENABLED | bool | string | lower }} -{% set _targets = {} %} -{% for _key, _role in OPENPOST_RELAY_SIBLINGS.items() if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool %} -{% set _ = _targets.update({_key: lookup('domain', _role)}) %} -{% endfor %} -OPENPOST_RELAY_TARGETS='{{ _targets | to_json }}' +OPENPOST_RELAY_TARGETS='{{ _view.relay_targets | to_json }}' OPENPOST_RELAY_PORT={{ lookup('config', application_id, 'services.relay.ports.internal.https') }} {% set _platforms = [] %} {% for _provider in (lookup('config', application_id, 'services.simulator.providers') if OPENPOST_SIMULATOR_ENABLED | bool else []) %} @@ -23,7 +20,7 @@ OPENPOST_SIMULATOR_PLATFORMS='{{ _platforms | to_json }}' {% set _ = _unconfigured.extend(OPENPOST_PROVIDER_APP_KEYS[_provider] if _provider in OPENPOST_PROVIDER_APP_KEYS else [_provider]) %} {% endfor %} OPENPOST_UNCONFIGURED_PLATFORMS='{{ _unconfigured | to_json }}' -OPENPOST_S3_PUBLIC_URL={{ lookup('objstore', application_id, 'public_url') | regex_replace('/?$', '/') if OPENPOST_OBJSTORE_ENABLED | bool else '' }} +OPENPOST_S3_PUBLIC_URL={{ _view.s3_public_url }} OPENPOST_SIMULATOR_HOST={{ OPENPOST_SIMULATOR_HOSTS | first }} OPENPOST_DB_CONTAINER={{ lookup('database', application_id, 'address') }} OPENPOST_DB_NAME={{ lookup('database', application_id, 'name') }} @@ -35,13 +32,9 @@ OPENPOST_MEMBER_EMAIL={{ lookup('users', 'administrator').email | regex_replace( OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'administrator').password ~ ':' ~ application_id ~ ':cli-member') | hash('sha256') | b64encode }} OPENPOST_SSO_ADMIN_EMAIL={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_OIDC_ENABLED | bool else '' }} OPENPOST_MAIL_RECIPIENT={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_EMAIL_ENABLED | bool else '' }} -OPENPOST_MAIL_HOST={{ lookup('email', application_id).host if OPENPOST_EMAIL_ENABLED | bool else '' }} +OPENPOST_MAIL_HOST={{ _view.mail_host }} OPENPOST_MAIL_PASSWORD_B64={{ lookup('users', 'administrator').password | b64encode }} -{% set _routes = [] %} -{% for _route in OPENPOST_CROSSPOSTER_ROUTES %} -{% set _ = _routes.append({'name': _route.name, 'platform': _route.source.platform, 'base_url': _route.source.base_url, 'account': _route.source.account, 'mode': _route.mode, 'tags': _route.filters.tags, 'social_set': _route.targets.social_set | default('', true)}) %} -{% endfor %} -OPENPOST_CROSSPOSTER_ROUTES_B64={{ _routes | to_json | b64encode }} +OPENPOST_CROSSPOSTER_ROUTES_B64={{ _view.routes | to_json | b64encode }} OPENPOST_CROSSPOSTER_POLL_SECONDS={{ OPENPOST_CROSSPOSTER.poll_interval_seconds }} OPENPOST_CROSSPOSTER_RETRY_SECONDS={{ (OPENPOST_CROSSPOSTER.retry.max_attempts | int) * (OPENPOST_CROSSPOSTER.retry.cap_seconds | int) }} {% if OPENPOST_CROSSPOSTER_ENABLED | bool %} From 6ea637fbf6e49466c3910003bb937e12e4ced846 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:37 +0200 Subject: [PATCH 209/554] test(web-app-openpost): pin public http and https to the stack host --- roles/web-app-openpost/files/test/openpost/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/api.py b/roles/web-app-openpost/files/test/openpost/api.py index d5005fe0cb..f02bfaa227 100644 --- a/roles/web-app-openpost/files/test/openpost/api.py +++ b/roles/web-app-openpost/files/test/openpost/api.py @@ -55,12 +55,12 @@ ADMIN_EMAIL = os.environ["OPENPOST_ADMIN_EMAIL"] ADMIN_PASSWORD = base64.b64decode(os.environ["OPENPOST_ADMIN_PASSWORD_B64"]).decode() RELAY_TARGETS = json.loads(os.environ["OPENPOST_RELAY_TARGETS"]) DEADLINE = time.monotonic() + int(os.environ["OPENPOST_DEADLINE_SECONDS"]) -PUBLIC_URL = public_url(os.environ["OPENPOST_PUBLIC_URL"]).rstrip("/") +PUBLIC_URL = os.environ["OPENPOST_PUBLIC_URL"].rstrip("/") SSO_ENABLED = os.environ["OPENPOST_SSO_ENABLED"] == "true" CONTAINER = os.environ["OPENPOST_CONTAINER"] SIMULATOR_PLATFORMS = json.loads(os.environ["OPENPOST_SIMULATOR_PLATFORMS"]) UNCONFIGURED_PLATFORMS = json.loads(os.environ["OPENPOST_UNCONFIGURED_PLATFORMS"]) -S3_PUBLIC_URL = public_url(os.environ["OPENPOST_S3_PUBLIC_URL"]) +S3_PUBLIC_URL = os.environ["OPENPOST_S3_PUBLIC_URL"] SIMULATOR_ADMIN = "https://" + os.environ["OPENPOST_SIMULATOR_HOST"] + "/__admin" DB_CONTAINER = os.environ["OPENPOST_DB_CONTAINER"] DB_NAME = os.environ["OPENPOST_DB_NAME"] From 585eb592f6de773bffdb08b116c2209e9c4131d2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:38 +0200 Subject: [PATCH 210/554] test(web-app-openpost): take crossposter routes from the public view --- .../web-app-openpost/files/test/openpost/crossposter.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/crossposter.py b/roles/web-app-openpost/files/test/openpost/crossposter.py index 63ce9b3ddb..2eac580f40 100644 --- a/roles/web-app-openpost/files/test/openpost/crossposter.py +++ b/roles/web-app-openpost/files/test/openpost/crossposter.py @@ -18,7 +18,7 @@ import time import urllib.parse from pathlib import Path -from openpost.api import DEADLINE, accounts, call, check, public_url, render_media +from openpost.api import DEADLINE, accounts, call, check, render_media from openpost.journal import hits, statuses from openpost.mailbox import reports_naming from openpost.simulator import SCENARIOS, simulator_admin @@ -29,12 +29,7 @@ from openpost.sources import ( pixelfed_post, ) -ROUTES = [ - {**route, "base_url": public_url(route["base_url"])} - for route in json.loads( - base64.b64decode(os.environ["OPENPOST_CROSSPOSTER_ROUTES_B64"]) - ) -] +ROUTES = json.loads(base64.b64decode(os.environ["OPENPOST_CROSSPOSTER_ROUTES_B64"])) SECRETS_FILE = os.environ["OPENPOST_CROSSPOSTER_SECRETS_FILE"] CROSSPOSTER = os.environ["OPENPOST_CROSSPOSTER_CONTAINER"] CONFIG = os.environ["OPENPOST_CROSSPOSTER_CONFIG"] From cd0960a9d3a6ee60dcfbc11f57848a7d275e3fd8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:38 +0200 Subject: [PATCH 211/554] test(web-app-openpost): check workspace roles only where self-registration is open --- roles/web-app-openpost/files/test/openpost/simulator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/test/openpost/simulator.py b/roles/web-app-openpost/files/test/openpost/simulator.py index 85d58d27f7..ba75549bcd 100644 --- a/roles/web-app-openpost/files/test/openpost/simulator.py +++ b/roles/web-app-openpost/files/test/openpost/simulator.py @@ -17,6 +17,7 @@ from openpost.api import ( MEMBER_USERNAME, SIMULATOR_ADMIN, SIMULATOR_PLATFORMS, + SSO_ENABLED, accounts, call, call_raw, @@ -342,7 +343,11 @@ def check_simulator(token: str, workspace: str) -> None: if status != 200: sys.exit(f"[FAIL] publish-now for {label} returned HTTP {status}: {body}") publications[label] = str(publication["id"]) - if "x" in connected: + if not SSO_ENABLED: + print( + "[SKIP] workspace roles: without SSO the role closes self-registration, so no second account can exist" + ) + elif "x" in connected: tags["member"] = f"openpost-cli-member-{nonce}" promoted = check_roles(token, workspace, connected["x"][0], tags["member"]) if promoted: From 9600f75d4fa1caa8507b5654a367019b0a23db73 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:26:38 +0200 Subject: [PATCH 212/554] docs(web-app-openpost): document the relay's plain http leg --- roles/web-app-openpost/Administration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 311d2c2f09..3a05ebb253 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -51,6 +51,7 @@ The role therefore runs an `nginx` stream relay next to OpenPost: - The relay carries the canonical domains of the deployed Mastodon, Pixelfed and PeerTube roles, and the public domain of the object store, as network aliases, so OpenPost resolves those names to the relay. OpenPost writes media to the object store's public endpoint because browsers upload through the same presigned URLs; the alias keeps those writes on the shared proxy even where that public name only resolves through Tor. - The relay reads the SNI of each TLS connection, forwards a mapped name unchanged to the shared OpenResty proxy and closes every other connection. +- Onion services carry no TLS, so the relay also forwards plain HTTP on port 80 to the proxy, which routes it by `Host`; only the aliased names resolve to the relay. It forwards to `host.docker.internal`, which points at the Docker host in compose and at the stack host in swarm. - TLS stays end to end between OpenPost and OpenResty; in self-signed mode OpenPost trusts the platform CA through the compose CA injection. From 237ea22f94d4fe1b39ba5a5332aae365c2373954 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:58:40 +0200 Subject: [PATCH 213/554] chore(networks): widen the local http port band up to typesense --- group_vars/all/08_networks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/group_vars/all/08_networks.yml b/group_vars/all/08_networks.yml index 79e669a786..417c8c213a 100644 --- a/group_vars/all/08_networks.yml +++ b/group_vars/all/08_networks.yml @@ -38,7 +38,7 @@ PORT_BANDS: # nocheck: unused-var # consumed by the port-allocation plugin outs local: http: start: 8001 - end: 8099 + end: 8107 agent: start: 8500 end: 8599 From a846a4c48fa71d332f64cf2f853522ebbd5ed75a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:58:40 +0200 Subject: [PATCH 214/554] fix(web-app-openpost): move the local port off jitsi's 8098 --- roles/web-app-openpost/meta/services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index ddbaeaedb7..62cde359c2 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -82,7 +82,7 @@ openpost: internal: http: 8080 local: - http: 8098 + http: 8100 run_after: - svc-db-postgres - web-app-keycloak From 88560f8bbdce7857fd862fd00708379b0cf729dc Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 09:58:40 +0200 Subject: [PATCH 215/554] docs(requirements): record openpost's new local port --- docs/requirements/040-web-app-openpost.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements/040-web-app-openpost.md b/docs/requirements/040-web-app-openpost.md index b584877404..088c13d6ec 100644 --- a/docs/requirements/040-web-app-openpost.md +++ b/docs/requirements/040-web-app-openpost.md @@ -169,7 +169,7 @@ openpost: internal: http: 8080 local: - http: 8098 + http: 8100 lifecycle: alpha relay: image: nginx From 877d8fda5556e352ec22b00fb18aeacf30e4f78a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:09 +0200 Subject: [PATCH 216/554] feat(web-app-openpost): wait until OpenPost confirms public media URLs publish-now refuses a publication whose media OpenPost has not yet fetched from its public URL (400 "public media URL returned 404"). --- .../files/crossposter/crossposter/openpost.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py index a06f09f76f..3874e1ba8e 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py @@ -1,6 +1,7 @@ from __future__ import annotations import json +import time import urllib.parse from dataclasses import dataclass from typing import TYPE_CHECKING @@ -13,6 +14,10 @@ if TYPE_CHECKING: from crossposter.config import Targets +PUBLIC_MEDIA_POLLS = 20 +PUBLIC_MEDIA_POLL_SECONDS = 3 + + @dataclass(frozen=True) class Destination: account_id: str @@ -148,6 +153,22 @@ class OpenPost: } return dict(self._call("POST", "/publications", payload, key, (200, 201))) + def await_public_media(self, publication_id: str) -> None: + for _ in range(PUBLIC_MEDIA_POLLS): + media = (self.get(f"/publications/{publication_id}") or {}).get("media") + if all( + item.get("public_url_checked_at") and item.get("public_url_ready") + for item in media or [] + ): + return + time.sleep(PUBLIC_MEDIA_POLL_SECONDS) + raise web.RequestError( + f"{self.base_url}/publications/{publication_id}", + 503, + {}, + "OpenPost has not confirmed the public media URLs yet", + ) + def publish_now(self, publication: dict) -> None: self._call( "POST", From 9a52a07227cc857b13bd9e270b077949bc4f23af Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:09 +0200 Subject: [PATCH 217/554] fix(web-app-openpost): publish media posts only once their URLs are public --- roles/web-app-openpost/files/crossposter/crossposter/service.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/service.py b/roles/web-app-openpost/files/crossposter/crossposter/service.py index ce2c77b5c1..7acc93fe54 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/service.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/service.py @@ -211,6 +211,8 @@ class Service: state = store.transition("pending", "drafted") else: if str(publication.get("status")) == "draft": + if media: + self.openpost.await_public_media(str(publication["id"])) self.openpost.publish_now(publication) state = store.transition("pending", "submitted") self.store.update(row["id"], state, str(publication["id"]), attempts, "", 0) From d0d287d66147e78eb8237ab5077438938793e815 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:09 +0200 Subject: [PATCH 218/554] test(web-app-openpost): cover the public media wait --- .../crossposter/crossposter/test_openpost.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py index 87e07dab9e..aad9074474 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py @@ -160,3 +160,42 @@ class TestRequests(unittest.TestCase): self.assertTrue( fake.calls[-1][1].endswith("/media/upload-session/media-1/complete") ) + + +class TestPublicMedia(unittest.TestCase): + def answers(self, states: list[list[dict]]) -> list[str]: + asked: list[str] = [] + + def request(method, url, headers, body, accepted) -> web.Response: + asked.append(url) + media = states[min(len(asked), len(states)) - 1] + return web.Response(200, {}, json.dumps({"media": media}).encode()) + + self.request = request + return asked + + def test_publishing_waits_until_every_medium_is_public(self) -> None: + asked = self.answers( + [ + [{"public_url_checked_at": None}], + [{"public_url_checked_at": "now", "public_url_ready": False}], + [{"public_url_checked_at": "now", "public_url_ready": True}], + ] + ) + with ( + patch.object(openpost.web, "request", self.request), + patch.object(openpost.time, "sleep", lambda seconds: None), + ): + client().await_public_media("pub-1") + self.assertEqual(len(asked), 3) + self.assertTrue(asked[0].endswith("/publications/pub-1")) + + def test_media_that_never_turns_public_is_a_transient_error(self) -> None: + self.answers([[{"public_url_checked_at": "now", "public_url_ready": False}]]) + with ( + patch.object(openpost.web, "request", self.request), + patch.object(openpost.time, "sleep", lambda seconds: None), + self.assertRaises(web.RequestError) as raised, + ): + client().await_public_media("pub-1") + self.assertTrue(raised.exception.transient) From 4f8a2746282b48014f0eb7d636ce787c813e27f8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:09 +0200 Subject: [PATCH 219/554] fix(web-app-openpost): read route hashtags from the post text too Pixelfed fills its tag list after the status is created and PeerTube drops multipart tags, so the API tag list alone missed tagged posts. --- .../files/crossposter/crossposter/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/config.py b/roles/web-app-openpost/files/crossposter/crossposter/config.py index 4c10c23c03..81c90793e1 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/config.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/config.py @@ -6,6 +6,7 @@ from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING +from crossposter import adapt from crossposter.notify import Mail if TYPE_CHECKING: @@ -60,7 +61,10 @@ class Route: return self.attribution.get(network, self.attribution["default"]) def refusal(self, item: SourceItem, opt_out_tag: str) -> str | None: - tags = {tag.lower() for tag in item.tags} + tags = { + tag.lower().lstrip("#") + for tag in (*item.tags, *adapt.HASHTAG_RE.findall(item.text)) + } if opt_out_tag.lower() in tags: return "opt-out" if item.application == LOOP_APPLICATION: From 11f107e9bd1abc660d64f2282254b609d955f8c3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:10 +0200 Subject: [PATCH 220/554] test(web-app-openpost): match tag filters and opt-out against text hashtags --- .../crossposter/crossposter/test_config.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py index 61c8b39758..c0c4deefbe 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py @@ -205,6 +205,23 @@ class TestRouting(ConfigFixture, unittest.TestCase): self.assertEqual(tagged.refusal(item(), "nocrosspost"), "tags") self.assertIsNone(tagged.refusal(item(tags=("Press",)), "nocrosspost")) + def test_hashtags_in_the_text_count_when_the_source_lists_no_tags(self) -> None: + raw = copy.deepcopy(self.raw) + raw["routes"][0]["filters"]["tags"] = ["press"] + tagged = config.parse(raw).routes[0] + self.assertIsNone( + tagged.refusal(item(text="Launch day #Press", tags=()), "nocrosspost") + ) + self.assertEqual( + tagged.refusal(item(text="Press day", tags=()), "nocrosspost"), "tags" + ) + + def test_the_opt_out_hashtag_in_the_text_is_never_forwarded(self) -> None: + self.assertEqual( + self.route.refusal(item(text="Hi #NoCrossPost", tags=()), "nocrosspost"), + "opt-out", + ) + def test_media_filters(self) -> None: raw = copy.deepcopy(self.raw) raw["routes"][0]["filters"]["media"] = "required" From 829fdfad1b7c26cd4180ecfc18129901909e620e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:10 +0200 Subject: [PATCH 221/554] fix(web-app-openpost): give probe social sets a default output format OpenPost refuses social set defaults for YouTube and TikTok without default_output_profile (400 "choose a format before setting Social Set defaults"). --- roles/web-app-openpost/files/test/openpost/crossposter.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/web-app-openpost/files/test/openpost/crossposter.py b/roles/web-app-openpost/files/test/openpost/crossposter.py index 2eac580f40..426e7051a1 100644 --- a/roles/web-app-openpost/files/test/openpost/crossposter.py +++ b/roles/web-app-openpost/files/test/openpost/crossposter.py @@ -43,6 +43,7 @@ MEMBERS = { ("peertube", "auto"): ("youtube",), } SETTINGS = {label: settings for label, _, _, _, settings in SCENARIOS if settings} +FORMATS = {"youtube": "youtube.video", "tiktok": "tiktok.photo"} SQL = ( "import json, sys, psycopg\n" "from crossposter import config\n" @@ -130,6 +131,11 @@ def fill_sets(token: str, workspace: str) -> None: { "social_account_id": connected[platform][0], "default_settings": SETTINGS.get(platform, {}), + **( + {"default_output_profile": FORMATS[platform]} + if platform in SETTINGS + else {} + ), } for platform in MEMBERS[(route["platform"], route["mode"])] if connected.get(platform) From d07af1675552bb9c2ffbd2a2e84c3eb10cacc1a6 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:10 +0200 Subject: [PATCH 222/554] fix(web-app-openpost): tag the probe's PeerTube upload in its description --- roles/web-app-openpost/files/test/openpost/sources.py | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/test/openpost/sources.py b/roles/web-app-openpost/files/test/openpost/sources.py index e38bf922cc..52909edf9f 100644 --- a/roles/web-app-openpost/files/test/openpost/sources.py +++ b/roles/web-app-openpost/files/test/openpost/sources.py @@ -141,6 +141,7 @@ def peertube_upload( { "channelId": str(found["id"]), "name": name, + "description": f"{name} #{tag}", "privacy": "1", "waitTranscoding": "false", "tags[]": [tag], From ddab6e806f96d9556090ba2bf0f34043eaee5b8a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:10 +0200 Subject: [PATCH 223/554] fix(web-app-openpost): pin fediverse servers under a name OpenPost lists OpenPost hides a pinned server whose name equals its URL from the connect dialog, which then registers its own app and accepts only https instances, so onion Pixelfed failed with "instance_url scheme must be https". A trailing slash keeps the name distinct while the code exchange trims it back to the canonical URL for readiness. The root CA flag covers onion-primary OpenPost: it gets no CA injection, yet still talks to the clearnet HTTPS S3 vhost. --- roles/web-app-openpost/vars/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 2483010969..a9b0581b92 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -14,6 +14,7 @@ OPENPOST_RELAY_CONF_HOST: "{{ [lookup('container', application_id, 'directories. OPENPOST_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}" OPENPOST_EMAIL_ENABLED: "{{ lookup('config', application_id, 'services.email.enabled') }}" OPENPOST_OBJSTORE_ENABLED: "{{ lookup('objstore', application_id, 'enabled') }}" +OPENPOST_ROOT_CA_TRUSTED: "{{ OPENPOST_OBJSTORE_ENABLED | bool and TLS_MODE == 'self_signed' }}" OPENPOST_JWT_SECRET: "{{ lookup('config', application_id, 'secrets.credentials.jwt_secret') }}" OPENPOST_ENCRYPTION_KEY: "{{ lookup('config', application_id, 'secrets.credentials.encryption_key') }}" @@ -53,7 +54,8 @@ OPENPOST_PINNED_INSTANCES: >- {%- set _instances = [] -%} {%- for _key in ['mastodon', 'pixelfed'] -%} {%- if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} - {%- set _ = _instances.append({'platform': _key, 'url': lookup('tls', OPENPOST_RELAY_SIBLINGS[_key], 'url.base') | regex_replace('/+$', '')}) -%} + {%- set _url = lookup('tls', OPENPOST_RELAY_SIBLINGS[_key], 'url.base') | regex_replace('/+$', '') -%} + {%- set _ = _instances.append({'platform': _key, 'url': _url, 'name': _url ~ '/'}) -%} {%- endif -%} {%- endfor -%} {{ _instances }} From 12ef78f62de0b5a7a697d96b0c666ec5d32af487 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:10 +0200 Subject: [PATCH 224/554] fix(web-app-openpost): mount the root CA when S3 runs on a self-signed vhost Tor rounds failed at startup with x509 unknown authority against api.seaweedfs.s3: ca_injected is false for an onion-primary app. --- roles/web-app-openpost/meta/volumes.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/volumes.yml b/roles/web-app-openpost/meta/volumes.yml index ba88553040..7a18d3f89c 100644 --- a/roles/web-app-openpost/meta/volumes.yml +++ b/roles/web-app-openpost/meta/volumes.yml @@ -30,9 +30,18 @@ simulator_ca: mode: "0444" mounts: - service: openpost - target: /etc/ssl/openpost-simulator/ca.crt + target: /etc/ssl/openpost-trust/simulator-ca.crt when: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" +root_ca: + type: config + source: "{{ CA_TRUST.cert_host }}" + mode: "0444" + mounts: + - service: openpost + target: /etc/ssl/openpost-trust/root-ca.crt + when: "{{ (lookup('objstore', 'web-app-openpost', 'enabled') | bool) and TLS_MODE == 'self_signed' }}" + crossposter_config: type: config source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'crossposter', 'crossposter.json'] | path_join }}" From 0582d3917bea59bc1df49c13c5fb209934afcf05 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:10 +0200 Subject: [PATCH 225/554] fix(web-app-openpost): trust the root CA and name pinned servers apart from their URL --- roles/web-app-openpost/templates/env.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/templates/env.j2 b/roles/web-app-openpost/templates/env.j2 index c52d215cef..71d612b511 100644 --- a/roles/web-app-openpost/templates/env.j2 +++ b/roles/web-app-openpost/templates/env.j2 @@ -64,7 +64,7 @@ OPENPOST_SMTP_TLS_MODE={{ 'tls' if email.tls | bool else 'starttls' }} {% for _platform in ['mastodon', 'pixelfed'] %} {% set _servers = [] %} {% for _instance in OPENPOST_PINNED_INSTANCES if _instance.platform == _platform and _instance.url in openpost_fediverse_apps %} -{% set _ = _servers.append({'name': _instance.url, 'instance_url': _instance.url, 'client_id': openpost_fediverse_apps[_instance.url].client_id, 'client_secret': openpost_fediverse_apps[_instance.url].client_secret}) %} +{% set _ = _servers.append({'name': _instance.name, 'instance_url': _instance.url, 'client_id': openpost_fediverse_apps[_instance.url].client_id, 'client_secret': openpost_fediverse_apps[_instance.url].client_secret}) %} {% endfor %} {% if _servers %} {{ _platform | upper }}_SERVERS={{ _servers | to_json(separators=[',', ':']) | dotenv_quote }} @@ -78,6 +78,6 @@ OPENPOST_SMTP_TLS_MODE={{ 'tls' if email.tls | bool else 'starttls' }} {% if OPENPOST_PROVIDER_APPS | length > 0 %} OPENPOST_PROVIDER_APPS={{ OPENPOST_PROVIDER_APPS | to_json(separators=[',', ':']) | dotenv_quote }} {% endif %} -{% if OPENPOST_SIMULATOR_ENABLED | bool %} -SSL_CERT_DIR={{ lookup('volume', application_id, 'simulator_ca').target | dirname }}:/etc/ssl/certs +{% if OPENPOST_SIMULATOR_ENABLED | bool or OPENPOST_ROOT_CA_TRUSTED | bool %} +SSL_CERT_DIR={{ lookup('volume', application_id, 'root_ca').target | dirname }}:/etc/ssl/certs {% endif %} From 744685198e717dd9ae33470ef3dd64b0dcd16766 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:11 +0200 Subject: [PATCH 226/554] fix(web-app-openpost): connect the seed Mastodon account through the pinned server The instance_url path is OpenPost's own registration, which refuses the plain HTTP onion instance. --- .../web-app-openpost/tasks/crossposter/seed/connect.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml index e7380751e7..97d4b37cc1 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml @@ -1,4 +1,8 @@ --- +- name: "📌 Pick the pinned Mastodon server OpenPost connects through" + ansible.builtin.set_fact: + openpost_crossposter_mastodon_server: "{{ OPENPOST_PINNED_INSTANCES | selectattr('platform', 'equalto', 'mastodon') | map(attribute='name') | first }}" + - name: "🔍 Resolve the Mastodon container that grants the OpenPost app" ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" vars: @@ -9,7 +13,7 @@ - name: "🧭 Ask OpenPost for the Mastodon authorization it would start" uri_retry: - url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts/mastodon/auth-url?workspace_id={{ openpost_crossposter_target_workspace }}&instance_url={{ openpost_crossposter_mastodon_route.source.base_url | urlencode }}" + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/accounts/mastodon/auth-url?workspace_id={{ openpost_crossposter_target_workspace }}&server_name={{ openpost_crossposter_mastodon_server | urlencode }}" headers: "{{ openpost_breakglass_headers }}" status_code: 200 register: openpost_crossposter_mastodon_authorize @@ -54,8 +58,7 @@ body_format: json body: code: "{{ (openpost_crossposter_mastodon_grant.stdout_lines | select('match', 'CROSSPOSTER_GRANT=') | first) | replace('CROSSPOSTER_GRANT=', '') | trim }}" - instance_url: "{{ openpost_crossposter_mastodon_route.source.base_url }}" - server_name: "{{ openpost_crossposter_mastodon_route.source.base_url }}" + server_name: "{{ openpost_crossposter_mastodon_server }}" workspace_id: "{{ openpost_crossposter_target_workspace }}" status_code: [200, 201] retries: 0 From 82c3cd0308f4f9aedf0090f6e7e8f9a5c0905cf5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 16:04:11 +0200 Subject: [PATCH 227/554] docs(web-app-openpost): document pinned server naming and root CA trust --- roles/web-app-openpost/Administration.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 3a05ebb253..ae0747586f 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -74,8 +74,10 @@ A network whose entry is incomplete (`lookup('api_enabled', '')` is fa | `tiktok` | `OPENPOST_PROVIDER_APPS` entry `tiktok` | TikTok | Mastodon, Pixelfed, PeerTube and Bluesky need no operator credentials: PeerTube exchanges the user's password once for tokens, and Bluesky uses an app password. -For Mastodon and Pixelfed the deploy registers an `OpenPost` app on every deployed sibling instance once, stores its credentials in `fediverse-apps.json` in the role's config directory and renders them into `MASTODON_SERVERS` and `PIXELFED_SERVERS`, named by the instance's canonical URL. +For Mastodon and Pixelfed the deploy registers an `OpenPost` app on every deployed sibling instance once, stores its credentials in `fediverse-apps.json` in the role's config directory and renders them into `MASTODON_SERVERS` and `PIXELFED_SERVERS`, named by the instance's canonical URL with a trailing slash. OpenPost v7.22.9 can register apps on any other instance by itself, but its code exchange then checks provider readiness against the bare host name the dialog sends and refuses with `provider operation is not ready: needs_configuration`; an external instance therefore needs the same pinning through those two variables. +The name has to differ from the URL, because OpenPost hides a server named exactly like its URL from the connect dialog, which then falls back to its own registration and accepts only `https://` instances. +Its code exchange strips the trailing slash, so readiness still matches the canonical URL, and onion instances served over plain HTTP connect through the pinned app. Every callback URL has the form `https://publish./api/v1/accounts//callback`. ## Provider simulator @@ -236,6 +238,7 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo ## Backup, restore and upgrades - With `web-app-seaweedfs` deployed, browsers upload media directly to its public S3 vhost through presigned URLs, which is why `OPENPOST_S3_ENDPOINT` is the public endpoint and the CSP allows it in `connect-src`; OpenPost deduplicates identical files by content hash. + With `TLS_MODE=self_signed` the role mounts the root CA into OpenPost and adds it to `SSL_CERT_DIR`, because an onion-primary OpenPost receives no CA injection while that vhost stays on clearnet HTTPS. - The platform backup covers the OpenPost database in the shared Postgres and the `openpost_media` volume; media in `web-app-seaweedfs` is covered by that role's backup. - A restore needs the database, the media and the inventory secrets, especially `encryption_key`; without it the stored provider tokens cannot be decrypted and every network has to be reconnected. The key is pinned `rotatable: false` because OpenPost refuses to start once a stored row no longer decrypts; the other secrets rotate freely. - Changing the pinned version in `meta/services.yml` and redeploying runs OpenPost's own migrations, which take a Postgres advisory lock. From e55a4a5fe19a052d58be9032a228c2bc3a3b45b1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 20:35:25 +0200 Subject: [PATCH 228/554] refactor(web-app-openpost): share the Pixelfed PHP user and pinned Pixelfed list --- roles/web-app-openpost/vars/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index a9b0581b92..5220b51433 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -59,6 +59,7 @@ OPENPOST_PINNED_INSTANCES: >- {%- endif -%} {%- endfor -%} {{ _instances }} +OPENPOST_PINNED_PIXELFED: "{{ OPENPOST_PINNED_INSTANCES | selectattr('platform', 'equalto', 'pixelfed') | list }}" OPENPOST_FEDIVERSE_APPS_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'fediverse-apps.json'] | path_join }}" OPENPOST_RELAY_UPSTREAM_HOST: "host.docker.internal" OPENPOST_RELAY_UPSTREAM_PORT: "{{ lookup('config', 'svc-prx-openresty', 'services.openresty.ports.public.https') }}" @@ -118,5 +119,5 @@ OPENPOST_CROSSPOSTER_SEED_PROBES: mastodon: /api/v1/accounts/verify_credentials pixelfed: /api/v1/accounts/verify_credentials peertube: /api/v1/users/me -OPENPOST_SEED_PIXELFED_USER: "33" +OPENPOST_PIXELFED_PHP_USER: "33" OPENPOST_SEED_PEERTUBE_USERNAME: "root" From b2bb14c1da3e49882452ebbd98dcd1766ffa95bd Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 20:35:25 +0200 Subject: [PATCH 229/554] refactor(web-app-openpost): run the Pixelfed seed as the shared PHP user --- roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml index 4cf5469719..477553026e 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml @@ -13,7 +13,7 @@ - container - exec - -u - - "{{ OPENPOST_SEED_PIXELFED_USER }}" + - "{{ OPENPOST_PIXELFED_PHP_USER }}" - -e - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_PIXELFED_LOCAL_CID resolved at delegate_to runtime From b957fd0c71c249333ec136385036730d2dac8ed9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 20:35:26 +0200 Subject: [PATCH 230/554] fix(web-app-openpost): give OpenPost's Pixelfed app an owner Pixelfed registers API apps without user_id, so Passport 13 derives the client_credentials grant for them and its TokenGuard drops every token whose user id equals the client id. On a fresh instance the pinned app is client 1 and the administrator is user 1: the token exchange succeeds, verify_credentials answers 401 and OpenPost stores a placeholder pixelfed-user profile. An owned client is not first party, so the guard keeps its tokens. --- .../tasks/fediverse/pixelfed_owner.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml diff --git a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml new file mode 100644 index 0000000000..f74b3f71f0 --- /dev/null +++ b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml @@ -0,0 +1,38 @@ +--- +- name: "🔍 Resolve the Pixelfed container that owns OpenPost's app" + ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" + vars: + resolve_service_key: pixelfed + resolve_service_name: "{{ lookup('container_service', 'web-app-pixelfed', 'pixelfed') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_output_prefix: OPENPOST_PIXELFED + resolve_compose_cid: "{{ lookup('config', 'web-app-pixelfed', 'services.pixelfed.name') }}" + +- name: "👤 Give OpenPost's Pixelfed app an owner so Passport accepts its tokens" + ansible.builtin.command: + argv: + - container + - exec + - -u + - "{{ OPENPOST_PIXELFED_PHP_USER }}" + - -e + - "OPENPOST_CLIENT_ID={{ openpost_fediverse_apps[item.url].client_id }}" + - -e + - "OPENPOST_CLIENT_OWNER={{ lookup('users', 'administrator').username }}" + - "{{ OPENPOST_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_PIXELFED_LOCAL_CID resolved at delegate_to runtime + - php + - -r + - >- + require '/var/www/vendor/autoload.php'; + $app = require '/var/www/bootstrap/app.php'; + $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); + $owner = App\Models\User::where('username', getenv('OPENPOST_CLIENT_OWNER'))->firstOrFail(); + $client = Laravel\Passport\Client::whereKey(getenv('OPENPOST_CLIENT_ID'))->firstOrFail(); + if ((string) $client->user_id !== (string) $owner->id) { $client->forceFill(['user_id' => $owner->id])->save(); echo 'OWNER_SET' . PHP_EOL; } + loop: "{{ OPENPOST_PINNED_PIXELFED }}" + loop_control: + label: "{{ item.url }}" + register: openpost_pixelfed_app_owner + changed_when: "'OWNER_SET' in openpost_pixelfed_app_owner.stdout" + delegate_to: "{{ OPENPOST_PIXELFED_HOST_NODE }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From ff0cadbfd6f9b2de1780ccd0876b29497bfb0102 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 20:35:26 +0200 Subject: [PATCH 231/554] fix(web-app-openpost): set the Pixelfed app owner on every deploy --- roles/web-app-openpost/tasks/01_fediverse_apps.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/web-app-openpost/tasks/01_fediverse_apps.yml b/roles/web-app-openpost/tasks/01_fediverse_apps.yml index 8a54443721..7e12a0d0aa 100644 --- a/roles/web-app-openpost/tasks/01_fediverse_apps.yml +++ b/roles/web-app-openpost/tasks/01_fediverse_apps.yml @@ -48,6 +48,10 @@ {{ _apps }} no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" +- name: "👤 Give OpenPost's Pixelfed app an owner" + ansible.builtin.include_tasks: fediverse/pixelfed_owner.yml + when: OPENPOST_PINNED_PIXELFED | length > 0 + - name: "📁 Ensure the directory for the registered apps exists" ansible.builtin.file: path: "{{ OPENPOST_FEDIVERSE_APPS_HOST | dirname }}" From 3d16fcabf2ec3853a35e330406844e1ac784b8b5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 20:35:26 +0200 Subject: [PATCH 232/554] fix(web-app-openpost): send an empty instance_url to the seed exchange OpenPost's exchange schema requires the instance_url key (422 without it), while a non-empty value would take the https-only dynamic path. --- roles/web-app-openpost/tasks/crossposter/seed/connect.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml index 97d4b37cc1..9e21f4fe66 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml @@ -58,6 +58,7 @@ body_format: json body: code: "{{ (openpost_crossposter_mastodon_grant.stdout_lines | select('match', 'CROSSPOSTER_GRANT=') | first) | replace('CROSSPOSTER_GRANT=', '') | trim }}" + instance_url: "" server_name: "{{ openpost_crossposter_mastodon_server }}" workspace_id: "{{ openpost_crossposter_target_workspace }}" status_code: [200, 201] From 84241bc9afdd273d1e21d3d7b07493fcbe52cabd Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 20:35:26 +0200 Subject: [PATCH 233/554] fix(web-app-openpost): wait for Pixelfed's sign-in form before deciding to log in Over Tor the login page renders after the URL check, so isVisible() read false, the login was skipped and the consent poll timed out. --- .../web-app-openpost/files/playwright/_shared.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index 16478a7336..d6c5d392b5 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -334,15 +334,22 @@ async function pixelfedAuthorizationCode(page, label, redirectedCode) { .poll(() => page.url(), { timeout: resolveTimeout(60_000), message: `${label}: expected Pixelfed's sign-in or consent page` }) .toContain(env.pixelfedBaseUrl); const password = page.locator('input[name="password"]'); - if (!redirectedCode() && (await password.isVisible())) { + const authorize = page.getByRole("button", { name: /^authorize$/i }); + const codeShown = async () => (await page.locator("body").innerText()).includes('"code"'); + const consented = async () => Boolean(redirectedCode()) || (await codeShown()) || (await authorize.isVisible()); + await expect + .poll(async () => (await consented()) || (await password.isVisible()), { + timeout: resolveTimeout(60_000), + message: `${label}: expected Pixelfed's sign-in form, consent screen or authorization code`, + }) + .toBe(true); + if (!(await consented()) && (await password.isVisible())) { await page.locator('input[name="email"]').fill(env.adminEmail); await password.fill(env.adminPassword); await page.locator("form").filter({ has: password }).locator('button[type="submit"]').click(); } - const authorize = page.getByRole("button", { name: /^authorize$/i }); - const codeShown = async () => (await page.locator("body").innerText()).includes('"code"'); await expect - .poll(async () => Boolean(redirectedCode()) || (await codeShown()) || (await authorize.isVisible()), { + .poll(consented, { timeout: resolveTimeout(60_000), message: `${label}: expected Pixelfed's consent screen or its authorization code`, }) From 730553283f01a1ef1378ae87b39a48cf7d053a1d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 24 Oct 2026 20:35:26 +0200 Subject: [PATCH 234/554] docs(web-app-openpost): document the Pixelfed app owner workaround --- roles/web-app-openpost/Administration.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index ae0747586f..748113a035 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -78,6 +78,8 @@ For Mastodon and Pixelfed the deploy registers an `OpenPost` app on every deploy OpenPost v7.22.9 can register apps on any other instance by itself, but its code exchange then checks provider readiness against the bare host name the dialog sends and refuses with `provider operation is not ready: needs_configuration`; an external instance therefore needs the same pinning through those two variables. The name has to differ from the URL, because OpenPost hides a server named exactly like its URL from the connect dialog, which then falls back to its own registration and accepts only `https://` instances. Its code exchange strips the trailing slash, so readiness still matches the canonical URL, and onion instances served over plain HTTP connect through the pinned app. +Pixelfed registers API apps without an owner, and Laravel Passport 13 then treats them as `client_credentials` clients and rejects every token whose user ID equals the app's client ID, which on a fresh instance is the administrator and app number 1. +The deploy therefore makes the Pixelfed administrator the owner of OpenPost's Pixelfed app on every run. Every callback URL has the form `https://publish./api/v1/accounts//callback`. ## Provider simulator From 5acd684ffebd17d8088ded498fe40e9f07583b5d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:43 +0200 Subject: [PATCH 235/554] fix(web-app-openpost): use the media OpenPost keeps and re-check it before publishing complete answers the deduplicated media id; the session's media_id of a repeated upload is an orphan whose public URL is 404. GET never re-checks public URLs, so the wait now runs POST /validate, and it also waits for video analysis, which YouTube publishing requires. --- .../files/crossposter/crossposter/openpost.py | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py index 3874e1ba8e..734e29f0f7 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py @@ -14,8 +14,17 @@ if TYPE_CHECKING: from crossposter.config import Targets -PUBLIC_MEDIA_POLLS = 20 -PUBLIC_MEDIA_POLL_SECONDS = 3 +PUBLIC_MEDIA_POLLS = 24 +PUBLIC_MEDIA_POLL_SECONDS = 5 +ANALYSED = ("ready", "failed") + + +def publishable(medium: dict) -> bool: + public = bool(medium.get("public_url_checked_at") and medium.get("public_url_ready")) + analysed = not str(medium.get("mime_type") or "").startswith("video/") or ( + medium.get("analysis_status") in ANALYSED + ) + return public and analysed @dataclass(frozen=True) @@ -121,8 +130,10 @@ class OpenPost: complete = urllib.parse.urlparse(str(session["complete_url"])).path.split( "/api/v1", 1 )[1] - self._call("POST", complete, {"workspace_id": self.workspace}, "", (200, 201)) - return str(session["media_id"]) + completed = self._call( + "POST", complete, {"workspace_id": self.workspace}, "", (200, 201) + ) + return str(completed["id"]) def create( self, @@ -153,20 +164,23 @@ class OpenPost: } return dict(self._call("POST", "/publications", payload, key, (200, 201))) - def await_public_media(self, publication_id: str) -> None: + def publication(self, publication_id: str) -> dict: + return dict(self.get(f"/publications/{publication_id}") or {}) + + def await_media(self, publication_id: str) -> None: for _ in range(PUBLIC_MEDIA_POLLS): - media = (self.get(f"/publications/{publication_id}") or {}).get("media") - if all( - item.get("public_url_checked_at") and item.get("public_url_ready") - for item in media or [] - ): + self._call( + "POST", f"/publications/{publication_id}/validate", None, "", (200,) + ) + media = self.publication(publication_id).get("media") + if all(publishable(item) for item in media or []): return time.sleep(PUBLIC_MEDIA_POLL_SECONDS) raise web.RequestError( f"{self.base_url}/publications/{publication_id}", 503, {}, - "OpenPost has not confirmed the public media URLs yet", + "OpenPost has not confirmed the public media URLs or video analysis yet", ) def publish_now(self, publication: dict) -> None: @@ -179,5 +193,4 @@ class OpenPost: ) def renditions(self, publication_id: str) -> list[dict]: - body = self.get(f"/publications/{publication_id}") - return list((body or {}).get("renditions") or []) + return list(self.publication(publication_id).get("renditions") or []) From 8b8e6b4b776633230d3f59bc1e9c18c1d0a8921c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:43 +0200 Subject: [PATCH 236/554] fix(web-app-openpost): start a resend without the failed publication --- roles/web-app-openpost/files/crossposter/crossposter/store.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/store.py b/roles/web-app-openpost/files/crossposter/crossposter/store.py index b49f94ebb8..fd3e9064fc 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/store.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/store.py @@ -169,7 +169,8 @@ class Store: next_attempt = datetime.now(UTC) + timedelta(seconds=delay_seconds) self.connection.execute( """UPDATE crossposter.items - SET state = 'pending', resends = resends + 1, attempts = %s, last_error = %s, + SET state = 'pending', resends = resends + 1, publication_id = '', + attempts = %s, last_error = %s, next_attempt_at = %s, updated_at = now() WHERE id = %s""", (attempts, error, next_attempt, row_id), From 947a06a41f1446b9a408d6dd4a1283fcf71770c9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:43 +0200 Subject: [PATCH 237/554] feat(web-app-openpost): re-read a Mastodon or Pixelfed status before delivery --- .../files/crossposter/crossposter/sources/mastodon.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py b/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py index 5040824e6a..ae9a99b316 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py @@ -82,6 +82,10 @@ class MastodonSource: ) return str(statuses[0]["id"]) if statuses else "0" + def refresh(self, item: SourceItem) -> SourceItem: + status = self._get(f"/api/v1/statuses/{item.cursor}", {}) + return parse_status(dict(status), self.platform) + def fetch(self, cursor: str) -> list[SourceItem]: items: list[SourceItem] = [] for _ in range(MAX_PAGES): From e57724b7115736546f616e977cfa696baa62c436 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:43 +0200 Subject: [PATCH 238/554] feat(web-app-openpost): give the PeerTube source the refresh interface --- .../files/crossposter/crossposter/sources/peertube.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py b/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py index 0c68f2e64e..a08d2c714f 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py @@ -84,6 +84,9 @@ class PeerTubeSource: web.get_json(f"{self.base_url}/api/v1/videos/{video['uuid']}", self.headers) ) + def refresh(self, item: SourceItem) -> SourceItem: + return item + def newest_cursor(self) -> str: page = self._page(0) return str(page[0].get("publishedAt") or "") if page else "" From 1c2efab5556e14a536251a9173df59d324a21ad4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:43 +0200 Subject: [PATCH 239/554] fix(web-app-openpost): reuse a created publication and retry unready source media A retry after a failure past creation re-created the publication under the same idempotency key with new media ids and got 409. Pixelfed replaces an image while it optimises it, so the URL read at detection redirected to no-preview.png: the post is re-read before each attempt and a failed media download is transient. --- .../files/crossposter/crossposter/service.py | 64 ++++++++++++------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/service.py b/roles/web-app-openpost/files/crossposter/crossposter/service.py index 7acc93fe54..b7b0d90f81 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/service.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/service.py @@ -25,6 +25,7 @@ SOURCES = { "peertube": PeerTubeSource, } JPEG_QUALITY = 90 +SOURCE_MEDIA_UNAVAILABLE = 503 def to_jpeg(source: Path) -> Path: @@ -158,11 +159,21 @@ class Service: Path(urllib.parse.urlparse(attachment.media.url).path).name or f"media-{index}" ) - local = web.download( - attachment.media.url, - credentials_for(route.source.base_url, attachment.media.url, headers), - folder / f"{index}-{name}", - ) + try: + local = web.download( + attachment.media.url, + credentials_for( + route.source.base_url, attachment.media.url, headers + ), + folder / f"{index}-{name}", + ) + except web.RequestError as error: + raise web.RequestError( + attachment.media.url, + SOURCE_MEDIA_UNAVAILABLE, + error.headers, + f"the source media is not available yet: {error}", + ) from error mime = attachment.media.mime if attachment.jpeg and mime != "image/jpeg": local, mime = to_jpeg(local), "image/jpeg" @@ -190,32 +201,39 @@ class Service: ) return item = store.item_from_json(row["payload"]) + publication_id = str(row["publication_id"]) try: + if item.media and not publication_id: + item = self.sources[route.name].refresh(item) destination = self._destination(route, row["target"]) plan = self._plan(route, item, destination) - key = store.idempotency_key( - item.uri, destination.account_id, int(row["resends"]) - ) - with tempfile.TemporaryDirectory(prefix="crossposter-") as folder: - media = self._media(route, plan, Path(folder)) - publication = self.openpost.create( - destination, - plan.title, - plan.text, - plan.profile, - media, - key, - {"crossposter_route": route.name, "crossposter_source": item.url}, - ) + if publication_id: + publication = self.openpost.publication(publication_id) + else: + key = store.idempotency_key( + item.uri, destination.account_id, int(row["resends"]) + ) + with tempfile.TemporaryDirectory(prefix="crossposter-") as folder: + media = self._media(route, plan, Path(folder)) + publication = self.openpost.create( + destination, + plan.title, + plan.text, + plan.profile, + media, + key, + {"crossposter_route": route.name, "crossposter_source": item.url}, + ) + publication_id = str(publication["id"]) if plan.draft_only: state = store.transition("pending", "drafted") else: if str(publication.get("status")) == "draft": - if media: - self.openpost.await_public_media(str(publication["id"])) + if plan.media: + self.openpost.await_media(publication_id) self.openpost.publish_now(publication) state = store.transition("pending", "submitted") - self.store.update(row["id"], state, str(publication["id"]), attempts, "", 0) + self.store.update(row["id"], state, publication_id, attempts, "", 0) LOG.info( "%s -> %s %s: %s", item.url, @@ -239,7 +257,7 @@ class Service: self.store.update( row["id"], state, - str(row["publication_id"]), + publication_id, attempts, str(error), pause, From 8b8cb4f5c7bd028a3252d0caa81609ac88a91b99 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:43 +0200 Subject: [PATCH 240/554] test(web-app-openpost): cover deduplicated uploads, validation polling and video analysis --- .../crossposter/crossposter/test_openpost.py | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py index aad9074474..8455a4e4bf 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py @@ -63,6 +63,9 @@ class FakeOpenPost: }, } return web.Response(200, {}, json.dumps(session).encode()) + if path.endswith("/complete"): + completed = {"id": "media-0", "deduped": True} + return web.Response(200, {}, json.dumps(completed).encode()) return web.Response(200, {}, b"{}") @@ -154,7 +157,7 @@ class TestRequests(unittest.TestCase): patch.object(openpost.web, "upload", upload), ): media = client().upload(image, "a.jpg", "image/jpeg") - self.assertEqual(media, "media-1") + self.assertEqual(media, "media-0") self.assertEqual(uploads[0][0], "http://openpost:8080/media/upload/media-1") self.assertEqual(uploads[0][1]["Authorization"], "Bearer op-token") self.assertTrue( @@ -165,8 +168,12 @@ class TestRequests(unittest.TestCase): class TestPublicMedia(unittest.TestCase): def answers(self, states: list[list[dict]]) -> list[str]: asked: list[str] = [] + self.validated: list[str] = [] def request(method, url, headers, body, accepted) -> web.Response: + if method == "POST": + self.validated.append(url) + return web.Response(200, {}, b'{"valid": true, "issues": []}') asked.append(url) media = states[min(len(asked), len(states)) - 1] return web.Response(200, {}, json.dumps({"media": media}).encode()) @@ -186,9 +193,11 @@ class TestPublicMedia(unittest.TestCase): patch.object(openpost.web, "request", self.request), patch.object(openpost.time, "sleep", lambda seconds: None), ): - client().await_public_media("pub-1") + client().await_media("pub-1") self.assertEqual(len(asked), 3) self.assertTrue(asked[0].endswith("/publications/pub-1")) + self.assertEqual(len(self.validated), 3) + self.assertTrue(self.validated[0].endswith("/publications/pub-1/validate")) def test_media_that_never_turns_public_is_a_transient_error(self) -> None: self.answers([[{"public_url_checked_at": "now", "public_url_ready": False}]]) @@ -197,5 +206,32 @@ class TestPublicMedia(unittest.TestCase): patch.object(openpost.time, "sleep", lambda seconds: None), self.assertRaises(web.RequestError) as raised, ): - client().await_public_media("pub-1") + client().await_media("pub-1") self.assertTrue(raised.exception.transient) + + def test_a_video_also_waits_for_its_analysis(self) -> None: + public = {"public_url_checked_at": "now", "public_url_ready": True} + asked = self.answers( + [ + [{**public, "mime_type": "video/mp4", "analysis_status": "pending"}], + [{**public, "mime_type": "video/mp4", "analysis_status": "ready"}], + ] + ) + with ( + patch.object(openpost.web, "request", self.request), + patch.object(openpost.time, "sleep", lambda seconds: None), + ): + client().await_media("pub-1") + self.assertEqual(len(asked), 2) + + def test_an_image_needs_no_analysis(self) -> None: + self.assertTrue( + openpost.publishable( + { + "public_url_checked_at": "now", + "public_url_ready": True, + "mime_type": "image/jpeg", + "analysis_status": "pending", + } + ) + ) From 094ea53f3d48074625a4534e7318aaa78d73e589 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 241/554] test(web-app-openpost): cover publication reuse, refreshed media and unready source media --- .../crossposter/crossposter/test_service.py | 74 ++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py index dac2ed8088..7f2b70feb6 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py @@ -3,6 +3,7 @@ from __future__ import annotations import json import tempfile import unittest +from dataclasses import replace from pathlib import Path from unittest.mock import patch @@ -18,7 +19,7 @@ from crossposter.config import ( ) from crossposter.notify import Mail from crossposter.openpost import Destination -from crossposter.sources import SourceItem +from crossposter.sources import Media, SourceItem DESTINATIONS = [ Destination("acc-x", "x-press", "x", {}), @@ -68,10 +69,22 @@ class TestMediaCredentials(unittest.TestCase): ) +def picture(number: int, url: str) -> SourceItem: + return replace(post(number), media=(Media(url, "image/jpeg", "", 0),)) + + class FakeSource: def __init__(self, items: list[SourceItem]) -> None: self.items = items self.headers: dict[str, str] = {} + self.fresh_url = "" + + def refresh(self, item: SourceItem) -> SourceItem: + if not self.fresh_url: + return item + return replace( + item, media=tuple(replace(m, url=self.fresh_url) for m in item.media) + ) def newest_cursor(self) -> str: return "100" @@ -158,6 +171,7 @@ class FakeStore: row.update( state="pending", resends=row["resends"] + 1, + publication_id="", attempts=attempts, last_error=error, delay=delay_seconds, @@ -187,6 +201,7 @@ class FakeOpenPost: self.metadata: list[dict] = [] self.published: list[str] = [] self.failure: web.RequestError | None = None + self.publish_failure: web.RequestError | None = None self.outcome: list[dict] = [] def destinations(self, targets: Targets) -> list[Destination]: @@ -199,7 +214,15 @@ class FakeOpenPost: self.metadata.append(metadata) return {"id": f"pub-{len(self.created)}", "revision": 1, "status": "draft"} + def publication(self, publication_id: str) -> dict: + return {"id": publication_id, "revision": 1, "status": "draft"} + + def upload(self, source: Path, filename: str, mime: str) -> str: + return f"media-{filename}" + def publish_now(self, publication: dict) -> None: + if self.publish_failure: + raise self.publish_failure self.published.append(publication["id"]) def renditions(self, publication_id: str) -> list[dict]: @@ -316,6 +339,55 @@ class TestDelivery(ServiceFixture, unittest.TestCase): self.assertEqual({row["state"] for row in database.items}, {"dead_lettered"}) self.assertIn("HTTP 503", database.items[0]["last_error"]) + def test_a_retry_after_creation_reuses_the_publication(self) -> None: + runner, database, client = self.queued("auto") + client.publish_failure = web.RequestError( + "https://openpost/api/v1/publications/pub-1/publish-now", 503, {}, "busy" + ) + runner.deliver_due() + self.assertEqual( + [row["publication_id"] for row in database.items], ["pub-1", "pub-2"] + ) + client.publish_failure = None + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"submitted"}) + self.assertEqual(len(client.created), 2) + self.assertEqual(client.published, ["pub-1", "pub-2"]) + + def test_media_is_fetched_from_the_refreshed_source_post(self) -> None: + runner, database, _ = self.build( + "review", [picture(101, "https://microblog.example/m/original.jpg")] + ) + database.cursors["press"] = "100" + runner.detect(runner.routes["press"]) + runner.sources["press"].fresh_url = "https://microblog.example/m/optimised.jpg" + fetched: list[str] = [] + + def download(url: str, headers: dict, target: Path) -> Path: + fetched.append(url) + target.write_bytes(b"\xff\xd8 image") + return target + + with patch.object(service.web, "download", download): + runner.deliver_due() + self.assertEqual(set(fetched), {"https://microblog.example/m/optimised.jpg"}) + self.assertEqual({row["state"] for row in database.items}, {"drafted"}) + + def test_source_media_that_is_not_ready_is_retried(self) -> None: + runner, database, _ = self.build( + "review", [picture(101, "https://microblog.example/m/original.jpg")] + ) + database.cursors["press"] = "100" + runner.detect(runner.routes["press"]) + + def download(url: str, headers: dict, target: Path) -> Path: + raise web.RequestError(url, 403, {}, "no-preview") + + with patch.object(service.web, "download", download): + runner.deliver_due() + self.assertEqual({row["state"] for row in database.items}, {"pending"}) + self.assertIn("not available yet", database.items[0]["last_error"]) + def test_permanent_errors_dead_letter_at_once(self) -> None: runner, database, client = self.queued("auto") client.failure = web.RequestError( From f894bc226f30739fa93a5c9166cd340b81d94f7d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 242/554] test(web-app-openpost): cover the status refresh --- .../crossposter/sources/test_mastodon.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py index d52c5d715e..39471cc113 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py @@ -106,3 +106,23 @@ class TestPolling(unittest.TestCase): ).fetch("0") self.assertEqual(len(items), 45) self.assertEqual(fake.queries[1]["min_id"], "239") + + def test_refresh_rereads_the_status_with_its_current_media(self) -> None: + stale = mastodon.parse_status(fixture("mastodon/statuses.json")[1], "mastodon") + current = dict(fixture("mastodon/statuses.json")[1]) + current["media_attachments"] = [ + dict(current["media_attachments"][0], url="https://m/optimised.png") + ] + asked: list[str] = [] + + def get_json(url: str, headers: dict[str, str]) -> object: + asked.append(urllib.parse.urlparse(url).path) + return current + + with patch.object(mastodon.web, "get_json", get_json): + fresh = mastodon.MastodonSource( + "https://microblog.example", "press", "token" + ).refresh(stale) + self.assertEqual(asked, [f"/api/v1/statuses/{stale.cursor}"]) + self.assertEqual(fresh.media[0].url, "https://m/optimised.png") + self.assertEqual(fresh.cursor, stale.cursor) From 5939ae6fbb126bbb3f49096294886dd14f77fa87 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 243/554] fix(web-app-openpost): pin no app for an onion Fediverse sibling OpenPost is a pure Go binary: its resolver refuses to look up .onion names (RFC 7686), so it never reaches the relay alias, and its own registration accepts only https instances. --- roles/web-app-openpost/vars/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 5220b51433..8eb51f3e7c 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -55,8 +55,10 @@ OPENPOST_PINNED_INSTANCES: >- {%- for _key in ['mastodon', 'pixelfed'] -%} {%- if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} {%- set _url = lookup('tls', OPENPOST_RELAY_SIBLINGS[_key], 'url.base') | regex_replace('/+$', '') -%} + {%- if _url is not search('\\.onion$') -%} {%- set _ = _instances.append({'platform': _key, 'url': _url, 'name': _url ~ '/'}) -%} {%- endif -%} + {%- endif -%} {%- endfor -%} {{ _instances }} OPENPOST_PINNED_PIXELFED: "{{ OPENPOST_PINNED_INSTANCES | selectattr('platform', 'equalto', 'pixelfed') | list }}" From 876a7edaf432e22d2ca1c05d5e0e1ff8fa219cd6 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 244/554] fix(web-app-openpost): connect the seed Mastodon target only when it is pinned --- roles/web-app-openpost/tasks/crossposter/seed.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed.yml b/roles/web-app-openpost/tasks/crossposter/seed.yml index c6b75c2d12..ceae92edeb 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed.yml @@ -51,7 +51,9 @@ - name: "🐘 Connect the CI Mastodon account as a target" ansible.builtin.include_tasks: crossposter/seed/target.yml - when: OPENPOST_CROSSPOSTER_ROUTES | selectattr('source.platform', 'equalto', 'mastodon') | list | length > 0 + when: + - OPENPOST_CROSSPOSTER_ROUTES | selectattr('source.platform', 'equalto', 'mastodon') | list | length > 0 + - OPENPOST_PINNED_INSTANCES | selectattr('platform', 'equalto', 'mastodon') | list | length > 0 - name: "📚 List the social sets of the organisation workspace" uri_retry: From 7a329e0d98e6f561d98e32cd38a6aa5eba02c5da Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 245/554] test(web-app-openpost): add a skip for onion Fediverse siblings --- roles/web-app-openpost/files/playwright/_shared.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index d6c5d392b5..ea642bec44 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -1,4 +1,4 @@ -const { expect } = require("@playwright/test"); +const { test, expect } = require("@playwright/test"); const { resolveTimeout } = require("./timeouts"); const { decodeDotenvQuotedValue, normalizeBaseUrl, performKeycloakLoginForm, gotoOnion } = require("./personas"); @@ -221,6 +221,13 @@ function mastodonChannelActions(page, account) { return page.getByRole("button", { name: new RegExp(`^actions for ${account.handle} · mastodon$`, "i") }); } +function skipOnOnionSibling(platform) { + test.skip( + env[`${platform}BaseUrl`].includes(".onion"), + `OpenPost cannot connect an onion ${platform} instance: its Go resolver refuses .onion names`, + ); +} + async function disconnectAccount(page, account) { await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); await expect(page.getByRole("heading", { name: /connected channels/i })).toBeVisible({ timeout: resolveTimeout(60_000) }); @@ -504,4 +511,5 @@ module.exports = { logout, beforeEach, skipUnlessServiceEnabled, + skipOnOnionSibling, }; From 2e6a222756f978ed374e22d36eda47eee3da97bb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 246/554] test(web-app-openpost): skip the Mastodon connect for an onion instance --- roles/web-app-openpost/files/playwright/test-publish-mastodon.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/test-publish-mastodon.js b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js index 978bbcf303..a989685b2c 100644 --- a/roles/web-app-openpost/files/playwright/test-publish-mastodon.js +++ b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js @@ -5,6 +5,7 @@ exports.register = function (shared) { test("administrator: connects the local Mastodon account through the OOB code flow and publishes to it", async ({ page, context }) => { shared.skipUnlessServiceEnabled("sso"); shared.skipUnlessServiceEnabled("mastodon"); + shared.skipOnOnionSibling("mastodon"); test.setTimeout(resolveTimeout(300_000)); // two Keycloak logins, Mastodon OAuth approval and the publishing worker round-trip const marker = `openpost-e2e ${Date.now()}`; From e9fbc7096d7face7cabf2520187d242c50f32fed Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 247/554] test(web-app-openpost): skip the Pixelfed connect for an onion instance --- roles/web-app-openpost/files/playwright/test-publish-pixelfed.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js b/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js index 763fcbf109..f7ecfaf83d 100644 --- a/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js +++ b/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js @@ -4,6 +4,7 @@ const { resolveTimeout } = require("./timeouts"); exports.register = function (shared) { test("administrator: connects the local Pixelfed account through the OOB code flow and publishes an image to it", async ({ page }) => { shared.skipUnlessServiceEnabled("pixelfed"); + shared.skipOnOnionSibling("pixelfed"); test.setTimeout(resolveTimeout(300_000)); // Pixelfed sign-in, OAuth approval, media upload and the publishing worker round-trip const label = "break-glass administrator"; const marker = `openpost-e2e-pixelfed ${Date.now()}`; From 364326b86212785979766dc00847b74060e8bebe Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:44 +0200 Subject: [PATCH 248/554] test(web-app-openpost): skip the desk review for an onion Mastodon --- .../web-app-openpost/files/playwright/test-crossposter-draft.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js index ba2aba5b08..a1fdf402ed 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js @@ -53,6 +53,7 @@ exports.register = function (shared) { test("administrator: finds a crossposted draft in the desk, edits it and schedules it", async ({ page }) => { shared.skipUnlessServiceEnabled("crossposter"); shared.skipUnlessServiceEnabled("mastodon"); + shared.skipOnOnionSibling("mastodon"); test.setTimeout(resolveTimeout(420_000)); // Mastodon sign-in, the crossposter's poll interval, composer autosave and scheduling const label = "administrator"; const marker = `cp-desk-${Date.now()}`; From bc21313bec0ca84ad170196791a736866ca376bf Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 01:16:45 +0200 Subject: [PATCH 249/554] docs(web-app-openpost): document that onion Fediverse siblings cannot be connected --- roles/web-app-openpost/Administration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 748113a035..33a93c074b 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -218,6 +218,7 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo | X charges $0.20 instead of $0.015 for a post that contains a URL. | Write the X rendition without links, or accept the surcharge per post. | | X forbids identical content across accounts of the same owner. | Give each X account its own rendition. | | On an onion-only deployment OpenPost marks uploaded media as unreachable for providers, because X, Meta, LinkedIn, YouTube and TikTok cannot fetch from a `.onion` origin. | Serve media from object storage with a clearnet public URL, or publish text-only posts to commercial networks. | +| OpenPost cannot connect a Mastodon or Pixelfed instance served only on a `.onion` name: its Go resolver refuses to look up `.onion` names (RFC 7686), and its own app registration accepts only `https://` instances. The deploy therefore pins no app for an onion sibling, and the CI connect checks skip it. | Connect the instance through a clearnet name. The crossposter still reads onion sources, because Python resolves them through the relay. | | OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition. | Cap X spending through the prepaid credits of the X developer account. | | Instagram accepts JPEG only and fetches media from a public URL. | Deploy `web-app-seaweedfs` so media gets public HTTPS URLs; convert other image formats before upload. | | Facebook, Instagram, Threads and TikTok fetch media from public HTTPS URLs. | Same as above; without `web-app-seaweedfs` media is served under `/media/` of the public OpenPost domain, which also works when that domain is reachable from the internet. | From 4ba240a507f5223d617f08cb0dbaffdb5fb68908 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:41 +0100 Subject: [PATCH 250/554] fix(web-app-openpost): reach an onion Keycloak through Tor and derive the SMTP flag once Keycloak's realm requires HTTPS for external clients (sslRequired: external) and treats OpenPost's 192.88.99.0/24 network as external, so the plain-HTTP OIDC discovery against the onion issuer answered 403. Through the Tor SOCKS proxy the request arrives from the hidden service backend, as for Pixelfed, EspoCRM and Stalwart. --- roles/web-app-openpost/vars/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 8eb51f3e7c..2f1819c356 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -12,7 +12,10 @@ OPENPOST_API_HEADERS: OPENPOST_RELAY_CONF_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'relay.conf'] | path_join }}" OPENPOST_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}" +OPENPOST_OIDC_ONION_ISSUER: "{{ lookup('tls', 'web-app-keycloak', 'domain').endswith('.onion') }}" +OPENPOST_OIDC_SOCKS_PROXY: "{{ lookup('tor_socks_proxy') if OPENPOST_OIDC_ONION_ISSUER | bool else '' }}" OPENPOST_EMAIL_ENABLED: "{{ lookup('config', application_id, 'services.email.enabled') }}" +OPENPOST_SMTP_ENABLED: "{{ OPENPOST_EMAIL_ENABLED | bool and (lookup('email', application_id).tls | bool or lookup('email', application_id).start_tls | bool) }}" OPENPOST_OBJSTORE_ENABLED: "{{ lookup('objstore', application_id, 'enabled') }}" OPENPOST_ROOT_CA_TRUSTED: "{{ OPENPOST_OBJSTORE_ENABLED | bool and TLS_MODE == 'self_signed' }}" From cd2ae598f4725fe6fd92002aab3c04e925d03e7d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:42 +0100 Subject: [PATCH 251/554] fix(web-app-openpost): proxy the onion OIDC back channel and gate SMTP on one flag --- roles/web-app-openpost/templates/env.j2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/templates/env.j2 b/roles/web-app-openpost/templates/env.j2 index 71d612b511..8c435dd4ff 100644 --- a/roles/web-app-openpost/templates/env.j2 +++ b/roles/web-app-openpost/templates/env.j2 @@ -46,11 +46,13 @@ OPENPOST_OIDC_NAME={{ OIDC.BUTTON_TEXT | dotenv_quote }} OPENPOST_OIDC_SCOPES=openid,profile,email OPENPOST_OIDC_JIT_ENABLED=true OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST={{ OPENPOST_BOOTSTRAP_ADMINS | join(',') }} +{% if OPENPOST_OIDC_SOCKS_PROXY | length > 0 %} +http_proxy={{ OPENPOST_OIDC_SOCKS_PROXY }} +{% endif %} {% endif %} -{% if OPENPOST_EMAIL_ENABLED | bool %} +{% if OPENPOST_SMTP_ENABLED | bool %} {% set email = lookup('email', application_id) %} -{% if email.tls | bool or email.start_tls | bool %} OPENPOST_EMAIL_PROVIDER=smtp OPENPOST_EMAIL_FROM={{ email['from'] }} OPENPOST_SMTP_HOST={{ email.host }} @@ -59,7 +61,6 @@ OPENPOST_SMTP_USERNAME={{ email.username }} OPENPOST_SMTP_PASSWORD={{ email.password | dotenv_quote }} OPENPOST_SMTP_TLS_MODE={{ 'tls' if email.tls | bool else 'starttls' }} {% endif %} -{% endif %} {% for _platform in ['mastodon', 'pixelfed'] %} {% set _servers = [] %} From b4f0bf7e1255780dff7c3575d8643cbd88b964eb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:42 +0100 Subject: [PATCH 252/554] fix(web-app-openpost): snapshot whether OpenPost has an SMTP relay for the probe --- roles/web-app-openpost/tasks/00_core.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index df5d7a2ed2..04d199570c 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -9,6 +9,7 @@ api_headers: "{{ OPENPOST_API_HEADERS }}" s3_public_url: "{{ lookup('objstore', application_id, 'public_url') | regex_replace('/?$', '/') if OPENPOST_OBJSTORE_ENABLED | bool else '' }}" mail_host: "{{ lookup('email', application_id).host if OPENPOST_EMAIL_ENABLED | bool else '' }}" + smtp_enabled: "{{ OPENPOST_SMTP_ENABLED | bool }}" relay_targets: >- {%- set _targets = {} -%} {%- for _key, _role in OPENPOST_RELAY_SIBLINGS.items() if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} From a9adbe23dfed8357b06ad3a60de4f14d31b7771e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:42 +0100 Subject: [PATCH 253/554] fix(web-app-openpost): tell the probe whether OpenPost can send mail --- roles/web-app-openpost/templates/test.env.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index 4296723615..3f1383d428 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -33,6 +33,7 @@ OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'administrator').password ~ ':' OPENPOST_SSO_ADMIN_EMAIL={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_OIDC_ENABLED | bool else '' }} OPENPOST_MAIL_RECIPIENT={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_EMAIL_ENABLED | bool else '' }} OPENPOST_MAIL_HOST={{ _view.mail_host }} +OPENPOST_SMTP_ENABLED={{ _view.smtp_enabled | bool | string | lower }} OPENPOST_MAIL_PASSWORD_B64={{ lookup('users', 'administrator').password | b64encode }} OPENPOST_CROSSPOSTER_ROUTES_B64={{ _view.routes | to_json | b64encode }} OPENPOST_CROSSPOSTER_POLL_SECONDS={{ OPENPOST_CROSSPOSTER.poll_interval_seconds }} From dc56b2897662a4f9b0277cade8e92dbb51071151 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:42 +0100 Subject: [PATCH 254/554] fix(web-app-openpost): set the Pixelfed app owner from the registering host's view In swarm tor rounds only the manager renders onion names, so workers saw a clearnet Pixelfed the run_once registration had skipped and failed on a missing fediverse app. --- roles/web-app-openpost/tasks/01_fediverse_apps.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/tasks/01_fediverse_apps.yml b/roles/web-app-openpost/tasks/01_fediverse_apps.yml index 7e12a0d0aa..764c772a3f 100644 --- a/roles/web-app-openpost/tasks/01_fediverse_apps.yml +++ b/roles/web-app-openpost/tasks/01_fediverse_apps.yml @@ -51,6 +51,7 @@ - name: "👤 Give OpenPost's Pixelfed app an owner" ansible.builtin.include_tasks: fediverse/pixelfed_owner.yml when: OPENPOST_PINNED_PIXELFED | length > 0 + run_once: true - name: "📁 Ensure the directory for the registered apps exists" ansible.builtin.file: From 8a851d7f73fa19adf17fd726f75061ee34a31b5d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:42 +0100 Subject: [PATCH 255/554] fix(web-app-openpost): simulate X media upload and photos on the second Facebook Page X uploads an image to upload.twitter.com before tweeting and Facebook posts an image to /{page}/photos; both fell through to the catch-all 404, so OpenPost reported the destinations as failed. --- .../files/simulator/openpost.json | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/files/simulator/openpost.json b/roles/web-app-openpost/files/simulator/openpost.json index 7eb49a3e38..7b53f38b81 100644 --- a/roles/web-app-openpost/files/simulator/openpost.json +++ b/roles/web-app-openpost/files/simulator/openpost.json @@ -198,6 +198,38 @@ } } }, + { + "name": "x-media-upload", + "request": { + "method": "POST", + "urlPath": "/1.1/media/upload.json" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "media_id": 1880000000000000001, + "media_id_string": "1880000000000000001", + "expires_after_secs": 86400 + } + } + }, + { + "name": "x-media-metadata", + "request": { + "method": "POST", + "urlPath": "/1.1/media/metadata/create.json" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "body": "{}" + } + }, { "name": "meta-access-token", "request": { @@ -411,7 +443,7 @@ "name": "facebook-photos", "request": { "method": "POST", - "urlPathPattern": "/v[0-9.]+/424242/photos" + "urlPathPattern": "/v[0-9.]+/(424242|525252)/photos" }, "response": { "status": 200, @@ -420,8 +452,11 @@ }, "jsonBody": { "id": "2001", - "post_id": "424242_2001" - } + "post_id": "{{request.pathSegments.[1]}}_2001" + }, + "transformers": [ + "response-template" + ] } }, { From 542b6796e37e58f1b4e1f75b7bf7ba46c85a760d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:42 +0100 Subject: [PATCH 256/554] test(web-app-openpost): expose the onion origin and the SMTP flag to the probe --- roles/web-app-openpost/files/test/openpost/api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/web-app-openpost/files/test/openpost/api.py b/roles/web-app-openpost/files/test/openpost/api.py index f02bfaa227..2e33432066 100644 --- a/roles/web-app-openpost/files/test/openpost/api.py +++ b/roles/web-app-openpost/files/test/openpost/api.py @@ -17,6 +17,7 @@ OPENPOST_DB_NAME OpenPost database name OPENPOST_DB_USER OpenPost database user OPENPOST_DB_PASSWORD_B64 base64 OpenPost database password OPENPOST_MAIL_RECIPIENT platform mailbox that receives a probe invitation, empty without mail +OPENPOST_SMTP_ENABLED true when OpenPost itself is given an SMTP relay it can use OPENPOST_SSO_ADMIN_EMAIL platform administrator the Playwright run provisions through SSO before the backup drill, empty without SSO OPENPOST_PEERTUBE_USERNAME local PeerTube account OpenPost connects through its password login OPENPOST_PEERTUBE_PASSWORD_B64 base64 password of that PeerTube account @@ -56,6 +57,7 @@ ADMIN_PASSWORD = base64.b64decode(os.environ["OPENPOST_ADMIN_PASSWORD_B64"]).dec RELAY_TARGETS = json.loads(os.environ["OPENPOST_RELAY_TARGETS"]) DEADLINE = time.monotonic() + int(os.environ["OPENPOST_DEADLINE_SECONDS"]) PUBLIC_URL = os.environ["OPENPOST_PUBLIC_URL"].rstrip("/") +ONION_ORIGIN = (urllib.parse.urlparse(PUBLIC_URL).hostname or "").endswith(".onion") SSO_ENABLED = os.environ["OPENPOST_SSO_ENABLED"] == "true" CONTAINER = os.environ["OPENPOST_CONTAINER"] SIMULATOR_PLATFORMS = json.loads(os.environ["OPENPOST_SIMULATOR_PLATFORMS"]) @@ -67,6 +69,7 @@ DB_NAME = os.environ["OPENPOST_DB_NAME"] DB_USER = os.environ["OPENPOST_DB_USER"] DB_PASSWORD = base64.b64decode(os.environ["OPENPOST_DB_PASSWORD_B64"]).decode() MAIL_RECIPIENT = os.environ["OPENPOST_MAIL_RECIPIENT"] +SMTP_ENABLED = os.environ["OPENPOST_SMTP_ENABLED"] == "true" SSO_ADMIN_EMAIL = os.environ["OPENPOST_SSO_ADMIN_EMAIL"] PEERTUBE_USERNAME = os.environ["OPENPOST_PEERTUBE_USERNAME"] PEERTUBE_PASSWORD = base64.b64decode( From 971fcd127edc782aa96fc59e3f1902f8d5720045 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:43 +0100 Subject: [PATCH 257/554] fix(web-app-openpost): log in to IMAP with a UTF-8 password --- roles/web-app-openpost/files/test/openpost/mailbox.py | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/test/openpost/mailbox.py b/roles/web-app-openpost/files/test/openpost/mailbox.py index 77b26846e8..c785ddf8c5 100644 --- a/roles/web-app-openpost/files/test/openpost/mailbox.py +++ b/roles/web-app-openpost/files/test/openpost/mailbox.py @@ -27,6 +27,7 @@ def reports_naming(urls: list[str]) -> list[str]: with imaplib.IMAP4_SSL( PROXY_ADDRESS or MAIL_HOST, IMAPS_PORT, ssl_context=context, timeout=60 ) as imap: + imap._encoding = "utf-8" imap.login(MAIL_RECIPIENT, MAIL_PASSWORD) imap.select("INBOX", readonly=True) for url in urls: From c40b8e6e07f440af88649fbbc2185744c4f9ed8b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:43 +0100 Subject: [PATCH 258/554] test(web-app-openpost): skip simulated media posts on an onion origin --- roles/web-app-openpost/files/test/openpost/simulator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/web-app-openpost/files/test/openpost/simulator.py b/roles/web-app-openpost/files/test/openpost/simulator.py index ba75549bcd..8e7d3a7680 100644 --- a/roles/web-app-openpost/files/test/openpost/simulator.py +++ b/roles/web-app-openpost/files/test/openpost/simulator.py @@ -15,6 +15,7 @@ from openpost.api import ( MEMBER_EMAIL, MEMBER_PASSWORD, MEMBER_USERNAME, + ONION_ORIGIN, SIMULATOR_ADMIN, SIMULATOR_PLATFORMS, SSO_ENABLED, @@ -333,6 +334,11 @@ def check_simulator(token: str, workspace: str) -> None: or platform not in connected ): continue + if ONION_ORIGIN and kind in ("image", "video"): + print( + f"[SKIP] {label}: providers cannot fetch media from an onion origin" + ) + continue targets = ( connected[platform] if label == "facebook" else connected[platform][:1] ) From aad629dba716d6fea6535d122355ee981d33b774 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:43 +0100 Subject: [PATCH 259/554] test(web-app-openpost): accept a Facebook photo post for an image --- roles/web-app-openpost/files/test/openpost/crossposter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/test/openpost/crossposter.py b/roles/web-app-openpost/files/test/openpost/crossposter.py index 426e7051a1..e476546f0f 100644 --- a/roles/web-app-openpost/files/test/openpost/crossposter.py +++ b/roles/web-app-openpost/files/test/openpost/crossposter.py @@ -246,7 +246,7 @@ def mastodon_scenarios( ) check( "Facebook and Instagram receive the post", - bool(hits(entries, "POST", r"/v[0-9.]+/(424242|525252)/feed", nonce)) + bool(hits(entries, "POST", r"/v[0-9.]+/(424242|525252)/(feed|photos)", nonce)) and bool(hits(entries, "POST", r"/v[0-9.]+/17841400000000000/media", nonce)), ) copies = [ From 55ca351d6f6500aaaf37fcd8eaf8e881e4a86650 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:43 +0100 Subject: [PATCH 260/554] test(web-app-openpost): skip the onion-only checks the limitation rules out Media on an onion origin, onion Fediverse siblings and OpenPost mail without TLS cannot work; the media check reads the OpenPost origin, which is the URL providers fetch. --- roles/web-app-openpost/files/test/probe.py | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py index ff663f4b1c..7445099de2 100644 --- a/roles/web-app-openpost/files/test/probe.py +++ b/roles/web-app-openpost/files/test/probe.py @@ -14,6 +14,7 @@ from openpost.api import ( CONTAINER, DEADLINE, MAIL_RECIPIENT, + ONION_ORIGIN, OPENER, PEERTUBE_PASSWORD, PEERTUBE_USERNAME, @@ -22,6 +23,7 @@ from openpost.api import ( S3_PUBLIC_URL, SETTLE_SECONDS, SIMULATOR_PLATFORMS, + SMTP_ENABLED, SSO_ADMIN_EMAIL, SSO_ENABLED, UNCONFIGURED_PLATFORMS, @@ -153,7 +155,8 @@ def check_sso_administrator(token: str) -> None: bool(found) and found[0].get("is_admin") is True, found, ) - if found and "mastodon" in RELAY_TARGETS: + mastodon = RELAY_TARGETS.get("mastodon") + if found and mastodon and not mastodon.endswith(".onion"): count = found[0].get("publication_count") check( "the SSO administrator's publications survived the backup drill", @@ -223,6 +226,11 @@ def check_relay(token: str, workspace: str) -> None: for platform, domain in RELAY_TARGETS.items(): if platform == "peertube": continue + if domain.endswith(".onion"): + print( + f"[SKIP] relay to {platform}: OpenPost cannot resolve the onion name {domain}" + ) + continue status, body = auth_url(token, workspace, platform, f"https://{domain}") check( f"relay carries {platform} at {domain} past the guard", @@ -248,8 +256,7 @@ def check_media(token: str, workspace: str) -> None: or [{}] )[0] time.sleep(0 if attached.get("public_url_checked_at") else 3) - origin = urllib.parse.urlparse(S3_PUBLIC_URL or PUBLIC_URL).hostname or "" - if origin.endswith(".onion"): + if ONION_ORIGIN: check( "OpenPost flags media on an onion origin as unreachable for providers", attached.get("public_url_ready") is False @@ -395,13 +402,19 @@ def main() -> int: check_relay(token, workspace) check_unconfigured(token, workspace) check_media(token, workspace) - if MAIL_RECIPIENT: + if MAIL_RECIPIENT and SMTP_ENABLED: check_mail(token, workspace) if SIMULATOR_PLATFORMS: check_simulator(token, workspace) - if "peertube" in RELAY_TARGETS: + if RELAY_TARGETS.get("peertube", "").endswith(".onion"): + print("[SKIP] PeerTube connect: OpenPost cannot resolve an onion PeerTube") + elif "peertube" in RELAY_TARGETS: check_peertube(token, workspace) - if ROUTES: + if ROUTES and ONION_ORIGIN: + print( + "[SKIP] crossposter delivery: an onion OpenPost can neither hand media to providers nor connect onion Fediverse targets" + ) + elif ROUTES: check_crossposter(token, workspace) if failures: print(f"[FAIL] {len(failures)} check(s) failed: {', '.join(failures)}") From 3a2e2963dee250ad2f93d16d086e8a30da75ff38 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:43 +0100 Subject: [PATCH 261/554] feat(annotations): register secrets with GitHub Actions for masking The ::add-mask:: command goes to stderr, so callers that parse a CLI's stdout, such as the credentials snippet mode, never read it; the runner processes workflow commands on both streams. --- utils/annotations/message.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utils/annotations/message.py b/utils/annotations/message.py index b4712b1f50..b3c1d257f5 100644 --- a/utils/annotations/message.py +++ b/utils/annotations/message.py @@ -9,6 +9,7 @@ See: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-wor from __future__ import annotations import os +import sys from typing import TYPE_CHECKING if TYPE_CHECKING: @@ -48,6 +49,19 @@ def _emit( print(f"{label}: {message}", flush=True) +def mask(value: str) -> None: + """Register a secret with GitHub Actions so every later log line redacts it. + + Args: + value: the secret; each non-blank line is registered on its own. + """ + if not in_github_actions(): + return + for line in value.splitlines(): + if line.strip(): + print(f"::add-mask::{line}", file=sys.stderr, flush=True) + + def warning( message: str, *, From e4452dce1696a61efa011b297ced24aea8923797 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:43 +0100 Subject: [PATCH 262/554] feat(credentials): mask every generated value at birth in CI A value the inventory generator creates is now redacted from every later GitHub Actions log line, so deploy and test output can no longer show it. The undefined fallback for an unknown algorithm stays unmasked. --- utils/manager/value_generator.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/utils/manager/value_generator.py b/utils/manager/value_generator.py index d797dd7a0e..4d1f2c6ff1 100644 --- a/utils/manager/value_generator.py +++ b/utils/manager/value_generator.py @@ -13,6 +13,10 @@ from cryptography.hazmat.primitives.serialization import ( PublicFormat, ) +from utils.annotations.message import mask + +UNDEFINED = "undefined" + class ValueGenerator: PASSWORD_REGEX = re.compile( @@ -31,6 +35,7 @@ class ValueGenerator: for _ in range(10_000): password = "".join(secrets.choice(characters) for _ in range(length)) if self._is_valid_password(password): + mask(password) return password raise RuntimeError("Failed to generate a valid password after many attempts") @@ -41,7 +46,9 @@ class ValueGenerator: def generate_secure_alphanumeric(self, length: int) -> str: """Generate a cryptographically secure random alphanumeric string of the given length.""" characters = string.ascii_letters + string.digits - return "".join(secrets.choice(characters) for _ in range(length)) + value = "".join(secrets.choice(characters) for _ in range(length)) + mask(value) + return value def generate_vapid_keypair(self) -> tuple[str, str]: """Return a linked (private, public) VAPID keypair, cached per instance. @@ -81,7 +88,17 @@ class ValueGenerator: • "vapid_private" • "vapid_public" • "rsa_pem_2048" + + Returns: + the value, already registered with GitHub Actions for masking, or + ``"undefined"`` for an unknown algorithm. """ + value = self._generate(algorithm) + if value != UNDEFINED: + mask(value) + return value + + def _generate(self, algorithm: str) -> str: if algorithm == "random_hex": return secrets.token_hex(64) if algorithm == "random_hex_32": @@ -119,4 +136,4 @@ class ValueGenerator: return key.private_bytes( Encoding.PEM, PrivateFormat.TraditionalOpenSSL, NoEncryption() ).decode() - return "undefined" + return UNDEFINED From 0d01df182b6714ca7375177f7b4027d2e707f1c4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:44 +0100 Subject: [PATCH 263/554] feat(credentials): mask generated user passwords at birth in CI --- cli/administration/inventory/provision/passwords.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/administration/inventory/provision/passwords.py b/cli/administration/inventory/provision/passwords.py index 251c466b03..e7cc965de4 100644 --- a/cli/administration/inventory/provision/passwords.py +++ b/cli/administration/inventory/provision/passwords.py @@ -4,6 +4,7 @@ import re import secrets import string +from utils.annotations.message import mask from utils.manager.value_generator import ValueGenerator USER_PASSWORD_LENGTH = 64 @@ -37,6 +38,7 @@ def generate_user_password(length: int = USER_PASSWORD_LENGTH) -> str: body[secrets.randbelow(length - 1) + 1] = secrets.choice(SHELL_SAFE_MARKS) password = "".join(body) if _USER_PASSWORD_RE.match(password): + mask(password) return password raise RuntimeError("Failed to generate a user password after many attempts") From 55940aef887c8e60a4edc597cab083535a03ea60 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:44 +0100 Subject: [PATCH 264/554] test(annotations): cover secret masking --- tests/unit/python/cli/gha/test_annotations.py | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tests/unit/python/cli/gha/test_annotations.py b/tests/unit/python/cli/gha/test_annotations.py index b708aea649..9906f87248 100644 --- a/tests/unit/python/cli/gha/test_annotations.py +++ b/tests/unit/python/cli/gha/test_annotations.py @@ -5,7 +5,14 @@ import unittest from io import StringIO from unittest.mock import patch -from utils.annotations.message import error, error_each, notice, warning, warning_each +from utils.annotations.message import ( + error, + error_each, + mask, + notice, + warning, + warning_each, +) GHA_ENV = {"GITHUB_ACTIONS": "true"} NO_GHA_ENV = {"GITHUB_ACTIONS": ""} @@ -112,5 +119,35 @@ class TestAnnotationsPlainText(unittest.TestCase): self.assertIn("beta", lines[1]) +class TestMask(unittest.TestCase): + def _capture(self, env: dict[str, str], value: str) -> tuple[str, str]: + with ( + patch.dict(os.environ, env), + patch("sys.stdout", new_callable=StringIO) as out, + patch("sys.stderr", new_callable=StringIO) as err, + ): + mask(value) + return out.getvalue(), err.getvalue() + + def test_a_secret_is_registered_on_stderr_only(self) -> None: + out, err = self._capture(GHA_ENV, "s3cr€t") + self.assertEqual(out, "") + self.assertEqual(err, "::add-mask::s3cr€t\n") + + def test_each_line_of_a_multiline_secret_is_registered(self) -> None: + _, err = self._capture(GHA_ENV, "-----BEGIN-----\nabc\n\n-----END-----\n") + self.assertEqual( + err.splitlines(), + [ + "::add-mask::-----BEGIN-----", + "::add-mask::abc", + "::add-mask::-----END-----", + ], + ) + + def test_nothing_is_printed_outside_github_actions(self) -> None: + self.assertEqual(self._capture(NO_GHA_ENV, "s3cret"), ("", "")) + + if __name__ == "__main__": unittest.main() From bd45714f7a3f4e022ac5bbe4f3acfb5922b2168e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:44 +0100 Subject: [PATCH 265/554] test(credentials): cover masking of generated values --- .../utils/manager/test_value_generator.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/unit/python/utils/manager/test_value_generator.py b/tests/unit/python/utils/manager/test_value_generator.py index 46e2d08478..97ebddf6bd 100644 --- a/tests/unit/python/utils/manager/test_value_generator.py +++ b/tests/unit/python/utils/manager/test_value_generator.py @@ -1,6 +1,7 @@ import base64 import re import unittest +from unittest.mock import patch from cryptography.hazmat.primitives.asymmetric import ec, rsa from cryptography.hazmat.primitives.serialization import ( @@ -9,6 +10,7 @@ from cryptography.hazmat.primitives.serialization import ( load_pem_private_key, ) +from utils.manager import value_generator from utils.manager.value_generator import ValueGenerator @@ -20,6 +22,22 @@ class TestValueGenerator(unittest.TestCase): def setUp(self): self.vg = ValueGenerator() + def test_every_generated_value_is_registered_for_masking(self): + with patch.object(value_generator, "mask") as masked: + values = [ + self.vg.generate_strong_password(32), + self.vg.generate_secure_alphanumeric(16), + self.vg.generate_value("random_hex_16"), + ] + registered = [call.args[0] for call in masked.call_args_list] + for value in values: + self.assertIn(value, registered) + + def test_an_unknown_algorithm_masks_nothing(self): + with patch.object(value_generator, "mask") as masked: + self.assertEqual(self.vg.generate_value("nope"), "undefined") + masked.assert_not_called() + def test_generate_secure_alphanumeric(self): s = self.vg.generate_secure_alphanumeric(64) self.assertEqual(len(s), 64) From 342d6dfced0693f0afba3f313bc63392e91cf78d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sun, 25 Oct 2026 15:10:44 +0100 Subject: [PATCH 266/554] test(credentials): cover masking of generated user passwords --- .../inventory/provision/test_passwords.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/unit/python/cli/administration/inventory/provision/test_passwords.py diff --git a/tests/unit/python/cli/administration/inventory/provision/test_passwords.py b/tests/unit/python/cli/administration/inventory/provision/test_passwords.py new file mode 100644 index 0000000000..7e1ae1692c --- /dev/null +++ b/tests/unit/python/cli/administration/inventory/provision/test_passwords.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +import unittest +from unittest.mock import patch + +from cli.administration.inventory.provision import passwords + + +class TestPasswordMasking(unittest.TestCase): + def test_a_user_password_is_registered_for_masking(self) -> None: + with patch.object(passwords, "mask") as masked: + password = passwords.generate_user_password() + masked.assert_called_once_with(password) + + +if __name__ == "__main__": + unittest.main() From 56fed2e198c02c7c46f0ae86b31463871e294ca9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 267/554] docs(requirements): renumber the OpenPost publishing desk to 062 --- .../{040-web-app-openpost.md => 062-web-app-openpost.md} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename docs/requirements/{040-web-app-openpost.md => 062-web-app-openpost.md} (99%) diff --git a/docs/requirements/040-web-app-openpost.md b/docs/requirements/062-web-app-openpost.md similarity index 99% rename from docs/requirements/040-web-app-openpost.md rename to docs/requirements/062-web-app-openpost.md index 088c13d6ec..ab137c916e 100644 --- a/docs/requirements/040-web-app-openpost.md +++ b/docs/requirements/062-web-app-openpost.md @@ -1,4 +1,4 @@ -# 040 - OpenPost Publishing Desk Role +# 062 - OpenPost Publishing Desk Role ## User Story @@ -7,7 +7,7 @@ As an Infinito.Nexus PR manager, I want a self-hosted [OpenPost](https://github. ## Background This requirement implements the publishing half of the OpenProject user story "sovereign social media publishing and crossposting" (story criteria AC1, AC2, AC3, AC4, AC6, AC7 and the desk part of AC8). -Automated crossposting from Fediverse accounts (story criterion AC5 and its tests) is specified in [041-openpost-crossposter.md](041-openpost-crossposter.md), which builds on this role. +Automated crossposting from Fediverse accounts (story criterion AC5 and its tests) is specified in [063-openpost-crossposter.md](063-openpost-crossposter.md), which builds on this role. OpenPost is self-hosted and integrated like every other application of the stack: the official upstream image, configured through environment variables, wired into the shared proxy, Keycloak, Postgres, object storage and backups. ### Evaluation and selection @@ -107,7 +107,7 @@ These decisions were confirmed by the operator before implementation starts and | 8 | Provider app credentials live in the central `API` SPOT. | One place for proprietary credentials. | | 9 | Diagnostics, update check, PostHog telemetry, feedback and public profiles are disabled. | No unnecessary transmission of internal data. | | 10 | CI tests Fediverse publishing end to end against local instances through the relay, and the commercial adapters against a role-local provider simulator on the same role network; real platforms are checked manually in staging. | Real OAuth logins, public redirect hosts and per-post billing make real platforms unusable in CI. | -| 11 | Automated crossposting is a separate sidecar specified in [041](041-openpost-crossposter.md). | Separable deliverable and pull request. | +| 11 | Automated crossposting is a separate sidecar specified in [063](063-openpost-crossposter.md). | Separable deliverable and pull request. | ## Target Schema @@ -304,6 +304,6 @@ Prove every relay and simulator change in the live stack via `make compose-exec` ## See Also -- Automated crossposting: [041-openpost-crossposter.md](041-openpost-crossposter.md) +- Automated crossposting: [063-openpost-crossposter.md](063-openpost-crossposter.md) - Requirement format: [requirements.md](../contributing/requirements.md) - How agents process requirements: [requirements.md](../agents/action/requirements.md) From 02fc4856e2752f9bcef268ffb97238587a284602 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 268/554] docs(requirements): renumber the crossposter to 063 and add the fake LinkedIn provider --- ...sposter.md => 063-openpost-crossposter.md} | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) rename docs/requirements/{041-openpost-crossposter.md => 063-openpost-crossposter.md} (82%) diff --git a/docs/requirements/041-openpost-crossposter.md b/docs/requirements/063-openpost-crossposter.md similarity index 82% rename from docs/requirements/041-openpost-crossposter.md rename to docs/requirements/063-openpost-crossposter.md index ea04d0be69..8732cb86c5 100644 --- a/docs/requirements/041-openpost-crossposter.md +++ b/docs/requirements/063-openpost-crossposter.md @@ -1,4 +1,4 @@ -# 041 - OpenPost Crossposter for Automated Fediverse Crossposting +# 063 - OpenPost Crossposter for Automated Fediverse Crossposting ## User Story @@ -7,8 +7,8 @@ As an Infinito.Nexus PR manager, I want new posts on our organisation's Mastodon ## Background This requirement implements the crossposting half of the OpenProject user story "sovereign social media publishing and crossposting" (story criterion AC5 and the crossposting part of AC8). -It builds on [040-web-app-openpost.md](040-web-app-openpost.md), which delivers the OpenPost desk, the egress relay to the deployment's Fediverse instances, the connected Fediverse targets and the provider simulator for X, Facebook, Instagram and YouTube. -OpenPost's session cookies only accept same-origin requests, so programmatic access uses Bearer API tokens (observed in the 040 egress proof on 2026-10-21). +It builds on [062-web-app-openpost.md](062-web-app-openpost.md), which delivers the OpenPost desk, the egress relay to the deployment's Fediverse instances, the connected Fediverse targets and the provider simulator for X, Facebook, Instagram and YouTube. +OpenPost's session cookies only accept same-origin requests, so programmatic access uses Bearer API tokens (observed in the 062 egress proof on 2026-10-21). No evaluated product forwards Fediverse posts unattended. OpenPost's built-in workflows refuse to schedule unless a human approves the exact revision in the same run, and its native imports never dispatch automation ([runtime.go](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/server/internal/services/workflows/runtime.go)). @@ -28,13 +28,13 @@ The crossposter therefore lives in the role as a sidecar that detects posts, app | Idempotency | Mastodon and Pixelfed honour `Idempotency-Key` for one hour, PeerTube has none, and OpenPost answers a reused key with different input with HTTP 409. | [post_status_service.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/services/post_status_service.rb), [OpenPost API reliability](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/docs/content/docs/automate/api/reliability.mdx) | | OpenPost publish API | `POST /api/v1/publications` takes the workspace, title, source text, target accounts or a social set, renditions, media, metadata and an optional `scheduled_at`; `publish-now`, `events` and media upload sessions complete the flow. | [openapi.json](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/apps/web/openapi.json) | | Length rules | Mastodon counts graphemes of content warning plus text with 23 per URL; X weights emoji and CJK characters double; Threads allows 500 characters; Instagram allows 2,200 characters and 30 hashtags. | [status_length_validator.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/validators/status_length_validator.rb), [X counting](https://docs.x.com/fundamentals/counting-characters) | -| Media rules | Pixelfed rejects text-only posts; Mastodon caps video at 99 MB; Instagram accepts JPEG only. | [ApiV1Controller.php](https://github.com/pixelfed/pixelfed/blob/v0.15.1/app/Http/Controllers/Api/ApiV1Controller.php), [media_attachment.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/models/media_attachment.rb), [040 platform constraints](040-web-app-openpost.md#platform-constraints) | +| Media rules | Pixelfed rejects text-only posts; Mastodon caps video at 99 MB; Instagram accepts JPEG only. | [ApiV1Controller.php](https://github.com/pixelfed/pixelfed/blob/v0.15.1/app/Http/Controllers/Api/ApiV1Controller.php), [media_attachment.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/app/models/media_attachment.rb), [062 platform constraints](062-web-app-openpost.md#platform-constraints) | | Test tokens | Mastodon disables the password grant and `tootctl` mints no tokens; PeerTube offers a password grant; Pixelfed issues personal access tokens. | [doorkeeper.rb](https://github.com/mastodon/mastodon/blob/v4.7.3/config/initializers/doorkeeper.rb), [tootctl](https://docs.joinmastodon.org/admin/tootctl/) | | X cost | A post costs $0.015, a post containing a URL costs $0.20. | [X pricing](https://docs.x.com/x-api/getting-started/pricing) | ### In-repo analogues -- `web-app-openpost` from [040](040-web-app-openpost.md) provides the desk, the API, the provider simulator and the local Fediverse targets. +- `web-app-openpost` from [062](062-web-app-openpost.md) provides the desk, the API, the provider simulator and the local Fediverse targets. - [`web-app-bluesky`](../../roles/web-app-bluesky/) builds its sidecar from `files/login-broker/Dockerfile`. - `roles/web-app-n8n/files/python/provision/` is tested from `tests/unit/python/roles/web-app-n8n/files/provision/`, the pattern for role-local Python tests. @@ -49,13 +49,15 @@ These decisions were confirmed by the operator before implementation starts and | 3 | Detection uses authenticated REST polling with persisted cursors. | The only method that is complete on Mastodon, Pixelfed and PeerTube. | | 4 | Crossposting state lives in a `crossposter` schema of the role's Postgres database, unique per source post and target account. | Durable duplicate prevention independent of platform idempotency windows. | | 5 | Routes are declared in the inventory with a `review` mode (OpenPost draft) and an `auto` mode (immediate publishing). | Configurable routing with optional manual approval. | -| 6 | CI covers Mastodon, Pixelfed and PeerTube as sources against local instances, Fediverse targets end to end, and commercial targets through the 040 provider simulator. | Operator decision on automated testing. | +| 6 | CI covers Mastodon, Pixelfed and PeerTube as sources against local instances, Fediverse targets end to end, and commercial targets through the 062 provider simulator. | Operator decision on automated testing. | | 7 | New routes start in `review` mode. | Routes are cleared for unattended publishing one by one. | | 8 | Activating a route forwards no existing posts; its cursor starts at the newest item. | Prevents flooding targets with the account history. | | 9 | The opt-out hashtag is `nocrosspost`. | Authors can keep a single post local. | | 10 | The X attribution template omits the source link. | A post with a URL costs about 13 times more on X. | | 11 | One active instance, enforced by a Postgres advisory lock. | Two pollers would race for the same cursors. | | 12 | Dead-lettered items are reported by email through the platform mail service. | Failures reach the PR team without another dashboard. | +| 13 | The end-to-end journey reaches commercial networks through a stateful fake provider owned by the role, piloted on LinkedIn; real provider sandboxes are not used in CI. | Meta has paused programmatic test users, LinkedIn test profiles are created by hand only, X and YouTube offer no sandbox, and CI runs must stay offline, deterministic and free of real accounts. | +| 14 | The fake is a role-local Python sidecar entity `provider`, enabled with the simulator; the simulator keeps answering for every network the fake does not serve yet. | Networks move to the fake one at a time without losing coverage. | ## Target Schema @@ -78,7 +80,15 @@ roles/web-app-openpost/files/crossposter/ ├── mastodon.py ├── peertube.py └── pixelfed.py +roles/web-app-openpost/files/provider/ +├── Dockerfile +└── provider/ + ├── __init__.py + ├── __main__.py + ├── linkedin.py + └── store.py tests/unit/python/roles/web-app-openpost/files/crossposter/ +tests/unit/python/roles/web-app-openpost/files/provider/ ``` ### Route shape (proposed) @@ -177,6 +187,18 @@ crossposter: - [ ] The Playwright spec shows the administrator persona finding a crossposted draft in the desk, editing it and scheduling it. - [ ] `make test` and `make roundtrip apps="web-app-openpost"` are green. +### Fake provider and end-to-end journey + +- [ ] The `provider` entity is built from `files/provider/Dockerfile` on the Python base image pinned in `meta/services.yml`, runs as a non-root user, has a healthcheck that works on the slim image, and is enabled exactly when the simulator is. +- [ ] It answers for `www.linkedin.com` and `api.linkedin.com` on the role network with a certificate OpenPost trusts, and the simulator no longer serves LinkedIn. +- [ ] A person can create an account on the fake's sign-up page, and the account exists only in the fake's state. +- [ ] `GET /oauth/v2/authorization` shows sign-in and consent for OpenPost's client and redirects to the registered callback with a single-use code bound to the client id and redirect URI; `POST /oauth/v2/accessToken` exchanges codes and refresh tokens; `GET /v2/userinfo` describes the signed-in account. +- [ ] `POST /rest/images?action=initializeUpload` and its upload URL store images, `POST /rest/posts` stores a post authored by the token's member and answers its id in `x-restli-id`, and `GET /rest/posts/{id}` returns that post; requests with an unknown token are refused. +- [ ] The Playwright browser reaches the fake's pages under the real LinkedIn host names by routing them to the fake's published plain-HTTP port; tor rounds skip the journey. +- [ ] The Playwright spec walks the journey as the administrator: it signs up a new account on the fake, connects it to OpenPost through the fake's consent page, adds it to the review social set, posts on the local Mastodon, finds the crossposter's draft in the desk, edits it and publishes it, then opens the post through the URL OpenPost recorded, finds the edited text, and finds that post exactly once in the fake's delivery list. +- [ ] The CLI test connects LinkedIn through the fake's code flow instead of calling OpenPost's callback with a fixed code. +- [x] Unit tests under `tests/unit/python/roles/web-app-openpost/files/provider/` cover sign-up, the code and refresh flows, token checks, and storing and reading posts and images. + ### Documentation - [ ] `Administration.md` documents the route schema with examples, the review and auto modes, the opt-out hashtag, the attribution templates and their X cost impact, token creation per source platform, and the handling of dead-lettered items. @@ -189,6 +211,7 @@ crossposter: - Push-based detection through Mastodon webhooks, streaming or an ActivityPub follower actor. - Bluesky as a crossposting target, because federation through `web-app-bridgy-fed` already reaches it. - TikTok publishing, because TikTok's terms exclude in-house upload tools. +- Serving X, Facebook, Instagram and YouTube from the fake provider; they follow the LinkedIn pilot in later work. ## Validation Apps @@ -201,7 +224,7 @@ Smoke: post as a test user on the local Mastodon instance, find the draft in the ## Prerequisites -Every Acceptance Criterion of [040](040-web-app-openpost.md) MUST be checked off before this requirement starts. +Every Acceptance Criterion of [062](062-web-app-openpost.md) MUST be checked off before this requirement starts. The agent MUST read [AGENTS.md](../../AGENTS.md), then [Compose Loop](../agents/action/iteration/compose.md), [Unit Tests](../contributing/actions/testing/unit.md) and the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md). ## Implementation Strategy @@ -217,6 +240,6 @@ Verify on the deployed Mastodon, Pixelfed and PeerTube versions that the behavio ## See Also -- Publishing desk: [040-web-app-openpost.md](040-web-app-openpost.md) +- Publishing desk: [062-web-app-openpost.md](062-web-app-openpost.md) - Requirement format: [requirements.md](../contributing/requirements.md) - How agents process requirements: [requirements.md](../agents/action/requirements.md) From 6948a7ed8ce6592f0ebb1746d56e287d497e9e11 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 269/554] feat(openpost): add the fake provider's account, token and post store --- .../files/provider/provider/store.py | 228 ++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 roles/web-app-openpost/files/provider/provider/store.py diff --git a/roles/web-app-openpost/files/provider/provider/store.py b/roles/web-app-openpost/files/provider/provider/store.py new file mode 100644 index 0000000000..173c264ea0 --- /dev/null +++ b/roles/web-app-openpost/files/provider/provider/store.py @@ -0,0 +1,228 @@ +from __future__ import annotations + +import hashlib +import hmac +import itertools +import secrets +import threading +import time +from dataclasses import dataclass +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from collections.abc import Callable + +CODE_SECONDS = 600 +ACCESS_SECONDS = 5_184_000 +REFRESH_SECONDS = 31_536_000 +HASH_ROUNDS = 100_000 +FIRST_POST = 7_300_000_000_000_000_001 + + +class StoreError(ValueError): + pass + + +@dataclass(frozen=True) +class Account: + member: str + name: str + email: str + salt: str + password_hash: str + + @property + def urn(self) -> str: + return f"urn:li:person:{self.member}" + + +@dataclass(frozen=True) +class Grant: + member: str + client_id: str + redirect_uri: str + scope: str + expires_at: float + + +@dataclass(frozen=True) +class Token: + member: str + scope: str + expires_at: float + + +@dataclass(frozen=True) +class Image: + urn: str + owner: str + upload_id: str + size: int + + +@dataclass(frozen=True) +class Post: + id: str + author: str + commentary: str + visibility: str + content: dict + created_at: float + + +def _digest(password: str, salt: str) -> str: + return hashlib.pbkdf2_hmac( + "sha256", password.encode(), salt.encode(), HASH_ROUNDS + ).hex() + + +class Store: + def __init__(self, now: Callable[[], float] = time.time) -> None: + self.now = now + self._lock = threading.Lock() + self._accounts: dict[str, Account] = {} + self._codes: dict[str, Grant] = {} + self._access: dict[str, Token] = {} + self._refresh: dict[str, Token] = {} + self._images: dict[str, Image] = {} + self._uploads: dict[str, bytes] = {} + self._posts: dict[str, Post] = {} + self._post_ids = itertools.count(FIRST_POST) + + def create_account(self, name: str, email: str, password: str) -> Account: + name, email = name.strip(), email.strip().lower() + if not name or not email or not password: + raise StoreError("name, email and password are required") + with self._lock: + if email in self._accounts: + raise StoreError("an account with this email already exists") + salt = secrets.token_hex(16) + account = Account( + member=secrets.token_hex(6), + name=name, + email=email, + salt=salt, + password_hash=_digest(password, salt), + ) + self._accounts[email] = account + return account + + def authenticate(self, email: str, password: str) -> Account | None: + account = self._accounts.get(email.strip().lower()) + if account is None: + return None + if not hmac.compare_digest( + account.password_hash, _digest(password, account.salt) + ): + return None + return account + + def account(self, member: str) -> Account | None: + return next( + (item for item in self._accounts.values() if item.member == member), None + ) + + def accounts(self) -> list[Account]: + return list(self._accounts.values()) + + def issue_code( + self, member: str, client_id: str, redirect_uri: str, scope: str + ) -> str: + code = secrets.token_urlsafe(32) + with self._lock: + self._codes[code] = Grant( + member, client_id, redirect_uri, scope, self.now() + CODE_SECONDS + ) + return code + + def redeem_code(self, code: str, client_id: str, redirect_uri: str) -> Grant: + with self._lock: + grant = self._codes.pop(code, None) + if grant is None or grant.expires_at < self.now(): + raise StoreError("the authorization code is invalid or expired") + if grant.client_id != client_id or grant.redirect_uri != redirect_uri: + raise StoreError("the authorization code belongs to another client") + return grant + + def issue_tokens(self, member: str, scope: str) -> dict: + access, refresh = secrets.token_urlsafe(48), secrets.token_urlsafe(48) + now = self.now() + with self._lock: + self._access[access] = Token(member, scope, now + ACCESS_SECONDS) + self._refresh[refresh] = Token(member, scope, now + REFRESH_SECONDS) + return { + "access_token": access, + "expires_in": ACCESS_SECONDS, + "refresh_token": refresh, + "refresh_token_expires_in": REFRESH_SECONDS, + "scope": scope, + } + + def refresh(self, refresh_token: str) -> dict: + token = self._refresh.get(refresh_token) + now = self.now() + if token is None or token.expires_at < now: + raise StoreError("the refresh token is invalid or expired") + access = secrets.token_urlsafe(48) + with self._lock: + self._access[access] = Token(token.member, token.scope, now + ACCESS_SECONDS) + return { + "access_token": access, + "expires_in": ACCESS_SECONDS, + "refresh_token": refresh_token, + "refresh_token_expires_in": int(token.expires_at - now), + "scope": token.scope, + } + + def member_for(self, access_token: str) -> Account | None: + token = self._access.get(access_token) + if token is None or token.expires_at < self.now(): + return None + return self.account(token.member) + + def register_image(self, owner: str) -> Image: + image = Image( + urn=f"urn:li:image:{secrets.token_hex(8)}", + owner=owner, + upload_id=secrets.token_hex(12), + size=0, + ) + with self._lock: + self._images[image.upload_id] = image + return image + + def store_upload(self, upload_id: str, owner: str, data: bytes) -> Image: + with self._lock: + image = self._images.get(upload_id) + if image is None or image.owner != owner: + raise StoreError("the upload belongs to no image of this member") + stored = Image(image.urn, image.owner, image.upload_id, len(data)) + self._images[upload_id] = stored + self._uploads[image.urn] = data + return stored + + def uploaded(self, urn: str, owner: str) -> bool: + return urn in self._uploads and any( + image.urn == urn and image.owner == owner for image in self._images.values() + ) + + def create_post( + self, author: str, commentary: str, visibility: str, content: dict + ) -> Post: + with self._lock: + post = Post( + id=f"urn:li:share:{next(self._post_ids)}", + author=author, + commentary=commentary, + visibility=visibility, + content=content, + created_at=self.now(), + ) + self._posts[post.id] = post + return post + + def post(self, post_id: str) -> Post | None: + return self._posts.get(post_id) + + def posts(self) -> list[Post]: + return list(self._posts.values()) From 1ab72e1397ebb8b1ce8949dd37887905bf5e3352 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 270/554] feat(openpost): serve LinkedIn sign-up, OAuth, images and posts from the fake provider --- .../files/provider/provider/linkedin.py | 358 ++++++++++++++++++ 1 file changed, 358 insertions(+) create mode 100644 roles/web-app-openpost/files/provider/provider/linkedin.py diff --git a/roles/web-app-openpost/files/provider/provider/linkedin.py b/roles/web-app-openpost/files/provider/provider/linkedin.py new file mode 100644 index 0000000000..72ec0aecc8 --- /dev/null +++ b/roles/web-app-openpost/files/provider/provider/linkedin.py @@ -0,0 +1,358 @@ +from __future__ import annotations + +import html +import json +import re +import urllib.parse +from dataclasses import asdict, dataclass + +from provider.store import Account, Store, StoreError + +API_HOST = "api.linkedin.com" +POST_VISIBILITIES = ("PUBLIC", "CONNECTIONS") +ESCAPED_MARKUP = re.compile(r"\\([|{}@\[\]()<>#\\*_~])") +SHARE_PATH = re.compile(r"^/rest/posts/(?P.+)$") +FEED_PATH = re.compile(r"^/feed/update/(?P.+)$") +UPLOAD_PATH = re.compile(r"^/upload/images/(?P[0-9a-f]+)$") + + +@dataclass(frozen=True) +class Client: + secret: str + name: str + redirect_uris: tuple[str, ...] + + +@dataclass(frozen=True) +class Request: + method: str + path: str + query: dict[str, str] + headers: dict[str, str] + body: bytes + + def form(self) -> dict[str, str]: + return dict(urllib.parse.parse_qsl(self.body.decode(), keep_blank_values=True)) + + def bearer(self) -> str: + value = self.headers.get("authorization", "") + return value[7:] if value.lower().startswith("bearer ") else "" + + +@dataclass(frozen=True) +class Response: + status: int + headers: dict[str, str] + body: bytes + + +def plain_text(commentary: str) -> str: + return ESCAPED_MARKUP.sub(r"\1", commentary) + + +def _json(status: int, payload: object, headers: dict[str, str] | None = None) -> Response: + return Response( + status, + {"Content-Type": "application/json", **(headers or {})}, + json.dumps(payload).encode(), + ) + + +def _error(status: int, code: str, message: str) -> Response: + return _json(status, {"status": status, "code": code, "message": message}) + + +def _redirect(location: str) -> Response: + return Response(302, {"Location": location}, b"") + + +def _page(status: int, title: str, body: str) -> Response: + document = ( + "" + f"{html.escape(title)}
" + f"

{html.escape(title)}

{body}
" + ) + return Response(status, {"Content-Type": "text/html; charset=utf-8"}, document.encode()) + + +def _hidden(fields: dict[str, str]) -> str: + return "".join( + f"" + for name, value in fields.items() + ) + + +def _field(label: str, name: str, kind: str) -> str: + return ( + f"" + ) + + +def _with_query(url: str, params: dict[str, str]) -> str: + joiner = "&" if urllib.parse.urlsplit(url).query else "?" + return url + joiner + urllib.parse.urlencode(params) + + +class LinkedIn: + def __init__(self, store: Store, clients: dict[str, Client]) -> None: + self.store = store + self.clients = clients + + def handle(self, request: Request) -> Response: + routes = { + ("GET", "/signup"): self.signup_page, + ("POST", "/signup"): self.signup, + ("GET", "/oauth/v2/authorization"): self.authorization_page, + ("POST", "/oauth/v2/authorization"): self.authorize, + ("POST", "/oauth/v2/accessToken"): self.access_token, + ("GET", "/v2/userinfo"): self.userinfo, + ("POST", "/rest/images"): self.initialize_upload, + ("POST", "/rest/posts"): self.create_post, + ("GET", "/__fake/health"): self.health, + ("GET", "/__fake/linkedin/posts"): self.admin_posts, + ("GET", "/__fake/linkedin/accounts"): self.admin_accounts, + } + handler = routes.get((request.method, request.path)) + if handler is not None: + return handler(request) + for method, pattern, dynamic in ( + ("GET", SHARE_PATH, self.read_post), + ("GET", FEED_PATH, self.feed_page), + ("PUT", UPLOAD_PATH, self.upload), + ): + match = pattern.match(request.path) + if match and request.method == method: + return dynamic(request, urllib.parse.unquote(match.group("id"))) + return _error(404, "NOT_FOUND", f"{request.method} {request.path} is not served") + + def health(self, request: Request) -> Response: + return Response(200, {"Content-Type": "text/plain"}, b"ok") + + def signup_page(self, request: Request, error: str = "") -> Response: + notice = f"

{html.escape(error)}

" if error else "" + form = ( + "
" + f"{_hidden({'next': request.query.get('next', '')})}" + f"{_field('Name', 'name', 'text')}{_field('Email', 'email', 'email')}" + f"{_field('Password', 'password', 'password')}" + "
" + ) + return _page(400 if error else 200, "Join LinkedIn", notice + form) + + def signup(self, request: Request) -> Response: + form = request.form() + try: + self.store.create_account( + form.get("name", ""), form.get("email", ""), form.get("password", "") + ) + except StoreError as error: + return self.signup_page( + Request("GET", "/signup", {"next": form.get("next", "")}, {}, b""), + str(error), + ) + destination = form.get("next", "") + if destination.startswith("/oauth/v2/authorization?"): + return Response(303, {"Location": destination}, b"") + return _page(201, "Account created", "

Your account is ready.

") + + def _client(self, params: dict[str, str]) -> Client | None: + client = self.clients.get(params.get("client_id", "")) + if client is None or params.get("redirect_uri", "") not in client.redirect_uris: + return None + return client + + def authorization_page(self, request: Request, error: str = "") -> Response: + params = request.query + client = self._client(params) + if client is None or params.get("response_type") != "code": + return _page(400, "Invalid request", "

The application is not registered.

") + here = "/oauth/v2/authorization?" + urllib.parse.urlencode(params) + notice = f"

{html.escape(error)}

" if error else "" + scopes = "".join( + f"
  • {html.escape(scope)}
  • " for scope in params.get("scope", "").split() + ) + carried = { + key: params.get(key, "") + for key in ("client_id", "redirect_uri", "scope", "state", "response_type") + } + form = ( + f"

    {html.escape(client.name)} would like to access your account.

    " + f"
      {scopes}
    " + "
    " + f"{_hidden(carried)}{_field('Email', 'email', 'email')}" + f"{_field('Password', 'password', 'password')}" + "" + "" + "
    " + f"

    Join now

    " + ) + return _page(400 if error else 200, "Sign in to LinkedIn", notice + form) + + def authorize(self, request: Request) -> Response: + form = request.form() + client = self._client(form) + if client is None or form.get("response_type") != "code": + return _page(400, "Invalid request", "

    The application is not registered.

    ") + redirect_uri, state = form["redirect_uri"], form.get("state", "") + if form.get("decision") != "allow": + return _redirect( + _with_query( + redirect_uri, + {"error": "user_cancelled_authorize", "state": state}, + ) + ) + account = self.store.authenticate(form.get("email", ""), form.get("password", "")) + if account is None: + carried = {key: form.get(key, "") for key in ("client_id", "redirect_uri", "scope", "state", "response_type")} + return self.authorization_page( + Request("GET", "/oauth/v2/authorization", carried, {}, b""), + "Wrong email or password.", + ) + code = self.store.issue_code( + account.member, form["client_id"], redirect_uri, form.get("scope", "") + ) + return _redirect(_with_query(redirect_uri, {"code": code, "state": state})) + + def access_token(self, request: Request) -> Response: + form = request.form() + client = self.clients.get(form.get("client_id", "")) + if client is None or client.secret != form.get("client_secret", ""): + return _json(401, {"error": "invalid_client", "error_description": "Client authentication failed"}) + try: + if form.get("grant_type") == "authorization_code": + grant = self.store.redeem_code( + form.get("code", ""), form["client_id"], form.get("redirect_uri", "") + ) + return _json(200, self.store.issue_tokens(grant.member, grant.scope)) + if form.get("grant_type") == "refresh_token": + return _json(200, self.store.refresh(form.get("refresh_token", ""))) + except StoreError as error: + return _json(400, {"error": "invalid_grant", "error_description": str(error)}) + return _json(400, {"error": "unsupported_grant_type", "error_description": "Unsupported grant type"}) + + def _member(self, request: Request) -> Account | None: + return self.store.member_for(request.bearer()) + + def userinfo(self, request: Request) -> Response: + account = self._member(request) + if account is None: + return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + given, _, family = account.name.partition(" ") + return _json( + 200, + { + "sub": account.member, + "name": account.name, + "given_name": given, + "family_name": family, + "picture": "", + "email": account.email, + "email_verified": True, + "locale": {"country": "US", "language": "en"}, + }, + ) + + def initialize_upload(self, request: Request) -> Response: + account = self._member(request) + if account is None: + return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + if request.query.get("action") != "initializeUpload": + return _error(400, "ILLEGAL_ARGUMENT", "Unsupported action") + payload = json.loads(request.body or b"{}") + owner = str((payload.get("initializeUploadRequest") or {}).get("owner", "")) + if owner != account.urn: + return _error(403, "ACCESS_DENIED", "The owner is not the authenticated member") + image = self.store.register_image(owner) + return _json( + 200, + { + "value": { + "uploadUrlExpiresAt": int((self.store.now() + 3600) * 1000), + "uploadUrl": f"https://{API_HOST}/upload/images/{image.upload_id}", + "image": image.urn, + } + }, + ) + + def upload(self, request: Request, upload_id: str) -> Response: + account = self._member(request) + if account is None: + return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + try: + self.store.store_upload(upload_id, account.urn, request.body) + except StoreError as error: + return _error(404, "NOT_FOUND", str(error)) + return Response(201, {}, b"") + + def create_post(self, request: Request) -> Response: + account = self._member(request) + if account is None: + return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + payload = json.loads(request.body or b"{}") + if payload.get("author") != account.urn: + return _error(403, "ACCESS_DENIED", "The author is not the authenticated member") + visibility = payload.get("visibility") + if visibility not in POST_VISIBILITIES or payload.get("lifecycleState") != "PUBLISHED": + return _error(422, "UNPROCESSABLE_ENTITY", "Unsupported visibility or lifecycle state") + content = payload.get("content") or {} + media = (content.get("media") or {}).get("id") + if media and not self.store.uploaded(str(media), account.urn): + return _error(422, "UNPROCESSABLE_ENTITY", "The media was never uploaded by this member") + post = self.store.create_post( + account.urn, str(payload.get("commentary", "")), visibility, content + ) + return Response(201, {"x-restli-id": post.id}, b"") + + def _post_body(self, post_id: str) -> dict | None: + post = self.store.post(post_id) + if post is None: + return None + return { + "id": post.id, + "author": post.author, + "commentary": post.commentary, + "visibility": post.visibility, + "lifecycleState": "PUBLISHED", + "content": post.content, + "createdAt": int(post.created_at * 1000), + } + + def read_post(self, request: Request, post_id: str) -> Response: + if self._member(request) is None: + return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + body = self._post_body(post_id) + if body is None: + return _error(404, "NOT_FOUND", f"Post {post_id} does not exist") + return _json(200, body) + + def feed_page(self, request: Request, post_id: str) -> Response: + post = self.store.post(post_id) + if post is None: + return _page(404, "Post not found", "

    This post does not exist.

    ") + member = post.author.rsplit(":", 1)[-1] + author = self.store.account(member) + name = author.name if author else member + return _page( + 200, + f"{name} on LinkedIn", + f"

    {html.escape(plain_text(post.commentary))}

    ", + ) + + def admin_posts(self, request: Request) -> Response: + return _json( + 200, + [ + {**asdict(post), "text": plain_text(post.commentary)} + for post in self.store.posts() + ], + ) + + def admin_accounts(self, request: Request) -> Response: + return _json( + 200, + [ + {"member": account.member, "name": account.name, "email": account.email} + for account in self.store.accounts() + ], + ) From c6223ebadb5145e44117fede40a81dfd4276bfcb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 271/554] feat(openpost): add the fake provider's HTTP and TLS server entry point --- .../files/provider/provider/__main__.py | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 roles/web-app-openpost/files/provider/provider/__main__.py diff --git a/roles/web-app-openpost/files/provider/provider/__main__.py b/roles/web-app-openpost/files/provider/provider/__main__.py new file mode 100644 index 0000000000..eba234e106 --- /dev/null +++ b/roles/web-app-openpost/files/provider/provider/__main__.py @@ -0,0 +1,103 @@ +from __future__ import annotations + +import argparse +import json +import logging +import ssl +import sys +import threading +import urllib.error +import urllib.parse +import urllib.request +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer +from pathlib import Path + +from provider.linkedin import Client, LinkedIn, Request +from provider.store import Store + +LOG = logging.getLogger("provider") +HEALTH_TIMEOUT_SECONDS = 5 + + +def load(path: str) -> dict: + return json.loads(Path(path).read_text()) + + +def application(config: dict) -> LinkedIn: + clients = { + client_id: Client( + secret=str(client["secret"]), + name=str(client["name"]), + redirect_uris=tuple(str(uri) for uri in client["redirect_uris"]), + ) + for client_id, client in config["linkedin"]["clients"].items() + } + return LinkedIn(Store(), clients) + + +def handler_for(app: LinkedIn) -> type[BaseHTTPRequestHandler]: + class Handler(BaseHTTPRequestHandler): + protocol_version = "HTTP/1.1" + + def _dispatch(self) -> None: + url = urllib.parse.urlsplit(self.path) + length = int(self.headers.get("Content-Length") or 0) + request = Request( + method=self.command, + path=url.path, + query=dict(urllib.parse.parse_qsl(url.query, keep_blank_values=True)), + headers={key.lower(): value for key, value in self.headers.items()}, + body=self.rfile.read(length) if length else b"", + ) + response = app.handle(request) + self.send_response(response.status) + for name, value in response.headers.items(): + self.send_header(name, value) + self.send_header("Content-Length", str(len(response.body))) + self.end_headers() + self.wfile.write(response.body) + + do_GET = do_POST = do_PUT = do_DELETE = _dispatch + + def log_message(self, format: str, *args: object) -> None: + LOG.info("%s %s", self.address_string(), format % args) + + return Handler + + +def serve(config: dict) -> int: + handler = handler_for(application(config)) + plain = ThreadingHTTPServer(("0.0.0.0", int(config["http_port"])), handler) # noqa: S104 published only on the role network and the CI loopback + secure = ThreadingHTTPServer(("0.0.0.0", int(config["https_port"])), handler) # noqa: S104 published only on the role network and the CI loopback + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain(config["certificate"], config["key"]) + secure.socket = context.wrap_socket(secure.socket, server_side=True) + threading.Thread(target=secure.serve_forever, daemon=True).start() + LOG.info("serving LinkedIn on %s and %s", config["http_port"], config["https_port"]) + plain.serve_forever() + return 0 + + +def health(config: dict) -> int: + url = f"http://127.0.0.1:{int(config['http_port'])}/__fake/health" + try: + with urllib.request.urlopen(url, timeout=HEALTH_TIMEOUT_SECONDS) as answer: # noqa: S310 fixed loopback URL + return 0 if answer.status == 200 else 1 + except (urllib.error.URLError, OSError): + return 1 + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(prog="provider") + parser.add_argument("command", choices=("serve", "health")) + parser.add_argument("--config", required=True) + args = parser.parse_args(argv) + logging.basicConfig( + level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s" + ) + config = load(args.config) + return serve(config) if args.command == "serve" else health(config) + + +if __name__ == "__main__": + sys.exit(main()) From 7b3e12fcbed57b38073349484f30a856488e6ff7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 272/554] feat(openpost): add the fake provider package --- roles/web-app-openpost/files/provider/provider/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 roles/web-app-openpost/files/provider/provider/__init__.py diff --git a/roles/web-app-openpost/files/provider/provider/__init__.py b/roles/web-app-openpost/files/provider/provider/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 9c88722e6dfabd10f09de62539baf2e4d727b166 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 273/554] feat(openpost): build the fake provider image as a non-root user --- .../files/provider/Dockerfile | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 roles/web-app-openpost/files/provider/Dockerfile diff --git a/roles/web-app-openpost/files/provider/Dockerfile b/roles/web-app-openpost/files/provider/Dockerfile new file mode 100644 index 0000000000..44501dd51e --- /dev/null +++ b/roles/web-app-openpost/files/provider/Dockerfile @@ -0,0 +1,21 @@ +ARG PROVIDER_BASE_IMAGE +ARG PROVIDER_BASE_VERSION +FROM ${PROVIDER_BASE_IMAGE}:${PROVIDER_BASE_VERSION} + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 + +ARG PROVIDER_UID +RUN groupadd --system --gid "${PROVIDER_UID}" provider \ + && useradd --system --uid "${PROVIDER_UID}" --gid provider --home-dir /app --shell /usr/sbin/nologin provider + +WORKDIR /app + +COPY provider ./provider + +USER provider + +HEALTHCHECK --interval=2m --timeout=5s --retries=3 --start-period=10m --start-interval=5s \ + CMD ["python", "-m", "provider", "health", "--config", "/run/secrets/provider.json"] + +CMD ["python", "-m", "provider", "serve", "--config", "/run/secrets/provider.json"] From cfa8675eae450a71ffa636323bfc9d247d647256 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 274/554] chore(openpost): justify the fake provider's files layout --- roles/web-app-openpost/files/provider/.nocheck | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/web-app-openpost/files/provider/.nocheck diff --git a/roles/web-app-openpost/files/provider/.nocheck b/roles/web-app-openpost/files/provider/.nocheck new file mode 100644 index 0000000000..17666c9aea --- /dev/null +++ b/roles/web-app-openpost/files/provider/.nocheck @@ -0,0 +1 @@ +# nocheck: role-files-layout - Docker build context of the fake provider sidecar; the Dockerfile copies the importable provider package as one tree, so its modules cannot be split by language. From 44d86bbf130ca038a570eeac0d6ab64f9f50f30b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 275/554] test(openpost): put the fake provider package on the test path --- .../roles/web-app-openpost/files/provider/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/provider/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/__init__.py b/tests/unit/python/roles/web-app-openpost/files/provider/__init__.py new file mode 100644 index 0000000000..9f7330316f --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/provider/__init__.py @@ -0,0 +1,10 @@ +import sys +from pathlib import Path + +PROJECT_ROOT: Path = Path(__file__).resolve().parents[7] +PACKAGE_ROOT: Path = PROJECT_ROOT / "roles/web-app-openpost/files/provider" + +if str(PACKAGE_ROOT) not in sys.path: + sys.path.insert(0, str(PACKAGE_ROOT)) + +__all__ = ["PACKAGE_ROOT", "PROJECT_ROOT"] From 0dc5fd2d78c91bc866fb37f888522dd26a1ed495 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 276/554] test(openpost): add the fake provider test package --- .../roles/web-app-openpost/files/provider/provider/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/files/provider/provider/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/__init__.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From d7f67f19afb194539ead826ea88e82b150480b6b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 277/554] test(openpost): cover the fake provider store --- .../files/provider/provider/test_store.py | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py new file mode 100644 index 0000000000..d1d2acca80 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py @@ -0,0 +1,109 @@ +from __future__ import annotations + +import unittest + +from provider import store + + +class Clock: + def __init__(self) -> None: + self.value = 1_000.0 + + def __call__(self) -> float: + return self.value + + +class TestAccounts(unittest.TestCase): + def setUp(self) -> None: + self.store = store.Store() + + def test_an_account_signs_in_with_its_password_only(self) -> None: + account = self.store.create_account("Ada Lovelace", "Ada@Example.org", "s3cret") + self.assertEqual(self.store.authenticate("ada@example.org", "s3cret"), account) + self.assertIsNone(self.store.authenticate("ada@example.org", "wrong")) + self.assertIsNone(self.store.authenticate("nobody@example.org", "s3cret")) + + def test_the_password_is_never_stored_in_plaintext(self) -> None: + account = self.store.create_account("Ada", "ada@example.org", "s3cret") + self.assertNotIn("s3cret", account.password_hash) + + def test_an_email_belongs_to_one_account(self) -> None: + self.store.create_account("Ada", "ada@example.org", "s3cret") + with self.assertRaises(store.StoreError): + self.store.create_account("Ada Again", "ADA@example.org", "other") + + def test_empty_fields_are_refused(self) -> None: + with self.assertRaises(store.StoreError): + self.store.create_account(" ", "ada@example.org", "s3cret") + + +class TestGrants(unittest.TestCase): + def setUp(self) -> None: + self.clock = Clock() + self.store = store.Store(now=self.clock) + self.member = self.store.create_account("Ada", "ada@example.org", "pw").member + + def test_a_code_is_redeemed_once_by_its_client(self) -> None: + code = self.store.issue_code(self.member, "client", "https://app/cb", "openid") + grant = self.store.redeem_code(code, "client", "https://app/cb") + self.assertEqual(grant.member, self.member) + with self.assertRaises(store.StoreError): + self.store.redeem_code(code, "client", "https://app/cb") + + def test_a_code_for_another_client_or_redirect_is_refused(self) -> None: + code = self.store.issue_code(self.member, "client", "https://app/cb", "openid") + with self.assertRaises(store.StoreError): + self.store.redeem_code(code, "client", "https://evil/cb") + + def test_an_expired_code_is_refused(self) -> None: + code = self.store.issue_code(self.member, "client", "https://app/cb", "openid") + self.clock.value += store.CODE_SECONDS + 1 + with self.assertRaises(store.StoreError): + self.store.redeem_code(code, "client", "https://app/cb") + + def test_tokens_identify_the_member_until_they_expire(self) -> None: + tokens = self.store.issue_tokens(self.member, "openid") + self.assertEqual(self.store.member_for(tokens["access_token"]).member, self.member) + self.clock.value += store.ACCESS_SECONDS + 1 + self.assertIsNone(self.store.member_for(tokens["access_token"])) + + def test_a_refresh_keeps_the_refresh_token_and_issues_a_new_access_token(self) -> None: + tokens = self.store.issue_tokens(self.member, "openid") + refreshed = self.store.refresh(tokens["refresh_token"]) + self.assertEqual(refreshed["refresh_token"], tokens["refresh_token"]) + self.assertNotEqual(refreshed["access_token"], tokens["access_token"]) + self.assertEqual(self.store.member_for(refreshed["access_token"]).member, self.member) + + def test_an_unknown_refresh_token_is_refused(self) -> None: + with self.assertRaises(store.StoreError): + self.store.refresh("nope") + + +class TestContent(unittest.TestCase): + def setUp(self) -> None: + self.store = store.Store() + self.owner = self.store.create_account("Ada", "ada@example.org", "pw").urn + + def test_an_image_counts_as_uploaded_only_after_its_bytes_arrive(self) -> None: + image = self.store.register_image(self.owner) + self.assertFalse(self.store.uploaded(image.urn, self.owner)) + self.store.store_upload(image.upload_id, self.owner, b"\xff\xd8") + self.assertTrue(self.store.uploaded(image.urn, self.owner)) + self.assertFalse(self.store.uploaded(image.urn, "urn:li:person:other")) + + def test_another_member_cannot_upload_into_an_image(self) -> None: + image = self.store.register_image(self.owner) + with self.assertRaises(store.StoreError): + self.store.store_upload(image.upload_id, "urn:li:person:other", b"x") + + def test_posts_get_distinct_share_urns_and_can_be_read_back(self) -> None: + first = self.store.create_post(self.owner, "one", "PUBLIC", {}) + second = self.store.create_post(self.owner, "two", "PUBLIC", {}) + self.assertNotEqual(first.id, second.id) + self.assertRegex(first.id, r"^urn:li:share:[0-9]+$") + self.assertEqual(self.store.post(second.id).commentary, "two") + self.assertEqual(len(self.store.posts()), 2) + + +if __name__ == "__main__": + unittest.main() From 2d1d32a669b67a60b40a72db037d7f19abc8545b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:15 +0100 Subject: [PATCH 278/554] test(openpost): cover the fake LinkedIn endpoints --- .../files/provider/provider/test_linkedin.py | 216 ++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py new file mode 100644 index 0000000000..da565f0905 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py @@ -0,0 +1,216 @@ +from __future__ import annotations + +import json +import unittest +import urllib.parse + +from provider.linkedin import Client, LinkedIn, Request, plain_text +from provider.store import Store + +CLIENT_ID = "simulator-linkedin" +SECRET = "simulator-linkedin-secret" +CALLBACK = "https://publish.example/api/v1/accounts/linkedin/callback" +AUTHORIZE = { + "response_type": "code", + "client_id": CLIENT_ID, + "redirect_uri": CALLBACK, + "scope": "openid profile w_member_social", + "state": "state-1", +} + + +def form(method: str, path: str, fields: dict[str, str], headers: dict | None = None) -> Request: + return Request(method, path, {}, headers or {}, urllib.parse.urlencode(fields).encode()) + + +def call(method: str, path: str, token: str, body: object = None, query: dict | None = None) -> Request: + return Request( + method, + path, + query or {}, + {"authorization": f"Bearer {token}"}, + json.dumps(body).encode() if body is not None else b"", + ) + + +class Fixture: + def setUp(self) -> None: + self.app = LinkedIn( + Store(), {CLIENT_ID: Client(SECRET, "OpenPost", (CALLBACK,))} + ) + + def sign_up(self, email: str = "ada@example.org") -> None: + response = self.app.handle( + form("POST", "/signup", {"name": "Ada Lovelace", "email": email, "password": "pw", "next": ""}) + ) + self.assertEqual(response.status, 201) + + def code(self, email: str = "ada@example.org") -> str: + response = self.app.handle( + form("POST", "/oauth/v2/authorization", {**AUTHORIZE, "email": email, "password": "pw", "decision": "allow"}) + ) + self.assertEqual(response.status, 302) + location = urllib.parse.urlsplit(response.headers["Location"]) + query = dict(urllib.parse.parse_qsl(location.query)) + self.assertEqual(query["state"], "state-1") + self.assertTrue(response.headers["Location"].startswith(CALLBACK + "?")) + return query["code"] + + def tokens(self) -> dict: + self.sign_up() + response = self.app.handle( + form( + "POST", + "/oauth/v2/accessToken", + {"grant_type": "authorization_code", "code": self.code(), "redirect_uri": CALLBACK, "client_id": CLIENT_ID, "client_secret": SECRET}, + ) + ) + self.assertEqual(response.status, 200) + return json.loads(response.body) + + +class TestSignUpAndConsent(Fixture, unittest.TestCase): + def test_the_sign_up_page_offers_a_form(self) -> None: + page = self.app.handle(Request("GET", "/signup", {"next": ""}, {}, b"")) + self.assertEqual(page.status, 200) + self.assertIn(b"Create account", page.body) + + def test_a_sign_up_from_the_consent_page_returns_to_it(self) -> None: + back = "/oauth/v2/authorization?" + urllib.parse.urlencode(AUTHORIZE) + response = self.app.handle( + form("POST", "/signup", {"name": "Ada", "email": "ada@example.org", "password": "pw", "next": back}) + ) + self.assertEqual((response.status, response.headers["Location"]), (303, back)) + + def test_a_sign_up_never_redirects_off_the_fake(self) -> None: + response = self.app.handle( + form("POST", "/signup", {"name": "Ada", "email": "ada@example.org", "password": "pw", "next": "https://evil.example/"}) + ) + self.assertEqual(response.status, 201) + + def test_the_consent_page_names_the_client_and_its_scopes(self) -> None: + page = self.app.handle(Request("GET", "/oauth/v2/authorization", AUTHORIZE, {}, b"")) + self.assertEqual(page.status, 200) + self.assertIn(b"OpenPost", page.body) + self.assertIn(b"w_member_social", page.body) + self.assertIn(b"/signup?next=", page.body) + + def test_an_unregistered_redirect_uri_is_refused(self) -> None: + page = self.app.handle( + Request("GET", "/oauth/v2/authorization", {**AUTHORIZE, "redirect_uri": "https://evil/cb"}, {}, b"") + ) + self.assertEqual(page.status, 400) + + def test_wrong_credentials_stay_on_the_consent_page(self) -> None: + self.sign_up() + response = self.app.handle( + form("POST", "/oauth/v2/authorization", {**AUTHORIZE, "email": "ada@example.org", "password": "wrong", "decision": "allow"}) + ) + self.assertEqual(response.status, 400) + self.assertIn(b"Wrong email or password", response.body) + + def test_cancelling_returns_an_error_to_the_client(self) -> None: + response = self.app.handle( + form("POST", "/oauth/v2/authorization", {**AUTHORIZE, "decision": "deny"}) + ) + query = dict(urllib.parse.parse_qsl(urllib.parse.urlsplit(response.headers["Location"]).query)) + self.assertEqual(query, {"error": "user_cancelled_authorize", "state": "state-1"}) + + +class TestTokens(Fixture, unittest.TestCase): + def test_a_code_becomes_tokens_that_describe_the_member(self) -> None: + tokens = self.tokens() + profile = json.loads(self.app.handle(call("GET", "/v2/userinfo", tokens["access_token"])).body) + self.assertEqual((profile["name"], profile["given_name"]), ("Ada Lovelace", "Ada")) + self.assertTrue(profile["sub"]) + + def test_a_wrong_client_secret_is_refused(self) -> None: + self.sign_up() + response = self.app.handle( + form( + "POST", + "/oauth/v2/accessToken", + {"grant_type": "authorization_code", "code": self.code(), "redirect_uri": CALLBACK, "client_id": CLIENT_ID, "client_secret": "wrong"}, + ) + ) + self.assertEqual(response.status, 401) + + def test_a_refresh_token_yields_a_working_access_token(self) -> None: + tokens = self.tokens() + response = self.app.handle( + form( + "POST", + "/oauth/v2/accessToken", + {"grant_type": "refresh_token", "refresh_token": tokens["refresh_token"], "client_id": CLIENT_ID, "client_secret": SECRET}, + ) + ) + refreshed = json.loads(response.body) + self.assertEqual(self.app.handle(call("GET", "/v2/userinfo", refreshed["access_token"])).status, 200) + + def test_an_unknown_token_is_refused(self) -> None: + self.assertEqual(self.app.handle(call("GET", "/v2/userinfo", "nope")).status, 401) + + +class TestPosts(Fixture, unittest.TestCase): + def setUp(self) -> None: + super().setUp() + self.token = self.tokens()["access_token"] + profile = json.loads(self.app.handle(call("GET", "/v2/userinfo", self.token)).body) + self.author = f"urn:li:person:{profile['sub']}" + + def post(self, body: dict) -> object: + return self.app.handle(call("POST", "/rest/posts", self.token, body)) + + def body(self, **extra: object) -> dict: + return { + "author": self.author, + "commentary": r"Hello \#world", + "visibility": "PUBLIC", + "lifecycleState": "PUBLISHED", + **extra, + } + + def test_a_post_is_stored_and_read_back_by_its_id(self) -> None: + response = self.post(self.body()) + self.assertEqual(response.status, 201) + post_id = response.headers["x-restli-id"] + read = self.app.handle(call("GET", f"/rest/posts/{urllib.parse.quote(post_id, safe='')}", self.token)) + self.assertEqual(json.loads(read.body)["commentary"], r"Hello \#world") + + def test_the_feed_page_shows_the_unescaped_text_without_a_token(self) -> None: + post_id = self.post(self.body()).headers["x-restli-id"] + page = self.app.handle(Request("GET", f"/feed/update/{post_id}", {}, {}, b"")) + self.assertEqual(page.status, 200) + self.assertIn(b"Hello #world", page.body) + self.assertIn(b"Ada Lovelace on LinkedIn", page.body) + + def test_posting_as_someone_else_is_refused(self) -> None: + self.assertEqual(self.post(self.body(author="urn:li:person:other")).status, 403) + + def test_an_image_post_needs_an_uploaded_image(self) -> None: + initialized = self.app.handle( + call("POST", "/rest/images", self.token, {"initializeUploadRequest": {"owner": self.author}}, {"action": "initializeUpload"}) + ) + value = json.loads(initialized.body)["value"] + media = {"content": {"media": {"id": value["image"]}}} + self.assertEqual(self.post(self.body(**media)).status, 422) + upload_path = urllib.parse.urlsplit(value["uploadUrl"]).path + self.assertEqual( + self.app.handle(Request("PUT", upload_path, {}, {"authorization": f"Bearer {self.token}"}, b"\xff\xd8")).status, + 201, + ) + self.assertEqual(self.post(self.body(**media)).status, 201) + + def test_the_admin_listing_shows_posts_with_plain_text(self) -> None: + self.post(self.body()) + posts = json.loads(self.app.handle(Request("GET", "/__fake/linkedin/posts", {}, {}, b"")).body) + self.assertEqual([post["text"] for post in posts], ["Hello #world"]) + + +class TestPlainText(unittest.TestCase): + def test_linkedin_markup_escapes_are_removed(self) -> None: + self.assertEqual(plain_text(r"a \#tag \@name \(x\) \\ end"), r"a #tag @name (x) \ end") + + +if __name__ == "__main__": + unittest.main() From e3352638b6b687c299357d7ca5bca965c4e46040 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 279/554] test(openpost): cover the fake provider entry point --- .../files/provider/provider/test___main__.py | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py new file mode 100644 index 0000000000..ddd6e81cde --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py @@ -0,0 +1,54 @@ +from __future__ import annotations + +import json +import tempfile +import threading +import unittest +import urllib.request +from http.server import ThreadingHTTPServer +from pathlib import Path + +from provider import __main__ as entry + +CONFIG = { + "http_port": 0, + "https_port": 0, + "certificate": "/unused.crt", + "key": "/unused.key", + "linkedin": { + "clients": { + "simulator-linkedin": { + "secret": "s", + "name": "OpenPost", + "redirect_uris": ["https://publish.example/cb"], + } + } + }, +} + + +class TestEntry(unittest.TestCase): + def test_the_config_registers_its_clients(self) -> None: + app = entry.application(CONFIG) + client = app.clients["simulator-linkedin"] + self.assertEqual(client.redirect_uris, ("https://publish.example/cb",)) + + def test_the_http_handler_serves_the_app(self) -> None: + server = ThreadingHTTPServer( + ("127.0.0.1", 0), entry.handler_for(entry.application(CONFIG)) + ) + threading.Thread(target=server.serve_forever, daemon=True).start() + self.addCleanup(server.shutdown) + url = f"http://127.0.0.1:{server.server_address[1]}/__fake/health" + with urllib.request.urlopen(url, timeout=5) as answer: # noqa: S310 local test server + self.assertEqual((answer.status, answer.read()), (200, b"ok")) + + def test_health_fails_without_a_server(self) -> None: + with tempfile.TemporaryDirectory() as folder: + path = Path(folder) / "provider.json" + path.write_text(json.dumps({**CONFIG, "http_port": 1})) + self.assertEqual(entry.health(entry.load(str(path))), 1) + + +if __name__ == "__main__": + unittest.main() From 9a81816257ef5f39e5dc5283481ed56bd766cfac Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 280/554] feat(openpost): declare the fake provider entity and move LinkedIn off the simulator --- roles/web-app-openpost/meta/services.yml | 29 ++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index 62cde359c2..dfbb3461e0 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -144,8 +144,6 @@ simulator: - oauth2.googleapis.com - www.googleapis.com - open.tiktokapis.com - - www.linkedin.com - - api.linkedin.com providers: - x - meta @@ -153,6 +151,33 @@ simulator: - tiktok - linkedin +# nocheck: dynamic-flag a sidecar of this role, provided by no other role; it runs exactly while the simulator does +provider: + enabled: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" + custom: true + modes: + compose: + enabled: true + swarm: + enabled: true + image: python + version: 3.13.7-slim + name: openpost-provider + uid: 10002 + cpus: "0.25" + mem_reservation: 64m + mem_limit: 128m + pids_limit: 64 + ports: + internal: + http: 8080 + https: 443 + local: + http: 8101 + hosts: + - www.linkedin.com + - api.linkedin.com + # nocheck: dynamic-flag a sidecar of this role, provided by no other role; it runs exactly while routes are configured crossposter: enabled: "{{ (lookup('config', 'web-app-openpost', 'services.crossposter.routes') | length) > 0 }}" From 9d49394db0fea850502bcb32cbc0addc65392dc0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 281/554] feat(openpost): mount the fake provider's config, certificate and key --- roles/web-app-openpost/meta/volumes.yml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/roles/web-app-openpost/meta/volumes.yml b/roles/web-app-openpost/meta/volumes.yml index 7a18d3f89c..5dd2c94962 100644 --- a/roles/web-app-openpost/meta/volumes.yml +++ b/roles/web-app-openpost/meta/volumes.yml @@ -33,6 +33,37 @@ simulator_ca: target: /etc/ssl/openpost-trust/simulator-ca.crt when: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" +provider_config: + type: secret + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'provider', 'provider.json'] | path_join }}" + mode: "0400" + mounts: + - service: provider + target: /run/secrets/provider.json + uid: "{{ lookup('config', 'web-app-openpost', 'services.provider.uid') }}" + gid: "{{ lookup('config', 'web-app-openpost', 'services.provider.uid') }}" + when: "{{ lookup('config', 'web-app-openpost', 'services.provider.enabled') | bool }}" + +provider_certificate: + type: config + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'simulator', 'server.crt'] | path_join }}" + mode: "0444" + mounts: + - service: provider + target: /config/server.crt + when: "{{ lookup('config', 'web-app-openpost', 'services.provider.enabled') | bool }}" + +provider_key: + type: secret + source: "{{ [lookup('container', 'web-app-openpost', 'directories.config'), 'provider', 'server.key'] | path_join }}" + mode: "0400" + mounts: + - service: provider + target: /run/secrets/server.key + uid: "{{ lookup('config', 'web-app-openpost', 'services.provider.uid') }}" + gid: "{{ lookup('config', 'web-app-openpost', 'services.provider.uid') }}" + when: "{{ lookup('config', 'web-app-openpost', 'services.provider.enabled') | bool }}" + root_ca: type: config source: "{{ CA_TRUST.cert_host }}" From d44da7b3e66ab344ab50a10522a3fb0cdfc8ced0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 282/554] feat(openpost): add the fake provider variables --- roles/web-app-openpost/vars/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 2f1819c356..29dfe77e26 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -74,6 +74,21 @@ OPENPOST_SIMULATOR_ENABLED: "{{ lookup('config', application_id, 'services.simul OPENPOST_SIMULATOR_NAME: "{{ lookup('config', application_id, 'services.simulator.name') }}" OPENPOST_SIMULATOR_DIR: "{{ [lookup('container', application_id, 'directories.config'), 'simulator'] | path_join }}" OPENPOST_SIMULATOR_HOSTS: "{{ lookup('config', application_id, 'services.simulator.hosts') }}" +OPENPOST_PROVIDER: "{{ lookup('config', application_id, 'services.provider') }}" +OPENPOST_PROVIDER_ENABLED: "{{ lookup('config', application_id, 'services.provider.enabled') | bool }}" +OPENPOST_PROVIDER_NAME: "{{ OPENPOST_PROVIDER.name }}" +OPENPOST_PROVIDER_UID: "{{ OPENPOST_PROVIDER.uid }}" +OPENPOST_PROVIDER_HOSTS: "{{ OPENPOST_PROVIDER.hosts }}" +OPENPOST_PROVIDER_DIR: "{{ [lookup('container', application_id, 'directories.config'), 'provider'] | path_join }}" +OPENPOST_PROVIDER_CONFIG_HOST: "{{ [OPENPOST_PROVIDER_DIR, 'provider.json'] | path_join }}" +OPENPOST_PROVIDER_KEY_HOST: "{{ [OPENPOST_PROVIDER_DIR, 'server.key'] | path_join }}" +OPENPOST_PROVIDER_BUILD_CONTEXT: "{{ [lookup('container', application_id, 'directories.services'), 'provider'] | path_join }}" +OPENPOST_PROVIDER_IMAGE: "openpost_provider_custom" +OPENPOST_PROVIDER_BASE_IMAGE: "{{ OPENPOST_PROVIDER.image }}" +OPENPOST_PROVIDER_BASE_VERSION: "{{ OPENPOST_PROVIDER.version }}" +OPENPOST_PROVIDER_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if DEPLOYMENT_MODE == 'compose' else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" +OPENPOST_PROVIDER_BROWSER_URL: "http://{{ 'host.docker.internal' if DEPLOYMENT_MODE == 'compose' else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" +OPENPOST_LINKEDIN_CALLBACK: "{{ OPENPOST_URL }}/api/v1/accounts/linkedin/callback" OPENPOST_SIMULATOR_KEYSTORE_PASSWORD: "simulator" OPENPOST_PROVIDER_CREDENTIALS: >- From c7e7861bf0b3b4c007eacf72cf8487c10f1ca6a3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 283/554] feat(openpost): render the fake provider configuration --- roles/web-app-openpost/templates/provider.json.j2 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 roles/web-app-openpost/templates/provider.json.j2 diff --git a/roles/web-app-openpost/templates/provider.json.j2 b/roles/web-app-openpost/templates/provider.json.j2 new file mode 100644 index 0000000000..eac10e171d --- /dev/null +++ b/roles/web-app-openpost/templates/provider.json.j2 @@ -0,0 +1,15 @@ +{{ { + 'http_port': OPENPOST_PROVIDER.ports.internal.http, + 'https_port': OPENPOST_PROVIDER.ports.internal.https, + 'certificate': lookup('volume', application_id, 'provider_certificate').target, + 'key': lookup('volume', application_id, 'provider_key').target, + 'linkedin': { + 'clients': { + OPENPOST_PROVIDER_CREDENTIALS.linkedin.client_id: { + 'secret': OPENPOST_PROVIDER_CREDENTIALS.linkedin.client_secret, + 'name': 'OpenPost', + 'redirect_uris': [OPENPOST_LINKEDIN_CALLBACK], + }, + }, + }, +} | to_nice_json }} From 5af046cc2eaffc5e9259c26c19ebc081bcb30152 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 284/554] feat(openpost): stage and render the fake provider --- .../tasks/provider/render.yml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 roles/web-app-openpost/tasks/provider/render.yml diff --git a/roles/web-app-openpost/tasks/provider/render.yml b/roles/web-app-openpost/tasks/provider/render.yml new file mode 100644 index 0000000000..c9af9c3ffd --- /dev/null +++ b/roles/web-app-openpost/tasks/provider/render.yml @@ -0,0 +1,40 @@ +--- +- name: "📁 Ensure the fake provider directory exists" + ansible.builtin.file: + path: "{{ OPENPOST_PROVIDER_DIR }}" + state: directory + mode: "0750" + delegate_to: "{{ STACK_HOST }}" + run_once: true + +- name: "🔑 Hand the fake provider its copy of the simulator key" + ansible.builtin.copy: + src: "{{ [OPENPOST_SIMULATOR_DIR, 'server.key'] | path_join }}" + dest: "{{ OPENPOST_PROVIDER_KEY_HOST }}" + remote_src: true + owner: "{{ OPENPOST_PROVIDER_UID }}" + group: "{{ OPENPOST_PROVIDER_UID }}" + mode: "0400" + delegate_to: "{{ STACK_HOST }}" + run_once: true + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: "📦 Stage the fake provider build context" + ansible.builtin.copy: + src: "{{ role_path }}/files/provider/" + dest: "{{ OPENPOST_PROVIDER_BUILD_CONTEXT }}/" + mode: preserve + notify: + - compose-build + - compose-up + +- name: "📄 Render the fake provider configuration" + ansible.builtin.include_tasks: + file: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/render_replicated_templates.yml') }}" + vars: + role_templates: + - src: "provider.json.j2" + dest: "{{ OPENPOST_PROVIDER_CONFIG_HOST }}" + mode: "0400" + owner: "{{ OPENPOST_PROVIDER_UID }}" + group: "{{ OPENPOST_PROVIDER_UID }}" From cee44b83c93e4faab3a874ae1bbfd1c00c8192f9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 285/554] feat(openpost): sign the simulator certificate for the fake provider hosts --- roles/web-app-openpost/tasks/02_simulator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/02_simulator.yml b/roles/web-app-openpost/tasks/02_simulator.yml index 1887dd8f30..95e7ff71ee 100644 --- a/roles/web-app-openpost/tasks/02_simulator.yml +++ b/roles/web-app-openpost/tasks/02_simulator.yml @@ -28,7 +28,7 @@ ansible.builtin.copy: dest: "{{ OPENPOST_SIMULATOR_DIR }}/server.ext" content: | - subjectAltName={{ OPENPOST_SIMULATOR_HOSTS | map('regex_replace', '^', 'DNS:') | join(',') }} + subjectAltName={{ (OPENPOST_SIMULATOR_HOSTS + OPENPOST_PROVIDER_HOSTS) | map('regex_replace', '^', 'DNS:') | join(',') }} extendedKeyUsage=serverAuth mode: "0640" register: openpost_simulator_ext From 54fdaef5d06d06b44550d73af87c8b2526b2f01a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 286/554] feat(openpost): include the fake provider tasks --- roles/web-app-openpost/tasks/00_core.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index 04d199570c..27e196d6f8 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -56,6 +56,10 @@ include_tasks: crossposter/render.yml when: OPENPOST_CROSSPOSTER_ENABLED | bool +- name: "🎭 Stage and render the fake provider" + include_tasks: provider/render.yml + when: OPENPOST_PROVIDER_ENABLED | bool + - name: "🚿 flush handlers for '{{ application_id }}'" meta: flush_handlers From 7fe6d14b755a87488e5ce3191e628614115c0162 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 287/554] feat(openpost): run the fake provider next to the simulator --- .../web-app-openpost/templates/compose.yml.j2 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/roles/web-app-openpost/templates/compose.yml.j2 b/roles/web-app-openpost/templates/compose.yml.j2 index 0a1137211e..0b1e6cffd8 100644 --- a/roles/web-app-openpost/templates/compose.yml.j2 +++ b/roles/web-app-openpost/templates/compose.yml.j2 @@ -63,6 +63,26 @@ {{ lookup('container_networks', aliases=OPENPOST_SIMULATOR_HOSTS) | indent(4) }} {% endif %} + {% if OPENPOST_PROVIDER_ENABLED | bool %} + {% set service_name = 'provider' %} + {{ service_name }}: + {% include 'roles/sys-svc-container/templates/deploy.yml.j2' %} + build: + context: "{{ OPENPOST_PROVIDER_BUILD_CONTEXT }}" + dockerfile: Dockerfile + args: + PROVIDER_BASE_IMAGE: "{{ OPENPOST_PROVIDER_BASE_IMAGE }}" + PROVIDER_BASE_VERSION: "{{ OPENPOST_PROVIDER_BASE_VERSION }}" + PROVIDER_UID: "{{ OPENPOST_PROVIDER_UID }}" + {{ lookup('container_image', application_id, service_name, image=OPENPOST_PROVIDER_IMAGE) }} + {{ lookup('compose_only', 'container_name', OPENPOST_PROVIDER_NAME) }} + {{ lookup('compose_only', 'pull_policy', 'never') }} + {{ lookup('compose_restart') }} + {{ lookup('container_ports', ['provider', 'http', DOCKER_BIND_HOST]) | indent(4) }} + {{ lookup('container_volumes', service_name) | indent(4) }} + {{ lookup('container_networks', aliases=OPENPOST_PROVIDER_HOSTS) | indent(4) }} + {% endif %} + {{ lookup('compose_volumes') }} {{ lookup('compose_networks') }} From 081ddd4c8d26925c9139147e252443271cb53581 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 288/554] refactor(openpost): drop the LinkedIn mappings from the simulator --- .../files/simulator/openpost.json | 90 ------------------- 1 file changed, 90 deletions(-) diff --git a/roles/web-app-openpost/files/simulator/openpost.json b/roles/web-app-openpost/files/simulator/openpost.json index 7b53f38b81..183e91a91c 100644 --- a/roles/web-app-openpost/files/simulator/openpost.json +++ b/roles/web-app-openpost/files/simulator/openpost.json @@ -895,96 +895,6 @@ } } }, - { - "name": "linkedin-token", - "request": { - "method": "POST", - "urlPath": "/oauth/v2/accessToken" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "jsonBody": { - "access_token": "simulator-linkedin-token", - "expires_in": 5183999, - "refresh_token": "simulator-linkedin-refresh", - "refresh_token_expires_in": 31535999, - "scope": "openid,profile,w_member_social" - } - } - }, - { - "name": "linkedin-userinfo", - "request": { - "method": "GET", - "urlPath": "/v2/userinfo" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "jsonBody": { - "sub": "simulatorlinkedin", - "name": "OpenPost Simulator", - "given_name": "OpenPost", - "picture": "" - } - } - }, - { - "name": "linkedin-image-upload-init", - "request": { - "method": "POST", - "urlPath": "/rest/images", - "queryParameters": { - "action": { - "equalTo": "initializeUpload" - } - } - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "jsonBody": { - "value": { - "uploadUrlExpiresAt": 4102444800000, - "uploadUrl": "{{request.baseUrl}}/simulator-upload/image", - "image": "urn:li:image:simulator" - } - }, - "transformers": [ - "response-template" - ] - } - }, - { - "name": "linkedin-image-upload", - "request": { - "method": "PUT", - "urlPath": "/simulator-upload/image" - }, - "response": { - "status": 201 - } - }, - { - "name": "linkedin-post", - "request": { - "method": "POST", - "urlPath": "/rest/posts" - }, - "response": { - "status": 201, - "headers": { - "x-restli-id": "urn:li:share:7300000000000000001" - } - } - }, { "name": "unmatched", "priority": 10, From 563e560b6e40aa6b421410ab0559874e48bcbcf2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 289/554] test(openpost): hand the CLI probe the fake provider URL --- roles/web-app-openpost/templates/test.env.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index 3f1383d428..5d9df44da4 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -5,6 +5,7 @@ OPENPOST_API_HEADERS_B64={{ _view.api_headers | to_json | b64encode }} OPENPOST_CONTAINER={{ CLI_LOCAL_CID }} OPENPOST_DEADLINE_SECONDS={{ lookup('timeout', 600) | int }} OPENPOST_LOCAL_URL={{ OPENPOST_LOCAL_URL }} +OPENPOST_PROVIDER_URL={{ OPENPOST_PROVIDER_LOCAL_URL if OPENPOST_PROVIDER_ENABLED | bool else '' }} OPENPOST_PUBLIC_URL={{ _view.public_url }} OPENPOST_PROXY_ADDRESS={{ _view.proxy_address }} OPENPOST_SSO_ENABLED={{ OPENPOST_OIDC_ENABLED | bool | string | lower }} From bf32a729880c1c8210a9f825c9dd621bf3a47451 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 290/554] test(openpost): let the CLI probe call the fake provider --- roles/web-app-openpost/files/test/openpost/api.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/web-app-openpost/files/test/openpost/api.py b/roles/web-app-openpost/files/test/openpost/api.py index 2e33432066..d041b5ee2c 100644 --- a/roles/web-app-openpost/files/test/openpost/api.py +++ b/roles/web-app-openpost/files/test/openpost/api.py @@ -10,6 +10,7 @@ OPENPOST_SSO_ENABLED true when Keycloak provisions users, so the proxy c OPENPOST_CONTAINER resolved OpenPost container, used to reach the simulator admin API OPENPOST_SIMULATOR_PLATFORMS JSON list of OpenPost platforms served by the provider simulator, empty without it OPENPOST_SIMULATOR_HOST one simulator alias, whose /__admin API holds the request journal +OPENPOST_PROVIDER_URL published plain-HTTP origin of the fake provider that plays LinkedIn, empty without it OPENPOST_UNCONFIGURED_PLATFORMS JSON list of commercial platforms without credentials, which must not connect OPENPOST_S3_PUBLIC_URL public bucket URL with a trailing slash, empty when media stays in the role volume OPENPOST_DB_CONTAINER resolved Postgres container @@ -64,6 +65,7 @@ SIMULATOR_PLATFORMS = json.loads(os.environ["OPENPOST_SIMULATOR_PLATFORMS"]) UNCONFIGURED_PLATFORMS = json.loads(os.environ["OPENPOST_UNCONFIGURED_PLATFORMS"]) S3_PUBLIC_URL = os.environ["OPENPOST_S3_PUBLIC_URL"] SIMULATOR_ADMIN = "https://" + os.environ["OPENPOST_SIMULATOR_HOST"] + "/__admin" +PROVIDER_URL = os.environ["OPENPOST_PROVIDER_URL"].rstrip("/") DB_CONTAINER = os.environ["OPENPOST_DB_CONTAINER"] DB_NAME = os.environ["OPENPOST_DB_NAME"] DB_USER = os.environ["OPENPOST_DB_USER"] @@ -143,6 +145,18 @@ def call_raw( request.add_header("Content-Type", "application/json") if token: request.add_header("Authorization", "Bearer " + token) + return _open(request) + + +def provider( + path: str, fields: dict[str, str] | None = None +) -> tuple[int, str, object]: + data = urllib.parse.urlencode(fields).encode() if fields is not None else None + request = urllib.request.Request(PROVIDER_URL + path, data=data) # noqa: S310 fixed fake provider origin + return _open(request) + + +def _open(request: urllib.request.Request) -> tuple[int, str, object]: try: with OPENER.open(request, timeout=60) as response: raw = response.read().decode() From 45742479f198496946553d06b883ca6ac30f367e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 291/554] test(openpost): connect LinkedIn through the fake provider's code flow --- .../files/test/openpost/simulator.py | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/simulator.py b/roles/web-app-openpost/files/test/openpost/simulator.py index 8e7d3a7680..9a8709afbb 100644 --- a/roles/web-app-openpost/files/test/openpost/simulator.py +++ b/roles/web-app-openpost/files/test/openpost/simulator.py @@ -25,6 +25,7 @@ from openpost.api import ( check, draft, in_container, + provider, release, renditions, revoke_invitations, @@ -43,8 +44,6 @@ SIMULATOR_TOKENS = ( "simulator-google-refresh", "simulator-tiktok-token", "simulator-tiktok-refresh", - "simulator-linkedin-token", - "simulator-linkedin-refresh", ) SCHEDULE_AHEAD_SECONDS = 120 SCENARIOS = ( @@ -91,6 +90,40 @@ def simulator_admin(path: str, post: bool) -> object: return json.loads(raw) if raw.strip() else None +def linkedin_consent(url: str) -> dict[str, str] | str: + email = f"openpost-cli-{secrets.token_hex(4)}@linkedin.invalid" + password = secrets.token_urlsafe(18) + status, _, body = provider( + "/signup", + {"name": "OpenPost Probe", "email": email, "password": password, "next": ""}, + ) + if status != 201: + return f"fake LinkedIn sign-up HTTP {status} {body}" + carried = dict(urllib.parse.parse_qsl(urllib.parse.urlparse(url).query)) + status, location, body = provider( + "/oauth/v2/authorization", + {**carried, "email": email, "password": password, "decision": "allow"}, + ) + answer = dict(urllib.parse.parse_qsl(urllib.parse.urlparse(location).query)) + if status != 302 or "code" not in answer: + return f"fake LinkedIn consent HTTP {status} {location or body}" + return {"code": answer["code"], "state": answer.get("state", "")} + + +def check_linkedin(tag: str) -> None: + status, _, body = provider("/__fake/linkedin/posts") + posts = [ + post + for post in (body if isinstance(body, list) else []) + if tag in str(post.get("text")) + ] + check( + "the fake LinkedIn holds exactly one post with the tag", + status == 200 and len(posts) == 1, + f"HTTP {status} {posts}", + ) + + def connect(token: str, workspace: str, platform: str, pick: int) -> str: status, body = call( "GET", f"/accounts/{platform}/auth-url?workspace_id={workspace}", token=token @@ -103,6 +136,11 @@ def connect(token: str, workspace: str, platform: str, pick: int) -> str: "oauth_token": query["oauth_token"][0], "oauth_verifier": "simulator-verifier", } + elif platform == "linkedin": + consent = linkedin_consent(str(body["url"])) + if isinstance(consent, str): + return consent + params = consent else: params = {"code": "simulator-code", "state": query["state"][0]} status, location, _ = call_raw( @@ -378,7 +416,9 @@ def check_simulator(token: str, workspace: str) -> None: ) entries = journal["requests"] if isinstance(journal, dict) else [] for label in publications: - if label in tags: + if label == "linkedin": + check_linkedin(tags[label]) + elif label in tags: check_journal(entries, label, tags[label]) if "scheduled" in publications: delivered = [ From 3c6bb23af42837fff3e9441e0b6fbad20c0fd5c9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 292/554] test(openpost): read LinkedIn deliveries from the fake provider, not the simulator journal --- roles/web-app-openpost/files/test/openpost/journal.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/journal.py b/roles/web-app-openpost/files/test/openpost/journal.py index bec15d8d06..11258e9baa 100644 --- a/roles/web-app-openpost/files/test/openpost/journal.py +++ b/roles/web-app-openpost/files/test/openpost/journal.py @@ -127,9 +127,6 @@ def check_journal(journal: list[dict], label: str, tag: str) -> None: bool(uploads), statuses(uploads), ) - elif label == "linkedin": - posts = statuses(hits(journal, "POST", "/rest/posts", tag)) - check("LinkedIn receives exactly one post", posts == [201], posts) elif label == "tiktok": inits = statuses(hits(journal, "POST", "/v2/post/publish/content/init/", tag)) polls = hits(journal, "POST", "/v2/post/publish/status/fetch/", "") From cea41a614d2f2cb6194d5f3619c5771ccf3676f3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 293/554] test(openpost): hand Playwright the fake LinkedIn URL and service flag --- roles/web-app-openpost/templates/playwright.env.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/web-app-openpost/templates/playwright.env.j2 b/roles/web-app-openpost/templates/playwright.env.j2 index 2c211a334c..7afd277844 100644 --- a/roles/web-app-openpost/templates/playwright.env.j2 +++ b/roles/web-app-openpost/templates/playwright.env.j2 @@ -27,6 +27,8 @@ DASHBOARD_SERVICE_ENABLED={{ lookup('config', application_id, 'services.dashboar # nocheck: playwright-service-gate - mail delivery is covered by the sys-svc-mail integration tests, not the persona surface EMAIL_SERVICE_ENABLED={{ OPENPOST_EMAIL_ENABLED | string | lower }} +LINKEDIN_FAKE_URL={{ (OPENPOST_PROVIDER_BROWSER_URL if OPENPOST_PROVIDER_ENABLED | bool else '') | dotenv_quote }} + # nocheck: playwright-service-gate - universal-logout redirect is exercised by the persona logout step; covered by web-svc-logout integration tests LOGOUT_SERVICE_ENABLED={{ lookup('config', application_id, 'services.logout.enabled') | string | lower }} @@ -50,6 +52,8 @@ PIXELFED_SERVICE_ENABLED={{ lookup('config', application_id, 'services.pixelfed. # nocheck: playwright-service-gate - Prometheus scrape parity is owned by the web-app-prometheus spec PROMETHEUS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.prometheus.enabled') | string | lower }} +PROVIDER_SERVICE_ENABLED={{ OPENPOST_PROVIDER_ENABLED | string | lower }} + SEAWEEDFS_ADMIN_PASSWORD={{ lookup('users', 'administrator').password | dotenv_quote }} SEAWEEDFS_ADMIN_USERNAME={{ lookup('users', 'administrator').username | dotenv_quote }} From bfb81945ee3e5021526f8a972fa2c768a1bc3e86 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 294/554] test(openpost): read the fake LinkedIn URL in the Playwright env --- roles/web-app-openpost/files/playwright/_shared.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index ea642bec44..f50a2242ef 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -17,6 +17,7 @@ const env = { breakglassPassword: decodeDotenvQuotedValue(process.env.BREAKGLASS_PASSWORD), mastodonBaseUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.MASTODON_BASE_URL || "")), pixelfedBaseUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.PIXELFED_BASE_URL || "")), + linkedinFakeUrl: normalizeBaseUrl(decodeDotenvQuotedValue(process.env.LINKEDIN_FAKE_URL || "")), organisationWorkspace: decodeDotenvQuotedValue(process.env.ORGANISATION_WORKSPACE), oidcEnabled: isServiceEnabled("sso"), }; From a993f68a8de9de486841eb9344c50b718b983cee Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 295/554] test(openpost): share the crossposter review helpers --- .../playwright/test-crossposter-draft.js | 62 +++++++++++-------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js index a1fdf402ed..45845cb75a 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js @@ -6,8 +6,7 @@ const REVIEW_ROUTE = "ci-review"; const REVIEW_SET = "Crossposter review"; const REVIEW_TAG = "crossposterreview"; -async function routeReviewToMastodon(page, shared, headers) { - const target = await shared.apiAccount(page, headers, "mastodon"); +async function routeReview(page, shared, headers, target) { const sets = await shared.apiRequest(page, headers, "GET", `/social-sets?workspace_id=${target.workspace}`); const reviewSet = (sets || []).find((item) => item.name === REVIEW_SET); expect(reviewSet, `the deploy must create the "${REVIEW_SET}" social set`).toBeTruthy(); @@ -49,6 +48,39 @@ async function crosspostedDraft(page, shared, headers, workspace, marker) { return (drafts || []).find((item) => (item.metadata || {}).crossposter_route === REVIEW_ROUTE) || null; } +async function awaitCrosspostedDraft(page, shared, headers, workspace, marker, label) { + let draft = null; + await expect + .poll( + async () => { + draft = await crosspostedDraft(page, shared, headers, workspace, marker); + return Boolean(draft); + }, + { timeout: resolveTimeout(180_000), message: `${label}: the crossposter must turn the status into a review draft` }, + ) + .toBe(true); + return draft; +} + +async function openDraftInDesk(page, shared, marker, label) { + await gotoOnion(page, `${shared.env.appBaseUrl}/publications?tab=drafts`, { waitUntil: "domcontentloaded" }); + await page.getByRole("textbox", { name: /search posts/i }).fill(marker); + const listed = page.getByRole("link", { name: new RegExp(marker, "i") }).first(); + await expect(listed, `${label}: the crossposted draft must be listed among the drafts`).toBeVisible({ + timeout: resolveTimeout(60_000), + }); + await listed.click(); + const text = page.getByRole("textbox", { name: /post text/i }).first(); + await expect(text, `${label}: the draft must open in the composer`).toBeVisible({ timeout: resolveTimeout(60_000) }); + return text; +} + +exports.REVIEW_TAG = REVIEW_TAG; +exports.routeReview = routeReview; +exports.postOnMastodon = postOnMastodon; +exports.awaitCrosspostedDraft = awaitCrosspostedDraft; +exports.openDraftInDesk = openDraftInDesk; + exports.register = function (shared) { test("administrator: finds a crossposted draft in the desk, edits it and schedules it", async ({ page }) => { shared.skipUnlessServiceEnabled("crossposter"); @@ -61,30 +93,10 @@ exports.register = function (shared) { await shared.signInViaLocal(page, shared.env.breakglassEmail, shared.env.breakglassPassword, label); const headers = shared.apiSession(); - const workspace = await routeReviewToMastodon(page, shared, headers); + const workspace = await routeReview(page, shared, headers, await shared.apiAccount(page, headers, "mastodon")); await postOnMastodon(page, shared, `Desk review ${marker} #${REVIEW_TAG}`, label); - - let draft = null; - await expect - .poll( - async () => { - draft = await crosspostedDraft(page, shared, headers, workspace, marker); - return Boolean(draft); - }, - { timeout: resolveTimeout(180_000), message: `${label}: the crossposter must turn the status into a review draft` }, - ) - .toBe(true); - - await gotoOnion(page, `${shared.env.appBaseUrl}/publications?tab=drafts`, { waitUntil: "domcontentloaded" }); - await page.getByRole("textbox", { name: /search posts/i }).fill(marker); - const listed = page.getByRole("link", { name: new RegExp(marker, "i") }).first(); - await expect(listed, `${label}: the crossposted draft must be listed among the drafts`).toBeVisible({ - timeout: resolveTimeout(60_000), - }); - await listed.click(); - - const text = page.getByRole("textbox", { name: /post text/i }).first(); - await expect(text, `${label}: the draft must open in the composer`).toBeVisible({ timeout: resolveTimeout(60_000) }); + const draft = await awaitCrosspostedDraft(page, shared, headers, workspace, marker, label); + const text = await openDraftInDesk(page, shared, marker, label); await text.fill(edited); await page.getByRole("main").getByRole("button", { name: /^more$/i }).click(); await page.getByRole("menuitem", { name: /^schedule$/i }).click(); From 5e4a6c2ae0a526dd1428c877533d8690b8e2d6ba Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 296/554] test(openpost): walk Mastodon to desk to LinkedIn through the fake provider --- .../playwright/test-crossposter-linkedin.js | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js new file mode 100644 index 0000000000..50a1b14ef5 --- /dev/null +++ b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js @@ -0,0 +1,132 @@ +const { test, expect } = require("@playwright/test"); +const { gotoOnion } = require("./personas"); +const { resolveTimeout } = require("./timeouts"); +const { REVIEW_TAG, routeReview, postOnMastodon, awaitCrosspostedDraft, openDraftInDesk } = require("./test-crossposter-draft"); + +const LINKEDIN_ORIGIN = "https://www.linkedin.com"; + +async function routeLinkedInToFake(page, shared) { + await page.route(`${LINKEDIN_ORIGIN}/**`, async (route) => { + const target = new URL(route.request().url()); + const response = await route.fetch({ url: `${shared.env.linkedinFakeUrl}${target.pathname}${target.search}`, maxRedirects: 0 }); + await route.fulfill({ response }); + }); +} + +async function signUpOnLinkedIn(page, member, label) { + await gotoOnion(page, `${LINKEDIN_ORIGIN}/signup`, { waitUntil: "domcontentloaded" }); + await page.getByLabel("Name").fill(member.name); + await page.getByLabel("Email").fill(member.email); + await page.getByLabel("Password").fill(member.password); + await page.getByRole("button", { name: /^create account$/i }).click(); + await expect(page.getByText(/your account is ready/i), `${label}: the fake LinkedIn must create the member`).toBeVisible({ + timeout: resolveTimeout(30_000), + }); +} + +async function connectLinkedIn(page, shared, headers, workspace, member, label) { + const { url } = await shared.apiRequest(page, headers, "GET", `/accounts/linkedin/auth-url?workspace_id=${workspace}`); + await gotoOnion(page, url, { waitUntil: "domcontentloaded" }); + await page.getByLabel("Email").fill(member.email); + await page.getByLabel("Password").fill(member.password); + await page.getByRole("button", { name: /^allow$/i }).click(); + await expect + .poll(() => page.url(), { timeout: resolveTimeout(60_000), message: `${label}: OpenPost must finish the LinkedIn callback` }) + .not.toMatch(/linkedin\.com|\/accounts\/linkedin\/callback/); + expect(page.url(), `${label}: OpenPost must accept the LinkedIn consent`).not.toContain("failed"); + const selection = new URL(page.url()).searchParams.get("connection_id"); + if (selection) { + const offer = await shared.apiRequest(page, headers, "GET", `/accounts/selections/${selection}`); + const options = (offer.options || []).map((option) => String(option.id)); + expect(options.length, `${label}: LinkedIn must offer the member profile`).toBeGreaterThan(0); + await shared.apiRequest(page, headers, "POST", `/accounts/selections/${selection}/complete`, { + selection_ids: [options.find((id) => id.startsWith("person:")) || options[0]], + }); + } + const accounts = await shared.apiRequest(page, headers, "GET", `/accounts?workspace_id=${workspace}`); + const account = accounts.find((item) => item.platform === "linkedin" && JSON.stringify(item).includes(member.name)); + expect(account, `${label}: the LinkedIn member must be connected in the review workspace`).toBeTruthy(); + return { workspace, account: account.id }; +} + +async function publishInDesk(page, label) { + await page.getByRole("main").getByRole("button", { name: /^more$/i }).click(); + await page.getByRole("menuitem", { name: /^publish now$/i }).click(); + const confirm = page.getByRole("alertdialog").or(page.getByRole("dialog")); + if (await confirm.first().isVisible().catch(() => false)) { + await confirm.first().getByRole("button", { name: /publish/i }).first().click(); + } + await expect(confirm.first(), `${label}: the publish confirmation must close`).toBeHidden({ timeout: resolveTimeout(30_000) }); +} + +exports.register = function (shared) { + test("administrator: a Mastodon status becomes a review draft, is edited in the desk and lands on LinkedIn", async ({ page }) => { + shared.skipUnlessServiceEnabled("crossposter"); + shared.skipUnlessServiceEnabled("mastodon"); + shared.skipUnlessServiceEnabled("provider"); + shared.skipOnOnionSibling("mastodon"); + test.skip( + shared.env.appBaseUrl.includes(".onion"), + "LinkedIn cannot redirect a member back to an onion OpenPost origin", + ); + test.setTimeout(resolveTimeout(480_000)); // fake sign-up and consent, Mastodon sign-in, the crossposter's poll interval and the publishing worker + const label = "administrator"; + const stamp = Date.now(); + const marker = `cp-linkedin-${stamp}`; + const edited = `Edited for LinkedIn ${marker}`; + const member = { + name: `Desk Pilot ${stamp}`, + email: `desk-pilot-${stamp}@linkedin.invalid`, + password: `fake-${stamp}-linkedin`, + }; + + await routeLinkedInToFake(page, shared); + await signUpOnLinkedIn(page, member, label); + await shared.signInViaLocal(page, shared.env.breakglassEmail, shared.env.breakglassPassword, label); + const headers = shared.apiSession(); + const { workspace } = await shared.apiAccount(page, headers, "mastodon"); + const target = await connectLinkedIn(page, shared, headers, workspace, member, label); + await routeReview(page, shared, headers, target); + await postOnMastodon(page, shared, `LinkedIn review ${marker} #${REVIEW_TAG}`, label); + const draft = await awaitCrosspostedDraft(page, shared, headers, workspace, marker, label); + + const text = await openDraftInDesk(page, shared, marker, label); + await text.fill(edited); + await expect + .poll( + async () => String((await shared.apiRequest(page, headers, "GET", `/publications/${draft.id}`)).source_text).includes(edited), + { timeout: resolveTimeout(60_000), message: `${label}: the desk must save the edited text` }, + ) + .toBe(true); + await publishInDesk(page, label); + + let rendition = {}; + await expect + .poll( + async () => { + const current = await shared.apiRequest(page, headers, "GET", `/publications/${draft.id}`); + rendition = (current.renditions || []).find((item) => item.social_account_id === target.account) || {}; + return rendition.status; + }, + { timeout: resolveTimeout(180_000), message: `${label}: the LinkedIn destination must end published` }, + ) + .toBe("published"); + expect(rendition.external_url, `${label}: OpenPost must record the URL of the LinkedIn post`).toContain( + `${LINKEDIN_ORIGIN}/feed/update/`, + ); + + await gotoOnion(page, rendition.external_url, { waitUntil: "domcontentloaded" }); + await expect(page.getByRole("article"), `${label}: the LinkedIn post must show the text edited in the desk`).toContainText(edited); + await expect(page, `${label}: the LinkedIn post must carry the member's name`).toHaveTitle(new RegExp(member.name)); + + const posts = await (await page.request.get(`${shared.env.linkedinFakeUrl}/__fake/linkedin/posts`)).json(); + const delivered = posts.filter((post) => String(post.text).includes(marker)); + expect(delivered.map((post) => post.text), `${label}: LinkedIn must receive the edited post exactly once`).toEqual([edited]); + expect(decodeURIComponent(rendition.external_url), `${label}: OpenPost must link the post LinkedIn created`).toContain( + delivered[0].id, + ); + + await gotoOnion(page, `${shared.env.appBaseUrl}/publications`, { waitUntil: "domcontentloaded" }); + await shared.logout(page, label); + }); +}; From 4ee057d7e8861e57d7786f014896891e63f5f9c7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 297/554] test(openpost): register the LinkedIn crossposter journey --- roles/web-app-openpost/files/playwright/playwright.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/playwright/playwright.spec.js b/roles/web-app-openpost/files/playwright/playwright.spec.js index cd5da0a7cf..5fa2eb133e 100644 --- a/roles/web-app-openpost/files/playwright/playwright.spec.js +++ b/roles/web-app-openpost/files/playwright/playwright.spec.js @@ -15,4 +15,5 @@ require("./test-login-oidc-biber").register(shared); require("./test-publish-mastodon").register(shared); require("./test-publish-pixelfed").register(shared); require("./test-crossposter-draft").register(shared); +require("./test-crossposter-linkedin").register(shared); require("./test-seaweedfs").register(shared); From b5a11b14f484828238ff0314f3078c0ca3c8a62b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 298/554] docs(openpost): document the fake LinkedIn provider --- roles/web-app-openpost/Administration.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 33a93c074b..7421107426 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -84,13 +84,15 @@ Every callback URL has the form `https://publish./api/v1/account ## Provider simulator -Variant 0 of `meta/variants.yml` starts a WireMock `simulator` on the role network that answers for X, Facebook, Instagram, YouTube, LinkedIn and TikTok under their real API host names. -The deploy signs a certificate for those names with a per-deploy test CA in the role's config directory, OpenPost trusts that CA through `SSL_CERT_DIR`, and the role renders `simulator-` credentials instead of the `API` entries for the simulated providers. +Variant 0 of `meta/variants.yml` starts a WireMock `simulator` on the role network that answers for X, Facebook, Instagram, YouTube and TikTok under their real API host names. +Next to it runs the fake `provider`, a small stateful Python service built from `files/provider/` that plays LinkedIn on `www.linkedin.com` and `api.linkedin.com`: members sign up on `/signup`, grant OpenPost access on the consent page, and the fake keeps the tokens, images and posts it receives. +The deploy signs a certificate for all those names with a per-deploy test CA in the role's config directory, OpenPost trusts that CA through `SSL_CERT_DIR`, and the role renders `simulator-` credentials instead of the `API` entries for the simulated providers. +The fake also publishes plain HTTP on the local port of `services.provider.ports.local.http`; Playwright routes `https://www.linkedin.com/` there, and `/__fake/linkedin/posts` lists what OpenPost delivered. The mappings live in `files/simulator/openpost.json`; a post whose text contains `[simulate-429]`, `[simulate-503]` or `[simulate-400]` gets that answer from the X endpoint once. OpenPost v7.22.9 retries a 429 by itself after the reset header, but treats a 503 to a write as an ambiguous delivery: the destination stays in "Manual review required", its retry is refused, and after confirming on the network that nothing was posted the post has to be published again to that destination. A destination that failed with a definite rejection can be retried on its own. TikTok renditions need `content_posting_method`, `privacy_level` and `music_usage_confirmed`, YouTube renditions need `privacy` and `category_id` and wait for the media analysis to finish, and LinkedIn Organization Pages stay off, so a LinkedIn account connects as the member's personal profile. -The simulator never runs in production; leave the variant to CI and local tests. +The simulator and the fake provider never run in production; leave the variant to CI and local tests. ## Networks @@ -269,7 +271,7 @@ Run these checks against real platforms after onboarding a network and after eve | Facebook Pages (simulator) | Text to two Pages | v7.22.9 | 2026-10-22 | Published | | Instagram (simulator) | JPEG image | v7.22.9 | 2026-10-22 | Published from a public media URL | | YouTube (simulator) | Video | v7.22.9 | 2026-10-22 | Published through a resumable upload | -| LinkedIn (simulator) | Text | v7.22.9 | 2026-10-22 | Published | +| LinkedIn (fake provider) | Text, crossposted from Mastodon and edited in the desk | v7.22.9 | not yet verified | CI end-to-end test | | TikTok (simulator) | Photo | v7.22.9 | 2026-10-22 | Published | | Facebook Pages | Text, image | v7.22.9 | not yet verified | Manual staging check | | Instagram | Image | v7.22.9 | not yet verified | Manual staging check | From 0d0fdb48ee5932220eb6102d8ab99dd427474ad7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:21:16 +0100 Subject: [PATCH 299/554] docs(openpost): show the fake provider in the Cosmos diagram --- roles/web-app-openpost/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/README.md b/roles/web-app-openpost/README.md index 9f5da690f0..80e3bf6619 100644 --- a/roles/web-app-openpost/README.md +++ b/roles/web-app-openpost/README.md @@ -50,6 +50,7 @@ flowchart LR svc_openpost["openpost"] svc_relay["relay"] svc_simulator["simulator ❌"] + svc_provider["provider"] svc_crossposter["crossposter"] svc_tor["tor"] svc_container_backup["container_backup"] From d8649681336fb31c4cff4b63f85d02c0feea555e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:58 +0100 Subject: [PATCH 300/554] fix(openpost): give the fake provider handler real do_* methods and a non-builtin log argument --- .../files/provider/provider/__main__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/files/provider/provider/__main__.py b/roles/web-app-openpost/files/provider/provider/__main__.py index eba234e106..3c0e1be6bb 100644 --- a/roles/web-app-openpost/files/provider/provider/__main__.py +++ b/roles/web-app-openpost/files/provider/provider/__main__.py @@ -57,10 +57,20 @@ def handler_for(app: LinkedIn) -> type[BaseHTTPRequestHandler]: self.end_headers() self.wfile.write(response.body) - do_GET = do_POST = do_PUT = do_DELETE = _dispatch + def do_GET(self) -> None: + self._dispatch() - def log_message(self, format: str, *args: object) -> None: - LOG.info("%s %s", self.address_string(), format % args) + def do_POST(self) -> None: + self._dispatch() + + def do_PUT(self) -> None: + self._dispatch() + + def do_DELETE(self) -> None: + self._dispatch() + + def log_message(self, message: str, *args: object) -> None: + LOG.info("%s %s", self.address_string(), message % args) return Handler @@ -81,7 +91,7 @@ def serve(config: dict) -> int: def health(config: dict) -> int: url = f"http://127.0.0.1:{int(config['http_port'])}/__fake/health" try: - with urllib.request.urlopen(url, timeout=HEALTH_TIMEOUT_SECONDS) as answer: # noqa: S310 fixed loopback URL + with urllib.request.urlopen(url, timeout=HEALTH_TIMEOUT_SECONDS) as answer: return 0 if answer.status == 200 else 1 except (urllib.error.URLError, OSError): return 1 From 3be97bc0c2d41733738f8f5263db9425bb36d744 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:58 +0100 Subject: [PATCH 301/554] style(openpost): format the fake LinkedIn endpoints --- .../files/provider/provider/linkedin.py | 115 ++++++++++++++---- 1 file changed, 93 insertions(+), 22 deletions(-) diff --git a/roles/web-app-openpost/files/provider/provider/linkedin.py b/roles/web-app-openpost/files/provider/provider/linkedin.py index 72ec0aecc8..193f9a4556 100644 --- a/roles/web-app-openpost/files/provider/provider/linkedin.py +++ b/roles/web-app-openpost/files/provider/provider/linkedin.py @@ -50,7 +50,9 @@ def plain_text(commentary: str) -> str: return ESCAPED_MARKUP.sub(r"\1", commentary) -def _json(status: int, payload: object, headers: dict[str, str] | None = None) -> Response: +def _json( + status: int, payload: object, headers: dict[str, str] | None = None +) -> Response: return Response( status, {"Content-Type": "application/json", **(headers or {})}, @@ -72,7 +74,9 @@ def _page(status: int, title: str, body: str) -> Response: f"{html.escape(title)}
    " f"

    {html.escape(title)}

    {body}
    " ) - return Response(status, {"Content-Type": "text/html; charset=utf-8"}, document.encode()) + return Response( + status, {"Content-Type": "text/html; charset=utf-8"}, document.encode() + ) def _hidden(fields: dict[str, str]) -> str: @@ -124,7 +128,9 @@ class LinkedIn: match = pattern.match(request.path) if match and request.method == method: return dynamic(request, urllib.parse.unquote(match.group("id"))) - return _error(404, "NOT_FOUND", f"{request.method} {request.path} is not served") + return _error( + 404, "NOT_FOUND", f"{request.method} {request.path} is not served" + ) def health(self, request: Request) -> Response: return Response(200, {"Content-Type": "text/plain"}, b"ok") @@ -166,11 +172,14 @@ class LinkedIn: params = request.query client = self._client(params) if client is None or params.get("response_type") != "code": - return _page(400, "Invalid request", "

    The application is not registered.

    ") + return _page( + 400, "Invalid request", "

    The application is not registered.

    " + ) here = "/oauth/v2/authorization?" + urllib.parse.urlencode(params) notice = f"

    {html.escape(error)}

    " if error else "" scopes = "".join( - f"
  • {html.escape(scope)}
  • " for scope in params.get("scope", "").split() + f"
  • {html.escape(scope)}
  • " + for scope in params.get("scope", "").split() ) carried = { key: params.get(key, "") @@ -193,7 +202,9 @@ class LinkedIn: form = request.form() client = self._client(form) if client is None or form.get("response_type") != "code": - return _page(400, "Invalid request", "

    The application is not registered.

    ") + return _page( + 400, "Invalid request", "

    The application is not registered.

    " + ) redirect_uri, state = form["redirect_uri"], form.get("state", "") if form.get("decision") != "allow": return _redirect( @@ -202,9 +213,20 @@ class LinkedIn: {"error": "user_cancelled_authorize", "state": state}, ) ) - account = self.store.authenticate(form.get("email", ""), form.get("password", "")) + account = self.store.authenticate( + form.get("email", ""), form.get("password", "") + ) if account is None: - carried = {key: form.get(key, "") for key in ("client_id", "redirect_uri", "scope", "state", "response_type")} + carried = { + key: form.get(key, "") + for key in ( + "client_id", + "redirect_uri", + "scope", + "state", + "response_type", + ) + } return self.authorization_page( Request("GET", "/oauth/v2/authorization", carried, {}, b""), "Wrong email or password.", @@ -218,18 +240,34 @@ class LinkedIn: form = request.form() client = self.clients.get(form.get("client_id", "")) if client is None or client.secret != form.get("client_secret", ""): - return _json(401, {"error": "invalid_client", "error_description": "Client authentication failed"}) + return _json( + 401, + { + "error": "invalid_client", + "error_description": "Client authentication failed", + }, + ) try: if form.get("grant_type") == "authorization_code": grant = self.store.redeem_code( - form.get("code", ""), form["client_id"], form.get("redirect_uri", "") + form.get("code", ""), + form["client_id"], + form.get("redirect_uri", ""), ) return _json(200, self.store.issue_tokens(grant.member, grant.scope)) if form.get("grant_type") == "refresh_token": return _json(200, self.store.refresh(form.get("refresh_token", ""))) except StoreError as error: - return _json(400, {"error": "invalid_grant", "error_description": str(error)}) - return _json(400, {"error": "unsupported_grant_type", "error_description": "Unsupported grant type"}) + return _json( + 400, {"error": "invalid_grant", "error_description": str(error)} + ) + return _json( + 400, + { + "error": "unsupported_grant_type", + "error_description": "Unsupported grant type", + }, + ) def _member(self, request: Request) -> Account | None: return self.store.member_for(request.bearer()) @@ -237,7 +275,11 @@ class LinkedIn: def userinfo(self, request: Request) -> Response: account = self._member(request) if account is None: - return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + return _error( + 401, + "REVOKED_ACCESS_TOKEN", + "The token used in the request has been revoked by the user", + ) given, _, family = account.name.partition(" ") return _json( 200, @@ -256,13 +298,19 @@ class LinkedIn: def initialize_upload(self, request: Request) -> Response: account = self._member(request) if account is None: - return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + return _error( + 401, + "REVOKED_ACCESS_TOKEN", + "The token used in the request has been revoked by the user", + ) if request.query.get("action") != "initializeUpload": return _error(400, "ILLEGAL_ARGUMENT", "Unsupported action") payload = json.loads(request.body or b"{}") owner = str((payload.get("initializeUploadRequest") or {}).get("owner", "")) if owner != account.urn: - return _error(403, "ACCESS_DENIED", "The owner is not the authenticated member") + return _error( + 403, "ACCESS_DENIED", "The owner is not the authenticated member" + ) image = self.store.register_image(owner) return _json( 200, @@ -278,7 +326,11 @@ class LinkedIn: def upload(self, request: Request, upload_id: str) -> Response: account = self._member(request) if account is None: - return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + return _error( + 401, + "REVOKED_ACCESS_TOKEN", + "The token used in the request has been revoked by the user", + ) try: self.store.store_upload(upload_id, account.urn, request.body) except StoreError as error: @@ -288,17 +340,32 @@ class LinkedIn: def create_post(self, request: Request) -> Response: account = self._member(request) if account is None: - return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + return _error( + 401, + "REVOKED_ACCESS_TOKEN", + "The token used in the request has been revoked by the user", + ) payload = json.loads(request.body or b"{}") if payload.get("author") != account.urn: - return _error(403, "ACCESS_DENIED", "The author is not the authenticated member") + return _error( + 403, "ACCESS_DENIED", "The author is not the authenticated member" + ) visibility = payload.get("visibility") - if visibility not in POST_VISIBILITIES or payload.get("lifecycleState") != "PUBLISHED": - return _error(422, "UNPROCESSABLE_ENTITY", "Unsupported visibility or lifecycle state") + if ( + visibility not in POST_VISIBILITIES + or payload.get("lifecycleState") != "PUBLISHED" + ): + return _error( + 422, "UNPROCESSABLE_ENTITY", "Unsupported visibility or lifecycle state" + ) content = payload.get("content") or {} media = (content.get("media") or {}).get("id") if media and not self.store.uploaded(str(media), account.urn): - return _error(422, "UNPROCESSABLE_ENTITY", "The media was never uploaded by this member") + return _error( + 422, + "UNPROCESSABLE_ENTITY", + "The media was never uploaded by this member", + ) post = self.store.create_post( account.urn, str(payload.get("commentary", "")), visibility, content ) @@ -320,7 +387,11 @@ class LinkedIn: def read_post(self, request: Request, post_id: str) -> Response: if self._member(request) is None: - return _error(401, "REVOKED_ACCESS_TOKEN", "The token used in the request has been revoked by the user") + return _error( + 401, + "REVOKED_ACCESS_TOKEN", + "The token used in the request has been revoked by the user", + ) body = self._post_body(post_id) if body is None: return _error(404, "NOT_FOUND", f"Post {post_id} does not exist") From 72ea7a87868e88c381a36aa9b5bf30c18010d106 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:58 +0100 Subject: [PATCH 302/554] style(openpost): format the fake provider store --- roles/web-app-openpost/files/provider/provider/store.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/provider/provider/store.py b/roles/web-app-openpost/files/provider/provider/store.py index 173c264ea0..725c6f0f7d 100644 --- a/roles/web-app-openpost/files/provider/provider/store.py +++ b/roles/web-app-openpost/files/provider/provider/store.py @@ -165,7 +165,9 @@ class Store: raise StoreError("the refresh token is invalid or expired") access = secrets.token_urlsafe(48) with self._lock: - self._access[access] = Token(token.member, token.scope, now + ACCESS_SECONDS) + self._access[access] = Token( + token.member, token.scope, now + ACCESS_SECONDS + ) return { "access_token": access, "expires_in": ACCESS_SECONDS, From e1e89d7c0b721a298a326eac72efce003c06e029 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:58 +0100 Subject: [PATCH 303/554] style(openpost): format the crossposter OpenPost client --- .../files/crossposter/crossposter/openpost.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py index 734e29f0f7..0c290ed3c1 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/openpost.py @@ -20,7 +20,9 @@ ANALYSED = ("ready", "failed") def publishable(medium: dict) -> bool: - public = bool(medium.get("public_url_checked_at") and medium.get("public_url_ready")) + public = bool( + medium.get("public_url_checked_at") and medium.get("public_url_ready") + ) analysed = not str(medium.get("mime_type") or "").startswith("video/") or ( medium.get("analysis_status") in ANALYSED ) From 13cc788556fc50f5836013b1b017c88dea9cdc0c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:58 +0100 Subject: [PATCH 304/554] style(openpost): format the CLI probe simulator module --- roles/web-app-openpost/files/test/openpost/simulator.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/simulator.py b/roles/web-app-openpost/files/test/openpost/simulator.py index 9a8709afbb..9b7830e110 100644 --- a/roles/web-app-openpost/files/test/openpost/simulator.py +++ b/roles/web-app-openpost/files/test/openpost/simulator.py @@ -373,9 +373,7 @@ def check_simulator(token: str, workspace: str) -> None: ): continue if ONION_ORIGIN and kind in ("image", "video"): - print( - f"[SKIP] {label}: providers cannot fetch media from an onion origin" - ) + print(f"[SKIP] {label}: providers cannot fetch media from an onion origin") continue targets = ( connected[platform] if label == "facebook" else connected[platform][:1] From f6e398c86ec0f1cf513f2e7873665346020e2b2b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:59 +0100 Subject: [PATCH 305/554] style(openpost): format the fake provider entry point tests --- .../web-app-openpost/files/provider/provider/test___main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py index ddd6e81cde..496722cb45 100644 --- a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py +++ b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py @@ -40,7 +40,7 @@ class TestEntry(unittest.TestCase): threading.Thread(target=server.serve_forever, daemon=True).start() self.addCleanup(server.shutdown) url = f"http://127.0.0.1:{server.server_address[1]}/__fake/health" - with urllib.request.urlopen(url, timeout=5) as answer: # noqa: S310 local test server + with urllib.request.urlopen(url, timeout=5) as answer: self.assertEqual((answer.status, answer.read()), (200, b"ok")) def test_health_fails_without_a_server(self) -> None: From b3e1f902491cb7dd5a14324df2c9cab8d1c29e71 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:59 +0100 Subject: [PATCH 306/554] style(openpost): format the fake LinkedIn tests --- .../files/provider/provider/test_linkedin.py | 157 +++++++++++++++--- 1 file changed, 132 insertions(+), 25 deletions(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py index da565f0905..ce11bd1932 100644 --- a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py +++ b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py @@ -19,11 +19,17 @@ AUTHORIZE = { } -def form(method: str, path: str, fields: dict[str, str], headers: dict | None = None) -> Request: - return Request(method, path, {}, headers or {}, urllib.parse.urlencode(fields).encode()) +def form( + method: str, path: str, fields: dict[str, str], headers: dict | None = None +) -> Request: + return Request( + method, path, {}, headers or {}, urllib.parse.urlencode(fields).encode() + ) -def call(method: str, path: str, token: str, body: object = None, query: dict | None = None) -> Request: +def call( + method: str, path: str, token: str, body: object = None, query: dict | None = None +) -> Request: return Request( method, path, @@ -41,13 +47,21 @@ class Fixture: def sign_up(self, email: str = "ada@example.org") -> None: response = self.app.handle( - form("POST", "/signup", {"name": "Ada Lovelace", "email": email, "password": "pw", "next": ""}) + form( + "POST", + "/signup", + {"name": "Ada Lovelace", "email": email, "password": "pw", "next": ""}, + ) ) self.assertEqual(response.status, 201) def code(self, email: str = "ada@example.org") -> str: response = self.app.handle( - form("POST", "/oauth/v2/authorization", {**AUTHORIZE, "email": email, "password": "pw", "decision": "allow"}) + form( + "POST", + "/oauth/v2/authorization", + {**AUTHORIZE, "email": email, "password": "pw", "decision": "allow"}, + ) ) self.assertEqual(response.status, 302) location = urllib.parse.urlsplit(response.headers["Location"]) @@ -62,7 +76,13 @@ class Fixture: form( "POST", "/oauth/v2/accessToken", - {"grant_type": "authorization_code", "code": self.code(), "redirect_uri": CALLBACK, "client_id": CLIENT_ID, "client_secret": SECRET}, + { + "grant_type": "authorization_code", + "code": self.code(), + "redirect_uri": CALLBACK, + "client_id": CLIENT_ID, + "client_secret": SECRET, + }, ) ) self.assertEqual(response.status, 200) @@ -78,18 +98,38 @@ class TestSignUpAndConsent(Fixture, unittest.TestCase): def test_a_sign_up_from_the_consent_page_returns_to_it(self) -> None: back = "/oauth/v2/authorization?" + urllib.parse.urlencode(AUTHORIZE) response = self.app.handle( - form("POST", "/signup", {"name": "Ada", "email": "ada@example.org", "password": "pw", "next": back}) + form( + "POST", + "/signup", + { + "name": "Ada", + "email": "ada@example.org", + "password": "pw", + "next": back, + }, + ) ) self.assertEqual((response.status, response.headers["Location"]), (303, back)) def test_a_sign_up_never_redirects_off_the_fake(self) -> None: response = self.app.handle( - form("POST", "/signup", {"name": "Ada", "email": "ada@example.org", "password": "pw", "next": "https://evil.example/"}) + form( + "POST", + "/signup", + { + "name": "Ada", + "email": "ada@example.org", + "password": "pw", + "next": "https://evil.example/", + }, + ) ) self.assertEqual(response.status, 201) def test_the_consent_page_names_the_client_and_its_scopes(self) -> None: - page = self.app.handle(Request("GET", "/oauth/v2/authorization", AUTHORIZE, {}, b"")) + page = self.app.handle( + Request("GET", "/oauth/v2/authorization", AUTHORIZE, {}, b"") + ) self.assertEqual(page.status, 200) self.assertIn(b"OpenPost", page.body) self.assertIn(b"w_member_social", page.body) @@ -97,14 +137,29 @@ class TestSignUpAndConsent(Fixture, unittest.TestCase): def test_an_unregistered_redirect_uri_is_refused(self) -> None: page = self.app.handle( - Request("GET", "/oauth/v2/authorization", {**AUTHORIZE, "redirect_uri": "https://evil/cb"}, {}, b"") + Request( + "GET", + "/oauth/v2/authorization", + {**AUTHORIZE, "redirect_uri": "https://evil/cb"}, + {}, + b"", + ) ) self.assertEqual(page.status, 400) def test_wrong_credentials_stay_on_the_consent_page(self) -> None: self.sign_up() response = self.app.handle( - form("POST", "/oauth/v2/authorization", {**AUTHORIZE, "email": "ada@example.org", "password": "wrong", "decision": "allow"}) + form( + "POST", + "/oauth/v2/authorization", + { + **AUTHORIZE, + "email": "ada@example.org", + "password": "wrong", + "decision": "allow", + }, + ) ) self.assertEqual(response.status, 400) self.assertIn(b"Wrong email or password", response.body) @@ -113,15 +168,25 @@ class TestSignUpAndConsent(Fixture, unittest.TestCase): response = self.app.handle( form("POST", "/oauth/v2/authorization", {**AUTHORIZE, "decision": "deny"}) ) - query = dict(urllib.parse.parse_qsl(urllib.parse.urlsplit(response.headers["Location"]).query)) - self.assertEqual(query, {"error": "user_cancelled_authorize", "state": "state-1"}) + query = dict( + urllib.parse.parse_qsl( + urllib.parse.urlsplit(response.headers["Location"]).query + ) + ) + self.assertEqual( + query, {"error": "user_cancelled_authorize", "state": "state-1"} + ) class TestTokens(Fixture, unittest.TestCase): def test_a_code_becomes_tokens_that_describe_the_member(self) -> None: tokens = self.tokens() - profile = json.loads(self.app.handle(call("GET", "/v2/userinfo", tokens["access_token"])).body) - self.assertEqual((profile["name"], profile["given_name"]), ("Ada Lovelace", "Ada")) + profile = json.loads( + self.app.handle(call("GET", "/v2/userinfo", tokens["access_token"])).body + ) + self.assertEqual( + (profile["name"], profile["given_name"]), ("Ada Lovelace", "Ada") + ) self.assertTrue(profile["sub"]) def test_a_wrong_client_secret_is_refused(self) -> None: @@ -130,7 +195,13 @@ class TestTokens(Fixture, unittest.TestCase): form( "POST", "/oauth/v2/accessToken", - {"grant_type": "authorization_code", "code": self.code(), "redirect_uri": CALLBACK, "client_id": CLIENT_ID, "client_secret": "wrong"}, + { + "grant_type": "authorization_code", + "code": self.code(), + "redirect_uri": CALLBACK, + "client_id": CLIENT_ID, + "client_secret": "wrong", + }, ) ) self.assertEqual(response.status, 401) @@ -141,21 +212,35 @@ class TestTokens(Fixture, unittest.TestCase): form( "POST", "/oauth/v2/accessToken", - {"grant_type": "refresh_token", "refresh_token": tokens["refresh_token"], "client_id": CLIENT_ID, "client_secret": SECRET}, + { + "grant_type": "refresh_token", + "refresh_token": tokens["refresh_token"], + "client_id": CLIENT_ID, + "client_secret": SECRET, + }, ) ) refreshed = json.loads(response.body) - self.assertEqual(self.app.handle(call("GET", "/v2/userinfo", refreshed["access_token"])).status, 200) + self.assertEqual( + self.app.handle( + call("GET", "/v2/userinfo", refreshed["access_token"]) + ).status, + 200, + ) def test_an_unknown_token_is_refused(self) -> None: - self.assertEqual(self.app.handle(call("GET", "/v2/userinfo", "nope")).status, 401) + self.assertEqual( + self.app.handle(call("GET", "/v2/userinfo", "nope")).status, 401 + ) class TestPosts(Fixture, unittest.TestCase): def setUp(self) -> None: super().setUp() self.token = self.tokens()["access_token"] - profile = json.loads(self.app.handle(call("GET", "/v2/userinfo", self.token)).body) + profile = json.loads( + self.app.handle(call("GET", "/v2/userinfo", self.token)).body + ) self.author = f"urn:li:person:{profile['sub']}" def post(self, body: dict) -> object: @@ -174,7 +259,11 @@ class TestPosts(Fixture, unittest.TestCase): response = self.post(self.body()) self.assertEqual(response.status, 201) post_id = response.headers["x-restli-id"] - read = self.app.handle(call("GET", f"/rest/posts/{urllib.parse.quote(post_id, safe='')}", self.token)) + read = self.app.handle( + call( + "GET", f"/rest/posts/{urllib.parse.quote(post_id, safe='')}", self.token + ) + ) self.assertEqual(json.loads(read.body)["commentary"], r"Hello \#world") def test_the_feed_page_shows_the_unescaped_text_without_a_token(self) -> None: @@ -189,27 +278,45 @@ class TestPosts(Fixture, unittest.TestCase): def test_an_image_post_needs_an_uploaded_image(self) -> None: initialized = self.app.handle( - call("POST", "/rest/images", self.token, {"initializeUploadRequest": {"owner": self.author}}, {"action": "initializeUpload"}) + call( + "POST", + "/rest/images", + self.token, + {"initializeUploadRequest": {"owner": self.author}}, + {"action": "initializeUpload"}, + ) ) value = json.loads(initialized.body)["value"] media = {"content": {"media": {"id": value["image"]}}} self.assertEqual(self.post(self.body(**media)).status, 422) upload_path = urllib.parse.urlsplit(value["uploadUrl"]).path self.assertEqual( - self.app.handle(Request("PUT", upload_path, {}, {"authorization": f"Bearer {self.token}"}, b"\xff\xd8")).status, + self.app.handle( + Request( + "PUT", + upload_path, + {}, + {"authorization": f"Bearer {self.token}"}, + b"\xff\xd8", + ) + ).status, 201, ) self.assertEqual(self.post(self.body(**media)).status, 201) def test_the_admin_listing_shows_posts_with_plain_text(self) -> None: self.post(self.body()) - posts = json.loads(self.app.handle(Request("GET", "/__fake/linkedin/posts", {}, {}, b"")).body) + posts = json.loads( + self.app.handle(Request("GET", "/__fake/linkedin/posts", {}, {}, b"")).body + ) self.assertEqual([post["text"] for post in posts], ["Hello #world"]) class TestPlainText(unittest.TestCase): def test_linkedin_markup_escapes_are_removed(self) -> None: - self.assertEqual(plain_text(r"a \#tag \@name \(x\) \\ end"), r"a #tag @name (x) \ end") + self.assertEqual( + plain_text(r"a \#tag \@name \(x\) \\ end"), r"a #tag @name (x) \ end" + ) if __name__ == "__main__": From e8da7dc89c5bf3c376aeb7f21417f0df0d5156fc Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:50:59 +0100 Subject: [PATCH 307/554] style(openpost): format the fake provider store tests --- .../files/provider/provider/test_store.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py index d1d2acca80..ed0e2fc2bd 100644 --- a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py +++ b/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py @@ -63,16 +63,22 @@ class TestGrants(unittest.TestCase): def test_tokens_identify_the_member_until_they_expire(self) -> None: tokens = self.store.issue_tokens(self.member, "openid") - self.assertEqual(self.store.member_for(tokens["access_token"]).member, self.member) + self.assertEqual( + self.store.member_for(tokens["access_token"]).member, self.member + ) self.clock.value += store.ACCESS_SECONDS + 1 self.assertIsNone(self.store.member_for(tokens["access_token"])) - def test_a_refresh_keeps_the_refresh_token_and_issues_a_new_access_token(self) -> None: + def test_a_refresh_keeps_the_refresh_token_and_issues_a_new_access_token( + self, + ) -> None: tokens = self.store.issue_tokens(self.member, "openid") refreshed = self.store.refresh(tokens["refresh_token"]) self.assertEqual(refreshed["refresh_token"], tokens["refresh_token"]) self.assertNotEqual(refreshed["access_token"], tokens["access_token"]) - self.assertEqual(self.store.member_for(refreshed["access_token"]).member, self.member) + self.assertEqual( + self.store.member_for(refreshed["access_token"]).member, self.member + ) def test_an_unknown_refresh_token_is_refused(self) -> None: with self.assertRaises(store.StoreError): From c9dc8a8e8d456dcff483570a3d54f397acd16f23 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 30 Oct 2026 02:53:57 +0100 Subject: [PATCH 308/554] fix(openpost): give the fake provider handler real do_* methods and a non-builtin log argument --- scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh b/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh index 426d3d1502..c3a5e5d1bf 100755 --- a/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh +++ b/scripts/tests/deploy/swarm/utils/unmount/nfs_mounts.sh @@ -16,7 +16,7 @@ for container in "$@"; do docker inspect "${container}" >/dev/null 2>&1 || continue echo ">>> swarm-cleanup: detach NFS mounts inside ${container}" - if ! timeout "${NFS_CONTAINER_TIMEOUT}" docker exec -e NFS_UNMOUNT_TIMEOUT="${NFS_UNMOUNT_TIMEOUT}" "${container}" sh -s <<'SH'; then + if ! timeout "${NFS_CONTAINER_TIMEOUT}" docker exec -e NFS_UNMOUNT_TIMEOUT="${NFS_UNMOUNT_TIMEOUT}" "${container}" sh -s <<'SH' set -eu mounts="$( @@ -62,6 +62,7 @@ printf '%s\n' "${mounts}" | while IFS= read -r mount_point; do fi done SH + then echo "WARNING: could not inspect/unmount NFS mounts inside ${container} (gave up after ${NFS_CONTAINER_TIMEOUT})" >&2 fi done From 03a9027964a476afd5d8b2a509ca97f6793ec916 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 08:12:30 +0100 Subject: [PATCH 309/554] fix(openpost): keep OpenPost's env file and onion proxy out of the simulator --- roles/web-app-openpost/templates/compose.yml.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/templates/compose.yml.j2 b/roles/web-app-openpost/templates/compose.yml.j2 index 0b1e6cffd8..62bddd9ad3 100644 --- a/roles/web-app-openpost/templates/compose.yml.j2 +++ b/roles/web-app-openpost/templates/compose.yml.j2 @@ -44,9 +44,10 @@ {% if OPENPOST_SIMULATOR_ENABLED | bool %} {% set service_name = 'simulator' %} {{ service_name }}: - {% include 'roles/sys-svc-container/templates/base.yml.j2' %} + {% include 'roles/sys-svc-container/templates/deploy.yml.j2' %} {{ lookup('container_image', application_id, 'simulator') }} {{ lookup('compose_only', 'container_name', OPENPOST_SIMULATOR_NAME) }} + {{ lookup('compose_restart') }} command: - --https-port - "{{ lookup('config', application_id, 'services.simulator.ports.internal.https') }}" From 99b82d5e05ce0e582f463bd3bcc2b71839b43789 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 08:12:30 +0100 Subject: [PATCH 310/554] fix(openpost): trust the root CA whenever TLS is self-signed, not only with object storage --- roles/web-app-openpost/meta/volumes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/volumes.yml b/roles/web-app-openpost/meta/volumes.yml index 5dd2c94962..3515301bb0 100644 --- a/roles/web-app-openpost/meta/volumes.yml +++ b/roles/web-app-openpost/meta/volumes.yml @@ -71,7 +71,7 @@ root_ca: mounts: - service: openpost target: /etc/ssl/openpost-trust/root-ca.crt - when: "{{ (lookup('objstore', 'web-app-openpost', 'enabled') | bool) and TLS_MODE == 'self_signed' }}" + when: "{{ TLS_MODE == 'self_signed' }}" crossposter_config: type: config From af174909ce9905894dad7949c864ec8821d2d1c0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 08:12:30 +0100 Subject: [PATCH 311/554] test(openpost): run the SSO variant clearnet only, since Tor refuses OpenPost's subnet on its SOCKS port --- roles/web-app-openpost/meta/variants.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/variants.yml b/roles/web-app-openpost/meta/variants.yml index 241759a223..10db219664 100644 --- a/roles/web-app-openpost/meta/variants.yml +++ b/roles/web-app-openpost/meta/variants.yml @@ -1,5 +1,6 @@ --- # nocheck: clearnet-variant-tor PeerTube is a publishing target OpenPost reaches server-side through its relay; the onion round never advertises it +# nocheck: sso-variant-tor variant 0 runs clearnet only: OpenPost reaches an onion Keycloak only through Tor's SOCKS port, which svc-net-tor opens to the internal ranges and not to the role subnet 192.88.99.0/24 - services: container_backup: enabled: true @@ -87,7 +88,7 @@ enabled: true shared: true tor: - enabled: true + enabled: false - services: container_backup: From a46297b3503e9496c7e6b0f14fc45de1b6f42469 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 08:12:30 +0100 Subject: [PATCH 312/554] chore(openpost): drop the variants-coverage exemption now that a variant pins the onion off --- roles/web-app-openpost/meta/services.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index dfbb3461e0..bb1dd44cab 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -206,7 +206,6 @@ crossposter: routes: [] # nocheck: playwright-service-flag -# nocheck: variants-coverage — sso-variant-tor requires the onion on in every variant, so the false polarity has no variant left to live in tor: bond: 0.5 enabled: "{{ 'svc-net-tor' in group_names }}" From 90db6d2205806fdd7d232a662cd63db90dbd33dd Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 08:12:30 +0100 Subject: [PATCH 313/554] docs(openpost): document onion SSO as unsupported and the root CA for relayed siblings --- roles/web-app-openpost/Administration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 7421107426..4da4edb486 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -221,6 +221,7 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo | X forbids identical content across accounts of the same owner. | Give each X account its own rendition. | | On an onion-only deployment OpenPost marks uploaded media as unreachable for providers, because X, Meta, LinkedIn, YouTube and TikTok cannot fetch from a `.onion` origin. | Serve media from object storage with a clearnet public URL, or publish text-only posts to commercial networks. | | OpenPost cannot connect a Mastodon or Pixelfed instance served only on a `.onion` name: its Go resolver refuses to look up `.onion` names (RFC 7686), and its own app registration accepts only `https://` instances. The deploy therefore pins no app for an onion sibling, and the CI connect checks skip it. | Connect the instance through a clearnet name. The crossposter still reads onion sources, because Python resolves them through the relay. | +| On a compose deployment served on `.onion`, single sign-on fails: OpenPost reaches the onion Keycloak only through Tor's SOCKS port, which `svc-net-tor` opens to the internal ranges, and OpenPost's role subnet `192.88.99.0/24` is not one of them. The CI round with SSO therefore runs clearnet only. | Sign in with a native OpenPost account on onion deployments. | | OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition. | Cap X spending through the prepaid credits of the X developer account. | | Instagram accepts JPEG only and fetches media from a public URL. | Deploy `web-app-seaweedfs` so media gets public HTTPS URLs; convert other image formats before upload. | | Facebook, Instagram, Threads and TikTok fetch media from public HTTPS URLs. | Same as above; without `web-app-seaweedfs` media is served under `/media/` of the public OpenPost domain, which also works when that domain is reachable from the internet. | @@ -243,7 +244,7 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo ## Backup, restore and upgrades - With `web-app-seaweedfs` deployed, browsers upload media directly to its public S3 vhost through presigned URLs, which is why `OPENPOST_S3_ENDPOINT` is the public endpoint and the CSP allows it in `connect-src`; OpenPost deduplicates identical files by content hash. - With `TLS_MODE=self_signed` the role mounts the root CA into OpenPost and adds it to `SSL_CERT_DIR`, because an onion-primary OpenPost receives no CA injection while that vhost stays on clearnet HTTPS. + With `TLS_MODE=self_signed` the role always mounts the root CA into OpenPost and adds it to `SSL_CERT_DIR`, because an onion-primary OpenPost receives no CA injection while that vhost and the local Fediverse siblings behind the relay stay on clearnet HTTPS. - The platform backup covers the OpenPost database in the shared Postgres and the `openpost_media` volume; media in `web-app-seaweedfs` is covered by that role's backup. - A restore needs the database, the media and the inventory secrets, especially `encryption_key`; without it the stored provider tokens cannot be decrypted and every network has to be reconnected. The key is pinned `rotatable: false` because OpenPost refuses to start once a stored row no longer decrypts; the other secrets rotate freely. - Changing the pinned version in `meta/services.yml` and redeploying runs OpenPost's own migrations, which take a Postgres advisory lock. From 56d9bb5bbceef382047da2426f098e94fc15a823 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 08:12:31 +0100 Subject: [PATCH 314/554] docs(requirements): say variant 0 of OpenPost runs without the onion --- docs/requirements/062-web-app-openpost.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements/062-web-app-openpost.md b/docs/requirements/062-web-app-openpost.md index ab137c916e..ffc4dd2850 100644 --- a/docs/requirements/062-web-app-openpost.md +++ b/docs/requirements/062-web-app-openpost.md @@ -266,7 +266,7 @@ simulator: ### Variants, tests and quality (story AC8) -- [x] `meta/variants.yml` stays within the three-variant limit: variant 0 enables every integration, the simulator and the local Mastodon target, variant 1 adds the local Pixelfed and PeerTube targets with the integrations off, and variant 2 switches everything off, so no single round deploys all three instances; every variant deploys cleanly on a fresh host. +- [x] `meta/variants.yml` stays within the three-variant limit: variant 0 enables every integration but the onion, the simulator and the local Mastodon target, variant 1 adds the local Pixelfed and PeerTube targets with the integrations off, and variant 2 switches everything off, so no single round deploys all three instances; every variant deploys cleanly on a fresh host. - [x] `files/playwright/` covers the `guest`, `biber` and `administrator` personas per the [Playwright contract](../contributing/artefact/files/role/playwright.specs.js.md), with the administrator connecting a Fediverse account and publishing, and `biber` being denied the organisation workspace. - [x] `files/test/test.sh` with `templates/test.env.j2` covers readiness, the telemetry flags, the egress relay and its negative controls, token encryption at rest, Fediverse delivery and the simulator journal assertions. - [ ] `make compose-playwright role=web-app-openpost` exits 0 without stub tests and ends logged out. From c4982157574f01ba158cdc928c8cc6e48f3f6d0b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 08:12:31 +0100 Subject: [PATCH 315/554] test(openpost): identify the connected LinkedIn account as the one the consent added --- .../playwright/test-crossposter-linkedin.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js index 50a1b14ef5..0a6af1bbf9 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js @@ -24,7 +24,13 @@ async function signUpOnLinkedIn(page, member, label) { }); } +async function linkedInAccountIds(page, shared, headers, workspace) { + const accounts = await shared.apiRequest(page, headers, "GET", `/accounts?workspace_id=${workspace}`); + return accounts.filter((item) => item.platform === "linkedin").map((item) => item.id); +} + async function connectLinkedIn(page, shared, headers, workspace, member, label) { + const known = await linkedInAccountIds(page, shared, headers, workspace); const { url } = await shared.apiRequest(page, headers, "GET", `/accounts/linkedin/auth-url?workspace_id=${workspace}`); await gotoOnion(page, url, { waitUntil: "domcontentloaded" }); await page.getByLabel("Email").fill(member.email); @@ -43,10 +49,17 @@ async function connectLinkedIn(page, shared, headers, workspace, member, label) selection_ids: [options.find((id) => id.startsWith("person:")) || options[0]], }); } - const accounts = await shared.apiRequest(page, headers, "GET", `/accounts?workspace_id=${workspace}`); - const account = accounts.find((item) => item.platform === "linkedin" && JSON.stringify(item).includes(member.name)); - expect(account, `${label}: the LinkedIn member must be connected in the review workspace`).toBeTruthy(); - return { workspace, account: account.id }; + let added = []; + await expect + .poll( + async () => { + added = (await linkedInAccountIds(page, shared, headers, workspace)).filter((id) => !known.includes(id)); + return added.length; + }, + { timeout: resolveTimeout(30_000), message: `${label}: the LinkedIn member must be connected in the review workspace` }, + ) + .toBe(1); + return { workspace, account: added[0] }; } async function publishInDesk(page, label) { From 8ba79f5f176d7a3a33906a732b5c3226b915947d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 09:37:21 +0100 Subject: [PATCH 316/554] fix(pixelfed): link public storage on every container start so a recreated container still serves media --- roles/web-app-pixelfed/files/shell/docker-entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/web-app-pixelfed/files/shell/docker-entrypoint.sh b/roles/web-app-pixelfed/files/shell/docker-entrypoint.sh index 846919578b..405d70136d 100644 --- a/roles/web-app-pixelfed/files/shell/docker-entrypoint.sh +++ b/roles/web-app-pixelfed/files/shell/docker-entrypoint.sh @@ -8,6 +8,11 @@ fi cp -R storage.skel/* storage/ chown -R www-data:www-data storage/ bootstrap/ +if [ ! -L public/storage ]; then + ln -s "${PWD}/storage/app/public" public/storage + chown -h www-data:www-data public/storage +fi + php /wait-for-db.php if [ -n "${CA_TRUST_CERT:-}" ] && [ -r "${CA_TRUST_CERT}" ]; then From f55e2fe8d1d79f5dbab1c1e974abf40983e866ee Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 09:37:21 +0100 Subject: [PATCH 317/554] refactor(pixelfed): drop the one-shot storage link task the entrypoint now covers --- roles/web-app-pixelfed/tasks/02_bootstrap.yml | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/roles/web-app-pixelfed/tasks/02_bootstrap.yml b/roles/web-app-pixelfed/tasks/02_bootstrap.yml index d24ed52ffa..389a629a31 100644 --- a/roles/web-app-pixelfed/tasks/02_bootstrap.yml +++ b/roles/web-app-pixelfed/tasks/02_bootstrap.yml @@ -115,27 +115,6 @@ until: pixelfed_passport_keys.rc == 0 delegate_to: "{{ PIXELFED_HOST_NODE }}" -- name: "✅ Ensure the Pixelfed public storage symlink exists" - ansible.builtin.command: - argv: - - container - - exec - - -u - - "{{ PIXELFED_APP_USER }}" - - "{{ PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver PIXELFED_LOCAL_CID resolved at delegate_to runtime - - sh - - -lc - - | - if [ ! -L /var/www/public/storage ]; then - php artisan storage:link - fi - register: pixelfed_storage_link - changed_when: false - retries: 20 - delay: 5 - until: pixelfed_storage_link.rc == 0 - delegate_to: "{{ PIXELFED_HOST_NODE }}" - - name: "🎬 Initialize the Pixelfed instance actor" ansible.builtin.command: argv: From de33c6466da08c4c1d711243a9b1cc0807854a06 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 16:40:39 +0100 Subject: [PATCH 318/554] test(openpost): check the LinkedIn post by the id OpenPost records, since v7.22.9 stores no URL for it --- .../files/playwright/test-crossposter-linkedin.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js index 0a6af1bbf9..5929c982f3 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js @@ -124,20 +124,16 @@ exports.register = function (shared) { { timeout: resolveTimeout(180_000), message: `${label}: the LinkedIn destination must end published` }, ) .toBe("published"); - expect(rendition.external_url, `${label}: OpenPost must record the URL of the LinkedIn post`).toContain( - `${LINKEDIN_ORIGIN}/feed/update/`, - ); + expect(rendition.external_id, `${label}: OpenPost must record the id of the LinkedIn post`).toMatch(/^urn:li:share:/); - await gotoOnion(page, rendition.external_url, { waitUntil: "domcontentloaded" }); + await gotoOnion(page, `${LINKEDIN_ORIGIN}/feed/update/${rendition.external_id}`, { waitUntil: "domcontentloaded" }); await expect(page.getByRole("article"), `${label}: the LinkedIn post must show the text edited in the desk`).toContainText(edited); await expect(page, `${label}: the LinkedIn post must carry the member's name`).toHaveTitle(new RegExp(member.name)); const posts = await (await page.request.get(`${shared.env.linkedinFakeUrl}/__fake/linkedin/posts`)).json(); const delivered = posts.filter((post) => String(post.text).includes(marker)); expect(delivered.map((post) => post.text), `${label}: LinkedIn must receive the edited post exactly once`).toEqual([edited]); - expect(decodeURIComponent(rendition.external_url), `${label}: OpenPost must link the post LinkedIn created`).toContain( - delivered[0].id, - ); + expect(rendition.external_id, `${label}: OpenPost must record the post LinkedIn created`).toBe(delivered[0].id); await gotoOnion(page, `${shared.env.appBaseUrl}/publications`, { waitUntil: "domcontentloaded" }); await shared.logout(page, label); From efae4bf5664bc8f90863c4c66850d62f5a3febf7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 16:40:39 +0100 Subject: [PATCH 319/554] test(openpost): wait for the upload to complete and reload the media library before looking for the file --- roles/web-app-openpost/files/playwright/_shared.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index f50a2242ef..f1da88ba89 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -184,6 +184,12 @@ async function uploadMedia(page, fileName, label) { await addMedia.click(); const dialog = page.getByRole("dialog", { name: /upload media/i }); await expect(dialog, `${label}: the upload dialog must open`).toBeVisible({ timeout: resolveTimeout(30_000) }); + const completed = page.waitForResponse( + (response) => + response.request().method() === "POST" && + /\/api\/v1\/media\/upload-session\/[^/]+\/complete$/.test(new URL(response.url()).pathname), + { timeout: resolveTimeout(60_000) }, + ); await dialog.locator('input[type="file"]').first().setInputFiles({ name: fileName, mimeType: "image/png", @@ -193,6 +199,7 @@ async function uploadMedia(page, fileName, label) { if (await confirm.first().isVisible().catch(() => false)) { await confirm.first().click(); } + expect((await completed).ok(), `${label}: OpenPost must complete the upload`).toBe(true); await expect( dialog.getByText(fileName).first(), `${label}: the upload dialog must list the file it received`, @@ -201,6 +208,7 @@ async function uploadMedia(page, fileName, label) { await page.keyboard.press("Escape"); } await expect(dialog, `${label}: the upload dialog must close`).toBeHidden({ timeout: resolveTimeout(30_000) }); + await gotoOnion(page, `${env.appBaseUrl}/media`, { waitUntil: "domcontentloaded" }); await expect( page.getByText(fileName).or(page.locator(`img[alt*="${fileName}"]`)).first(), `${label}: the uploaded file must appear in the media library`, From 80133678fccdd4f9d02a6f6e88cbf51abe7f2e5f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 20:29:25 +0100 Subject: [PATCH 320/554] test(openpost): look for crossposter reports in Junk too, match the source URL in the decoded body and report IMAP errors --- .../files/test/openpost/mailbox.py | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/mailbox.py b/roles/web-app-openpost/files/test/openpost/mailbox.py index c785ddf8c5..f8d392ec4f 100644 --- a/roles/web-app-openpost/files/test/openpost/mailbox.py +++ b/roles/web-app-openpost/files/test/openpost/mailbox.py @@ -6,6 +6,8 @@ OPENPOST_MAIL_PASSWORD_B64 base64 password of the administrator mailbox from __future__ import annotations import base64 +import email +import email.policy import imaplib import os import ssl @@ -16,26 +18,37 @@ MAIL_HOST = os.environ["OPENPOST_MAIL_HOST"] MAIL_PASSWORD = base64.b64decode(os.environ["OPENPOST_MAIL_PASSWORD_B64"]).decode() IMAPS_PORT = 993 REPORT_SUBJECT = "OpenPost crossposter" +MAILBOXES = ("INBOX", "Junk Mail") -def reports_naming(urls: list[str]) -> list[str]: +def _reports(imap: imaplib.IMAP4_SSL, mailbox: str) -> list[str]: + typ, _ = imap.select(f'"{mailbox}"', readonly=True) + if typ != "OK": + return [] + typ, data = imap.search(None, "SUBJECT", f'"{REPORT_SUBJECT}"') + texts = [] + for number in data[0].split() if typ == "OK" and data else []: + typ, parts = imap.fetch(number, "(BODY.PEEK[])") + for part in parts if typ == "OK" else []: + if isinstance(part, tuple): + message = email.message_from_bytes(part[1], policy=email.policy.default) + body = message.get_body(("plain",)) + texts.append(body.get_content() if body else "") + return texts + + +def reports_naming(urls: list[str]) -> tuple[list[str], str]: context = ssl.create_default_context() context.check_hostname = False context.verify_mode = ssl.CERT_NONE - found: list[str] = [] try: with imaplib.IMAP4_SSL( PROXY_ADDRESS or MAIL_HOST, IMAPS_PORT, ssl_context=context, timeout=60 ) as imap: imap._encoding = "utf-8" imap.login(MAIL_RECIPIENT, MAIL_PASSWORD) - imap.select("INBOX", readonly=True) - for url in urls: - typ, data = imap.search( - None, "SUBJECT", f'"{REPORT_SUBJECT}"', "BODY", f'"{url}"' - ) - if typ == "OK" and data and data[0].split(): - found.append(url) - except (imaplib.IMAP4.error, OSError): - return found - return found + texts = [text for mailbox in MAILBOXES for text in _reports(imap, mailbox)] + except (imaplib.IMAP4.error, OSError) as error: + return [], f"IMAP {type(error).__name__}: {error}" + found = [url for url in urls if any(url in text for text in texts)] + return found, f"{len(texts)} crossposter report(s) in {', '.join(MAILBOXES)}" From ddb64e1540ae379c2194a27d4857725920ab8f9c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 31 Oct 2026 20:29:25 +0100 Subject: [PATCH 321/554] test(openpost): print what the mailbox held when the failure report check fails --- roles/web-app-openpost/files/test/openpost/crossposter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/crossposter.py b/roles/web-app-openpost/files/test/openpost/crossposter.py index e476546f0f..4fa7f3b05e 100644 --- a/roles/web-app-openpost/files/test/openpost/crossposter.py +++ b/roles/web-app-openpost/files/test/openpost/crossposter.py @@ -310,15 +310,15 @@ def check_failures(token: str, workspace: str, route: dict, source: str) -> set[ ) urls = [str(rejected.get("url")), str(exhausted.get("url"))] budget = POLL_SECONDS * 6 + RETRY_SECONDS - found = wait( + found, mailbox = wait( lambda: reports_naming(urls), - lambda found: len(found) == len(urls), + lambda result: len(result[0]) == len(urls), budget, ) check( "a provider rejection and an exhausted retry budget reach the administrator by mail", len(found) == len(urls), - found, + f"{found} of {urls}; {mailbox}", ) if CROSSPOSTER: states = { From 6db963ac062457fb60ca3d87ad675d66d2a3ac57 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 322/554] fix(web-app-stalwart): name the recipient throttle key, its rule and one settings reload body --- roles/web-app-stalwart/vars/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/web-app-stalwart/vars/main.yml b/roles/web-app-stalwart/vars/main.yml index 4057e736d7..010af57afd 100644 --- a/roles/web-app-stalwart/vars/main.yml +++ b/roles/web-app-stalwart/vars/main.yml @@ -26,6 +26,9 @@ STALWART_BAN_TRACER: STALWART_JMAP_APPLICATION_GET: >- {{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'], 'methodCalls': [['x:Application/get', {'ids': none}, 'c0']]} | to_json }} +STALWART_JMAP_RELOAD_SETTINGS: >- + {{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'], + 'methodCalls': [['x:Action/set', {'create': {'a': {'@type': 'ReloadSettings'}}}, 'c0']]} | to_json }} STALWART_JMAP_TRANSIENT_ERRORS: - serverUnavailable - rateLimit @@ -91,6 +94,10 @@ STALWART_BOT_APP_PASSWORD_DESCRIPTION: "Infinito.Nexus submission" STALWART_BOT_APP_PASSWORD_RETIRED_DESCRIPTION: "Infinito.Nexus submission, retired" stalwart_app_password_stale: {} STALWART_RELAY_RULE: "!is_empty(authenticated_as)" +STALWART_RCPT_THROTTLE_KEY: + senderDomain: true + rcpt: true +STALWART_RCPT_THROTTLE_RULE: "is_empty(authenticated_as)" STALWART_BAN_PERIOD_MS: "{{ (lookup('config', application_id, 'services.stalwart.ban_period_seconds') | int) * 1000 }}" STALWART_BAN_PERIODS: From 76ff568a3dd18d413dbf6dd84e7e28fec5513ac5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 323/554] refactor(web-app-stalwart): reload the ban settings through the shared reload body --- roles/web-app-stalwart/tasks/security.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/roles/web-app-stalwart/tasks/security.yml b/roles/web-app-stalwart/tasks/security.yml index a311f8a242..58039e2c8f 100644 --- a/roles/web-app-stalwart/tasks/security.yml +++ b/roles/web-app-stalwart/tasks/security.yml @@ -27,8 +27,4 @@ - name: "🔄 Reload Stalwart's settings" include_tasks: jmap_call.yml vars: - stalwart_jmap_body: >- - {{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'], - 'methodCalls': [['x:Action/set', - {'create': {'a': {'@type': 'ReloadSettings'}}}, - 'c0']]} | to_json }} + stalwart_jmap_body: "{{ STALWART_JMAP_RELOAD_SETTINGS }}" From b9e4a2863ea2dd2b3e7549b7bd4e79dceb4553ff Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 324/554] fix(web-app-stalwart): count only unauthenticated sessions against the recipient throttle (#1335) --- roles/web-app-stalwart/tasks/throttle.yml | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 roles/web-app-stalwart/tasks/throttle.yml diff --git a/roles/web-app-stalwart/tasks/throttle.yml b/roles/web-app-stalwart/tasks/throttle.yml new file mode 100644 index 0000000000..d1994927d2 --- /dev/null +++ b/roles/web-app-stalwart/tasks/throttle.yml @@ -0,0 +1,34 @@ +--- +- name: "📖 Read Stalwart's inbound throttles" + include_tasks: jmap_call.yml + vars: + stalwart_jmap_body: >- + {{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'], + 'methodCalls': [['x:MtaInboundThrottle/get', {'ids': none}, 'c0']]} | to_json }} + +- name: "🔍 Resolve the recipient throttles that still count authenticated submissions" + ansible.builtin.set_fact: + stalwart_rcpt_throttle_ids: >- + {{ stalwart_jmap.methodResponses[0][1].list + | selectattr('key', 'equalto', STALWART_RCPT_THROTTLE_KEY) + | rejectattr('match.else', 'equalto', STALWART_RCPT_THROTTLE_RULE) + | map(attribute='id') + | list }} + +- name: "📮 Keep authenticated submissions out of the recipient throttle" + when: stalwart_rcpt_throttle_ids | length > 0 + block: + - name: "🔧 Count only unauthenticated sessions against the recipient throttle" + include_tasks: jmap_call.yml + vars: + stalwart_jmap_body: >- + {{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'], + 'methodCalls': [['x:MtaInboundThrottle/set', + {'update': dict(stalwart_rcpt_throttle_ids + | zip([{'match': {'else': STALWART_RCPT_THROTTLE_RULE}}] * (stalwart_rcpt_throttle_ids | length)))}, + 'c0']]} | to_json }} + + - name: "🔄 Reload Stalwart's settings" + include_tasks: jmap_call.yml + vars: + stalwart_jmap_body: "{{ STALWART_JMAP_RELOAD_SETTINGS }}" From c3286b79b1e627a291fef35eb339f7af88c2e764 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 325/554] fix(web-app-stalwart): apply the recipient throttle rule on every deploy --- roles/web-app-stalwart/tasks/manager_ops.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/web-app-stalwart/tasks/manager_ops.yml b/roles/web-app-stalwart/tasks/manager_ops.yml index dff0bc26b1..72a33d9909 100644 --- a/roles/web-app-stalwart/tasks/manager_ops.yml +++ b/roles/web-app-stalwart/tasks/manager_ops.yml @@ -30,6 +30,9 @@ - name: "⏱️ Let Stalwart's address bans expire" include_tasks: security.yml +- name: "📮 Keep authenticated submissions out of the recipient throttle" + include_tasks: throttle.yml + - name: "⚙️ Provision the Stalwart WebUI (WebAdmin) bundle" include_tasks: 02_webadmin.yml From 49072be9bbbf1cc633faef464936398e781b127a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 326/554] docs(web-app-stalwart): document that authenticated submissions skip the recipient throttle --- roles/web-app-stalwart/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/web-app-stalwart/README.md b/roles/web-app-stalwart/README.md index 6537a644ac..150fe156b4 100644 --- a/roles/web-app-stalwart/README.md +++ b/roles/web-app-stalwart/README.md @@ -231,6 +231,12 @@ account (or the Keycloak SSO token when SSO is enabled). (`templates/jmap/*.json.j2`). - **Only authenticated sessions relay, with or without SSO.** Under SSO a bot authenticates with an app password. +- **Authenticated submissions skip the recipient throttle.** Stalwart's default + inbound throttle allows 25 mails per hour from one sender domain to one + recipient, and plus-addresses share their base address's budget. The role + limits it to unauthenticated sessions (`STALWART_RCPT_THROTTLE_RULE`, + `tasks/throttle.yml`), so the platform's own `no-reply` mail to the + administrator, alerts included, is never deferred with `452 4.4.5`. - **Address bans expire after `services.stalwart.ban_period_seconds`** (one hour by default). Without a period Stalwart keeps a ban forever, and the reverse proxy, the published ports, Tor and the swarm ingress hand many From 184c96b96ac18e62c8830a0811048db4eb8aa071 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 327/554] test(web-app-stalwart): cover the recipient throttle selection, update and reload --- .../web-app-stalwart/test_rcpt_throttle.py | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 tests/unit/python/roles/web-app-stalwart/test_rcpt_throttle.py diff --git a/tests/unit/python/roles/web-app-stalwart/test_rcpt_throttle.py b/tests/unit/python/roles/web-app-stalwart/test_rcpt_throttle.py new file mode 100644 index 0000000000..ed1829af00 --- /dev/null +++ b/tests/unit/python/roles/web-app-stalwart/test_rcpt_throttle.py @@ -0,0 +1,114 @@ +from __future__ import annotations + +import json +import unittest + +from ansible.parsing.dataloader import DataLoader +from ansible.template import Templar + +from utils.cache.yaml import load_yaml_any +from utils.roles.mapping import ROLE_FILE_VARS_MAIN +from utils.templating.ansible import _trust_as_template + +from . import PROJECT_ROOT + +ROLE = PROJECT_ROOT / "roles" / "web-app-stalwart" +TASKS = load_yaml_any(str(ROLE / "tasks" / "throttle.yml"), default_if_missing=[]) +MANAGER_OPS = load_yaml_any( + str(ROLE / "tasks" / "manager_ops.yml"), default_if_missing=[] +) +VARS = load_yaml_any(str(ROLE / ROLE_FILE_VARS_MAIN), default_if_missing={}) +RULE = VARS["STALWART_RCPT_THROTTLE_RULE"] + +SENDER_IP = { + "id": "a", + "description": "Sender IP throttle", + "enable": True, + "key": {"remoteIp": True}, + "match": {"match": {}, "else": ""}, + "rate": {"count": 5, "period": 1000}, +} +RECIPIENT = { + "id": "b", + "description": "Sender address to recipient throttle", + "enable": True, + "key": {"senderDomain": True, "rcpt": True}, + "match": {"match": {}, "else": ""}, + "rate": {"count": 25, "period": 3600000}, +} + + +def _render(template: str, **variables): + templar = Templar(loader=DataLoader(), variables=variables) + return templar.template(_trust_as_template(template)) + + +def _selected(throttles: list[dict]) -> list[str]: + facts = next( + task["ansible.builtin.set_fact"] + for task in TASKS + if "ansible.builtin.set_fact" in task + ) + return _render( + facts["stalwart_rcpt_throttle_ids"], + STALWART_RCPT_THROTTLE_KEY=VARS["STALWART_RCPT_THROTTLE_KEY"], + STALWART_RCPT_THROTTLE_RULE=RULE, + stalwart_jmap={ + "methodResponses": [["x:MtaInboundThrottle/get", {"list": throttles}, "c0"]] + }, + ) + + +def _update_body(ids: list[str]) -> dict: + block = next(task["block"] for task in TASKS if "block" in task) + return json.loads( + _render( + block[0]["vars"]["stalwart_jmap_body"], + stalwart_rcpt_throttle_ids=ids, + STALWART_RCPT_THROTTLE_RULE=RULE, + ) + ) + + +class TestRecipientThrottle(unittest.TestCase): + def test_only_the_recipient_throttle_is_selected(self): + self.assertEqual(_selected([SENDER_IP, RECIPIENT]), ["b"]) + + def test_a_limited_recipient_throttle_is_left_alone(self): + limited = {**RECIPIENT, "match": {"match": {}, "else": RULE}} + self.assertEqual(_selected([SENDER_IP, limited]), []) + + def test_the_update_counts_only_unauthenticated_sessions(self): + self.assertEqual( + _update_body(["b"])["methodCalls"], + [ + [ + "x:MtaInboundThrottle/set", + { + "update": { + "b": {"match": {"else": "is_empty(authenticated_as)"}} + } + }, + "c0", + ] + ], + ) + + def test_the_rule_is_the_complement_of_the_relay_rule(self): + self.assertEqual(VARS["STALWART_RELAY_RULE"], "!" + RULE) + + def test_the_settings_reload_after_the_update(self): + block = next(task["block"] for task in TASKS if "block" in task) + self.assertEqual( + block[-1]["vars"]["stalwart_jmap_body"], + "{{ STALWART_JMAP_RELOAD_SETTINGS }}", + ) + + def test_the_manager_runs_the_throttle_tasks(self): + self.assertIn( + "throttle.yml", [task.get("include_tasks") for task in MANAGER_OPS] + ) + + +if __name__ == "__main__": + unittest.main() From 3fb59f331e2c16b0362d515bfcee9703a4aa3806 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 328/554] test(openpost): check that the mail server accepted the failure reports instead of reading the mailbox --- .../files/test/openpost/crossposter.py | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/crossposter.py b/roles/web-app-openpost/files/test/openpost/crossposter.py index 4fa7f3b05e..f9f1d8918e 100644 --- a/roles/web-app-openpost/files/test/openpost/crossposter.py +++ b/roles/web-app-openpost/files/test/openpost/crossposter.py @@ -20,7 +20,6 @@ from pathlib import Path from openpost.api import DEADLINE, accounts, call, check, render_media from openpost.journal import hits, statuses -from openpost.mailbox import reports_naming from openpost.simulator import SCENARIOS, simulator_admin from openpost.sources import ( mastodon_post, @@ -91,6 +90,15 @@ def items(source_url: str) -> list[list[str]]: ) +def reported(source_url: str) -> bool: + rows = sql( + "SELECT notified_at IS NOT NULL FROM crossposter.items" + " WHERE source_url = %s AND state IN ('failed', 'dead_lettered')", + source_url, + ) + return bool(rows) and all(row == ["True"] for row in rows) + + def publications(token: str, workspace: str, nonce: str) -> list[dict]: query = urllib.parse.urlencode( {"workspace_id": workspace, "search": nonce, "limit": 50} @@ -293,6 +301,9 @@ def mastodon_scenarios( def check_failures(token: str, workspace: str, route: dict, source: str) -> set[str]: + if not CROSSPOSTER: + print("[SKIP] crossposter failure reports: its task runs on another swarm node") + return set() base, tag = route["base_url"], route["tags"][0] rejected = mastodon_post( base, @@ -309,26 +320,24 @@ def check_failures(token: str, workspace: str, route: dict, source: str) -> set[ "", ) urls = [str(rejected.get("url")), str(exhausted.get("url"))] - budget = POLL_SECONDS * 6 + RETRY_SECONDS - found, mailbox = wait( - lambda: reports_naming(urls), - lambda result: len(result[0]) == len(urls), - budget, + found = wait( + lambda: [url for url in urls if reported(url)], + lambda found: len(found) == len(urls), + POLL_SECONDS * 6 + RETRY_SECONDS, ) check( - "a provider rejection and an exhausted retry budget reach the administrator by mail", + "the mail server accepts the reports of a provider rejection and an exhausted retry budget for the administrator", len(found) == len(urls), - f"{found} of {urls}; {mailbox}", + {url: items(url) for url in urls}, + ) + states = { + state for url in urls for _, state, *_ in items(url) if state != "published" + } + check( + "the rejection ends failed and the outage ends dead-lettered", + states == {"failed", "dead_lettered"}, + states, ) - if CROSSPOSTER: - states = { - state for url in urls for _, state, *_ in items(url) if state != "published" - } - check( - "the rejection ends failed and the outage ends dead-lettered", - states == {"failed", "dead_lettered"}, - states, - ) return {"failed", "dead_lettered"} From a2a53bf7113a96722d50e9e877724a06ba34b212 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 329/554] test(openpost): drop the IMAP mailbox reader --- .../files/test/openpost/mailbox.py | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 roles/web-app-openpost/files/test/openpost/mailbox.py diff --git a/roles/web-app-openpost/files/test/openpost/mailbox.py b/roles/web-app-openpost/files/test/openpost/mailbox.py deleted file mode 100644 index f8d392ec4f..0000000000 --- a/roles/web-app-openpost/files/test/openpost/mailbox.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Env (rendered into test.env from templates/test.env.j2): -OPENPOST_MAIL_HOST IMAPS host of the platform mail server -OPENPOST_MAIL_PASSWORD_B64 base64 password of the administrator mailbox -""" - -from __future__ import annotations - -import base64 -import email -import email.policy -import imaplib -import os -import ssl - -from openpost.api import MAIL_RECIPIENT, PROXY_ADDRESS - -MAIL_HOST = os.environ["OPENPOST_MAIL_HOST"] -MAIL_PASSWORD = base64.b64decode(os.environ["OPENPOST_MAIL_PASSWORD_B64"]).decode() -IMAPS_PORT = 993 -REPORT_SUBJECT = "OpenPost crossposter" -MAILBOXES = ("INBOX", "Junk Mail") - - -def _reports(imap: imaplib.IMAP4_SSL, mailbox: str) -> list[str]: - typ, _ = imap.select(f'"{mailbox}"', readonly=True) - if typ != "OK": - return [] - typ, data = imap.search(None, "SUBJECT", f'"{REPORT_SUBJECT}"') - texts = [] - for number in data[0].split() if typ == "OK" and data else []: - typ, parts = imap.fetch(number, "(BODY.PEEK[])") - for part in parts if typ == "OK" else []: - if isinstance(part, tuple): - message = email.message_from_bytes(part[1], policy=email.policy.default) - body = message.get_body(("plain",)) - texts.append(body.get_content() if body else "") - return texts - - -def reports_naming(urls: list[str]) -> tuple[list[str], str]: - context = ssl.create_default_context() - context.check_hostname = False - context.verify_mode = ssl.CERT_NONE - try: - with imaplib.IMAP4_SSL( - PROXY_ADDRESS or MAIL_HOST, IMAPS_PORT, ssl_context=context, timeout=60 - ) as imap: - imap._encoding = "utf-8" - imap.login(MAIL_RECIPIENT, MAIL_PASSWORD) - texts = [text for mailbox in MAILBOXES for text in _reports(imap, mailbox)] - except (imaplib.IMAP4.error, OSError) as error: - return [], f"IMAP {type(error).__name__}: {error}" - found = [url for url in urls if any(url in text for text in texts)] - return found, f"{len(texts)} crossposter report(s) in {', '.join(MAILBOXES)}" From cb24be2001d0dfff64196dfb74496667d895298e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 330/554] test(openpost): drop the mailbox host and password from the probe env --- roles/web-app-openpost/templates/test.env.j2 | 2 -- 1 file changed, 2 deletions(-) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index 5d9df44da4..7b4a18c3c0 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -33,9 +33,7 @@ OPENPOST_MEMBER_EMAIL={{ lookup('users', 'administrator').email | regex_replace( OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'administrator').password ~ ':' ~ application_id ~ ':cli-member') | hash('sha256') | b64encode }} OPENPOST_SSO_ADMIN_EMAIL={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_OIDC_ENABLED | bool else '' }} OPENPOST_MAIL_RECIPIENT={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_EMAIL_ENABLED | bool else '' }} -OPENPOST_MAIL_HOST={{ _view.mail_host }} OPENPOST_SMTP_ENABLED={{ _view.smtp_enabled | bool | string | lower }} -OPENPOST_MAIL_PASSWORD_B64={{ lookup('users', 'administrator').password | b64encode }} OPENPOST_CROSSPOSTER_ROUTES_B64={{ _view.routes | to_json | b64encode }} OPENPOST_CROSSPOSTER_POLL_SECONDS={{ OPENPOST_CROSSPOSTER.poll_interval_seconds }} OPENPOST_CROSSPOSTER_RETRY_SECONDS={{ (OPENPOST_CROSSPOSTER.retry.max_attempts | int) * (OPENPOST_CROSSPOSTER.retry.cap_seconds | int) }} From e6024204dcb574281f69f394d7d04defec63a5d3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:37 +0100 Subject: [PATCH 331/554] refactor(openpost): drop the mail host from the probe's public view --- roles/web-app-openpost/tasks/00_core.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index 27e196d6f8..0145f2e335 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -8,7 +8,6 @@ public_url: "{{ OPENPOST_URL }}" api_headers: "{{ OPENPOST_API_HEADERS }}" s3_public_url: "{{ lookup('objstore', application_id, 'public_url') | regex_replace('/?$', '/') if OPENPOST_OBJSTORE_ENABLED | bool else '' }}" - mail_host: "{{ lookup('email', application_id).host if OPENPOST_EMAIL_ENABLED | bool else '' }}" smtp_enabled: "{{ OPENPOST_SMTP_ENABLED | bool }}" relay_targets: >- {%- set _targets = {} -%} From 564941241e86cd11e87a4f3d5ce83a2a6405aa16 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 17:30:38 +0100 Subject: [PATCH 332/554] docs(requirements): 063 asserts the accepted notification instead of the mailbox --- docs/requirements/063-openpost-crossposter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements/063-openpost-crossposter.md b/docs/requirements/063-openpost-crossposter.md index 8732cb86c5..c27b1a3052 100644 --- a/docs/requirements/063-openpost-crossposter.md +++ b/docs/requirements/063-openpost-crossposter.md @@ -183,7 +183,7 @@ crossposter: - [ ] Unit tests under `tests/unit/python/roles/web-app-openpost/files/crossposter/` cover length counting, adaptation, routing filters, the idempotency key, backoff timing and the state machine with fixtures recorded from Mastodon, Pixelfed and PeerTube responses. - [ ] The CLI test posts as a test user on the local Mastodon, Pixelfed and PeerTube instances and asserts within a bounded time exactly one OpenPost publication per route, one delivered post on the local Fediverse target, and the expected simulator requests for X, Facebook, Instagram and YouTube. - [ ] The CLI test asserts review mode (draft without delivery), the opt-out hashtag, loop prevention, restart without duplicates, and no forwarding of existing posts on route activation. -- [ ] The CLI test lets the simulator answer 503 before succeeding and asserts one delivery, then forces a permanent failure and asserts the dead-letter state and the notification in the test mailbox. +- [ ] The CLI test lets the simulator answer 503 before succeeding and asserts one delivery, then forces a permanent failure and asserts the dead-letter state and that the platform mail server accepted the notification for the configured recipients. - [ ] The Playwright spec shows the administrator persona finding a crossposted draft in the desk, editing it and scheduling it. - [ ] `make test` and `make roundtrip apps="web-app-openpost"` are green. From d5f5cdc4512ce7e71d1188498ac8af9135f01c93 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Thu, 5 Nov 2026 19:07:33 +0100 Subject: [PATCH 333/554] fix(test): read the dockerignore lint inputs through the file cache and import PROJECT_ROOT --- tests/lint/repository/test_dockerignore.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/lint/repository/test_dockerignore.py b/tests/lint/repository/test_dockerignore.py index 81df725641..c900866f99 100644 --- a/tests/lint/repository/test_dockerignore.py +++ b/tests/lint/repository/test_dockerignore.py @@ -1,27 +1,29 @@ import re import unittest -from pathlib import Path -PROJECT_ROOT = Path(__file__).resolve().parents[3] +from utils.cache.files import read_text + +from . import PROJECT_ROOT + NESTED_CHECKOUTS = (".claude/worktrees/", ".worktrees/") class TestDockerignore(unittest.TestCase): def test_dockerignore_is_the_gitignore(self) -> None: self.assertEqual( - (PROJECT_ROOT / ".gitignore").read_text(), - (PROJECT_ROOT / ".dockerignore").read_text(), + read_text(str(PROJECT_ROOT / ".gitignore")), + read_text(str(PROJECT_ROOT / ".dockerignore")), "Run 'make fix-dockerignore': .dockerignore must be a copy of .gitignore.", ) def test_nested_checkouts_stay_out_of_the_build_context(self) -> None: - lines = (PROJECT_ROOT / ".dockerignore").read_text().splitlines() + lines = read_text(str(PROJECT_ROOT / ".dockerignore")).splitlines() for entry in NESTED_CHECKOUTS: with self.subTest(entry=entry): self.assertIn(entry, lines) def test_compose_up_regenerates_the_dockerignore(self) -> None: - makefile = (PROJECT_ROOT / "Makefile").read_text() + makefile = read_text(str(PROJECT_ROOT / "Makefile")) match = re.search(r"^compose-up:(.*)$", makefile, re.MULTILINE) self.assertIsNotNone(match, "Makefile has no compose-up target") self.assertIn("fix-dockerignore", match.group(1).split()) From 87322a5ada745cb44d6a70708d1c7e65470be4c8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 6 Nov 2026 13:31:39 +0100 Subject: [PATCH 334/554] refactor(web-app-openpost): read the registered Fediverse apps only when the file exists instead of ignoring the read error --- roles/web-app-openpost/tasks/01_fediverse_apps.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/tasks/01_fediverse_apps.yml b/roles/web-app-openpost/tasks/01_fediverse_apps.yml index 764c772a3f..f505a53f51 100644 --- a/roles/web-app-openpost/tasks/01_fediverse_apps.yml +++ b/roles/web-app-openpost/tasks/01_fediverse_apps.yml @@ -1,10 +1,16 @@ --- +- name: "🔎 Check for the OpenPost apps registered on sibling Fediverse instances" + ansible.builtin.stat: + path: "{{ OPENPOST_FEDIVERSE_APPS_HOST }}" + register: openpost_fediverse_apps_file + delegate_to: "{{ STACK_HOST }}" + run_once: true + - name: "📖 Read the OpenPost apps already registered on the sibling Fediverse instances" ansible.builtin.slurp: src: "{{ OPENPOST_FEDIVERSE_APPS_HOST }}" register: openpost_fediverse_apps_raw - failed_when: false - changed_when: false + when: openpost_fediverse_apps_file.stat.exists delegate_to: "{{ STACK_HOST }}" run_once: true no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" @@ -13,7 +19,7 @@ ansible.builtin.set_fact: openpost_fediverse_apps: >- {{ (openpost_fediverse_apps_raw.content | b64decode | from_json) - if openpost_fediverse_apps_raw.content is defined else {} }} + if openpost_fediverse_apps_file.stat.exists else {} }} no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "📝 Register an OpenPost app on each sibling instance that has none yet" From d82c1eb064172a3eec3d14f012d93d6217612323 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 6 Nov 2026 13:31:39 +0100 Subject: [PATCH 335/554] refactor(web-app-openpost): spell out the empty crossposter state instead of defaulting each key --- roles/web-app-openpost/tasks/crossposter/render.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/render.yml b/roles/web-app-openpost/tasks/crossposter/render.yml index 6af09df02b..f94557541c 100644 --- a/roles/web-app-openpost/tasks/crossposter/render.yml +++ b/roles/web-app-openpost/tasks/crossposter/render.yml @@ -17,11 +17,14 @@ - name: "🧭 Remember the provisioned workspace, API token and CI source tokens" ansible.builtin.set_fact: - openpost_crossposter_workspace: "{{ openpost_crossposter_state.workspace | default('') }}" - openpost_crossposter_token: "{{ openpost_crossposter_state.token | default('') }}" - openpost_crossposter_sources: "{{ openpost_crossposter_state.sources | default({}) }}" + openpost_crossposter_workspace: "{{ openpost_crossposter_state.workspace }}" + openpost_crossposter_token: "{{ openpost_crossposter_state.token }}" + openpost_crossposter_sources: "{{ openpost_crossposter_state.sources }}" vars: - openpost_crossposter_state: "{{ (openpost_crossposter_state_raw.content | b64decode | from_json) if openpost_crossposter_state_file.stat.exists else {} }}" + openpost_crossposter_state: >- + {{ (openpost_crossposter_state_raw.content | b64decode | from_json) + if openpost_crossposter_state_file.stat.exists + else {'workspace': '', 'token': '', 'sources': {}} }} no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "📦 Stage the crossposter build context" From bd311a8c27b79c6c667f29fc3c0f2caba4989e5c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 6 Nov 2026 13:31:39 +0100 Subject: [PATCH 336/554] test(web-app-openpost): open the accounts page OpenPost v7.37 moved out of settings and match its Connected accounts heading --- .../web-app-openpost/files/playwright/_shared.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index f1da88ba89..acfa1071f7 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -216,7 +216,7 @@ async function uploadMedia(page, fileName, label) { } async function openMastodonConnectDialog(page, label) { - await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + await gotoOnion(page, `${env.appBaseUrl}/accounts`, { waitUntil: "domcontentloaded" }); const card = page.locator('[data-testid="provider-card-mastodon"]'); await expect(card, `${label}: the Mastodon provider card must render`).toBeVisible({ timeout: resolveTimeout(60_000) }); await card.getByRole("button", { name: /^connect$/i }).click(); @@ -238,8 +238,8 @@ function skipOnOnionSibling(platform) { } async function disconnectAccount(page, account) { - await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); - await expect(page.getByRole("heading", { name: /connected channels/i })).toBeVisible({ timeout: resolveTimeout(60_000) }); + await gotoOnion(page, `${env.appBaseUrl}/accounts`, { waitUntil: "domcontentloaded" }); + await expect(page.getByRole("heading", { name: /connected accounts/i })).toBeVisible({ timeout: resolveTimeout(60_000) }); const actions = mastodonChannelActions(page, account); if (!(await actions.isVisible())) { return; @@ -251,7 +251,7 @@ async function disconnectAccount(page, account) { timeout: resolveTimeout(30_000), }); await confirm.getByRole("button", { name: /^remove connection$/i }).click(); - await expect(actions, `${account.handle} must disappear from the connected channels`).toBeHidden({ + await expect(actions, `${account.handle} must disappear from the connected accounts`).toBeHidden({ timeout: resolveTimeout(60_000), }); } @@ -295,10 +295,10 @@ async function connectMastodonAccount(page, context, label) { message: `${label}: OpenPost must leave the code page after the exchange`, }) .not.toContain("/accounts/mastodon/callback"); - await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + await gotoOnion(page, `${env.appBaseUrl}/accounts`, { waitUntil: "domcontentloaded" }); await expect( mastodonChannelActions(page, account), - `${label}: ${account.handle} must be listed among the connected channels`, + `${label}: ${account.handle} must be listed among the connected accounts`, ).toBeVisible({ timeout: resolveTimeout(60_000) }); return account; } @@ -329,7 +329,7 @@ async function mastodonStatusExists(page, account, marker) { } async function openPixelfedConnectDialog(page, label) { - await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + await gotoOnion(page, `${env.appBaseUrl}/accounts`, { waitUntil: "domcontentloaded" }); const card = page.locator('[data-testid="provider-card-pixelfed"]'); await expect(card, `${label}: the Pixelfed provider card must render`).toBeVisible({ timeout: resolveTimeout(60_000) }); await card.getByRole("button", { name: /^connect$/i }).click(); @@ -410,7 +410,7 @@ async function connectPixelfedAccount(page, label) { message: `${label}: OpenPost must leave the code page after the exchange`, }) .not.toContain("/accounts/pixelfed/callback"); - await gotoOnion(page, `${env.appBaseUrl}/settings?tab=accounts`, { waitUntil: "domcontentloaded" }); + await gotoOnion(page, `${env.appBaseUrl}/accounts`, { waitUntil: "domcontentloaded" }); await expect( pixelfedChannelActions(page, account), `${label}: ${account.handle} must be listed among the connected Pixelfed channels`, From 0faa00c87b3b92c2fe1f429b1e8574acfd1c6e17 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 6 Nov 2026 13:31:39 +0100 Subject: [PATCH 337/554] test(web-app-openpost): find the posts search as the searchbox OpenPost v7.37 renders --- .../web-app-openpost/files/playwright/test-crossposter-draft.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js index 45845cb75a..f168da8a03 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js @@ -64,7 +64,7 @@ async function awaitCrosspostedDraft(page, shared, headers, workspace, marker, l async function openDraftInDesk(page, shared, marker, label) { await gotoOnion(page, `${shared.env.appBaseUrl}/publications?tab=drafts`, { waitUntil: "domcontentloaded" }); - await page.getByRole("textbox", { name: /search posts/i }).fill(marker); + await page.getByRole("searchbox", { name: /search posts/i }).fill(marker); const listed = page.getByRole("link", { name: new RegExp(marker, "i") }).first(); await expect(listed, `${label}: the crossposted draft must be listed among the drafts`).toBeVisible({ timeout: resolveTimeout(60_000), From 7ef104a52a372346ecf96978330a947789d2d1e1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 6 Nov 2026 13:31:39 +0100 Subject: [PATCH 338/554] update(web-app-openpost): pin OpenPost v7.37.2 and promote the role to beta --- roles/web-app-openpost/meta/services.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index bb1dd44cab..17bd68cc17 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -65,7 +65,7 @@ openpost: swarm: enabled: true image: ghcr.io/getopenpost/openpost - version: "v7.22.9" + version: "v7.37.2" update: type: registry_tags image: ghcr.io/getopenpost/openpost @@ -92,7 +92,7 @@ openpost: - web-app-mastodon - web-app-pixelfed - web-app-peertube - lifecycle: alpha + lifecycle: beta # nocheck: playwright-service-flag egress sidecar, covered by the role's CLI test # nocheck: dynamic-flag the relay is part of this role and runs whenever OpenPost runs; no other role's presence decides it relay: From 6e6e68f4116a7b03048898375d18b4d9276adc78 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 6 Nov 2026 13:31:39 +0100 Subject: [PATCH 339/554] docs(readme): list OpenPost as beta in the role overview --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7aa41f45ff..27bd87b666 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ Every invokable role in the tested lifecycle envelope, with its upstream homepag | [OpenClaw](roles/web-app-openclaw/) | beta | Self-hosted personal AI agent gateway with a browser control UI, sandboxed in a Kata microVM or gVisor runtime | [🌐](https://openclaw.ai/) [🛠️](roles/web-app-openclaw/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Corporate Design](roles/web-svc-css/), [Dashboard](roles/web-app-dashboard/), [Kata & gVisor](roles/svc-virt-kata/), [Keycloak](roles/web-app-keycloak/), [LiteLLM Gateway](roles/svc-ai-litellm/), [Matomo](roles/web-app-matomo/), [Prometheus](roles/web-app-prometheus/), [Tor Onion Service](roles/svc-net-tor/), [Universal Logout](roles/web-svc-logout/) | | [OpenCloud](roles/web-app-opencloud/) | beta | Self-hosted platform for file sync, sharing, and collaboration with Keycloak SSO and central LDAP directory | [🌐](https://opencloud.eu/) [🎬](https://www.youtube.com/watch?v=Cg48rFNY0R4) [🛠️](roles/web-app-opencloud/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Corporate Design](roles/web-svc-css/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [Matomo](roles/web-app-matomo/), [OpenLDAP](roles/svc-db-openldap/), [Prometheus](roles/web-app-prometheus/), [Stalwart Mail Server](roles/web-app-stalwart/), [Tor Onion Service](roles/svc-net-tor/), [Universal Logout](roles/web-svc-logout/) | | [OpenLDAP](roles/svc-db-openldap/) | beta | Self-hosted LDAP directory service for centralized user, group, and schema management with TLS-secured access | [🌐](https://www.openldap.org/) [🛠️](roles/svc-db-openldap/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Tor Onion Service](roles/svc-net-tor/) | +| [OpenPost](roles/web-app-openpost/) | beta | Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks | [🌐](https://openpo.st/) [🎬](https://www.youtube.com/watch?v=_mZf3HzQaN8) [🛠️](roles/web-app-openpost/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Corporate Design](roles/web-svc-css/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [Mastodon](roles/web-app-mastodon/), [Matomo](roles/web-app-matomo/), [PeerTube](roles/web-app-peertube/), [Pixelfed](roles/web-app-pixelfed/), [PostgreSQL](roles/svc-db-postgres/), [Prometheus](roles/web-app-prometheus/), [SeaweedFS](roles/web-app-seaweedfs/), [Stalwart Mail Server](roles/web-app-stalwart/), [Tor Onion Service](roles/svc-net-tor/), [Universal Logout](roles/web-svc-logout/) | | [OpenProject](roles/web-app-openproject/) | beta | Self-hosted platform for project management, work-package tracking, Gantt planning, and team collaboration | [🌐](https://www.openproject.org/) [🎬](https://www.youtube.com/watch?v=rvCd0xH7rCs) [🛠️](roles/web-app-openproject/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Corporate Design](roles/web-svc-css/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [Matomo](roles/web-app-matomo/), [OpenLDAP](roles/svc-db-openldap/), [PostgreSQL](roles/svc-db-postgres/), [Prometheus](roles/web-app-prometheus/), [SeaweedFS](roles/web-app-seaweedfs/), [Stalwart Mail Server](roles/web-app-stalwart/), [Tor Onion Service](roles/svc-net-tor/), [Universal Logout](roles/web-svc-logout/) | | [OpenResty](roles/svc-prx-openresty/) | beta | NGINX-based web platform and reverse proxy with validated config reloads and Let's Encrypt integration | [🌐](https://openresty.org/) [🎬](https://www.youtube.com/watch?v=NR8U1qYHGqk) [🛠️](roles/svc-prx-openresty/README.md#quick-setup) | [Tor Onion Service](roles/svc-net-tor/) | | [OpenTalk](roles/web-app-opentalk/) | beta | Sovereign open-source video conferencing platform for audio/video calls, screen sharing, breakout rooms, and SSO | [🌐](https://opentalk.eu/) [🛠️](roles/web-app-opentalk/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Corporate Design](roles/web-svc-css/), [Coturn](roles/web-svc-coturn/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [Matomo](roles/web-app-matomo/), [PostgreSQL](roles/svc-db-postgres/), [Prometheus](roles/web-app-prometheus/), [Redis](roles/svc-db-redis/), [SeaweedFS](roles/web-app-seaweedfs/), [Stalwart Mail Server](roles/web-app-stalwart/), [Universal Logout](roles/web-svc-logout/) | From 79dd9a21e5b443ff1019c26aa69b76cae010ea0c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Fri, 6 Nov 2026 13:31:39 +0100 Subject: [PATCH 340/554] docs(requirements): 035 names the pinned OpenPost v7.37.2 --- docs/requirements/035-mcp-proxy-expansion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements/035-mcp-proxy-expansion.md b/docs/requirements/035-mcp-proxy-expansion.md index 46296d52b9..d0801badfc 100644 --- a/docs/requirements/035-mcp-proxy-expansion.md +++ b/docs/requirements/035-mcp-proxy-expansion.md @@ -461,7 +461,7 @@ An upstream path exists or is claimed, and something concrete stops it here. Eac | `web-app-erpnext` | `version_unverified` | The Frappe MCP component is experimental and unverified against the pinned Frappe v16. | | `web-app-matomo` | `unreviewed_third_party` | The project-owned plugin is unaudited: endpoint, transport, auth and tool scope are unverified in source. | | `web-app-odoo` | `unreviewed_third_party` | Neither Odoo SA nor the OCA publishes a server; the leading third party carries 197 of 231 commits from one author, keeps its access control in a separate Odoo Apps store module outside any pinnable tag, and defaults to a mutating tool scope. | -| `web-app-openpost` | `version_unverified` | The pinned v7.22.9 serves a native `/mcp` endpoint, but its tool list, client registration and publishing side effects on external networks are not audited against that release. | +| `web-app-openpost` | `version_unverified` | The pinned v7.37.2 serves a native `/mcp` endpoint, but its tool list, client registration and publishing side effects on external networks are not audited against that release. | | `web-app-penpot` | `interactive_browser_session` | The server needs an active browser tab and plugin connection, and can execute powerful design-context operations. | | `web-app-shopware` | `version_unverified` | The pinned 6.7.8.2 predates the experimental native `/api/_mcp` server. | From b46049a779f549d6dcdc3aff1c1e61eaee24bf43 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 341/554] refactor(web-app-stalwart): reload the security settings through the shared reload body --- roles/web-app-stalwart/tasks/security/apply.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/roles/web-app-stalwart/tasks/security/apply.yml b/roles/web-app-stalwart/tasks/security/apply.yml index 016c530801..dc037b347d 100644 --- a/roles/web-app-stalwart/tasks/security/apply.yml +++ b/roles/web-app-stalwart/tasks/security/apply.yml @@ -34,8 +34,4 @@ - name: "🔄 Reload Stalwart's settings" include_tasks: "{{ role_path }}/tasks/jmap_call.yml" vars: - stalwart_jmap_body: >- - {{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'], - 'methodCalls': [['x:Action/set', - {'create': {'a': {'@type': 'ReloadSettings'}}}, - 'c0']]} | to_json }} + stalwart_jmap_body: "{{ STALWART_JMAP_RELOAD_SETTINGS }}" From 17234477b3fc687f6103ee19b01a77bb1e932440 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 342/554] refactor(web-app-pixelfed): take APP_URL from url.origin instead of stripping url.base --- roles/web-app-pixelfed/templates/env.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-pixelfed/templates/env.j2 b/roles/web-app-pixelfed/templates/env.j2 index bbae4bfbe8..884522bb5c 100644 --- a/roles/web-app-pixelfed/templates/env.j2 +++ b/roles/web-app-pixelfed/templates/env.j2 @@ -6,7 +6,7 @@ APP_KEY={{ lookup('config', application_id, 'secrets.credentials.app_key')}} APP_NAME="{{ PIXELFED_TITLE }}" APP_ENV={{ ENVIRONMENT | lower }} APP_DEBUG={{MODE_DEBUG | string | lower }} -APP_URL={{ lookup('tls', application_id, 'url.base') | regex_replace('/$', '') }} +APP_URL={{ lookup('tls', application_id, 'url.origin') }} FORCE_HTTPS_URLS={{ lookup('tls', application_id, 'enabled') | string | lower }} APP_DOMAIN={{ lookup('domain',application_id) }} ADMIN_DOMAIN={{ lookup('domain',application_id) }} From 591d3f77f5d327f77291ce32a3e843a63289ad81 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 343/554] fix(web-app-peertube): drop our root password seed now that upstream sets PT_INITIAL_ROOT_PASSWORD --- roles/web-app-peertube/templates/env.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/web-app-peertube/templates/env.j2 b/roles/web-app-peertube/templates/env.j2 index 7d189cab1b..51a0d728b2 100644 --- a/roles/web-app-peertube/templates/env.j2 +++ b/roles/web-app-peertube/templates/env.j2 @@ -27,7 +27,6 @@ PEERTUBE_LIVE_RTMP_PORT={{ PEERTUBE_RTMP_PORT }} {% endif %} PEERTUBE_SECRET={{ lookup('config', application_id, 'secrets.credentials.secret')}} -PT_INITIAL_ROOT_PASSWORD={{ lookup('users', 'administrator').password | dotenv_quote }} {% if lookup('objstore', application_id, 'enabled') | bool %} {% set objstore_bucket = lookup('objstore', application_id, 'bucket') %} From c3ca5f4053c1decb118d1bc5e43e3e075b66a6f3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 344/554] docs(web-app-peertube): drop our root password note now that the README documents upstream's bounded password --- roles/web-app-peertube/Setup.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/roles/web-app-peertube/Setup.md b/roles/web-app-peertube/Setup.md index 7131e5a489..1d79b1ccfe 100644 --- a/roles/web-app-peertube/Setup.md +++ b/roles/web-app-peertube/Setup.md @@ -2,9 +2,6 @@ ## Change Root Administrator Password -A fresh instance creates the local `root` account with the platform administrator's password. -To change it later: - ```bash docker exec -it -u peertube peertube npm run reset-password -- -u root ``` From 54e10269029fe9dd8abbf42c5d34a449893f92e9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 345/554] fix(web-app-openpost): administer through platform_administrator instead of the host administrator --- roles/web-app-openpost/meta/users.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/meta/users.yml b/roles/web-app-openpost/meta/users.yml index 0c2109f734..70b01e89e2 100644 --- a/roles/web-app-openpost/meta/users.yml +++ b/roles/web-app-openpost/meta/users.yml @@ -1,8 +1,8 @@ --- -administrator: {} +platform_administrator: {} web-app-openpost-breakglass: username: openpost-breakglass password: algorithm: alphanumeric accounts: [] - description: OpenPost local break-glass instance admin; not provisioned to IAM, its mail goes to a plus-address of the administrator mailbox + description: OpenPost local break-glass instance admin; not provisioned to IAM, its mail goes to a plus-address of the platform administrator mailbox From 437c3df60b2443ee924a7374a56be889080f52fa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 346/554] fix(web-app-openpost): read platform_administrator, url.origin, the mode booleans, Pixelfed's app root and PeerTube's bounded root password --- roles/web-app-openpost/vars/main.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 29dfe77e26..8313445b57 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -4,8 +4,8 @@ container_port: "{{ lookup('config', application_id, 'services.openpost.ports.in OPENPOST_NAME: "{{ lookup('config', application_id, 'services.openpost.name') }}" OPENPOST_RELAY_NAME: "{{ lookup('config', application_id, 'services.relay.name') }}" -OPENPOST_URL: "{{ lookup('tls', application_id, 'url.base') | regex_replace('/+$', '') }}" -OPENPOST_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if DEPLOYMENT_MODE == 'compose' else '127.0.0.1' }}:{{ lookup('config', application_id, 'services.openpost.ports.local.http') }}" +OPENPOST_URL: "{{ lookup('tls', application_id, 'url.origin') }}" +OPENPOST_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ lookup('config', application_id, 'services.openpost.ports.local.http') }}" OPENPOST_API_HEADERS: Host: "{{ lookup('domain', application_id) }}" X-Forwarded-Proto: "{{ OPENPOST_URL | urlsplit('scheme') }}" @@ -32,11 +32,11 @@ OPENPOST_TRUSTED_PROXY_CIDRS: >- OPENPOST_ADMIN_USERNAME: "{{ lookup('users', 'web-app-openpost-breakglass').username }}" OPENPOST_ADMIN_PASSWORD: "{{ lookup('users', 'web-app-openpost-breakglass').password }}" -OPENPOST_ADMIN_EMAIL: "{{ lookup('users', 'administrator').email | regex_replace('@', '+' ~ OPENPOST_ADMIN_USERNAME ~ '@') }}" +OPENPOST_ADMIN_EMAIL: "{{ lookup('users', 'platform_administrator').email | regex_replace('@', '+' ~ OPENPOST_ADMIN_USERNAME ~ '@') }}" OPENPOST_ORGANISATION_WORKSPACE: "{{ SOFTWARE_NAME }}" OPENPOST_BOOTSTRAP_ADMINS: - - "{{ lookup('users', 'administrator').email }}" + - "{{ lookup('users', 'platform_administrator').email }}" OPENPOST_RELAY_SIBLINGS: mastodon: web-app-mastodon @@ -57,7 +57,7 @@ OPENPOST_PINNED_INSTANCES: >- {%- set _instances = [] -%} {%- for _key in ['mastodon', 'pixelfed'] -%} {%- if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} - {%- set _url = lookup('tls', OPENPOST_RELAY_SIBLINGS[_key], 'url.base') | regex_replace('/+$', '') -%} + {%- set _url = lookup('tls', OPENPOST_RELAY_SIBLINGS[_key], 'url.origin') -%} {%- if _url is not search('\\.onion$') -%} {%- set _ = _instances.append({'platform': _key, 'url': _url, 'name': _url ~ '/'}) -%} {%- endif -%} @@ -86,8 +86,8 @@ OPENPOST_PROVIDER_BUILD_CONTEXT: "{{ [lookup('container', application_id, 'direc OPENPOST_PROVIDER_IMAGE: "openpost_provider_custom" OPENPOST_PROVIDER_BASE_IMAGE: "{{ OPENPOST_PROVIDER.image }}" OPENPOST_PROVIDER_BASE_VERSION: "{{ OPENPOST_PROVIDER.version }}" -OPENPOST_PROVIDER_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if DEPLOYMENT_MODE == 'compose' else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" -OPENPOST_PROVIDER_BROWSER_URL: "http://{{ 'host.docker.internal' if DEPLOYMENT_MODE == 'compose' else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" +OPENPOST_PROVIDER_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" +OPENPOST_PROVIDER_BROWSER_URL: "http://{{ 'host.docker.internal' if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" OPENPOST_LINKEDIN_CALLBACK: "{{ OPENPOST_URL }}/api/v1/accounts/linkedin/callback" OPENPOST_SIMULATOR_KEYSTORE_PASSWORD: "simulator" @@ -140,4 +140,6 @@ OPENPOST_CROSSPOSTER_SEED_PROBES: pixelfed: /api/v1/accounts/verify_credentials peertube: /api/v1/users/me OPENPOST_PIXELFED_PHP_USER: "33" +OPENPOST_PIXELFED_APP_DIR: "{{ lookup('volume', 'web-app-pixelfed', 'data').target | dirname }}" OPENPOST_SEED_PEERTUBE_USERNAME: "root" +OPENPOST_SEED_PEERTUBE_PASSWORD: "{{ (lookup('users', 'platform_administrator').password | string)[:50] }}" From c032421910952813c36e2fd84f8ecbbffd86e438 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 347/554] fix(web-app-openpost): consume web-svc-seaweedfs and web-svc-design, declare docs and the backup stop decision, and move the local ports off weblate and translate --- roles/web-app-openpost/meta/services.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index 17bd68cc17..44036863d9 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -20,10 +20,10 @@ email: bond: 1 enabled: "{{ MAIL_PROVIDER in group_names }}" shared: "{{ MAIL_PROVIDER in group_names }}" -css: +design: bond: 1 - enabled: "{{ 'web-svc-css' in group_names }}" - shared: "{{ 'web-svc-css' in group_names }}" + enabled: "{{ 'web-svc-design' in group_names }}" + shared: "{{ 'web-svc-design' in group_names }}" prometheus: bond: 1 enabled: "{{ 'web-app-prometheus' in group_names }}" @@ -35,8 +35,8 @@ postgres: shared: "{{ 'svc-db-postgres' in group_names }}" seaweedfs: bond: 1 - enabled: "{{ 'web-app-seaweedfs' in group_names }}" - shared: "{{ 'web-app-seaweedfs' in group_names }}" + enabled: "{{ 'web-svc-seaweedfs' in group_names }}" + shared: "{{ 'web-svc-seaweedfs' in group_names }}" public: true mastodon: bond: 1 @@ -77,16 +77,16 @@ openpost: pids_limit: 512 min_storage: 600MB backup: - no_stop_required: true + stop_required: false ports: internal: http: 8080 local: - http: 8100 + http: 8106 run_after: - svc-db-postgres - web-app-keycloak - - web-app-seaweedfs + - web-svc-seaweedfs - web-app-stalwart - web-app-mailu - web-app-mastodon @@ -173,7 +173,7 @@ provider: http: 8080 https: 443 local: - http: 8101 + http: 8107 hosts: - www.linkedin.com - api.linkedin.com @@ -215,3 +215,8 @@ container_backup: # nocheck: bond-baseline backup host joins outside the variant bond: 1 enabled: "{{ 'svc-bkp-volume-2-local' in group_names }}" shared: true + +docs: + bond: 0.5 + enabled: "{{ 'web-app-docs' in group_names }}" + shared: "{{ 'web-app-docs' in group_names }}" From 752f96d6a853410ee42a8c768038f601c76dceab Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 348/554] fix(web-app-openpost): pin platform_administrator, url.origin, design and docs in the variants and give the clearnet SSO round its reason --- roles/web-app-openpost/meta/variants.yml | 33 +++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/roles/web-app-openpost/meta/variants.yml b/roles/web-app-openpost/meta/variants.yml index 10db219664..dc758cf314 100644 --- a/roles/web-app-openpost/meta/variants.yml +++ b/roles/web-app-openpost/meta/variants.yml @@ -12,13 +12,13 @@ cap_seconds: 30 notify: recipients: - - "{{ lookup('users', 'administrator').email }}" + - "{{ lookup('users', 'platform_administrator').email }}" routes: - name: ci-review source: platform: mastodon - base_url: "{{ lookup('tls', 'web-app-mastodon', 'url.base') | regex_replace('/+$', '') }}" - account: "{{ lookup('users', 'administrator').username }}" + base_url: "{{ lookup('tls', 'web-app-mastodon', 'url.origin') }}" + account: "{{ lookup('users', 'platform_administrator').username }}" token: "" filters: visibility: [public] @@ -35,8 +35,8 @@ - name: ci-auto source: platform: mastodon - base_url: "{{ lookup('tls', 'web-app-mastodon', 'url.base') | regex_replace('/+$', '') }}" - account: "{{ lookup('users', 'administrator').username }}" + base_url: "{{ lookup('tls', 'web-app-mastodon', 'url.origin') }}" + account: "{{ lookup('users', 'platform_administrator').username }}" token: "" filters: visibility: [public] @@ -50,12 +50,15 @@ attribution: default: "{text}\n\n{source_url}" x: "{text}" - css: + design: enabled: true shared: true dashboard: enabled: true shared: true + docs: + enabled: false + shared: false email: enabled: true shared: true @@ -87,7 +90,7 @@ sso: enabled: true shared: true - tor: + tor: # nocheck: variant-tor-off, variant-tor-collateral the SSO round runs clearnet only: OpenPost reaches an onion Keycloak only through Tor's SOCKS port, which svc-net-tor opens to the internal ranges and not to the role subnet 192.88.99.0/24, so its partners ride along on clearnet and are proven over the onion in their own variants enabled: false - services: @@ -104,8 +107,8 @@ - name: ci-pixelfed source: platform: pixelfed - base_url: "{{ lookup('tls', 'web-app-pixelfed', 'url.base') | regex_replace('/+$', '') }}" - account: "{{ lookup('users', 'administrator').username }}" + base_url: "{{ lookup('tls', 'web-app-pixelfed', 'url.origin') }}" + account: "{{ lookup('users', 'platform_administrator').username }}" token: "" filters: visibility: [public] @@ -122,7 +125,7 @@ - name: ci-peertube source: platform: peertube - base_url: "{{ lookup('tls', 'web-app-peertube', 'url.base') | regex_replace('/+$', '') }}" + base_url: "{{ lookup('tls', 'web-app-peertube', 'url.origin') }}" account: root_channel token: "" filters: @@ -137,12 +140,15 @@ attribution: default: "{text}\n\n{source_url}" x: "{text}" - css: + design: enabled: false shared: false dashboard: enabled: false shared: false + docs: + enabled: false + shared: false email: enabled: false shared: false @@ -181,12 +187,15 @@ container_backup: enabled: false shared: false # nocheck: variants-static-override backup shared stays literally true - css: + design: enabled: false shared: false dashboard: enabled: false shared: false + docs: + enabled: true + shared: true email: enabled: false shared: false From f970125914591a686ca6af10e6cc2baf93fceedf Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 349/554] fix(web-app-openpost): allow the web-svc-seaweedfs S3 endpoint in connect-src --- roles/web-app-openpost/meta/csp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/csp.yml b/roles/web-app-openpost/meta/csp.yml index 95b30b8d3f..030fc85c49 100644 --- a/roles/web-app-openpost/meta/csp.yml +++ b/roles/web-app-openpost/meta/csp.yml @@ -4,6 +4,6 @@ flags: unsafe-inline: true # nocheck: csp-unsafe Reason: OpenPost's SvelteKit shell boots through inline scripts whose hashes change with every upstream release, and the unmodified image cannot carry a nonce whitelist: connect-src: - - "{{ lookup('tls', 'web-app-seaweedfs', 'protocols.web') }}://{{ lookup('config', 'web-app-seaweedfs', 'domains.canonical.api') }}" + - "{{ lookup('tls', 'web-svc-seaweedfs', 'protocols.web') }}://{{ lookup('config', 'web-svc-seaweedfs', 'domains.canonical.api') }}" font-src: - "data:" From f54670196d74862a29b3dec47888eec108974747 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 350/554] feat(web-app-openpost): declare OpenPost's AGPL-3.0-only licence --- roles/web-app-openpost/meta/license.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 roles/web-app-openpost/meta/license.yml diff --git a/roles/web-app-openpost/meta/license.yml b/roles/web-app-openpost/meta/license.yml new file mode 100644 index 0000000000..ea019b393f --- /dev/null +++ b/roles/web-app-openpost/meta/license.yml @@ -0,0 +1,3 @@ +--- +spdx: AGPL-3.0-only +url: https://github.com/getopenpost/openpost/blob/main/LICENSE From 3ad970738ec597fbc484cfc170c08e683c983372 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 351/554] refactor(web-app-openpost): provision and apply the crossposter under one condition and read the swarm mode boolean --- roles/web-app-openpost/tasks/00_core.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index 0145f2e335..e2c79d0139 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -4,7 +4,7 @@ - name: "🧭 Remember the public view of this deploy for the CLI probe" ansible.builtin.set_fact: openpost_public_view: - proxy_address: "{{ hostvars[STACK_HOST].ansible_facts.default_ipv4.address if DEPLOYMENT_MODE == 'swarm' else '' }}" + proxy_address: "{{ hostvars[STACK_HOST].ansible_facts.default_ipv4.address if IS_SWARM_MODE else '' }}" public_url: "{{ OPENPOST_URL }}" api_headers: "{{ OPENPOST_API_HEADERS }}" s3_public_url: "{{ lookup('objstore', application_id, 'public_url') | regex_replace('/?$', '/') if OPENPOST_OBJSTORE_ENABLED | bool else '' }}" @@ -66,12 +66,12 @@ include_tasks: 03_breakglass.yml when: IS_STACK_HOST | bool -- name: "🔑 Provision the crossposter API token" - include_tasks: crossposter/provision.yml - when: - - OPENPOST_CROSSPOSTER_ENABLED | bool - - IS_STACK_HOST | bool - -- name: "✅ Apply and validate the crossposter" - include_tasks: crossposter/apply.yml +- name: "📮 Provision, apply and validate the crossposter" when: OPENPOST_CROSSPOSTER_ENABLED | bool + block: + - name: "🔑 Provision the crossposter API token" + include_tasks: crossposter/provision.yml + when: IS_STACK_HOST | bool + + - name: "✅ Apply and validate the crossposter" + include_tasks: crossposter/apply.yml From 2f09d341d3b45a03ec8246f4ce3818050f278a7e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 352/554] refactor(web-app-openpost): persist the registered Fediverse apps in one conditional block --- .../tasks/01_fediverse_apps.yml | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/roles/web-app-openpost/tasks/01_fediverse_apps.yml b/roles/web-app-openpost/tasks/01_fediverse_apps.yml index f505a53f51..c2c9b96a24 100644 --- a/roles/web-app-openpost/tasks/01_fediverse_apps.yml +++ b/roles/web-app-openpost/tasks/01_fediverse_apps.yml @@ -59,21 +59,20 @@ when: OPENPOST_PINNED_PIXELFED | length > 0 run_once: true -- name: "📁 Ensure the directory for the registered apps exists" - ansible.builtin.file: - path: "{{ OPENPOST_FEDIVERSE_APPS_HOST | dirname }}" - state: directory - mode: "0755" +- name: "💾 Persist the apps registered in this run" + when: openpost_fediverse_registrations.results | length > 0 delegate_to: "{{ STACK_HOST }}" run_once: true - when: openpost_fediverse_registrations.results | length > 0 + block: + - name: "📁 Ensure the directory for the registered apps exists" + ansible.builtin.file: + path: "{{ OPENPOST_FEDIVERSE_APPS_HOST | dirname }}" + state: directory + mode: "0755" -- name: "💾 Persist the registered apps" - ansible.builtin.copy: - dest: "{{ OPENPOST_FEDIVERSE_APPS_HOST }}" - content: "{{ openpost_fediverse_apps | to_nice_json }}" - mode: "0600" - delegate_to: "{{ STACK_HOST }}" - run_once: true - when: openpost_fediverse_registrations.results | length > 0 - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + - name: "💾 Persist the registered apps" + ansible.builtin.copy: + dest: "{{ OPENPOST_FEDIVERSE_APPS_HOST }}" + content: "{{ openpost_fediverse_apps | to_nice_json }}" + mode: "0600" + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From 055a5bf51bdaae4331f5ceeb36b0a8861293bacf Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 353/554] refactor(web-app-openpost): move the break-glass registration and recovery into their own task file --- .../tasks/breakglass/recover.yml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 roles/web-app-openpost/tasks/breakglass/recover.yml diff --git a/roles/web-app-openpost/tasks/breakglass/recover.yml b/roles/web-app-openpost/tasks/breakglass/recover.yml new file mode 100644 index 0000000000..c4a2bc1992 --- /dev/null +++ b/roles/web-app-openpost/tasks/breakglass/recover.yml @@ -0,0 +1,53 @@ +--- +- name: "👤 Register the break-glass account as the first instance admin" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/auth/register" + method: POST + headers: "{{ OPENPOST_API_HEADERS }}" + body_format: json + body: + email: "{{ OPENPOST_ADMIN_EMAIL }}" + password: "{{ OPENPOST_ADMIN_PASSWORD }}" + username: "{{ OPENPOST_ADMIN_USERNAME }}" + status_code: [200, 403, 409] + register: openpost_breakglass_register + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + changed_when: openpost_breakglass_register.status == 200 + +- name: "🔐 Recover the existing break-glass account" + when: openpost_breakglass_register.status != 200 + block: + - name: "🔐 Realign the password of the existing break-glass account with the inventory" + database_query: + config: "{{ lookup('database', application_id) }}" + query_file: "{{ role_path }}/files/sql/breakglass/password.sql" + named_args: + email: "{{ OPENPOST_ADMIN_EMAIL }}" + password_hash: "{{ OPENPOST_ADMIN_PASSWORD | bcrypt_hash(application_id ~ ':breakglass') }}" + mask_values: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + register: openpost_breakglass_realign + changed_when: openpost_breakglass_realign.stdout is search('UPDATE [1-9]') + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + + - name: "🔑 Sign in as the break-glass instance admin with the realigned password" + uri_retry: + url: "{{ OPENPOST_LOCAL_URL }}/api/v1/auth/login" + method: POST + headers: "{{ OPENPOST_API_HEADERS }}" + body_format: json + body: + email: "{{ OPENPOST_ADMIN_EMAIL }}" + password: "{{ OPENPOST_ADMIN_PASSWORD }}" + status_code: [200, 401] + register: openpost_breakglass_relogin + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + changed_when: false + + - name: "❌ Fail when the break-glass account can neither sign in nor be created" + ansible.builtin.fail: + msg: >- + OpenPost refused the break-glass sign-in, its registration (HTTP + {{ openpost_breakglass_register.status }}) and the sign-in after the password + realignment. Another account already became the first instance admin; follow + the break-glass procedure in Administration.md. + when: openpost_breakglass_relogin.status != 200 From 1ee50707568901118735eb27450a79a9c679524e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 354/554] refactor(web-app-openpost): include the break-glass recovery only when the sign-in is refused --- .../web-app-openpost/tasks/03_breakglass.yml | 58 +------------------ 1 file changed, 2 insertions(+), 56 deletions(-) diff --git a/roles/web-app-openpost/tasks/03_breakglass.yml b/roles/web-app-openpost/tasks/03_breakglass.yml index 2108d3e5f6..d24ec03449 100644 --- a/roles/web-app-openpost/tasks/03_breakglass.yml +++ b/roles/web-app-openpost/tasks/03_breakglass.yml @@ -23,64 +23,10 @@ no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" changed_when: false -- name: "👤 Register the break-glass account as the first instance admin" - uri_retry: - url: "{{ OPENPOST_LOCAL_URL }}/api/v1/auth/register" - method: POST - headers: "{{ OPENPOST_API_HEADERS }}" - body_format: json - body: - email: "{{ OPENPOST_ADMIN_EMAIL }}" - password: "{{ OPENPOST_ADMIN_PASSWORD }}" - username: "{{ OPENPOST_ADMIN_USERNAME }}" - status_code: [200, 403, 409] - register: openpost_breakglass_register - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - changed_when: openpost_breakglass_register.status == 200 +- name: "🛟 Create or recover the break-glass account that cannot sign in" + include_tasks: breakglass/recover.yml when: openpost_breakglass_login.status == 401 -- name: "🔐 Realign the password of the existing break-glass account with the inventory" - database_query: - config: "{{ lookup('database', application_id) }}" - query_file: "{{ role_path }}/files/sql/breakglass/password.sql" - named_args: - email: "{{ OPENPOST_ADMIN_EMAIL }}" - password_hash: "{{ OPENPOST_ADMIN_PASSWORD | bcrypt_hash(application_id ~ ':breakglass') }}" - mask_values: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - register: openpost_breakglass_realign - changed_when: openpost_breakglass_realign.stdout is search('UPDATE [1-9]') - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - when: - - openpost_breakglass_login.status == 401 - - openpost_breakglass_register.status != 200 - -- name: "🔑 Sign in as the break-glass instance admin with the realigned password" - uri_retry: - url: "{{ OPENPOST_LOCAL_URL }}/api/v1/auth/login" - method: POST - headers: "{{ OPENPOST_API_HEADERS }}" - body_format: json - body: - email: "{{ OPENPOST_ADMIN_EMAIL }}" - password: "{{ OPENPOST_ADMIN_PASSWORD }}" - status_code: [200, 401] - register: openpost_breakglass_relogin - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - changed_when: false - when: openpost_breakglass_realign is not skipped - -- name: "❌ Fail when the break-glass account can neither sign in nor be created" - ansible.builtin.fail: - msg: >- - OpenPost refused the break-glass sign-in, its registration (HTTP - {{ openpost_breakglass_register.status }}) and the sign-in after the password - realignment. Another account already became the first instance admin; follow - the break-glass procedure in Administration.md. - when: - - openpost_breakglass_login.status == 401 - - openpost_breakglass_register.status != 200 - - openpost_breakglass_relogin.status != 200 - - name: "🔐 Keep the break-glass session headers for the following API calls" ansible.builtin.set_fact: openpost_breakglass_headers: >- From e4c1dc6349a2bb304b64b8bd80a63bf6e403bfd7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 355/554] fix(web-app-openpost): hand the simulator keystore password to openssl on stdin --- roles/web-app-openpost/tasks/02_simulator.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/02_simulator.yml b/roles/web-app-openpost/tasks/02_simulator.yml index 95e7ff71ee..f804bc85b6 100644 --- a/roles/web-app-openpost/tasks/02_simulator.yml +++ b/roles/web-app-openpost/tasks/02_simulator.yml @@ -95,9 +95,10 @@ - -certfile - "{{ OPENPOST_SIMULATOR_DIR }}/ca.crt" - -passout - - "pass:{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" + - stdin - -out - "{{ OPENPOST_SIMULATOR_DIR }}/keystore.p12" + stdin: "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" creates: "{{ OPENPOST_SIMULATOR_DIR }}/keystore.p12" no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" From ff3b0db47a4653f1d200320b54dae2b7f4416931 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 356/554] chore(web-app-openpost): mark the simulator keystore literal as a deliberate argv exception --- roles/web-app-openpost/templates/compose.yml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/templates/compose.yml.j2 b/roles/web-app-openpost/templates/compose.yml.j2 index 62bddd9ad3..e811e01644 100644 --- a/roles/web-app-openpost/templates/compose.yml.j2 +++ b/roles/web-app-openpost/templates/compose.yml.j2 @@ -56,9 +56,9 @@ - --keystore-type - PKCS12 - --keystore-password - - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" + - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" # nocheck: compose-argv-secret fixed literal of the CI-only WireMock keystore around a throwaway self-signed key; WireMock reads it only as a flag - --key-manager-password - - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" + - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" # nocheck: compose-argv-secret same keystore literal - --disable-banner {{ lookup('container_volumes', service_name) | indent(4) }} {{ lookup('container_networks', aliases=OPENPOST_SIMULATOR_HOSTS) | indent(4) }} From 2cf9de88a78cd9a9f976be94f7b98f92576c2c19 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 357/554] refactor(web-app-openpost): read the swarm mode boolean when connecting the crossposter's Mastodon source --- roles/web-app-openpost/tasks/crossposter/seed/connect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml index 9e21f4fe66..b38f34282e 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml @@ -7,7 +7,7 @@ ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" vars: resolve_service_key: mastodon - resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if IS_SWARM_MODE else '' }}" resolve_output_prefix: OPENPOST_SEED_MASTODON resolve_compose_cid: "{{ lookup('container_address', 'web-app-mastodon', 'mastodon') }}" From 93754c1c2a80a25c728879021d613133116de313 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 358/554] refactor(web-app-openpost): read the swarm mode boolean when minting the Mastodon source tokens --- roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml index 3f9a3c58ea..e886c61282 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml @@ -3,7 +3,7 @@ ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" vars: resolve_service_key: mastodon - resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_service_name: "{{ lookup('container_service', 'web-app-mastodon', 'mastodon') if IS_SWARM_MODE else '' }}" resolve_output_prefix: OPENPOST_SEED_MASTODON resolve_compose_cid: "{{ lookup('container_address', 'web-app-mastodon', 'mastodon') }}" From c3c12e51f101199cfadbc32595dcf99c7963fd03 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 359/554] fix(web-app-openpost): log the crossposter into PeerTube with its bounded root password --- roles/web-app-openpost/tasks/crossposter/seed/peertube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/peertube.yml b/roles/web-app-openpost/tasks/crossposter/seed/peertube.yml index 02945f7ff7..cd8b121d87 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/peertube.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/peertube.yml @@ -20,7 +20,7 @@ client_secret: "{{ item.json.client_secret }}" grant_type: password username: "{{ OPENPOST_SEED_PEERTUBE_USERNAME }}" - password: "{{ lookup('users', 'administrator').password }}" + password: "{{ OPENPOST_SEED_PEERTUBE_PASSWORD }}" status_code: 200 loop: "{{ openpost_crossposter_peertube_clients.results }}" loop_control: From dec20686984cf41ff62838a4e7dc38e4b1613dd0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 360/554] fix(web-app-openpost): mint the Pixelfed source tokens under the upstream image's app root --- .../web-app-openpost/tasks/crossposter/seed/pixelfed.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml index 477553026e..7cc553d8ff 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml @@ -3,7 +3,7 @@ ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" vars: resolve_service_key: pixelfed - resolve_service_name: "{{ lookup('container_service', 'web-app-pixelfed', 'pixelfed') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_service_name: "{{ lookup('container_service', 'web-app-pixelfed', 'pixelfed') if IS_SWARM_MODE else '' }}" resolve_output_prefix: OPENPOST_SEED_PIXELFED resolve_compose_cid: "{{ lookup('config', 'web-app-pixelfed', 'services.pixelfed.name') }}" @@ -16,12 +16,14 @@ - "{{ OPENPOST_PIXELFED_PHP_USER }}" - -e - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" + - -e + - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_PIXELFED_LOCAL_CID resolved at delegate_to runtime - php - -r - >- - require '/var/www/vendor/autoload.php'; - $app = require '/var/www/bootstrap/app.php'; + require getenv('PIXELFED_APP_DIR') . '/vendor/autoload.php'; + $app = require getenv('PIXELFED_APP_DIR') . '/bootstrap/app.php'; $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); $user = App\Models\User::where('username', getenv('CROSSPOSTER_ACCOUNT'))->firstOrFail(); $mint = fn () => $user->createToken('crossposter-ci', ['read', 'write'])->accessToken; From fca89f9f7202c45697999ffe3b8e0905fdf19202 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 361/554] fix(web-app-openpost): make platform_administrator the Pixelfed app owner under the upstream image's app root --- .../tasks/fediverse/pixelfed_owner.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml index f74b3f71f0..9bb7c10f79 100644 --- a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml +++ b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml @@ -3,7 +3,7 @@ ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" vars: resolve_service_key: pixelfed - resolve_service_name: "{{ lookup('container_service', 'web-app-pixelfed', 'pixelfed') if DEPLOYMENT_MODE == 'swarm' else '' }}" + resolve_service_name: "{{ lookup('container_service', 'web-app-pixelfed', 'pixelfed') if IS_SWARM_MODE else '' }}" resolve_output_prefix: OPENPOST_PIXELFED resolve_compose_cid: "{{ lookup('config', 'web-app-pixelfed', 'services.pixelfed.name') }}" @@ -17,13 +17,15 @@ - -e - "OPENPOST_CLIENT_ID={{ openpost_fediverse_apps[item.url].client_id }}" - -e - - "OPENPOST_CLIENT_OWNER={{ lookup('users', 'administrator').username }}" + - "OPENPOST_CLIENT_OWNER={{ lookup('users', 'platform_administrator').username }}" + - -e + - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - "{{ OPENPOST_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_PIXELFED_LOCAL_CID resolved at delegate_to runtime - php - -r - >- - require '/var/www/vendor/autoload.php'; - $app = require '/var/www/bootstrap/app.php'; + require getenv('PIXELFED_APP_DIR') . '/vendor/autoload.php'; + $app = require getenv('PIXELFED_APP_DIR') . '/bootstrap/app.php'; $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); $owner = App\Models\User::where('username', getenv('OPENPOST_CLIENT_OWNER'))->firstOrFail(); $client = Laravel\Passport\Client::whereKey(getenv('OPENPOST_CLIENT_ID'))->firstOrFail(); From b27fa776d8bca0f6b4d3e473ee0a50f92a6727a7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:52 +0100 Subject: [PATCH 362/554] build(web-app-openpost): pin the crossposter's Python dependencies in a requirements file --- roles/web-app-openpost/files/crossposter/requirements.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 roles/web-app-openpost/files/crossposter/requirements.txt diff --git a/roles/web-app-openpost/files/crossposter/requirements.txt b/roles/web-app-openpost/files/crossposter/requirements.txt new file mode 100644 index 0000000000..5a51fa6c8b --- /dev/null +++ b/roles/web-app-openpost/files/crossposter/requirements.txt @@ -0,0 +1,2 @@ +psycopg[binary]==3.2.10 +pillow==11.3.0 From 7cefe57ce7ee8275862dbe7c30e8fb9cc173e9df Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 363/554] build(web-app-openpost): install the crossposter dependencies from its requirements file --- roles/web-app-openpost/files/crossposter/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/crossposter/Dockerfile b/roles/web-app-openpost/files/crossposter/Dockerfile index 61b7f215c6..ab96a6bf56 100644 --- a/roles/web-app-openpost/files/crossposter/Dockerfile +++ b/roles/web-app-openpost/files/crossposter/Dockerfile @@ -11,7 +11,8 @@ RUN groupadd --system --gid "${CROSSPOSTER_UID}" crossposter \ WORKDIR /app -RUN pip install --no-cache-dir "psycopg[binary]==3.2.10" "pillow==11.3.0" +COPY requirements.txt ./requirements.txt +RUN pip install --no-cache-dir -r requirements.txt COPY crossposter ./crossposter From 8836c8b4e573e8b6ff1ed55e46425df85adabdac Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 364/554] test(web-app-openpost): give the CLI test platform_administrator, PeerTube's bounded root password and the entity_name filter --- roles/web-app-openpost/templates/test.env.j2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index 7b4a18c3c0..3744b5616c 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -27,10 +27,10 @@ OPENPOST_DB_CONTAINER={{ lookup('database', application_id, 'address') }} OPENPOST_DB_NAME={{ lookup('database', application_id, 'name') }} OPENPOST_DB_USER={{ lookup('database', application_id, 'username') }} OPENPOST_DB_PASSWORD_B64={{ lookup('database', application_id, 'password') | b64encode }} -OPENPOST_PEERTUBE_USERNAME=root -OPENPOST_PEERTUBE_PASSWORD_B64={{ lookup('users', 'administrator').password | b64encode }} -OPENPOST_MEMBER_EMAIL={{ lookup('users', 'administrator').email | regex_replace('@', '+openpost-cli-member@') }} -OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'administrator').password ~ ':' ~ application_id ~ ':cli-member') | hash('sha256') | b64encode }} +OPENPOST_PEERTUBE_USERNAME={{ OPENPOST_SEED_PEERTUBE_USERNAME }} +OPENPOST_PEERTUBE_PASSWORD_B64={{ OPENPOST_SEED_PEERTUBE_PASSWORD | b64encode }} +OPENPOST_MEMBER_EMAIL={{ lookup('users', 'platform_administrator').email | regex_replace('@', '+openpost-cli-member@') }} +OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'platform_administrator').password ~ ':' ~ application_id ~ ':cli-member') | hash('sha256') | b64encode }} OPENPOST_SSO_ADMIN_EMAIL={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_OIDC_ENABLED | bool else '' }} OPENPOST_MAIL_RECIPIENT={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_EMAIL_ENABLED | bool else '' }} OPENPOST_SMTP_ENABLED={{ _view.smtp_enabled | bool | string | lower }} @@ -39,7 +39,7 @@ OPENPOST_CROSSPOSTER_POLL_SECONDS={{ OPENPOST_CROSSPOSTER.poll_interval_seconds OPENPOST_CROSSPOSTER_RETRY_SECONDS={{ (OPENPOST_CROSSPOSTER.retry.max_attempts | int) * (OPENPOST_CROSSPOSTER.retry.cap_seconds | int) }} {% if OPENPOST_CROSSPOSTER_ENABLED | bool %} OPENPOST_CROSSPOSTER_SECRETS_FILE={{ OPENPOST_CROSSPOSTER_SECRETS_HOST }} -OPENPOST_CROSSPOSTER_CONTAINER={{ ('"$(' ~ BIN_RESOLVE_CONTAINER_ID ~ ' ' ~ (application_id | get_entity_name) ~ ' crossposter)"') if DEPLOYMENT_MODE == 'swarm' else OPENPOST_CROSSPOSTER_ADDRESS }} +OPENPOST_CROSSPOSTER_CONTAINER={{ ('"$(' ~ BIN_RESOLVE_CONTAINER_ID ~ ' ' ~ (application_id | entity_name) ~ ' crossposter)"') if IS_SWARM_MODE else OPENPOST_CROSSPOSTER_ADDRESS }} OPENPOST_CROSSPOSTER_CONFIG={{ OPENPOST_CROSSPOSTER_CONFIG_TARGET }} {% else %} OPENPOST_CROSSPOSTER_SECRETS_FILE= From 1e345bac6b1a3d8b718499e51be3b9d85964cfd3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 365/554] test(web-app-openpost): hand Playwright platform_administrator, landing_url siblings, the design flag and the S3 listing keys --- .../templates/playwright.env.j2 | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/roles/web-app-openpost/templates/playwright.env.j2 b/roles/web-app-openpost/templates/playwright.env.j2 index 7afd277844..4d20e34ac6 100644 --- a/roles/web-app-openpost/templates/playwright.env.j2 +++ b/roles/web-app-openpost/templates/playwright.env.j2 @@ -1,8 +1,8 @@ -ADMIN_EMAIL={{ lookup('users', 'administrator').email | dotenv_quote }} +ADMIN_EMAIL={{ lookup('users', 'platform_administrator').email | dotenv_quote }} -ADMIN_PASSWORD={{ lookup('users', 'administrator').password | dotenv_quote }} +ADMIN_PASSWORD={{ lookup('users', 'platform_administrator').password | dotenv_quote }} -ADMIN_USERNAME={{ lookup('users', 'administrator').username | dotenv_quote }} +ADMIN_USERNAME={{ lookup('users', 'platform_administrator').username | dotenv_quote }} APP_BASE_URL={{ lookup('tls', application_id, 'url.base') | dotenv_quote }} @@ -18,12 +18,12 @@ CANONICAL_DOMAIN={{ lookup('domain', application_id) | dotenv_quote }} CROSSPOSTER_SERVICE_ENABLED={{ OPENPOST_CROSSPOSTER_ENABLED | string | lower }} -# nocheck: playwright-service-gate - CSS injection is asserted by the central CSP helper, not a per-persona surface -CSS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.css.enabled') | string | lower }} - # nocheck: playwright-service-gate - dashboard tiles are owned by the web-app-dashboard spec DASHBOARD_SERVICE_ENABLED={{ lookup('config', application_id, 'services.dashboard.enabled') | string | lower }} +# nocheck: playwright-service-gate - the corporate design sheet is injected by sys-front-inj-design and asserted by the web-svc-design spec, not a per-persona surface +DESIGN_SERVICE_ENABLED={{ lookup('config', application_id, 'services.design.enabled') | string | lower }} + # nocheck: playwright-service-gate - mail delivery is covered by the sys-svc-mail integration tests, not the persona surface EMAIL_SERVICE_ENABLED={{ OPENPOST_EMAIL_ENABLED | string | lower }} @@ -32,11 +32,11 @@ LINKEDIN_FAKE_URL={{ (OPENPOST_PROVIDER_BROWSER_URL if OPENPOST_PROVIDER_ENABLED # nocheck: playwright-service-gate - universal-logout redirect is exercised by the persona logout step; covered by web-svc-logout integration tests LOGOUT_SERVICE_ENABLED={{ lookup('config', application_id, 'services.logout.enabled') | string | lower }} -MASTODON_BASE_URL={{ lookup('tls', 'web-app-mastodon', 'url.base') | dotenv_quote }} +MASTODON_BASE_URL={{ lookup('landing_url', 'web-app-mastodon') | dotenv_quote }} MASTODON_SERVICE_ENABLED={{ lookup('config', application_id, 'services.mastodon.enabled') | string | lower }} -MATOMO_BASE_URL={{ lookup('tls', 'web-app-matomo', 'url.base') | dotenv_quote }} +MATOMO_BASE_URL={{ lookup('landing_url', 'web-app-matomo') | dotenv_quote }} # nocheck: playwright-service-gate - Matomo tracking is an injected snippet, covered by the web-app-matomo spec MATOMO_SERVICE_ENABLED={{ lookup('config', application_id, 'services.matomo.enabled') | string | lower }} @@ -45,7 +45,7 @@ OIDC_ISSUER_URL={{ OIDC.CLIENT.ISSUER_URL | dotenv_quote }} ORGANISATION_WORKSPACE={{ OPENPOST_ORGANISATION_WORKSPACE | dotenv_quote }} -PIXELFED_BASE_URL={{ lookup('tls', 'web-app-pixelfed', 'url.base') | dotenv_quote }} +PIXELFED_BASE_URL={{ lookup('landing_url', 'web-app-pixelfed') | dotenv_quote }} PIXELFED_SERVICE_ENABLED={{ lookup('config', application_id, 'services.pixelfed.enabled') | string | lower }} @@ -54,13 +54,15 @@ PROMETHEUS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.prometh PROVIDER_SERVICE_ENABLED={{ OPENPOST_PROVIDER_ENABLED | string | lower }} -SEAWEEDFS_ADMIN_PASSWORD={{ lookup('users', 'administrator').password | dotenv_quote }} - -SEAWEEDFS_ADMIN_USERNAME={{ lookup('users', 'administrator').username | dotenv_quote }} +SEAWEEDFS_APP_ACCESS_KEY={{ lookup('objstore', application_id, 'access_key') | dotenv_quote }} SEAWEEDFS_APP_BUCKET={{ lookup('objstore', application_id, 'bucket') | dotenv_quote }} -SEAWEEDFS_FILER_URL={{ lookup('canonical_url', 'web-app-seaweedfs', 'filer', consumer=application_id) | dotenv_quote }} +SEAWEEDFS_APP_SECRET_KEY={{ lookup('objstore', application_id, 'secret_key') | dotenv_quote }} + +SEAWEEDFS_REGION={{ lookup('config', 'web-svc-seaweedfs', 'services.seaweedfs.region') }} + +SEAWEEDFS_S3_URL={{ lookup('canonical_url', 'web-svc-seaweedfs', 'api', consumer=application_id) | dotenv_quote }} SEAWEEDFS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.seaweedfs.enabled') | string | lower }} From f90b3ed54a71f632d7397b3508ce9b2ae80907fe Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 366/554] test(web-app-openpost): drop the filer timeout comment from the SeaweedFS spec --- roles/web-app-openpost/files/playwright/test-seaweedfs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-seaweedfs.js b/roles/web-app-openpost/files/playwright/test-seaweedfs.js index 84da33bb0f..74bdd7c0a0 100644 --- a/roles/web-app-openpost/files/playwright/test-seaweedfs.js +++ b/roles/web-app-openpost/files/playwright/test-seaweedfs.js @@ -7,7 +7,7 @@ exports.register = function (shared) { test.skip(isOnionTarget(), "SeaweedFS filer UI is not a Tor surface on an onion node (headless backend)"); shared.skipUnlessServiceEnabled("seaweedfs"); shared.skipUnlessServiceEnabled("sso"); - test.setTimeout(resolveTimeout(300_000)); // Filer UI admin login, OIDC login and the upload round-trip + test.setTimeout(resolveTimeout(300_000)); await runSeaweedfsStorageCheck(page, browser, { label: "an OpenPost media library upload", From 25f9b1555854a4b56bfff6e9a14e3e3fe4c95cf3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 367/554] test(networks): pass entity_name to render_container_networks after upstream's rename --- .../python/utils/networks/test_render_container_networks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/python/utils/networks/test_render_container_networks.py b/tests/unit/python/utils/networks/test_render_container_networks.py index 7bf8237acf..fd79828633 100644 --- a/tests/unit/python/utils/networks/test_render_container_networks.py +++ b/tests/unit/python/utils/networks/test_render_container_networks.py @@ -174,7 +174,7 @@ class TestRenderContainerNetworks(unittest.TestCase): application_id="web-app-plain", deployment_mode="compose", registry={}, - get_entity_name=_entity_name, + entity_name=_entity_name, lookup_config=_const_lookup_config(), lookup_database=_const_lookup_database(), aliases=["microblog.example.com", "video.example.com"], @@ -207,7 +207,7 @@ class TestRenderContainerNetworks(unittest.TestCase): application_id="svc-prx-openresty", deployment_mode="swarm", registry=registry, - get_entity_name=_entity_name, + entity_name=_entity_name, lookup_config=_const_lookup_config(), lookup_database=_const_lookup_database(), aliases=["auth.example.com", "extra.example.com"], From 5525db4cb2d758d9e6dfeace5a884df1faf57cbb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 368/554] docs(web-app-openpost): drop the generated sections the documentation build now renders --- roles/web-app-openpost/README.md | 108 +------------------------------ 1 file changed, 1 insertion(+), 107 deletions(-) diff --git a/roles/web-app-openpost/README.md b/roles/web-app-openpost/README.md index 80e3bf6619..87e56211a5 100644 --- a/roles/web-app-openpost/README.md +++ b/roles/web-app-openpost/README.md @@ -8,71 +8,10 @@ Teams compose posts once, adapt them per network, schedule them and publish them ## Overview This role deploys the unmodified official `ghcr.io/getopenpost/openpost` image as one `all` process behind the shared OpenResty proxy at `publish.`. -It stores data in the central PostgreSQL, keeps media in the `web-app-seaweedfs` object store when one is deployed, signs users in through Keycloak over OIDC and sends mail through the platform mail service. +It stores data in the central PostgreSQL, keeps media in the `web-svc-seaweedfs` object store when one is deployed, signs users in through Keycloak over OIDC and sends mail through the platform mail service. An always-on egress relay lets OpenPost publish to the Mastodon, Pixelfed and PeerTube instances of the same deployment without weakening its SSRF guard. For operation, platform onboarding and the egress design see [Administration.md](./Administration.md). -## Cosmos - -The diagram places OpenPost in the Infinito.Nexus cosmos: the components it deploys (capabilities), the central services it consumes (dependencies), and its outward reach (federation and bridged external networks). - -```mermaid -flowchart LR - subgraph deps [Dependencies] - dep_svc_bkp_volume_2_local["svc-bkp-volume-2-local 💻"] - dep_svc_db_postgres["svc-db-postgres 🐳🐝"] - dep_svc_net_tor["svc-net-tor 🐳🐝"] - dep_web_app_dashboard["web-app-dashboard 🐳🐝"] - dep_web_app_keycloak["web-app-keycloak 🐳🐝"] - dep_web_app_mastodon["web-app-mastodon 🐳🐝"] - dep_web_app_matomo["web-app-matomo 🐳🐝"] - dep_web_app_peertube["web-app-peertube 🐳🐝"] - dep_web_app_pixelfed["web-app-pixelfed 🐳🐝"] - dep_web_app_prometheus["web-app-prometheus 🐳🐝"] - dep_web_app_seaweedfs["web-app-seaweedfs 🐳🐝"] - dep_web_app_stalwart["web-app-stalwart 🐳🐝"] - dep_web_svc_css["web-svc-css 💻"] - dep_web_svc_logout["web-svc-logout 🐳🐝"] - end - subgraph role [web-app-openpost 🐳🐝] - svc_sso["sso"] - svc_logout["logout"] - svc_dashboard["dashboard"] - svc_matomo["matomo"] - svc_email["email"] - svc_css["css"] - svc_prometheus["prometheus"] - svc_postgres["postgres"] - svc_seaweedfs["seaweedfs"] - svc_mastodon["mastodon"] - svc_pixelfed["pixelfed"] - svc_peertube["peertube"] - svc_openpost["openpost"] - svc_relay["relay"] - svc_simulator["simulator ❌"] - svc_provider["provider"] - svc_crossposter["crossposter"] - svc_tor["tor"] - svc_container_backup["container_backup"] - end - dep_svc_bkp_volume_2_local -. "0..1" .-> svc_container_backup - dep_svc_db_postgres -. "0..1" .-> svc_postgres - dep_svc_net_tor -. "0..1" .-> svc_tor - dep_web_app_dashboard -. "0..1" .-> svc_dashboard - dep_web_app_keycloak -. "0..1" .-> svc_sso - dep_web_app_mastodon -. "0..1" .-> svc_mastodon - dep_web_app_matomo -. "0..1" .-> svc_matomo - dep_web_app_peertube -. "0..1" .-> svc_peertube - dep_web_app_pixelfed -. "0..1" .-> svc_pixelfed - dep_web_app_prometheus -. "0..1" .-> svc_prometheus - dep_web_app_seaweedfs -. "0..1" .-> svc_seaweedfs - dep_web_app_stalwart -. "0..1" .-> svc_email - dep_web_svc_css -. "0..1" .-> svc_css - dep_web_svc_logout -. "0..1" .-> svc_logout -``` - -Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional (enabled only in matching deployments); red `0..0` edges are turned off in this role. Node markers show the role's deploy modes (💻 host, 🐳 compose, 🐝 swarm); ❌ marks a service that is explicitly turned off, and ⚙️ an Ansible role dependency declared in `meta/main.yml`. - ## Features - **Official image only:** The role pins an upstream release tag, configures OpenPost purely through environment variables and lets the update tooling propose new release tags. @@ -84,45 +23,6 @@ Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional ( - **Central credentials:** Developer app credentials for X, Meta, Threads, LinkedIn, YouTube and TikTok come from the central `API` mapping, and a network without credentials stays unavailable. - **Automated crossposting:** A crossposter sidecar polls configured Mastodon, Pixelfed and PeerTube accounts and hands every new post to OpenPost, as a draft for review or for immediate publishing, with per-network shortening, attribution, opt-out by hashtag, loop prevention and mailed reports of failed deliveries. -## Quick Setup - -### Development - -Clone, set up the workstation, and deploy OpenPost onto the local stack: - -```bash -git clone https://github.com/infinito-nexus/core.git -cd core -make onboard -make compose-deploy mode=reinstall apps=web-app-openpost full_cycle=false -``` - -### Production - -Run the published image to provision the inventory and deploy OpenPost to a managed server (the mounted volume persists the inventory): - -```bash -APP=web-app-openpost -HOST= -DOMAIN= -TLS_MODE=self_signed -SSH_PUBLIC_KEY="" - -docker run --rm -it \ - -v "$PWD/inventories:/etc/infinito.nexus/inventories" \ - -e APP="$APP" -e HOST="$HOST" -e DOMAIN="$DOMAIN" -e TLS_MODE="$TLS_MODE" -e SSH_PUBLIC_KEY="$SSH_PUBLIC_KEY" \ - ghcr.io/infinito-nexus/core/debian bash -c ' - INVENTORY=/etc/infinito.nexus/inventories/production - infinito administration inventory provision "$INVENTORY" \ - --inventory-file "$INVENTORY/devices.yml" \ - --host "$HOST" \ - --include "$APP" \ - --vars "{\"TLS_MODE\": \"$TLS_MODE\", \"DOMAIN_PRIMARY\": \"$DOMAIN\", \"users\": {\"administrator\": {\"authorized_keys\": [\"$SSH_PUBLIC_KEY\"]}}}" && - infinito administration deploy dedicated "$INVENTORY/devices.yml" \ - --password-file "$INVENTORY/.password" \ - --diff -vv' -``` - ## Developer Notes See [Administration.md](./Administration.md) for the egress relay, the break-glass procedure, per-network onboarding and the staging checklist. @@ -131,9 +31,3 @@ See [Administration.md](./Administration.md) for the egress relay, the break-gla - [OpenPost on GitHub](https://github.com/getopenpost/openpost) - [OpenPost provider reference](https://github.com/getopenpost/openpost/blob/0deadaf7bbf3b3be045e783c3eeef323c9e3c440/docs/reference/providers/index.md) - -## Credits - -Implemented by **[Evangelos Tsakoudis](https://github.com/evangelostsak)**. -Part of the [Infinito.Nexus Project](https://s.infinito.nexus/code) and maintained by [Kevin Veen-Birkenbach](https://www.veen.world). -Licensed under the [Infinito.Nexus Community License (Non-Commercial)](https://s.infinito.nexus/license). From c7613a0d75410829489267e025e43eb1ce163586 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 369/554] docs(web-app-openpost): name platform_administrator, web-svc-seaweedfs and PeerTube's bounded root password --- roles/web-app-openpost/Administration.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 4da4edb486..f6c9085ac1 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -16,7 +16,7 @@ The role configures OpenPost's instance-wide OIDC provider against the shared Ke - Users sign in with the Keycloak button on the login page. OpenPost provisions them just in time on their first verified login (`OPENPOST_OIDC_JIT_ENABLED=true`) and matches later logins by issuer and subject. -- The platform `administrator` is listed in `OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST` and becomes instance admin on its first SSO login. +- The `platform_administrator` is listed in `OPENPOST_OIDC_BOOTSTRAP_ALLOWLIST` and becomes instance admin on its first SSO login. - A just-in-time user starts without access to existing workspaces. Grant access by inviting the user from the workspace's team settings; OpenPost does not consume Keycloak groups. - Password self-registration is closed. @@ -223,12 +223,12 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo | OpenPost cannot connect a Mastodon or Pixelfed instance served only on a `.onion` name: its Go resolver refuses to look up `.onion` names (RFC 7686), and its own app registration accepts only `https://` instances. The deploy therefore pins no app for an onion sibling, and the CI connect checks skip it. | Connect the instance through a clearnet name. The crossposter still reads onion sources, because Python resolves them through the relay. | | On a compose deployment served on `.onion`, single sign-on fails: OpenPost reaches the onion Keycloak only through Tor's SOCKS port, which `svc-net-tor` opens to the internal ranges, and OpenPost's role subnet `192.88.99.0/24` is not one of them. The CI round with SSO therefore runs clearnet only. | Sign in with a native OpenPost account on onion deployments. | | OpenPost's X budget guardrail (`OPENPOST_X_MONTHLY_BUDGET_MICROUSD`) applies only in its cloud edition. | Cap X spending through the prepaid credits of the X developer account. | -| Instagram accepts JPEG only and fetches media from a public URL. | Deploy `web-app-seaweedfs` so media gets public HTTPS URLs; convert other image formats before upload. | -| Facebook, Instagram, Threads and TikTok fetch media from public HTTPS URLs. | Same as above; without `web-app-seaweedfs` media is served under `/media/` of the public OpenPost domain, which also works when that domain is reachable from the internet. | +| Instagram accepts JPEG only and fetches media from a public URL. | Deploy `web-svc-seaweedfs` so media gets public HTTPS URLs; convert other image formats before upload. | +| Facebook, Instagram, Threads and TikTok fetch media from public HTTPS URLs. | Same as above; without `web-svc-seaweedfs` media is served under `/media/` of the public OpenPost domain, which also works when that domain is reachable from the internet. | | LinkedIn requires vetting of the legal entity and re-authorisation every 60 days. | Plan the vetting before launch and schedule a re-authorisation reminder. | | YouTube projects in testing status lose refresh tokens after 7 days. | Move the Google OAuth client to production status and complete verification. | | Bluesky is also reachable without OpenPost through `web-app-bridgy-fed`. | Use the bridge for automatic federation and OpenPost for deliberate Bluesky-native posts. | -| OpenPost connects PeerTube only through the OAuth password grant, and PeerTube accounts that sign in through Keycloak have no local password. | Connect a local PeerTube account: the `root` account, which a fresh `web-app-peertube` instance creates with the platform administrator's password, or one the PeerTube administrator creates for publishing. PeerTube then asks for the channel each video goes to. | +| OpenPost connects PeerTube only through the OAuth password grant, and PeerTube accounts that sign in through Keycloak have no local password. | Connect a local PeerTube account: the `root` account, which a fresh `web-app-peertube` instance creates with the first 50 characters of the platform administrator's password, or one the PeerTube administrator creates for publishing. PeerTube then asks for the channel each video goes to. | | Sibling Fediverse instances are reachable only over TLS on port 443. | Keep TLS enabled for `web-app-mastodon`, `web-app-pixelfed` and `web-app-peertube`. | ## Data processing and dependencies @@ -243,9 +243,9 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo ## Backup, restore and upgrades -- With `web-app-seaweedfs` deployed, browsers upload media directly to its public S3 vhost through presigned URLs, which is why `OPENPOST_S3_ENDPOINT` is the public endpoint and the CSP allows it in `connect-src`; OpenPost deduplicates identical files by content hash. +- With `web-svc-seaweedfs` deployed, browsers upload media directly to its public S3 vhost through presigned URLs, which is why `OPENPOST_S3_ENDPOINT` is the public endpoint and the CSP allows it in `connect-src`; OpenPost deduplicates identical files by content hash. With `TLS_MODE=self_signed` the role always mounts the root CA into OpenPost and adds it to `SSL_CERT_DIR`, because an onion-primary OpenPost receives no CA injection while that vhost and the local Fediverse siblings behind the relay stay on clearnet HTTPS. -- The platform backup covers the OpenPost database in the shared Postgres and the `openpost_media` volume; media in `web-app-seaweedfs` is covered by that role's backup. +- The platform backup covers the OpenPost database in the shared Postgres and the `openpost_media` volume; media in `web-svc-seaweedfs` is covered by that role's backup. - A restore needs the database, the media and the inventory secrets, especially `encryption_key`; without it the stored provider tokens cannot be decrypted and every network has to be reconnected. The key is pinned `rotatable: false` because OpenPost refuses to start once a stored row no longer decrypts; the other secrets rotate freely. - Changing the pinned version in `meta/services.yml` and redeploying runs OpenPost's own migrations, which take a Postgres advisory lock. Only the latest upstream release receives security fixes, so follow new release tags promptly. From 1b79bfa4758dc5fa6a3212d9b223a46389b38eb0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 370/554] docs(requirements): 062 names web-svc-seaweedfs as the object store --- docs/requirements/062-web-app-openpost.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/requirements/062-web-app-openpost.md b/docs/requirements/062-web-app-openpost.md index ffc4dd2850..c0c83bd249 100644 --- a/docs/requirements/062-web-app-openpost.md +++ b/docs/requirements/062-web-app-openpost.md @@ -88,7 +88,7 @@ Sources: - [`svc-net-wireguard`](../../roles/svc-net-wireguard/) carries swarm overlay traffic inside its `swarm` mesh, so the role's overlay network is tunnelled without extra configuration. - [`web-app-semaphore`](../../roles/web-app-semaphore/) consumes Keycloak through `sso.flavor: oidc`. - [`web-app-mastodon`](../../roles/web-app-mastodon/), [`web-app-pixelfed`](../../roles/web-app-pixelfed/) and [`web-app-peertube`](../../roles/web-app-peertube/) provide the local Fediverse accounts used as publishing targets in tests. -- [`web-app-seaweedfs`](../../roles/web-app-seaweedfs/) provides S3 object storage through the `seaweedfs` service with `public: true`, as in `web-app-mastodon`. +- [`web-svc-seaweedfs`](../../roles/web-svc-seaweedfs/) provides S3 object storage through the `seaweedfs` service with `public: true`, as in `web-app-mastodon`. - [18_api.yml](../../group_vars/all/18_api.yml) is the central SPOT for proprietary API credentials, read through `lookup('api', ...)` and gated by `lookup('api_enabled', ...)`. ## Confirmed Decisions @@ -102,7 +102,7 @@ These decisions were confirmed by the operator before implementation starts and | 3 | The role runs the official `ghcr.io/getopenpost/openpost` image unmodified, pinned to a release tag and configured through environment variables only. | The application is integrated like every other role; the project does not maintain OpenPost. | | 4 | OpenPost reaches the deployment's own sibling vhosts only through an always-on, role-local egress relay on the role network `192.88.99.0/24` (declared in `meta/networks.yml`, listed in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES`), with exact aliases and an SNI allowlist, forwarding to the shared proxy. | One proven path for development, CI and production, including split-horizon DNS and WireGuard meshes, with the guard intact for every other destination; the existing role-subnet exception mechanism already carries out-of-pool blocks, so no new SPOT is needed. | | 5 | Keycloak SSO through native OIDC (`sso.flavor: oidc`); publishing permissions are enforced through OpenPost workspace roles. | OpenPost ships an OIDC adapter and does not consume group claims. | -| 6 | Shared `svc-db-postgres`; media on `web-app-seaweedfs` S3 when deployed, a role volume otherwise. | Postgres is the only multi-process database; S3 gives public media URLs for Meta. | +| 6 | Shared `svc-db-postgres`; media on `web-svc-seaweedfs` S3 when deployed, a role volume otherwise. | Postgres is the only multi-process database; S3 gives public media URLs for Meta. | | 7 | One `all` process with one replica in compose and swarm. | State lives in Postgres and S3, so rescheduling is safe; split `web`/`worker` scaling is out of scope. | | 8 | Provider app credentials live in the central `API` SPOT. | One place for proprietary credentials. | | 9 | Diagnostics, update check, PostHog telemetry, feedback and public profiles are disabled. | No unnecessary transmission of internal data. | @@ -211,7 +211,7 @@ simulator: - [x] `publish.{{ DOMAIN_PRIMARY }}` serves the OpenPost UI through the shared OpenResty proxy with TLS and a `Content-Security-Policy` header, and `/api/v1/ready` returns HTTP 200. - [ ] The role deploys green in compose (`make compose-deploy mode=reinstall apps=web-app-openpost full_cycle=true`) and in swarm, with one `all` replica and no reliance on `container_name`. - [x] OpenPost stores its data in `svc-db-postgres`, and no SQLite database exists in the container. -- [x] With `web-app-seaweedfs` deployed, media lands in S3 and an uploaded file is fetchable anonymously over HTTPS from its public URL; without it, media lands in a role volume served under `/media/`. +- [x] With `web-svc-seaweedfs` deployed, media lands in S3 and an uploaded file is fetchable anonymously over HTTPS from its public URL; without it, media lands in a role volume served under `/media/`. - [x] Media URLs and `/api/v1/accounts//callback` are reachable without a session, while every other UI and API route requires authentication. - [x] The container healthcheck probes `/api/v1/health`, and the deploy waits for `/api/v1/ready`. - [x] Database and media are part of the platform backup, and a restore drill (purge, restore, redeploy) brings back users, connected accounts and publications. From c4bf4ca66502b8ce0d81300a74c035647fd9719c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 10 Nov 2026 00:45:53 +0100 Subject: [PATCH 371/554] chore(i18n): extract OpenPost's role description into the core catalogues --- locale/aa/LC_MESSAGES/core.po | 4 ++++ locale/ab/LC_MESSAGES/core.po | 4 ++++ locale/af/LC_MESSAGES/core.po | 4 ++++ locale/ak/LC_MESSAGES/core.po | 4 ++++ locale/am/LC_MESSAGES/core.po | 4 ++++ locale/an/LC_MESSAGES/core.po | 4 ++++ locale/ar/LC_MESSAGES/core.po | 4 ++++ locale/as/LC_MESSAGES/core.po | 4 ++++ locale/av/LC_MESSAGES/core.po | 4 ++++ locale/ay/LC_MESSAGES/core.po | 4 ++++ locale/az/LC_MESSAGES/core.po | 4 ++++ locale/ba/LC_MESSAGES/core.po | 4 ++++ locale/be/LC_MESSAGES/core.po | 4 ++++ locale/bg/LC_MESSAGES/core.po | 4 ++++ locale/bh/LC_MESSAGES/core.po | 4 ++++ locale/bi/LC_MESSAGES/core.po | 4 ++++ locale/bm/LC_MESSAGES/core.po | 4 ++++ locale/bn/LC_MESSAGES/core.po | 4 ++++ locale/bo/LC_MESSAGES/core.po | 4 ++++ locale/br/LC_MESSAGES/core.po | 4 ++++ locale/bs/LC_MESSAGES/core.po | 4 ++++ locale/ca/LC_MESSAGES/core.po | 4 ++++ locale/ce/LC_MESSAGES/core.po | 4 ++++ locale/ch/LC_MESSAGES/core.po | 4 ++++ locale/co/LC_MESSAGES/core.po | 4 ++++ locale/cr/LC_MESSAGES/core.po | 4 ++++ locale/cs/LC_MESSAGES/core.po | 4 ++++ locale/cu/LC_MESSAGES/core.po | 4 ++++ locale/cv/LC_MESSAGES/core.po | 4 ++++ locale/cy/LC_MESSAGES/core.po | 4 ++++ locale/da/LC_MESSAGES/core.po | 4 ++++ locale/de/LC_MESSAGES/core.po | 4 ++++ locale/dv/LC_MESSAGES/core.po | 4 ++++ locale/dz/LC_MESSAGES/core.po | 4 ++++ locale/ee/LC_MESSAGES/core.po | 4 ++++ locale/el/LC_MESSAGES/core.po | 4 ++++ locale/eo/LC_MESSAGES/core.po | 4 ++++ locale/es/LC_MESSAGES/core.po | 4 ++++ locale/et/LC_MESSAGES/core.po | 4 ++++ locale/eu/LC_MESSAGES/core.po | 4 ++++ locale/fa/LC_MESSAGES/core.po | 4 ++++ locale/ff/LC_MESSAGES/core.po | 4 ++++ locale/fi/LC_MESSAGES/core.po | 4 ++++ locale/fj/LC_MESSAGES/core.po | 4 ++++ locale/fo/LC_MESSAGES/core.po | 4 ++++ locale/fr/LC_MESSAGES/core.po | 4 ++++ locale/fy/LC_MESSAGES/core.po | 4 ++++ locale/ga/LC_MESSAGES/core.po | 4 ++++ locale/gd/LC_MESSAGES/core.po | 4 ++++ locale/gl/LC_MESSAGES/core.po | 4 ++++ locale/gn/LC_MESSAGES/core.po | 4 ++++ locale/gu/LC_MESSAGES/core.po | 4 ++++ locale/gv/LC_MESSAGES/core.po | 4 ++++ locale/ha/LC_MESSAGES/core.po | 4 ++++ locale/he/LC_MESSAGES/core.po | 4 ++++ locale/hi/LC_MESSAGES/core.po | 4 ++++ locale/ho/LC_MESSAGES/core.po | 4 ++++ locale/hr/LC_MESSAGES/core.po | 4 ++++ locale/ht/LC_MESSAGES/core.po | 4 ++++ locale/hu/LC_MESSAGES/core.po | 4 ++++ locale/hy/LC_MESSAGES/core.po | 4 ++++ locale/hz/LC_MESSAGES/core.po | 4 ++++ locale/ia/LC_MESSAGES/core.po | 4 ++++ locale/id/LC_MESSAGES/core.po | 4 ++++ locale/ie/LC_MESSAGES/core.po | 4 ++++ locale/ig/LC_MESSAGES/core.po | 4 ++++ locale/ii/LC_MESSAGES/core.po | 4 ++++ locale/ik/LC_MESSAGES/core.po | 4 ++++ locale/io/LC_MESSAGES/core.po | 4 ++++ locale/is/LC_MESSAGES/core.po | 4 ++++ locale/it/LC_MESSAGES/core.po | 4 ++++ locale/iu/LC_MESSAGES/core.po | 4 ++++ locale/ja/LC_MESSAGES/core.po | 4 ++++ locale/jv/LC_MESSAGES/core.po | 4 ++++ locale/ka/LC_MESSAGES/core.po | 4 ++++ locale/kg/LC_MESSAGES/core.po | 4 ++++ locale/ki/LC_MESSAGES/core.po | 4 ++++ locale/kj/LC_MESSAGES/core.po | 4 ++++ locale/kk/LC_MESSAGES/core.po | 4 ++++ locale/kl/LC_MESSAGES/core.po | 4 ++++ locale/km/LC_MESSAGES/core.po | 4 ++++ locale/kn/LC_MESSAGES/core.po | 4 ++++ locale/ko/LC_MESSAGES/core.po | 4 ++++ locale/kr/LC_MESSAGES/core.po | 4 ++++ locale/ks/LC_MESSAGES/core.po | 4 ++++ locale/ku/LC_MESSAGES/core.po | 4 ++++ locale/kv/LC_MESSAGES/core.po | 4 ++++ locale/kw/LC_MESSAGES/core.po | 4 ++++ locale/ky/LC_MESSAGES/core.po | 4 ++++ locale/la/LC_MESSAGES/core.po | 4 ++++ locale/lb/LC_MESSAGES/core.po | 4 ++++ locale/lg/LC_MESSAGES/core.po | 4 ++++ locale/li/LC_MESSAGES/core.po | 4 ++++ locale/ln/LC_MESSAGES/core.po | 4 ++++ locale/lo/LC_MESSAGES/core.po | 4 ++++ locale/lt/LC_MESSAGES/core.po | 4 ++++ locale/lu/LC_MESSAGES/core.po | 4 ++++ locale/lv/LC_MESSAGES/core.po | 4 ++++ locale/mg/LC_MESSAGES/core.po | 4 ++++ locale/mh/LC_MESSAGES/core.po | 4 ++++ locale/mi/LC_MESSAGES/core.po | 4 ++++ locale/mk/LC_MESSAGES/core.po | 4 ++++ locale/ml/LC_MESSAGES/core.po | 4 ++++ locale/mn/LC_MESSAGES/core.po | 4 ++++ locale/mr/LC_MESSAGES/core.po | 4 ++++ locale/ms/LC_MESSAGES/core.po | 4 ++++ locale/mt/LC_MESSAGES/core.po | 4 ++++ locale/my/LC_MESSAGES/core.po | 4 ++++ locale/na/LC_MESSAGES/core.po | 4 ++++ locale/nb/LC_MESSAGES/core.po | 4 ++++ locale/nd/LC_MESSAGES/core.po | 4 ++++ locale/ne/LC_MESSAGES/core.po | 4 ++++ locale/ng/LC_MESSAGES/core.po | 4 ++++ locale/nl/LC_MESSAGES/core.po | 4 ++++ locale/nn/LC_MESSAGES/core.po | 4 ++++ locale/no/LC_MESSAGES/core.po | 4 ++++ locale/nr/LC_MESSAGES/core.po | 4 ++++ locale/nv/LC_MESSAGES/core.po | 4 ++++ locale/ny/LC_MESSAGES/core.po | 4 ++++ locale/oc/LC_MESSAGES/core.po | 4 ++++ locale/oj/LC_MESSAGES/core.po | 4 ++++ locale/om/LC_MESSAGES/core.po | 4 ++++ locale/or/LC_MESSAGES/core.po | 4 ++++ locale/os/LC_MESSAGES/core.po | 4 ++++ locale/pa/LC_MESSAGES/core.po | 4 ++++ locale/pi/LC_MESSAGES/core.po | 4 ++++ locale/pl/LC_MESSAGES/core.po | 4 ++++ locale/ps/LC_MESSAGES/core.po | 4 ++++ locale/pt/LC_MESSAGES/core.po | 4 ++++ locale/qu/LC_MESSAGES/core.po | 4 ++++ locale/rm/LC_MESSAGES/core.po | 4 ++++ locale/rn/LC_MESSAGES/core.po | 4 ++++ locale/ro/LC_MESSAGES/core.po | 4 ++++ locale/ru/LC_MESSAGES/core.po | 4 ++++ locale/rw/LC_MESSAGES/core.po | 4 ++++ locale/sa/LC_MESSAGES/core.po | 4 ++++ locale/sc/LC_MESSAGES/core.po | 4 ++++ locale/sd/LC_MESSAGES/core.po | 4 ++++ locale/se/LC_MESSAGES/core.po | 4 ++++ locale/sg/LC_MESSAGES/core.po | 4 ++++ locale/si/LC_MESSAGES/core.po | 4 ++++ locale/sk/LC_MESSAGES/core.po | 4 ++++ locale/sl/LC_MESSAGES/core.po | 4 ++++ locale/sm/LC_MESSAGES/core.po | 4 ++++ locale/sn/LC_MESSAGES/core.po | 4 ++++ locale/so/LC_MESSAGES/core.po | 4 ++++ locale/sq/LC_MESSAGES/core.po | 4 ++++ locale/sr/LC_MESSAGES/core.po | 4 ++++ locale/ss/LC_MESSAGES/core.po | 4 ++++ locale/st/LC_MESSAGES/core.po | 4 ++++ locale/su/LC_MESSAGES/core.po | 4 ++++ locale/sv/LC_MESSAGES/core.po | 4 ++++ locale/sw/LC_MESSAGES/core.po | 4 ++++ locale/ta/LC_MESSAGES/core.po | 4 ++++ locale/te/LC_MESSAGES/core.po | 4 ++++ locale/tg/LC_MESSAGES/core.po | 4 ++++ locale/th/LC_MESSAGES/core.po | 4 ++++ locale/ti/LC_MESSAGES/core.po | 4 ++++ locale/tk/LC_MESSAGES/core.po | 4 ++++ locale/tl/LC_MESSAGES/core.po | 4 ++++ locale/tn/LC_MESSAGES/core.po | 4 ++++ locale/to/LC_MESSAGES/core.po | 4 ++++ locale/tr/LC_MESSAGES/core.po | 4 ++++ locale/ts/LC_MESSAGES/core.po | 4 ++++ locale/tt/LC_MESSAGES/core.po | 4 ++++ locale/tw/LC_MESSAGES/core.po | 4 ++++ locale/ty/LC_MESSAGES/core.po | 4 ++++ locale/ug/LC_MESSAGES/core.po | 4 ++++ locale/uk/LC_MESSAGES/core.po | 4 ++++ locale/ur/LC_MESSAGES/core.po | 4 ++++ locale/uz/LC_MESSAGES/core.po | 4 ++++ locale/ve/LC_MESSAGES/core.po | 4 ++++ locale/vi/LC_MESSAGES/core.po | 4 ++++ locale/vo/LC_MESSAGES/core.po | 4 ++++ locale/wa/LC_MESSAGES/core.po | 4 ++++ locale/wo/LC_MESSAGES/core.po | 4 ++++ locale/xh/LC_MESSAGES/core.po | 4 ++++ locale/yi/LC_MESSAGES/core.po | 4 ++++ locale/yo/LC_MESSAGES/core.po | 4 ++++ locale/za/LC_MESSAGES/core.po | 4 ++++ locale/zh/LC_MESSAGES/core.po | 4 ++++ locale/zu/LC_MESSAGES/core.po | 4 ++++ 182 files changed, 728 insertions(+) diff --git a/locale/aa/LC_MESSAGES/core.po b/locale/aa/LC_MESSAGES/core.po index 30c3277e9d..3accaa4293 100644 --- a/locale/aa/LC_MESSAGES/core.po +++ b/locale/aa/LC_MESSAGES/core.po @@ -1728,6 +1728,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Selbsokta portallu for samordnet tilgogo til alle eplastret applikasjoner gjennom en tilpassbar tiler og menybrukerintasjen" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ab/LC_MESSAGES/core.po b/locale/ab/LC_MESSAGES/core.po index 49548db6ff..e366ef57ae 100644 --- a/locale/ab/LC_MESSAGES/core.po +++ b/locale/ab/LC_MESSAGES/core.po @@ -1744,6 +1744,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # güvenli ödeme yönetimi için platform msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/af/LC_MESSAGES/core.po b/locale/af/LC_MESSAGES/core.po index fd36149624..0b158687bd 100644 --- a/locale/af/LC_MESSAGES/core.po +++ b/locale/af/LC_MESSAGES/core.po @@ -1723,6 +1723,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self-hostede portal vir enheidlike toegang tot alle uitgebreide toepassings via 'n aanpasbare teggevat en meniuinskript" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ak/LC_MESSAGES/core.po b/locale/ak/LC_MESSAGES/core.po index d45e28359d..82d0bf7d58 100644 --- a/locale/ak/LC_MESSAGES/core.po +++ b/locale/ak/LC_MESSAGES/core.po @@ -1730,6 +1730,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portalti yadebi na yire ɗọ̀nọ̀ nitori nitori na aṣi aṣi ọ̀pọ̀tọ́nọ̀ tàbẹ̀ nọ̀nà ẹmọ̀njẹtọ̀ fun ọ̀pọ̀tọ́nọ̀ ọ̀pọ̀tọ́nọ̀ na ọ̀pọ̀tọ́nọ̀ tí ó ṣẹlẹ̀ fun ọ̀pọ̀tọ́nọ̀ tàbẹ̀ fun ọ̀pọ̀tọ́nọ̀" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/am/LC_MESSAGES/core.po b/locale/am/LC_MESSAGES/core.po index 0395ef1016..b6dda98fe6 100644 --- a/locale/am/LC_MESSAGES/core.po +++ b/locale/am/LC_MESSAGES/core.po @@ -1750,6 +1750,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/an/LC_MESSAGES/core.po b/locale/an/LC_MESSAGES/core.po index e6a9600615..06faa439ff 100644 --- a/locale/an/LC_MESSAGES/core.po +++ b/locale/an/LC_MESSAGES/core.po @@ -1672,6 +1672,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ar/LC_MESSAGES/core.po b/locale/ar/LC_MESSAGES/core.po index dfab0f020e..f9052dcad5 100644 --- a/locale/ar/LC_MESSAGES/core.po +++ b/locale/ar/LC_MESSAGES/core.po @@ -1799,6 +1799,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "بوابة مأهولة ذاتيا من أجل الوصول الموحد إلى جميع التطبيقات المنشورة عن طريق وصلة بينية مصممة حسب الطلب والقائمة" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/as/LC_MESSAGES/core.po b/locale/as/LC_MESSAGES/core.po index 258e11d38f..ae0bf37b38 100644 --- a/locale/as/LC_MESSAGES/core.po +++ b/locale/as/LC_MESSAGES/core.po @@ -2003,6 +2003,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate # fagin á módin próðugu, og táfvagum safnar msgctxt "role:web-app-pretix:description" diff --git a/locale/av/LC_MESSAGES/core.po b/locale/av/LC_MESSAGES/core.po index b2a1183eef..2047abe347 100644 --- a/locale/av/LC_MESSAGES/core.po +++ b/locale/av/LC_MESSAGES/core.po @@ -2036,6 +2036,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate # gögnar, aðalstöður til netjárar, og skoðastu tónulegar gögnum msgctxt "role:web-app-pretix:description" diff --git a/locale/ay/LC_MESSAGES/core.po b/locale/ay/LC_MESSAGES/core.po index efc19a1be3..7eec3d5197 100644 --- a/locale/ay/LC_MESSAGES/core.po +++ b/locale/ay/LC_MESSAGES/core.po @@ -1682,6 +1682,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Sul-bun daluwa daluwa a siis a baarsu a kaƙarin aɓarƙarin iya aɓarƙarin kai aɗaba ko aɗaba taimaka da iya koƙoƙa ko yawa" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/az/LC_MESSAGES/core.po b/locale/az/LC_MESSAGES/core.po index 4434b5b3f7..5c57d841db 100644 --- a/locale/az/LC_MESSAGES/core.po +++ b/locale/az/LC_MESSAGES/core.po @@ -1741,6 +1741,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Xüsusi dəstək və menyu interfeyssi ilə bütün istifadə edilmiş proqramlar üçün Self- hosting portalı" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: ollama msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ba/LC_MESSAGES/core.po b/locale/ba/LC_MESSAGES/core.po index 10f3986d1f..7bd2bd7942 100644 --- a/locale/ba/LC_MESSAGES/core.po +++ b/locale/ba/LC_MESSAGES/core.po @@ -2039,6 +2039,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate # penjualan online, pemeliharaan pendaftaran, dan pembayaran yang aman msgctxt "role:web-app-pretix:description" diff --git a/locale/be/LC_MESSAGES/core.po b/locale/be/LC_MESSAGES/core.po index 4805167e97..df7b771812 100644 --- a/locale/be/LC_MESSAGES/core.po +++ b/locale/be/LC_MESSAGES/core.po @@ -1811,6 +1811,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # z dostępem online, zarządzaniem rejestrowaniem oraz płatności # zabezpieczonymi msgctxt "role:web-app-pretix:description" diff --git a/locale/bg/LC_MESSAGES/core.po b/locale/bg/LC_MESSAGES/core.po index 25da6bed7d..4b5e04dc0a 100644 --- a/locale/bg/LC_MESSAGES/core.po +++ b/locale/bg/LC_MESSAGES/core.po @@ -1747,6 +1747,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self-hosted портал за единен достъп до всички разположени приложения чрез персонализируема плочка и интерфейс меню" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/bh/LC_MESSAGES/core.po b/locale/bh/LC_MESSAGES/core.po index dd9b9b1749..9cff19a5e1 100644 --- a/locale/bh/LC_MESSAGES/core.po +++ b/locale/bh/LC_MESSAGES/core.po @@ -1728,6 +1728,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/bi/LC_MESSAGES/core.po b/locale/bi/LC_MESSAGES/core.po index aa8a820bc6..059c300c3b 100644 --- a/locale/bi/LC_MESSAGES/core.po +++ b/locale/bi/LC_MESSAGES/core.po @@ -1709,6 +1709,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self-hôte portail pour l'accès unifié à tous les applications déployées via une interface de menu et de palette personnalisable" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/bm/LC_MESSAGES/core.po b/locale/bm/LC_MESSAGES/core.po index 69f946e604..35916d714b 100644 --- a/locale/bm/LC_MESSAGES/core.po +++ b/locale/bm/LC_MESSAGES/core.po @@ -1709,6 +1709,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal self-hosted untuk akses yang sejuk ke semua aplikasi yang diluncurkan melalui antologi yang dikustomisasi dan antologi menu" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/bn/LC_MESSAGES/core.po b/locale/bn/LC_MESSAGES/core.po index d73f39ca27..d7a546c99e 100644 --- a/locale/bn/LC_MESSAGES/core.po +++ b/locale/bn/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "স্বনির্বাচিত টালি এবং মেনু ইন্টারফেসের মাধ্যমে সব অ্যাপ্লিকেশনের জন্য একত্রিত করার উদ্দেশ্যে স্ব-পরীক্ষণ বক্স" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/bo/LC_MESSAGES/core.po b/locale/bo/LC_MESSAGES/core.po index f74aeef55a..d994ca0a03 100644 --- a/locale/bo/LC_MESSAGES/core.po +++ b/locale/bo/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/br/LC_MESSAGES/core.po b/locale/br/LC_MESSAGES/core.po index f13f1ddfcb..9e0664a87d 100644 --- a/locale/br/LC_MESSAGES/core.po +++ b/locale/br/LC_MESSAGES/core.po @@ -1723,6 +1723,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal self-hostado para acesso unificado a todas as aplicações desembolsadas via interface de tijolo e menu personalizável" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/bs/LC_MESSAGES/core.po b/locale/bs/LC_MESSAGES/core.po index 96ddc59767..8dec96ddf2 100644 --- a/locale/bs/LC_MESSAGES/core.po +++ b/locale/bs/LC_MESSAGES/core.po @@ -1726,6 +1726,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Sloborni portal za zajedničko pristup svega napravljenim aplikačnim dijelovima kroz dostupno tvrtkovu ikonu i rubrični interfejs" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: ollama msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ca/LC_MESSAGES/core.po b/locale/ca/LC_MESSAGES/core.po index a84e560c25..e476b5cbb0 100644 --- a/locale/ca/LC_MESSAGES/core.po +++ b/locale/ca/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Un portal auto-ordinador per a accedir unificat a totes les aplicacions que s' usen mitjançant una fitxa i interfície de menú personalitzable" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ce/LC_MESSAGES/core.po b/locale/ce/LC_MESSAGES/core.po index 91d911f87c..4fb3747e64 100644 --- a/locale/ce/LC_MESSAGES/core.po +++ b/locale/ce/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ch/LC_MESSAGES/core.po b/locale/ch/LC_MESSAGES/core.po index 50e2d01f70..09bb204273 100644 --- a/locale/ch/LC_MESSAGES/core.po +++ b/locale/ch/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/co/LC_MESSAGES/core.po b/locale/co/LC_MESSAGES/core.po index 401e5b01da..84e57567c2 100644 --- a/locale/co/LC_MESSAGES/core.po +++ b/locale/co/LC_MESSAGES/core.po @@ -1720,6 +1720,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal autoseñaal voor eenheidse toegang tot alle geplande toepassingen via een aanpasbare blok en menuinterface" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: ollama msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/cr/LC_MESSAGES/core.po b/locale/cr/LC_MESSAGES/core.po index 35b8f3af5b..254ec62d57 100644 --- a/locale/cr/LC_MESSAGES/core.po +++ b/locale/cr/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/cs/LC_MESSAGES/core.po b/locale/cs/LC_MESSAGES/core.po index 3227c2c4d0..713c18fdd0 100644 --- a/locale/cs/LC_MESSAGES/core.po +++ b/locale/cs/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self- hostovaný portál pro jednotný přístup ke všem nasazeným aplikacím přes přizpůsobitelné dlaždice a menu rozhraní" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/cu/LC_MESSAGES/core.po b/locale/cu/LC_MESSAGES/core.po index fc634aa379..735a0f5f32 100644 --- a/locale/cu/LC_MESSAGES/core.po +++ b/locale/cu/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/cv/LC_MESSAGES/core.po b/locale/cv/LC_MESSAGES/core.po index a382bd9bf8..cec2660594 100644 --- a/locale/cv/LC_MESSAGES/core.po +++ b/locale/cv/LC_MESSAGES/core.po @@ -1742,6 +1742,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Індивідуальна порталка для однієї доступу до всієї підключеної програми через налаштувану плитку та інтерфейс мenu" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: ollama msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/cy/LC_MESSAGES/core.po b/locale/cy/LC_MESSAGES/core.po index 4fea138577..cf3b3cfa03 100644 --- a/locale/cy/LC_MESSAGES/core.po +++ b/locale/cy/LC_MESSAGES/core.po @@ -1691,6 +1691,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal self-hospidol ar ystod y gallwn o drafod ynglŷn ag y bobwiwn wedi bod yn ymhlith, gyda wahân a menydd ariannol cymhleth" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: ollama msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/da/LC_MESSAGES/core.po b/locale/da/LC_MESSAGES/core.po index 11da784f25..ffe59c5857 100644 --- a/locale/da/LC_MESSAGES/core.po +++ b/locale/da/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self-hosted portal for samlet adgang til alle installerede programmer via en brugervenlig flise og menu interface" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/de/LC_MESSAGES/core.po b/locale/de/LC_MESSAGES/core.po index 50fbcbbf27..776780c379 100644 --- a/locale/de/LC_MESSAGES/core.po +++ b/locale/de/LC_MESSAGES/core.po @@ -1723,6 +1723,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Selbst gehostetes Portal für einheitlichen Zugriff auf alle bereitgestellten Anwendungen über eine anpassbare Kachel- und Menüoberfläche" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/dv/LC_MESSAGES/core.po b/locale/dv/LC_MESSAGES/core.po index 16a8a6cbac..c6fe17acbd 100644 --- a/locale/dv/LC_MESSAGES/core.po +++ b/locale/dv/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/dz/LC_MESSAGES/core.po b/locale/dz/LC_MESSAGES/core.po index 3dbfae4297..5630ef0fc9 100644 --- a/locale/dz/LC_MESSAGES/core.po +++ b/locale/dz/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ee/LC_MESSAGES/core.po b/locale/ee/LC_MESSAGES/core.po index 861eddd100..5ba1f5dcce 100644 --- a/locale/ee/LC_MESSAGES/core.po +++ b/locale/ee/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/el/LC_MESSAGES/core.po b/locale/el/LC_MESSAGES/core.po index 31072c646f..1d3c42d0f1 100644 --- a/locale/el/LC_MESSAGES/core.po +++ b/locale/el/LC_MESSAGES/core.po @@ -1738,6 +1738,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Αυτο-φιλοξενούμενη πύλη για ενιαία πρόσβαση σε όλες τις χρησιμοποιούμενες εφαρμογές μέσω μιας προσαρμόσιμης διεπαφής πλακιδίων και μενού" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/eo/LC_MESSAGES/core.po b/locale/eo/LC_MESSAGES/core.po index b1821e7103..6d97df8a38 100644 --- a/locale/eo/LC_MESSAGES/core.po +++ b/locale/eo/LC_MESSAGES/core.po @@ -1732,6 +1732,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Mem-gastigita portalo por unuigita aliro al ĉiuj deplojitaj aplikoj per specialadaptita kahelo kaj menuo interfaco" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/es/LC_MESSAGES/core.po b/locale/es/LC_MESSAGES/core.po index b182a1ae6e..2298ea573f 100644 --- a/locale/es/LC_MESSAGES/core.po +++ b/locale/es/LC_MESSAGES/core.po @@ -1727,6 +1727,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal auto hospedado para un acceso unificado a todas las aplicaciones implementadas a través de una interfaz de mosaico y menú personalizable" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/et/LC_MESSAGES/core.po b/locale/et/LC_MESSAGES/core.po index f5e8cac715..8fa0190a87 100644 --- a/locale/et/LC_MESSAGES/core.po +++ b/locale/et/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Isehostitud portaal, mis võimaldab ühtset juurdepääsu kõigile kasutatud rakendustele kohandatava plaadi- ja menüüliidese kaudu" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/eu/LC_MESSAGES/core.po b/locale/eu/LC_MESSAGES/core.po index a6ef0467ac..fdf153116a 100644 --- a/locale/eu/LC_MESSAGES/core.po +++ b/locale/eu/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Auto-ostatutako ataria, hedatutako aplikazio guztietarako sarbide bateratua, pertsonalizatutako fitxa eta menu-interfazearen bidez." +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/fa/LC_MESSAGES/core.po b/locale/fa/LC_MESSAGES/core.po index d93070872a..b2d61289b6 100644 --- a/locale/fa/LC_MESSAGES/core.po +++ b/locale/fa/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "پورتال خود میزبان برای دسترسی یکپارچه به تمام برنامه های کاربردی از طریق یک کاشی قابل تنظیم و رابط منو" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ff/LC_MESSAGES/core.po b/locale/ff/LC_MESSAGES/core.po index c8e53c788a..2df434dfaa 100644 --- a/locale/ff/LC_MESSAGES/core.po +++ b/locale/ff/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/fi/LC_MESSAGES/core.po b/locale/fi/LC_MESSAGES/core.po index 39e813bf04..b2561d21ee 100644 --- a/locale/fi/LC_MESSAGES/core.po +++ b/locale/fi/LC_MESSAGES/core.po @@ -1738,6 +1738,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Itse isännöimä portaali, joka mahdollistaa yhtenäisen pääsyn kaikkiin käytössä oleviin sovelluksiin muokattavissa olevien laattojen ja valikon käyttöliittymän kautta" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/fj/LC_MESSAGES/core.po b/locale/fj/LC_MESSAGES/core.po index 0921b138b4..e3b5b39c44 100644 --- a/locale/fj/LC_MESSAGES/core.po +++ b/locale/fj/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/fo/LC_MESSAGES/core.po b/locale/fo/LC_MESSAGES/core.po index f7c7e75746..348ff1f123 100644 --- a/locale/fo/LC_MESSAGES/core.po +++ b/locale/fo/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/fr/LC_MESSAGES/core.po b/locale/fr/LC_MESSAGES/core.po index 11ffc90cfb..e9fa6918dc 100644 --- a/locale/fr/LC_MESSAGES/core.po +++ b/locale/fr/LC_MESSAGES/core.po @@ -1723,6 +1723,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portail autonome pour un accès unifié à toutes les applications déployées via une interface de carrelage et de menu personnalisable" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/fy/LC_MESSAGES/core.po b/locale/fy/LC_MESSAGES/core.po index 3f84240fed..079e9840ee 100644 --- a/locale/fy/LC_MESSAGES/core.po +++ b/locale/fy/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ga/LC_MESSAGES/core.po b/locale/ga/LC_MESSAGES/core.po index 6b54e24eb7..d86591f51e 100644 --- a/locale/ga/LC_MESSAGES/core.po +++ b/locale/ga/LC_MESSAGES/core.po @@ -1744,6 +1744,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Tairseach féin-óstáil le haghaidh rochtain aontaithe ar gach iarratas imscaradh trí tíl customizable agus roghchlár comhéadan" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/gd/LC_MESSAGES/core.po b/locale/gd/LC_MESSAGES/core.po index ed30b960c6..0858ef20fc 100644 --- a/locale/gd/LC_MESSAGES/core.po +++ b/locale/gd/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/gl/LC_MESSAGES/core.po b/locale/gl/LC_MESSAGES/core.po index 0a1db1ce1e..a96eac90cf 100644 --- a/locale/gl/LC_MESSAGES/core.po +++ b/locale/gl/LC_MESSAGES/core.po @@ -1733,6 +1733,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal auto-hosted para un acceso único a todas as aplicacións despregadas a través dunha interface de menú e tella personalizables." +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/gn/LC_MESSAGES/core.po b/locale/gn/LC_MESSAGES/core.po index 199e8cb593..c14ae92c8b 100644 --- a/locale/gn/LC_MESSAGES/core.po +++ b/locale/gn/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/gu/LC_MESSAGES/core.po b/locale/gu/LC_MESSAGES/core.po index 766f0c385b..776a239772 100644 --- a/locale/gu/LC_MESSAGES/core.po +++ b/locale/gu/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/gv/LC_MESSAGES/core.po b/locale/gv/LC_MESSAGES/core.po index fd083acf35..7b80a70def 100644 --- a/locale/gv/LC_MESSAGES/core.po +++ b/locale/gv/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ha/LC_MESSAGES/core.po b/locale/ha/LC_MESSAGES/core.po index 64515a561b..e59f7e7415 100644 --- a/locale/ha/LC_MESSAGES/core.po +++ b/locale/ha/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/he/LC_MESSAGES/core.po b/locale/he/LC_MESSAGES/core.po index 934ca6c551..7b5b88b7db 100644 --- a/locale/he/LC_MESSAGES/core.po +++ b/locale/he/LC_MESSAGES/core.po @@ -1741,6 +1741,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "פורטל עוין עצמי לגישה מאוחדת לכל היישומים שנקבעו באמצעות אריח מותאם אישית וממשק התפריט" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/hi/LC_MESSAGES/core.po b/locale/hi/LC_MESSAGES/core.po index 51b7fbc187..d9742fba44 100644 --- a/locale/hi/LC_MESSAGES/core.po +++ b/locale/hi/LC_MESSAGES/core.po @@ -1724,6 +1724,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "एक अनुकूलन योग्य टाइल और मेनू इंटरफ़ेस के माध्यम से सभी तैनात अनुप्रयोगों के लिए एकीकृत पहुँच के लिए स्व-होस्टेड पोर्टल" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ho/LC_MESSAGES/core.po b/locale/ho/LC_MESSAGES/core.po index d594cd1444..620367b74d 100644 --- a/locale/ho/LC_MESSAGES/core.po +++ b/locale/ho/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/hr/LC_MESSAGES/core.po b/locale/hr/LC_MESSAGES/core.po index 1b158c2bbb..3be234e5eb 100644 --- a/locale/hr/LC_MESSAGES/core.po +++ b/locale/hr/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ht/LC_MESSAGES/core.po b/locale/ht/LC_MESSAGES/core.po index 0e77bdea9b..91d86bf41c 100644 --- a/locale/ht/LC_MESSAGES/core.po +++ b/locale/ht/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/hu/LC_MESSAGES/core.po b/locale/hu/LC_MESSAGES/core.po index c690dc264c..0e000cae53 100644 --- a/locale/hu/LC_MESSAGES/core.po +++ b/locale/hu/LC_MESSAGES/core.po @@ -1734,6 +1734,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self- hosted portál az összes telepített alkalmazáshoz való egységes hozzáférés érdekében testreszabható csempe és menüfelület segítségével" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/hy/LC_MESSAGES/core.po b/locale/hy/LC_MESSAGES/core.po index f3fa272b67..d39a09d4bc 100644 --- a/locale/hy/LC_MESSAGES/core.po +++ b/locale/hy/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/hz/LC_MESSAGES/core.po b/locale/hz/LC_MESSAGES/core.po index 0b56e70031..0cfe5cb492 100644 --- a/locale/hz/LC_MESSAGES/core.po +++ b/locale/hz/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ia/LC_MESSAGES/core.po b/locale/ia/LC_MESSAGES/core.po index abdd588001..9d318cb38f 100644 --- a/locale/ia/LC_MESSAGES/core.po +++ b/locale/ia/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/id/LC_MESSAGES/core.po b/locale/id/LC_MESSAGES/core.po index 56127b633d..0f2035e8a4 100644 --- a/locale/id/LC_MESSAGES/core.po +++ b/locale/id/LC_MESSAGES/core.po @@ -1724,6 +1724,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal bertuan sendiri untuk akses unified ke semua aplikasi yang dipakai melalui tile dan menu antarmuka yang dapat diubah" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ie/LC_MESSAGES/core.po b/locale/ie/LC_MESSAGES/core.po index 1c98ec0ad8..59b6cbc533 100644 --- a/locale/ie/LC_MESSAGES/core.po +++ b/locale/ie/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ig/LC_MESSAGES/core.po b/locale/ig/LC_MESSAGES/core.po index f1122d2a03..54a959135c 100644 --- a/locale/ig/LC_MESSAGES/core.po +++ b/locale/ig/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ii/LC_MESSAGES/core.po b/locale/ii/LC_MESSAGES/core.po index 10be56222d..5d312c0944 100644 --- a/locale/ii/LC_MESSAGES/core.po +++ b/locale/ii/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ik/LC_MESSAGES/core.po b/locale/ik/LC_MESSAGES/core.po index 105f0fcb42..3c6477d724 100644 --- a/locale/ik/LC_MESSAGES/core.po +++ b/locale/ik/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/io/LC_MESSAGES/core.po b/locale/io/LC_MESSAGES/core.po index b3885013a9..ac5476ef5b 100644 --- a/locale/io/LC_MESSAGES/core.po +++ b/locale/io/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/is/LC_MESSAGES/core.po b/locale/is/LC_MESSAGES/core.po index 6eb987864f..4c48d5a715 100644 --- a/locale/is/LC_MESSAGES/core.po +++ b/locale/is/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/it/LC_MESSAGES/core.po b/locale/it/LC_MESSAGES/core.po index 3576cefd75..bfb717e130 100644 --- a/locale/it/LC_MESSAGES/core.po +++ b/locale/it/LC_MESSAGES/core.po @@ -1724,6 +1724,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portale self-hosted per l'accesso unificato a tutte le applicazioni implementate tramite un'interfaccia per piastrelle e menu personalizzabile" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/iu/LC_MESSAGES/core.po b/locale/iu/LC_MESSAGES/core.po index dc79a763df..f3c5f79d0e 100644 --- a/locale/iu/LC_MESSAGES/core.po +++ b/locale/iu/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ja/LC_MESSAGES/core.po b/locale/ja/LC_MESSAGES/core.po index f20337f74e..f085527680 100644 --- a/locale/ja/LC_MESSAGES/core.po +++ b/locale/ja/LC_MESSAGES/core.po @@ -1736,6 +1736,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "カスタマイズ可能なタイルとメニューインターフェイスを介してすべての展開されたアプリケーションへの統一されたアクセスのためのセルフホストポータル" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/jv/LC_MESSAGES/core.po b/locale/jv/LC_MESSAGES/core.po index fcd204d98b..cce3d32212 100644 --- a/locale/jv/LC_MESSAGES/core.po +++ b/locale/jv/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ka/LC_MESSAGES/core.po b/locale/ka/LC_MESSAGES/core.po index 977f7d4324..faebe75b47 100644 --- a/locale/ka/LC_MESSAGES/core.po +++ b/locale/ka/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/kg/LC_MESSAGES/core.po b/locale/kg/LC_MESSAGES/core.po index f4a20dcdd5..3442f3bc07 100644 --- a/locale/kg/LC_MESSAGES/core.po +++ b/locale/kg/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ki/LC_MESSAGES/core.po b/locale/ki/LC_MESSAGES/core.po index c0754fecfc..e7abb0f630 100644 --- a/locale/ki/LC_MESSAGES/core.po +++ b/locale/ki/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/kj/LC_MESSAGES/core.po b/locale/kj/LC_MESSAGES/core.po index 8a76803e47..ac62f74efe 100644 --- a/locale/kj/LC_MESSAGES/core.po +++ b/locale/kj/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/kk/LC_MESSAGES/core.po b/locale/kk/LC_MESSAGES/core.po index e9ac05e7e4..5b5fe3e36d 100644 --- a/locale/kk/LC_MESSAGES/core.po +++ b/locale/kk/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/kl/LC_MESSAGES/core.po b/locale/kl/LC_MESSAGES/core.po index 01dcbfcadb..b4c755900b 100644 --- a/locale/kl/LC_MESSAGES/core.po +++ b/locale/kl/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/km/LC_MESSAGES/core.po b/locale/km/LC_MESSAGES/core.po index eb1fc43d22..627cd2c3f9 100644 --- a/locale/km/LC_MESSAGES/core.po +++ b/locale/km/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/kn/LC_MESSAGES/core.po b/locale/kn/LC_MESSAGES/core.po index a62b1ccd6c..2641d198c3 100644 --- a/locale/kn/LC_MESSAGES/core.po +++ b/locale/kn/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ko/LC_MESSAGES/core.po b/locale/ko/LC_MESSAGES/core.po index 016b8c378c..8b2fde98cc 100644 --- a/locale/ko/LC_MESSAGES/core.po +++ b/locale/ko/LC_MESSAGES/core.po @@ -1739,6 +1739,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "사용자 정의 타일 및 메뉴 인터페이스를 통해 모든 배포 응용 프로그램에 통합 된 액세스를위한 셀프 호스팅 포털" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/kr/LC_MESSAGES/core.po b/locale/kr/LC_MESSAGES/core.po index d3e118f2c2..410da73c94 100644 --- a/locale/kr/LC_MESSAGES/core.po +++ b/locale/kr/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ks/LC_MESSAGES/core.po b/locale/ks/LC_MESSAGES/core.po index 8524faf0de..49dc845454 100644 --- a/locale/ks/LC_MESSAGES/core.po +++ b/locale/ks/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ku/LC_MESSAGES/core.po b/locale/ku/LC_MESSAGES/core.po index 53da1098ef..cace12a67e 100644 --- a/locale/ku/LC_MESSAGES/core.po +++ b/locale/ku/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/kv/LC_MESSAGES/core.po b/locale/kv/LC_MESSAGES/core.po index fc3277e72a..748ce561c8 100644 --- a/locale/kv/LC_MESSAGES/core.po +++ b/locale/kv/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/kw/LC_MESSAGES/core.po b/locale/kw/LC_MESSAGES/core.po index 8c82d1a944..78b4e17902 100644 --- a/locale/kw/LC_MESSAGES/core.po +++ b/locale/kw/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ky/LC_MESSAGES/core.po b/locale/ky/LC_MESSAGES/core.po index 1677cf7d2d..68e7f508ae 100644 --- a/locale/ky/LC_MESSAGES/core.po +++ b/locale/ky/LC_MESSAGES/core.po @@ -1750,6 +1750,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Бардык жайгаштырылган тиркемелерге ылайыкташтырылган плитка жана меню интерфейси аркылуу бирдиктүү кирүү үчүн өз алдынча жайгаштырылган портал" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/la/LC_MESSAGES/core.po b/locale/la/LC_MESSAGES/core.po index 7b921ec2c5..12dfd77056 100644 --- a/locale/la/LC_MESSAGES/core.po +++ b/locale/la/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/lb/LC_MESSAGES/core.po b/locale/lb/LC_MESSAGES/core.po index 1445884704..bf982c7e06 100644 --- a/locale/lb/LC_MESSAGES/core.po +++ b/locale/lb/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/lg/LC_MESSAGES/core.po b/locale/lg/LC_MESSAGES/core.po index b2658e20d3..06c6e616d7 100644 --- a/locale/lg/LC_MESSAGES/core.po +++ b/locale/lg/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/li/LC_MESSAGES/core.po b/locale/li/LC_MESSAGES/core.po index 30f655e6f1..e1ac35775e 100644 --- a/locale/li/LC_MESSAGES/core.po +++ b/locale/li/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ln/LC_MESSAGES/core.po b/locale/ln/LC_MESSAGES/core.po index e1a1ebdcc3..40c3b6c51b 100644 --- a/locale/ln/LC_MESSAGES/core.po +++ b/locale/ln/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/lo/LC_MESSAGES/core.po b/locale/lo/LC_MESSAGES/core.po index 5c672bba94..2c7f604301 100644 --- a/locale/lo/LC_MESSAGES/core.po +++ b/locale/lo/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/lt/LC_MESSAGES/core.po b/locale/lt/LC_MESSAGES/core.po index a4867ca0dc..c359a06be9 100644 --- a/locale/lt/LC_MESSAGES/core.po +++ b/locale/lt/LC_MESSAGES/core.po @@ -1742,6 +1742,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Šūčių tinklė, kuriame galima pasiekti visus iššūkių įrengtus, individualiai pasizividinantį" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/lu/LC_MESSAGES/core.po b/locale/lu/LC_MESSAGES/core.po index 5ab9641fbb..61d7a9e706 100644 --- a/locale/lu/LC_MESSAGES/core.po +++ b/locale/lu/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/lv/LC_MESSAGES/core.po b/locale/lv/LC_MESSAGES/core.po index c63ae317e0..315bb3e631 100644 --- a/locale/lv/LC_MESSAGES/core.po +++ b/locale/lv/LC_MESSAGES/core.po @@ -1743,6 +1743,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Pašsaņemams portāls vienotai piekļuvei visām izvērstajām programmām, izmantojot pielāgojamu flīžu un izvēlnes saskarni" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/mg/LC_MESSAGES/core.po b/locale/mg/LC_MESSAGES/core.po index e6e648394d..328025b018 100644 --- a/locale/mg/LC_MESSAGES/core.po +++ b/locale/mg/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/mh/LC_MESSAGES/core.po b/locale/mh/LC_MESSAGES/core.po index e824089d28..40dddc2771 100644 --- a/locale/mh/LC_MESSAGES/core.po +++ b/locale/mh/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/mi/LC_MESSAGES/core.po b/locale/mi/LC_MESSAGES/core.po index 1ce5011d0e..b2ba5d4fc4 100644 --- a/locale/mi/LC_MESSAGES/core.po +++ b/locale/mi/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/mk/LC_MESSAGES/core.po b/locale/mk/LC_MESSAGES/core.po index 1c6d9075ea..e09fbfe81c 100644 --- a/locale/mk/LC_MESSAGES/core.po +++ b/locale/mk/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ml/LC_MESSAGES/core.po b/locale/ml/LC_MESSAGES/core.po index 1f147272da..ed8c9e82bb 100644 --- a/locale/ml/LC_MESSAGES/core.po +++ b/locale/ml/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/mn/LC_MESSAGES/core.po b/locale/mn/LC_MESSAGES/core.po index 2d18003d87..352ff94620 100644 --- a/locale/mn/LC_MESSAGES/core.po +++ b/locale/mn/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/mr/LC_MESSAGES/core.po b/locale/mr/LC_MESSAGES/core.po index 270c1c1694..5dea7de60b 100644 --- a/locale/mr/LC_MESSAGES/core.po +++ b/locale/mr/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ms/LC_MESSAGES/core.po b/locale/ms/LC_MESSAGES/core.po index f066a3f06e..6de49e746f 100644 --- a/locale/ms/LC_MESSAGES/core.po +++ b/locale/ms/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal self-hosted untuk akses terpadu ke semua aplikasi yang dikerahkan melalui ubin dan antarmuka menu yang dapat disesuaikan" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/mt/LC_MESSAGES/core.po b/locale/mt/LC_MESSAGES/core.po index e3140df0ff..390a9f9efb 100644 --- a/locale/mt/LC_MESSAGES/core.po +++ b/locale/mt/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/my/LC_MESSAGES/core.po b/locale/my/LC_MESSAGES/core.po index 7014c5bb0e..c40a82adb3 100644 --- a/locale/my/LC_MESSAGES/core.po +++ b/locale/my/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/na/LC_MESSAGES/core.po b/locale/na/LC_MESSAGES/core.po index 1652d04ce6..58ecd0eb5c 100644 --- a/locale/na/LC_MESSAGES/core.po +++ b/locale/na/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/nb/LC_MESSAGES/core.po b/locale/nb/LC_MESSAGES/core.po index 83032d86c6..1fd6e2b6e0 100644 --- a/locale/nb/LC_MESSAGES/core.po +++ b/locale/nb/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Selvvært portal for enhetlig tilgang til alle utplasserte programmer via en tilpasset flis og menygrensesnitt" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/nd/LC_MESSAGES/core.po b/locale/nd/LC_MESSAGES/core.po index ae773788b3..e85b181281 100644 --- a/locale/nd/LC_MESSAGES/core.po +++ b/locale/nd/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ne/LC_MESSAGES/core.po b/locale/ne/LC_MESSAGES/core.po index fc3856751f..2a93e1ce0c 100644 --- a/locale/ne/LC_MESSAGES/core.po +++ b/locale/ne/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ng/LC_MESSAGES/core.po b/locale/ng/LC_MESSAGES/core.po index 72f0c82e97..979007f686 100644 --- a/locale/ng/LC_MESSAGES/core.po +++ b/locale/ng/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/nl/LC_MESSAGES/core.po b/locale/nl/LC_MESSAGES/core.po index 1c06b02bb6..06d8b85c44 100644 --- a/locale/nl/LC_MESSAGES/core.po +++ b/locale/nl/LC_MESSAGES/core.po @@ -1726,6 +1726,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self-hosted portal voor uniforme toegang tot alle geïmplementeerde toepassingen via een aanpasbare tegel- en menuinterface" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/nn/LC_MESSAGES/core.po b/locale/nn/LC_MESSAGES/core.po index eff50875b2..80e35d2511 100644 --- a/locale/nn/LC_MESSAGES/core.po +++ b/locale/nn/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/no/LC_MESSAGES/core.po b/locale/no/LC_MESSAGES/core.po index 7bbfde540a..8d5ce17ed7 100644 --- a/locale/no/LC_MESSAGES/core.po +++ b/locale/no/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/nr/LC_MESSAGES/core.po b/locale/nr/LC_MESSAGES/core.po index b67d3fd152..d3e31a8037 100644 --- a/locale/nr/LC_MESSAGES/core.po +++ b/locale/nr/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/nv/LC_MESSAGES/core.po b/locale/nv/LC_MESSAGES/core.po index b5c8a2f675..01022f17db 100644 --- a/locale/nv/LC_MESSAGES/core.po +++ b/locale/nv/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ny/LC_MESSAGES/core.po b/locale/ny/LC_MESSAGES/core.po index 0fa73b4fa4..0be2a176d8 100644 --- a/locale/ny/LC_MESSAGES/core.po +++ b/locale/ny/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/oc/LC_MESSAGES/core.po b/locale/oc/LC_MESSAGES/core.po index fb3bdc6046..c81b6b188c 100644 --- a/locale/oc/LC_MESSAGES/core.po +++ b/locale/oc/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/oj/LC_MESSAGES/core.po b/locale/oj/LC_MESSAGES/core.po index 0286742a04..c20b5a16ac 100644 --- a/locale/oj/LC_MESSAGES/core.po +++ b/locale/oj/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/om/LC_MESSAGES/core.po b/locale/om/LC_MESSAGES/core.po index 894a4c6d6a..49940b8b62 100644 --- a/locale/om/LC_MESSAGES/core.po +++ b/locale/om/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/or/LC_MESSAGES/core.po b/locale/or/LC_MESSAGES/core.po index d9d4e3689c..b70c0caaf4 100644 --- a/locale/or/LC_MESSAGES/core.po +++ b/locale/or/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/os/LC_MESSAGES/core.po b/locale/os/LC_MESSAGES/core.po index b4ef0cc518..a1bb0d8f2f 100644 --- a/locale/os/LC_MESSAGES/core.po +++ b/locale/os/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/pa/LC_MESSAGES/core.po b/locale/pa/LC_MESSAGES/core.po index 1cab06b8db..84171a5f9c 100644 --- a/locale/pa/LC_MESSAGES/core.po +++ b/locale/pa/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/pi/LC_MESSAGES/core.po b/locale/pi/LC_MESSAGES/core.po index b99f955c9c..ef116acc72 100644 --- a/locale/pi/LC_MESSAGES/core.po +++ b/locale/pi/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/pl/LC_MESSAGES/core.po b/locale/pl/LC_MESSAGES/core.po index 14b7128827..07ee371924 100644 --- a/locale/pl/LC_MESSAGES/core.po +++ b/locale/pl/LC_MESSAGES/core.po @@ -1723,6 +1723,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self-host portal dla jednolitego dostępu do wszystkich zastosowanych aplikacji za pomocą dostosowanego interfejsu dachowego i menu" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ps/LC_MESSAGES/core.po b/locale/ps/LC_MESSAGES/core.po index cae0042ed4..4f85348bb1 100644 --- a/locale/ps/LC_MESSAGES/core.po +++ b/locale/ps/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/pt/LC_MESSAGES/core.po b/locale/pt/LC_MESSAGES/core.po index 61cc61cbd4..4ed8e96b97 100644 --- a/locale/pt/LC_MESSAGES/core.po +++ b/locale/pt/LC_MESSAGES/core.po @@ -1723,6 +1723,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal auto- hospedado para acesso unificado a todos os aplicativos implantados através de uma interface de azulejo e menu personalizável" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/qu/LC_MESSAGES/core.po b/locale/qu/LC_MESSAGES/core.po index 3b8d27f8fe..289d55d7da 100644 --- a/locale/qu/LC_MESSAGES/core.po +++ b/locale/qu/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/rm/LC_MESSAGES/core.po b/locale/rm/LC_MESSAGES/core.po index 2e5a059c1f..e4e5e66279 100644 --- a/locale/rm/LC_MESSAGES/core.po +++ b/locale/rm/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/rn/LC_MESSAGES/core.po b/locale/rn/LC_MESSAGES/core.po index cd8dc5d2e3..26a9905fa3 100644 --- a/locale/rn/LC_MESSAGES/core.po +++ b/locale/rn/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ro/LC_MESSAGES/core.po b/locale/ro/LC_MESSAGES/core.po index 4f01bb3d64..3e5cbf1eaf 100644 --- a/locale/ro/LC_MESSAGES/core.po +++ b/locale/ro/LC_MESSAGES/core.po @@ -1736,6 +1736,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Portal auto-hostat pentru acces unificat la toate aplicațiile implementate prin intermediul unei interfețe personalizabile pentru plăci și meniu" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ru/LC_MESSAGES/core.po b/locale/ru/LC_MESSAGES/core.po index 6133b923d4..5b946cdc1e 100644 --- a/locale/ru/LC_MESSAGES/core.po +++ b/locale/ru/LC_MESSAGES/core.po @@ -1725,6 +1725,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Автономный портал для унифицированного доступа ко всем развернутым приложениям через настраиваемую плитку и интерфейс меню" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/rw/LC_MESSAGES/core.po b/locale/rw/LC_MESSAGES/core.po index a3e57a7d49..4e5ae2b518 100644 --- a/locale/rw/LC_MESSAGES/core.po +++ b/locale/rw/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sa/LC_MESSAGES/core.po b/locale/sa/LC_MESSAGES/core.po index ec4ac34c25..24e5a1b5fa 100644 --- a/locale/sa/LC_MESSAGES/core.po +++ b/locale/sa/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sc/LC_MESSAGES/core.po b/locale/sc/LC_MESSAGES/core.po index 331bf3c495..b1e3eeaff9 100644 --- a/locale/sc/LC_MESSAGES/core.po +++ b/locale/sc/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sd/LC_MESSAGES/core.po b/locale/sd/LC_MESSAGES/core.po index 3dde3a1b46..88c0330fb6 100644 --- a/locale/sd/LC_MESSAGES/core.po +++ b/locale/sd/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/se/LC_MESSAGES/core.po b/locale/se/LC_MESSAGES/core.po index 2de41b1d1f..a8ba644d4c 100644 --- a/locale/se/LC_MESSAGES/core.po +++ b/locale/se/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sg/LC_MESSAGES/core.po b/locale/sg/LC_MESSAGES/core.po index fc3919fd52..3f09bb56be 100644 --- a/locale/sg/LC_MESSAGES/core.po +++ b/locale/sg/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/si/LC_MESSAGES/core.po b/locale/si/LC_MESSAGES/core.po index 8f931c3dd2..4a95938005 100644 --- a/locale/si/LC_MESSAGES/core.po +++ b/locale/si/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sk/LC_MESSAGES/core.po b/locale/sk/LC_MESSAGES/core.po index b1d2271f29..db9e15924c 100644 --- a/locale/sk/LC_MESSAGES/core.po +++ b/locale/sk/LC_MESSAGES/core.po @@ -1732,6 +1732,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Self-hosted portál pre jednotný prístup ku všetkým nasadeným aplikáciám prostredníctvom prispôsobiteľného rozhrania dlažby a menu" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/sl/LC_MESSAGES/core.po b/locale/sl/LC_MESSAGES/core.po index 33bd0a6bc7..03ede4d049 100644 --- a/locale/sl/LC_MESSAGES/core.po +++ b/locale/sl/LC_MESSAGES/core.po @@ -1732,6 +1732,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Samogostujoči portal za enoten dostop do vseh razporejenih programov prek prilagodljivega vmesnika za ploščice in menije" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/sm/LC_MESSAGES/core.po b/locale/sm/LC_MESSAGES/core.po index c01fd6bd46..f880a4066a 100644 --- a/locale/sm/LC_MESSAGES/core.po +++ b/locale/sm/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sn/LC_MESSAGES/core.po b/locale/sn/LC_MESSAGES/core.po index b65d49ce3d..cc6bff3da0 100644 --- a/locale/sn/LC_MESSAGES/core.po +++ b/locale/sn/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/so/LC_MESSAGES/core.po b/locale/so/LC_MESSAGES/core.po index 9f3159831c..2327e80992 100644 --- a/locale/so/LC_MESSAGES/core.po +++ b/locale/so/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sq/LC_MESSAGES/core.po b/locale/sq/LC_MESSAGES/core.po index 6ecac89911..fb87d6aa49 100644 --- a/locale/sq/LC_MESSAGES/core.po +++ b/locale/sq/LC_MESSAGES/core.po @@ -1731,6 +1731,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Porta e vetë-pritur për hyrje të unifikuar në të gjitha programet e vendosura nëpërmjet një tjegulle të personalizuar dhe ndërfaqe menush" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/sr/LC_MESSAGES/core.po b/locale/sr/LC_MESSAGES/core.po index cdd5e2199c..079f4883a4 100644 --- a/locale/sr/LC_MESSAGES/core.po +++ b/locale/sr/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ss/LC_MESSAGES/core.po b/locale/ss/LC_MESSAGES/core.po index 42a9f19318..fef3f47259 100644 --- a/locale/ss/LC_MESSAGES/core.po +++ b/locale/ss/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/st/LC_MESSAGES/core.po b/locale/st/LC_MESSAGES/core.po index 51753ad1a5..eedafe3f2e 100644 --- a/locale/st/LC_MESSAGES/core.po +++ b/locale/st/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/su/LC_MESSAGES/core.po b/locale/su/LC_MESSAGES/core.po index 8b4f95ca09..071f8c023f 100644 --- a/locale/su/LC_MESSAGES/core.po +++ b/locale/su/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/sv/LC_MESSAGES/core.po b/locale/sv/LC_MESSAGES/core.po index 1293583f64..c1d5893317 100644 --- a/locale/sv/LC_MESSAGES/core.po +++ b/locale/sv/LC_MESSAGES/core.po @@ -1732,6 +1732,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Självhäftad portal för enhetlig tillgång till alla utplacerade applikationer via ett anpassningsbart kakel- och menygränssnitt" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/sw/LC_MESSAGES/core.po b/locale/sw/LC_MESSAGES/core.po index fac193a03b..13bb9f2eb7 100644 --- a/locale/sw/LC_MESSAGES/core.po +++ b/locale/sw/LC_MESSAGES/core.po @@ -1743,6 +1743,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Hifadhi ya kujitegemea ya upatikanaji wa umoja kwa maombi yote yaliyopelekwa kupitia interface ya tile na menu customizable" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ta/LC_MESSAGES/core.po b/locale/ta/LC_MESSAGES/core.po index ec27aa8bc7..d2e9d7f21c 100644 --- a/locale/ta/LC_MESSAGES/core.po +++ b/locale/ta/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/te/LC_MESSAGES/core.po b/locale/te/LC_MESSAGES/core.po index 9e8698cb31..94df583906 100644 --- a/locale/te/LC_MESSAGES/core.po +++ b/locale/te/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/tg/LC_MESSAGES/core.po b/locale/tg/LC_MESSAGES/core.po index 3775c4941b..5fd116dcaf 100644 --- a/locale/tg/LC_MESSAGES/core.po +++ b/locale/tg/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/th/LC_MESSAGES/core.po b/locale/th/LC_MESSAGES/core.po index b23efc8a21..4927e4b5e9 100644 --- a/locale/th/LC_MESSAGES/core.po +++ b/locale/th/LC_MESSAGES/core.po @@ -1738,6 +1738,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "ประตูมิติด้วยตนเอง สําหรับเข้าถึงโปรแกรมทั้งหมดที่ใช้งานอยู่ โดยผ่านส่วนติดต่อของกระเบื้องและเมนูที่กําหนดเอง" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ti/LC_MESSAGES/core.po b/locale/ti/LC_MESSAGES/core.po index 205ae5ebd1..f9c345b647 100644 --- a/locale/ti/LC_MESSAGES/core.po +++ b/locale/ti/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/tk/LC_MESSAGES/core.po b/locale/tk/LC_MESSAGES/core.po index e63639d3ec..ab908cb591 100644 --- a/locale/tk/LC_MESSAGES/core.po +++ b/locale/tk/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/tl/LC_MESSAGES/core.po b/locale/tl/LC_MESSAGES/core.po index ac4a68ebec..b49eeb0571 100644 --- a/locale/tl/LC_MESSAGES/core.po +++ b/locale/tl/LC_MESSAGES/core.po @@ -1733,6 +1733,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Sarili-hosted portal para sa nagkakaisang pag-access sa lahat ng mga naka-set na application sa pamamagitan ng isang custizable tile at menu interface" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/tn/LC_MESSAGES/core.po b/locale/tn/LC_MESSAGES/core.po index 5bbbcac80e..eed1375010 100644 --- a/locale/tn/LC_MESSAGES/core.po +++ b/locale/tn/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/to/LC_MESSAGES/core.po b/locale/to/LC_MESSAGES/core.po index b669674be3..9597ebfa98 100644 --- a/locale/to/LC_MESSAGES/core.po +++ b/locale/to/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/tr/LC_MESSAGES/core.po b/locale/tr/LC_MESSAGES/core.po index b6258e0fbd..872eae71b1 100644 --- a/locale/tr/LC_MESSAGES/core.po +++ b/locale/tr/LC_MESSAGES/core.po @@ -1737,6 +1737,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Kendi kendine evlenmiş portal, tüm dağıtılmış uygulamalara bir karot ve menü arayüzü aracılığıyla birleşik erişim için" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ts/LC_MESSAGES/core.po b/locale/ts/LC_MESSAGES/core.po index a2ea78eff1..10413a4454 100644 --- a/locale/ts/LC_MESSAGES/core.po +++ b/locale/ts/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/tt/LC_MESSAGES/core.po b/locale/tt/LC_MESSAGES/core.po index 1d6208c03e..d20b60d297 100644 --- a/locale/tt/LC_MESSAGES/core.po +++ b/locale/tt/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/tw/LC_MESSAGES/core.po b/locale/tw/LC_MESSAGES/core.po index 4e00b39e5c..f9b94ea9b3 100644 --- a/locale/tw/LC_MESSAGES/core.po +++ b/locale/tw/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ty/LC_MESSAGES/core.po b/locale/ty/LC_MESSAGES/core.po index b0d71c1570..8091f59371 100644 --- a/locale/ty/LC_MESSAGES/core.po +++ b/locale/ty/LC_MESSAGES/core.po @@ -1390,6 +1390,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ug/LC_MESSAGES/core.po b/locale/ug/LC_MESSAGES/core.po index 04fa996ed7..b496b6ddca 100644 --- a/locale/ug/LC_MESSAGES/core.po +++ b/locale/ug/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/uk/LC_MESSAGES/core.po b/locale/uk/LC_MESSAGES/core.po index b7c9de9c11..0949251397 100644 --- a/locale/uk/LC_MESSAGES/core.po +++ b/locale/uk/LC_MESSAGES/core.po @@ -1730,6 +1730,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Самостійний портал для єдиного доступу до всіх розгорнутих додатків за допомогою настроюваного інтерфейсу плитки та меню" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/ur/LC_MESSAGES/core.po b/locale/ur/LC_MESSAGES/core.po index 713b4020c7..d3e894c713 100644 --- a/locale/ur/LC_MESSAGES/core.po +++ b/locale/ur/LC_MESSAGES/core.po @@ -1751,6 +1751,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "خود کار طور پر متحدہ سمتوں تک رسائی کے لیے" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/uz/LC_MESSAGES/core.po b/locale/uz/LC_MESSAGES/core.po index 1b79f5ccb8..72a20eb98a 100644 --- a/locale/uz/LC_MESSAGES/core.po +++ b/locale/uz/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/ve/LC_MESSAGES/core.po b/locale/ve/LC_MESSAGES/core.po index 9915884b36..bf26f4d3a4 100644 --- a/locale/ve/LC_MESSAGES/core.po +++ b/locale/ve/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/vi/LC_MESSAGES/core.po b/locale/vi/LC_MESSAGES/core.po index 89b5a4b6e8..582aeb4825 100644 --- a/locale/vi/LC_MESSAGES/core.po +++ b/locale/vi/LC_MESSAGES/core.po @@ -1728,6 +1728,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "Cổng tự tạo cho phép truy cập hợp nhất tới tất cả các ứng dụng được triển khai thông qua giao diện bảng điều khiển và trình đơn tùy chỉnh" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/vo/LC_MESSAGES/core.po b/locale/vo/LC_MESSAGES/core.po index bf45560358..28f1c6443a 100644 --- a/locale/vo/LC_MESSAGES/core.po +++ b/locale/vo/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/wa/LC_MESSAGES/core.po b/locale/wa/LC_MESSAGES/core.po index 8d749949eb..edf3a72a9d 100644 --- a/locale/wa/LC_MESSAGES/core.po +++ b/locale/wa/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/wo/LC_MESSAGES/core.po b/locale/wo/LC_MESSAGES/core.po index 7ffa793595..6caa3cd8e2 100644 --- a/locale/wo/LC_MESSAGES/core.po +++ b/locale/wo/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/xh/LC_MESSAGES/core.po b/locale/xh/LC_MESSAGES/core.po index c5cb333152..12160ee62e 100644 --- a/locale/xh/LC_MESSAGES/core.po +++ b/locale/xh/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/yi/LC_MESSAGES/core.po b/locale/yi/LC_MESSAGES/core.po index 25a625a5e3..56145fbbaf 100644 --- a/locale/yi/LC_MESSAGES/core.po +++ b/locale/yi/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/yo/LC_MESSAGES/core.po b/locale/yo/LC_MESSAGES/core.po index deb7c6ff0b..d5a580807d 100644 --- a/locale/yo/LC_MESSAGES/core.po +++ b/locale/yo/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/za/LC_MESSAGES/core.po b/locale/za/LC_MESSAGES/core.po index 2d6e4887ad..6e3edffd78 100644 --- a/locale/za/LC_MESSAGES/core.po +++ b/locale/za/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" diff --git a/locale/zh/LC_MESSAGES/core.po b/locale/zh/LC_MESSAGES/core.po index 6cb8d0aff1..79bc3db9ad 100644 --- a/locale/zh/LC_MESSAGES/core.po +++ b/locale/zh/LC_MESSAGES/core.po @@ -1739,6 +1739,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "自动托管的门户,通过自定义的瓷砖和菜单接口统一访问所有已部署的应用程序" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + # translated-by: libretranslate msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" diff --git a/locale/zu/LC_MESSAGES/core.po b/locale/zu/LC_MESSAGES/core.po index 949859d41a..b152db708b 100644 --- a/locale/zu/LC_MESSAGES/core.po +++ b/locale/zu/LC_MESSAGES/core.po @@ -1391,6 +1391,10 @@ msgctxt "role:web-app-dashboard:description" msgid "Self-hosted portal for unified access to all deployed applications via a customizable tile and menu interface" msgstr "" +msgctxt "role:web-app-openpost:description" +msgid "Self-hosted publishing desk that composes, schedules and publishes posts to Fediverse and commercial social networks" +msgstr "" + msgctxt "role:web-app-pretix:description" msgid "Self-hosted ticketing platform for events with online sales, registration management, and secure payments" msgstr "" From 680641eefbf9ef1cd388ff89ed180a18fadcbed6 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:36 +0100 Subject: [PATCH 372/554] fix(web-app-openpost): drop the crossposter routes whose source platform the round disables --- roles/web-app-openpost/vars/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 8313445b57..af4e78271b 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -119,7 +119,13 @@ OPENPOST_PROVIDER_APPS: >- {{ _apps }} OPENPOST_CROSSPOSTER: "{{ lookup('config', application_id, 'services.crossposter') }}" -OPENPOST_CROSSPOSTER_ROUTES: "{{ OPENPOST_CROSSPOSTER.routes }}" +OPENPOST_CROSSPOSTER_ROUTES: >- + {%- set _routes = [] -%} + {%- for _route in OPENPOST_CROSSPOSTER.routes + if lookup('config', application_id, 'services.' ~ _route.source.platform ~ '.enabled') | bool -%} + {%- set _ = _routes.append(_route) -%} + {%- endfor -%} + {{ _routes }} OPENPOST_CROSSPOSTER_ENABLED: "{{ lookup('config', application_id, 'services.crossposter.enabled') | bool }}" OPENPOST_CROSSPOSTER_NAME: "{{ OPENPOST_CROSSPOSTER.name }}" OPENPOST_CROSSPOSTER_UID: "{{ OPENPOST_CROSSPOSTER.uid }}" From ba3d6e2e90c96b9f03276bb9d7ac7889a6fe27e9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:36 +0100 Subject: [PATCH 373/554] test(web-app-openpost): resolve the database and crossposter containers on the probe's own swarm node --- roles/web-app-openpost/templates/test.env.j2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index 3744b5616c..653908efa0 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -1,4 +1,5 @@ {% set _view = hostvars[STACK_HOST].openpost_public_view %} +{% set _node_local_cid = '"$(container ps -q --filter label=com.docker.swarm.service.name=%s --filter status=running)"' %} OPENPOST_ADMIN_EMAIL={{ OPENPOST_ADMIN_EMAIL }} OPENPOST_ADMIN_PASSWORD_B64={{ OPENPOST_ADMIN_PASSWORD | b64encode }} OPENPOST_API_HEADERS_B64={{ _view.api_headers | to_json | b64encode }} @@ -23,7 +24,7 @@ OPENPOST_SIMULATOR_PLATFORMS='{{ _platforms | to_json }}' OPENPOST_UNCONFIGURED_PLATFORMS='{{ _unconfigured | to_json }}' OPENPOST_S3_PUBLIC_URL={{ _view.s3_public_url }} OPENPOST_SIMULATOR_HOST={{ OPENPOST_SIMULATOR_HOSTS | first }} -OPENPOST_DB_CONTAINER={{ lookup('database', application_id, 'address') }} +OPENPOST_DB_CONTAINER={{ (_node_local_cid | format(lookup('database', application_id, 'service_name'))) if IS_SWARM_MODE else lookup('database', application_id, 'address') }} OPENPOST_DB_NAME={{ lookup('database', application_id, 'name') }} OPENPOST_DB_USER={{ lookup('database', application_id, 'username') }} OPENPOST_DB_PASSWORD_B64={{ lookup('database', application_id, 'password') | b64encode }} @@ -39,7 +40,7 @@ OPENPOST_CROSSPOSTER_POLL_SECONDS={{ OPENPOST_CROSSPOSTER.poll_interval_seconds OPENPOST_CROSSPOSTER_RETRY_SECONDS={{ (OPENPOST_CROSSPOSTER.retry.max_attempts | int) * (OPENPOST_CROSSPOSTER.retry.cap_seconds | int) }} {% if OPENPOST_CROSSPOSTER_ENABLED | bool %} OPENPOST_CROSSPOSTER_SECRETS_FILE={{ OPENPOST_CROSSPOSTER_SECRETS_HOST }} -OPENPOST_CROSSPOSTER_CONTAINER={{ ('"$(' ~ BIN_RESOLVE_CONTAINER_ID ~ ' ' ~ (application_id | entity_name) ~ ' crossposter)"') if IS_SWARM_MODE else OPENPOST_CROSSPOSTER_ADDRESS }} +OPENPOST_CROSSPOSTER_CONTAINER={{ (_node_local_cid | format(lookup('container_service', application_id, 'crossposter'))) if IS_SWARM_MODE else OPENPOST_CROSSPOSTER_ADDRESS }} OPENPOST_CROSSPOSTER_CONFIG={{ OPENPOST_CROSSPOSTER_CONFIG_TARGET }} {% else %} OPENPOST_CROSSPOSTER_SECRETS_FILE= From 2a99cfe12830fc390e52bc2451c262f3dff17099 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:36 +0100 Subject: [PATCH 374/554] test(web-app-openpost): state that the probe's database container is empty off-node --- roles/web-app-openpost/files/test/openpost/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/test/openpost/api.py b/roles/web-app-openpost/files/test/openpost/api.py index d041b5ee2c..55932282b8 100644 --- a/roles/web-app-openpost/files/test/openpost/api.py +++ b/roles/web-app-openpost/files/test/openpost/api.py @@ -13,7 +13,7 @@ OPENPOST_SIMULATOR_HOST one simulator alias, whose /__admin API holds the r OPENPOST_PROVIDER_URL published plain-HTTP origin of the fake provider that plays LinkedIn, empty without it OPENPOST_UNCONFIGURED_PLATFORMS JSON list of commercial platforms without credentials, which must not connect OPENPOST_S3_PUBLIC_URL public bucket URL with a trailing slash, empty when media stays in the role volume -OPENPOST_DB_CONTAINER resolved Postgres container +OPENPOST_DB_CONTAINER Postgres container on the probe's node, empty when swarm placed it elsewhere OPENPOST_DB_NAME OpenPost database name OPENPOST_DB_USER OpenPost database user OPENPOST_DB_PASSWORD_B64 base64 OpenPost database password From d6c8108728e5fa12d286717e8ecd36646037672f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:36 +0100 Subject: [PATCH 375/554] test(web-app-openpost): read the account list from the API before disconnecting Mastodon --- .../files/playwright/_shared.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/files/playwright/_shared.js b/roles/web-app-openpost/files/playwright/_shared.js index acfa1071f7..21a506d5ef 100644 --- a/roles/web-app-openpost/files/playwright/_shared.js +++ b/roles/web-app-openpost/files/playwright/_shared.js @@ -238,12 +238,24 @@ function skipOnOnionSibling(platform) { } async function disconnectAccount(page, account) { + const listed = page.waitForResponse( + (response) => response.request().method() === "GET" && new URL(response.url()).pathname === "/api/v1/accounts", + { timeout: resolveTimeout(60_000) }, + ); await gotoOnion(page, `${env.appBaseUrl}/accounts`, { waitUntil: "domcontentloaded" }); - await expect(page.getByRole("heading", { name: /connected accounts/i })).toBeVisible({ timeout: resolveTimeout(60_000) }); - const actions = mastodonChannelActions(page, account); - if (!(await actions.isVisible())) { + const response = await listed; + expect(response.ok(), `${account.handle}: OpenPost must list the workspace accounts, got HTTP ${response.status()}`).toBeTruthy(); + const username = account.handle.replace(/^@/, "").toLowerCase(); + const connected = (await response.json()).some( + (entry) => entry.platform === "mastodon" && String(entry.account_username).replace(/^@/, "").toLowerCase() === username, + ); + if (!connected) { return; } + const actions = mastodonChannelActions(page, account); + await expect(actions, `${account.handle}: the connected account must offer its actions`).toBeVisible({ + timeout: resolveTimeout(60_000), + }); await actions.click(); await page.getByRole("menuitem", { name: /remove connection/i }).click(); const confirm = page.getByRole("alertdialog").or(page.getByRole("dialog")).first(); From 1e93061afd0d7af82c36cbf83b5d5e81f348e4f3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:36 +0100 Subject: [PATCH 376/554] fix(web-app-openpost): forward OpenPost's cookie Echo routes as plain HTTP with a matching origin --- .../web-app-openpost/templates/proxy.conf.j2 | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 roles/web-app-openpost/templates/proxy.conf.j2 diff --git a/roles/web-app-openpost/templates/proxy.conf.j2 b/roles/web-app-openpost/templates/proxy.conf.j2 new file mode 100644 index 0000000000..964ae5bc3a --- /dev/null +++ b/roles/web-app-openpost/templates/proxy.conf.j2 @@ -0,0 +1,54 @@ +{% set application_id = front_proxy_application_id | default(application_id) %} +{% set domain = front_proxy_domain | default(domain) %} +server +{ + server_name {{ domain }}; + {% include 'roles/sys-svc-proxy/templates/cdn.conf.j2' %} + {% include 'roles/sys-svc-proxy/templates/headers/buffers.conf.j2' %} + + {% if lookup('sso', application_id, 'is_proxy_gated') %} + {% include 'roles/web-app-keycloak/templates/sso_proxy/endpoint.conf.j2'%} + {% endif %} + + {% include 'roles/sys-front-inj-all/templates/server.conf.j2'%} + + {% if webserver_extra_configuration is defined %} + {{ webserver_extra_configuration }} + {% endif %} + + {% include 'roles/sys-front-tls/templates/nginx_ssl_header.j2' %} + + {% set _issuer_host = OIDC.URL | urlsplit('hostname') %} + {% if lookup('domain', application_id) == _issuer_host and domain != _issuer_host %} + location / { + return 302 {{ OIDC.URL }}$request_uri; + } + + {% elif lookup('network_handover', application_id, domain) %} + {% include 'roles/sys-svc-proxy/templates/location/handover.conf.j2' %} + + {% else %} + {% set _echo_session_origin %} + set $openpost_origin $http_origin; + if ($http_origin = "https://$host") { + set $openpost_origin "http://$host"; + } + proxy_set_header Origin $openpost_origin; + {% endset %} + {% with sso_proxy_enabled = lookup('sso', application_id, 'is_proxy_gated'), + location = '~ "^/api/v1/(media/(upload|batch-upload|metadata|upload-session/[^/]+/content)|auth/profile/avatar|admin/backup(/.*)?)$"', + proxy_x_forwarded_proto = 'http', + webserver_location_extra_configuration = _echo_session_origin %} + {% include 'roles/sys-svc-proxy/templates/location/html.conf.j2' %} + {% endwith %} + + {% include 'roles/sys-svc-proxy/templates/location/sso_acl.conf.j2' %} + {% endif %} + + {% include 'roles/web-app-prometheus/templates/nginx/locations.conf.j2' %} + + {% include 'roles/web-svc-seaweedfs/templates/nginx/locations.conf.j2' %} + + {% include 'roles/sys-svc-proxy/templates/mcp/vhost.conf.j2' %} + +} From 7887e70909c2fe8761bc30a829867372dd0917af Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:37 +0100 Subject: [PATCH 377/554] test(web-app-openpost): cover the Echo route location of the OpenPost vhost --- .../test_proxy_echo_origin.py | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py diff --git a/tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py b/tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py new file mode 100644 index 0000000000..3e758f8ca5 --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py @@ -0,0 +1,122 @@ +from __future__ import annotations + +import re +import unittest +from urllib.parse import urlsplit + +from jinja2 import ( + ChoiceLoader, + DictLoader, + Environment, + FileSystemLoader, + StrictUndefined, + select_autoescape, +) + +from utils.cache.files import PROJECT_ROOT + +PROXY_TEMPLATE = "roles/web-app-openpost/templates/proxy.conf.j2" +DOMAIN = "publish.example.test" +LOCATION_STUB = "LOCATION[{{ location }}]PROTO[{{ proxy_x_forwarded_proto | default('$scheme') }}]EXTRA[{{ webserver_location_extra_configuration | default('') }}]END" +STUBS = { + "roles/sys-svc-proxy/templates/cdn.conf.j2": "", + "roles/sys-svc-proxy/templates/headers/buffers.conf.j2": "", + "roles/web-app-keycloak/templates/sso_proxy/endpoint.conf.j2": "", + "roles/sys-front-inj-all/templates/server.conf.j2": "", + "roles/sys-front-tls/templates/nginx_ssl_header.j2": "", + "roles/sys-svc-proxy/templates/location/handover.conf.j2": "HANDOVER", + "roles/sys-svc-proxy/templates/location/sso_acl.conf.j2": "SSO_ACL", + "roles/sys-svc-proxy/templates/location/html.conf.j2": LOCATION_STUB, + "roles/web-app-prometheus/templates/nginx/locations.conf.j2": "", + "roles/web-svc-seaweedfs/templates/nginx/locations.conf.j2": "", + "roles/sys-svc-proxy/templates/mcp/vhost.conf.j2": "", +} +ECHO_ROUTES = ( + "/api/v1/media/upload", + "/api/v1/media/batch-upload", + "/api/v1/media/metadata", + "/api/v1/media/upload-session/0b6f/content", + "/api/v1/auth/profile/avatar", + "/api/v1/admin/backup", + "/api/v1/admin/backup/restore/upload", + "/api/v1/admin/backup/restore-points/nightly", +) +HUMA_ROUTES = ( + "/api/v1/media/upload-session", + "/api/v1/media/upload-session/0b6f/complete", + "/api/v1/media", + "/api/v1/accounts", + "/api/v1/publications", + "/media/0b6f", +) + + +def _render() -> str: + """Render the OpenPost vhost with stubbed includes and lookups. + + Returns: + The rendered vhost text. + """ + env = Environment( + autoescape=select_autoescape(default=False, default_for_string=False), + undefined=StrictUndefined, + loader=ChoiceLoader([DictLoader(STUBS), FileSystemLoader(str(PROJECT_ROOT))]), + ) + env.filters["urlsplit"] = lambda value, part: getattr(urlsplit(value), part) + answers = {"sso": False, "domain": DOMAIN, "network_handover": False} + env.globals["lookup"] = lambda name, *_args, **_kwargs: answers[name] + return env.get_template(PROXY_TEMPLATE).render( + application_id="web-app-openpost", + domain=DOMAIN, + OIDC={"URL": "https://auth.example.test/realms/main"}, + ) + + +def _echo_location(rendered: str) -> tuple[str, str, str]: + """Return the location, forwarded proto and extra block of the Echo location. + + Args: + rendered: the rendered vhost text. + + Returns: + The location argument, the X-Forwarded-Proto value and the extra configuration. + """ + found = re.findall( + r"LOCATION\[(.*?)\]PROTO\[(.*?)\]EXTRA\[(.*?)\]END", rendered, re.DOTALL + ) + if len(found) != 1: + raise AssertionError(f"expected one Echo location, found {len(found)}") + return found[0] + + +class TestProxyEchoOrigin(unittest.TestCase): + def test_the_echo_location_matches_every_cookie_echo_route_and_no_huma_route( + self, + ) -> None: + location, _, _ = _echo_location(_render()) + modifier, quoted = location.split(" ", 1) + self.assertEqual(modifier, "~") + pattern = re.compile(quoted.strip('"')) + for route in ECHO_ROUTES: + self.assertRegex(route, pattern) + for route in HUMA_ROUTES: + self.assertNotRegex(route, pattern) + + def test_the_echo_location_forwards_plain_http(self) -> None: + _, proto, _ = _echo_location(_render()) + self.assertEqual(proto, "http") + + def test_the_echo_location_downgrades_only_its_own_https_origin(self) -> None: + _, _, extra = _echo_location(_render()) + self.assertIn('if ($http_origin = "https://$host") {', extra) + self.assertIn('set $openpost_origin "http://$host";', extra) + self.assertIn("proxy_set_header Origin $openpost_origin;", extra) + + def test_the_regular_locations_stay_in_place(self) -> None: + rendered = _render() + self.assertIn("SSO_ACL", rendered) + self.assertNotIn("HANDOVER", rendered) + + +if __name__ == "__main__": + unittest.main() From 6898d939617eb20c739e647eeb518586ee6a188c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:37 +0100 Subject: [PATCH 378/554] docs(web-app-openpost): document dropped routes and the Echo scheme workaround --- roles/web-app-openpost/Administration.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index f6c9085ac1..92c5fc1aca 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -168,7 +168,8 @@ applications: | `mode` | `review` creates an unscheduled draft; `auto` publishes immediately. New routes start in `review`. | | `attribution` | Template per network with `{text}` and `{source_url}`; `default` covers networks without their own entry. | -The deploy validates every route against OpenPost and fails with the route name and the field when a platform is unknown, a token is missing or a target is not connected. +A route is left out of the deployed configuration while the OpenPost service of its `source.platform` (`services.mastodon`, `services.pixelfed` or `services.peertube`) is disabled, for example PeerTube on an onion-only deployment, since PeerTube refuses the onion. +The deploy validates every remaining route against OpenPost and fails with the route name and the field when a platform is unknown, a token is missing or a target is not connected. Connect the target accounts and create the Social Set in OpenPost before adding the route. On the CI rounds with the provider simulator the routes carry no token: the deploy mints read tokens on the local instances, connects the local Mastodon account and creates the empty Social Sets that the CLI probe fills. @@ -230,6 +231,7 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo | Bluesky is also reachable without OpenPost through `web-app-bridgy-fed`. | Use the bridge for automatic federation and OpenPost for deliberate Bluesky-native posts. | | OpenPost connects PeerTube only through the OAuth password grant, and PeerTube accounts that sign in through Keycloak have no local password. | Connect a local PeerTube account: the `root` account, which a fresh `web-app-peertube` instance creates with the first 50 characters of the platform administrator's password, or one the PeerTube administrator creates for publishing. PeerTube then asks for the channel each video goes to. | | Sibling Fediverse instances are reachable only over TLS on port 443. | Keep TLS enabled for `web-app-mastodon`, `web-app-pixelfed` and `web-app-peertube`. | +| OpenPost's media upload, avatar upload and instance backup routes believe `X-Forwarded-Proto` only from loopback, link-local or private peers, unlike the rest of its API, which follows `OPENPOST_TRUSTED_PROXY_CIDRS`. Behind the shared proxy on the role subnet `192.88.99.0/24` they take an HTTPS session for plain HTTP and refuse it as cross-site (HTTP 403 `cross-site session request rejected`) whenever media stays in the role volume. | The role's own vhost (`templates/proxy.conf.j2`) forwards exactly those routes as plain HTTP and rewrites the browser's own `https://` origin to `http://`, so both sides agree in compose and swarm; OpenPost still compares the origin's host. | ## Data processing and dependencies From 8841a5cc081014c505e157a273c4565279877716 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:37 +0100 Subject: [PATCH 379/554] chore(web-app-openpost): pin OpenPost v7.41.6 --- roles/web-app-openpost/meta/services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index 44036863d9..a47a9c3430 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -65,7 +65,7 @@ openpost: swarm: enabled: true image: ghcr.io/getopenpost/openpost - version: "v7.37.2" + version: "v7.41.6" update: type: registry_tags image: ghcr.io/getopenpost/openpost From 388b9115e4f5c72639f5214c8bedd6fa18f90d10 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 16 Nov 2026 10:10:37 +0100 Subject: [PATCH 380/554] docs(requirements): 035 names the pinned OpenPost v7.41.6 --- docs/requirements/035-mcp-proxy-expansion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements/035-mcp-proxy-expansion.md b/docs/requirements/035-mcp-proxy-expansion.md index e7ecbad347..869b8d503b 100644 --- a/docs/requirements/035-mcp-proxy-expansion.md +++ b/docs/requirements/035-mcp-proxy-expansion.md @@ -51,7 +51,7 @@ An upstream path exists or is claimed, and something concrete stops it here. Eac | `web-app-erpnext` | `version_unverified` | The Frappe MCP component is experimental and unverified against the pinned Frappe v16. | | `web-app-matomo` | `unreviewed_third_party` | The project-owned plugin is unaudited: endpoint, transport, auth and tool scope are unverified in source. | | `web-app-odoo` | `unreviewed_third_party` | Neither Odoo SA nor the OCA publishes a server; the leading third party carries 197 of 231 commits from one author, keeps its access control in a separate Odoo Apps store module outside any pinnable tag, and defaults to a mutating tool scope. | -| `web-app-openpost` | `version_unverified` | The pinned v7.37.2 serves a native `/mcp` endpoint, but its tool list, client registration and publishing side effects on external networks are not audited against that release. | +| `web-app-openpost` | `version_unverified` | The pinned v7.41.6 serves a native `/mcp` endpoint, but its tool list, client registration and publishing side effects on external networks are not audited against that release. | | `web-app-penpot` | `interactive_browser_session` | The server needs an active browser tab and plugin connection, and can execute powerful design-context operations. | | `web-app-shopware` | `version_unverified` | The pinned 6.7.8.2 predates the experimental native `/api/_mcp` server. | From 912656d91e13c347275dc6e90c114d6966f57c19 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:00:40 +0100 Subject: [PATCH 381/554] fix(web-app-openpost): add the Echo routes location as a vhost extra --- .../templates/nginx/echo_routes.conf.j2 | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 roles/web-app-openpost/templates/nginx/echo_routes.conf.j2 diff --git a/roles/web-app-openpost/templates/nginx/echo_routes.conf.j2 b/roles/web-app-openpost/templates/nginx/echo_routes.conf.j2 new file mode 100644 index 0000000000..c5fde8569f --- /dev/null +++ b/roles/web-app-openpost/templates/nginx/echo_routes.conf.j2 @@ -0,0 +1,11 @@ +{% set sso_proxy_enabled = lookup('sso', application_id, 'is_proxy_gated') %} +{% set location = '~ "^/api/v1/(media/(upload|batch-upload|metadata|upload-session/[^/]+/content)|auth/profile/avatar|admin/backup(/.*)?)$"' %} +{% set proxy_x_forwarded_proto = 'http' %} +{% set webserver_location_extra_configuration %} + set $openpost_origin $http_origin; + if ($http_origin = "https://$host") { + set $openpost_origin "http://$host"; + } + proxy_set_header Origin $openpost_origin; +{% endset %} +{% include 'roles/sys-svc-proxy/templates/location/html.conf.j2' %} From 245c61e0ced0c0388fa715f453a802b56e6f26c8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 382/554] refactor(web-app-openpost): drop the copied vhost in favour of the shared flavour --- .../web-app-openpost/templates/proxy.conf.j2 | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 roles/web-app-openpost/templates/proxy.conf.j2 diff --git a/roles/web-app-openpost/templates/proxy.conf.j2 b/roles/web-app-openpost/templates/proxy.conf.j2 deleted file mode 100644 index 964ae5bc3a..0000000000 --- a/roles/web-app-openpost/templates/proxy.conf.j2 +++ /dev/null @@ -1,54 +0,0 @@ -{% set application_id = front_proxy_application_id | default(application_id) %} -{% set domain = front_proxy_domain | default(domain) %} -server -{ - server_name {{ domain }}; - {% include 'roles/sys-svc-proxy/templates/cdn.conf.j2' %} - {% include 'roles/sys-svc-proxy/templates/headers/buffers.conf.j2' %} - - {% if lookup('sso', application_id, 'is_proxy_gated') %} - {% include 'roles/web-app-keycloak/templates/sso_proxy/endpoint.conf.j2'%} - {% endif %} - - {% include 'roles/sys-front-inj-all/templates/server.conf.j2'%} - - {% if webserver_extra_configuration is defined %} - {{ webserver_extra_configuration }} - {% endif %} - - {% include 'roles/sys-front-tls/templates/nginx_ssl_header.j2' %} - - {% set _issuer_host = OIDC.URL | urlsplit('hostname') %} - {% if lookup('domain', application_id) == _issuer_host and domain != _issuer_host %} - location / { - return 302 {{ OIDC.URL }}$request_uri; - } - - {% elif lookup('network_handover', application_id, domain) %} - {% include 'roles/sys-svc-proxy/templates/location/handover.conf.j2' %} - - {% else %} - {% set _echo_session_origin %} - set $openpost_origin $http_origin; - if ($http_origin = "https://$host") { - set $openpost_origin "http://$host"; - } - proxy_set_header Origin $openpost_origin; - {% endset %} - {% with sso_proxy_enabled = lookup('sso', application_id, 'is_proxy_gated'), - location = '~ "^/api/v1/(media/(upload|batch-upload|metadata|upload-session/[^/]+/content)|auth/profile/avatar|admin/backup(/.*)?)$"', - proxy_x_forwarded_proto = 'http', - webserver_location_extra_configuration = _echo_session_origin %} - {% include 'roles/sys-svc-proxy/templates/location/html.conf.j2' %} - {% endwith %} - - {% include 'roles/sys-svc-proxy/templates/location/sso_acl.conf.j2' %} - {% endif %} - - {% include 'roles/web-app-prometheus/templates/nginx/locations.conf.j2' %} - - {% include 'roles/web-svc-seaweedfs/templates/nginx/locations.conf.j2' %} - - {% include 'roles/sys-svc-proxy/templates/mcp/vhost.conf.j2' %} - -} From 3b89e1a8f4eb974eb6986c1eb5e7bb4a2247c164 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 383/554] fix(web-app-openpost): hand the Echo routes location to the vhost next to the registration guard --- roles/web-app-openpost/tasks/00_core.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/tasks/00_core.yml b/roles/web-app-openpost/tasks/00_core.yml index e2c79d0139..e88f29b6b0 100644 --- a/roles/web-app-openpost/tasks/00_core.yml +++ b/roles/web-app-openpost/tasks/00_core.yml @@ -39,8 +39,9 @@ vars: compose_handlers_flush: false webserver_extra_configuration: >- - {{ lookup('file', lookup('path_absolute', 'roles/web-app-openpost/files/nginx/deny-password-registration.conf')) - if OPENPOST_OIDC_ENABLED | bool else '' }} + {{ lookup('template', 'nginx/echo_routes.conf.j2') + ~ (lookup('file', lookup('path_absolute', 'roles/web-app-openpost/files/nginx/deny-password-registration.conf')) + if OPENPOST_OIDC_ENABLED | bool else '') }} - name: "📄 Render the egress relay config (local + swarm peers)" ansible.builtin.include_tasks: From 8caa3321afbf6f217936e7c5809a030843f5fc63 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 384/554] test(web-app-openpost): drop the copied-vhost render test --- .../test_proxy_echo_origin.py | 122 ------------------ 1 file changed, 122 deletions(-) delete mode 100644 tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py diff --git a/tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py b/tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py deleted file mode 100644 index 3e758f8ca5..0000000000 --- a/tests/unit/python/roles/web-app-openpost/test_proxy_echo_origin.py +++ /dev/null @@ -1,122 +0,0 @@ -from __future__ import annotations - -import re -import unittest -from urllib.parse import urlsplit - -from jinja2 import ( - ChoiceLoader, - DictLoader, - Environment, - FileSystemLoader, - StrictUndefined, - select_autoescape, -) - -from utils.cache.files import PROJECT_ROOT - -PROXY_TEMPLATE = "roles/web-app-openpost/templates/proxy.conf.j2" -DOMAIN = "publish.example.test" -LOCATION_STUB = "LOCATION[{{ location }}]PROTO[{{ proxy_x_forwarded_proto | default('$scheme') }}]EXTRA[{{ webserver_location_extra_configuration | default('') }}]END" -STUBS = { - "roles/sys-svc-proxy/templates/cdn.conf.j2": "", - "roles/sys-svc-proxy/templates/headers/buffers.conf.j2": "", - "roles/web-app-keycloak/templates/sso_proxy/endpoint.conf.j2": "", - "roles/sys-front-inj-all/templates/server.conf.j2": "", - "roles/sys-front-tls/templates/nginx_ssl_header.j2": "", - "roles/sys-svc-proxy/templates/location/handover.conf.j2": "HANDOVER", - "roles/sys-svc-proxy/templates/location/sso_acl.conf.j2": "SSO_ACL", - "roles/sys-svc-proxy/templates/location/html.conf.j2": LOCATION_STUB, - "roles/web-app-prometheus/templates/nginx/locations.conf.j2": "", - "roles/web-svc-seaweedfs/templates/nginx/locations.conf.j2": "", - "roles/sys-svc-proxy/templates/mcp/vhost.conf.j2": "", -} -ECHO_ROUTES = ( - "/api/v1/media/upload", - "/api/v1/media/batch-upload", - "/api/v1/media/metadata", - "/api/v1/media/upload-session/0b6f/content", - "/api/v1/auth/profile/avatar", - "/api/v1/admin/backup", - "/api/v1/admin/backup/restore/upload", - "/api/v1/admin/backup/restore-points/nightly", -) -HUMA_ROUTES = ( - "/api/v1/media/upload-session", - "/api/v1/media/upload-session/0b6f/complete", - "/api/v1/media", - "/api/v1/accounts", - "/api/v1/publications", - "/media/0b6f", -) - - -def _render() -> str: - """Render the OpenPost vhost with stubbed includes and lookups. - - Returns: - The rendered vhost text. - """ - env = Environment( - autoescape=select_autoescape(default=False, default_for_string=False), - undefined=StrictUndefined, - loader=ChoiceLoader([DictLoader(STUBS), FileSystemLoader(str(PROJECT_ROOT))]), - ) - env.filters["urlsplit"] = lambda value, part: getattr(urlsplit(value), part) - answers = {"sso": False, "domain": DOMAIN, "network_handover": False} - env.globals["lookup"] = lambda name, *_args, **_kwargs: answers[name] - return env.get_template(PROXY_TEMPLATE).render( - application_id="web-app-openpost", - domain=DOMAIN, - OIDC={"URL": "https://auth.example.test/realms/main"}, - ) - - -def _echo_location(rendered: str) -> tuple[str, str, str]: - """Return the location, forwarded proto and extra block of the Echo location. - - Args: - rendered: the rendered vhost text. - - Returns: - The location argument, the X-Forwarded-Proto value and the extra configuration. - """ - found = re.findall( - r"LOCATION\[(.*?)\]PROTO\[(.*?)\]EXTRA\[(.*?)\]END", rendered, re.DOTALL - ) - if len(found) != 1: - raise AssertionError(f"expected one Echo location, found {len(found)}") - return found[0] - - -class TestProxyEchoOrigin(unittest.TestCase): - def test_the_echo_location_matches_every_cookie_echo_route_and_no_huma_route( - self, - ) -> None: - location, _, _ = _echo_location(_render()) - modifier, quoted = location.split(" ", 1) - self.assertEqual(modifier, "~") - pattern = re.compile(quoted.strip('"')) - for route in ECHO_ROUTES: - self.assertRegex(route, pattern) - for route in HUMA_ROUTES: - self.assertNotRegex(route, pattern) - - def test_the_echo_location_forwards_plain_http(self) -> None: - _, proto, _ = _echo_location(_render()) - self.assertEqual(proto, "http") - - def test_the_echo_location_downgrades_only_its_own_https_origin(self) -> None: - _, _, extra = _echo_location(_render()) - self.assertIn('if ($http_origin = "https://$host") {', extra) - self.assertIn('set $openpost_origin "http://$host";', extra) - self.assertIn("proxy_set_header Origin $openpost_origin;", extra) - - def test_the_regular_locations_stay_in_place(self) -> None: - rendered = _render() - self.assertIn("SSO_ACL", rendered) - self.assertNotIn("HANDOVER", rendered) - - -if __name__ == "__main__": - unittest.main() From 0a57de5420a2fea69cfbb4e9d91a5c9c4de39321 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 385/554] test(web-app-openpost): add the templates test package --- tests/unit/python/roles/web-app-openpost/templates/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/python/roles/web-app-openpost/templates/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/templates/__init__.py b/tests/unit/python/roles/web-app-openpost/templates/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 27b92e541c252e59cbcfc6e33aa3515ea2b7f377 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 386/554] test(web-app-openpost): render the Echo routes location through html.conf.j2 and the vhost extras --- .../templates/test_echo_routes.py | 228 ++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 tests/unit/python/roles/web-app-openpost/templates/test_echo_routes.py diff --git a/tests/unit/python/roles/web-app-openpost/templates/test_echo_routes.py b/tests/unit/python/roles/web-app-openpost/templates/test_echo_routes.py new file mode 100644 index 0000000000..e949b7256a --- /dev/null +++ b/tests/unit/python/roles/web-app-openpost/templates/test_echo_routes.py @@ -0,0 +1,228 @@ +from __future__ import annotations + +import re +import tempfile +import unittest +from pathlib import Path + +from ansible.parsing.dataloader import DataLoader +from ansible.template import Templar, trust_as_template +from jinja2 import ( + ChoiceLoader, + DictLoader, + Environment, + FileSystemLoader, + StrictUndefined, + select_autoescape, +) + +from utils.cache.files import PROJECT_ROOT +from utils.cache.yaml import load_yaml_any +from utils.networks.proxy import render_proxy_pass + +ROLE_DIR = PROJECT_ROOT / "roles/web-app-openpost" +TEMPLATE = "roles/web-app-openpost/templates/nginx/echo_routes.conf.j2" +DOMAIN = "publish.example.test" +LOCAL_HTTP_PORT = 8106 + +STUBBED_INCLUDES = { + "roles/web-app-keycloak/templates/sso_proxy/following_directives.conf.j2": "SSO_GATE\n", + "roles/sys-svc-proxy/templates/headers/content_security_policy.conf.j2": "", + "roles/sys-svc-proxy/templates/headers/access_control_allow.conf.j2": "", + "roles/sys-svc-proxy/templates/headers/untrusted_identity_strips.conf.j2": "", + "roles/sys-front-inj-all/templates/location.lua.j2": "", +} + +ECHO_ROUTES = ( + "/api/v1/media/upload", + "/api/v1/media/batch-upload", + "/api/v1/media/metadata", + "/api/v1/media/upload-session/0b6f/content", + "/api/v1/auth/profile/avatar", + "/api/v1/admin/backup", + "/api/v1/admin/backup/export", + "/api/v1/admin/backup/restore/upload", + "/api/v1/admin/backup/restore-points/nightly", +) +OTHER_ROUTES = ( + "/", + "/api/v1/media", + "/api/v1/media/upload-session", + "/api/v1/media/upload-session/0b6f/complete", + "/api/v1/media/uploads", + "/api/v1/accounts", + "/api/v1/publications", + "/api/v1/admin/backups", + "/media/0b6f", +) + + +def stub_lookup(deployment_mode: str, proxy_gated: bool): + """Return a `lookup` that answers what the location template asks for. + + Args: + deployment_mode: the mode `proxy_pass` renders for. + proxy_gated: what `lookup('sso', ..., 'is_proxy_gated')` answers. + """ + tls = {"protocols.web": "https", "ports.web": 443, "enabled": True} + + def lookup(kind, *args, **kwargs): + if kind == "sso": + return proxy_gated + if kind == "config": + return args[2] + if kind == "network_handover": + return False + if kind == "tls": + return tls[args[1]] + if kind == "proxy_pass": + return render_proxy_pass( + f"127.0.0.1:{kwargs['local_port']}", + deployment_mode, + tail=kwargs["tail"], + ) + raise AssertionError(f"unexpected lookup({kind!r}, ...)") + + return lookup + + +def render(deployment_mode: str = "compose", proxy_gated: bool = False) -> str: + """Render the location the OpenPost vhost carries for its Echo routes. + + Args: + deployment_mode: the mode `proxy_pass` renders for. + proxy_gated: whether the application sits behind the SSO proxy gate. + """ + env = Environment( + loader=ChoiceLoader( + [DictLoader(STUBBED_INCLUDES), FileSystemLoader(str(PROJECT_ROOT))] + ), + undefined=StrictUndefined, + autoescape=select_autoescape(), + trim_blocks=True, + ) + env.filters["bool"] = lambda value: ( + value + if isinstance(value, bool) + else str(value).strip().lower() in {"true", "1", "yes", "on"} + ) + env.filters["on_off"] = lambda value: "on" if value else "off" + env.filters["entity_name"] = lambda value: value.rsplit("-", 1)[-1] + return env.get_template(TEMPLATE).render( + application_id="web-app-openpost", + domain=DOMAIN, + http_port=LOCAL_HTTP_PORT, + lookup=stub_lookup(deployment_mode, proxy_gated), + ) + + +def location_block(rendered: str) -> tuple[str, list[str]]: + """Return the matcher and the directives, one per line, of the only location. + + Args: + rendered: the rendered fragment. + """ + blocks = re.findall( + r"^location\s+([^{\n]+?)\s*\{((?:[^{}]|\{[^{}]*\})*)\}", rendered, re.MULTILINE + ) + if len(blocks) != 1: + raise AssertionError(f"expected one location, rendered:\n{rendered}") + matcher, body = blocks[0] + return matcher.strip(), [line.strip() for line in body.splitlines() if line.strip()] + + +def matcher_pattern(matcher: str) -> re.Pattern[str]: + """Return the regular expression of a case-sensitive regex location matcher. + + Args: + matcher: the location matcher, modifier included. + """ + modifier, expression = matcher.split(" ", 1) + if modifier != "~": + raise AssertionError(f"'{matcher}' is not a case-sensitive regex location") + return re.compile(expression.strip('"')) + + +def extra_configuration(oidc_enabled: bool) -> str: + """Evaluate the vhost extras `tasks/00_core.yml` hands to `sys-stk-full`. + + Args: + oidc_enabled: the resolved `OPENPOST_OIDC_ENABLED`. + """ + task = next( + task + for task in load_yaml_any(ROLE_DIR / "tasks/00_core.yml") + if "vars" in task and "webserver_extra_configuration" in task["vars"] + ) + with tempfile.TemporaryDirectory() as search_path: + fragments = Path(search_path, "templates", "nginx") + fragments.mkdir(parents=True) + (fragments / "echo_routes.conf.j2").write_text( + "ECHO_ROUTES\n", encoding="utf-8" + ) + templar = Templar( + loader=DataLoader(), + variables={ + "ansible_search_path": [search_path], + "OPENPOST_OIDC_ENABLED": oidc_enabled, + }, + ) + return templar.template( + trust_as_template(task["vars"]["webserver_extra_configuration"]) + ) + + +class TestEchoRoutesLocation(unittest.TestCase): + def test_every_cookie_echo_route_is_covered(self): + matcher, _ = location_block(render()) + pattern = matcher_pattern(matcher) + for path in ECHO_ROUTES: + with self.subTest(path=path): + self.assertRegex(path, pattern) + + def test_no_other_route_is_covered(self): + matcher, _ = location_block(render()) + pattern = matcher_pattern(matcher) + for path in OTHER_ROUTES: + with self.subTest(path=path): + self.assertNotRegex(path, pattern) + + def test_the_upstream_is_told_plain_http(self): + _, directives = location_block(render()) + self.assertIn("proxy_set_header X-Forwarded-Proto http;", directives) + self.assertNotIn("proxy_set_header X-Forwarded-Proto $scheme;", directives) + + def test_only_the_vhost_own_https_origin_is_downgraded(self): + _, directives = location_block(render()) + rewrite = [ + "set $openpost_origin $http_origin;", + 'if ($http_origin = "https://$host") {', + 'set $openpost_origin "http://$host";', + "}", + "proxy_set_header Origin $openpost_origin;", + ] + start = directives.index(rewrite[0]) + self.assertEqual(directives[start : start + len(rewrite)], rewrite) + + def test_both_modes_proxy_without_a_static_uri(self): + for mode in ("compose", "swarm"): + with self.subTest(mode=mode): + _, directives = location_block(render(mode)) + proxy_pass = [d for d in directives if d.startswith("proxy_pass ")] + self.assertEqual(len(proxy_pass), 1) + self.assertRegex( + proxy_pass[0], r"^proxy_pass http://[^/;]+(\$request_uri)?;$" + ) + + def test_the_location_follows_the_application_sso_gate(self): + self.assertNotIn("SSO_GATE", render(proxy_gated=False)) + self.assertIn("SSO_GATE", render(proxy_gated=True)) + + +class TestVhostExtras(unittest.TestCase): + def test_the_echo_routes_location_reaches_the_vhost(self): + self.assertEqual(extra_configuration(False), "ECHO_ROUTES\n") + + +if __name__ == "__main__": + unittest.main() From c2688c4608ccb360c4e23a95626f74ade628e197 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 387/554] test(web-app-openpost): drop the unread PROJECT_ROOT from the test package --- tests/unit/python/roles/web-app-openpost/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/python/roles/web-app-openpost/__init__.py b/tests/unit/python/roles/web-app-openpost/__init__.py index 8ee16d7567..e69de29bb2 100644 --- a/tests/unit/python/roles/web-app-openpost/__init__.py +++ b/tests/unit/python/roles/web-app-openpost/__init__.py @@ -1,3 +0,0 @@ -from pathlib import Path - -PROJECT_ROOT: Path = Path(__file__).resolve().parents[5] From f77911efa9df9455a7001837c6619d2ca26e8a60 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 388/554] fix(web-app-openpost): build the simulator keystore with WireMock's built-in password --- roles/web-app-openpost/vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index af4e78271b..3a3e0e66db 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -89,7 +89,7 @@ OPENPOST_PROVIDER_BASE_VERSION: "{{ OPENPOST_PROVIDER.version }}" OPENPOST_PROVIDER_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" OPENPOST_PROVIDER_BROWSER_URL: "http://{{ 'host.docker.internal' if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" OPENPOST_LINKEDIN_CALLBACK: "{{ OPENPOST_URL }}/api/v1/accounts/linkedin/callback" -OPENPOST_SIMULATOR_KEYSTORE_PASSWORD: "simulator" +OPENPOST_SIMULATOR_KEYSTORE_PASSWORD: "password" OPENPOST_PROVIDER_CREDENTIALS: >- {%- set _credentials = {} -%} From 89746e8c6891915ccbf3f0f952135cf65b9e4b91 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 389/554] fix(web-app-openpost): start the simulator without passwords on its command line --- roles/web-app-openpost/templates/compose.yml.j2 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/roles/web-app-openpost/templates/compose.yml.j2 b/roles/web-app-openpost/templates/compose.yml.j2 index e811e01644..4810038e99 100644 --- a/roles/web-app-openpost/templates/compose.yml.j2 +++ b/roles/web-app-openpost/templates/compose.yml.j2 @@ -55,10 +55,6 @@ - "{{ lookup('volume', application_id, 'simulator_keystore').target }}" - --keystore-type - PKCS12 - - --keystore-password - - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" # nocheck: compose-argv-secret fixed literal of the CI-only WireMock keystore around a throwaway self-signed key; WireMock reads it only as a flag - - --key-manager-password - - "{{ OPENPOST_SIMULATOR_KEYSTORE_PASSWORD }}" # nocheck: compose-argv-secret same keystore literal - --disable-banner {{ lookup('container_volumes', service_name) | indent(4) }} {{ lookup('container_networks', aliases=OPENPOST_SIMULATOR_HOSTS) | indent(4) }} From 9ebb8ea8a924668ae669075654ec1d293ae74e49 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 390/554] chore(web-app-openpost): pin nginx 1.31.8-alpine with upstream's CVE suppression and python 3.13.18-slim --- roles/web-app-openpost/meta/services.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index a47a9c3430..bafef8c487 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -104,7 +104,7 @@ relay: swarm: enabled: true image: nginx - version: 1.31.7-alpine + version: 1.31.8-alpine name: openpost-relay cpus: "0.2" mem_reservation: 16m @@ -114,6 +114,11 @@ relay: internal: http: 80 https: 443 + security: + suppressions: + # nocheck: cve upstream tag ships fixable CRITICAL CVEs; lift it once a rebuilt tag lands + - image_tag: "1.31.8-alpine" + until: 2026-11-30 # nocheck: playwright-service-flag CI provider simulator, covered by the role's CLI test # nocheck: dynamic-flag a test fixture switched on by one variant only; no other role's presence decides it simulator: @@ -161,7 +166,7 @@ provider: swarm: enabled: true image: python - version: 3.13.7-slim + version: 3.13.18-slim name: openpost-provider uid: 10002 cpus: "0.25" @@ -188,7 +193,7 @@ crossposter: swarm: enabled: true image: python - version: 3.13.7-slim + version: 3.13.18-slim name: openpost-crossposter uid: 10001 cpus: "0.25" From cf748d6d8ca905e1300a681d9d0f417e62fc4990 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 391/554] chore(web-app-openpost): pin psycopg 3.3.9 and Pillow 13.0.0 for the crossposter --- roles/web-app-openpost/files/crossposter/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/requirements.txt b/roles/web-app-openpost/files/crossposter/requirements.txt index 5a51fa6c8b..2398febb21 100644 --- a/roles/web-app-openpost/files/crossposter/requirements.txt +++ b/roles/web-app-openpost/files/crossposter/requirements.txt @@ -1,2 +1,2 @@ -psycopg[binary]==3.2.10 -pillow==11.3.0 +psycopg[binary]==3.3.9 +pillow==13.0.0 From 9bd8993d1bce0b2abc4eacc7658bf1a890a14887 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 392/554] refactor(web-app-openpost): import psycopg in one form in the crossposter store --- roles/web-app-openpost/files/crossposter/crossposter/store.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/store.py b/roles/web-app-openpost/files/crossposter/crossposter/store.py index fd3e9064fc..78ebf1de6c 100644 --- a/roles/web-app-openpost/files/crossposter/crossposter/store.py +++ b/roles/web-app-openpost/files/crossposter/crossposter/store.py @@ -85,10 +85,10 @@ def item_from_json(raw: dict) -> SourceItem: class Store: def __init__(self, dsn: str) -> None: - import psycopg + from psycopg import connect from psycopg.rows import dict_row - self.connection = psycopg.connect(dsn, autocommit=True, row_factory=dict_row) + self.connection = connect(dsn, autocommit=True, row_factory=dict_row) def migrate(self) -> None: for statement in SCHEMA: From 9812189f0e0befc7cbe860272159828a9c4a3200 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 393/554] test(web-app-openpost): report the last readiness error instead of passing over it --- roles/web-app-openpost/files/test/probe.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py index 7445099de2..685292a85b 100644 --- a/roles/web-app-openpost/files/test/probe.py +++ b/roles/web-app-openpost/files/test/probe.py @@ -57,15 +57,18 @@ SQLITE_PATTERNS = ( def wait_ready() -> None: + last = "no answer" while True: try: status, _ = call("GET", "/ready") + except OSError as error: + last = str(error) + else: if status == 200: return - except OSError: - pass + last = f"HTTP {status}" if time.monotonic() > DEADLINE: - sys.exit("[FAIL] OpenPost never reported ready") + sys.exit(f"[FAIL] OpenPost never reported ready: {last}") time.sleep(5) From 022fb827c46bfe3f73258aeb7a2bdc8a5787c1f4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 394/554] docs(web-app-openpost): name the Echo routes location and the simulator keystore password --- roles/web-app-openpost/Administration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 92c5fc1aca..f21868b133 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -87,6 +87,7 @@ Every callback URL has the form `https://publish./api/v1/account Variant 0 of `meta/variants.yml` starts a WireMock `simulator` on the role network that answers for X, Facebook, Instagram, YouTube and TikTok under their real API host names. Next to it runs the fake `provider`, a small stateful Python service built from `files/provider/` that plays LinkedIn on `www.linkedin.com` and `api.linkedin.com`: members sign up on `/signup`, grant OpenPost access on the consent page, and the fake keeps the tokens, images and posts it receives. The deploy signs a certificate for all those names with a per-deploy test CA in the role's config directory, OpenPost trusts that CA through `SSL_CERT_DIR`, and the role renders `simulator-` credentials instead of the `API` entries for the simulated providers. +The keystore that carries the certificate uses WireMock's built-in keystore password, so WireMock starts without any password on its command line. The fake also publishes plain HTTP on the local port of `services.provider.ports.local.http`; Playwright routes `https://www.linkedin.com/` there, and `/__fake/linkedin/posts` lists what OpenPost delivered. The mappings live in `files/simulator/openpost.json`; a post whose text contains `[simulate-429]`, `[simulate-503]` or `[simulate-400]` gets that answer from the X endpoint once. OpenPost v7.22.9 retries a 429 by itself after the reset header, but treats a 503 to a write as an ambiguous delivery: the destination stays in "Manual review required", its retry is refused, and after confirming on the network that nothing was posted the post has to be published again to that destination. @@ -231,7 +232,7 @@ A dead-lettered item stays in that state; publish the post again from the OpenPo | Bluesky is also reachable without OpenPost through `web-app-bridgy-fed`. | Use the bridge for automatic federation and OpenPost for deliberate Bluesky-native posts. | | OpenPost connects PeerTube only through the OAuth password grant, and PeerTube accounts that sign in through Keycloak have no local password. | Connect a local PeerTube account: the `root` account, which a fresh `web-app-peertube` instance creates with the first 50 characters of the platform administrator's password, or one the PeerTube administrator creates for publishing. PeerTube then asks for the channel each video goes to. | | Sibling Fediverse instances are reachable only over TLS on port 443. | Keep TLS enabled for `web-app-mastodon`, `web-app-pixelfed` and `web-app-peertube`. | -| OpenPost's media upload, avatar upload and instance backup routes believe `X-Forwarded-Proto` only from loopback, link-local or private peers, unlike the rest of its API, which follows `OPENPOST_TRUSTED_PROXY_CIDRS`. Behind the shared proxy on the role subnet `192.88.99.0/24` they take an HTTPS session for plain HTTP and refuse it as cross-site (HTTP 403 `cross-site session request rejected`) whenever media stays in the role volume. | The role's own vhost (`templates/proxy.conf.j2`) forwards exactly those routes as plain HTTP and rewrites the browser's own `https://` origin to `http://`, so both sides agree in compose and swarm; OpenPost still compares the origin's host. | +| OpenPost's media upload, avatar upload and instance backup routes believe `X-Forwarded-Proto` only from loopback, link-local or private peers, unlike the rest of its API, which follows `OPENPOST_TRUSTED_PROXY_CIDRS`. Behind the shared proxy on the role subnet `192.88.99.0/24` they take an HTTPS session for plain HTTP and refuse it as cross-site (HTTP 403 `cross-site session request rejected`) whenever media stays in the role volume. | The role adds one location for exactly those routes to its vhost (`templates/nginx/echo_routes.conf.j2`). It forwards them as plain HTTP and rewrites the browser's own `https://` origin to `http://`, so both sides agree in compose and swarm; OpenPost still compares the origin's host. | ## Data processing and dependencies From 6a7d76a5cec13c53aeb0b5e41a253a9a4e18136d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 395/554] docs(requirements): 062 ticks the README criterion against the generated Cosmos diagram --- docs/requirements/062-web-app-openpost.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements/062-web-app-openpost.md b/docs/requirements/062-web-app-openpost.md index c0c83bd249..428fc8786b 100644 --- a/docs/requirements/062-web-app-openpost.md +++ b/docs/requirements/062-web-app-openpost.md @@ -275,7 +275,7 @@ simulator: ### Role documentation -- [ ] `README.md` follows the [role README rules](../contributing/artefact/files/role/readme_md.md), including the Cosmos diagram with the relay, and states the image and bump policy, the egress relay, the SSO model and the telemetry defaults. +- [x] `README.md` follows the [role README rules](../contributing/artefact/files/role/readme_md.md) and states the image and bump policy, the egress relay, the SSO model and the telemetry defaults; `meta/services.yml` declares the `relay` entity that the documentation build draws into the role's Cosmos diagram. - [ ] This requirement is cross-linked from the implementing pull request and from the OpenProject work item. ## Validation Apps From b231032be678fb8be2084ee2478a377a476252ad Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 17 Nov 2026 18:05:09 +0100 Subject: [PATCH 396/554] docs(requirements): 063 ticks the criteria verified in code and unit tests --- docs/requirements/063-openpost-crossposter.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/requirements/063-openpost-crossposter.md b/docs/requirements/063-openpost-crossposter.md index c27b1a3052..1beb81ff35 100644 --- a/docs/requirements/063-openpost-crossposter.md +++ b/docs/requirements/063-openpost-crossposter.md @@ -129,7 +129,7 @@ crossposter: ### Packaging and lifecycle -- [ ] The `crossposter` entity is built from `files/crossposter/Dockerfile` on a Python base image pinned in `meta/services.yml` and passed as an `ARG` without default, and it runs as a non-root user. +- [x] The `crossposter` entity is built from `files/crossposter/Dockerfile` on a Python base image pinned in `meta/services.yml` and passed as an `ARG` without default, and it runs as a non-root user. - [ ] Its container healthcheck works on the slim base image without extra binaries. - [ ] The entity is enabled only when at least one route is configured, and the role deploys green with and without it in compose and swarm. - [ ] A second crossposter instance neither polls nor publishes while the first holds the Postgres advisory lock. @@ -139,7 +139,7 @@ crossposter: ### Configuration - [ ] Routes are read from `services.crossposter.routes`, and an invalid route (unknown platform, missing token, unknown target) fails the deploy with a message naming the route and the field. -- [ ] Source tokens come from the vault-encrypted inventory and reach the container as files, never as environment variables. +- [x] Source tokens come from the vault-encrypted inventory and reach the container as files, never as environment variables. ### Detection @@ -180,7 +180,7 @@ crossposter: ### Tests -- [ ] Unit tests under `tests/unit/python/roles/web-app-openpost/files/crossposter/` cover length counting, adaptation, routing filters, the idempotency key, backoff timing and the state machine with fixtures recorded from Mastodon, Pixelfed and PeerTube responses. +- [x] Unit tests under `tests/unit/python/roles/web-app-openpost/files/crossposter/` cover length counting, adaptation, routing filters, the idempotency key, backoff timing and the state machine with fixtures recorded from Mastodon, Pixelfed and PeerTube responses. - [ ] The CLI test posts as a test user on the local Mastodon, Pixelfed and PeerTube instances and asserts within a bounded time exactly one OpenPost publication per route, one delivered post on the local Fediverse target, and the expected simulator requests for X, Facebook, Instagram and YouTube. - [ ] The CLI test asserts review mode (draft without delivery), the opt-out hashtag, loop prevention, restart without duplicates, and no forwarding of existing posts on route activation. - [ ] The CLI test lets the simulator answer 503 before succeeding and asserts one delivery, then forces a permanent failure and asserts the dead-letter state and that the platform mail server accepted the notification for the configured recipients. @@ -201,8 +201,8 @@ crossposter: ### Documentation -- [ ] `Administration.md` documents the route schema with examples, the review and auto modes, the opt-out hashtag, the attribution templates and their X cost impact, token creation per source platform, and the handling of dead-lettered items. -- [ ] `README.md` lists automated crossposting under Features and shows the crossposter in the Cosmos diagram. +- [x] `Administration.md` documents the route schema with examples, the review and auto modes, the opt-out hashtag, the attribution templates and their X cost impact, token creation per source platform, and the handling of dead-lettered items. +- [x] `README.md` lists automated crossposting under Features, and `meta/services.yml` declares the `crossposter` entity that the documentation build draws into the role's Cosmos diagram. - [ ] This requirement is cross-linked from the implementing pull request and from the OpenProject work item. ## Out of Scope From d8bf1682ed7245c96b63db9daf0d86e96d24d2bb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 18 Nov 2026 09:54:59 +0100 Subject: [PATCH 397/554] fix(web-app-openpost): carry OpenPost's own domain on the relay so its media URL check resolves under Tor's DNS guard --- roles/web-app-openpost/vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 3a3e0e66db..8727ff60fb 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -43,7 +43,7 @@ OPENPOST_RELAY_SIBLINGS: pixelfed: web-app-pixelfed peertube: web-app-peertube OPENPOST_RELAY_DOMAINS: >- - {%- set _domains = [] -%} + {%- set _domains = [lookup('domain', application_id)] -%} {%- for _key, _role in OPENPOST_RELAY_SIBLINGS.items() -%} {%- if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} {%- set _ = _domains.append(lookup('domain', _role)) -%} From 99aa1a41dabc4c5dd3415cbd7dbdfaba1fea9c26 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 18 Nov 2026 09:54:59 +0100 Subject: [PATCH 398/554] docs(web-app-openpost): explain why the relay carries OpenPost's own domain --- roles/web-app-openpost/Administration.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index f21868b133..0ab5488fb4 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -48,8 +48,9 @@ The role therefore runs an `nginx` stream relay next to OpenPost: - The role network uses `192.88.99.0/24`, the deprecated 6to4 relay anycast block (RFC 7526), which `netguard` accepts as a global unicast range and which never leaves the Docker host. `group_vars/all/08_networks.yml` lists the role in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` for that reason. -- The relay carries the canonical domains of the deployed Mastodon, Pixelfed and PeerTube roles, and the public domain of the object store, as network aliases, so OpenPost resolves those names to the relay. +- The relay carries OpenPost's own canonical domain, the canonical domains of the deployed Mastodon, Pixelfed and PeerTube roles, and the public domain of the object store, as network aliases, so OpenPost resolves those names to the relay. OpenPost writes media to the object store's public endpoint because browsers upload through the same presigned URLs; the alias keeps those writes on the shared proxy even where that public name only resolves through Tor. + OpenPost requests its own public media URLs before it lets a provider fetch them. With `svc-net-tor` deployed, the host drops DNS queries from every range outside the internal ones, `192.88.99.0/24` included, so without the alias that check would time out resolving the name. - The relay reads the SNI of each TLS connection, forwards a mapped name unchanged to the shared OpenResty proxy and closes every other connection. - Onion services carry no TLS, so the relay also forwards plain HTTP on port 80 to the proxy, which routes it by `Host`; only the aliased names resolve to the relay. It forwards to `host.docker.internal`, which points at the Docker host in compose and at the stack host in swarm. From e6489a1fac454a601f15bf1409e07e645357f6bf Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 18 Nov 2026 09:54:59 +0100 Subject: [PATCH 399/554] test(web-app-openpost): hand the probe the administrator mailbox instead of a member password derived from a rotated credential --- roles/web-app-openpost/templates/test.env.j2 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/web-app-openpost/templates/test.env.j2 b/roles/web-app-openpost/templates/test.env.j2 index 653908efa0..8faddd3b11 100644 --- a/roles/web-app-openpost/templates/test.env.j2 +++ b/roles/web-app-openpost/templates/test.env.j2 @@ -30,8 +30,7 @@ OPENPOST_DB_USER={{ lookup('database', application_id, 'username') }} OPENPOST_DB_PASSWORD_B64={{ lookup('database', application_id, 'password') | b64encode }} OPENPOST_PEERTUBE_USERNAME={{ OPENPOST_SEED_PEERTUBE_USERNAME }} OPENPOST_PEERTUBE_PASSWORD_B64={{ OPENPOST_SEED_PEERTUBE_PASSWORD | b64encode }} -OPENPOST_MEMBER_EMAIL={{ lookup('users', 'platform_administrator').email | regex_replace('@', '+openpost-cli-member@') }} -OPENPOST_MEMBER_PASSWORD_B64={{ (lookup('users', 'platform_administrator').password ~ ':' ~ application_id ~ ':cli-member') | hash('sha256') | b64encode }} +OPENPOST_MEMBER_MAILBOX={{ lookup('users', 'platform_administrator').email }} OPENPOST_SSO_ADMIN_EMAIL={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_OIDC_ENABLED | bool else '' }} OPENPOST_MAIL_RECIPIENT={{ OPENPOST_BOOTSTRAP_ADMINS | first if OPENPOST_EMAIL_ENABLED | bool else '' }} OPENPOST_SMTP_ENABLED={{ _view.smtp_enabled | bool | string | lower }} From c4760833aadd9cb2cd3740ea9b63796d146b3017 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 18 Nov 2026 09:55:00 +0100 Subject: [PATCH 400/554] test(web-app-openpost): read the probe member's mailbox instead of a fixed identity --- roles/web-app-openpost/files/test/openpost/api.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/api.py b/roles/web-app-openpost/files/test/openpost/api.py index 55932282b8..c90167f8c2 100644 --- a/roles/web-app-openpost/files/test/openpost/api.py +++ b/roles/web-app-openpost/files/test/openpost/api.py @@ -22,8 +22,7 @@ OPENPOST_SMTP_ENABLED true when OpenPost itself is given an SMTP relay it OPENPOST_SSO_ADMIN_EMAIL platform administrator the Playwright run provisions through SSO before the backup drill, empty without SSO OPENPOST_PEERTUBE_USERNAME local PeerTube account OpenPost connects through its password login OPENPOST_PEERTUBE_PASSWORD_B64 base64 password of that PeerTube account -OPENPOST_MEMBER_EMAIL deliverable plus-address of the administrator mailbox for the probe's workspace member -OPENPOST_MEMBER_PASSWORD_B64 base64 password of the probe's workspace member, stable across credential rotation +OPENPOST_MEMBER_MAILBOX administrator mailbox whose per-run plus-address the probe's workspace member registers with OPENPOST_PROXY_ADDRESS stack host address that serves every public vhost, empty when the probe runs on that host's network """ @@ -77,9 +76,7 @@ PEERTUBE_USERNAME = os.environ["OPENPOST_PEERTUBE_USERNAME"] PEERTUBE_PASSWORD = base64.b64decode( os.environ["OPENPOST_PEERTUBE_PASSWORD_B64"] ).decode() -MEMBER_USERNAME = "openpost-cli-member" -MEMBER_PASSWORD = base64.b64decode(os.environ["OPENPOST_MEMBER_PASSWORD_B64"]).decode() -MEMBER_EMAIL = os.environ["OPENPOST_MEMBER_EMAIL"] +MEMBER_MAILBOX = os.environ["OPENPOST_MEMBER_MAILBOX"] PROXY_ADDRESS = os.environ["OPENPOST_PROXY_ADDRESS"] SETTLE_SECONDS = 300 From 36aab875331eef77fb93d38a61d918dbd541cad9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 18 Nov 2026 09:55:00 +0100 Subject: [PATCH 401/554] test(web-app-openpost): register a fresh probe member per run so credential rotation between passes cannot lock it out --- .../files/test/openpost/simulator.py | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/roles/web-app-openpost/files/test/openpost/simulator.py b/roles/web-app-openpost/files/test/openpost/simulator.py index 9b7830e110..4032cf2b4b 100644 --- a/roles/web-app-openpost/files/test/openpost/simulator.py +++ b/roles/web-app-openpost/files/test/openpost/simulator.py @@ -12,9 +12,7 @@ from openpost.api import ( DB_NAME, DB_PASSWORD, DB_USER, - MEMBER_EMAIL, - MEMBER_PASSWORD, - MEMBER_USERNAME, + MEMBER_MAILBOX, ONION_ORIGIN, SIMULATOR_ADMIN, SIMULATOR_PLATFORMS, @@ -28,7 +26,6 @@ from openpost.api import ( provider, release, renditions, - revoke_invitations, settle, upload, ) @@ -196,28 +193,30 @@ def check_tokens_at_rest() -> None: check("no provider token is stored in plaintext", not leaked, leaked) -def member_session() -> tuple[str, str]: - credentials = {"email": MEMBER_EMAIL, "password": MEMBER_PASSWORD} +def member_session(tag: str) -> tuple[str, str, str]: + local, domain = MEMBER_MAILBOX.split("@", 1) + email = f"{local}+{tag}@{domain}" status, body = call( "POST", "/auth/register", - {**credentials, "username": MEMBER_USERNAME, "accepted_legal": True}, + { + "email": email, + "password": secrets.token_urlsafe(24), + "username": tag, + "accepted_legal": True, + }, ) - if status == 409: - status, body = call("POST", "/auth/login", credentials) if status != 200 or not isinstance(body, dict) or not body.get("token"): - sys.exit(f"[FAIL] the probe member cannot sign in: HTTP {status}") - return str(body["token"]), str(body["user"]["id"]) + sys.exit(f"[FAIL] the probe member cannot register: HTTP {status} {body}") + return str(body["token"]), str(body["user"]["id"]), email def check_roles(token: str, workspace: str, account: str, tag: str) -> str: - member, member_id = member_session() - call("DELETE", f"/workspaces/{workspace}/members/{member_id}", token=token) - revoke_invitations(token, workspace, MEMBER_EMAIL) + member, member_id, email = member_session(tag) status, invitation = call( "POST", f"/workspaces/{workspace}/invitations", - {"email": MEMBER_EMAIL, "role": "viewer"}, + {"email": email, "role": "viewer"}, token, ) if status != 200 or not isinstance(invitation, dict): From eef8e86f0bb579e1661596bdf1b09f08250fa9c1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 09:57:25 +0100 Subject: [PATCH 402/554] update(web-app-openpost): pin OpenPost v7.42.2 and the relay on nginx 1.31.9-alpine without the lapsed CVE suppression --- roles/web-app-openpost/meta/services.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index bafef8c487..baa0ab53bb 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -65,7 +65,7 @@ openpost: swarm: enabled: true image: ghcr.io/getopenpost/openpost - version: "v7.41.6" + version: "v7.42.2" update: type: registry_tags image: ghcr.io/getopenpost/openpost @@ -104,7 +104,7 @@ relay: swarm: enabled: true image: nginx - version: 1.31.8-alpine + version: 1.31.9-alpine name: openpost-relay cpus: "0.2" mem_reservation: 16m @@ -114,11 +114,6 @@ relay: internal: http: 80 https: 443 - security: - suppressions: - # nocheck: cve upstream tag ships fixable CRITICAL CVEs; lift it once a rebuilt tag lands - - image_tag: "1.31.8-alpine" - until: 2026-11-30 # nocheck: playwright-service-flag CI provider simulator, covered by the role's CLI test # nocheck: dynamic-flag a test fixture switched on by one variant only; no other role's presence decides it simulator: From 4bcc632c7f9b594b0b824bd0eef485ae01ea9cc7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 09:57:26 +0100 Subject: [PATCH 403/554] docs(requirements): name OpenPost v7.42.2 as the pin the MCP row refers to --- docs/requirements/035-mcp-proxy-expansion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements/035-mcp-proxy-expansion.md b/docs/requirements/035-mcp-proxy-expansion.md index 869b8d503b..1986553fa2 100644 --- a/docs/requirements/035-mcp-proxy-expansion.md +++ b/docs/requirements/035-mcp-proxy-expansion.md @@ -51,7 +51,7 @@ An upstream path exists or is claimed, and something concrete stops it here. Eac | `web-app-erpnext` | `version_unverified` | The Frappe MCP component is experimental and unverified against the pinned Frappe v16. | | `web-app-matomo` | `unreviewed_third_party` | The project-owned plugin is unaudited: endpoint, transport, auth and tool scope are unverified in source. | | `web-app-odoo` | `unreviewed_third_party` | Neither Odoo SA nor the OCA publishes a server; the leading third party carries 197 of 231 commits from one author, keeps its access control in a separate Odoo Apps store module outside any pinnable tag, and defaults to a mutating tool scope. | -| `web-app-openpost` | `version_unverified` | The pinned v7.41.6 serves a native `/mcp` endpoint, but its tool list, client registration and publishing side effects on external networks are not audited against that release. | +| `web-app-openpost` | `version_unverified` | The pinned v7.42.2 serves a native `/mcp` endpoint, but its tool list, client registration and publishing side effects on external networks are not audited against that release. | | `web-app-penpot` | `interactive_browser_session` | The server needs an active browser tab and plugin connection, and can execute powerful design-context operations. | | `web-app-shopware` | `version_unverified` | The pinned 6.7.8.2 predates the experimental native `/api/_mcp` server. | From 7a0d91444812bc1e82d3a80916cba9f7de1be6b8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 09:57:26 +0100 Subject: [PATCH 404/554] refactor(web-app-openpost): name the local reach host once --- roles/web-app-openpost/vars/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 8727ff60fb..39b229249b 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -5,7 +5,8 @@ container_port: "{{ lookup('config', application_id, 'services.openpost.ports.in OPENPOST_NAME: "{{ lookup('config', application_id, 'services.openpost.name') }}" OPENPOST_RELAY_NAME: "{{ lookup('config', application_id, 'services.relay.name') }}" OPENPOST_URL: "{{ lookup('tls', application_id, 'url.origin') }}" -OPENPOST_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ lookup('config', application_id, 'services.openpost.ports.local.http') }}" +OPENPOST_LOCAL_HOST: "{{ DOCKER_REACH_HOST if IS_COMPOSE_MODE else '127.0.0.1' }}" +OPENPOST_LOCAL_URL: "http://{{ OPENPOST_LOCAL_HOST }}:{{ lookup('config', application_id, 'services.openpost.ports.local.http') }}" OPENPOST_API_HEADERS: Host: "{{ lookup('domain', application_id) }}" X-Forwarded-Proto: "{{ OPENPOST_URL | urlsplit('scheme') }}" @@ -86,7 +87,7 @@ OPENPOST_PROVIDER_BUILD_CONTEXT: "{{ [lookup('container', application_id, 'direc OPENPOST_PROVIDER_IMAGE: "openpost_provider_custom" OPENPOST_PROVIDER_BASE_IMAGE: "{{ OPENPOST_PROVIDER.image }}" OPENPOST_PROVIDER_BASE_VERSION: "{{ OPENPOST_PROVIDER.version }}" -OPENPOST_PROVIDER_LOCAL_URL: "http://{{ DOCKER_REACH_HOST if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" +OPENPOST_PROVIDER_LOCAL_URL: "http://{{ OPENPOST_LOCAL_HOST }}:{{ OPENPOST_PROVIDER.ports.local.http }}" OPENPOST_PROVIDER_BROWSER_URL: "http://{{ 'host.docker.internal' if IS_COMPOSE_MODE else '127.0.0.1' }}:{{ OPENPOST_PROVIDER.ports.local.http }}" OPENPOST_LINKEDIN_CALLBACK: "{{ OPENPOST_URL }}/api/v1/accounts/linkedin/callback" OPENPOST_SIMULATOR_KEYSTORE_PASSWORD: "password" From b952ca44e80be1cfd656a0c45fa98fc4af2aee46 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:00 +0100 Subject: [PATCH 405/554] style(web-app-openpost): drop the timeout comment from the crossposter draft spec --- .../web-app-openpost/files/playwright/test-crossposter-draft.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js index f168da8a03..36e5373a7e 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-draft.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-draft.js @@ -86,7 +86,7 @@ exports.register = function (shared) { shared.skipUnlessServiceEnabled("crossposter"); shared.skipUnlessServiceEnabled("mastodon"); shared.skipOnOnionSibling("mastodon"); - test.setTimeout(resolveTimeout(420_000)); // Mastodon sign-in, the crossposter's poll interval, composer autosave and scheduling + test.setTimeout(resolveTimeout(420_000)); const label = "administrator"; const marker = `cp-desk-${Date.now()}`; const edited = `Edited in the desk ${marker}`; From 7bd33ba162666d725c68ab2eef99074c93f42cb1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:00 +0100 Subject: [PATCH 406/554] style(web-app-openpost): drop the timeout comment from the LinkedIn crossposter spec --- .../files/playwright/test-crossposter-linkedin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js index 5929c982f3..67d0a2417f 100644 --- a/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js +++ b/roles/web-app-openpost/files/playwright/test-crossposter-linkedin.js @@ -82,7 +82,7 @@ exports.register = function (shared) { shared.env.appBaseUrl.includes(".onion"), "LinkedIn cannot redirect a member back to an onion OpenPost origin", ); - test.setTimeout(resolveTimeout(480_000)); // fake sign-up and consent, Mastodon sign-in, the crossposter's poll interval and the publishing worker + test.setTimeout(resolveTimeout(480_000)); const label = "administrator"; const stamp = Date.now(); const marker = `cp-linkedin-${stamp}`; From 31530237f9ca8afc1f4918e8e0317799d9f5ccd7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:00 +0100 Subject: [PATCH 407/554] style(web-app-openpost): drop the timeout comment from the guest spec --- roles/web-app-openpost/files/playwright/test-guest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-guest.js b/roles/web-app-openpost/files/playwright/test-guest.js index 3438a8ee82..2d70933f4b 100644 --- a/roles/web-app-openpost/files/playwright/test-guest.js +++ b/roles/web-app-openpost/files/playwright/test-guest.js @@ -6,7 +6,7 @@ const { isServiceEnabled } = require("./service-gating"); exports.register = function (shared) { test("guest: login serves CSP, refuses wrong and empty credentials, never reaches the desk", async ({ page }) => { - test.setTimeout(resolveTimeout(90_000)); // optional Keycloak round-trip for the IdP rejection + test.setTimeout(resolveTimeout(90_000)); const response = await shared.gotoLogin(page); expect(response, "Expected an OpenPost login response").toBeTruthy(); expect(response.status(), "Expected the OpenPost login status to be < 400").toBeLessThan(400); From 49e758cd86048042b70d7f7451957a2ce7c2772f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:00 +0100 Subject: [PATCH 408/554] style(web-app-openpost): drop the timeout comment from the native administrator login spec --- .../files/playwright/test-login-native-administrator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-login-native-administrator.js b/roles/web-app-openpost/files/playwright/test-login-native-administrator.js index bc999efffe..1407bcd4dc 100644 --- a/roles/web-app-openpost/files/playwright/test-login-native-administrator.js +++ b/roles/web-app-openpost/files/playwright/test-login-native-administrator.js @@ -3,7 +3,7 @@ const { resolveTimeout } = require("./timeouts"); exports.register = function (shared) { test("administrator: break-glass password login reaches the instance administration", async ({ page }) => { - test.setTimeout(resolveTimeout(90_000)); // cold SvelteKit bundle plus the instance settings fetch + test.setTimeout(resolveTimeout(90_000)); expect(shared.env.breakglassEmail, "BREAKGLASS_EMAIL must be set").toBeTruthy(); expect(shared.env.breakglassPassword, "BREAKGLASS_PASSWORD must be set").toBeTruthy(); From 25e9899b2304168b46a0be97c7cf1780c2e3b043 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:00 +0100 Subject: [PATCH 409/554] style(web-app-openpost): drop the timeout comment from the OIDC administrator login spec --- .../files/playwright/test-login-oidc-administrator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js b/roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js index 7f5b26b168..9db34aa3e9 100644 --- a/roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js +++ b/roles/web-app-openpost/files/playwright/test-login-oidc-administrator.js @@ -4,7 +4,7 @@ const { resolveTimeout } = require("./timeouts"); exports.register = function (shared) { test("administrator: Keycloak login provisions an instance admin who reaches the instance administration", async ({ page }) => { shared.skipUnlessServiceEnabled("sso"); - test.setTimeout(resolveTimeout(120_000)); // OIDC round-trip via Keycloak plus just-in-time provisioning + test.setTimeout(resolveTimeout(120_000)); expect(shared.env.adminUsername, "ADMIN_USERNAME must be set").toBeTruthy(); expect(shared.env.adminPassword, "ADMIN_PASSWORD must be set").toBeTruthy(); From a34fe93376a841dba37a657a2f18ac10687a90b3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 410/554] style(web-app-openpost): drop the timeout comment from the OIDC biber login spec --- .../web-app-openpost/files/playwright/test-login-oidc-biber.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-login-oidc-biber.js b/roles/web-app-openpost/files/playwright/test-login-oidc-biber.js index 32d9602f63..3f9d657296 100644 --- a/roles/web-app-openpost/files/playwright/test-login-oidc-biber.js +++ b/roles/web-app-openpost/files/playwright/test-login-oidc-biber.js @@ -4,7 +4,7 @@ const { resolveTimeout } = require("./timeouts"); exports.register = function (shared) { test("biber: Keycloak login opens the composer but never the organisation workspace", async ({ page }) => { shared.skipUnlessServiceEnabled("sso"); - test.setTimeout(resolveTimeout(120_000)); // OIDC round-trip via Keycloak plus just-in-time provisioning + test.setTimeout(resolveTimeout(120_000)); expect(shared.env.biberUsername, "BIBER_USERNAME must be set").toBeTruthy(); expect(shared.env.biberPassword, "BIBER_PASSWORD must be set").toBeTruthy(); From c579673d76a96b2400acdab79780dddf8b0abebd Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 411/554] style(web-app-openpost): drop the timeout comment from the Mastodon publishing spec --- .../web-app-openpost/files/playwright/test-publish-mastodon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-publish-mastodon.js b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js index a989685b2c..e910c37dd6 100644 --- a/roles/web-app-openpost/files/playwright/test-publish-mastodon.js +++ b/roles/web-app-openpost/files/playwright/test-publish-mastodon.js @@ -6,7 +6,7 @@ exports.register = function (shared) { shared.skipUnlessServiceEnabled("sso"); shared.skipUnlessServiceEnabled("mastodon"); shared.skipOnOnionSibling("mastodon"); - test.setTimeout(resolveTimeout(300_000)); // two Keycloak logins, Mastodon OAuth approval and the publishing worker round-trip + test.setTimeout(resolveTimeout(300_000)); const marker = `openpost-e2e ${Date.now()}`; await shared.signInViaOidc(page, shared.env.adminUsername, shared.env.adminPassword, "administrator"); From 0a427d019c3137c9ae40e40c673892cce5d70adc Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 412/554] style(web-app-openpost): drop the timeout comment from the Pixelfed publishing spec --- .../web-app-openpost/files/playwright/test-publish-pixelfed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js b/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js index f7ecfaf83d..33bb9035f9 100644 --- a/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js +++ b/roles/web-app-openpost/files/playwright/test-publish-pixelfed.js @@ -5,7 +5,7 @@ exports.register = function (shared) { test("administrator: connects the local Pixelfed account through the OOB code flow and publishes an image to it", async ({ page }) => { shared.skipUnlessServiceEnabled("pixelfed"); shared.skipOnOnionSibling("pixelfed"); - test.setTimeout(resolveTimeout(300_000)); // Pixelfed sign-in, OAuth approval, media upload and the publishing worker round-trip + test.setTimeout(resolveTimeout(300_000)); const label = "break-glass administrator"; const marker = `openpost-e2e-pixelfed ${Date.now()}`; From fab0db4d868c9bf3975d8b1e02984ef3c9ddef42 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 413/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the CLI test --- roles/web-app-openpost/files/test/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/files/test/test.sh b/roles/web-app-openpost/files/test/test.sh index adab16415f..764da62079 100644 --- a/roles/web-app-openpost/files/test/test.sh +++ b/roles/web-app-openpost/files/test/test.sh @@ -17,7 +17,7 @@ here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" python3 -E -s "${here}/probe.py" rc=$? -# nocheck: container-exec-resolver, shell-download-retry address resolved by the caller; a single attempt is the point of a refusal probe +# nocheck: container-exec-resolver, shell-download-retry unmapped="$(container exec "${OPENPOST_CONTAINER}" wget -S -T 10 -O /dev/null "https://relay:${OPENPOST_RELAY_PORT}/" 2>&1)" case "${unmapped}" in *"HTTP/"*) From d09290d7b8721ac034093058292a1272c627fc6e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 414/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the services --- roles/web-app-openpost/meta/services.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index baa0ab53bb..29521703d1 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -28,7 +28,7 @@ prometheus: bond: 1 enabled: "{{ 'web-app-prometheus' in group_names }}" shared: "{{ 'web-app-prometheus' in group_names }}" -# nocheck: playwright-service-flag - DB engine, covered by the role's CLI test +# nocheck: playwright-service-flag postgres: bond: 1 enabled: true # nocheck: dynamic-flag @@ -42,17 +42,17 @@ mastodon: bond: 1 enabled: "{{ 'web-app-mastodon' in group_names }}" shared: "{{ 'web-app-mastodon' in group_names }}" -# nocheck: playwright-service-flag - publishing target reached through the relay, covered by the role's CLI test +# nocheck: playwright-service-flag pixelfed: bond: 0.5 enabled: "{{ 'web-app-pixelfed' in group_names }}" shared: "{{ 'web-app-pixelfed' in group_names }}" -# nocheck: playwright-service-flag - publishing target reached through the relay, covered by the role's CLI test +# nocheck: playwright-service-flag peertube: bond: 0.5 enabled: "{{ 'web-app-peertube' in group_names }}" shared: "{{ 'web-app-peertube' in group_names }}" -# nocheck: playwright-service-flag self-provider +# nocheck: playwright-service-flag openpost: # nocheck: single-replica one `all` process schedules and publishes; split web and worker scaling is out of scope replicas: 1 @@ -93,8 +93,7 @@ openpost: - web-app-pixelfed - web-app-peertube lifecycle: beta -# nocheck: playwright-service-flag egress sidecar, covered by the role's CLI test -# nocheck: dynamic-flag the relay is part of this role and runs whenever OpenPost runs; no other role's presence decides it +# nocheck: playwright-service-flag, dynamic-flag relay: enabled: true shared: false @@ -114,8 +113,7 @@ relay: internal: http: 80 https: 443 -# nocheck: playwright-service-flag CI provider simulator, covered by the role's CLI test -# nocheck: dynamic-flag a test fixture switched on by one variant only; no other role's presence decides it +# nocheck: playwright-service-flag, dynamic-flag simulator: enabled: false shared: false @@ -151,7 +149,7 @@ simulator: - tiktok - linkedin -# nocheck: dynamic-flag a sidecar of this role, provided by no other role; it runs exactly while the simulator does +# nocheck: dynamic-flag provider: enabled: "{{ lookup('config', 'web-app-openpost', 'services.simulator.enabled') | bool }}" custom: true @@ -178,7 +176,7 @@ provider: - www.linkedin.com - api.linkedin.com -# nocheck: dynamic-flag a sidecar of this role, provided by no other role; it runs exactly while routes are configured +# nocheck: dynamic-flag crossposter: enabled: "{{ (lookup('config', 'web-app-openpost', 'services.crossposter.routes') | length) > 0 }}" custom: true @@ -210,8 +208,8 @@ tor: bond: 0.5 enabled: "{{ 'svc-net-tor' in group_names }}" shared: true # nocheck: dynamic-flag -# nocheck: playwright-service-flag, dynamic-flag infrastructure backup consumer -container_backup: # nocheck: bond-baseline backup host joins outside the variant topology +# nocheck: playwright-service-flag, dynamic-flag +container_backup: # nocheck: bond-baseline bond: 1 enabled: "{{ 'svc-bkp-volume-2-local' in group_names }}" shared: true From 753efc1566fe1eb3e8619611fb76de0dd791af42 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 415/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the variants --- roles/web-app-openpost/meta/variants.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/web-app-openpost/meta/variants.yml b/roles/web-app-openpost/meta/variants.yml index dc758cf314..e110658901 100644 --- a/roles/web-app-openpost/meta/variants.yml +++ b/roles/web-app-openpost/meta/variants.yml @@ -1,5 +1,5 @@ --- -# nocheck: clearnet-variant-tor PeerTube is a publishing target OpenPost reaches server-side through its relay; the onion round never advertises it +# nocheck: clearnet-variant-tor # nocheck: sso-variant-tor variant 0 runs clearnet only: OpenPost reaches an onion Keycloak only through Tor's SOCKS port, which svc-net-tor opens to the internal ranges and not to the role subnet 192.88.99.0/24 - services: container_backup: @@ -86,7 +86,7 @@ enabled: true shared: true simulator: - enabled: true # nocheck: variants-static-override CI provider simulator the first two rounds switch on + enabled: true # nocheck: variants-static-override sso: enabled: true shared: true @@ -96,7 +96,7 @@ - services: container_backup: enabled: false - shared: false # nocheck: variants-static-override backup shared stays literally true + shared: false # nocheck: variants-static-override crossposter: poll_interval_seconds: 15 retry: @@ -176,7 +176,7 @@ enabled: false shared: false simulator: - enabled: true # nocheck: variants-static-override CI provider simulator the crossposter's Pixelfed and PeerTube routes deliver to + enabled: true # nocheck: variants-static-override sso: enabled: false shared: false @@ -186,7 +186,7 @@ - services: container_backup: enabled: false - shared: false # nocheck: variants-static-override backup shared stays literally true + shared: false # nocheck: variants-static-override design: enabled: false shared: false From caf0b9a17bfc4bd335b143e4a1bafa0e33351b37 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 416/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the crossposter apply tasks --- roles/web-app-openpost/tasks/crossposter/apply.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/apply.yml b/roles/web-app-openpost/tasks/crossposter/apply.yml index c36cf799ee..925cb7941e 100644 --- a/roles/web-app-openpost/tasks/crossposter/apply.yml +++ b/roles/web-app-openpost/tasks/crossposter/apply.yml @@ -25,7 +25,7 @@ argv: - container - exec - - "{{ OPENPOST_CROSSPOSTER_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_CROSSPOSTER_LOCAL_CID resolved at delegate_to runtime + - "{{ OPENPOST_CROSSPOSTER_LOCAL_CID }}" # nocheck: container-exec-resolver - python - -m - crossposter From 967633f99f944d5dbdecf38a4b2ca1e986069d63 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 417/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the crossposter connect seed --- roles/web-app-openpost/tasks/crossposter/seed/connect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml index b38f34282e..81638f5748 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml @@ -28,7 +28,7 @@ - "CROSSPOSTER_ACCOUNT={{ openpost_crossposter_mastodon_route.source.account }}" - -e - "CROSSPOSTER_AUTHORIZE={{ openpost_crossposter_mastodon_authorize.json.url }}" - - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_MASTODON_LOCAL_CID resolved at delegate_to runtime + - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver - bin/rails - runner - | From ca7627117c5bc8aa023b7e5d6c6cc31122edefb8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 418/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the Mastodon seed --- roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml index e886c61282..156e018a70 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml @@ -14,7 +14,7 @@ - exec - -e - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" - - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_MASTODON_LOCAL_CID resolved at delegate_to runtime + - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver - bin/rails - runner - | From 3294217306a4c09050c4f06f0d0ad00b83bda549 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 419/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the Pixelfed seed --- roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml index 7cc553d8ff..78a2c37797 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml @@ -18,7 +18,7 @@ - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" - -e - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_SEED_PIXELFED_LOCAL_CID resolved at delegate_to runtime + - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver - php - -r - >- From 3fdd3257f37701f91ccdf2c747b7c567e1a0b817 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 420/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the Pixelfed owner tasks --- roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml index 9bb7c10f79..1c4c70226c 100644 --- a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml +++ b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml @@ -20,7 +20,7 @@ - "OPENPOST_CLIENT_OWNER={{ lookup('users', 'platform_administrator').username }}" - -e - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - - "{{ OPENPOST_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver OPENPOST_PIXELFED_LOCAL_CID resolved at delegate_to runtime + - "{{ OPENPOST_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver - php - -r - >- From 762cf38ea6b2b5b447ec270645bc032707f1ae10 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 421/554] style(web-app-openpost): keep only the rule names on the nocheck markers of the Playwright env --- roles/web-app-openpost/templates/playwright.env.j2 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/web-app-openpost/templates/playwright.env.j2 b/roles/web-app-openpost/templates/playwright.env.j2 index 4d20e34ac6..ed3d2be3ae 100644 --- a/roles/web-app-openpost/templates/playwright.env.j2 +++ b/roles/web-app-openpost/templates/playwright.env.j2 @@ -18,18 +18,18 @@ CANONICAL_DOMAIN={{ lookup('domain', application_id) | dotenv_quote }} CROSSPOSTER_SERVICE_ENABLED={{ OPENPOST_CROSSPOSTER_ENABLED | string | lower }} -# nocheck: playwright-service-gate - dashboard tiles are owned by the web-app-dashboard spec +# nocheck: playwright-service-gate DASHBOARD_SERVICE_ENABLED={{ lookup('config', application_id, 'services.dashboard.enabled') | string | lower }} -# nocheck: playwright-service-gate - the corporate design sheet is injected by sys-front-inj-design and asserted by the web-svc-design spec, not a per-persona surface +# nocheck: playwright-service-gate DESIGN_SERVICE_ENABLED={{ lookup('config', application_id, 'services.design.enabled') | string | lower }} -# nocheck: playwright-service-gate - mail delivery is covered by the sys-svc-mail integration tests, not the persona surface +# nocheck: playwright-service-gate EMAIL_SERVICE_ENABLED={{ OPENPOST_EMAIL_ENABLED | string | lower }} LINKEDIN_FAKE_URL={{ (OPENPOST_PROVIDER_BROWSER_URL if OPENPOST_PROVIDER_ENABLED | bool else '') | dotenv_quote }} -# nocheck: playwright-service-gate - universal-logout redirect is exercised by the persona logout step; covered by web-svc-logout integration tests +# nocheck: playwright-service-gate LOGOUT_SERVICE_ENABLED={{ lookup('config', application_id, 'services.logout.enabled') | string | lower }} MASTODON_BASE_URL={{ lookup('landing_url', 'web-app-mastodon') | dotenv_quote }} @@ -38,7 +38,7 @@ MASTODON_SERVICE_ENABLED={{ lookup('config', application_id, 'services.mastodon. MATOMO_BASE_URL={{ lookup('landing_url', 'web-app-matomo') | dotenv_quote }} -# nocheck: playwright-service-gate - Matomo tracking is an injected snippet, covered by the web-app-matomo spec +# nocheck: playwright-service-gate MATOMO_SERVICE_ENABLED={{ lookup('config', application_id, 'services.matomo.enabled') | string | lower }} OIDC_ISSUER_URL={{ OIDC.CLIENT.ISSUER_URL | dotenv_quote }} @@ -49,7 +49,7 @@ PIXELFED_BASE_URL={{ lookup('landing_url', 'web-app-pixelfed') | dotenv_quote }} PIXELFED_SERVICE_ENABLED={{ lookup('config', application_id, 'services.pixelfed.enabled') | string | lower }} -# nocheck: playwright-service-gate - Prometheus scrape parity is owned by the web-app-prometheus spec +# nocheck: playwright-service-gate PROMETHEUS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.prometheus.enabled') | string | lower }} PROVIDER_SERVICE_ENABLED={{ OPENPOST_PROVIDER_ENABLED | string | lower }} From 47b27c29255b4473bd650161e44d6d6be9a38085 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Sat, 21 Nov 2026 23:01:01 +0100 Subject: [PATCH 422/554] test(web-app-openpost): keep only the rule name on the crossposter entry point test's nocheck marker --- .../files/crossposter/crossposter/test___main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py index 1f18a737e6..17ed64204a 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py @@ -74,7 +74,7 @@ class TestHealth(CliFixture, unittest.TestCase): def test_waiting_for_provisioning_stays_healthy(self) -> None: pause = cli.wait_for_configuration(str(self.config), ValueError("no token yet")) self.assertEqual(pause, 60) - written = self.heartbeat.read_text() # nocheck: cache-read tempdir file + written = self.heartbeat.read_text() # nocheck: cache-read self.assertTrue(written.strip().endswith("waiting")) self.assertEqual(cli.command_health(str(self.config)), 0) From 2d7c6d7048821c1ca43874fcae5fc04c73bdbb89 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 23 Nov 2026 11:43:44 +0100 Subject: [PATCH 423/554] fix(web-app-openpost): pin the fake provider's TLS floor to 1.2 --- roles/web-app-openpost/files/provider/provider/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/files/provider/provider/__main__.py b/roles/web-app-openpost/files/provider/provider/__main__.py index 3c0e1be6bb..69c0a4da86 100644 --- a/roles/web-app-openpost/files/provider/provider/__main__.py +++ b/roles/web-app-openpost/files/provider/provider/__main__.py @@ -80,6 +80,7 @@ def serve(config: dict) -> int: plain = ThreadingHTTPServer(("0.0.0.0", int(config["http_port"])), handler) # noqa: S104 published only on the role network and the CI loopback secure = ThreadingHTTPServer(("0.0.0.0", int(config["https_port"])), handler) # noqa: S104 published only on the role network and the CI loopback context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.minimum_version = ssl.TLSVersion.TLSv1_2 context.load_cert_chain(config["certificate"], config["key"]) secure.socket = context.wrap_socket(secure.socket, server_side=True) threading.Thread(target=secure.serve_forever, daemon=True).start() From 2f6603c3a92f843bbcca339279140f82039edb45 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Mon, 23 Nov 2026 11:43:44 +0100 Subject: [PATCH 424/554] test(web-app-openpost): drop the readiness probe's dead initial error --- roles/web-app-openpost/files/test/probe.py | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/web-app-openpost/files/test/probe.py b/roles/web-app-openpost/files/test/probe.py index 685292a85b..fc3d4909fd 100644 --- a/roles/web-app-openpost/files/test/probe.py +++ b/roles/web-app-openpost/files/test/probe.py @@ -57,7 +57,6 @@ SQLITE_PATTERNS = ( def wait_ready() -> None: - last = "no answer" while True: try: status, _ = call("GET", "/ready") From 29c77e6c86e2a7946702bc5df71235d91f33da3d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 425/554] refactor(web-app-openpost): move crossposter/__init__.py under files/python --- .../files/{crossposter => python}/crossposter/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/__init__.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/__init__.py b/roles/web-app-openpost/files/python/crossposter/__init__.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/__init__.py rename to roles/web-app-openpost/files/python/crossposter/__init__.py From dc280a2a2274ee13fcba52d90c646cbc62e05ec5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 426/554] refactor(web-app-openpost): move crossposter/__main__.py under files/python --- .../files/{crossposter => python}/crossposter/__main__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/__main__.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/__main__.py b/roles/web-app-openpost/files/python/crossposter/__main__.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/__main__.py rename to roles/web-app-openpost/files/python/crossposter/__main__.py From 35c3847ff899ebcee8c80096f5c6ce5296b48363 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 427/554] refactor(web-app-openpost): move crossposter/adapt.py under files/python --- .../files/{crossposter => python}/crossposter/adapt.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/adapt.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/adapt.py b/roles/web-app-openpost/files/python/crossposter/adapt.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/adapt.py rename to roles/web-app-openpost/files/python/crossposter/adapt.py From e94de8394b2282d6b72b8734120ddef589d52048 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 428/554] refactor(web-app-openpost): move crossposter/config.py under files/python --- .../files/{crossposter => python}/crossposter/config.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/config.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/config.py b/roles/web-app-openpost/files/python/crossposter/config.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/config.py rename to roles/web-app-openpost/files/python/crossposter/config.py From 8d7ed3a7b93d11c55fd98b330bd5345bc6d08152 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 429/554] refactor(web-app-openpost): move crossposter/notify.py under files/python --- .../files/{crossposter => python}/crossposter/notify.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/notify.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/notify.py b/roles/web-app-openpost/files/python/crossposter/notify.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/notify.py rename to roles/web-app-openpost/files/python/crossposter/notify.py From 00d5f3187bcaa005bd1b9b635bb905591c11c5f7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 430/554] refactor(web-app-openpost): move crossposter/openpost.py under files/python --- .../files/{crossposter => python}/crossposter/openpost.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/openpost.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/openpost.py b/roles/web-app-openpost/files/python/crossposter/openpost.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/openpost.py rename to roles/web-app-openpost/files/python/crossposter/openpost.py From 26e297afbe1cec352e08bb99b4d0451eec4a8c99 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 431/554] refactor(web-app-openpost): move crossposter/retry.py under files/python --- .../files/{crossposter => python}/crossposter/retry.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/retry.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/retry.py b/roles/web-app-openpost/files/python/crossposter/retry.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/retry.py rename to roles/web-app-openpost/files/python/crossposter/retry.py From abdd266ffa41b5e2497e9c0ed0e50522651d4018 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 432/554] refactor(web-app-openpost): move crossposter/service.py under files/python --- .../files/{crossposter => python}/crossposter/service.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/service.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/service.py b/roles/web-app-openpost/files/python/crossposter/service.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/service.py rename to roles/web-app-openpost/files/python/crossposter/service.py From 540efb415fd26a9a3466fb0c6044a6d6307ef52c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 433/554] refactor(web-app-openpost): move crossposter/store.py under files/python --- .../files/{crossposter => python}/crossposter/store.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/store.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/store.py b/roles/web-app-openpost/files/python/crossposter/store.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/store.py rename to roles/web-app-openpost/files/python/crossposter/store.py From da103f9883f91a268d6d4b716eb43738f2c28f0c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 434/554] refactor(web-app-openpost): move crossposter/web.py under files/python --- .../files/{crossposter => python}/crossposter/web.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/web.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/web.py b/roles/web-app-openpost/files/python/crossposter/web.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/web.py rename to roles/web-app-openpost/files/python/crossposter/web.py From a9655ca6441df2eb5b5636ecb913d26074c47738 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 435/554] refactor(web-app-openpost): move crossposter/sources/__init__.py under files/python --- .../files/{crossposter => python}/crossposter/sources/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/sources/__init__.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py b/roles/web-app-openpost/files/python/crossposter/sources/__init__.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py rename to roles/web-app-openpost/files/python/crossposter/sources/__init__.py From 185dc93f2407d51c505ab670b34a6dd2df5f8a35 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 436/554] refactor(web-app-openpost): move crossposter/sources/mastodon.py under files/python --- .../files/{crossposter => python}/crossposter/sources/mastodon.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/sources/mastodon.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py b/roles/web-app-openpost/files/python/crossposter/sources/mastodon.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/sources/mastodon.py rename to roles/web-app-openpost/files/python/crossposter/sources/mastodon.py From 5913ec483e0fe64806b88caac2e185387448a410 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 437/554] refactor(web-app-openpost): move crossposter/sources/peertube.py under files/python --- .../files/{crossposter => python}/crossposter/sources/peertube.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/sources/peertube.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py b/roles/web-app-openpost/files/python/crossposter/sources/peertube.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/sources/peertube.py rename to roles/web-app-openpost/files/python/crossposter/sources/peertube.py From 8b8fde632c0c96cff1c5f4e3470e891e8cda2635 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 438/554] refactor(web-app-openpost): move crossposter/sources/pixelfed.py under files/python --- .../files/{crossposter => python}/crossposter/sources/pixelfed.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{crossposter => python}/crossposter/sources/pixelfed.py (100%) diff --git a/roles/web-app-openpost/files/crossposter/crossposter/sources/pixelfed.py b/roles/web-app-openpost/files/python/crossposter/sources/pixelfed.py similarity index 100% rename from roles/web-app-openpost/files/crossposter/crossposter/sources/pixelfed.py rename to roles/web-app-openpost/files/python/crossposter/sources/pixelfed.py From 002f5f38b9a23e53c854ca721c31fd5cac6f3b0e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 439/554] refactor(web-app-openpost): move provider/__init__.py under files/python --- .../files/{provider => python}/provider/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{provider => python}/provider/__init__.py (100%) diff --git a/roles/web-app-openpost/files/provider/provider/__init__.py b/roles/web-app-openpost/files/python/provider/__init__.py similarity index 100% rename from roles/web-app-openpost/files/provider/provider/__init__.py rename to roles/web-app-openpost/files/python/provider/__init__.py From e200228ffbd0cbc250e124c5b54ff0020b290066 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:24 +0100 Subject: [PATCH 440/554] refactor(web-app-openpost): move provider/__main__.py under files/python --- .../files/{provider => python}/provider/__main__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{provider => python}/provider/__main__.py (100%) diff --git a/roles/web-app-openpost/files/provider/provider/__main__.py b/roles/web-app-openpost/files/python/provider/__main__.py similarity index 100% rename from roles/web-app-openpost/files/provider/provider/__main__.py rename to roles/web-app-openpost/files/python/provider/__main__.py From 9c0f6b08af83bf719a36afa1db6fc1b17c7d9700 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 441/554] refactor(web-app-openpost): move provider/linkedin.py under files/python --- .../files/{provider => python}/provider/linkedin.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{provider => python}/provider/linkedin.py (100%) diff --git a/roles/web-app-openpost/files/provider/provider/linkedin.py b/roles/web-app-openpost/files/python/provider/linkedin.py similarity index 100% rename from roles/web-app-openpost/files/provider/provider/linkedin.py rename to roles/web-app-openpost/files/python/provider/linkedin.py From 5bb7a364405159caafed061a25eeeb15afa49bee Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 442/554] refactor(web-app-openpost): move provider/store.py under files/python --- .../web-app-openpost/files/{provider => python}/provider/store.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/{provider => python}/provider/store.py (100%) diff --git a/roles/web-app-openpost/files/provider/provider/store.py b/roles/web-app-openpost/files/python/provider/store.py similarity index 100% rename from roles/web-app-openpost/files/provider/provider/store.py rename to roles/web-app-openpost/files/python/provider/store.py From ffe06cd223fff9f87d7ac4e77e51b4d659e49a48 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 443/554] refactor(web-app-openpost): stage the crossposter package from files/python into its build context --- roles/web-app-openpost/tasks/crossposter/render.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/render.yml b/roles/web-app-openpost/tasks/crossposter/render.yml index f94557541c..f5cdfd0bd9 100644 --- a/roles/web-app-openpost/tasks/crossposter/render.yml +++ b/roles/web-app-openpost/tasks/crossposter/render.yml @@ -29,9 +29,14 @@ - name: "📦 Stage the crossposter build context" ansible.builtin.copy: - src: "{{ role_path }}/files/crossposter/" - dest: "{{ OPENPOST_CROSSPOSTER_BUILD_CONTEXT }}/" + src: "{{ item.src }}" + dest: "{{ item.dest }}" mode: preserve + loop: + - src: "{{ role_path }}/files/crossposter/" + dest: "{{ OPENPOST_CROSSPOSTER_BUILD_CONTEXT }}/" + - src: "{{ role_path }}/files/python/crossposter/" + dest: "{{ [OPENPOST_CROSSPOSTER_BUILD_CONTEXT, 'crossposter'] | path_join }}/" notify: - compose-build - compose-up From 12c548702e9ce61e82050b5eae16ed350595a503 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 444/554] refactor(web-app-openpost): stage the fake provider package from files/python into its build context --- roles/web-app-openpost/tasks/provider/render.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/tasks/provider/render.yml b/roles/web-app-openpost/tasks/provider/render.yml index c9af9c3ffd..ed05869b41 100644 --- a/roles/web-app-openpost/tasks/provider/render.yml +++ b/roles/web-app-openpost/tasks/provider/render.yml @@ -21,9 +21,14 @@ - name: "📦 Stage the fake provider build context" ansible.builtin.copy: - src: "{{ role_path }}/files/provider/" - dest: "{{ OPENPOST_PROVIDER_BUILD_CONTEXT }}/" + src: "{{ item.src }}" + dest: "{{ item.dest }}" mode: preserve + loop: + - src: "{{ role_path }}/files/provider/" + dest: "{{ OPENPOST_PROVIDER_BUILD_CONTEXT }}/" + - src: "{{ role_path }}/files/python/provider/" + dest: "{{ [OPENPOST_PROVIDER_BUILD_CONTEXT, 'provider'] | path_join }}/" notify: - compose-build - compose-up From 24e473823ecf317f511c9af1c5bac01e571f916e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 445/554] refactor(web-app-openpost): drop the crossposter build context's layout exemption --- roles/web-app-openpost/files/crossposter/.nocheck | 1 - 1 file changed, 1 deletion(-) delete mode 100644 roles/web-app-openpost/files/crossposter/.nocheck diff --git a/roles/web-app-openpost/files/crossposter/.nocheck b/roles/web-app-openpost/files/crossposter/.nocheck deleted file mode 100644 index f6291d4f85..0000000000 --- a/roles/web-app-openpost/files/crossposter/.nocheck +++ /dev/null @@ -1 +0,0 @@ -# nocheck: role-files-layout - Docker build context of the crossposter sidecar; the Dockerfile copies the importable crossposter package as one tree, so its modules cannot be split by language. From fe438e73beac28a396d177d5a48db20a875f5da2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 446/554] refactor(web-app-openpost): drop the fake provider build context's layout exemption --- roles/web-app-openpost/files/provider/.nocheck | 1 - 1 file changed, 1 deletion(-) delete mode 100644 roles/web-app-openpost/files/provider/.nocheck diff --git a/roles/web-app-openpost/files/provider/.nocheck b/roles/web-app-openpost/files/provider/.nocheck deleted file mode 100644 index 17666c9aea..0000000000 --- a/roles/web-app-openpost/files/provider/.nocheck +++ /dev/null @@ -1 +0,0 @@ -# nocheck: role-files-layout - Docker build context of the fake provider sidecar; the Dockerfile copies the importable provider package as one tree, so its modules cannot be split by language. From c951fc7cd44a56d26ea26ac67eb4e1619c0680bb Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 447/554] test(web-app-openpost): import the crossposter package from files/python --- .../python/roles/web-app-openpost/files/crossposter/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py index da4a7bf6bb..241d1186c0 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/__init__.py @@ -2,7 +2,7 @@ import sys from pathlib import Path PROJECT_ROOT: Path = Path(__file__).resolve().parents[7] -PACKAGE_ROOT: Path = PROJECT_ROOT / "roles/web-app-openpost/files/crossposter" +PACKAGE_ROOT: Path = PROJECT_ROOT / "roles/web-app-openpost/files/python" if str(PACKAGE_ROOT) not in sys.path: sys.path.insert(0, str(PACKAGE_ROOT)) From 4dad3ad9571aa221e0454fbddc13c2e621bc58f1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 448/554] test(web-app-openpost): import the fake provider package from files/python --- .../python/roles/web-app-openpost/files/provider/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/__init__.py b/tests/unit/python/roles/web-app-openpost/files/provider/__init__.py index 9f7330316f..241d1186c0 100644 --- a/tests/unit/python/roles/web-app-openpost/files/provider/__init__.py +++ b/tests/unit/python/roles/web-app-openpost/files/provider/__init__.py @@ -2,7 +2,7 @@ import sys from pathlib import Path PROJECT_ROOT: Path = Path(__file__).resolve().parents[7] -PACKAGE_ROOT: Path = PROJECT_ROOT / "roles/web-app-openpost/files/provider" +PACKAGE_ROOT: Path = PROJECT_ROOT / "roles/web-app-openpost/files/python" if str(PACKAGE_ROOT) not in sys.path: sys.path.insert(0, str(PACKAGE_ROOT)) From 89fe14246cd2c38656bcaf38c4b1552d4596680f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 449/554] test(web-app-openpost): move the crossposter test test___main__.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test___main__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test___main__.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test___main__.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test___main__.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test___main__.py From a4da83d4db2f1668529cf98052aeff6b4ddcc68e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 450/554] test(web-app-openpost): move the crossposter test test_adapt.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_adapt.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_adapt.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_adapt.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_adapt.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_adapt.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_adapt.py From 31fff608cca308df68b1a10f09fdaa4aa0583446 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 451/554] test(web-app-openpost): move the crossposter test test_config.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_config.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_config.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_config.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_config.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_config.py From 237f7eb34f24f3c8bfefdd0138c129301644173e Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 452/554] test(web-app-openpost): move the crossposter test test_notify.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_notify.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_notify.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_notify.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_notify.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_notify.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_notify.py From db8af80e661cad9109e41b5075a9f9c50e9b0124 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 453/554] test(web-app-openpost): move the crossposter test test_openpost.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_openpost.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_openpost.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_openpost.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_openpost.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_openpost.py From 55ce8f8e49ec1a0ebcc91d2ecb67566cca69ce16 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 454/554] test(web-app-openpost): move the crossposter test test_retry.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_retry.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_retry.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_retry.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_retry.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_retry.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_retry.py From 250d3041337f736a25d42f20941776ba8a13ba02 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 455/554] test(web-app-openpost): move the crossposter test test_service.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_service.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_service.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_service.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_service.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_service.py From 9f90c13707961d6b09a759200f4b33c5e3c3ba50 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 456/554] test(web-app-openpost): move the crossposter test test_store.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_store.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_store.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_store.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_store.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py From 45b94f3ea272c14adba4ec1edf1ae791df5725a5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 457/554] test(web-app-openpost): move the crossposter test test_web.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/test_web.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/test_web.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_web.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_web.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/test_web.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/test_web.py From a6a30bc27499dda6092fc04c09e29443470a4612 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 458/554] test(web-app-openpost): move the crossposter test sources/__init__.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/sources/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/__init__.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/__init__.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/__init__.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/__init__.py From ed040359ff6d730f21a2cca40c8e2d6fe0a56bda Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 459/554] test(web-app-openpost): move the crossposter test sources/test_mastodon.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/sources/test_mastodon.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/test_mastodon.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/test_mastodon.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_mastodon.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/test_mastodon.py From b5fd1c9cf698ab88771b0fd13bbb289332235017 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 460/554] test(web-app-openpost): move the crossposter test sources/test_peertube.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/sources/test_peertube.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/test_peertube.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/test_peertube.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_peertube.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/test_peertube.py From 7dec146527452869bd9a14008984366791949be7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 461/554] test(web-app-openpost): move the crossposter test sources/test_pixelfed.py to the mirrored path of files/python --- .../files/crossposter/{crossposter => }/sources/test_pixelfed.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/test_pixelfed.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_pixelfed.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/test_pixelfed.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/test_pixelfed.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/test_pixelfed.py From e1c0489a2c21fcbec06c5f4ee9b593a8b3e37083 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 462/554] test(web-app-openpost): move the crossposter test sources/fixtures/__init__.py to the mirrored path of files/python --- .../crossposter/{crossposter => }/sources/fixtures/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/__init__.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/__init__.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/__init__.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/__init__.py From f38ec123dc542d5aef650b46035fe596a4b09aef Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:25 +0100 Subject: [PATCH 463/554] test(web-app-openpost): move the crossposter test sources/fixtures/pixelfed_statuses.json to the mirrored path of files/python --- .../{crossposter => }/sources/fixtures/pixelfed_statuses.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/pixelfed_statuses.json (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/pixelfed_statuses.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/pixelfed_statuses.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/pixelfed_statuses.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/pixelfed_statuses.json From afc686a99619e7437cdfdd898a6dfb200c6dafb9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 464/554] test(web-app-openpost): move the crossposter test sources/fixtures/mastodon/__init__.py to the mirrored path of files/python --- .../{crossposter => }/sources/fixtures/mastodon/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/mastodon/__init__.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/mastodon/__init__.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/__init__.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/mastodon/__init__.py From b44f79a1a41d9aaab1c66f64a79a2edda94a61b3 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 465/554] test(web-app-openpost): move the crossposter test sources/fixtures/mastodon/account.json to the mirrored path of files/python --- .../{crossposter => }/sources/fixtures/mastodon/account.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/mastodon/account.json (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/account.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/mastodon/account.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/account.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/mastodon/account.json From 72571634014ef10dfd989163b5e30626b5ffb14f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 466/554] test(web-app-openpost): move the crossposter test sources/fixtures/mastodon/statuses.json to the mirrored path of files/python --- .../{crossposter => }/sources/fixtures/mastodon/statuses.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/mastodon/statuses.json (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/statuses.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/mastodon/statuses.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/mastodon/statuses.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/mastodon/statuses.json From 8e209567d5f9f3306967fa58bd568ef70fc84f52 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 467/554] test(web-app-openpost): move the crossposter test sources/fixtures/peertube/__init__.py to the mirrored path of files/python --- .../{crossposter => }/sources/fixtures/peertube/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/peertube/__init__.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/peertube/__init__.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/__init__.py rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/peertube/__init__.py From 9902e573c263fd718f73b9c9658e1ac936235376 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 468/554] test(web-app-openpost): move the crossposter test sources/fixtures/peertube/video_detail.json to the mirrored path of files/python --- .../{crossposter => }/sources/fixtures/peertube/video_detail.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/peertube/video_detail.json (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/video_detail.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/peertube/video_detail.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/video_detail.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/peertube/video_detail.json From 02ca92a630e80c79ae43035e3cda1ffcc442e1c6 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 469/554] test(web-app-openpost): move the crossposter test sources/fixtures/peertube/videos.json to the mirrored path of files/python --- .../{crossposter => }/sources/fixtures/peertube/videos.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/crossposter/{crossposter => }/sources/fixtures/peertube/videos.json (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/videos.json b/tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/peertube/videos.json similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/sources/fixtures/peertube/videos.json rename to tests/unit/python/roles/web-app-openpost/files/crossposter/sources/fixtures/peertube/videos.json From a42b220306236ea43660ad138e4dc94a23cddabe Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 470/554] test(web-app-openpost): move the provider test test___main__.py to the mirrored path of files/python --- .../files/provider/{provider => }/test___main__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/provider/{provider => }/test___main__.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py b/tests/unit/python/roles/web-app-openpost/files/provider/test___main__.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/provider/provider/test___main__.py rename to tests/unit/python/roles/web-app-openpost/files/provider/test___main__.py From 0850fa8f1abb7ea54f96e2d639329d07acc8d2cd Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 471/554] test(web-app-openpost): move the provider test test_linkedin.py to the mirrored path of files/python --- .../files/provider/{provider => }/test_linkedin.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/provider/{provider => }/test_linkedin.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py b/tests/unit/python/roles/web-app-openpost/files/provider/test_linkedin.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/provider/provider/test_linkedin.py rename to tests/unit/python/roles/web-app-openpost/files/provider/test_linkedin.py From 4a270e0effdc451a7e6a54657bd2738988c90d8c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 472/554] test(web-app-openpost): move the provider test test_store.py to the mirrored path of files/python --- .../web-app-openpost/files/provider/{provider => }/test_store.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/python/roles/web-app-openpost/files/provider/{provider => }/test_store.py (100%) diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py b/tests/unit/python/roles/web-app-openpost/files/provider/test_store.py similarity index 100% rename from tests/unit/python/roles/web-app-openpost/files/provider/provider/test_store.py rename to tests/unit/python/roles/web-app-openpost/files/provider/test_store.py From 599da7c3ec7e5c96bfe21cce866bcdd7ecb5d5d0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 473/554] test(web-app-openpost): drop the nested crossposter test package --- .../web-app-openpost/files/crossposter/crossposter/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/__init__.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/crossposter/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 From 790e8333e7d11a4a76d5d4ff6fc90fd8b7f662c7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 474/554] test(web-app-openpost): drop the nested fake provider test package --- .../roles/web-app-openpost/files/provider/provider/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/unit/python/roles/web-app-openpost/files/provider/provider/__init__.py diff --git a/tests/unit/python/roles/web-app-openpost/files/provider/provider/__init__.py b/tests/unit/python/roles/web-app-openpost/files/provider/provider/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 From 060625cbfc1f3d377cc1c2089bb58b959460718d Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 475/554] docs(requirements): show the crossposter and fake provider packages under files/python --- docs/requirements/063-openpost-crossposter.md | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/requirements/063-openpost-crossposter.md b/docs/requirements/063-openpost-crossposter.md index 1beb81ff35..9eae2c38b7 100644 --- a/docs/requirements/063-openpost-crossposter.md +++ b/docs/requirements/063-openpost-crossposter.md @@ -66,22 +66,26 @@ These decisions were confirmed by the operator before implementation starts and ``` roles/web-app-openpost/files/crossposter/ ├── Dockerfile -└── crossposter/ - ├── __init__.py - ├── __main__.py - ├── adapt.py - ├── config.py - ├── notify.py - ├── openpost.py - ├── retry.py - ├── store.py - └── sources/ - ├── __init__.py - ├── mastodon.py - ├── peertube.py - └── pixelfed.py +└── requirements.txt roles/web-app-openpost/files/provider/ -├── Dockerfile +└── Dockerfile +roles/web-app-openpost/files/python/ +├── crossposter/ +│ ├── __init__.py +│ ├── __main__.py +│ ├── adapt.py +│ ├── config.py +│ ├── notify.py +│ ├── openpost.py +│ ├── retry.py +│ ├── service.py +│ ├── store.py +│ ├── web.py +│ └── sources/ +│ ├── __init__.py +│ ├── mastodon.py +│ ├── peertube.py +│ └── pixelfed.py └── provider/ ├── __init__.py ├── __main__.py From 8dca8421d6d9e4a4d8c8d1555c2d6c67b47aed66 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 476/554] refactor(container_networks): read a service's extra aliases from its services.yml network_aliases --- plugins/lookup/container_networks.py | 35 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/plugins/lookup/container_networks.py b/plugins/lookup/container_networks.py index 869fc55b55..e086f2d859 100644 --- a/plugins/lookup/container_networks.py +++ b/plugins/lookup/container_networks.py @@ -5,11 +5,13 @@ block. Reads the service_registry, the rendering role's ``application_id`` and Usage in any service template: {{ lookup('container_networks') | indent(4) }} + {{ lookup('container_networks', service_name) | indent(4) }} -Pass ``provider_self_alias=False`` for a sidecar service that must not carry the -provider's own alias, ``own_network_only=True`` for one that must not -inherit the networks its provider joins as a consumer, and ``aliases=[...]`` -for names this one service answers to on the role's default network. +Pass the service key for a service that answers to extra names on the role's +default network; they are read from ``services..network_aliases`` of +the rendering role. Pass ``provider_self_alias=False`` for a sidecar service +that must not carry the provider's own alias, and ``own_network_only=True`` for +one that must not inherit the networks its provider joins as a consumer. """ from __future__ import annotations @@ -31,8 +33,10 @@ class LookupModule(LookupBase): variables: dict[str, Any] | None = None, **kwargs: Any, ) -> list[str]: - if terms: - raise AnsibleError("container_networks lookup takes no positional terms") + if terms and len(terms) > 1: + raise AnsibleError( + "container_networks lookup takes at most one term, the service key" + ) ctx = build_context(self, variables) @@ -42,14 +46,17 @@ class LookupModule(LookupBase): "container_networks lookup: application_id is required in variables" ) - aliases = kwargs.get("aliases") - if aliases is not None and ( - not isinstance(aliases, list) - or not all(isinstance(alias, str) and alias for alias in aliases) - ): - raise AnsibleError( - "container_networks lookup: aliases must be a list of non-empty strings" - ) + aliases = None + if terms: + path = f"services.{terms[0]}.network_aliases" + aliases = ctx.lookup_config(str(application_id), path, None) + if not isinstance(aliases, list) or not all( + isinstance(alias, str) and alias for alias in aliases + ): + raise AnsibleError( + f"container_networks lookup: {application_id} {path} " + "must be a list of non-empty strings" + ) return [ render_container_networks( From 3d4e932478e027836ae30295bedd8f499731a7aa Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 477/554] fix(networks): leave the default aliases untouched when no service aliases are passed --- utils/networks/render.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/networks/render.py b/utils/networks/render.py index cb81bfe89e..d0775197a2 100644 --- a/utils/networks/render.py +++ b/utils/networks/render.py @@ -211,7 +211,8 @@ def render_container_networks( attachments, default_aliases = _compute_attachments( registry, application_id, deployment_mode, lookup_config, lookup_database ) - default_aliases = list(dict.fromkeys([*default_aliases, *(aliases or [])])) + if aliases: + default_aliases = list(dict.fromkeys([*default_aliases, *aliases])) lines: list[str] = ["networks:"] for att in attachments: if att["is_provider"] and att["topology"] == "default_net": From 8d28c82b95fb6f8e9696ba05516c3990cfa8aaf8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 478/554] test(container_networks): read network_aliases of the named service and reject a missing list --- .../plugins/lookup/test_container_networks.py | 69 ++++++++++++++----- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/tests/unit/python/plugins/lookup/test_container_networks.py b/tests/unit/python/plugins/lookup/test_container_networks.py index 77ed696396..bf91bccea9 100644 --- a/tests/unit/python/plugins/lookup/test_container_networks.py +++ b/tests/unit/python/plugins/lookup/test_container_networks.py @@ -32,10 +32,10 @@ def _make_lookup(vars_=None): class TestContainerNetworksLookup(unittest.TestCase): - def test_raises_when_positional_terms_supplied(self): + def test_raises_when_more_than_one_term_supplied(self): lm = _make_lookup({"application_id": "x", "DEPLOYMENT_MODE": "swarm"}) with self.assertRaises(AnsibleError): - lm.run(["unexpected"], variables=lm._templar.available_variables) + lm.run(["relay", "unexpected"], variables=lm._templar.available_variables) def test_raises_when_application_id_missing(self): lm = _make_lookup({"DEPLOYMENT_MODE": "swarm"}) @@ -71,7 +71,47 @@ class TestContainerNetworksLookup(unittest.TestCase): self.assertEqual(kwargs["application_id"], "web-app-baserow") self.assertEqual(kwargs["deployment_mode"], "compose") - def test_forwards_caller_aliases(self): + def _run_with_configured_aliases(self, configured, render_mock=None): + vars_ = {"application_id": "web-app-x", "DEPLOYMENT_MODE": "compose"} + lm = _make_lookup(vars_) + config_calls: list[tuple] = [] + + def _config_run(args, **_): + config_calls.append(tuple(args)) + return [configured] + + def _get(name, **_): + if name == "config": + return mock.MagicMock(run=_config_run) + return mock.MagicMock(run=lambda *_a, **_k: [{}]) + + with ( + mock.patch( + "utils.networks.lookup_context.build_service_registry_from_applications", + return_value={}, + ), + mock.patch("utils.networks.lookup_context.lookup_loader") as loader_mock, + mock.patch( + "plugins.lookup.container_networks.render_container_networks", + render_mock or mock.MagicMock(return_value="RENDERED"), + ), + ): + loader_mock.get.side_effect = _get + lm.run(["relay"], variables=vars_) + return config_calls + + def test_reads_the_service_network_aliases_from_its_config(self): + render_mock = mock.MagicMock(return_value="RENDERED") + config_calls = self._run_with_configured_aliases( + ["a.example.com"], render_mock + ) + + self.assertIn( + ("web-app-x", "services.relay.network_aliases", None), config_calls + ) + self.assertEqual(render_mock.call_args.kwargs["aliases"], ["a.example.com"]) + + def test_without_a_service_no_aliases_are_read(self): vars_ = {"application_id": "web-app-x", "DEPLOYMENT_MODE": "compose"} lm = _make_lookup(vars_) @@ -87,24 +127,17 @@ class TestContainerNetworksLookup(unittest.TestCase): ) as render_mock, ): loader_mock.get.return_value = mock.MagicMock(run=lambda *_a, **_k: [{}]) - lm.run([], variables=vars_, aliases=["a.example.com"]) + lm.run([], variables=vars_) - self.assertEqual(render_mock.call_args.kwargs["aliases"], ["a.example.com"]) + self.assertIsNone(render_mock.call_args.kwargs["aliases"]) - def test_rejects_aliases_that_are_not_a_list_of_strings(self): - vars_ = {"application_id": "web-app-x", "DEPLOYMENT_MODE": "compose"} - lm = _make_lookup(vars_) + def test_rejects_network_aliases_that_are_not_a_list_of_strings(self): + with self.assertRaises(AnsibleError): + self._run_with_configured_aliases("a.example.com") - with ( - mock.patch( - "utils.networks.lookup_context.build_service_registry_from_applications", - return_value={}, - ), - mock.patch("utils.networks.lookup_context.lookup_loader") as loader_mock, - ): - loader_mock.get.return_value = mock.MagicMock(run=lambda *_a, **_k: [{}]) - with self.assertRaises(AnsibleError): - lm.run([], variables=vars_, aliases="a.example.com") + def test_rejects_a_service_without_network_aliases(self): + with self.assertRaises(AnsibleError): + self._run_with_configured_aliases(None) def test_falls_back_to_compose_when_deployment_mode_unset(self): vars_ = {"application_id": "web-app-x"} From c78d10567034800aa8f4fda56feb96d2e2c8a55a Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 479/554] feat(lookup): add openpost_relay_domains for the names OpenPost's relay answers to --- plugins/lookup/openpost_relay_domains.py | 87 ++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 plugins/lookup/openpost_relay_domains.py diff --git a/plugins/lookup/openpost_relay_domains.py b/plugins/lookup/openpost_relay_domains.py new file mode 100644 index 0000000000..125712aad7 --- /dev/null +++ b/plugins/lookup/openpost_relay_domains.py @@ -0,0 +1,87 @@ +"""Lookup ``openpost_relay_domains``: the names OpenPost's egress relay answers to. + +Usage: + + {{ lookup('openpost_relay_domains') }} + +Returns OpenPost's canonical domain, then the canonical domain of every sibling +under ``services.relay.siblings`` whose service flag is on, then the object +store's public domain when OpenPost uses one. +""" + +from __future__ import annotations + +from collections.abc import Callable, Mapping +from typing import Any + +from ansible.errors import AnsibleError +from ansible.module_utils.parsing.convert_bool import boolean +from ansible.plugins.loader import lookup_loader +from ansible.plugins.lookup import LookupBase + +APPLICATION_ID = "web-app-openpost" +SIBLINGS_PATH = "services.relay.siblings" + + +def relay_domains( + own_domain: str, + siblings: Mapping[str, str], + sibling_enabled: Callable[[str], Any], + domain_of: Callable[[str], str], + objstore_domain: str, +) -> list[str]: + """Return the relay's names in alias order. + + Args: + own_domain: OpenPost's canonical domain. + siblings: service key to role id of every sibling the relay may carry. + sibling_enabled: the service flag of a sibling's key. + domain_of: the canonical domain of a role id. + objstore_domain: the object store's public domain, "" without one. + + Returns: + The own domain, the enabled siblings' domains, then the object store's. + """ + domains = [own_domain] + domains.extend( + domain_of(role) + for key, role in siblings.items() + if boolean(sibling_enabled(key)) + ) + if objstore_domain: + domains.append(objstore_domain) + return domains + + +class LookupModule(LookupBase): + def run( + self, + terms: list[Any] | None, + variables: dict[str, Any] | None = None, + **kwargs: Any, + ) -> list[list[str]]: + if terms: + raise AnsibleError("lookup('openpost_relay_domains') expects no terms.") + + def _lookup(name: str, *args: str) -> Any: + plugin = lookup_loader.get( + name, loader=self._loader, templar=self._templar + ) + return plugin.run(list(args), variables=variables)[0] + + objstore_domain = ( + str(_lookup("objstore", APPLICATION_ID, "public_domain")) + if boolean(_lookup("objstore", APPLICATION_ID, "enabled")) + else "" + ) + return [ + relay_domains( + own_domain=str(_lookup("domain", APPLICATION_ID)), + siblings=_lookup("config", APPLICATION_ID, SIBLINGS_PATH), + sibling_enabled=lambda key: _lookup( + "config", APPLICATION_ID, f"services.{key}.enabled" + ), + domain_of=lambda role: str(_lookup("domain", role)), + objstore_domain=objstore_domain, + ) + ] From 132cfb6526379f746d7838b40b2bacba9d5520f4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 480/554] test(lookup): cover openpost_relay_domains order, flags and object store --- .../lookup/test_openpost_relay_domains.py | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 tests/unit/python/plugins/lookup/test_openpost_relay_domains.py diff --git a/tests/unit/python/plugins/lookup/test_openpost_relay_domains.py b/tests/unit/python/plugins/lookup/test_openpost_relay_domains.py new file mode 100644 index 0000000000..ed70efc4e2 --- /dev/null +++ b/tests/unit/python/plugins/lookup/test_openpost_relay_domains.py @@ -0,0 +1,92 @@ +from __future__ import annotations + +import unittest +import unittest.mock as mock + +from ansible.errors import AnsibleError + +from plugins.lookup import openpost_relay_domains as relay + +SIBLINGS = { + "mastodon": "web-app-mastodon", + "pixelfed": "web-app-pixelfed", + "peertube": "web-app-peertube", +} +DOMAINS = { + "web-app-openpost": "publish.example", + "web-app-mastodon": "microblog.example", + "web-app-pixelfed": "picture.example", + "web-app-peertube": "video.example", +} + + +class TestRelayDomains(unittest.TestCase): + def test_own_domain_enabled_siblings_and_object_store_in_order(self): + enabled = {"mastodon": True, "pixelfed": "False", "peertube": "true"} + self.assertEqual( + relay.relay_domains( + "publish.example", + SIBLINGS, + enabled.__getitem__, + DOMAINS.__getitem__, + "s3.example", + ), + ["publish.example", "microblog.example", "video.example", "s3.example"], + ) + + def test_without_siblings_or_object_store_only_the_own_domain_remains(self): + self.assertEqual( + relay.relay_domains( + "publish.example", SIBLINGS, lambda _: False, DOMAINS.__getitem__, "" + ), + ["publish.example"], + ) + + def test_a_flag_that_is_not_a_boolean_fails(self): + with self.assertRaises(TypeError): + relay.relay_domains( + "publish.example", SIBLINGS, lambda _: "maybe", DOMAINS.__getitem__, "" + ) + + +class TestLookup(unittest.TestCase): + def _run(self, objstore_enabled): + answers = { + ("config", "web-app-openpost", "services.relay.siblings"): SIBLINGS, + ("config", "web-app-openpost", "services.mastodon.enabled"): True, + ("config", "web-app-openpost", "services.pixelfed.enabled"): False, + ("config", "web-app-openpost", "services.peertube.enabled"): False, + ("objstore", "web-app-openpost", "enabled"): objstore_enabled, + ("objstore", "web-app-openpost", "public_domain"): "s3.example", + } + + def _get(name, **_): + def _run(args, **__): + if name == "domain": + return [DOMAINS[args[0]]] + return [answers[(name, *args)]] + + return mock.MagicMock(run=_run) + + with mock.patch.object(relay, "lookup_loader") as loader: + loader.get.side_effect = _get + return relay.LookupModule().run([], variables={}) + + def test_reads_siblings_flags_and_the_object_store(self): + self.assertEqual( + self._run(True), + [["publish.example", "microblog.example", "s3.example"]], + ) + + def test_skips_the_object_store_when_openpost_uses_none(self): + self.assertEqual( + self._run(False), [["publish.example", "microblog.example"]] + ) + + def test_rejects_terms(self): + with self.assertRaises(AnsibleError): + relay.LookupModule().run(["unexpected"], variables={}) + + +if __name__ == "__main__": + unittest.main() From 1c8bb3b801157d1c4a716fdfbb3fe674c7abb727 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 481/554] refactor(web-app-openpost): declare the relay, simulator and fake provider aliases as network_aliases --- roles/web-app-openpost/meta/services.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/meta/services.yml b/roles/web-app-openpost/meta/services.yml index 29521703d1..abbad8dcd6 100644 --- a/roles/web-app-openpost/meta/services.yml +++ b/roles/web-app-openpost/meta/services.yml @@ -113,6 +113,11 @@ relay: internal: http: 80 https: 443 + siblings: + mastodon: web-app-mastodon + pixelfed: web-app-pixelfed + peertube: web-app-peertube + network_aliases: "{{ lookup('openpost_relay_domains') }}" # nocheck: playwright-service-flag, dynamic-flag simulator: enabled: false @@ -133,7 +138,7 @@ simulator: internal: http: 8080 https: 443 - hosts: + network_aliases: - api.twitter.com - upload.twitter.com - graph.facebook.com @@ -172,7 +177,7 @@ provider: https: 443 local: http: 8107 - hosts: + network_aliases: - www.linkedin.com - api.linkedin.com From a9af52a6e8e7d34a26b53401eb608bf85618db4f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 482/554] refactor(web-app-openpost): read the relay siblings and every alias list from services.yml --- roles/web-app-openpost/vars/main.yml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/roles/web-app-openpost/vars/main.yml b/roles/web-app-openpost/vars/main.yml index 39b229249b..a6bd0ff0e7 100644 --- a/roles/web-app-openpost/vars/main.yml +++ b/roles/web-app-openpost/vars/main.yml @@ -39,21 +39,8 @@ OPENPOST_ORGANISATION_WORKSPACE: "{{ SOFTWARE_NAME }}" OPENPOST_BOOTSTRAP_ADMINS: - "{{ lookup('users', 'platform_administrator').email }}" -OPENPOST_RELAY_SIBLINGS: - mastodon: web-app-mastodon - pixelfed: web-app-pixelfed - peertube: web-app-peertube -OPENPOST_RELAY_DOMAINS: >- - {%- set _domains = [lookup('domain', application_id)] -%} - {%- for _key, _role in OPENPOST_RELAY_SIBLINGS.items() -%} - {%- if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%} - {%- set _ = _domains.append(lookup('domain', _role)) -%} - {%- endif -%} - {%- endfor -%} - {%- if OPENPOST_OBJSTORE_ENABLED | bool -%} - {%- set _ = _domains.append(lookup('objstore', application_id, 'public_domain')) -%} - {%- endif -%} - {{ _domains }} +OPENPOST_RELAY_SIBLINGS: "{{ lookup('config', application_id, 'services.relay.siblings') }}" +OPENPOST_RELAY_DOMAINS: "{{ lookup('config', application_id, 'services.relay.network_aliases') }}" OPENPOST_PINNED_INSTANCES: >- {%- set _instances = [] -%} {%- for _key in ['mastodon', 'pixelfed'] -%} @@ -74,12 +61,12 @@ OPENPOST_RELAY_UPSTREAM_HTTP_PORT: "{{ lookup('config', 'svc-prx-openresty', 'se OPENPOST_SIMULATOR_ENABLED: "{{ lookup('config', application_id, 'services.simulator.enabled') | bool }}" OPENPOST_SIMULATOR_NAME: "{{ lookup('config', application_id, 'services.simulator.name') }}" OPENPOST_SIMULATOR_DIR: "{{ [lookup('container', application_id, 'directories.config'), 'simulator'] | path_join }}" -OPENPOST_SIMULATOR_HOSTS: "{{ lookup('config', application_id, 'services.simulator.hosts') }}" +OPENPOST_SIMULATOR_HOSTS: "{{ lookup('config', application_id, 'services.simulator.network_aliases') }}" OPENPOST_PROVIDER: "{{ lookup('config', application_id, 'services.provider') }}" OPENPOST_PROVIDER_ENABLED: "{{ lookup('config', application_id, 'services.provider.enabled') | bool }}" OPENPOST_PROVIDER_NAME: "{{ OPENPOST_PROVIDER.name }}" OPENPOST_PROVIDER_UID: "{{ OPENPOST_PROVIDER.uid }}" -OPENPOST_PROVIDER_HOSTS: "{{ OPENPOST_PROVIDER.hosts }}" +OPENPOST_PROVIDER_HOSTS: "{{ OPENPOST_PROVIDER.network_aliases }}" OPENPOST_PROVIDER_DIR: "{{ [lookup('container', application_id, 'directories.config'), 'provider'] | path_join }}" OPENPOST_PROVIDER_CONFIG_HOST: "{{ [OPENPOST_PROVIDER_DIR, 'provider.json'] | path_join }}" OPENPOST_PROVIDER_KEY_HOST: "{{ [OPENPOST_PROVIDER_DIR, 'server.key'] | path_join }}" From a232b7023f90d2bd7eb3871ca9a78d431ffd6679 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 483/554] refactor(web-app-openpost): let container_networks read each sidecar's network_aliases --- roles/web-app-openpost/templates/compose.yml.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/web-app-openpost/templates/compose.yml.j2 b/roles/web-app-openpost/templates/compose.yml.j2 index 4810038e99..39ecb9a9f5 100644 --- a/roles/web-app-openpost/templates/compose.yml.j2 +++ b/roles/web-app-openpost/templates/compose.yml.j2 @@ -19,7 +19,7 @@ {{ lookup('compose_only', 'container_name', OPENPOST_RELAY_NAME) }} {{ lookup('container_volumes', service_name) | indent(4) }} {{ lookup('container_extra_hosts', host_alias=True) | indent(4) }} - {{ lookup('container_networks', aliases=OPENPOST_RELAY_DOMAINS) | indent(4) }} + {{ lookup('container_networks', service_name) | indent(4) }} {% if OPENPOST_CROSSPOSTER_ENABLED | bool %} {% set service_name = 'crossposter' %} @@ -57,7 +57,7 @@ - PKCS12 - --disable-banner {{ lookup('container_volumes', service_name) | indent(4) }} - {{ lookup('container_networks', aliases=OPENPOST_SIMULATOR_HOSTS) | indent(4) }} + {{ lookup('container_networks', service_name) | indent(4) }} {% endif %} {% if OPENPOST_PROVIDER_ENABLED | bool %} @@ -77,7 +77,7 @@ {{ lookup('compose_restart') }} {{ lookup('container_ports', ['provider', 'http', DOCKER_BIND_HOST]) | indent(4) }} {{ lookup('container_volumes', service_name) | indent(4) }} - {{ lookup('container_networks', aliases=OPENPOST_PROVIDER_HOSTS) | indent(4) }} + {{ lookup('container_networks', service_name) | indent(4) }} {% endif %} {{ lookup('compose_volumes') }} From 841c62fd1abb2831a1f8f2aff84d5c19c9c2b291 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 484/554] feat(meta): list the roles whose networks.yml sets local.outside_pool --- utils/meta/scan.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/meta/scan.py b/utils/meta/scan.py index caf2e33d7e..cf7bdd801c 100644 --- a/utils/meta/scan.py +++ b/utils/meta/scan.py @@ -115,6 +115,15 @@ def iter_subnets() -> Iterable[tuple[str, ipaddress.IPv4Network]]: continue +def iter_outside_pool_roles() -> Iterable[str]: + """Yield every role whose ``meta/networks.yml`` sets ``local.outside_pool``.""" + for role_dir in iter_role_dirs(): + networks = _load_yaml(role_dir / ROLE_FILE_META_NETWORKS) + local = networks.get("local") if isinstance(networks, dict) else None + if isinstance(local, dict) and local.get("outside_pool") is True: + yield role_dir.name + + def occupied_ports_for(scope: str, category: str) -> list[int]: """Return the sorted, de-duplicated list of host-bound ports in use for ``.``. From a8f84e6dcb3023aa73de7a0e34ecdba0a8c27b5c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 485/554] feat(lookup): add role_subnet_exceptions collecting the roles that set local.outside_pool --- plugins/lookup/role_subnet_exceptions.py | 70 ++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 plugins/lookup/role_subnet_exceptions.py diff --git a/plugins/lookup/role_subnet_exceptions.py b/plugins/lookup/role_subnet_exceptions.py new file mode 100644 index 0000000000..4e777535be --- /dev/null +++ b/plugins/lookup/role_subnet_exceptions.py @@ -0,0 +1,70 @@ +"""Lookup ``role_subnet_exceptions``: the roles whose local subnet sits outside +``NETWORK_ROLE_SUBNET_POOL``. + +Usage: + + {{ lookup('role_subnet_exceptions') }} # ['web-app-bigbluebutton', ...] + +A role declares the exception itself, next to the subnet it concerns, with +``local.outside_pool: true`` in its ``meta/networks.yml``. Consumers resolve +the returned ids to subnets through ``lookup('role_subnets', ...)``. +""" + +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any + +from ansible.errors import AnsibleError +from ansible.plugins.loader import lookup_loader +from ansible.plugins.lookup import LookupBase + +from utils.roles.applications.config import get as get_app_conf + +FLAG_PATH = "networks.local.outside_pool" + + +def outside_pool_roles(applications: Mapping[str, Any]) -> list[str]: + """Return the sorted ids of the applications that declare the flag. + + Args: + applications: the merged ``lookup('applications')`` mapping. + + Returns: + Every application id whose ``networks.local.outside_pool`` is true. + """ + roles: list[str] = [] + for app_id in sorted(applications): + flag = get_app_conf( + applications=applications, + application_id=app_id, + config_path=FLAG_PATH, + strict=False, + default=False, + skip_missing_app=True, + ) + if not isinstance(flag, bool): + raise AnsibleError( + f"role_subnet_exceptions: {app_id} {FLAG_PATH} must be a boolean, " + f"got {flag!r}" + ) + if flag: + roles.append(app_id) + return roles + + +class LookupModule(LookupBase): + def run( + self, + terms: list[Any] | None, + variables: dict[str, Any] | None = None, + **kwargs: Any, + ) -> list[list[str]]: + if terms: + raise AnsibleError("lookup('role_subnet_exceptions') expects no terms.") + applications = lookup_loader.get( + "applications", + loader=getattr(self, "_loader", None), + templar=getattr(self, "_templar", None), + ).run([], variables=variables)[0] + return [outside_pool_roles(applications)] From 80dc403a0e7e74d074435f1fad7b9df7c9e5ddff Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 486/554] test(lookup): cover role_subnet_exceptions selection and flag type --- .../lookup/test_role_subnet_exceptions.py | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/unit/python/plugins/lookup/test_role_subnet_exceptions.py diff --git a/tests/unit/python/plugins/lookup/test_role_subnet_exceptions.py b/tests/unit/python/plugins/lookup/test_role_subnet_exceptions.py new file mode 100644 index 0000000000..8cb5316cfb --- /dev/null +++ b/tests/unit/python/plugins/lookup/test_role_subnet_exceptions.py @@ -0,0 +1,54 @@ +from __future__ import annotations + +import unittest +import unittest.mock as mock + +from ansible.errors import AnsibleError + +from plugins.lookup import role_subnet_exceptions +from plugins.lookup.role_subnet_exceptions import LookupModule, outside_pool_roles + + +def _app(local): + return {"networks": {"local": local}} + + +APPLICATIONS = { + "web-app-openpost": _app({"subnet": "192.88.99.0/24", "outside_pool": True}), + "web-app-bigbluebutton": _app({"subnet": "10.7.7.0/24", "outside_pool": True}), + "web-app-pooled": _app({"subnet": "192.168.10.0/24", "outside_pool": False}), + "web-app-plain": _app({"subnet": "192.168.11.0/24"}), + "svc-without-networks": {}, +} + + +class TestOutsidePoolRoles(unittest.TestCase): + def test_only_the_flagged_roles_in_sorted_order(self): + self.assertEqual( + outside_pool_roles(APPLICATIONS), + ["web-app-bigbluebutton", "web-app-openpost"], + ) + + def test_a_flag_that_is_not_a_boolean_fails(self): + with self.assertRaises(AnsibleError): + outside_pool_roles({"web-app-x": _app({"outside_pool": "yes"})}) + + +class TestLookup(unittest.TestCase): + def test_reads_the_merged_applications(self): + with mock.patch.object(role_subnet_exceptions, "lookup_loader") as loader: + loader.get.return_value = mock.MagicMock( + run=mock.MagicMock(return_value=[APPLICATIONS]) + ) + result = LookupModule().run([], variables={}) + + self.assertEqual(result, [["web-app-bigbluebutton", "web-app-openpost"]]) + self.assertEqual(loader.get.call_args.args, ("applications",)) + + def test_rejects_terms(self): + with self.assertRaises(AnsibleError): + LookupModule().run(["unexpected"], variables={}) + + +if __name__ == "__main__": + unittest.main() From 0ccc815c70f97e2cfd4e5c222119be8493d9489b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 487/554] feat(role_subnets): render an unrendered group var term before reading its role ids --- plugins/lookup/role_subnets.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/role_subnets.py b/plugins/lookup/role_subnets.py index b3a06976a1..17d8e158bf 100644 --- a/plugins/lookup/role_subnets.py +++ b/plugins/lookup/role_subnets.py @@ -13,6 +13,10 @@ Usage: Terms may be role ids or lists of them, mixed. A role that declares no local subnet raises, because a silently dropped entry would narrow whatever firewall or trust list consumes the result. + +A term may also be the unrendered template text of a group var such as +``NETWORK_ROLE_SUBNET_EXCEPTION_ROLES``, which reaches a lookup as the file +holds it; it is rendered before its role ids are read. """ from __future__ import annotations @@ -22,10 +26,17 @@ from typing import Any from ansible.errors import AnsibleError from ansible.plugins.loader import lookup_loader from ansible.plugins.lookup import LookupBase +from ansible.template import trust_as_template _SUBNET_PATH = "networks.local.subnet" +def _rendered(templar: Any, term: Any) -> Any: + if isinstance(term, str) and "{{" in term and templar is not None: + return templar.template(trust_as_template(term)) + return term + + def _flattened(terms: list[Any]) -> list[str]: roles: list[str] = [] for term in terms: @@ -43,7 +54,8 @@ class LookupModule(LookupBase): variables: dict[str, Any] | None = None, **kwargs: Any, ) -> list[Any]: - roles = _flattened(terms or []) + templar = getattr(self, "_templar", None) + roles = _flattened([_rendered(templar, term) for term in terms or []]) if not roles: raise AnsibleError( "lookup('role_subnets', ) expects " @@ -52,7 +64,7 @@ class LookupModule(LookupBase): config = lookup_loader.get( "config", loader=getattr(self, "_loader", None), - templar=getattr(self, "_templar", None), + templar=templar, ) subnets: list[str] = [] for role in roles: From 52d4e2e100e0c4d2527451e7a0083de00d356a63 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:26 +0100 Subject: [PATCH 488/554] test(role_subnets): cover role ids, lists and a templated group var term --- .../plugins/lookup/test_role_subnets.py | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/unit/python/plugins/lookup/test_role_subnets.py diff --git a/tests/unit/python/plugins/lookup/test_role_subnets.py b/tests/unit/python/plugins/lookup/test_role_subnets.py new file mode 100644 index 0000000000..9a9e74f4af --- /dev/null +++ b/tests/unit/python/plugins/lookup/test_role_subnets.py @@ -0,0 +1,69 @@ +from __future__ import annotations + +import unittest +import unittest.mock as mock + +from ansible.errors import AnsibleError + +from plugins.lookup import role_subnets +from plugins.lookup.role_subnets import LookupModule + +SUBNETS = { + "web-app-bigbluebutton": "10.7.7.0/24", + "web-app-openpost": "192.88.99.0/24", +} + + +class _Templar: + def __init__(self, rendered): + self.rendered = rendered + self.calls: list[str] = [] + + def template(self, value): + self.calls.append(str(value)) + return self.rendered + + +def _run(terms, templar=None): + lookup = LookupModule() + lookup._templar = templar + lookup._loader = mock.MagicMock() + config = mock.MagicMock( + run=lambda args, **_: [SUBNETS.get(args[0])], + ) + with mock.patch.object(role_subnets, "lookup_loader") as loader: + loader.get.return_value = config + return lookup.run(terms, variables={})[0] + + +class TestRoleSubnets(unittest.TestCase): + def test_role_ids_and_lists_of_them_resolve_in_order(self): + self.assertEqual( + _run(["web-app-openpost", ["web-app-bigbluebutton"]]), + ["192.88.99.0/24", "10.7.7.0/24"], + ) + + def test_an_unrendered_group_var_is_rendered_before_its_ids_are_read(self): + templar = _Templar(["web-app-bigbluebutton", "web-app-openpost"]) + self.assertEqual( + _run(["{{ lookup('role_subnet_exceptions') }}"], templar), + ["10.7.7.0/24", "192.88.99.0/24"], + ) + self.assertEqual(templar.calls, ["{{ lookup('role_subnet_exceptions') }}"]) + + def test_a_plain_role_id_is_not_templated(self): + templar = _Templar(["unused"]) + _run(["web-app-openpost"], templar) + self.assertEqual(templar.calls, []) + + def test_a_role_without_a_subnet_fails(self): + with self.assertRaises(AnsibleError): + _run(["web-app-unknown"]) + + def test_no_role_fails(self): + with self.assertRaises(AnsibleError): + _run([]) + + +if __name__ == "__main__": + unittest.main() From b4727b9be51eb98718b8d0e9c8f394d23b3f5b78 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:27 +0100 Subject: [PATCH 489/554] refactor(web-app-bigbluebutton): declare the subnet outside the role subnet pool in networks.yml --- roles/web-app-bigbluebutton/meta/networks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-bigbluebutton/meta/networks.yml b/roles/web-app-bigbluebutton/meta/networks.yml index ec12c90e6e..329ea476f8 100644 --- a/roles/web-app-bigbluebutton/meta/networks.yml +++ b/roles/web-app-bigbluebutton/meta/networks.yml @@ -2,3 +2,4 @@ meshes: [] local: subnet: 10.7.7.0/24 + outside_pool: true From 19fd8f0933e6fe02144321d107547a20bc3c5fb4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:27 +0100 Subject: [PATCH 490/554] refactor(web-app-openpost): declare the relay subnet outside the role subnet pool in networks.yml --- roles/web-app-openpost/meta/networks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/web-app-openpost/meta/networks.yml b/roles/web-app-openpost/meta/networks.yml index d3271bfd99..92c875000f 100644 --- a/roles/web-app-openpost/meta/networks.yml +++ b/roles/web-app-openpost/meta/networks.yml @@ -2,3 +2,4 @@ meshes: [] local: subnet: 192.88.99.0/24 + outside_pool: true From ef17f7710c68180eade797cb962efb6bb566af95 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:27 +0100 Subject: [PATCH 491/554] refactor(networks): collect NETWORK_ROLE_SUBNET_EXCEPTION_ROLES through role_subnet_exceptions --- group_vars/all/08_networks.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/group_vars/all/08_networks.yml b/group_vars/all/08_networks.yml index 868c09b5b1..89a7f876db 100644 --- a/group_vars/all/08_networks.yml +++ b/group_vars/all/08_networks.yml @@ -20,9 +20,7 @@ NETWORK_PRIVATE_CIDRS: class_c: "192.168.0.0/16" NETWORK_INTERNAL_CIDRS: "{{ [NETWORK_LOOPBACK_CIDR] + (NETWORK_PRIVATE_CIDRS.values() | list) }}" NETWORK_ROLE_SUBNET_POOL: "{{ NETWORK_PRIVATE_CIDRS.class_c }}" -NETWORK_ROLE_SUBNET_EXCEPTION_ROLES: - - web-app-bigbluebutton - - web-app-openpost +NETWORK_ROLE_SUBNET_EXCEPTION_ROLES: "{{ lookup('role_subnet_exceptions') }}" NETWORK_SWARM_GWBRIDGE_POOL: "{{ NETWORK_PRIVATE_CIDRS.class_b }}" NETWORK_TRUSTED_PROXY_CIDRS: "{{ [NETWORK_LOOPBACK_IPV4, NETWORK_LOOPBACK_IPV6] + (NETWORK_PRIVATE_CIDRS.values() | list) }}" NETWORK_DOCKER_ADDRESS_POOLS: From ff7a23ce18f351e496402e5c03ee50a08c00ad77 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:27 +0100 Subject: [PATCH 492/554] test(lint): read subnet pool exceptions from networks.yml and forbid a listed exception var --- .../roles/meta/test_role_subnet_pool.py | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/tests/lint/ansible/roles/meta/test_role_subnet_pool.py b/tests/lint/ansible/roles/meta/test_role_subnet_pool.py index d45f12251f..0f8b637cea 100644 --- a/tests/lint/ansible/roles/meta/test_role_subnet_pool.py +++ b/tests/lint/ansible/roles/meta/test_role_subnet_pool.py @@ -10,11 +10,12 @@ excludes that role. That is not hypothetical: a firewall range derived from the pool by eye would have cut BigBlueButton off, because its subnet is the one that sits outside. -A role that genuinely cannot choose its block is named in -``NETWORK_ROLE_SUBNET_EXCEPTION_ROLES``. The list carries role ids rather than -CIDRs on purpose: the block is already declared in that role's -``meta/networks.yml``, and repeating it here would be the same duplication one -layer up. Consumers resolve the ids through ``lookup('role_subnets', ...)``. +A role that genuinely cannot choose its block declares that next to the block, +with ``local.outside_pool: true`` in its ``meta/networks.yml``. +``NETWORK_ROLE_SUBNET_EXCEPTION_ROLES`` collects those roles through +``lookup('role_subnet_exceptions')`` rather than listing them, so the +declaration is never stated twice, and consumers resolve the ids through +``lookup('role_subnets', ...)``. """ from __future__ import annotations @@ -25,7 +26,7 @@ import unittest import jinja2 from utils.cache.yaml import load_yaml_any -from utils.meta.scan import iter_subnets +from utils.meta.scan import iter_outside_pool_roles, iter_subnets from . import PROJECT_ROOT @@ -40,20 +41,18 @@ def _declared_space() -> tuple[list[ipaddress.IPv4Network], list[str]]: pool = jinja2.Template( pool, autoescape=jinja2.select_autoescape(default_for_string=False) ).render(**data) - roles = data.get("NETWORK_ROLE_SUBNET_EXCEPTION_ROLES") or [] - if not isinstance(pool, str) or not isinstance(roles, list): + if not isinstance(pool, str): raise TypeError( - f"{NETWORKS_FILE} must declare NETWORK_ROLE_SUBNET_POOL as a string " - "and NETWORK_ROLE_SUBNET_EXCEPTION_ROLES as a list of role ids" + f"{NETWORKS_FILE} must declare NETWORK_ROLE_SUBNET_POOL as a string" ) declared = dict(iter_subnets()) raw = [pool] - for role in roles: - subnet = declared.get(str(role)) + for role in iter_outside_pool_roles(): + subnet = declared.get(role) if subnet is None: raise AssertionError( - f"{NETWORKS_FILE}: NETWORK_ROLE_SUBNET_EXCEPTION_ROLES names " - f"'{role}', which declares no networks.local.subnet" + f"{role} sets networks.local.outside_pool but declares no " + "networks.local.subnet" ) raw.append(str(subnet)) return [ipaddress.ip_network(entry, strict=True) for entry in raw], raw @@ -76,11 +75,20 @@ class TestRoleSubnetPool(unittest.TestCase): + ", ".join(raw) + "\n\nFix: pick a subnet inside the pool via " "`infinito contributing network address suggest`, or, when the " - "block is pinned by something outside this repository, name the " - "role in NETWORK_ROLE_SUBNET_EXCEPTION_ROLES in " - "group_vars/all/08_networks.yml." + "block is pinned by something outside this repository, set " + "networks.local.outside_pool: true in the role's " + "meta/networks.yml." ) + def test_the_exceptions_are_collected_from_the_roles(self) -> None: + data = load_yaml_any(str(NETWORKS_FILE), default_if_missing={}) or {} + self.assertEqual( + data.get("NETWORK_ROLE_SUBNET_EXCEPTION_ROLES"), + "{{ lookup('role_subnet_exceptions') }}", + f"{NETWORKS_FILE}: NETWORK_ROLE_SUBNET_EXCEPTION_ROLES must collect " + "the roles that set networks.local.outside_pool, not list them", + ) + def test_the_exceptions_are_not_already_covered(self) -> None: """An exception inside the pool is dead weight that outlives its reason.""" allowed, raw = _declared_space() @@ -88,10 +96,10 @@ class TestRoleSubnetPool(unittest.TestCase): redundant = [entry for entry in allowed[1:] if entry.subnet_of(pool)] if redundant: self.fail( - "NETWORK_ROLE_SUBNET_EXCEPTION_ROLES names role(s) whose subnet " + "networks.local.outside_pool is set on role(s) whose subnet " f"already sits inside {raw[0]}: " f"{', '.join(str(entry) for entry in redundant)}. " - "Remove them; the pool already admits those addresses." + "Drop the flag; the pool already admits those addresses." ) From 6510053c7fd2e4213067a721a35b2fb710805e69 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:27 +0100 Subject: [PATCH 493/554] docs(networks): document local.outside_pool in networks.yml --- docs/contributing/design/role/services/layout.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/contributing/design/role/services/layout.md b/docs/contributing/design/role/services/layout.md index 8674265aac..0cce4e47f2 100644 --- a/docs/contributing/design/role/services/layout.md +++ b/docs/contributing/design/role/services/layout.md @@ -187,11 +187,13 @@ networks: local: subnet: 192.168.101.112/28 # required; CIDR of the role's docker network dns_resolver: 192.168.102.29 # optional, only when a fixed DNS resolver IP is needed (today: mailu) + outside_pool: true # optional, only when something outside the repository pins the subnet outside NETWORK_ROLE_SUBNET_POOL (today: bigbluebutton, openpost) ``` The role's name is implied by the path. There is NO `web-app-` key inside the file. -The materialised path is `applications..networks.local.{subnet,dns_resolver}`. +The materialised path is `applications..networks.local.{subnet,dns_resolver,outside_pool}`. +`NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` collects every role that sets `outside_pool` through `lookup('role_subnet_exceptions')`. ## Per-Entity Ports: `meta/services.yml..ports` 🚪 From a6fda6c40e5d63de7c77179ea14d5fdc719e4b99 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:27 +0100 Subject: [PATCH 494/554] docs(requirements): describe the relay aliases and subnet exception as networks.yml and services.yml declarations --- docs/requirements/062-web-app-openpost.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/requirements/062-web-app-openpost.md b/docs/requirements/062-web-app-openpost.md index 428fc8786b..f2211bc3c4 100644 --- a/docs/requirements/062-web-app-openpost.md +++ b/docs/requirements/062-web-app-openpost.md @@ -100,7 +100,7 @@ These decisions were confirmed by the operator before implementation starts and | 1 | OpenPost is the publishing desk. | Only candidate covering every required source and target network. | | 2 | Role id `web-app-openpost`, canonical domain `publish.{{ DOMAIN_PRIMARY }}`. | `social.{{ DOMAIN_PRIMARY }}` belongs to `web-app-friendica`. | | 3 | The role runs the official `ghcr.io/getopenpost/openpost` image unmodified, pinned to a release tag and configured through environment variables only. | The application is integrated like every other role; the project does not maintain OpenPost. | -| 4 | OpenPost reaches the deployment's own sibling vhosts only through an always-on, role-local egress relay on the role network `192.88.99.0/24` (declared in `meta/networks.yml`, listed in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES`), with exact aliases and an SNI allowlist, forwarding to the shared proxy. | One proven path for development, CI and production, including split-horizon DNS and WireGuard meshes, with the guard intact for every other destination; the existing role-subnet exception mechanism already carries out-of-pool blocks, so no new SPOT is needed. | +| 4 | OpenPost reaches the deployment's own sibling vhosts only through an always-on, role-local egress relay on the role network `192.88.99.0/24` (declared in `meta/networks.yml` with `outside_pool: true`, which `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` collects), with exact aliases and an SNI allowlist, forwarding to the shared proxy. | One proven path for development, CI and production, including split-horizon DNS and WireGuard meshes, with the guard intact for every other destination; the existing role-subnet exception mechanism already carries out-of-pool blocks, so no new SPOT is needed. | | 5 | Keycloak SSO through native OIDC (`sso.flavor: oidc`); publishing permissions are enforced through OpenPost workspace roles. | OpenPost ships an OIDC adapter and does not consume group claims. | | 6 | Shared `svc-db-postgres`; media on `web-svc-seaweedfs` S3 when deployed, a role volume otherwise. | Postgres is the only multi-process database; S3 gives public media URLs for Meta. | | 7 | One `all` process with one replica in compose and swarm. | State lives in Postgres and S3, so rescheduling is safe; split `web`/`worker` scaling is out of scope. | @@ -197,8 +197,8 @@ simulator: ### Egress relay (story AC2, AC4, AC7) -- [ ] `roles/web-app-openpost/meta/networks.yml` declares the role subnet `192.88.99.0/24`, a block outside every range OpenPost's guard rejects and outside every Docker, mesh, Tor and role subnet pool, and `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` in `group_vars/all/08_networks.yml` names the role; the network is a bridge in compose and an overlay in swarm. -- [x] A `relay` entity running a pinned `nginx` image carries network aliases, passed through the `aliases` argument of the shared `container_networks` lookup, only for the canonical domains of the deployed sibling roles OpenPost publishes to (`web-app-mastodon`, `web-app-pixelfed`, `web-app-peertube`), each gated by that role's dynamic service flag. +- [ ] `roles/web-app-openpost/meta/networks.yml` declares the role subnet `192.88.99.0/24`, a block outside every range OpenPost's guard rejects and outside every Docker, mesh, Tor and role subnet pool, and sets `outside_pool: true` next to it, which `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` in `group_vars/all/08_networks.yml` collects through `lookup('role_subnet_exceptions')`; the network is a bridge in compose and an overlay in swarm. +- [x] A `relay` entity running a pinned `nginx` image carries network aliases, declared as `services.relay.network_aliases` in `meta/services.yml` and read by the shared `container_networks` lookup, only for the canonical domains of the deployed sibling roles OpenPost publishes to (`web-app-mastodon`, `web-app-pixelfed`, `web-app-peertube`), each gated by that role's dynamic service flag. - [ ] The relay forwards TLS unmodified by SNI to `host.docker.internal`, which `container_extra_hosts` resolves to the address that reaches the shared proxy in the effective deploy mode, and never resolves its own aliases. - [x] The relay refuses every SNI that is not in its map. - [x] When `TLS_MODE` is self-signed, OpenPost trusts the platform CA so that relayed vhosts verify; with public certificates no extra trust is configured. From cc8fd4c998443aac320e7dfa8e9973b399de98ce Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 01:59:27 +0100 Subject: [PATCH 495/554] docs(web-app-openpost): point at files/python and the networks.yml subnet exception --- roles/web-app-openpost/Administration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/Administration.md b/roles/web-app-openpost/Administration.md index 0ab5488fb4..83aa879743 100644 --- a/roles/web-app-openpost/Administration.md +++ b/roles/web-app-openpost/Administration.md @@ -47,7 +47,7 @@ Inside an Infinito.Nexus deployment the sibling vhosts usually resolve to privat The role therefore runs an `nginx` stream relay next to OpenPost: - The role network uses `192.88.99.0/24`, the deprecated 6to4 relay anycast block (RFC 7526), which `netguard` accepts as a global unicast range and which never leaves the Docker host. - `group_vars/all/08_networks.yml` lists the role in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES` for that reason. + `meta/networks.yml` declares that block with `outside_pool: true` for that reason, which puts the role in `NETWORK_ROLE_SUBNET_EXCEPTION_ROLES`. - The relay carries OpenPost's own canonical domain, the canonical domains of the deployed Mastodon, Pixelfed and PeerTube roles, and the public domain of the object store, as network aliases, so OpenPost resolves those names to the relay. OpenPost writes media to the object store's public endpoint because browsers upload through the same presigned URLs; the alias keeps those writes on the shared proxy even where that public name only resolves through Tor. OpenPost requests its own public media URLs before it lets a provider fetch them. With `svc-net-tor` deployed, the host drops DNS queries from every range outside the internal ones, `192.88.99.0/24` included, so without the alias that check would time out resolving the name. @@ -86,7 +86,7 @@ Every callback URL has the form `https://publish./api/v1/account ## Provider simulator Variant 0 of `meta/variants.yml` starts a WireMock `simulator` on the role network that answers for X, Facebook, Instagram, YouTube and TikTok under their real API host names. -Next to it runs the fake `provider`, a small stateful Python service built from `files/provider/` that plays LinkedIn on `www.linkedin.com` and `api.linkedin.com`: members sign up on `/signup`, grant OpenPost access on the consent page, and the fake keeps the tokens, images and posts it receives. +Next to it runs the fake `provider`, a small stateful Python service built from `files/provider/Dockerfile` and the `files/python/provider/` package that plays LinkedIn on `www.linkedin.com` and `api.linkedin.com`: members sign up on `/signup`, grant OpenPost access on the consent page, and the fake keeps the tokens, images and posts it receives. The deploy signs a certificate for all those names with a per-deploy test CA in the role's config directory, OpenPost trusts that CA through `SSL_CERT_DIR`, and the role renders `simulator-` credentials instead of the `API` entries for the simulated providers. The keystore that carries the certificate uses WireMock's built-in keystore password, so WireMock starts without any password on its command line. The fake also publishes plain HTTP on the local port of `services.provider.ports.local.http`; Playwright routes `https://www.linkedin.com/` there, and `/__fake/linkedin/posts` lists what OpenPost delivered. From 56c6c3ff4bb5b7370e9d7be3f5fc868ac60336c4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 03:16:24 +0100 Subject: [PATCH 496/554] fix(lookup): import the typing-only names of openpost_relay_domains under TYPE_CHECKING --- plugins/lookup/openpost_relay_domains.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/lookup/openpost_relay_domains.py b/plugins/lookup/openpost_relay_domains.py index 125712aad7..989598b716 100644 --- a/plugins/lookup/openpost_relay_domains.py +++ b/plugins/lookup/openpost_relay_domains.py @@ -11,14 +11,16 @@ store's public domain when OpenPost uses one. from __future__ import annotations -from collections.abc import Callable, Mapping -from typing import Any +from typing import TYPE_CHECKING, Any from ansible.errors import AnsibleError from ansible.module_utils.parsing.convert_bool import boolean from ansible.plugins.loader import lookup_loader from ansible.plugins.lookup import LookupBase +if TYPE_CHECKING: + from collections.abc import Callable, Mapping + APPLICATION_ID = "web-app-openpost" SIBLINGS_PATH = "services.relay.siblings" @@ -64,9 +66,7 @@ class LookupModule(LookupBase): raise AnsibleError("lookup('openpost_relay_domains') expects no terms.") def _lookup(name: str, *args: str) -> Any: - plugin = lookup_loader.get( - name, loader=self._loader, templar=self._templar - ) + plugin = lookup_loader.get(name, loader=self._loader, templar=self._templar) return plugin.run(list(args), variables=variables)[0] objstore_domain = ( From af2211b7acd52d98afc038a368f62a88cb287e03 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 03:16:24 +0100 Subject: [PATCH 497/554] fix(lookup): import the typing-only Mapping of role_subnet_exceptions under TYPE_CHECKING --- plugins/lookup/role_subnet_exceptions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/role_subnet_exceptions.py b/plugins/lookup/role_subnet_exceptions.py index 4e777535be..4613cec366 100644 --- a/plugins/lookup/role_subnet_exceptions.py +++ b/plugins/lookup/role_subnet_exceptions.py @@ -12,8 +12,7 @@ the returned ids to subnets through ``lookup('role_subnets', ...)``. from __future__ import annotations -from collections.abc import Mapping -from typing import Any +from typing import TYPE_CHECKING, Any from ansible.errors import AnsibleError from ansible.plugins.loader import lookup_loader @@ -21,6 +20,9 @@ from ansible.plugins.lookup import LookupBase from utils.roles.applications.config import get as get_app_conf +if TYPE_CHECKING: + from collections.abc import Mapping + FLAG_PATH = "networks.local.outside_pool" From f3b92d75234e3bc1edd93ed11c027deefc43f982 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 03:16:24 +0100 Subject: [PATCH 498/554] style(container_networks): apply ruff format to the network_aliases test --- tests/unit/python/plugins/lookup/test_container_networks.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/unit/python/plugins/lookup/test_container_networks.py b/tests/unit/python/plugins/lookup/test_container_networks.py index bf91bccea9..c160db268e 100644 --- a/tests/unit/python/plugins/lookup/test_container_networks.py +++ b/tests/unit/python/plugins/lookup/test_container_networks.py @@ -102,9 +102,7 @@ class TestContainerNetworksLookup(unittest.TestCase): def test_reads_the_service_network_aliases_from_its_config(self): render_mock = mock.MagicMock(return_value="RENDERED") - config_calls = self._run_with_configured_aliases( - ["a.example.com"], render_mock - ) + config_calls = self._run_with_configured_aliases(["a.example.com"], render_mock) self.assertIn( ("web-app-x", "services.relay.network_aliases", None), config_calls From d9e403945c5cf7a2885d50a1fcc4b4dbe234f3ab Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Tue, 24 Nov 2026 03:16:24 +0100 Subject: [PATCH 499/554] style(lookup): apply ruff format to the openpost_relay_domains test --- .../unit/python/plugins/lookup/test_openpost_relay_domains.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/unit/python/plugins/lookup/test_openpost_relay_domains.py b/tests/unit/python/plugins/lookup/test_openpost_relay_domains.py index ed70efc4e2..2962de940b 100644 --- a/tests/unit/python/plugins/lookup/test_openpost_relay_domains.py +++ b/tests/unit/python/plugins/lookup/test_openpost_relay_domains.py @@ -79,9 +79,7 @@ class TestLookup(unittest.TestCase): ) def test_skips_the_object_store_when_openpost_uses_none(self): - self.assertEqual( - self._run(False), [["publish.example", "microblog.example"]] - ) + self.assertEqual(self._run(False), [["publish.example", "microblog.example"]]) def test_rejects_terms(self): with self.assertRaises(AnsibleError): From 964ca8909c668f0628488f877d7d3d284d3b6684 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:10 +0100 Subject: [PATCH 500/554] fix(web-app-openpost): spell the crossposter's zero-width joiner and emoji selector as named escapes --- roles/web-app-openpost/files/python/crossposter/adapt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/web-app-openpost/files/python/crossposter/adapt.py b/roles/web-app-openpost/files/python/crossposter/adapt.py index a109476144..8841fdc050 100644 --- a/roles/web-app-openpost/files/python/crossposter/adapt.py +++ b/roles/web-app-openpost/files/python/crossposter/adapt.py @@ -42,7 +42,8 @@ LIMITS = { } _X_SINGLE = ((0, 4351), (8192, 8205), (8208, 8223), (8242, 8247)) -_ZWJ = "‍" +_ZWJ = "\N{ZERO WIDTH JOINER}" +_EMOJI_PRESENTATION = "\N{VARIATION SELECTOR-16}" def _joins(previous: str, char: str) -> bool: @@ -79,7 +80,9 @@ def _regional_pair(cluster: str, char: str) -> bool: def _emoji(cluster: str) -> bool: return any( - ord(char) >= 0x1F000 or 0x2600 <= ord(char) <= 0x27BF or char in (_ZWJ, "️") + ord(char) >= 0x1F000 + or 0x2600 <= ord(char) <= 0x27BF + or char in (_ZWJ, _EMOJI_PRESENTATION) for char in cluster ) From d13a75325b89065a0a051d1f7feb4a12af723823 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:10 +0100 Subject: [PATCH 501/554] test(web-app-openpost): spell the joiners of the family emoji as named escapes --- .../roles/web-app-openpost/files/crossposter/test_adapt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/test_adapt.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_adapt.py index ac3bcdc399..dd81e4ad9c 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/test_adapt.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_adapt.py @@ -61,7 +61,9 @@ class TestCounting(unittest.TestCase): ) def test_mastodon_counts_graphemes_not_code_points(self) -> None: - family = "\U0001f468‍\U0001f469‍\U0001f467" + family = ( + "\U0001f468\N{ZERO WIDTH JOINER}\U0001f469\N{ZERO WIDTH JOINER}\U0001f467" + ) self.assertEqual(adapt.count(family, "mastodon"), 1) self.assertEqual(adapt.count("é", "mastodon"), 1) From 884e783727d2b9fdc1426ec4e20ddce2b8ac9d87 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:10 +0100 Subject: [PATCH 502/554] refactor(web-app-openpost): move the Mastodon grant script of the crossposter seed into its own file --- .../files/ruby/mastodon_grant_authorization.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 roles/web-app-openpost/files/ruby/mastodon_grant_authorization.rb diff --git a/roles/web-app-openpost/files/ruby/mastodon_grant_authorization.rb b/roles/web-app-openpost/files/ruby/mastodon_grant_authorization.rb new file mode 100644 index 0000000000..89181bb4d3 --- /dev/null +++ b/roles/web-app-openpost/files/ruby/mastodon_grant_authorization.rb @@ -0,0 +1,18 @@ +# nocheck: mirrored-unit-test - runs in Mastodon's `rails runner` against its live Doorkeeper tables; the models exist only inside the booted app +# Args (environment): +# CROSSPOSTER_ACCOUNT: local Mastodon username that grants the code. +# CROSSPOSTER_AUTHORIZE: authorization URL OpenPost started; its query names the client, redirect URI, scope and PKCE challenge. +# Prints CROSSPOSTER_GRANT=. +query = Rack::Utils.parse_query(URI.parse(ENV.fetch("CROSSPOSTER_AUTHORIZE")).query) +account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) +application = Doorkeeper::Application.find_by!(uid: query.fetch("client_id")) +grant = Doorkeeper::AccessGrant.create!( + application: application, + resource_owner_id: account.user.id, + redirect_uri: query.fetch("redirect_uri"), + scopes: query.fetch("scope", application.scopes.to_s), + code_challenge: query["code_challenge"], + code_challenge_method: query["code_challenge_method"], + expires_in: 600 +) +puts "CROSSPOSTER_GRANT=#{grant.plaintext_token}" From 4a7c6cf075cf05b4e7a220797158ddcd5f133fa2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:10 +0100 Subject: [PATCH 503/554] refactor(web-app-openpost): feed the Mastodon grant script to rails runner from its file --- .../tasks/crossposter/seed/connect.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml index 81638f5748..d346dba002 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml @@ -24,6 +24,7 @@ argv: - container - exec + - -i - -e - "CROSSPOSTER_ACCOUNT={{ openpost_crossposter_mastodon_route.source.account }}" - -e @@ -31,20 +32,8 @@ - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver - bin/rails - runner - - | - query = Rack::Utils.parse_query(URI.parse(ENV.fetch("CROSSPOSTER_AUTHORIZE")).query) - account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) - application = Doorkeeper::Application.find_by!(uid: query.fetch("client_id")) - grant = Doorkeeper::AccessGrant.create!( - application: application, - resource_owner_id: account.user.id, - redirect_uri: query.fetch("redirect_uri"), - scopes: query.fetch("scope", application.scopes.to_s), - code_challenge: query["code_challenge"], - code_challenge_method: query["code_challenge_method"], - expires_in: 600 - ) - puts "CROSSPOSTER_GRANT=#{grant.plaintext_token}" + - "-" + stdin: "{{ lookup('file', 'ruby/mastodon_grant_authorization.rb') }}" register: openpost_crossposter_mastodon_grant changed_when: true delegate_to: "{{ OPENPOST_SEED_MASTODON_HOST_NODE }}" From a07fb186f6d4addd474b413f88ab334a8e053d00 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:10 +0100 Subject: [PATCH 504/554] refactor(web-app-openpost): move the Mastodon token script of the crossposter seed into its own file --- .../files/ruby/mastodon_mint_token.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 roles/web-app-openpost/files/ruby/mastodon_mint_token.rb diff --git a/roles/web-app-openpost/files/ruby/mastodon_mint_token.rb b/roles/web-app-openpost/files/ruby/mastodon_mint_token.rb new file mode 100644 index 0000000000..872e25c023 --- /dev/null +++ b/roles/web-app-openpost/files/ruby/mastodon_mint_token.rb @@ -0,0 +1,11 @@ +# nocheck: mirrored-unit-test - runs in Mastodon's `rails runner` against its live Doorkeeper tables; the models exist only inside the booted app +# Args (environment): +# CROSSPOSTER_ACCOUNT: local Mastodon username the token belongs to. +# Prints CROSSPOSTER_TOKEN=. +account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) +application = Doorkeeper::Application.find_or_create_by!(name: "Crossposter CI") do |created| + created.redirect_uri = "urn:ietf:wg:oauth:2.0:oob" + created.scopes = "read write" +end +token = Doorkeeper::AccessToken.create!(application: application, resource_owner_id: account.user.id, scopes: "read write") +puts "CROSSPOSTER_TOKEN=#{token.plaintext_token}" From 19db56eab33e8ba3e8236e4a8648585df7ebceb4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:10 +0100 Subject: [PATCH 505/554] refactor(web-app-openpost): feed the Mastodon token script to rails runner from its file --- .../tasks/crossposter/seed/mastodon.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml index 156e018a70..ea0d691570 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml @@ -12,19 +12,14 @@ argv: - container - exec + - -i - -e - "CROSSPOSTER_ACCOUNT={{ item.source.account }}" - "{{ OPENPOST_SEED_MASTODON_LOCAL_CID }}" # nocheck: container-exec-resolver - bin/rails - runner - - | - account = Account.find_local!(ENV.fetch("CROSSPOSTER_ACCOUNT")) - application = Doorkeeper::Application.find_or_create_by!(name: "Crossposter CI") do |created| - created.redirect_uri = "urn:ietf:wg:oauth:2.0:oob" - created.scopes = "read write" - end - token = Doorkeeper::AccessToken.create!(application: application, resource_owner_id: account.user.id, scopes: "read write") - puts "CROSSPOSTER_TOKEN=#{token.plaintext_token}" + - "-" + stdin: "{{ lookup('file', 'ruby/mastodon_mint_token.rb') }}" loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'mastodon') | list }}" loop_control: label: "{{ item.name }}" From 8ce922bfd84d8ef571da6017a26f36507aa5f5a8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:10 +0100 Subject: [PATCH 506/554] refactor(web-app-openpost): move the Pixelfed token script of the crossposter seed into its own file --- .../files/php/pixelfed_mint_token.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 roles/web-app-openpost/files/php/pixelfed_mint_token.php diff --git a/roles/web-app-openpost/files/php/pixelfed_mint_token.php b/roles/web-app-openpost/files/php/pixelfed_mint_token.php new file mode 100644 index 0000000000..7bbd4bd900 --- /dev/null +++ b/roles/web-app-openpost/files/php/pixelfed_mint_token.php @@ -0,0 +1,25 @@ +. + +require getenv('PIXELFED_APP_DIR') . '/vendor/autoload.php'; +$app = require getenv('PIXELFED_APP_DIR') . '/bootstrap/app.php'; +$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); + +$user = App\Models\User::where('username', getenv('CROSSPOSTER_ACCOUNT'))->firstOrFail(); +$mint = fn () => $user->createToken('crossposter-ci', ['read', 'write'])->accessToken; +try { + $token = $mint(); +} catch (RuntimeException $missing) { + Illuminate\Support\Facades\Artisan::call('passport:client', [ + '--personal' => true, + '--provider' => 'users', + '--name' => 'Crossposter CI', + '--no-interaction' => true, + ]); + $token = $mint(); +} +echo 'CROSSPOSTER_TOKEN=' . $token . PHP_EOL; From b7d9062e7420c2d314ce7126050fd5f35ca35683 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 507/554] refactor(web-app-openpost): feed the Pixelfed token script to php from its file --- .../tasks/crossposter/seed/pixelfed.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml index 78a2c37797..a7c3fd3778 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml @@ -12,6 +12,7 @@ argv: - container - exec + - -i - -u - "{{ OPENPOST_PIXELFED_PHP_USER }}" - -e @@ -20,17 +21,7 @@ - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver - php - - -r - - >- - require getenv('PIXELFED_APP_DIR') . '/vendor/autoload.php'; - $app = require getenv('PIXELFED_APP_DIR') . '/bootstrap/app.php'; - $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); - $user = App\Models\User::where('username', getenv('CROSSPOSTER_ACCOUNT'))->firstOrFail(); - $mint = fn () => $user->createToken('crossposter-ci', ['read', 'write'])->accessToken; - try { $token = $mint(); } catch (RuntimeException $missing) { - Illuminate\Support\Facades\Artisan::call('passport:client', ['--personal' => true, '--provider' => 'users', '--name' => 'Crossposter CI', '--no-interaction' => true]); - $token = $mint(); } - echo 'CROSSPOSTER_TOKEN=' . $token . PHP_EOL; + stdin: "{{ lookup('file', 'php/pixelfed_mint_token.php') }}" loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list }}" loop_control: label: "{{ item.name }}" From f198df4823220bbab672165222af8b71903cb7e5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 508/554] refactor(web-app-openpost): move the Pixelfed client owner script into its own file --- .../files/php/pixelfed_client_owner.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 roles/web-app-openpost/files/php/pixelfed_client_owner.php diff --git a/roles/web-app-openpost/files/php/pixelfed_client_owner.php b/roles/web-app-openpost/files/php/pixelfed_client_owner.php new file mode 100644 index 0000000000..f3b6555556 --- /dev/null +++ b/roles/web-app-openpost/files/php/pixelfed_client_owner.php @@ -0,0 +1,18 @@ +make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); + +$owner = App\Models\User::where('username', getenv('OPENPOST_CLIENT_OWNER'))->firstOrFail(); +$client = Laravel\Passport\Client::whereKey(getenv('OPENPOST_CLIENT_ID'))->firstOrFail(); +if ((string) $client->user_id !== (string) $owner->id) { + $client->forceFill(['user_id' => $owner->id])->save(); + echo 'OWNER_SET' . PHP_EOL; +} From 4c45bcf4b878f678dd3a972e56b0dac8340c9580 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 509/554] refactor(web-app-openpost): feed the Pixelfed client owner script to php from its file --- .../tasks/fediverse/pixelfed_owner.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml index 1c4c70226c..e4eddefc90 100644 --- a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml +++ b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml @@ -12,6 +12,7 @@ argv: - container - exec + - -i - -u - "{{ OPENPOST_PIXELFED_PHP_USER }}" - -e @@ -22,14 +23,7 @@ - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - "{{ OPENPOST_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver - php - - -r - - >- - require getenv('PIXELFED_APP_DIR') . '/vendor/autoload.php'; - $app = require getenv('PIXELFED_APP_DIR') . '/bootstrap/app.php'; - $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); - $owner = App\Models\User::where('username', getenv('OPENPOST_CLIENT_OWNER'))->firstOrFail(); - $client = Laravel\Passport\Client::whereKey(getenv('OPENPOST_CLIENT_ID'))->firstOrFail(); - if ((string) $client->user_id !== (string) $owner->id) { $client->forceFill(['user_id' => $owner->id])->save(); echo 'OWNER_SET' . PHP_EOL; } + stdin: "{{ lookup('file', 'php/pixelfed_client_owner.php') }}" loop: "{{ OPENPOST_PINNED_PIXELFED }}" loop_control: label: "{{ item.url }}" From 662a865f4d40c39225c44dcf9b4b66d24fda19b7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 510/554] refactor(web-app-openpost): add the crossposter's create_schema statement as a SQL file --- roles/web-app-openpost/files/sql/crossposter/create_schema.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/create_schema.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/create_schema.sql b/roles/web-app-openpost/files/sql/crossposter/create_schema.sql new file mode 100644 index 0000000000..bd46255a40 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/create_schema.sql @@ -0,0 +1 @@ +CREATE SCHEMA IF NOT EXISTS crossposter; From 97fe99b960c5b13e8aa9166c11fcc179cbdf1dff Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 511/554] refactor(web-app-openpost): add the crossposter's create_cursors statement as a SQL file --- .../files/sql/crossposter/create_cursors.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/create_cursors.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/create_cursors.sql b/roles/web-app-openpost/files/sql/crossposter/create_cursors.sql new file mode 100644 index 0000000000..00b81bd2aa --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/create_cursors.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS crossposter.cursors ( + route text PRIMARY KEY, + cursor text NOT NULL, + updated_at timestamptz NOT NULL DEFAULT now() +); From b3d4f2adb41cbc51a1df8a8cba463407b774baf6 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 512/554] refactor(web-app-openpost): add the crossposter's create_items statement as a SQL file --- .../files/sql/crossposter/create_items.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/create_items.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/create_items.sql b/roles/web-app-openpost/files/sql/crossposter/create_items.sql new file mode 100644 index 0000000000..c3eb712b3d --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/create_items.sql @@ -0,0 +1,19 @@ +CREATE TABLE IF NOT EXISTS crossposter.items ( + id bigserial PRIMARY KEY, + route text NOT NULL, + source_uri text NOT NULL, + source_url text NOT NULL, + target text NOT NULL, + network text NOT NULL, + state text NOT NULL, + payload jsonb NOT NULL, + publication_id text NOT NULL DEFAULT '', + attempts integer NOT NULL DEFAULT 0, + resends integer NOT NULL DEFAULT 0, + next_attempt_at timestamptz NOT NULL DEFAULT now(), + last_error text NOT NULL DEFAULT '', + notified_at timestamptz, + created_at timestamptz NOT NULL DEFAULT now(), + updated_at timestamptz NOT NULL DEFAULT now(), + UNIQUE (source_uri, target) +); From b48b980f9c4bfb5a6f806d07713177c7b3ee15ad Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 513/554] refactor(web-app-openpost): add the crossposter's try_lock statement as a SQL file --- roles/web-app-openpost/files/sql/crossposter/try_lock.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/try_lock.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/try_lock.sql b/roles/web-app-openpost/files/sql/crossposter/try_lock.sql new file mode 100644 index 0000000000..40808b4b02 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/try_lock.sql @@ -0,0 +1 @@ +SELECT pg_try_advisory_lock(%(lock_id)s) AS held; From 0f1439a7199907ae55a8297b806fc57ee08e8de7 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 514/554] refactor(web-app-openpost): add the crossposter's select_cursor statement as a SQL file --- roles/web-app-openpost/files/sql/crossposter/select_cursor.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/select_cursor.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/select_cursor.sql b/roles/web-app-openpost/files/sql/crossposter/select_cursor.sql new file mode 100644 index 0000000000..6206d98560 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/select_cursor.sql @@ -0,0 +1,3 @@ +SELECT cursor +FROM crossposter.cursors +WHERE route = %(route)s; From 509fbee8296bcb587bbdf432b6f7c8bf0577ab18 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 515/554] refactor(web-app-openpost): add the crossposter's insert_item statement as a SQL file --- .../files/sql/crossposter/insert_item.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/insert_item.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/insert_item.sql b/roles/web-app-openpost/files/sql/crossposter/insert_item.sql new file mode 100644 index 0000000000..a3741460bf --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/insert_item.sql @@ -0,0 +1,13 @@ +INSERT INTO crossposter.items ( + route, source_uri, source_url, target, network, state, payload +) +VALUES ( + %(route)s, + %(source_uri)s, + %(source_url)s, + %(target)s, + %(network)s, + 'pending', + %(payload)s +) +ON CONFLICT (source_uri, target) DO NOTHING; From e9b2a4ae166a2ca52f792c7aa159d6d87935c2ca Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 516/554] refactor(web-app-openpost): add the crossposter's upsert_cursor statement as a SQL file --- .../web-app-openpost/files/sql/crossposter/upsert_cursor.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/upsert_cursor.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/upsert_cursor.sql b/roles/web-app-openpost/files/sql/crossposter/upsert_cursor.sql new file mode 100644 index 0000000000..9df04f535f --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/upsert_cursor.sql @@ -0,0 +1,4 @@ +INSERT INTO crossposter.cursors (route, cursor) +VALUES (%(route)s, %(cursor)s) +ON CONFLICT (route) DO UPDATE + SET cursor = excluded.cursor, updated_at = now(); From ba4fe15c843538ce9c7565424e0defc063063ba2 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 517/554] refactor(web-app-openpost): add the crossposter's select_due statement as a SQL file --- roles/web-app-openpost/files/sql/crossposter/select_due.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/select_due.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/select_due.sql b/roles/web-app-openpost/files/sql/crossposter/select_due.sql new file mode 100644 index 0000000000..1549a29ff7 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/select_due.sql @@ -0,0 +1,4 @@ +SELECT * +FROM crossposter.items +WHERE state = 'pending' AND next_attempt_at <= now() +ORDER BY id; From 5527d873ce8cef53c89ce3f5c0c45ca8c32a6a2c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 518/554] refactor(web-app-openpost): add the crossposter's select_open_publications statement as a SQL file --- .../files/sql/crossposter/select_open_publications.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/select_open_publications.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/select_open_publications.sql b/roles/web-app-openpost/files/sql/crossposter/select_open_publications.sql new file mode 100644 index 0000000000..948b9289c6 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/select_open_publications.sql @@ -0,0 +1,4 @@ +SELECT * +FROM crossposter.items +WHERE state IN ('drafted', 'submitted') +ORDER BY id; From d876cd2c4eb589cb1a36522b9ad1d2a98515ef57 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 519/554] refactor(web-app-openpost): add the crossposter's select_unnotified statement as a SQL file --- .../files/sql/crossposter/select_unnotified.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/select_unnotified.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/select_unnotified.sql b/roles/web-app-openpost/files/sql/crossposter/select_unnotified.sql new file mode 100644 index 0000000000..eb71516f81 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/select_unnotified.sql @@ -0,0 +1,4 @@ +SELECT * +FROM crossposter.items +WHERE state IN ('failed', 'dead_lettered') AND notified_at IS NULL +ORDER BY id; From 4af56adcf508096953aee191d5d301bcf08ca6df Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 520/554] refactor(web-app-openpost): add the crossposter's select_items statement as a SQL file --- roles/web-app-openpost/files/sql/crossposter/select_items.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/select_items.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/select_items.sql b/roles/web-app-openpost/files/sql/crossposter/select_items.sql new file mode 100644 index 0000000000..726c055040 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/select_items.sql @@ -0,0 +1,3 @@ +SELECT * +FROM crossposter.items +ORDER BY id; From ecbfdbc3fa2621ec06e719645cab6b490923eb16 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 521/554] refactor(web-app-openpost): add the crossposter's update_item statement as a SQL file --- .../files/sql/crossposter/update_item.sql | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/update_item.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/update_item.sql b/roles/web-app-openpost/files/sql/crossposter/update_item.sql new file mode 100644 index 0000000000..8854556274 --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/update_item.sql @@ -0,0 +1,9 @@ +UPDATE crossposter.items +SET + state = %(state)s, + publication_id = %(publication_id)s, + attempts = %(attempts)s, + last_error = %(error)s, + next_attempt_at = %(next_attempt_at)s, + updated_at = now() +WHERE id = %(id)s; From 700d278cb836c14c4f19d0ab131e52a329dd9a49 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 522/554] refactor(web-app-openpost): add the crossposter's resend_item statement as a SQL file --- .../files/sql/crossposter/resend_item.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/resend_item.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/resend_item.sql b/roles/web-app-openpost/files/sql/crossposter/resend_item.sql new file mode 100644 index 0000000000..20a393ba0a --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/resend_item.sql @@ -0,0 +1,10 @@ +UPDATE crossposter.items +SET + state = 'pending', + resends = resends + 1, + publication_id = '', + attempts = %(attempts)s, + last_error = %(error)s, + next_attempt_at = %(next_attempt_at)s, + updated_at = now() +WHERE id = %(id)s; From 12f563111c6c8de9e832df887d092c9e0c2fd2d4 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 523/554] refactor(web-app-openpost): add the crossposter's mark_notified statement as a SQL file --- roles/web-app-openpost/files/sql/crossposter/mark_notified.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 roles/web-app-openpost/files/sql/crossposter/mark_notified.sql diff --git a/roles/web-app-openpost/files/sql/crossposter/mark_notified.sql b/roles/web-app-openpost/files/sql/crossposter/mark_notified.sql new file mode 100644 index 0000000000..46ff6fcb2b --- /dev/null +++ b/roles/web-app-openpost/files/sql/crossposter/mark_notified.sql @@ -0,0 +1,3 @@ +UPDATE crossposter.items +SET notified_at = now() +WHERE id = %(id)s; From 034cb759d326d4ca282d9c506eb11661f85f11e1 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 524/554] fix(web-app-openpost): run only the crossposter's named SQL files instead of composing a where clause --- .../files/python/crossposter/store.py | 138 +++++++++--------- 1 file changed, 67 insertions(+), 71 deletions(-) diff --git a/roles/web-app-openpost/files/python/crossposter/store.py b/roles/web-app-openpost/files/python/crossposter/store.py index 78ebf1de6c..bb988cfdb5 100644 --- a/roles/web-app-openpost/files/python/crossposter/store.py +++ b/roles/web-app-openpost/files/python/crossposter/store.py @@ -4,40 +4,26 @@ import dataclasses import hashlib import json from datetime import UTC, datetime, timedelta +from pathlib import Path from .sources import Media, SourceItem LOCK_ID = 4_103_270_041 -SCHEMA = ( - "CREATE SCHEMA IF NOT EXISTS crossposter", - """CREATE TABLE IF NOT EXISTS crossposter.cursors ( - route text PRIMARY KEY, - cursor text NOT NULL, - updated_at timestamptz NOT NULL DEFAULT now() - )""", - """CREATE TABLE IF NOT EXISTS crossposter.items ( - id bigserial PRIMARY KEY, - route text NOT NULL, - source_uri text NOT NULL, - source_url text NOT NULL, - target text NOT NULL, - network text NOT NULL, - state text NOT NULL, - payload jsonb NOT NULL, - publication_id text NOT NULL DEFAULT '', - attempts integer NOT NULL DEFAULT 0, - resends integer NOT NULL DEFAULT 0, - next_attempt_at timestamptz NOT NULL DEFAULT now(), - last_error text NOT NULL DEFAULT '', - notified_at timestamptz, - created_at timestamptz NOT NULL DEFAULT now(), - updated_at timestamptz NOT NULL DEFAULT now(), - UNIQUE (source_uri, target) - )""", -) -COLUMNS = ( - "id, route, source_uri, source_url, target, network, state, payload, publication_id, " - "attempts, resends, next_attempt_at, last_error, notified_at, created_at, updated_at" +SQL_DIR = Path(__file__).resolve().parent / "sql" +SCHEMA = ("create_schema", "create_cursors", "create_items") +QUERIES = ( + *SCHEMA, + "try_lock", + "select_cursor", + "insert_item", + "upsert_cursor", + "select_due", + "select_open_publications", + "select_unnotified", + "select_items", + "update_item", + "resend_item", + "mark_notified", ) STATES = ("pending", "drafted", "submitted", "published", "failed", "dead_lettered") @@ -83,6 +69,19 @@ def item_from_json(raw: dict) -> SourceItem: return SourceItem(**{**raw, "media": media, "tags": tuple(raw["tags"])}) +def query(name: str) -> str: + """ + Args: + name: one of QUERIES, the file name of a statement without ``.sql``. + + Returns: + The statement's text from SQL_DIR. + """ + if name not in QUERIES: + raise KeyError(f"unknown crossposter query {name!r}") + return (SQL_DIR / f"{name}.sql").read_text(encoding="utf-8") + + class Store: def __init__(self, dsn: str) -> None: from psycopg import connect @@ -90,19 +89,22 @@ class Store: self.connection = connect(dsn, autocommit=True, row_factory=dict_row) + def _rows(self, name: str) -> list[dict]: + return list(self.connection.execute(query(name)).fetchall()) + def migrate(self) -> None: - for statement in SCHEMA: - self.connection.execute(statement) + for name in SCHEMA: + self.connection.execute(query(name)) def lock(self) -> bool: row = self.connection.execute( - "SELECT pg_try_advisory_lock(%s) AS held", (LOCK_ID,) + query("try_lock"), {"lock_id": LOCK_ID} ).fetchone() return bool(row["held"]) def cursor(self, route: str) -> str | None: row = self.connection.execute( - "SELECT cursor FROM crossposter.cursors WHERE route = %s", (route,) + query("select_cursor"), {"route": route} ).fetchone() return None if row is None else str(row["cursor"]) @@ -112,38 +114,31 @@ class Store: with self.connection.transaction(): for item, target, network in enqueued: self.connection.execute( - """INSERT INTO crossposter.items (route, source_uri, source_url, target, network, state, payload) - VALUES (%s, %s, %s, %s, %s, 'pending', %s) - ON CONFLICT (source_uri, target) DO NOTHING""", - (route, item.uri, item.url, target, network, item_to_json(item)), + query("insert_item"), + { + "route": route, + "source_uri": item.uri, + "source_url": item.url, + "target": target, + "network": network, + "payload": item_to_json(item), + }, ) self.connection.execute( - """INSERT INTO crossposter.cursors (route, cursor) VALUES (%s, %s) - ON CONFLICT (route) DO UPDATE SET cursor = excluded.cursor, updated_at = now()""", - (route, cursor), + query("upsert_cursor"), {"route": route, "cursor": cursor} ) - def rows(self, where: str, parameters: tuple) -> list[dict]: - from psycopg import sql - - query = sql.SQL("SELECT {} FROM crossposter.items WHERE {} ORDER BY id").format( - sql.SQL(COLUMNS), sql.SQL(where) - ) - return list(self.connection.execute(query, parameters).fetchall()) - def due(self) -> list[dict]: - return self.rows("state = 'pending' AND next_attempt_at <= now()", ()) + return self._rows("select_due") def open_publications(self) -> list[dict]: - return self.rows("state IN ('drafted', 'submitted')", ()) + return self._rows("select_open_publications") def unnotified(self) -> list[dict]: - return self.rows( - "state IN ('failed', 'dead_lettered') AND notified_at IS NULL", () - ) + return self._rows("select_unnotified") def everything(self) -> list[dict]: - return self.rows("true", ()) + return self._rows("select_items") def update( self, @@ -154,29 +149,30 @@ class Store: error: str, delay_seconds: float, ) -> None: - next_attempt = datetime.now(UTC) + timedelta(seconds=delay_seconds) self.connection.execute( - """UPDATE crossposter.items - SET state = %s, publication_id = %s, attempts = %s, last_error = %s, - next_attempt_at = %s, updated_at = now() - WHERE id = %s""", - (state, publication_id, attempts, error, next_attempt, row_id), + query("update_item"), + { + "id": row_id, + "state": state, + "publication_id": publication_id, + "attempts": attempts, + "error": error, + "next_attempt_at": datetime.now(UTC) + timedelta(seconds=delay_seconds), + }, ) def resend( self, row_id: int, attempts: int, error: str, delay_seconds: float ) -> None: - next_attempt = datetime.now(UTC) + timedelta(seconds=delay_seconds) self.connection.execute( - """UPDATE crossposter.items - SET state = 'pending', resends = resends + 1, publication_id = '', - attempts = %s, last_error = %s, - next_attempt_at = %s, updated_at = now() - WHERE id = %s""", - (attempts, error, next_attempt, row_id), + query("resend_item"), + { + "id": row_id, + "attempts": attempts, + "error": error, + "next_attempt_at": datetime.now(UTC) + timedelta(seconds=delay_seconds), + }, ) def mark_notified(self, row_id: int) -> None: - self.connection.execute( - "UPDATE crossposter.items SET notified_at = now() WHERE id = %s", (row_id,) - ) + self.connection.execute(query("mark_notified"), {"id": row_id}) From 940d2622125ed19a019984c2a6f446ad9a2df4ce Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 525/554] build(web-app-openpost): stage the crossposter's SQL files into its image --- roles/web-app-openpost/tasks/crossposter/render.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/web-app-openpost/tasks/crossposter/render.yml b/roles/web-app-openpost/tasks/crossposter/render.yml index f5cdfd0bd9..90d14ee318 100644 --- a/roles/web-app-openpost/tasks/crossposter/render.yml +++ b/roles/web-app-openpost/tasks/crossposter/render.yml @@ -37,6 +37,8 @@ dest: "{{ OPENPOST_CROSSPOSTER_BUILD_CONTEXT }}/" - src: "{{ role_path }}/files/python/crossposter/" dest: "{{ [OPENPOST_CROSSPOSTER_BUILD_CONTEXT, 'crossposter'] | path_join }}/" + - src: "{{ role_path }}/files/sql/crossposter/" + dest: "{{ [OPENPOST_CROSSPOSTER_BUILD_CONTEXT, 'crossposter', 'sql'] | path_join }}/" notify: - compose-build - compose-up From 9e1d96073ac6e8029c6f0b05bfe669739770e212 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 526/554] test(web-app-openpost): bind every crossposter statement to exactly its placeholders --- .../files/crossposter/test_store.py | 113 ++++++++++++++---- 1 file changed, 91 insertions(+), 22 deletions(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py index 380526b79b..0a02236c31 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py @@ -1,42 +1,111 @@ from __future__ import annotations +import contextlib import json +import re import unittest +import unittest.mock from crossposter import store from crossposter.sources import Media, SourceItem +from . import PROJECT_ROOT + SOURCE = "https://microblog.example/users/press/statuses/1" +SQL_SOURCE = PROJECT_ROOT / "roles/web-app-openpost/files/sql/crossposter" +PLACEHOLDER = re.compile(r"%\((\w+)\)s") +ITEM = SourceItem( + uri=SOURCE, + url="https://microblog.example/@press/1", + platform="mastodon", + text="Hello", + visibility="public", + tags=("news",), + media=( + Media( + url="https://microblog.example/a.png", + mime="image/png", + description="alt", + size=12, + ), + ), + in_reply_to="", + reblog=False, + spoiler="", + application="", + cursor="1", +) + + +class _Connection: + def __init__(self) -> None: + self.calls: list[tuple[str, dict | None]] = [] + + def execute(self, text: str, parameters: dict | None = None) -> _Connection: + self.calls.append((text, parameters)) + return self + + def fetchone(self) -> dict: + return {"held": True, "cursor": "1"} + + def fetchall(self) -> list[dict]: + return [] + + def transaction(self) -> contextlib.nullcontext: + return contextlib.nullcontext() class TestPayload(unittest.TestCase): def test_a_stored_item_comes_back_unchanged(self) -> None: - item = SourceItem( - uri=SOURCE, - url="https://microblog.example/@press/1", - platform="mastodon", - text="Hello", - visibility="public", - tags=("news",), - media=( - Media( - url="https://microblog.example/a.png", - mime="image/png", - description="alt", - size=12, - ), - ), - in_reply_to="", - reblog=False, - spoiler="", - application="", - cursor="1", - ) self.assertEqual( - store.item_from_json(json.loads(store.item_to_json(item))), item + store.item_from_json(json.loads(store.item_to_json(ITEM))), ITEM ) +class TestQueries(unittest.TestCase): + def setUp(self) -> None: + patcher = unittest.mock.patch.object(store, "SQL_DIR", SQL_SOURCE) + patcher.start() + self.addCleanup(patcher.stop) + + def test_every_query_has_one_file_and_every_file_a_query(self) -> None: + self.assertEqual( + sorted(path.stem for path in SQL_SOURCE.glob("*.sql")), + sorted(store.QUERIES), + ) + + def test_an_unknown_query_is_refused(self) -> None: + with self.assertRaises(KeyError): + store.query("select_items; DROP SCHEMA crossposter") + + def test_every_call_binds_exactly_the_placeholders_of_its_statement( + self, + ) -> None: + connection = _Connection() + crossposter_store = store.Store.__new__(store.Store) + crossposter_store.connection = connection + + crossposter_store.migrate() + crossposter_store.lock() + crossposter_store.cursor("press") + crossposter_store.advance("press", "2", [(ITEM, "x-press", "x")]) + crossposter_store.due() + crossposter_store.open_publications() + crossposter_store.unnotified() + crossposter_store.everything() + crossposter_store.update(1, "drafted", "pub-1", 1, "", 0) + crossposter_store.resend(1, 0, "HTTP 503", 30) + crossposter_store.mark_notified(1) + + self.assertEqual( + sorted(text for text, _ in connection.calls), + sorted(store.query(name) for name in store.QUERIES), + ) + for text, parameters in connection.calls: + with self.subTest(statement=text.splitlines()[0]): + self.assertEqual(set(PLACEHOLDER.findall(text)), set(parameters or {})) + + class TestIdempotencyKey(unittest.TestCase): def test_the_key_is_stable_for_one_pair(self) -> None: self.assertEqual( From 14d2edd3133b8fb352c215fb4f0d5a6728655568 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 527/554] docs(requirements): list the crossposter's SQL files --- docs/requirements/063-openpost-crossposter.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/requirements/063-openpost-crossposter.md b/docs/requirements/063-openpost-crossposter.md index 9eae2c38b7..cf6de6e916 100644 --- a/docs/requirements/063-openpost-crossposter.md +++ b/docs/requirements/063-openpost-crossposter.md @@ -91,6 +91,8 @@ roles/web-app-openpost/files/python/ ├── __main__.py ├── linkedin.py └── store.py +roles/web-app-openpost/files/sql/crossposter/ +└── .sql one file per statement crossposter/store.py runs, staged into the image as crossposter/sql/ tests/unit/python/roles/web-app-openpost/files/crossposter/ tests/unit/python/roles/web-app-openpost/files/provider/ ``` From 45b2a92ef7972c86b043bf8051ba8966c2852704 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 00:58:11 +0100 Subject: [PATCH 528/554] test(web-app-openpost): fail once the pinned OpenPost can allow private networks (#2867) --- .../roles/test_openpost_netguard_allowlist.py | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 tests/external/roles/test_openpost_netguard_allowlist.py diff --git a/tests/external/roles/test_openpost_netguard_allowlist.py b/tests/external/roles/test_openpost_netguard_allowlist.py new file mode 100644 index 0000000000..05c5de156a --- /dev/null +++ b/tests/external/roles/test_openpost_netguard_allowlist.py @@ -0,0 +1,99 @@ +"""The pinned OpenPost still offers no switch to allow private networks. + +web-app-openpost sends OpenPost's requests to its sibling roles through a +relay on 192.88.99.0/24, a block outside the role subnet pool, because +OpenPost's netguard refuses every private address and offers no switch +(infinito-nexus/core#2867, getopenpost/openpost#533). Once the pinned OpenPost +reads such a switch, the relay and the out-of-pool subnet are obsolete, and +this test fails so the workaround goes instead of outliving its reason. + +The switch would live in the upstream repository at the pinned tag, so the +check is external: it fetches OpenPost's config loader of that tag from +raw.githubusercontent.com and looks for any ``OPENPOST_*PRIVATE*`` variable, +because the name may change during upstream review. A refused connection, a +timeout, a rate limit or a server error skips it as unverified; any other +status than 200 fails it. +""" + +from __future__ import annotations + +import re +import unittest + +import requests + +from utils.annotations.message import warning +from utils.cache.yaml import load_yaml_any +from utils.roles.mapping import ROLE_FILE_META_SERVICES + +from . import PROJECT_ROOT + +_SERVICES = PROJECT_ROOT / "roles/web-app-openpost" / ROLE_FILE_META_SERVICES +_CONFIG_LOADER = "apps/server/internal/config/config.go" +_REGISTRY = "ghcr.io/" +_SWITCH = re.compile(r'"(OPENPOST_[A-Z0-9_]*PRIVATE[A-Z0-9_]*)"') +_TIMEOUT_SECONDS = 30 +_TRACKING_ISSUE = "https://github.com/infinito-nexus/core/issues/2867" + + +def private_network_switches(source: str) -> list[str]: + """ + Args: + source: Go source of OpenPost's config loader. + + Returns: + The sorted, distinct ``OPENPOST_*PRIVATE*`` variables it names. + """ + return sorted(set(_SWITCH.findall(source))) + + +def _pinned_config_loader_url() -> str: + openpost = load_yaml_any(str(_SERVICES))["openpost"] + repository = openpost["image"].removeprefix(_REGISTRY) + return f"https://raw.githubusercontent.com/{repository}/{openpost['version']}/{_CONFIG_LOADER}" + + +class TestOpenPostNetguardAllowlist(unittest.TestCase): + def test_the_detector_finds_a_private_network_switch(self) -> None: + self.assertEqual( + private_network_switches( + 'getEnvDefault("OPENPOST_ALLOWED_PRIVATE_CIDRS", "")\n' + 'getEnvDefault("OPENPOST_PRIVACY_URL", "")' + ), + ["OPENPOST_ALLOWED_PRIVATE_CIDRS"], + ) + + def test_the_pinned_openpost_offers_no_private_network_switch(self) -> None: + url = _pinned_config_loader_url() + try: + response = requests.get(url, timeout=_TIMEOUT_SECONDS) + except requests.RequestException as exc: + self._unverified(url, f"{type(exc).__name__}: {exc}") + if response.status_code == 429 or response.status_code >= 500: + self._unverified(url, f"HTTP {response.status_code}") + self.assertEqual( + response.status_code, + 200, + f"{url} answered HTTP {response.status_code}; the pinned OpenPost no " + "longer ships its config loader at this path", + ) + switches = private_network_switches(response.text) + self.assertEqual( + switches, + [], + f"the pinned OpenPost reads {', '.join(switches)}, so netguard can " + "allow private networks now; drop the relay workaround as described " + f"in {_TRACKING_ISSUE}", + ) + + def _unverified(self, url: str, reason: str) -> None: + warning( + f"{url} was not checked ({reason})", + title="OpenPost netguard pin unverified", + file=str(_SERVICES.relative_to(PROJECT_ROOT)), + ) + raise unittest.SkipTest(f"{url} unverified") + + +if __name__ == "__main__": # pragma: no cover + unittest.main() From d687b006f3058efe27f2a717c8aac4c01d138bb8 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 529/554] refactor(web-app-openpost): move the Pixelfed client owner script into php/pixelfed/ --- .../php/{pixelfed_client_owner.php => pixelfed/client_owner.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/php/{pixelfed_client_owner.php => pixelfed/client_owner.php} (100%) diff --git a/roles/web-app-openpost/files/php/pixelfed_client_owner.php b/roles/web-app-openpost/files/php/pixelfed/client_owner.php similarity index 100% rename from roles/web-app-openpost/files/php/pixelfed_client_owner.php rename to roles/web-app-openpost/files/php/pixelfed/client_owner.php From 779bee8a23bd3f84a4c3051e9c898b5f8129b7ed Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 530/554] refactor(web-app-openpost): move the Pixelfed token script into php/pixelfed/ --- .../php/{pixelfed_mint_token.php => pixelfed/mint_token.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/php/{pixelfed_mint_token.php => pixelfed/mint_token.php} (100%) diff --git a/roles/web-app-openpost/files/php/pixelfed_mint_token.php b/roles/web-app-openpost/files/php/pixelfed/mint_token.php similarity index 100% rename from roles/web-app-openpost/files/php/pixelfed_mint_token.php rename to roles/web-app-openpost/files/php/pixelfed/mint_token.php From 5cf23df43e15585a788cacd73de39494fc6be6db Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 531/554] refactor(web-app-openpost): move the Mastodon grant script into ruby/mastodon/ --- .../grant_authorization.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/ruby/{mastodon_grant_authorization.rb => mastodon/grant_authorization.rb} (100%) diff --git a/roles/web-app-openpost/files/ruby/mastodon_grant_authorization.rb b/roles/web-app-openpost/files/ruby/mastodon/grant_authorization.rb similarity index 100% rename from roles/web-app-openpost/files/ruby/mastodon_grant_authorization.rb rename to roles/web-app-openpost/files/ruby/mastodon/grant_authorization.rb From 5621478af2cd91fdb4efb211545cf81be9f960f0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 532/554] refactor(web-app-openpost): move the Mastodon token script into ruby/mastodon/ --- .../files/ruby/{mastodon_mint_token.rb => mastodon/mint_token.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/ruby/{mastodon_mint_token.rb => mastodon/mint_token.rb} (100%) diff --git a/roles/web-app-openpost/files/ruby/mastodon_mint_token.rb b/roles/web-app-openpost/files/ruby/mastodon/mint_token.rb similarity index 100% rename from roles/web-app-openpost/files/ruby/mastodon_mint_token.rb rename to roles/web-app-openpost/files/ruby/mastodon/mint_token.rb From bb0460fb9eca32a6a62107f62a00d04bcc423b09 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 533/554] refactor(web-app-openpost): move the crossposter's create_schema statement into create/ --- .../sql/crossposter/{create_schema.sql => create/schema.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{create_schema.sql => create/schema.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/create_schema.sql b/roles/web-app-openpost/files/sql/crossposter/create/schema.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/create_schema.sql rename to roles/web-app-openpost/files/sql/crossposter/create/schema.sql From 9c804f935ae0aa2955054ef0e9437de3511a1779 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 534/554] refactor(web-app-openpost): move the crossposter's create_cursors statement into create/ --- .../sql/crossposter/{create_cursors.sql => create/cursors.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{create_cursors.sql => create/cursors.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/create_cursors.sql b/roles/web-app-openpost/files/sql/crossposter/create/cursors.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/create_cursors.sql rename to roles/web-app-openpost/files/sql/crossposter/create/cursors.sql From c4f3a7891d237ff813872994ec1f38e4fcbe57af Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 535/554] refactor(web-app-openpost): move the crossposter's create_items statement into create/ --- .../files/sql/crossposter/{create_items.sql => create/items.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{create_items.sql => create/items.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/create_items.sql b/roles/web-app-openpost/files/sql/crossposter/create/items.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/create_items.sql rename to roles/web-app-openpost/files/sql/crossposter/create/items.sql From 74b5e729a8d0478cdca95012e53c7d169a0381c9 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 536/554] refactor(web-app-openpost): move the crossposter's select_cursor statement into select/ --- .../sql/crossposter/{select_cursor.sql => select/cursor.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{select_cursor.sql => select/cursor.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/select_cursor.sql b/roles/web-app-openpost/files/sql/crossposter/select/cursor.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/select_cursor.sql rename to roles/web-app-openpost/files/sql/crossposter/select/cursor.sql From 41d2208375bb2f9ba559c3d000f0b3be4feba44c Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 537/554] refactor(web-app-openpost): move the crossposter's select_due statement into select/ --- .../files/sql/crossposter/{select_due.sql => select/due.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{select_due.sql => select/due.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/select_due.sql b/roles/web-app-openpost/files/sql/crossposter/select/due.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/select_due.sql rename to roles/web-app-openpost/files/sql/crossposter/select/due.sql From 5dd1498e1c760a428fb7d17f91eac91f5868f531 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 538/554] refactor(web-app-openpost): move the crossposter's select_open_publications statement into select/ --- .../open_publications.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{select_open_publications.sql => select/open_publications.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/select_open_publications.sql b/roles/web-app-openpost/files/sql/crossposter/select/open_publications.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/select_open_publications.sql rename to roles/web-app-openpost/files/sql/crossposter/select/open_publications.sql From e9b8ee787e0ec2705928516b0985af6d183bf180 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 539/554] refactor(web-app-openpost): move the crossposter's select_unnotified statement into select/ --- .../crossposter/{select_unnotified.sql => select/unnotified.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{select_unnotified.sql => select/unnotified.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/select_unnotified.sql b/roles/web-app-openpost/files/sql/crossposter/select/unnotified.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/select_unnotified.sql rename to roles/web-app-openpost/files/sql/crossposter/select/unnotified.sql From 2d9f9c84bf8f546297ea1a298867ecab9b87ca1f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:36 +0100 Subject: [PATCH 540/554] refactor(web-app-openpost): move the crossposter's select_items statement into select/ --- .../files/sql/crossposter/{select_items.sql => select/items.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/web-app-openpost/files/sql/crossposter/{select_items.sql => select/items.sql} (100%) diff --git a/roles/web-app-openpost/files/sql/crossposter/select_items.sql b/roles/web-app-openpost/files/sql/crossposter/select/items.sql similarity index 100% rename from roles/web-app-openpost/files/sql/crossposter/select_items.sql rename to roles/web-app-openpost/files/sql/crossposter/select/items.sql From 213d178430b88c8f12a11fe2ce964881158bbf83 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:37 +0100 Subject: [PATCH 541/554] refactor(web-app-openpost): run the crossposter's create and select statements from their folders --- .../files/python/crossposter/store.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/web-app-openpost/files/python/crossposter/store.py b/roles/web-app-openpost/files/python/crossposter/store.py index bb988cfdb5..b5d50e1630 100644 --- a/roles/web-app-openpost/files/python/crossposter/store.py +++ b/roles/web-app-openpost/files/python/crossposter/store.py @@ -10,17 +10,17 @@ from .sources import Media, SourceItem LOCK_ID = 4_103_270_041 SQL_DIR = Path(__file__).resolve().parent / "sql" -SCHEMA = ("create_schema", "create_cursors", "create_items") +SCHEMA = ("create/schema", "create/cursors", "create/items") QUERIES = ( *SCHEMA, "try_lock", - "select_cursor", + "select/cursor", "insert_item", "upsert_cursor", - "select_due", - "select_open_publications", - "select_unnotified", - "select_items", + "select/due", + "select/open_publications", + "select/unnotified", + "select/items", "update_item", "resend_item", "mark_notified", @@ -72,7 +72,7 @@ def item_from_json(raw: dict) -> SourceItem: def query(name: str) -> str: """ Args: - name: one of QUERIES, the file name of a statement without ``.sql``. + name: one of QUERIES, the path of a statement below SQL_DIR without ``.sql``. Returns: The statement's text from SQL_DIR. @@ -104,7 +104,7 @@ class Store: def cursor(self, route: str) -> str | None: row = self.connection.execute( - query("select_cursor"), {"route": route} + query("select/cursor"), {"route": route} ).fetchone() return None if row is None else str(row["cursor"]) @@ -129,16 +129,16 @@ class Store: ) def due(self) -> list[dict]: - return self._rows("select_due") + return self._rows("select/due") def open_publications(self) -> list[dict]: - return self._rows("select_open_publications") + return self._rows("select/open_publications") def unnotified(self) -> list[dict]: - return self._rows("select_unnotified") + return self._rows("select/unnotified") def everything(self) -> list[dict]: - return self._rows("select_items") + return self._rows("select/items") def update( self, From 10a270e7bc40d2a64c65121bff9efd61ee428045 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:37 +0100 Subject: [PATCH 542/554] refactor(web-app-openpost): read the Mastodon grant script from ruby/mastodon/ --- roles/web-app-openpost/tasks/crossposter/seed/connect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml index d346dba002..d7df6e9669 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/connect.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/connect.yml @@ -33,7 +33,7 @@ - bin/rails - runner - "-" - stdin: "{{ lookup('file', 'ruby/mastodon_grant_authorization.rb') }}" + stdin: "{{ lookup('file', 'ruby/mastodon/grant_authorization.rb') }}" register: openpost_crossposter_mastodon_grant changed_when: true delegate_to: "{{ OPENPOST_SEED_MASTODON_HOST_NODE }}" From 2f1ef26ab9aa256b1ea3244734590b38bfe4fa31 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:37 +0100 Subject: [PATCH 543/554] refactor(web-app-openpost): read the Mastodon token script from ruby/mastodon/ --- roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml index ea0d691570..8ba1a8fe97 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/mastodon.yml @@ -19,7 +19,7 @@ - bin/rails - runner - "-" - stdin: "{{ lookup('file', 'ruby/mastodon_mint_token.rb') }}" + stdin: "{{ lookup('file', 'ruby/mastodon/mint_token.rb') }}" loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'mastodon') | list }}" loop_control: label: "{{ item.name }}" From f84ac0cd7120bd1453f59074beac5d86bd09f5e0 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:37 +0100 Subject: [PATCH 544/554] refactor(web-app-openpost): read the Pixelfed token script from php/pixelfed/ --- roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml index a7c3fd3778..5bc7812565 100644 --- a/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml +++ b/roles/web-app-openpost/tasks/crossposter/seed/pixelfed.yml @@ -21,7 +21,7 @@ - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver - php - stdin: "{{ lookup('file', 'php/pixelfed_mint_token.php') }}" + stdin: "{{ lookup('file', 'php/pixelfed/mint_token.php') }}" loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list }}" loop_control: label: "{{ item.name }}" From d826f1ba96bab0b1f237b8e16b2a906a053fc4a5 Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:37 +0100 Subject: [PATCH 545/554] refactor(web-app-openpost): read the Pixelfed client owner script from php/pixelfed/ --- roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml index e4eddefc90..1d0dcb57d6 100644 --- a/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml +++ b/roles/web-app-openpost/tasks/fediverse/pixelfed_owner.yml @@ -23,7 +23,7 @@ - "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}" - "{{ OPENPOST_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver - php - stdin: "{{ lookup('file', 'php/pixelfed_client_owner.php') }}" + stdin: "{{ lookup('file', 'php/pixelfed/client_owner.php') }}" loop: "{{ OPENPOST_PINNED_PIXELFED }}" loop_control: label: "{{ item.url }}" From 506c2bbe57ac38aa9d134043c193aad0b726303f Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:37 +0100 Subject: [PATCH 546/554] test(web-app-openpost): find the crossposter's statements through the cached project walk --- .../web-app-openpost/files/crossposter/test_store.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py index 0a02236c31..23e88db187 100644 --- a/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py +++ b/tests/unit/python/roles/web-app-openpost/files/crossposter/test_store.py @@ -5,10 +5,13 @@ import json import re import unittest import unittest.mock +from pathlib import Path from crossposter import store from crossposter.sources import Media, SourceItem +from utils.cache.files import iter_project_files + from . import PROJECT_ROOT SOURCE = "https://microblog.example/users/press/statuses/1" @@ -69,8 +72,13 @@ class TestQueries(unittest.TestCase): self.addCleanup(patcher.stop) def test_every_query_has_one_file_and_every_file_a_query(self) -> None: + statements = (Path(path) for path in iter_project_files(extensions=(".sql",))) self.assertEqual( - sorted(path.stem for path in SQL_SOURCE.glob("*.sql")), + sorted( + path.relative_to(SQL_SOURCE).with_suffix("").as_posix() + for path in statements + if path.is_relative_to(SQL_SOURCE) + ), sorted(store.QUERIES), ) From bf3044767573fb0a18358344b10678de17dd739b Mon Sep 17 00:00:00 2001 From: evangelostsak Date: Wed, 25 Nov 2026 01:20:37 +0100 Subject: [PATCH 547/554] docs(requirements): show the crossposter's create and select statement folders --- docs/requirements/063-openpost-crossposter.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/requirements/063-openpost-crossposter.md b/docs/requirements/063-openpost-crossposter.md index cf6de6e916..16bbdf5212 100644 --- a/docs/requirements/063-openpost-crossposter.md +++ b/docs/requirements/063-openpost-crossposter.md @@ -92,7 +92,9 @@ roles/web-app-openpost/files/python/ ├── linkedin.py └── store.py roles/web-app-openpost/files/sql/crossposter/ -└── .sql one file per statement crossposter/store.py runs, staged into the image as crossposter/sql/ +├── create/.sql schema statements crossposter/store.py runs on start +├── select/.sql the reads it runs +└── .sql the writes, one file each; the tree is staged into the image as crossposter/sql/ tests/unit/python/roles/web-app-openpost/files/crossposter/ tests/unit/python/roles/web-app-openpost/files/provider/ ``` From d49655b1eac3b945447bc516a9681e6ab42155b6 Mon Sep 17 00:00:00 2001 From: "infinito-nexus-updater[bot]" <286144613+infinito-nexus-updater[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 10:01:51 +0000 Subject: [PATCH 548/554] update(repos): bump git refs to latest tags and commits (web-app-bridgy-fed) --- roles/web-app-bridgy-fed/meta/services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-bridgy-fed/meta/services.yml b/roles/web-app-bridgy-fed/meta/services.yml index 6e3ccf8399..87d935c752 100644 --- a/roles/web-app-bridgy-fed/meta/services.yml +++ b/roles/web-app-bridgy-fed/meta/services.yml @@ -53,7 +53,7 @@ bridgy-fed: version: 3.14-slim name: web-app-bridgy-fed repository: https://github.com/snarfed/bridgy-fed.git - ref: cbb76808cd8f21b571939a2a7b42655d845ea40a + ref: 891f78efd4601d1590640fb02982d3c3ed64459b ports: local: http: 8053 From dfea2e32cc3cacd71d0402d17c482d0b117d7099 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 25 Nov 2026 11:44:33 +0000 Subject: [PATCH 549/554] fix(test-e2e-playwright): run Playwright without core dumps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main run 45509759037 Moodle#2: after six chrome-headless int3 traps the Playwright container ran out of space ('OSError: [Errno 28] No space left on device', every file of the inner snapshot 0 bytes), while the host filesystem was back at 52 % once the container was gone. The host kernel uses a relative file core_pattern (no pipe helper), so crashing browsers can write core files into the container's filesystem. The runner now starts with --ulimit=core=0, the container guard allows exactly that value, and the local rerun script and the README carry the same flag. No artifact shows a core file itself, so this is the likely cause; draft PR, CI proves it. 🎯 Fix: 75 % 💥 Break: 3 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 73 🚦 Gate: ⛔ fix 75 % < 90 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- roles/test-e2e-playwright/README.md | 2 +- .../files/spec_secrets_container.py | 1 + roles/test-e2e-playwright/tasks/03_run_pass.yml | 2 +- scripts/tests/e2e/rerun-spec.sh | 2 +- .../test-e2e-playwright/test_spec_secrets_container.py | 8 ++++++++ .../test-e2e-playwright/test_spec_secrets_mount.py | 10 ++++++++++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/roles/test-e2e-playwright/README.md b/roles/test-e2e-playwright/README.md index a7bb9b2e57..d6f1e42ce6 100644 --- a/roles/test-e2e-playwright/README.md +++ b/roles/test-e2e-playwright/README.md @@ -30,7 +30,7 @@ This role: - Renders `.env` from `templates/playwright.env.j2` using Ansible variables (`application_id`, `domains`, `users`, `applications`) - Optionally waits until the application responds with HTTP `200` or `302` - Injects CA trust automatically for `TLS_MODE=self_signed` (via `CA_TRUST.*`), so Playwright accepts self-signed cert chains -- Runs Playwright in Docker with stable browser settings (`--ipc=host`, `--shm-size=1g`) +- Runs Playwright in Docker with stable browser settings (`--ipc=host`, `--shm-size=1g`) and without core dumps (`--ulimit=core=0`), so a crashing browser cannot fill the container's disk - Runs the suite once per role on one network it is served on (`lookup('network_siblings', ...)`), picked at random when there are several and kept for the flake retry, with the `.env` rendered for that network's vhost - Stores per-role reports/artifacts under `TEST_E2E_PLAYWRIGHT_REPORTS_BASE_DIR/`, or under `+` when the pick is not the canonical network diff --git a/roles/test-e2e-playwright/files/spec_secrets_container.py b/roles/test-e2e-playwright/files/spec_secrets_container.py index 337992a325..2e5adce400 100644 --- a/roles/test-e2e-playwright/files/spec_secrets_container.py +++ b/roles/test-e2e-playwright/files/spec_secrets_container.py @@ -59,6 +59,7 @@ OPTIONS = { "--oom-score-adj": re.compile(r"-?[0-9]+"), "--network": re.compile(r"host|none"), "--user": re.compile(r"[0-9]+:[0-9]+"), + "--ulimit": re.compile(r"core=0"), "-w": re.compile(r"/e2e"), "-e": re.compile(r"[A-Z][A-Z0-9_]*=.*"), "-v": re.compile(r"/[^:]+:/[^:]+(?::ro)?"), diff --git a/roles/test-e2e-playwright/tasks/03_run_pass.yml b/roles/test-e2e-playwright/tasks/03_run_pass.yml index ff9bffe224..3def07ab20 100644 --- a/roles/test-e2e-playwright/tasks/03_run_pass.yml +++ b/roles/test-e2e-playwright/tasks/03_run_pass.yml @@ -110,7 +110,7 @@ {{ (['python3', '-I', '-B', TEST_E2E_PLAYWRIGHT_TOOLS_DIR ~ '/spec_secrets.py', 'guard'] if (_playwright_secrets_template_stat.stat.exists | bool) else []) + TEST_E2E_PLAYWRIGHT_MASK_ARGV - + [('docker' if (_playwright_secrets_template_stat.stat.exists | bool) else 'container'), 'run', '--rm', '--ipc=host', '--shm-size=1g'] + + [('docker' if (_playwright_secrets_template_stat.stat.exists | bool) else 'container'), 'run', '--rm', '--ipc=host', '--shm-size=1g', '--ulimit=core=0'] + ( ['--network', 'host'] if IS_SWARM_MODE diff --git a/scripts/tests/e2e/rerun-spec.sh b/scripts/tests/e2e/rerun-spec.sh index 29c12efb30..e77cdea08d 100755 --- a/scripts/tests/e2e/rerun-spec.sh +++ b/scripts/tests/e2e/rerun-spec.sh @@ -203,7 +203,7 @@ for sub in addons fixtures; do done run=(docker run --rm - --ipc=host --shm-size=1g + --ipc=host --shm-size=1g --ulimit=core=0 "${net_args[@]}" --env-file "$env_file" -e "INFINITO_PLAYWRIGHT_KEEP=${INFINITO_PLAYWRIGHT_KEEP:-}" diff --git a/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_container.py b/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_container.py index f0c62e8ce7..e40e924465 100644 --- a/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_container.py +++ b/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_container.py @@ -148,6 +148,8 @@ def argv_triggers(stage: Path, run: Path) -> dict[str, tuple[str, list[str]]]: ), "entrypoint": ("-w", ["--entrypoint", "/bin/sh", "-w"]), "privileged": ("-w", ["--privileged", "-w"]), + "core_dumps": ("-w", ["--ulimit=core=-1", "-w"]), + "other_ulimit": ("-w", ["--ulimit", "nofile=1048576", "-w"]), "other_cidfile": (f"--cidfile={run}/.cid", ["--cidfile=/srv/x/.cid"]), "no_log_driver": ("--log-driver=none", []), "reports_elsewhere": (f"{run}/reports:/reports", ["/srv/x:/reports"]), @@ -212,6 +214,12 @@ class TestSpecSecretsContainer(unittest.TestCase): def test_the_command_a_run_with_spec_secrets_starts_passes(self) -> None: self.assertFalse(self.refused(container_argv(self.root, self.run_dir))) + def test_a_run_without_core_dumps_passes(self) -> None: + argv = container_argv(self.root, self.run_dir) + at = argv.index("-w") + argv[at:at] = ["--ulimit=core=0"] + self.assertFalse(self.refused(argv)) + def test_a_docker_config_the_caller_exports_stays_out_of_the_checks(self) -> None: argv = container_argv(self.root, self.run_dir) exported = {"DOCKER_CONFIG": str(open_config(self.root))} diff --git a/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_mount.py b/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_mount.py index 8feca6cef8..b3858b1e1a 100644 --- a/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_mount.py +++ b/tests/unit/python/roles/test-e2e-playwright/test_spec_secrets_mount.py @@ -3,6 +3,7 @@ from __future__ import annotations import copy import re import unittest +from itertools import pairwise from . import role_task from ._spec_secrets_wiring import ( @@ -27,6 +28,7 @@ from ._spec_secrets_wiring import ( mount_violations, prune_violations, render, + render_argv, role_tasks, run_argv, ) @@ -313,6 +315,14 @@ class TestSpecSecretsMount(unittest.TestCase): queued = role_task("03_run_pass.yml", "📬")["vars"]["_playwright_argv"] self.assertEqual(queued, run_argv()) + def test_every_run_disables_core_dumps_in_the_container(self) -> None: + for exists, directory in ((False, STALE_DIR), (True, SECRETS_DIR)): + with self.subTest(template=exists): + argv = render_argv(run_argv(), exists, directory) + self.assertIn( + ("--shm-size=1g", "--ulimit=core=0"), list(pairwise(argv)) + ) + def test_the_role_level_env_file_is_untouched(self) -> None: self.assertEqual(env_task()["ansible.builtin.copy"]["mode"], "0644") self.assertNotIn("secrets", str(env_task())) From cb5cf8b8a3de45ca82e470490398f7a7eaad1166 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 25 Nov 2026 12:09:20 +0000 Subject: [PATCH 550/554] fix(web-svc-libretranslate): shorten the staging task name to the 80-char limit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #2919 named the task that stages prefetch_models.py and gunicorn_worker_exit.py with 84 characters, so test_name_emoji_and_length fails on main 76e3a49cf3. The shorter name keeps the emoji prefix and fits one line. 🎯 Fix: 98 % 💥 Break: 1 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 97 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- roles/web-svc-libretranslate/tasks/00_core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-svc-libretranslate/tasks/00_core.yml b/roles/web-svc-libretranslate/tasks/00_core.yml index fa3a4307fa..57b2064c20 100644 --- a/roles/web-svc-libretranslate/tasks/00_core.yml +++ b/roles/web-svc-libretranslate/tasks/00_core.yml @@ -10,7 +10,7 @@ include_role: name: sys-stk-full -- name: "📦 Stage the model prefetch and the gunicorn worker-exit hook of {{ application_id }}" +- name: "📦 Stage the model prefetch and worker-exit hook of {{ application_id }}" stack_host_copy: src: "python/{{ item }}" dest: "{{ [lookup('container', application_id, 'directories.instance'), item] | path_join }}" From 0980e2ccc9c9f5ac50473da5aaa1bb2265f6361d Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 25 Nov 2026 12:39:14 +0000 Subject: [PATCH 551/554] fix(update): take ALARM databases and packages from one concrete mirror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Arch Linux ARM geo host mirror.archlinuxarm.org redirects every request on its own, so pacman took core.db from a mirror that already held kmod-34.4-1 and fetched the packages from mirrors that only served kmod-34.3-2, and the upgrade failed with 404s on arm64 (main run 45509759037: Bridgy Fed#0, LAM#1, Meta#1, Nextcloud#13, jitsi#2; PR #2873 OpenProject#0; PR #2856 GitLab#1). alarm_mirror.sh demote moves every geo Server line behind the last concrete Server before the database refresh. When the upgrade still fails to retrieve files, alarm_mirror.sh retry rotates the first concrete Server behind the last concrete one and runs pacman -Syyu, once per further concrete mirror; the geo host never leads. The role decides by the script's exit code only, the mirrorlist is replaced atomically with its mode kept, and a mirrorlist without the geo host (x86_64 Arch) stays untouched. 🎯 Fix: 85 % 💥 Break: 4 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 82 🚦 Gate: ⛔ fix 85 % < 90 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- roles/update/README.md | 2 + roles/update/files/shell/alarm_mirror.sh | 93 +++++++ roles/update/tasks/arch.yml | 34 ++- roles/update/vars/main.yml | 1 + .../roles/update/files/test_alarm_mirror.py | 234 ++++++++++++++++++ tests/unit/python/roles/update/test_arch.py | 73 ++++++ 6 files changed, 434 insertions(+), 3 deletions(-) create mode 100755 roles/update/files/shell/alarm_mirror.sh create mode 100644 tests/unit/python/roles/update/files/test_alarm_mirror.py create mode 100644 tests/unit/python/roles/update/test_arch.py diff --git a/roles/update/README.md b/roles/update/README.md index c9dc3e91c4..0beefaf2a9 100644 --- a/roles/update/README.md +++ b/roles/update/README.md @@ -26,6 +26,8 @@ message when a host runs a distribution that this role does not yet cover. | `CentOS` | `centos.yml` | `ansible.builtin.dnf` | | anything else | `unsupported.yml` | `ansible.builtin.fail` | +On Arch Linux ARM, `arch.yml` runs [alarm_mirror.sh](files/shell/alarm_mirror.sh) before the database refresh. The geo host `mirror.archlinuxarm.org` redirects every request on its own, so pacman can take the database from a mirror that already holds a new release and look the packages up on mirrors that do not yet serve it. The script moves every `Server` line of that host behind the last concrete `Server` of `/etc/pacman.d/mirrorlist`, so the database and the packages come from the first concrete mirror. When the upgrade still fails to retrieve packages, the role moves the first concrete `Server` behind the last concrete one, re-syncs the databases (`pacman -Syyu`) and upgrades again, at most once for every further concrete mirror; the geo host never leads. The role decides by the script's exit code, never by its output, and fails with the original error when no retry succeeded. A mirrorlist without that geo host, such as the one of x86_64 Arch Linux, stays untouched. + `centos.yml` first runs [centos_mirror.sh](files/shell/centos_mirror.sh), which replaces every `metalink=` of the CentOS Stream repo files with a `baseurl=` on `mirror.stream.centos.org` and every `metalink=` of the EPEL repo files with the file's own `baseurl` template on `dl.fedoraproject.org`, and then includes `fedora.yml`. The [Dockerfile](../../Dockerfile) runs the same script before its first `dnf` call, so the CentOS dev and swarm-node images resolve against the same source. ## Cosmos diff --git a/roles/update/files/shell/alarm_mirror.sh b/roles/update/files/shell/alarm_mirror.sh new file mode 100755 index 0000000000..c78c7acdbc --- /dev/null +++ b/roles/update/files/shell/alarm_mirror.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +# Param: $1 demote or retry, $2 the pacman mirrorlist. Only a mirrorlist with an active Server on the Arch Linux ARM geo host mirror.archlinuxarm.org is touched. A missing mirrorlist counts as one without that host. demote moves every geo Server behind the last concrete Server, prints the new first Server and exits 3; it exits 0 and prints nothing when nothing moved. retry moves the first concrete Server behind the last concrete one, then re-syncs the databases and upgrades, at most once for every concrete mirror after the first; it exits 0 after the upgrade that succeeded, with pacman's code when none did, and 1 when it retried nothing. +set -euo pipefail + +verb="$1" +mirrorlist="$2" +server='^[[:space:]]*Server[[:space:]]*=' +geo='^[[:space:]]*Server[[:space:]]*=[[:space:]]*https?://mirror\.archlinuxarm\.org/' + +case "${verb}" in +demote | retry) ;; +*) + echo "ERROR: unknown verb ${verb}, expected demote or retry" >&2 + exit 2 + ;; +esac + +scan() { + local index + geos=() + concrete=() + for index in "${!lines[@]}"; do + [[ "${lines[index]}" =~ ${server} ]] || continue + if [[ "${lines[index]}" =~ ${geo} ]]; then + geos+=("${index}") + else + concrete+=("${index}") + fi + done +} + +move_behind() { + local from="$1" after="$2" index + local moved=() + for index in "${!lines[@]}"; do + if ((index != from)); then + moved+=("${lines[index]}") + fi + if ((index == after)); then + moved+=("${lines[from]}") + fi + done + lines=("${moved[@]}") + printf '%s\n' "${lines[@]}" >"${mirrorlist}.new" + chmod --reference="${mirrorlist}" "${mirrorlist}.new" + chown --reference="${mirrorlist}" "${mirrorlist}.new" + mv -f "${mirrorlist}.new" "${mirrorlist}" + scan +} + +demote_geo() { + ((${#geos[@]} > 0 && ${#concrete[@]} > 0)) || return 0 + while ((geos[0] < concrete[-1])); do + move_behind "${geos[0]}" "${concrete[-1]}" + demoted=1 + done +} + +lead() { + printf '%s\n' "${lines[concrete[0]]}" +} + +lines=() +if [[ -f "${mirrorlist}" ]]; then + mapfile -t lines <"${mirrorlist}" +fi +scan +demoted=0 + +case "${verb}" in +demote) + demote_geo + if ((demoted)); then + lead + exit 3 + fi + ;; +retry) + ((${#geos[@]} > 0)) || exit 1 + demote_geo + status=1 + for ((rotation = 1; rotation < ${#concrete[@]}; rotation++)); do + move_behind "${concrete[0]}" "${concrete[-1]}" + status=0 + pacman --sync --refresh --refresh --sysupgrade --noconfirm >&2 || status=$? + if ((status == 0)); then + lead + exit 0 + fi + done + exit "${status}" + ;; +esac diff --git a/roles/update/tasks/arch.yml b/roles/update/tasks/arch.yml index bafbebed67..c44c7fe4a9 100644 --- a/roles/update/tasks/arch.yml +++ b/roles/update/tasks/arch.yml @@ -29,6 +29,14 @@ replace: "#DownloadUser =" when: "'DisableSandbox' in (update_pacman_conf.content | b64decode).splitlines()" +- name: "🪞 update (pacman) | take ALARM databases and packages from one concrete mirror" + become: true + ansible.builtin.script: + cmd: shell/alarm_mirror.sh demote {{ UPDATE_PACMAN_MIRRORLIST | quote }} + register: update_alarm_demoted + changed_when: update_alarm_demoted.rc == 3 + failed_when: update_alarm_demoted.rc not in [0, 3] + - name: "🔄 update (pacman) | refresh the pacman package databases" community.general.pacman: # nocheck: dynamic-package - database refresh, not a package install update_cache: true @@ -50,9 +58,29 @@ enabled: true when: not ansible_check_mode -- name: "🔄 update (pacman) | upgrade all installed packages" - community.general.pacman: # nocheck: dynamic-package - full-system upgrade, not a package install - upgrade: true +- name: "🔄 update (pacman) | upgrade all installed packages, retrying ALARM mirrors" + block: + - name: "🔄 update (pacman) | upgrade all installed packages" + community.general.pacman: # nocheck: dynamic-package - full-system upgrade, not a package install + upgrade: true + rescue: + - name: "🛑 update (pacman) | re-raise anything but packages no mirror served" # nocheck: rescue-recovery an Arch Linux ARM mirror can list packages in its database before it serves them, so the retry moves to the next concrete mirror, re-syncs and upgrades again, once per mirror; the last failure fails loud + ansible.builtin.fail: + msg: "{{ ansible_failed_result.msg }}" + when: "'failed to retrieve some files' not in (ansible_failed_result.stderr | default(''))" + + - name: "🔁 update (pacman) | upgrade from the next concrete ALARM mirror" + become: true + ansible.builtin.script: + cmd: shell/alarm_mirror.sh retry {{ UPDATE_PACMAN_MIRRORLIST | quote }} + register: update_alarm_retried + changed_when: update_alarm_retried.rc == 0 + failed_when: false + + - name: "🛑 update (pacman) | re-raise the failure no further ALARM mirror retried" + ansible.builtin.fail: + msg: "{{ ansible_failed_result.msg }}" + when: update_alarm_retried is skipped or update_alarm_retried.rc != 0 - name: "🛑 update (pacman) | reboot or guard when the running kernel was upgraded" ansible.builtin.include_tasks: arch/reboot.yml diff --git a/roles/update/vars/main.yml b/roles/update/vars/main.yml index a27068b088..d3269d9c56 100644 --- a/roles/update/vars/main.yml +++ b/roles/update/vars/main.yml @@ -3,3 +3,4 @@ application_id: update UPDATE_REBOOT_ENABLED: "{{ lookup('config', application_id, 'services.update.reboot.enabled') | bool }}" UPDATE_KERNEL_MODULES_HOOK_ENABLED: "{{ lookup('config', application_id, 'services.update.kernel_modules_hook.enabled') | bool }}" UPDATE_PACMAN_XFER: "{{ [ DIR_BIN, 'pacman-xfer' ] | path_join }}" +UPDATE_PACMAN_MIRRORLIST: /etc/pacman.d/mirrorlist diff --git a/tests/unit/python/roles/update/files/test_alarm_mirror.py b/tests/unit/python/roles/update/files/test_alarm_mirror.py new file mode 100644 index 0000000000..0d5a5d2afe --- /dev/null +++ b/tests/unit/python/roles/update/files/test_alarm_mirror.py @@ -0,0 +1,234 @@ +import os +import subprocess +import tempfile +import unittest +from pathlib import Path + +from utils import PROJECT_ROOT +from utils.cache.files import read_text + +SCRIPT = PROJECT_ROOT / "roles/update/files/shell/alarm_mirror.sh" +GEO = "Server = http://mirror.archlinuxarm.org/$arch/$repo" +GEO_HTTPS = "Server = https://mirror.archlinuxarm.org/$arch/$repo" +DE = "Server = http://de.mirror.archlinuxarm.org/$arch/$repo" +DE3 = "Server = http://de3.mirror.archlinuxarm.org/$arch/$repo" +DK = "Server = http://dk.mirror.archlinuxarm.org/$arch/$repo" +HEADER = ["#", "# Arch Linux ARM repository mirrorlist", "#", ""] +IMAGE = [ + *HEADER, + "## Geo-IP based mirror selection and load balancing", + GEO, + "", + "### Germany", + DE, + DE3, + "", + "### Denmark", + DK, +] +STOCK = [ + *HEADER, + "## Geo-IP based mirror selection and load balancing", + GEO, + "", + "### Germany", + f"# {DE}", + f"# {DE3}", +] +TWO_GEO = [*HEADER, GEO, GEO_HTTPS, "", DE, DE3, DK] +X86 = [ + "##", + "## Arch Linux repository mirrorlist", + "##", + "", + "Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch", + "Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch", + "Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch", +] +PACMAN_FAILED = 7 +DEMOTED = 3 +PACMAN_STUB = ( + "#!/bin/sh\n" + 'lead="$(grep -m 1 -E \'^[[:space:]]*Server[[:space:]]*=\' "${MIRRORLIST}")"\n' + 'printf \'%s|%s\\n\' "${lead}" "$*" >> "${PACMAN_LOG}"\n' + "echo 'resolving dependencies...'\n" + 'if [ -n "${PACMAN_SERVES}" ]; then\n' + '\tcase "${lead}" in *"${PACMAN_SERVES}"*) exit 0 ;; esac\n' + "fi\n" + f"exit {PACMAN_FAILED}\n" +) +RESYNC_UPGRADE = "--sync --refresh --refresh --sysupgrade --noconfirm" + + +def text(lines): + return "\n".join(lines) + "\n" + + +class TestAlarmMirror(unittest.TestCase): + def setUp(self): + tmp = tempfile.TemporaryDirectory() + self.addCleanup(tmp.cleanup) + self.root = Path(tmp.name) + bin_dir = self.root / "bin" + bin_dir.mkdir() + stub = bin_dir / "pacman" + stub.write_text(PACMAN_STUB) + stub.chmod(0o755) + self.mirrorlist = self.root / "mirrorlist" + self.pacman_log = self.root / "pacman.log" + self.env = dict(os.environ) + self.env["PATH"] = f"{bin_dir}{os.pathsep}{self.env['PATH']}" + self.env["MIRRORLIST"] = str(self.mirrorlist) + self.env["PACMAN_LOG"] = str(self.pacman_log) + + def run_helper(self, verb, lines=None, serves=""): + """Run the helper the way the role does, with a pacman stub on PATH. + + Args: + verb: demote or retry. + lines: the mirrorlist's lines before the run, or None to keep the + mirrorlist an earlier run left. + serves: the host whose upgrade the stub lets succeed while it is + the first Server; every other first Server, and every one when + empty, fails with PACMAN_FAILED. + + Returns: + Tuple of exit code, stdout, and the mirrorlist's lines after the + run, or None when there is no mirrorlist. + """ + if lines is not None: + self.mirrorlist.write_text(text(lines)) + env = dict(self.env, PACMAN_SERVES=serves) + done = subprocess.run( + ["bash", str(SCRIPT), verb, str(self.mirrorlist)], + env=env, + capture_output=True, + text=True, + timeout=60, + check=False, + ) + if not self.mirrorlist.exists(): + return done.returncode, done.stdout, None + after = self.mirrorlist.read_text() # nocheck: cache-read rewritten + return done.returncode, done.stdout, after.splitlines() + + def pacman_calls(self): + """Read the pacman stub's log. + + Returns: + One (first Server, argv) pair per pacman call, in call order. + """ + if not self.pacman_log.exists(): + return [] + return [ + tuple(line.split("|", 1)) + for line in read_text(str(self.pacman_log)).splitlines() + ] + + def servers(self, lines): + return [line for line in lines if line.startswith("Server")] + + def test_demote_moves_the_geo_host_behind_the_last_server(self): + code, out, after = self.run_helper("demote", IMAGE) + self.assertEqual(code, DEMOTED) + self.assertEqual(self.servers(after), [DE, DE3, DK, GEO]) + self.assertEqual(out, f"{DE}\n") + + def test_demote_keeps_every_other_line_in_place(self): + _, _, after = self.run_helper("demote", IMAGE) + self.assertEqual(after, [line for line in IMAGE if line != GEO] + [GEO]) + + def test_demote_twice_changes_nothing_the_second_time(self): + self.run_helper("demote", IMAGE) + code, out, after = self.run_helper("demote") + self.assertEqual(code, 0) + self.assertEqual(out, "") + self.assertEqual(self.servers(after), [DE, DE3, DK, GEO]) + + def test_demote_leaves_a_geo_only_mirrorlist_untouched(self): + code, out, after = self.run_helper("demote", STOCK) + self.assertEqual((code, out, after), (0, "", STOCK)) + + def test_demote_moves_every_geo_line_behind_the_last_server(self): + code, out, after = self.run_helper("demote", TWO_GEO) + self.assertEqual(code, DEMOTED) + self.assertEqual(out, f"{DE}\n") + self.assertEqual(self.servers(after)[:3], [DE, DE3, DK]) + self.assertEqual(sorted(self.servers(after)[3:]), sorted([GEO, GEO_HTTPS])) + + def test_demote_keeps_the_mirrorlist_mode(self): + self.mirrorlist.write_text(text(IMAGE)) + self.mirrorlist.chmod(0o640) + code, _, _ = self.run_helper("demote") + self.assertEqual(code, DEMOTED) + self.assertEqual(self.mirrorlist.stat().st_mode & 0o777, 0o640) + self.assertEqual( + sorted(path.name for path in self.root.iterdir()), ["bin", "mirrorlist"] + ) + + def test_a_missing_mirrorlist_counts_as_one_without_the_geo_host(self): + for verb, expected in (("demote", 0), ("retry", 1)): + with self.subTest(verb=verb): + code, out, after = self.run_helper(verb) + self.assertEqual((code, out, after), (expected, "", None)) + self.assertEqual(self.pacman_calls(), []) + + def test_an_x86_64_mirrorlist_stays_untouched(self): + for verb, expected in (("demote", 0), ("retry", 1)): + with self.subTest(verb=verb): + code, out, after = self.run_helper(verb, X86) + self.assertEqual((code, out, after), (expected, "", X86)) + self.assertEqual(self.pacman_calls(), []) + + def test_retry_moves_on_resyncs_and_upgrades_from_the_next_mirror(self): + self.run_helper("demote", IMAGE) + code, out, after = self.run_helper("retry", serves="de3.mirror") + self.assertEqual(code, 0) + self.assertEqual(out, f"{DE3}\n") + self.assertEqual(self.pacman_calls(), [(DE3, RESYNC_UPGRADE)]) + self.assertEqual(self.servers(after), [DE3, DK, DE, GEO]) + + def test_retry_tries_every_further_concrete_mirror_once(self): + self.run_helper("demote", IMAGE) + code, out, after = self.run_helper("retry") + self.assertEqual(code, PACMAN_FAILED) + self.assertEqual(out, "") + self.assertEqual( + self.pacman_calls(), [(DE3, RESYNC_UPGRADE), (DK, RESYNC_UPGRADE)] + ) + self.assertEqual(self.servers(after)[0], DK) + + def test_retry_never_lets_the_geo_host_lead(self): + self.run_helper("demote", IMAGE) + self.run_helper("retry") + leads = [lead for lead, _ in self.pacman_calls()] + self.assertTrue(leads) + self.assertNotIn(GEO, leads) + + def test_retry_never_lets_a_second_geo_line_lead(self): + code, _, _ = self.run_helper("retry", TWO_GEO) + leads = [lead for lead, _ in self.pacman_calls()] + self.assertEqual(code, PACMAN_FAILED) + self.assertEqual(leads, [DE3, DK]) + + def test_retry_keeps_pacman_output_off_stdout(self): + self.run_helper("demote", IMAGE) + _, out, _ = self.run_helper("retry", serves="dk.mirror") + self.assertEqual(out, f"{DK}\n") + + def test_retry_without_a_further_concrete_mirror_fails_untouched(self): + lines = [*HEADER, DE, GEO] + code, out, after = self.run_helper("retry", lines) + self.assertEqual((code, out, after), (1, "", lines)) + self.assertEqual(self.pacman_calls(), []) + + def test_an_unknown_verb_fails_on_any_mirrorlist(self): + for lines in (IMAGE, X86): + with self.subTest(lines=lines[-1]): + code, _, after = self.run_helper("rotate", lines) + self.assertEqual(code, 2) + self.assertEqual(after, lines) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/unit/python/roles/update/test_arch.py b/tests/unit/python/roles/update/test_arch.py new file mode 100644 index 0000000000..33ccb1c3e9 --- /dev/null +++ b/tests/unit/python/roles/update/test_arch.py @@ -0,0 +1,73 @@ +import unittest + +from utils import PROJECT_ROOT +from utils.cache.yaml import load_yaml_any + +TASKS = PROJECT_ROOT / "roles/update/tasks/arch.yml" +HELPER = "shell/alarm_mirror.sh" +DOWNLOAD_FAILED = "failed to retrieve some files" + + +def helper_verb(task): + script = task.get("ansible.builtin.script") or {} + words = (script.get("cmd", "") if isinstance(script, dict) else script).split() + return words[1] if words[:1] == [HELPER] else None + + +def index_of(tasks, match): + return next(index for index, task in enumerate(tasks) if match(task)) + + +def upgrade_block(tasks): + return next( + task + for task in tasks + if any( + (child.get("community.general.pacman") or {}).get("upgrade") + for child in task.get("block", []) + ) + ) + + +class ArchMirrorTests(unittest.TestCase): + def test_the_geo_host_is_demoted_before_the_databases_refresh(self): + tasks = load_yaml_any(str(TASKS)) + demote = index_of(tasks, lambda task: helper_verb(task) == "demote") + refresh = index_of( + tasks, + lambda task: (task.get("community.general.pacman") or {}).get( + "update_cache" + ), + ) + + self.assertLess(demote, refresh) + + def test_the_demote_decides_by_exit_code_never_by_output(self): + tasks = load_yaml_any(str(TASKS)) + demote = tasks[index_of(tasks, lambda task: helper_verb(task) == "demote")] + register = demote["register"] + + self.assertEqual(demote["changed_when"], f"{register}.rc == 3") + self.assertEqual(demote["failed_when"], f"{register}.rc not in [0, 3]") + + def test_only_a_failed_download_reaches_the_mirror_retry(self): + rescue = upgrade_block(load_yaml_any(str(TASKS)))["rescue"] + + self.assertIn("ansible.builtin.fail", rescue[0]) + self.assertIn(DOWNLOAD_FAILED, rescue[0]["when"]) + self.assertIn("not in", rescue[0]["when"]) + self.assertEqual(helper_verb(rescue[1]), "retry") + + def test_a_failure_no_mirror_retried_is_re_raised(self): + rescue = upgrade_block(load_yaml_any(str(TASKS)))["rescue"] + register = rescue[1]["register"] + + self.assertIs(rescue[1]["failed_when"], False) + self.assertIn("ansible.builtin.fail", rescue[-1]) + self.assertEqual( + rescue[-1]["when"], f"{register} is skipped or {register}.rc != 0" + ) + + +if __name__ == "__main__": + unittest.main() From d062ea3b76fc4b968600d3cca09771d3815e79a2 Mon Sep 17 00:00:00 2001 From: "infinito-nexus-updater[bot]" <286144613+infinito-nexus-updater[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 13:57:18 +0000 Subject: [PATCH 552/554] update(images): update Docker image versions (web-app-wazuh) --- roles/web-app-wazuh/meta/services.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/web-app-wazuh/meta/services.yml b/roles/web-app-wazuh/meta/services.yml index 377b0e4c2e..062cfe8377 100644 --- a/roles/web-app-wazuh/meta/services.yml +++ b/roles/web-app-wazuh/meta/services.yml @@ -75,7 +75,7 @@ certs_generator: pids_limit: 128 manager: image: wazuh/wazuh-manager - version: "4.14.10" + version: "4.14.11" name: wazuh.manager # nocheck: min-storage-headroom Reason: budgets room for wazuh-manager's own operational data (var-ossec logs, alerts, agent queue/state) to grow well beyond the base image over the service's lifetime, not just the image itself. min_storage: 10GB @@ -105,7 +105,7 @@ indexer: # nocheck: healthcheck-timing-override covers the indexer's real boot without waiting out the curl flavor's 10m default, which would otherwise stall manager/dashboard's startup order far longer than the indexer actually needs. start_period: 90s image: wazuh/wazuh-indexer - version: "4.14.10" + version: "4.14.11" name: wazuh.indexer # nocheck: min-storage-headroom Reason: budgets room for the OpenSearch index data (security events/alerts Wazuh continuously ingests) to grow well beyond the base image over the service's lifetime, not just the image itself. min_storage: 20GB @@ -123,7 +123,7 @@ indexer: http: 8102 console: image: wazuh/wazuh-dashboard - version: "4.14.10" + version: "4.14.11" name: wazuh.dashboard # nocheck: min-storage-headroom Reason: budgets room for the dashboard's own runtime state (OpenSearch Dashboards bundle/build cache rebuilt on first boot, plus exported reports and saved-object data) to grow beyond the base image, not just the image itself. min_storage: 2GB From ddd141c2e6aa11abbfeadb811f504437570c7ec4 Mon Sep 17 00:00:00 2001 From: "infinito-nexus-updater[bot]" <286144613+infinito-nexus-updater[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 14:03:56 +0000 Subject: [PATCH 553/554] update(versions): update pins with a declared source (dsk-gnt-pi) --- roles/dsk-gnt-pi/meta/services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/dsk-gnt-pi/meta/services.yml b/roles/dsk-gnt-pi/meta/services.yml index 77f36b0fb1..562ffa1535 100644 --- a/roles/dsk-gnt-pi/meta/services.yml +++ b/roles/dsk-gnt-pi/meta/services.yml @@ -9,7 +9,7 @@ pi: host: enabled: true lifecycle: alpha - npm_version: 1.6.0 + npm_version: 1.6.1 update: key: npm_version type: npm From 3bf00636e8f54a56d5edc703bfedaf30437c502b Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 25 Nov 2026 16:22:37 +0000 Subject: [PATCH 554/554] refactor(test-e2e-playwright): keep the spec secrets container check at 500 lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main 42b887e7f2 fails test_python_file_size: spec_secrets_container.py holds 501 lines since the --ulimit=core=0 option of #2925, so the Test job of every PR is red. The mount check at the end of check_container wrapped its chained comparison over three lines; binding set(mounts) once lets it fit on one, with the same semantics, so the file is back at 500 lines without moving code. Same change as IAM's b08c6594fd. (cherry picked from commit b08c6594fd) 🎯 Fix: 98 % 💥 Break: 1 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 97 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- roles/test-e2e-playwright/files/spec_secrets_container.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/roles/test-e2e-playwright/files/spec_secrets_container.py b/roles/test-e2e-playwright/files/spec_secrets_container.py index 2e5adce400..9bef582bcd 100644 --- a/roles/test-e2e-playwright/files/spec_secrets_container.py +++ b/roles/test-e2e-playwright/files/spec_secrets_container.py @@ -495,7 +495,6 @@ def check_container(container: list[str], run: Path) -> None: f"{shared / 'personas'}:/e2e/tests/personas:ro", } mounts = check_ca(container, found, stage) - if len(set(mounts)) != len(mounts) or not required <= set(mounts) <= ( - required | optional - ): + unique = set(mounts) + if len(unique) != len(mounts) or not required <= unique <= required | optional: raise SpecSecretsError("a run with spec secrets takes no other mounts")