diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9055844..255bba8 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -78,14 +78,14 @@ jobs: run: for f in deploy/grafana/dashboards/*.json; do python3 -m json.tool "$f" > /dev/null; done federation-interop: - # A real GoToSocial server follows a Scrobbler user (see scripts/interop/run.sh). + # A real GoToSocial server follows a Scrobbled user (see scripts/interop/run.sh). # Not for pull requests from forks: it runs containers on the runner's Docker. if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v4 - - name: Scrobbler <-> GoToSocial + - name: Scrobbled <-> GoToSocial env: # Own compose project, network and image tags, so concurrent runs can't collide INTEROP_PROJECT: interop-${{ github.run_id }} diff --git a/README.md b/README.md index fa2d661..4d49751 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Scrobbler +# Scrobbled A self-hosted music scrobbling service. It speaks the **Last.fm (Audioscrobbler 2.0) API**, so players and scrobblers that let you set a custom Last.fm server can use it unchanged. diff --git a/deploy/grafana/dashboards/album-art.json b/deploy/grafana/dashboards/album-art.json index 9365305..fad20d8 100644 --- a/deploy/grafana/dashboards/album-art.json +++ b/deploy/grafana/dashboards/album-art.json @@ -1,6 +1,6 @@ { "uid": "scrobbler-album-art", - "title": "Scrobbler: Album Art", + "title": "Scrobbled: Album Art", "description": "Album art endpoint, background resolver and MusicBrainz / Cover Art Archive upstreams", "tags": [ "scrobbler" @@ -28,7 +28,7 @@ "scrobbler" ], "asDropdown": true, - "title": "Scrobbler", + "title": "Scrobbled", "includeVars": false } ], diff --git a/deploy/grafana/dashboards/api-overview.json b/deploy/grafana/dashboards/api-overview.json index 405c71c..f0139ed 100644 --- a/deploy/grafana/dashboards/api-overview.json +++ b/deploy/grafana/dashboards/api-overview.json @@ -1,7 +1,7 @@ { "uid": "scrobbler-api-overview", - "title": "Scrobbler: API overview", - "description": "Rate, errors and duration for every endpoint of the Scrobbler API.", + "title": "Scrobbled: API overview", + "description": "Rate, errors and duration for every endpoint of the Scrobbled API.", "tags": [ "scrobbler" ], @@ -57,7 +57,7 @@ "scrobbler" ], "asDropdown": true, - "title": "Scrobbler", + "title": "Scrobbled", "includeVars": false } ], diff --git a/deploy/grafana/dashboards/database.json b/deploy/grafana/dashboards/database.json index f439529..29aca0d 100644 --- a/deploy/grafana/dashboards/database.json +++ b/deploy/grafana/dashboards/database.json @@ -1,6 +1,6 @@ { "uid": "scrobbler-database", - "title": "Scrobbler: Database", + "title": "Scrobbled: Database", "description": "Query latency and pool use from the app's side; Postgres health from postgres-exporter.", "tags": [ "scrobbler" @@ -28,7 +28,7 @@ "scrobbler" ], "asDropdown": true, - "title": "Scrobbler", + "title": "Scrobbled", "includeVars": false } ], diff --git a/deploy/grafana/dashboards/federation.json b/deploy/grafana/dashboards/federation.json index 73af914..b7db1d4 100644 --- a/deploy/grafana/dashboards/federation.json +++ b/deploy/grafana/dashboards/federation.json @@ -1,6 +1,6 @@ { "uid": "scrobbler-federation", - "title": "Scrobbler: Federation", + "title": "Scrobbled: Federation", "description": "ActivityPub: how the fediverse finds and talks to users sharing their listening. Empty unless FEDERATION_ENABLED is on.", "tags": [ "scrobbler" @@ -28,7 +28,7 @@ "scrobbler" ], "asDropdown": true, - "title": "Scrobbler", + "title": "Scrobbled", "includeVars": false } ], diff --git a/deploy/grafana/dashboards/lastfm-api.json b/deploy/grafana/dashboards/lastfm-api.json index 8b27dd8..bdd8b20 100644 --- a/deploy/grafana/dashboards/lastfm-api.json +++ b/deploy/grafana/dashboards/lastfm-api.json @@ -1,6 +1,6 @@ { "uid": "scrobbler-lastfm", - "title": "Scrobbler: Last.fm API", + "title": "Scrobbled: Last.fm API", "description": "The Last.fm-compatible /2.0/ API: which methods clients call, what fails, and what happens to scrobbles.", "tags": [ "scrobbler" @@ -57,7 +57,7 @@ "scrobbler" ], "asDropdown": true, - "title": "Scrobbler", + "title": "Scrobbled", "includeVars": false } ], diff --git a/deploy/grafana/dashboards/usage.json b/deploy/grafana/dashboards/usage.json index 13da42d..d15b775 100644 --- a/deploy/grafana/dashboards/usage.json +++ b/deploy/grafana/dashboards/usage.json @@ -1,6 +1,6 @@ { "uid": "scrobbler-usage", - "title": "Scrobbler: Usage", + "title": "Scrobbled: Usage", "description": "Who is using the service and how much they're listening.", "tags": [ "scrobbler" @@ -28,7 +28,7 @@ "scrobbler" ], "asDropdown": true, - "title": "Scrobbler", + "title": "Scrobbled", "includeVars": false } ], diff --git a/deploy/grafana/provisioning/dashboards/dashboards.yml b/deploy/grafana/provisioning/dashboards/dashboards.yml index 6fd7be4..0cd2f28 100644 --- a/deploy/grafana/provisioning/dashboards/dashboards.yml +++ b/deploy/grafana/provisioning/dashboards/dashboards.yml @@ -1,7 +1,7 @@ apiVersion: 1 providers: - name: scrobbler - folder: Scrobbler + folder: Scrobbled type: file allowUiUpdates: true options: diff --git a/deploy/interop/docker-compose.interop.yml b/deploy/interop/docker-compose.interop.yml index 69220aa..23c5364 100644 --- a/deploy/interop/docker-compose.interop.yml +++ b/deploy/interop/docker-compose.interop.yml @@ -1,9 +1,9 @@ -# Federation interop test: Scrobbler and a real GoToSocial server on one private network. +# Federation interop test: Scrobbled and a real GoToSocial server on one private network. # # docker compose -f docker-compose.yml -f deploy/interop/docker-compose.interop.yml up -d --build # ...create the GoToSocial user (see scripts/interop/run.sh), then run the driver. # -# TEST ONLY: GoToSocial runs over plain HTTP and skips TLS verification; Scrobbler is +# TEST ONLY: GoToSocial runs over plain HTTP and skips TLS verification; Scrobbled is # served over HTTPS by a Caddy proxy with a throwaway certificate, and its "insecure # testing" switch lets it reach GoToSocial over HTTP on this private network. All on the # reserved .test domain. Never use these settings anywhere else. @@ -62,7 +62,7 @@ services: GTS_PORT: "80" GTS_DB_TYPE: sqlite GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db - GTS_HTTP_CLIENT_ALLOW_IPS: ${INTEROP_PRIVATE_RANGES:-10.0.0.0/8,172.16.0.0/12,192.168.0.0/16} # let it reach Scrobbler on this network + GTS_HTTP_CLIENT_ALLOW_IPS: ${INTEROP_PRIVATE_RANGES:-10.0.0.0/8,172.16.0.0/12,192.168.0.0/16} # let it reach Scrobbled on this network GTS_HTTP_CLIENT_TLS_INSECURE_SKIP_VERIFY: "true" # Caddy's throwaway certificate GTS_TRUSTED_PROXIES: ${INTEROP_PRIVATE_RANGES:-10.0.0.0/8,172.16.0.0/12,192.168.0.0/16} GTS_ACCOUNTS_REGISTRATION_OPEN: "false" diff --git a/deploy/prometheus/alerts.yml b/deploy/prometheus/alerts.yml index 1c70c3e..a042e8f 100644 --- a/deploy/prometheus/alerts.yml +++ b/deploy/prometheus/alerts.yml @@ -6,7 +6,7 @@ groups: for: 2m labels: {severity: critical} annotations: - summary: Scrobbler API metrics endpoint is down + summary: Scrobbled API metrics endpoint is down description: Prometheus hasn't been able to scrape {{ $labels.instance }} for 2 minutes. - alert: HighErrorRate diff --git a/docker/api.Dockerfile b/docker/api.Dockerfile index 769b12e..9ce4c7f 100644 --- a/docker/api.Dockerfile +++ b/docker/api.Dockerfile @@ -1,4 +1,4 @@ -# Scrobbler API: gunicorn serving the Flask app, metrics on :9100. +# Scrobbled API: gunicorn serving the Flask app, metrics on :9100. FROM ghcr.io/astral-sh/uv:0.7.21 AS uv FROM python:3.13-slim AS build diff --git a/docker/ui.Dockerfile b/docker/ui.Dockerfile index f26bda5..651e91f 100644 --- a/docker/ui.Dockerfile +++ b/docker/ui.Dockerfile @@ -1,4 +1,4 @@ -# Scrobbler web UI: static files served by nginx. +# Scrobbled web UI: static files served by nginx. FROM nginx:1.29-alpine LABEL org.opencontainers.image.licenses="BSD-3-Clause" ENV API_BASE_URL=http://localhost:5050 diff --git a/docs/admin-guide.md b/docs/admin-guide.md index 9f44958..6dadaf7 100644 --- a/docs/admin-guide.md +++ b/docs/admin-guide.md @@ -1,9 +1,9 @@ # Admin guide -Running a real Scrobbler instance: architecture, installation, configuration, TLS, +Running a real Scrobbled instance: architecture, installation, configuration, TLS, fediverse sharing, monitoring, backups, upgrades and troubleshooting. If you're using an instance someone else runs, see the [user guide](user-guide.md) instead. If you're -working on Scrobbler's own code, see [setup.md](setup.md). +working on Scrobbled's own code, see [setup.md](setup.md). ## Architecture @@ -25,7 +25,7 @@ Prometheus ◄── API :9100/metrics, postgres-exporter ──► Grafana - **`db`**: PostgreSQL. - With the `monitoring` profile: `prometheus`, `grafana`, `postgres-exporter`. -Everything Scrobbler needs to run is in these five services plus optional monitoring — +Everything Scrobbled needs to run is in these five services plus optional monitoring — there's no separate cache, queue or search service to operate. ## Installing @@ -42,7 +42,7 @@ Published images: `pkgs.daubney.dev/scrobbler/scrobbler-api` and `pkgs.daubney.dev/scrobbler/scrobbler-ui`, tagged `main` (latest push to `main`), `sha-`, and ``/`latest` for tagged releases. -This is enough for evaluating Scrobbler. Before putting it in front of real users, also +This is enough for evaluating Scrobbled. Before putting it in front of real users, also read **Putting it behind TLS** below — the quick start above serves plain HTTP only. ## Configuration @@ -109,7 +109,7 @@ the web UI — see the [user guide](user-guide.md#sharing-on-the-fediverse). ## Putting it behind TLS -Scrobbler itself only speaks plain HTTP; something in front of it needs to terminate +Scrobbled itself only speaks plain HTTP; something in front of it needs to terminate TLS. Any reverse proxy works — nginx, Caddy, or a tunnel like Cloudflare Tunnel for testing without a public IP (see `docs/design/activitypub-phase4.md` for how the project's own manual federation test used one). @@ -166,7 +166,7 @@ registered/active/currently-listening users. Labels never contain usernames, API track names. With `--profile monitoring`, Grafana (`GRAFANA_ADMIN_PASSWORD`) provisions a -**Scrobbler** folder with dashboards for API overview, Last.fm API, usage, database and +**Scrobbled** folder with dashboards for API overview, Last.fm API, usage, database and (with federation on) federation. Alert rules live in `deploy/prometheus/alerts.yml` — evaluated by Prometheus and visible in Grafana, but nothing routes them anywhere without Alertmanager. @@ -230,7 +230,7 @@ how to run it locally before tagging. ## Troubleshooting -**The web UI loads but can't reach the API ("Can't reach the Scrobbler API at …" or +**The web UI loads but can't reach the API ("Can't reach the Scrobbled API at …" or requests failing silently).** Almost always `CORS_ORIGINS` on the `api` service not listing the exact origin the browser loads the UI from (scheme and host both have to match — `https://scrobble.example` is not the same origin as `http://scrobble.example` @@ -269,10 +269,10 @@ curl -H 'Accept: application/jrd+json' \ ``` If that's correct, the fix is time (or trying a smaller/different instance to confirm -it's not a Scrobbler-side problem) — there's nothing to change on the server. +it's not a Scrobbled-side problem) — there's nothing to change on the server. **A legacy scrobbler client (e.g. VLC's built-in scrobbler) fails to connect at all.** -Scrobbler implements the Last.fm 2.0 API only, not the legacy 1.2 Audioscrobbler +Scrobbled implements the Last.fm 2.0 API only, not the legacy 1.2 Audioscrobbler handshake (`hs=true&p=1.2&...`). Clients that only speak 1.2 can't be pointed at -Scrobbler regardless of configuration — point users at a client with 2.0 support +Scrobbled regardless of configuration — point users at a client with 2.0 support instead. \ No newline at end of file diff --git a/docs/design/activitypub-phase2.md b/docs/design/activitypub-phase2.md index eb219e9..1b0b2a9 100644 --- a/docs/design/activitypub-phase2.md +++ b/docs/design/activitypub-phase2.md @@ -5,12 +5,12 @@ Where this differed from the plan: - **httpcore instead of httpx.** httpcore is the transport layer underneath httpx, and it publicly supports the custom network backend that connecting to a pre-checked address needs. -- **No in-process test with two Scrobbler instances.** Scrobbler can't initiate follows yet, so one instance has nothing to send the other. Scripted remote accounts over real HTTP cover the same paths, and GoToSocial is the real second server. +- **No in-process test with two Scrobbled instances.** Scrobbled can't initiate follows yet, so one instance has nothing to send the other. Scripted remote accounts over real HTTP cover the same paths, and GoToSocial is the real second server. - **Undo of a Block.** Unblocking needed it: GoToSocial otherwise keeps the block. This implements phase 2 of [activitypub.md](activitypub.md), building on [phase 1](activitypub-phase1.md). -**Outcome:** people on Mastodon, GoToSocial and similar servers can follow a user who shares. Follows are accepted automatically, or wait for the user's approval if they've turned it on. The user sees their followers and can approve, decline, remove or block them. Scrobbler signs everything it sends and checks the signature on everything it receives. Posts come in phase 3; this phase makes the relationship work end to end. +**Outcome:** people on Mastodon, GoToSocial and similar servers can follow a user who shares. Follows are accepted automatically, or wait for the user's approval if they've turned it on. The user sees their followers and can approve, decline, remove or block them. Scrobbled signs everything it sends and checks the signature on everything it receives. Posts come in phase 3; this phase makes the relationship work end to end. Everything below is inside `scrobbler.federation`, and the boundary tests keep holding. Federation off still means nothing is registered. @@ -56,7 +56,7 @@ Everything below is inside `scrobbler.federation`, and the boundary tests keep h - At most 3 redirects, each checked the same way. - Response bodies are capped at 1 MB. - Timeouts: 10s to connect and 20s to read. - - A `User-Agent` of `Scrobbler/ (+)`. + - A `User-Agent` of `Scrobbled/ (+)`. - `signed_get(url, as_actor)`, which signs with the instance actor by default so "authorized fetch" servers answer; and `signed_post(inbox, activity, as_user)`. - **`FEDERATION_INSECURE_TESTING=1`** is **for automated tests only**. It allows `http://` and private addresses. It's refused unless the domain ends in `.test` (a reserved top-level domain) and logs a warning every minute while on. It exists so CI can federate with GoToSocial on a private Docker network. - **`remote.py`**: the remote-actor cache. @@ -178,12 +178,12 @@ Everything below is inside `scrobbler.federation`, and the boundary tests keep h - bad signatures rejected with the right reason - a blocked domain - turning sharing off -- **A real peer in CI**: a new `federation-interop` job runs Scrobbler (API, worker and UI) and a GoToSocial container on one Docker network. The hosts are `scrobble.test` and `gts.test`, over HTTP, with each side's test-only settings. A script: +- **A real peer in CI**: a new `federation-interop` job runs Scrobbled (API, worker and UI) and a GoToSocial container on one Docker network. The hosts are `scrobble.test` and `gts.test`, over HTTP, with each side's test-only settings. A script: 1. creates a GoToSocial user with its admin CLI, 2. gets a user token by driving GoToSocial's sign-in and OAuth screens with plain HTTP (this part gets a short spike first, since GoToSocial has no password grant), 3. follows `@alice@scrobble.test`, and checks it's accepted, 4. unfollows, and checks it's gone, - 5. with manual approval on, checks the request waits until approved through Scrobbler's API. + 5. with manual approval on, checks the request waits until approved through Scrobbled's API. The job posts to ntfy like every other job. It doesn't run on pull requests from forks. - **Manual pass before merging**: follow and unfollow from a real Mastodon account through a tunnel. @@ -210,5 +210,5 @@ Everything below is inside `scrobbler.federation`, and the boundary tests keep h - **Licences**: - `httpx` is BSD-3-Clause and `cryptography` is Apache-2.0/BSD. - - GoToSocial is AGPL, but it runs only as a separate container in CI to test against. Nothing of it is linked into, or shipped with, Scrobbler, so it has no effect on Scrobbler's licence. + - GoToSocial is AGPL, but it runs only as a separate container in CI to test against. Nothing of it is linked into, or shipped with, Scrobbled, so it has no effect on Scrobbled's licence. - **Scale**: this is the biggest phase, and signatures plus safe outbound HTTP are where the risk lies. They come first and have the most thorough tests. diff --git a/docs/design/activitypub-phase3.md b/docs/design/activitypub-phase3.md index 3285cd1..30b69c5 100644 --- a/docs/design/activitypub-phase3.md +++ b/docs/design/activitypub-phase3.md @@ -46,7 +46,7 @@ Everything is in `scrobbler.federation` except one small addition to the core st - `id`, `attributedTo`, `content` (HTML) plus `contentMap` (`{"en": …}`) - `published`, `url` (the UI post page) - `to` and `cc` from the visibility setting - - `tag` (`Hashtag` objects: `#Scrobbler`, and `#NowPlaying` in phase 4) + - `tag` (`Hashtag` objects: `#Scrobbled`, and `#NowPlaying` in phase 4) - `sensitive: false` - **`create(...)`**: `Create` wrapping the Note, with the same addressing. - **`delete(...)`**: `Delete` whose object is a `Tombstone` of the Note (the same shape Mastodon sends). @@ -85,7 +85,7 @@ Everything is in `scrobbler.federation` except one small addition to the core st > **My week in music: 312 plays** > Top artists: 1. Radiohead (48) 2. Björk (31) 3. Portishead (22) > Most played: *Reckoner* by Radiohead (12 plays) - > #Scrobbler + > #Scrobbled **Milestones** (`publishing/milestones.py`, worker task `federation.milestones`): @@ -99,7 +99,7 @@ Everything is in `scrobbler.federation` except one small addition to the core st - **No retroactive posts:** - When a user **turns sharing on**, every threshold they've already passed is marked `posted=false`. - When an **import finishes** (`import_finished`), the same happens: imported history moves the baseline silently. Imported plays therefore never trigger milestone posts, even if a live scrobble crosses a line soon after. -- Example: *"10,000 plays on Scrobbler 🎉"* or *"Björk just joined my all-time top 10 (at #7)"*. +- Example: *"10,000 plays on Scrobbled 🎉"* or *"Björk just joined my all-time top 10 (at #7)"*. ## 6. Endpoints (served on the UI domain, documented in OpenAPI) @@ -188,5 +188,5 @@ Everything is in `scrobbler.federation` except one small addition to the core st | Milestone thresholds | Plays: 1k, 5k, 10k, then every 25k. An artist's plays: 100, 500, 1k. New artist in the all-time top 10 | | Posts per milestone check | At most one (the most notable) | | Post language | English only for now (`contentMap.en`) | -| Hashtag | `#Scrobbler` on every post | +| Hashtag | `#Scrobbled` on every post | | Deleting individual posts | Allowed, from the web UI | diff --git a/docs/design/activitypub-phase4.md b/docs/design/activitypub-phase4.md index ccef145..fae813d 100644 --- a/docs/design/activitypub-phase4.md +++ b/docs/design/activitypub-phase4.md @@ -26,7 +26,7 @@ Everything is in `scrobbler.federation`, using the core's existing `services.scr ## 1. Settings and data (migration on the `federation` branch) - **`federation_settings` gains `now_playing_mode`**: `off` (default), `profile`, or `posts`. Validated the same way `visibility` is. -- **`federation_now_playing`**, one row per user, the state of what Scrobbler has last told the fediverse (as opposed to `now_playing` in core, which is what's actually playing): +- **`federation_now_playing`**, one row per user, the state of what Scrobbled has last told the fediverse (as opposed to `now_playing` in core, which is what's actually playing): - `profile_key` (nullable) and `profile_updated_at` (nullable): what the last `Update(Person)` said, and when it was sent - `post_key` (nullable) and `post_posted_at` (nullable): the key of the last now-playing post, and when @@ -36,7 +36,7 @@ Everything is in `scrobbler.federation`, using the core's existing `services.scr - **`update(activity_id, actor_id, actor_object)`**: wraps a document as an `Update`, addressed the same way `undo()` already does (mirrors its shape). - **`person(...)` already takes `fields`** (phase 1): a "Now playing" field is just one more `(name, value)` pair, `"Track by Artist"`. -- Now-playing posts reuse the existing `note()`/`create()` builders from phase 3, tagged `#NowPlaying` in addition to `#Scrobbler` (already anticipated in the phase 3 plan's vocabulary notes). +- Now-playing posts reuse the existing `note()`/`create()` builders from phase 3, tagged `#NowPlaying` in addition to `#Scrobbled` (already anticipated in the phase 3 plan's vocabulary notes). ## 3. Live actor vs. pushed updates @@ -114,4 +114,4 @@ No event receiver, no pending-checks queue: unlike milestones, now playing doesn | Minimum played before a post | 30 seconds | | Deleting the previous now-playing post | Always, when a new one goes out | | Worker poll interval | 30 seconds | -| Hashtags | `#Scrobbler` and `#NowPlaying` | +| Hashtags | `#Scrobbled` and `#NowPlaying` | diff --git a/docs/design/activitypub.md b/docs/design/activitypub.md index 9ae59ff..47cd48f 100644 --- a/docs/design/activitypub.md +++ b/docs/design/activitypub.md @@ -4,17 +4,17 @@ Status: **proposal, for review.** Nothing here is built yet. The decisions still ## Summary -Let a user turn their Scrobbler account into a fediverse account, for example `@alice@scrobble.example`, that people on Mastodon, GoToSocial, Misskey and similar servers can follow. Followers see three kinds of post: +Let a user turn their Scrobbled account into a fediverse account, for example `@alice@scrobble.example`, that people on Mastodon, GoToSocial, Misskey and similar servers can follow. Followers see three kinds of post: - a **weekly listening summary** - **milestones** (for example "10,000th scrobble") - **what the user is playing now** -The first version is **outbound only**: Scrobbler publishes, and it accepts and manages followers. Following other people and showing their listening in the UI is a possible later phase (see [Later](#later-following-and-listen-activities)). The data model is designed so it can be added without rework. +The first version is **outbound only**: Scrobbled publishes, and it accepts and manages followers. Following other people and showing their listening in the UI is a possible later phase (see [Later](#later-following-and-listen-activities)). The data model is designed so it can be added without rework. Federation is **off for everyone until they turn it on**. Until then a user can't be found by WebFinger and nothing about them is published. -**Decided:** we write the protocol layer ourselves, on `cryptography` plus the Flask, SQLAlchemy and worker setup we already have (about 1,500 lines, in the four phases below). Scrobbler is BSD-licensed, and the ready-made Python library is AGPL (see [Build or buy](#build-or-buy)). +**Decided:** we write the protocol layer ourselves, on `cryptography` plus the Flask, SQLAlchemy and worker setup we already have (about 1,500 lines, in the four phases below). Scrobbled is BSD-licensed, and the ready-made Python library is AGPL (see [Build or buy](#build-or-buy)). All of it lives in **one self-contained package, `scrobbler.federation`**, behind a narrow interface. It can then be changed, replaced or switched off without touching the rest of the app, and changes to the specs (signature schemes, vocabulary, FEPs) stay inside it. See [Module structure](#module-structure). @@ -35,7 +35,7 @@ All of it lives in **one self-contained package, `scrobbler.federation`**, behin ## How it fits the current system ``` -Mastodon, GoToSocial, … Scrobbler +Mastodon, GoToSocial, … Scrobbled ──────────────────────────────────────────────────────────────────────────── GET /.well-known/webfinger?resource=acct:… ─► API (only for opted-in users) GET /users/alice (Accept: activity+json) ─► API actor document @@ -53,7 +53,7 @@ POST /users/alice/inbox or /inbox ─► API verify signature, reco ## Module structure -Everything to do with ActivityPub lives in `src/scrobbler/federation/`. The rest of Scrobbler knows only two things about it: how to switch it on, and a handful of domain events. Replacing the implementation (with another library, or a rewrite when the specs move on) means replacing this package; nothing else changes. +Everything to do with ActivityPub lives in `src/scrobbler/federation/`. The rest of Scrobbled knows only two things about it: how to switch it on, and a handful of domain events. Replacing the implementation (with another library, or a rewrite when the specs move on) means replacing this package; nothing else changes. ``` src/scrobbler/ @@ -222,7 +222,7 @@ Serve `/.well-known/nodeinfo` and `/nodeinfo/2.1`, giving the software name `scr ## What gets posted -Posts are `Note` objects inside `Create` activities: Mastodon shows `Note` as a normal status, while other types are squashed into a title and link. The HTML uses only tags Mastodon keeps (`p`, `a`, `br`, `strong`, `em`, `ul`, `ol`, `li`), and all track and artist text is escaped. Each post also gets hashtags (`#NowPlaying`, `#Scrobbler`) as `Hashtag` tags. Visibility follows the user's setting, which defaults to **followers only**: +Posts are `Note` objects inside `Create` activities: Mastodon shows `Note` as a normal status, while other types are squashed into a title and link. The HTML uses only tags Mastodon keeps (`p`, `a`, `br`, `strong`, `em`, `ul`, `ol`, `li`), and all track and artist text is escaped. Each post also gets hashtags (`#NowPlaying`, `#Scrobbled`) as `Hashtag` tags. Visibility follows the user's setting, which defaults to **followers only**: | Setting | `to` | `cc` | |---|---|---| @@ -248,7 +248,7 @@ Example: > **This week: 312 scrobbles** > Top artists: 1. Radiohead (48) 2. Björk (31) 3. Portishead (22) > Top track: *Reckoner* by Radiohead (12 plays) -> #Scrobbler +> #Scrobbled ### Milestones @@ -279,7 +279,7 @@ A new post for every track would flood followers' timelines. There are two optio | Maturity | New code, but the scope is narrow | Active, but young (0.3.x, one maintainer) | The most complete framework | | Effort | About 1,500 lines, mostly signatures, inbox and delivery | Less code, but we'd adapt its storage and flow to ours | A new service to run and monitor | -**Decided: write it ourselves.** Scrobbler is BSD-3-Clause licensed. Using Pubby inside the app would make the running program subject to the AGPL, which defeats the point of a permissive licence. Fedify is excellent, but it would split the backend across two languages. The protocol surface we need is small (four activity types in and three out), so writing it ourselves is the least total cost. It also keeps ActivityPub on the same metrics, dashboards and tests as everything else, and it can all live in the one replaceable module described above. +**Decided: write it ourselves.** Scrobbled is BSD-3-Clause licensed. Using Pubby inside the app would make the running program subject to the AGPL, which defeats the point of a permissive licence. Fedify is excellent, but it would split the backend across two languages. The protocol surface we need is small (four activity types in and three out), so writing it ourselves is the least total cost. It also keeps ActivityPub on the same metrics, dashboards and tests as everything else, and it can all live in the one replaceable module described above. New dependency: `cryptography` (Apache-2.0 or BSD), for keys and signatures. @@ -335,8 +335,8 @@ Everything goes on the existing Prometheus and Grafana setup: - inbox state transitions - delivery retry schedule - visibility addressing -- **In-process federation**: two Scrobbler instances in one test process following each other. -- **A real peer in CI**: a [GoToSocial](https://gotosocial.org) container, which is a single binary with SQLite. It follows a Scrobbler user and we assert that it receives the `Accept` and the posts. That's much lighter than running Mastodon in CI. +- **In-process federation**: two Scrobbled instances in one test process following each other. +- **A real peer in CI**: a [GoToSocial](https://gotosocial.org) container, which is a single binary with SQLite. It follows a Scrobbled user and we assert that it receives the `Accept` and the posts. That's much lighter than running Mastodon in CI. - **Manual pass before release** (done, over a `cloudflared` tunnel - see [phase 4](activitypub-phase4.md)): - follow from a real Mastodon account - check the profile, posts, profile-field updates and unfollowing @@ -363,8 +363,8 @@ Each phase can be released on its own, with its migration, docs, OpenAPI updates This is the "profiles plus friends' listening" option, deliberately left out of v1: -- Users follow other Scrobbler users, or any actor that publishes listens, and see a friends feed in the UI. -- **Wire format**: ActivityStreams has a `Listen` activity type. Funkwhale already federates `Listen` activities whose object is a `Track`. We'd send the same thing to followers on Scrobbler and Funkwhale servers only. Mastodon ignores activity types it doesn't know, and a stream of `Listen`s isn't something people want in their timelines anyway. +- Users follow other Scrobbled users, or any actor that publishes listens, and see a friends feed in the UI. +- **Wire format**: ActivityStreams has a `Listen` activity type. Funkwhale already federates `Listen` activities whose object is a `Track`. We'd send the same thing to followers on Scrobbled and Funkwhale servers only. Mastodon ignores activity types it doesn't know, and a stream of `Listen`s isn't something people want in their timelines anyway. - **Changes needed**: an outbound `Follow` flow, storing received listens, a feed UI, and moderation of incoming content. - **Account migration** (`Move` and `alsoKnownAs`) would come with this, so users can change handle or domain without losing followers. diff --git a/docs/openapi.json b/docs/openapi.json index bec1d92..f7fd2d8 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -1,7 +1,7 @@ { "info": { "description": "Two APIs: `/2.0/` is Last.fm (Audioscrobbler 2.0) compatible, for players and scrobblers; `/api/v1/` is the JSON API used by the web UI.", - "title": "Scrobbler API", + "title": "Scrobbled API", "version": "v1" }, "paths": { diff --git a/docs/setup.md b/docs/setup.md index 684aa74..c8746fd 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -1,4 +1,4 @@ -# Working on Scrobbler +# Working on Scrobbled Setting up a local development environment. For running a real instance, see the [admin guide](admin-guide.md). For what the service does, see the @@ -67,7 +67,7 @@ route is missing its bearer-auth declaration. - `uv run python scripts/generate_traffic.py --minutes 5` — sends a realistic mix of scrobbles and errors, so the Grafana dashboards have something to show. -- `scripts/interop/run.sh` — runs Scrobbler against a real GoToSocial server on a private +- `scripts/interop/run.sh` — runs Scrobbled against a real GoToSocial server on a private network and checks the whole federation follow/post/now-playing life cycle end to end. CI runs this on every push; run it locally the same way before changing anything in `scrobbler.federation`. diff --git a/docs/user-guide.md b/docs/user-guide.md index ef0bd2e..005cea9 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -1,6 +1,6 @@ # User guide -What Scrobbler does once you're signed in: connecting a player, importing your old +What Scrobbled does once you're signed in: connecting a player, importing your old history, and sharing your listening on the fediverse. If you're setting up or running an instance rather than using one, see the [admin guide](admin-guide.md) instead. @@ -18,7 +18,7 @@ In the player's scrobbling settings, choose a custom or self-hosted Last.fm serv - **API URL**: `https://your-host/2.0/` - **API key and shared secret**: from an app on the **Apps** page -- **Username and password**: your Scrobbler account +- **Username and password**: your Scrobbled account Two sign-in flows are supported, and most players use one or the other automatically: diff --git a/frontend/approve.html b/frontend/approve.html index c5f24c6..1bf8984 100644 --- a/frontend/approve.html +++ b/frontend/approve.html @@ -3,7 +3,7 @@ - Allow access · Scrobbler + Allow access · Scrobbled diff --git a/frontend/apps.html b/frontend/apps.html index 7dbb1c9..c44d85f 100644 --- a/frontend/apps.html +++ b/frontend/apps.html @@ -3,7 +3,7 @@ - Apps · Scrobbler + Apps · Scrobbled diff --git a/frontend/art.html b/frontend/art.html index 811b542..38ad2b9 100644 --- a/frontend/art.html +++ b/frontend/art.html @@ -3,7 +3,7 @@ - Album art · Scrobbler + Album art · Scrobbled diff --git a/frontend/config.js b/frontend/config.js index 947a840..9e67eb4 100644 --- a/frontend/config.js +++ b/frontend/config.js @@ -1,4 +1,4 @@ -// Where the Scrobbler API lives. The UI container rewrites this file from the +// Where the Scrobbled API lives. The UI container rewrites this file from the // API_BASE_URL environment variable at start-up; edit it by hand otherwise. window.SCROBBLER_CONFIG = { apiBaseUrl: "http://localhost:5050", diff --git a/frontend/followers.html b/frontend/followers.html index 8b931f7..78dbbb6 100644 --- a/frontend/followers.html +++ b/frontend/followers.html @@ -3,7 +3,7 @@ - Followers · Scrobbler + Followers · Scrobbled diff --git a/frontend/history.html b/frontend/history.html index 2d4a10c..e6f9625 100644 --- a/frontend/history.html +++ b/frontend/history.html @@ -3,7 +3,7 @@ - History · Scrobbler + History · Scrobbled diff --git a/frontend/import.html b/frontend/import.html index d3466ed..eb3c74b 100644 --- a/frontend/import.html +++ b/frontend/import.html @@ -3,7 +3,7 @@ - Import · Scrobbler + Import · Scrobbled diff --git a/frontend/index.html b/frontend/index.html index dcbe65d..3dfcc31 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,7 +3,7 @@ - Overview · Scrobbler + Overview · Scrobbled diff --git a/frontend/js/api.js b/frontend/js/api.js index 2104516..3cffed9 100644 --- a/frontend/js/api.js +++ b/frontend/js/api.js @@ -1,4 +1,4 @@ -// Thin client for the Scrobbler /api/v1 JSON API. +// Thin client for the Scrobbled /api/v1 JSON API. const TOKEN_KEY = "scrobbler.token"; @@ -77,7 +77,7 @@ export async function api(path, { method = "GET", body, auth = true } = {}) { body: body === undefined ? undefined : JSON.stringify(body), }); } catch { - throw new ApiError(0, "network", `Can't reach the Scrobbler API at ${apiBase}. Check that it's running.`); + throw new ApiError(0, "network", `Can't reach the Scrobbled API at ${apiBase}. Check that it's running.`); } if (response.status === 401 && auth) { @@ -122,7 +122,7 @@ export function upload(path, formData, onProgress, method = "POST") { if (event.lengthComputable) onProgress?.(event.loaded / event.total); }); xhr.addEventListener("error", () => - reject(new ApiError(0, "network", `Can't reach the Scrobbler API at ${apiBase}. Check that it's running.`)), + reject(new ApiError(0, "network", `Can't reach the Scrobbled API at ${apiBase}. Check that it's running.`)), ); xhr.addEventListener("load", () => { let data = null; diff --git a/frontend/js/apps.js b/frontend/js/apps.js index e6e8a8c..891427c 100644 --- a/frontend/js/apps.js +++ b/frontend/js/apps.js @@ -113,7 +113,7 @@ function renderSetup() { h("dt", {}, "Username"), h("dd", {}, h("code", {}, user.username)), h("dt", {}, "Password"), - h("dd", {}, "Your Scrobbler password"), + h("dd", {}, "Your Scrobbled password"), h("dt", {}, "Key and secret"), h("dd", {}, "From one of the apps above"), h("dt", {}, "API reference"), diff --git a/frontend/js/layout.js b/frontend/js/layout.js index 2e5deb1..138cbf4 100644 --- a/frontend/js/layout.js +++ b/frontend/js/layout.js @@ -38,7 +38,7 @@ export function publicPage() { } function brand() { - return h("a", { class: "brand", href: "index.html" }, h("span", { class: "brand-mark", "aria-hidden": "true" }), "Scrobbler"); + return h("a", { class: "brand", href: "index.html" }, h("span", { class: "brand-mark", "aria-hidden": "true" }), "Scrobbled"); } function nav(active) { diff --git a/frontend/js/post.js b/frontend/js/post.js index 930e91c..269a2c3 100644 --- a/frontend/js/post.js +++ b/frontend/js/post.js @@ -15,7 +15,7 @@ try { `/federation/profiles/${encodeURIComponent(username)}/posts/${encodeURIComponent(postId)}`, { auth: false }, ); - document.title = `${post.display_name} · Scrobbler`; + document.title = `${post.display_name} · Scrobbled`; replace( root, h( diff --git a/frontend/js/profile.js b/frontend/js/profile.js index 31a4456..0823439 100644 --- a/frontend/js/profile.js +++ b/frontend/js/profile.js @@ -10,7 +10,7 @@ publicPage(); try { const profile = await api(`/federation/profiles/${encodeURIComponent(username)}`, { auth: false }); - document.title = `${profile.display_name} · Scrobbler`; + document.title = `${profile.display_name} · Scrobbled`; const copy = h("button", { type: "button", class: "button button-quiet" }, "Copy handle"); copy.addEventListener("click", async () => { try { diff --git a/frontend/js/song.js b/frontend/js/song.js index 2debcf6..e0545d9 100644 --- a/frontend/js/song.js +++ b/frontend/js/song.js @@ -36,7 +36,7 @@ if (!artist || !track) { } function render(result) { - document.title = `${result.track} · Scrobbler`; + document.title = `${result.track} · Scrobbled`; const m = result.metadata; const body = h( diff --git a/frontend/login.html b/frontend/login.html index 73f7175..28a5065 100644 --- a/frontend/login.html +++ b/frontend/login.html @@ -3,7 +3,7 @@ - Sign in · Scrobbler + Sign in · Scrobbled diff --git a/frontend/post.html b/frontend/post.html index 9feb410..4fd99f0 100644 --- a/frontend/post.html +++ b/frontend/post.html @@ -3,7 +3,7 @@ - Post · Scrobbler + Post · Scrobbled diff --git a/frontend/posts.html b/frontend/posts.html index 1248c40..80df17f 100644 --- a/frontend/posts.html +++ b/frontend/posts.html @@ -3,7 +3,7 @@ - Posts · Scrobbler + Posts · Scrobbled diff --git a/frontend/profile.html b/frontend/profile.html index 45b4bd7..7a7d912 100644 --- a/frontend/profile.html +++ b/frontend/profile.html @@ -3,7 +3,7 @@ - Profile · Scrobbler + Profile · Scrobbled diff --git a/frontend/register.html b/frontend/register.html index 55f782f..7eaf173 100644 --- a/frontend/register.html +++ b/frontend/register.html @@ -3,7 +3,7 @@ - Create an account · Scrobbler + Create an account · Scrobbled diff --git a/frontend/sessions.html b/frontend/sessions.html index 8c7fa9e..3be6ae4 100644 --- a/frontend/sessions.html +++ b/frontend/sessions.html @@ -3,7 +3,7 @@ - Sessions · Scrobbler + Sessions · Scrobbled @@ -17,7 +17,7 @@

Sessions

-

Players you've signed in to Scrobbler. Revoking one signs it out straight away; it has to sign in again before it can scrobble.

+

Players you've signed in to Scrobbled. Revoking one signs it out straight away; it has to sign in again before it can scrobble.

    diff --git a/frontend/sharing.html b/frontend/sharing.html index 10b08b9..eb668c2 100644 --- a/frontend/sharing.html +++ b/frontend/sharing.html @@ -3,7 +3,7 @@ - Sharing · Scrobbler + Sharing · Scrobbled diff --git a/frontend/site.webmanifest b/frontend/site.webmanifest index 5d8aba3..6496861 100644 --- a/frontend/site.webmanifest +++ b/frontend/site.webmanifest @@ -1,6 +1,6 @@ { - "name": "Scrobbler", - "short_name": "Scrobbler", + "name": "Scrobbled", + "short_name": "Scrobbled", "icons": [ { "src": "icon-192.png", diff --git a/frontend/song.html b/frontend/song.html index 462652d..506105d 100644 --- a/frontend/song.html +++ b/frontend/song.html @@ -3,7 +3,7 @@ - Song · Scrobbler + Song · Scrobbled diff --git a/scripts/generate_traffic.py b/scripts/generate_traffic.py index 3c786a2..143ac1c 100644 --- a/scripts/generate_traffic.py +++ b/scripts/generate_traffic.py @@ -1,4 +1,4 @@ -"""Send realistic traffic to a running Scrobbler, e.g. to see the Grafana dashboards move. +"""Send realistic traffic to a running Scrobbled, e.g. to see the Grafana dashboards move. uv run python scripts/generate_traffic.py --api http://localhost:5050 --minutes 5 diff --git a/scripts/interop/compose.sh b/scripts/interop/compose.sh index 73a7de9..0cf783c 100755 --- a/scripts/interop/compose.sh +++ b/scripts/interop/compose.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# docker compose for the federation interop stack (Scrobbler + GoToSocial). +# docker compose for the federation interop stack (Scrobbled + GoToSocial). set -euo pipefail root="$(cd "$(dirname "$0")/../.." && pwd)" # INTEROP_PROJECT (with a distinct SCROBBLER_IMAGE_TAG) lets concurrent runs (e.g. in CI) stay apart. diff --git a/scripts/interop/gotosocial_interop.py b/scripts/interop/gotosocial_interop.py index 1de4fcd..a214dbe 100644 --- a/scripts/interop/gotosocial_interop.py +++ b/scripts/interop/gotosocial_interop.py @@ -1,4 +1,4 @@ -"""Federation interop test: a real GoToSocial account follows a Scrobbler user. +"""Federation interop test: a real GoToSocial account follows a Scrobbled user. Runs inside the interop compose network (see deploy/interop/). Standard library only. Exits non-zero, with a description, on the first thing that doesn't work. @@ -164,7 +164,7 @@ def wait_for(description, check, timeout=60): fail(f"timed out waiting for: {description}") -class Scrobbler: +class Scrobbled: def __init__(self, username="alice", password="interop-password-1"): status, body = api( "POST", @@ -185,7 +185,7 @@ class Scrobbler: }, ) if status not in (200, 201): - fail(f"signing in to Scrobbler: {status} {body}") + fail(f"signing in to Scrobbled: {status} {body}") self.token = body["token"] def settings(self, **changes): @@ -193,7 +193,7 @@ class Scrobbler: "PATCH", f"{SCROBBLER_API}/federation/settings", self.token, body=changes ) if status != 200: - fail(f"changing Scrobbler settings: {status} {body}") + fail(f"changing Scrobbled settings: {status} {body}") return body def followers(self, state=None): @@ -275,8 +275,8 @@ def main(): step("Getting a GoToSocial access token") gts = GoToSocial(gotosocial_token()) - step("Alice starts sharing on Scrobbler") - alice = Scrobbler() + step("Alice starts sharing on Scrobbled") + alice = Scrobbled() alice.settings( enabled=True, display_name="Alice Interop", @@ -294,14 +294,14 @@ def main(): step("Follow: GoToSocial sees it accepted (our signed Accept verified)") gts.follow(account_id) wait_for("GoToSocial to be following", lambda: gts.relationship(account_id)["following"]) - followers = wait_for("Scrobbler to list the follower", lambda: alice.followers("accepted")) - print(f" Scrobbler follower: {followers[0]['handle']}") + followers = wait_for("Scrobbled to list the follower", lambda: alice.followers("accepted")) + print(f" Scrobbled follower: {followers[0]['handle']}") if followers[0]["handle"] != "@gtsuser@gts.test": fail(f"unexpected follower {followers[0]['handle']}") - step("Unfollow: Scrobbler drops the follower (their signed Undo verified)") + step("Unfollow: Scrobbled drops the follower (their signed Undo verified)") gts.unfollow(account_id) - wait_for("Scrobbler to drop the follower", lambda: not alice.followers()) + wait_for("Scrobbled to drop the follower", lambda: not alice.followers()) step("Manual approval: the follow waits as a request") alice.settings(manually_approves_followers=True) @@ -309,7 +309,7 @@ def main(): wait_for( "GoToSocial to show a pending request", lambda: gts.relationship(account_id)["requested"] ) - pending = wait_for("Scrobbler to list the request", lambda: alice.followers("pending")) + pending = wait_for("Scrobbled to list the request", lambda: alice.followers("pending")) if gts.relationship(account_id)["following"]: fail("following before being approved") @@ -317,7 +317,7 @@ def main(): alice.act(pending[0]["id"], "approve") wait_for("GoToSocial to be following", lambda: gts.relationship(account_id)["following"]) - step("Remove the follower: Scrobbler drops them and sends a Reject") + step("Remove the follower: Scrobbled drops them and sends a Reject") alice.act(alice.followers()[0]["id"], "remove") if alice.followers(): fail("the follower is still listed after removal") @@ -338,7 +338,7 @@ def main(): step("Block a follower: GoToSocial drops the follow (it honours Block)") gts.follow(account_id) - pending = wait_for("Scrobbler to list the request", lambda: alice.followers("pending")) + pending = wait_for("Scrobbled to list the request", lambda: alice.followers("pending")) alice.act(pending[0]["id"], "approve") wait_for("GoToSocial to be following", lambda: gts.relationship(account_id)["following"]) alice.act(alice.followers()[0]["id"], "block") @@ -358,7 +358,7 @@ def main(): step("Decline a request: GoToSocial's request is withdrawn") gts.follow(account_id) - pending = wait_for("Scrobbler to list the request", lambda: alice.followers("pending")) + pending = wait_for("Scrobbled to list the request", lambda: alice.followers("pending")) alice.act(pending[0]["id"], "decline") wait_for( "GoToSocial's request to go away", @@ -385,7 +385,7 @@ def check_posts(): profile field GoToSocial has cached is updated by the periodic push.""" step("Getting a GoToSocial access token") gts = GoToSocial(gotosocial_token()) - alice = Scrobbler() # register-or-login: the same account main() set up + alice = Scrobbled() # register-or-login: the same account main() set up account = gts.resolve("@alice@scrobble.test") account_id = account["id"] if not gts.relationship(account_id)["following"]: diff --git a/scripts/interop/run.sh b/scripts/interop/run.sh index 3f5fce6..f5ebb62 100755 --- a/scripts/interop/run.sh +++ b/scripts/interop/run.sh @@ -17,7 +17,7 @@ cleanup() { trap cleanup EXIT "$compose" down -v --remove-orphans >/dev/null 2>&1 -echo "==> Building and starting Scrobbler + GoToSocial" +echo "==> Building and starting Scrobbled + GoToSocial" "$compose" up -d --build --wait db api ui worker tls gotosocial || { "$compose" ps; exit 1; } echo "==> Waiting for GoToSocial" @@ -32,7 +32,7 @@ echo "==> Creating the GoToSocial test user" "$compose" exec -T gotosocial /gotosocial/gotosocial admin account confirm --username gtsuser >/dev/null diagnose() { - echo "==> Scrobbler federation state" + echo "==> Scrobbled federation state" "$compose" exec -T db psql -U scrobbler -d scrobbler -c \ "select activity_type, status, reason, attempts from federation_inbox order by id" -c \ "select a.activity_type, d.status, d.attempts, d.last_status, left(d.last_error, 200) as error diff --git a/src/scrobbler/config.py b/src/scrobbler/config.py index 1f3f2f5..8d52d16 100644 --- a/src/scrobbler/config.py +++ b/src/scrobbler/config.py @@ -29,7 +29,7 @@ class Config: START_METRICS_SERVER = os.environ.get("START_METRICS_SERVER", "0") == "1" # OpenAPI document and docs (flask-smorest) - API_TITLE = "Scrobbler API" + API_TITLE = "Scrobbled API" API_VERSION = "v1" OPENAPI_VERSION = "3.1.0" OPENAPI_URL_PREFIX = "/api" diff --git a/src/scrobbler/federation/README.md b/src/scrobbler/federation/README.md index 911f771..6c13bf3 100644 --- a/src/scrobbler/federation/README.md +++ b/src/scrobbler/federation/README.md @@ -112,7 +112,7 @@ for users with it on, every 30 seconds). All are registered only when federation ## Interop -`scripts/interop/run.sh` runs Scrobbler against a real GoToSocial server on a private +`scripts/interop/run.sh` runs Scrobbled against a real GoToSocial server on a private `.test` network. `scripts/interop/gotosocial_interop.py` checks the whole follow life cycle, then `run.sh` seeds a scrobble and a now-playing track, runs `flask federation post-weekly --now` directly in the `api` container, and runs the diff --git a/src/scrobbler/federation/__init__.py b/src/scrobbler/federation/__init__.py index 5eedd3f..bc74ae3 100644 --- a/src/scrobbler/federation/__init__.py +++ b/src/scrobbler/federation/__init__.py @@ -1,6 +1,6 @@ """ActivityPub federation: optional, self-contained, replaceable. -The rest of Scrobbler only calls `init_app(app)` (from `create_app`) and sends domain +The rest of Scrobbled only calls `init_app(app)` (from `create_app`) and sends domain events (`scrobbler.events`). Everything else about federation lives in this package; see README.md here and docs/design/activitypub.md. diff --git a/src/scrobbler/federation/outbound.py b/src/scrobbler/federation/outbound.py index d6cb576..357b13a 100644 --- a/src/scrobbler/federation/outbound.py +++ b/src/scrobbler/federation/outbound.py @@ -19,7 +19,7 @@ def client() -> Client: config = current_app.extensions["federation"] existing = Client( - user_agent=f"Scrobbler/{__version__} (+{config.base_url})", + user_agent=f"Scrobbled/{__version__} (+{config.base_url})", insecure_testing=config.insecure_testing, ) current_app.extensions["federation_client"] = existing diff --git a/src/scrobbler/federation/protocol/__init__.py b/src/scrobbler/federation/protocol/__init__.py index e76b2cb..82c2c29 100644 --- a/src/scrobbler/federation/protocol/__init__.py +++ b/src/scrobbler/federation/protocol/__init__.py @@ -2,6 +2,6 @@ NodeInfo documents, HTTP signature schemes. Rule: nothing in this package imports Flask, SQLAlchemy, Werkzeug or any other part of -Scrobbler; only the standard library and `cryptography`. Spec changes land here and are +Scrobbled; only the standard library and `cryptography`. Spec changes land here and are tested with spec test vectors alone. (Enforced by tests/test_federation_boundary.py.) """ diff --git a/src/scrobbler/federation/protocol/content.py b/src/scrobbler/federation/protocol/content.py index ec27501..eeefb25 100644 --- a/src/scrobbler/federation/protocol/content.py +++ b/src/scrobbler/federation/protocol/content.py @@ -7,7 +7,7 @@ line of a post is its own paragraph. import html -HASHTAG = "Scrobbler" +HASHTAG = "Scrobbled" def escape(text: str) -> str: diff --git a/src/scrobbler/federation/protocol/vocab.py b/src/scrobbler/federation/protocol/vocab.py index ff77353..ed2a7f4 100644 --- a/src/scrobbler/federation/protocol/vocab.py +++ b/src/scrobbler/federation/protocol/vocab.py @@ -235,7 +235,7 @@ def update(activity_id: str, actor_id: str, obj: dict, *, to: list[str]) -> dict def hashtag(name: str) -> dict: - """A Hashtag tag, e.g. #Scrobbler. No href: we don't serve tag pages, and Mastodon + """A Hashtag tag, e.g. #Scrobbled. No href: we don't serve tag pages, and Mastodon still recognises and indexes the tag from `name` alone.""" return {"type": "Hashtag", "name": f"#{name}"} diff --git a/src/scrobbler/federation/publishing/base.py b/src/scrobbler/federation/publishing/base.py index 4b60e23..dd20be8 100644 --- a/src/scrobbler/federation/publishing/base.py +++ b/src/scrobbler/federation/publishing/base.py @@ -18,7 +18,7 @@ from scrobbler.federation import metrics as fed_metrics from scrobbler.federation.models import FederationActivity, FederationPost from scrobbler.federation.protocol import addressing, vocab -DEFAULT_TAGS = ("Scrobbler",) +DEFAULT_TAGS = ("Scrobbled",) OUTBOX_PAGE_SIZE = 20 LISTED_VISIBILITIES = ("public", "unlisted") # followers-only posts aren't listed unauthenticated diff --git a/src/scrobbler/federation/publishing/now_playing.py b/src/scrobbler/federation/publishing/now_playing.py index 3052af3..86873ab 100644 --- a/src/scrobbler/federation/publishing/now_playing.py +++ b/src/scrobbler/federation/publishing/now_playing.py @@ -108,7 +108,7 @@ def _post_now_playing(user, playing, key: str, state: FederationNowPlaying, now: key, text=text, html=html, - tags=("Scrobbler", "NowPlaying"), + tags=("Scrobbled", "NowPlaying"), attachment=_attachment_for(playing), ) if post is None: diff --git a/src/scrobbler/services/art.py b/src/scrobbler/services/art.py index 856e924..bd7c3d7 100644 --- a/src/scrobbler/services/art.py +++ b/src/scrobbler/services/art.py @@ -86,7 +86,7 @@ def _user_agent() -> str: from scrobbler import __version__ contact = current_app.config["MUSICBRAINZ_CONTACT"] - return f"Scrobbler/{__version__} ( {contact} )" + return f"Scrobbled/{__version__} ( {contact} )" _last_musicbrainz_call = 0.0 diff --git a/tests/test_federation_content.py b/tests/test_federation_content.py index 13af7dc..68d27a1 100644 --- a/tests/test_federation_content.py +++ b/tests/test_federation_content.py @@ -79,18 +79,18 @@ def test_build_content_shape(): "My week in music: 312 plays", "Top artists: 1. Radiohead (48) 2. Björk (31) 3. Portishead (22)", "Most played: Reckoner by Radiohead (12 plays)", - "#Scrobbler", + "#Scrobbled", ] assert html.startswith("

    My week in music: 312 plays

    ") assert "
    1. Radiohead" in html assert "Reckoner by Radiohead" in html - assert html.endswith("

      #Scrobbler

      ") + assert html.endswith("

      #Scrobbled

      ") assert "" not in html # no top-artists list when there isn't one assert "Most played" not in html diff --git a/tests/test_federation_net_remote.py b/tests/test_federation_net_remote.py index 854e898..567c023 100644 --- a/tests/test_federation_net_remote.py +++ b/tests/test_federation_net_remote.py @@ -66,7 +66,7 @@ def test_urls_with_credentials_are_refused(): @pytest.fixture def local_client(): - client = Client("Scrobbler/test", insecure_testing=True) + client = Client("Scrobbled/test", insecure_testing=True) yield client client.close() @@ -74,7 +74,7 @@ def local_client(): def test_get_json_and_user_agent(local_client, remote): remote.routes["/doc"] = (200, {}, {"id": "x"}) assert local_client.get_json(remote.url("/doc")) == {"id": "x"} - assert remote.requests[0]["headers"]["User-Agent"] == "Scrobbler/test" + assert remote.requests[0]["headers"]["User-Agent"] == "Scrobbled/test" assert "application/activity+json" in remote.requests[0]["headers"]["Accept"] diff --git a/tests/test_federation_now_playing.py b/tests/test_federation_now_playing.py index 6d6f47c..a60202a 100644 --- a/tests/test_federation_now_playing.py +++ b/tests/test_federation_now_playing.py @@ -151,7 +151,7 @@ def test_post_sent_after_30_seconds(fed_ctx, posting_user): activity = db.session.get(FederationActivity, post.activity_id) assert activity.activity_type == "Create" assert activity.document["object"]["tag"] == [ - {"type": "Hashtag", "name": "#Scrobbler"}, + {"type": "Hashtag", "name": "#Scrobbled"}, {"type": "Hashtag", "name": "#NowPlaying"}, ] diff --git a/tests/test_federation_protocol.py b/tests/test_federation_protocol.py index 6b6508d..7c709ad 100644 --- a/tests/test_federation_protocol.py +++ b/tests/test_federation_protocol.py @@ -160,7 +160,7 @@ def test_is_public_or_unlisted(): def test_hashtag(): - assert vocab.hashtag("Scrobbler") == {"type": "Hashtag", "name": "#Scrobbler"} + assert vocab.hashtag("Scrobbled") == {"type": "Hashtag", "name": "#Scrobbled"} def test_note(): @@ -172,14 +172,14 @@ def test_note(): url=f"{BASE}/post.html?id=1", to=["FOLLOWERS"], cc=[], - tags=["Scrobbler"], + tags=["Scrobbled"], ) assert doc["type"] == "Note" assert doc["attributedTo"] == f"{BASE}/users/alice" assert doc["content"] == "

      Hello

      " assert doc["contentMap"] == {"en": "

      Hello

      "} assert (doc["to"], doc["cc"]) == (["FOLLOWERS"], []) - assert doc["tag"] == [{"type": "Hashtag", "name": "#Scrobbler"}] + assert doc["tag"] == [{"type": "Hashtag", "name": "#Scrobbled"}] assert doc["sensitive"] is False assert "@context" not in doc # carried by the wrapping Create instead assert "attachment" not in doc # omitted entirely, not an empty list, when there's none diff --git a/tests/test_federation_publishing.py b/tests/test_federation_publishing.py index cea45ac..ee30101 100644 --- a/tests/test_federation_publishing.py +++ b/tests/test_federation_publishing.py @@ -50,7 +50,7 @@ def test_publish_creates_a_post_and_a_create_activity(fed_ctx, user, metric_delt assert activity.document["object"]["type"] == "Note" assert activity.document["object"]["content"] == "

      312 plays

      " assert activity.document["object"]["contentMap"] == {"en": "

      312 plays

      "} - assert activity.document["object"]["tag"] == [{"type": "Hashtag", "name": "#Scrobbler"}] + assert activity.document["object"]["tag"] == [{"type": "Hashtag", "name": "#Scrobbled"}] assert activity.public is False # followers-only, the default diff --git a/tests/test_pylast_compat.py b/tests/test_pylast_compat.py index eeba5c5..a695b31 100644 --- a/tests/test_pylast_compat.py +++ b/tests/test_pylast_compat.py @@ -60,7 +60,7 @@ def https_server(app, tls_files): @pytest.fixture def network(https_server, api_app): return pylast._Network( - name="Scrobbler", + name="Scrobbled", homepage=f"https://{https_server}", ws_server=(https_server, "/2.0/"), api_key=api_app.api_key,