@@ -1,21 +1,23 @@
1−import expiredPlanetsByStar from './expiredPlanetsByStar.json';
1+import expiredPlanetsWithInviteCodes from './expiredPlanetsWithInviteCodes.json';
2+import { deSiggedString } from './lib';
23
3−export default function useIsExpired(patp: string | null) {
4+export default function useIsExpired(
5+ patp: string | null,
6+ ticket: string | null
7+) {
48 let isExpired = false;
5− let expiredPatps: string[] = [];
69
7− for (const [_, value] of Object.entries(expiredPlanetsByStar)) {
8− const { planets } = value;
10+ if (patp !== null && ticket !== null) {
11+ const ticketPatp = deSiggedString(ticket)?.concat(
12+ '-',
13+ deSiggedString(patp)
14+ );
915
10− planets.forEach(planet => expiredPatps.push(planet.patp));
11− }
12−
13− function patpInExpiredList(patp: string): boolean {
14− return expiredPatps.includes(patp);
15− }
16+ const expired = Object.keys(expiredPlanetsWithInviteCodes).includes(
17+ ticketPatp
18+ );
1619
17− if (patp !== null) {
18− isExpired = patpInExpiredList(patp);
20+ isExpired = expired;
1921 }
2022
2123 return {