fix: forward query params through redirect
Build and Deploy / build-and-deploy (push) Successful in 1m38s
Build and Deploy / build-and-deploy (push) Successful in 1m38s
This commit is contained in:
@@ -486,8 +486,8 @@ export function card(app: App) {
|
||||
)
|
||||
.get(
|
||||
"/enka/:username",
|
||||
async ({ params: { username }, query: { lang } }) => {
|
||||
const errorLoc = cardErrorLocs[lang === "th" ? "th" : "en"];
|
||||
async ({ params: { username }, query }) => {
|
||||
const errorLoc = cardErrorLocs[query.lang === "th" ? "th" : "en"];
|
||||
try {
|
||||
const cacheKey = `enka-redir::${username}`;
|
||||
if (feature("API")) {
|
||||
@@ -540,7 +540,7 @@ export function card(app: App) {
|
||||
if (!builds?.id) return status(404, errorLoc.buildNotFound);
|
||||
|
||||
const res = redirect(
|
||||
`/v1/card/enka/${username}/${hoyo.hash}/${builds.char}/${builds.id}`,
|
||||
`/v1/card/enka/${username}/${hoyo.hash}/${builds.char}/${builds.id}${new URLSearchParams(query as Record<string, string>)}`,
|
||||
);
|
||||
queueMicrotask(async () => {
|
||||
cache.set(cacheKey, res, 1000 * 60); // cache for 1 minute
|
||||
@@ -559,11 +559,7 @@ export function card(app: App) {
|
||||
}
|
||||
},
|
||||
{
|
||||
query: t.Partial(
|
||||
t.Object({
|
||||
lang: Locale,
|
||||
}),
|
||||
),
|
||||
query: characterCardQuery,
|
||||
},
|
||||
)
|
||||
.get(
|
||||
|
||||
Reference in New Issue
Block a user