From e4fac64771a52775cdf4f8703632c7d01dc89347 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sat, 11 Oct 2025 08:56:11 -0700 Subject: [PATCH] Feat: Return analytics status along with destination --- functions/api/links/get.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/api/links/get.js b/functions/api/links/get.js index 3338eaa..3db3de4 100644 --- a/functions/api/links/get.js +++ b/functions/api/links/get.js @@ -7,7 +7,10 @@ export async function onRequestGet({ request, env }) { const dest = await env.KV_EV.get(slug); if (!dest) return new Response("Link not found", { status: 404 }); - return Response.json({ destination_url: dest }); + const analytics_enabled = dest.startsWith('✺'); + const destination_url = analytics_enabled ? dest.substring(1) : dest; + + return Response.json({ destination_url, analytics_enabled }); } catch (e) { return new Response(e.message, { status: 500 }); }