From 4a9c17e0f5c5ff73416ad883022f6e0103368456 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Wed, 6 May 2026 19:37:13 +0800 Subject: [PATCH] fix #custom2?years=2 --- v3/src/components/common/BasicScripts.astro | 16 ++++++++++++++++ v3/src/components/widgets/Pricing.astro | 3 --- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/v3/src/components/common/BasicScripts.astro b/v3/src/components/common/BasicScripts.astro index f7570e30..bc1f27f1 100644 --- a/v3/src/components/common/BasicScripts.astro +++ b/v3/src/components/common/BasicScripts.astro @@ -182,6 +182,22 @@ import { UI } from 'astrowind:config'; function loadPrice() { if (!document.getElementById('users')) return; + // Migrate params from hash (e.g. #custom2?years=3) into the real query string + // so gotoBuy/buildCheckoutUrl can forward them to checkout. + if (window.location.hash.indexOf('?') >= 0) { + const hash = window.location.hash; + const qIdx = hash.indexOf('?'); + const hashAnchor = hash.slice(0, qIdx); + const hashQuery = hash.slice(qIdx + 1); + if (hashQuery) { + const existing = new URLSearchParams(window.location.search); + new URLSearchParams(hashQuery).forEach((v, k) => { + if (!existing.has(k)) existing.append(k, v); + }); + const qs = existing.toString(); + history.replaceState(null, '', window.location.pathname + (qs ? '?' + qs : '') + hashAnchor); + } + } let users = 10; let devices = 100; window.submit = function () { diff --git a/v3/src/components/widgets/Pricing.astro b/v3/src/components/widgets/Pricing.astro index 3384d9a9..6263511a 100644 --- a/v3/src/components/widgets/Pricing.astro +++ b/v3/src/components/widgets/Pricing.astro @@ -392,9 +392,6 @@ const defaultCurrency = 'USD'; try { var parsed = new URL(String(url), location.origin); if (parsed.pathname.startsWith(CHECKOUT_PATH)) { - new URLSearchParams(location.search).forEach(function (v, k) { - if (!parsed.searchParams.has(k)) parsed.searchParams.append(k, v); - }); var pending = { url: parsed.toString(), target: target,