feat(codes): mark a code dead once the owner confirms it in game
Game8 still lists Y1INABQB6DEX, 2BJ64QRZ7RT8 and PLDXIB886Y1S as active Genshin codes after the game refused them. CODE_CHECKS records the owner's in-game check; build-codes stamps the matching code confirmedDead, and the Codes tab shows it expired: "Confirmed expired in game, 2026-10-20." Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7569aa6395
commit
b8e8d44816
12 files changed
+178
-12
No files matched your search
@@ -69,13 +69,15 @@ export function CodesPage({
|
||||
</button>
|
||||
{c.reward && <p>{c.reward}</p>}
|
||||
<small>
|
||||
{codeExpired(c, now)
|
||||
? "Expired"
|
||||
: c.expiresAt
|
||||
? `Expires ${formatInZone(c.expiresAt, true, typeof state.prefs.timezone === "string" ? state.prefs.timezone : null)}`
|
||||
: c.expiresOn
|
||||
? `Expires on ${c.expiresOn} (time not stated)`
|
||||
: "Expiry not announced"}{" "}
|
||||
{c.confirmedDead
|
||||
? `Confirmed expired in game, ${c.confirmedDead}.`
|
||||
: codeExpired(c, now)
|
||||
? "Expired"
|
||||
: c.expiresAt
|
||||
? `Expires ${formatInZone(c.expiresAt, true, typeof state.prefs.timezone === "string" ? state.prefs.timezone : null)}`
|
||||
: c.expiresOn
|
||||
? `Expires on ${c.expiresOn} (time not stated)`
|
||||
: "Expiry not announced"}{" "}
|
||||
·{" "}
|
||||
<a href={c.sourceUrl} target="_blank" rel="noreferrer">
|
||||
Source
|
||||
|
||||
@@ -11,9 +11,11 @@ export function newCodes(
|
||||
* Whether a code's stated expiry has passed. A date with no time ("Expires on
|
||||
* 2026-10-20") counts as passed only once that date has ended everywhere, at
|
||||
* 12:00 UTC the next day, so a code is never shown expired while it may
|
||||
* still redeem somewhere.
|
||||
* still redeem somewhere. A code the owner confirmed dead in game is expired
|
||||
* whatever it states.
|
||||
*/
|
||||
export function codeExpired(code: RedeemCode, now: number): boolean {
|
||||
if (code.confirmedDead) return true;
|
||||
if (code.expiresAt) return Date.parse(code.expiresAt) <= now;
|
||||
if (code.expiresOn)
|
||||
return Date.parse(`${code.expiresOn}T00:00:00Z`) + 36 * 3600_000 <= now;
|
||||
|
||||
Reference in new issue
Block a user