From 4fe11e124ab09c9d29b43e96ee10838150e38cf8 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 15 Jun 2026 12:08:56 -0300 Subject: [PATCH] fix: use server code from webhook response for location select value The stats webhook now returns a 'code' field (e.g. 'fr', 'usa') alongside the display 'server' name. The option value now uses s.code and falls back to slugified server name for backward compat. --- add.html | 3 ++- assets/js/script.js | 3 ++- data/youtube-scan.json | 13 +++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 data/youtube-scan.json 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 diff --git a/data/youtube-scan.json b/data/youtube-scan.json new file mode 100644 index 0000000..6313e4a --- /dev/null +++ b/data/youtube-scan.json @@ -0,0 +1,13 @@ +{ + "scan_date": "2026-06-15", + "latest_videos": [ + { + "title": "I Connected my Hermes Agent to Odoo in 10 Minutes — Here's How", + "url": "https://www.youtube.com/watch?v=Gx-XiCJAt8g", + "published": "2026-06-14" + } + ], + "new_since_last": 1, + "channel_url": "https://www.youtube.com/@derez_ai", + "note": "First scan — no prior baseline to compare against. One video found on the channel." +} \ No newline at end of file