fix #custom2?years=2

This commit is contained in:
rustdesk
2026-05-06 19:37:13 +08:00
parent 90cd58340c
commit 4a9c17e0f5
2 changed files with 16 additions and 3 deletions
@@ -182,6 +182,22 @@ import { UI } from 'astrowind:config';
function loadPrice() { function loadPrice() {
if (!document.getElementById('users')) return; 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 users = 10;
let devices = 100; let devices = 100;
window.submit = function () { window.submit = function () {
-3
View File
@@ -392,9 +392,6 @@ const defaultCurrency = 'USD';
try { try {
var parsed = new URL(String(url), location.origin); var parsed = new URL(String(url), location.origin);
if (parsed.pathname.startsWith(CHECKOUT_PATH)) { 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 = { var pending = {
url: parsed.toString(), url: parsed.toString(),
target: target, target: target,