Show the destination, result and loot in Sokko TCG Discord alerts, with a button to the expedition
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 23m48s
Validate and deploy Sokko G / deploy (push) Successful in 16s

- Each queued alert keeps an embed and a link button: the destination illustration as thumbnail, the tier, score and loot for a return, the difficulty and automatic departure for a new group.
- The button and the message link open #/cards/expeditions/<id>, which scrolls to the player's expedition or group and highlights it; Discord login now returns to that link.
- Without an https CARDS_PUBLIC_ORIGIN the link stays in the text, without button or thumbnail, which Discord would refuse.
- Delivery docs name palico-bot's NOTIFICATIONS_API_KEY and its local-only route on port 3101.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-29 11:35:15 +01:00
parent 734a3b6a8b
commit 82cebd0fd1
17 changed files with 184 additions and 37 deletions

View file

@ -58,7 +58,7 @@ test("Discord OAuth preserves the dedicated admin route", async (t) => {
const oauthCookies = authorization.headers["set-cookie"];
assert.ok(oauthCookies.some((cookie) => cookie.startsWith("sokkog_cards_oauth_return=%2Fcards%2Fadmin;")));
// Le retour après connexion accepte les sections joueur, jamais une adresse hors de Sokko TCG.
for (const [returnTo, expected] of [["/cards/shop", "%2Fcards%2Fshop"], ["/cards/admin/collections/nebula", "%2Fcards%2Fadmin%2Fcollections%2Fnebula"], ["/cards/shop/extra", "%2Fcards"], ["//evil.example/cards", "%2Fcards"], ["/cards/../toolboxes", "%2Fcards"]]) {
for (const [returnTo, expected] of [["/cards/shop", "%2Fcards%2Fshop"], ["/cards/admin/collections/nebula", "%2Fcards%2Fadmin%2Fcollections%2Fnebula"], ["/cards/shop/extra", "%2Fcards"], ["/cards/expeditions/34d49df0-2a37-4ba1-83a5-1832ed81c885", "%2Fcards%2Fexpeditions%2F34d49df0-2a37-4ba1-83a5-1832ed81c885"], ["//evil.example/cards", "%2Fcards"], ["/cards/../toolboxes", "%2Fcards"]]) {
const response = await call(handler, { path: `/api/cards/auth/discord?returnTo=${encodeURIComponent(returnTo)}` });
assert.ok(response.headers["set-cookie"].some((cookie) => cookie.startsWith(`sokkog_cards_oauth_return=${expected};`)), returnTo);
}