fix(enka): include query params in redirect cacheKey
Build and Deploy / build-and-deploy (push) Successful in 1m10s
Build and Deploy / build-and-deploy (push) Successful in 1m10s
This commit is contained in:
@@ -489,7 +489,22 @@ export function card(app: App) {
|
|||||||
async ({ params: { username }, query }) => {
|
async ({ params: { username }, query }) => {
|
||||||
const errorLoc = cardErrorLocs[query.lang === "th" ? "th" : "en"];
|
const errorLoc = cardErrorLocs[query.lang === "th" ? "th" : "en"];
|
||||||
try {
|
try {
|
||||||
const cacheKey = `enka-redir::${username}`;
|
const cacheKey = `enka-redir::${username}::${hash(
|
||||||
|
JSON.stringify(
|
||||||
|
Object.entries(query).filter(([key]) =>
|
||||||
|
[
|
||||||
|
"error",
|
||||||
|
"lang",
|
||||||
|
"debug",
|
||||||
|
"format",
|
||||||
|
"quality",
|
||||||
|
"h",
|
||||||
|
"w",
|
||||||
|
"substat",
|
||||||
|
].includes(key),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).toString(36)}`;
|
||||||
if (feature("API")) {
|
if (feature("API")) {
|
||||||
const cached = cache.get<Response>(cacheKey);
|
const cached = cache.get<Response>(cacheKey);
|
||||||
if (cached) return cached.clone();
|
if (cached) return cached.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user