feat: the extension adds Discord channels to an artist you pick, and its tests gate the XPI (milestone 429)
CI and images / lint (push) Successful in 2s
CI and images / extension-version (push) Successful in 2s
CI and images / extension-test (push) Successful in 20s
CI and images / frontend-build (push) Successful in 24s
CI and images / backend-lint-and-test (push) Successful in 32s
CI and images / integration (push) Successful in 2m22s
CI and images / build-agent (push) Successful in 5s
CI and images / sign-extension (push) Successful in 3m13s
CI and images / build-web (push) Successful in 1m42s
CI and images / smoke-web (push) Successful in 54s
CI and images / promote (push) Successful in 1s
CI and images / lint (push) Successful in 2s
CI and images / extension-version (push) Successful in 2s
CI and images / extension-test (push) Successful in 20s
CI and images / frontend-build (push) Successful in 24s
CI and images / backend-lint-and-test (push) Successful in 32s
CI and images / integration (push) Successful in 2m22s
CI and images / build-agent (push) Successful in 5s
CI and images / sign-extension (push) Successful in 3m13s
CI and images / build-web (push) Successful in 1m42s
CI and images / smoke-web (push) Successful in 54s
CI and images / promote (push) Successful in 1s
Server (#4420) - extension_service gains a Discord pattern (server or channel, jump links, ptb/canary; not DMs or threads), mirrored in platforms.js and pinned by the shared artist-url-samples.json. - probe on a Discord URL matches the source by ids under any artist, reports a whole-server source as covering the channel, suggests the artist who owns another source on the same server, and names server/channel via the stored token (best-effort, bounded, no rate-limit waits). - quick-add takes artist_id / artist_name; Discord URLs are stored canonical. Extension (#4421, #4422) - Content script on discord.com; SPA navigation by URL polling (the old pushState patch ran in the isolated world and never fired); stale probes are dropped. - Discord chip opens an Add panel: this channel or the whole server, and the suggested artist / a search / a new name. - Popup: sources show artist, platform and state; a Discord token export is verified by FC and the result shown. Token capture covers ptb/canary. - Pure logic in lib/chip.js and lib/popup-format.js, with specs. CI (#4423) - extension.yml's lane (web-ext lint, vitest, XPI contents) moves into build.yml as extension-test and joins the needs of sign-extension, build-web and build-agent. As a separate workflow it gated nothing: a red extension suite still signed and shipped the XPI (rule 177). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVjrnpQjRgHdvq95rASoiR
This commit is contained in:
@@ -57,7 +57,8 @@ const PLATFORMS = {
|
||||
domains: ['.discord.com', 'discord.com'],
|
||||
authType: 'token',
|
||||
color: '#5865F2',
|
||||
urlPattern: /^https?:\/\/(www\.)?discord\.com/,
|
||||
// ptb/canary are Discord's beta clients — same channels, same token.
|
||||
urlPattern: /^https?:\/\/((www|ptb|canary)\.)?discord\.com/,
|
||||
note: 'Open Discord in browser to capture token',
|
||||
},
|
||||
};
|
||||
@@ -80,8 +81,23 @@ const PLATFORM_ARTIST_PATTERNS = {
|
||||
patreon: /^https?:\/\/(www\.)?patreon\.com\/(?:cw\/|c\/)?(?!(?:home|search|messages|notifications|library|settings|posts)(?:[\/?#]|$))[^/?#]+/i,
|
||||
subscribestar: /^https?:\/\/(www\.)?subscribestar\.(com|adult)\/(?!feed$|messages$|library$)[^/?#]+\/?$/i,
|
||||
hentaifoundry: /^https?:\/\/(www\.)?hentai-foundry\.com\/user\/[^/?#]+/i,
|
||||
// A Discord URL names a server or channel, not a creator: the backend's slug
|
||||
// is `<server>[/<channel>]` and the Add panel asks which artist it belongs
|
||||
// to. A message jump link still names its channel; DMs (@me) and thread
|
||||
// links don't match. Mirrors extension_service._PLATFORM_PATTERNS.
|
||||
discord: /^https?:\/\/(?:www\.|ptb\.|canary\.)?discord\.com\/channels\/\d+(?:\/\d+)?(?:\/\d+)?\/?(?:[?#].*)?$/i,
|
||||
};
|
||||
|
||||
/**
|
||||
* `{serverId, channelId}` from a Discord channel/server URL the artist
|
||||
* pattern accepts, else null. channelId is null for a whole-server URL.
|
||||
*/
|
||||
function parseDiscordUrl(url) {
|
||||
if (!PLATFORM_ARTIST_PATTERNS.discord.test(url || '')) return null;
|
||||
const m = /\/channels\/(\d+)(?:\/(\d+))?/.exec(url);
|
||||
return m ? { serverId: m[1], channelId: m[2] || null } : null;
|
||||
}
|
||||
|
||||
function getPlatformFromUrl(url) {
|
||||
for (const [key, platform] of Object.entries(PLATFORMS)) {
|
||||
if (platform.urlPattern.test(url)) return key;
|
||||
|
||||
Reference in New Issue
Block a user