Yokan / rebuild
Course 1 8624561

DISCORD_PRESENCE.md

docs/features/DISCORD_PRESENCE.md

documentation / design asset55 lines
1# Discord presence23Settings live on **Settings → Discord**. The legacy switches (`enableDiscordRpc`,4`hideDiscordRpcInIncognito`, `rpcShow*`) stay on `DbSettings`; everything new is in5`DbSettings.features.discord`. Defaults keep the previous presence text, buttons and6timestamp.78## Transports910| Platform | Transport | Login |11|---|---|---|12| Android, iOS | Discord gateway websocket with the active account | In-app Discord login page, or a pasted token |13| Web | Discord gateway websocket with the active account | Pasted token (a page cannot read discord.com storage) |14| Desktop | Local Discord client IPC socket when no account is active; the gateway when one is | Pasted token (JavaFX WebKit cannot finish Discord's captcha login) |1516- The shared `GatewayDiscordRpcService` (`services/discord`) holds one websocket per active17  token, identifies, heartbeats and re-sends the latest presence after every reconnect.18  Close codes 4004/4010–4014 stop retries and ask the user to log in again.19- Covers are uploaded through Discord's `external-assets` endpoint and shown as `mp:` media20  proxy images. If that call fails (for example a browser blocking the cross-origin request),21  the presence is sent without an image.22- Presence lives while the app process is running. There is no foreground service; Android may23  drop the socket in deep sleep and it reconnects on the next update.24- Animetail's pinned build uses Discord's proprietary Social SDK, which needs a partner-approved25  application and native binaries. Yokan uses the gateway approach Animetail used before26  (KizzyRPC). Discord does not officially allow automating user accounts; the add-account dialog27  says so. Tokens are the user's own; no upstream credentials ship with Yokan.2829## Accounts3031- Several accounts can be stored; exactly one is active (radio button). Removing the active one32  activates the next. Re-adding the same Discord user replaces its token.33- The account name comes from `/users/@me`. When that is unreachable (offline, browser CORS),34  the user id is decoded from the token. A 401 rejects the token.35- Tokens are installation-local: `features` is never synced or overwritten by a restore, and36  backups strip `discord.accounts` (`DbDiscordPreferences.forExport`). `toString` never prints37  tokens.3839## Presence content4041`discordActivity()` builds one transport-neutral activity from the settings:4243- **Custom message** replaces "Reading/Watching <title>" (and "Idle").44- **Show progress / title / cover** keep their previous meaning.45- **Show elapsed time** sends the session start timestamp.46- **Show buttons** with up to two user-defined label/URL buttons (default: the previous47  "Get Yokan" and "Join us").48- **Online status** (online/idle/do not disturb) is sent on the gateway. The desktop IPC socket49  cannot change the user's status.5051## Privacy5253- Global incognito with "Hide RPC in incognito" publishes nothing (as before).54- "Never show titles" and **private categories** (including Uncategorized) replace the title55  with the idle activity: no title, cover or progress reaches Discord.56

Search chapters, reference and source filenames.