From ec2bbad4a22e85c6b54833a6a590fad0243192a0 Mon Sep 17 00:00:00 2001 From: MOHAN Date: Thu, 11 Jun 2026 13:19:12 +0530 Subject: [PATCH] feat: replace hardcoded free-access shop with API check Loader now calls GET /free-access/:shop on the backend instead of comparing against a hardcoded shop domain. This lets the admin panel control which shops get free access without frontend deploys. Co-Authored-By: Claude Sonnet 4.6 --- app/routes/app._index.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/routes/app._index.jsx b/app/routes/app._index.jsx index 46ca969..1b8368c 100644 --- a/app/routes/app._index.jsx +++ b/app/routes/app._index.jsx @@ -81,7 +81,15 @@ export const loader = async ({ request }) => { currencyCode: recurringPricing?.price?.currencyCode || "USD", } : null; - if (shop === "racewerksengg.myshopify.com") { + // Check server-side free-access whitelist + let hasFreeAccess = false; + try { + const far = await fetch(`https://backend.data4autos.com/free-access/${encodeURIComponent(shop)}`); + const fad = await far.json(); + hasFreeAccess = fad.allowed === true; + } catch {} + + if (hasFreeAccess) { return json({ redirectToBilling: false, shop, isSubscribed: true, subscription: subscriptionDetails, allSubscriptions: subscriptions }); }