Discord: "Connect a Discord server" OAuth UI (server-26#225 S7)
- /discord/connected: Discord's OAuth redirect target. Stashes code/state
in sessionStorage, strips them from the URL (replaceState), no-referrer
(metadata + response header), sends a signed-out user to
/login?next=/discord/connected and resumes, access_denied = "Nothing
changed", result card "Linked X: N ready, M need a fix".
- middleware.ts: the callback path joins NO_SESSION_COOKIE_GATE (plan
finding 2). Also needed for signed-in users: drb_session is
SameSite=Strict, so it is not sent on the cross-site redirect back from
discord.com.
- /login honours ?next= for an allowlist of one path (no open redirect).
- DiscordServersCard: Connect is the primary action with a radio-bot
picker (automatic / the bot for a system / the org's own bots); the
/drb link code moves to a collapsed secondary option and opens itself
when /discord/oauth/start answers 404.
- RadioBotsPanel: write-only client-secret field per bot (PUT/DELETE
/tokens/{id}/oauth), "Connect on/off", "N of 100 servers" with the
pool cap (90) warning.
- lib/discordOAuth.ts: the S6 client, kept out of c2api.ts; only ever
navigates to a discord.com /oauth2/authorize URL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e54191a5d0
commit
dd3e5c9655
@@ -27,6 +27,9 @@ export interface RadioBot {
|
||||
in_use?: boolean;
|
||||
assigned_node_id?: string | null;
|
||||
preferred_for_system_id?: string | null;
|
||||
/** "Connect a Discord server" is on for this bot: its OAuth client secret is
|
||||
* set server-side (server-26#225 S6). The secret itself is never sent. */
|
||||
oauth_enabled?: boolean | null;
|
||||
}
|
||||
|
||||
export interface RadioBotAddResult {
|
||||
@@ -93,9 +96,16 @@ export interface DiscordAdminOverview {
|
||||
node_max_streams: number;
|
||||
unlinked_guild_org_id: string | null;
|
||||
unlinked_guild_org_name: string | null;
|
||||
/** Connect stops picking a DRB pool bot at this many servers (owner ruling Q3). */
|
||||
pool_bot_guild_cap?: number;
|
||||
};
|
||||
}
|
||||
|
||||
/** Discord's hard limit for an unverified bot. */
|
||||
export const DISCORD_UNVERIFIED_GUILD_LIMIT = 100;
|
||||
/** settings.discord_pool_bot_guild_cap's default — used when the overview doesn't send it. */
|
||||
export const POOL_BOT_GUILD_CAP = 90;
|
||||
|
||||
/** A desired-on channel that has not reached "connected" for this long turns red. */
|
||||
export const STUCK_AFTER_MS = 2 * 60 * 1000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user