This commit is contained in:
@@ -151,7 +151,18 @@ export function card(app: App) {
|
|||||||
|
|
||||||
if (debug) return { data };
|
if (debug) return { data };
|
||||||
|
|
||||||
return ListPage(
|
const cacheKey = hash(
|
||||||
|
JSON.stringify({
|
||||||
|
data,
|
||||||
|
lang,
|
||||||
|
}),
|
||||||
|
).toString(36);
|
||||||
|
if (feature("API")) {
|
||||||
|
const cached = cache.get<ImageResponse>(cacheKey);
|
||||||
|
if (cached) return cached.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await ListPage(
|
||||||
data,
|
data,
|
||||||
pfps[`${data.playerInfo.profilePicture.id ?? 1}`]?.IconPath,
|
pfps[`${data.playerInfo.profilePicture.id ?? 1}`]?.IconPath,
|
||||||
namecards[`${data.playerInfo.nameCardId ?? 210001}`]?.Icon,
|
namecards[`${data.playerInfo.nameCardId ?? 210001}`]?.Icon,
|
||||||
@@ -160,6 +171,12 @@ export function card(app: App) {
|
|||||||
locs[lang ?? "en"],
|
locs[lang ?? "en"],
|
||||||
log,
|
log,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
queueMicrotask(() => {
|
||||||
|
cache.set(cacheKey, res, 1000 * 60 * 60 * 24); // cache for 24 hour
|
||||||
|
});
|
||||||
|
|
||||||
|
return res.clone();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof InvalidFormatError)
|
if (err instanceof InvalidFormatError)
|
||||||
return error(400, errorLoc.uidFormat);
|
return error(400, errorLoc.uidFormat);
|
||||||
|
|||||||
Reference in New Issue
Block a user