From 10f88c4223e89b38f085703a58be030d75d59ceb Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sun, 11 Aug 2024 19:06:38 +0800 Subject: [PATCH] Minor fix --- routes/api/shared_token.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/routes/api/shared_token.ts b/routes/api/shared_token.ts index 792ed15..dba1ed4 100644 --- a/routes/api/shared_token.ts +++ b/routes/api/shared_token.ts @@ -52,10 +52,14 @@ export const handler: Handlers = { flutter_base = m.cfg.flutter_frontend; } const existed = await exists(flutter_base); - const base = existed - ? `${get_host(req)}/flutter` - : "https://dev.ehf.lifegpc.com/#"; - const url = `${base}/gallery/${gid}?share=${st.token}`; + const host = get_host(req); + const base = host + existed ? "/flutter" : "/api"; + const token = encodeURIComponent(st.token); + const url = existed + ? `${base}/gallery/${gid}?share=${token}` + : `https://dev.ehf.lifegpc.com/#/gallery/${gid}?base=${ + encodeURIComponent(base) + }&share=${token}`; return return_data({ url, token: st }, 201); } else { return return_error(1, "Unknown type");