From 58cff0616816e19e473763066a1864960908ea3e Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 15 Jun 2026 12:22:47 -0300 Subject: [PATCH] fix: use s.code as location select value, fall back to slugified name The server webhook will soon return a 'code' field (e.g. 'fr', 'usa') alongside the display 'server' name. Use it as the option value so the payment webhook receives the correct location code. Falls back to the old slugified server name when code is absent (e.g. current live API). --- add.html | 3 ++- assets/js/script.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/add.html b/add.html index 3087a2e..6e6ee54 100644 --- a/add.html +++ b/add.html @@ -564,10 +564,11 @@ } servers.forEach(function(s) { const server = s.server || ''; + const serverCode = s.code || server.toLowerCase().replace(/\s+/g, '-'); const available = parseInt(s['Seats Available'], 10) || 0; const label = server.charAt(0).toUpperCase() + server.slice(1); const opt = document.createElement('option'); - opt.value = server.toLowerCase().replace(/\s+/g, '-'); + opt.value = serverCode; if (available <= 0) { opt.textContent = label + ' (sold out)'; opt.disabled = true; diff --git a/assets/js/script.js b/assets/js/script.js index 597239e..55495cc 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -669,10 +669,11 @@ async function initServerLocations() { servers.forEach(function (s) { const server = s.server || ""; + const serverCode = s.code || server.toLowerCase().replace(/\s+/g, "-"); const available = parseInt(s["Seats Available"], 10) || 0; const label = server.charAt(0).toUpperCase() + server.slice(1); const opt = document.createElement("option"); - opt.value = server.toLowerCase().replace(/\s+/g, "-"); + opt.value = serverCode; if (available <= 0) { // No seats — red, disabled, cannot select