From 483026fd07834437a3d0e370414b06ea2291ef44 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Sat, 6 Jun 2026 11:13:45 +0000 Subject: [PATCH] Pass saved alias to platform on launch; copy to clipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - platforms table gets url_alias_param column (configurable per platform) - Admin game form has new "Username URL Param" field — leave blank if platform doesn't support it, or set to e.g. "username" if it does - Platform cards now use onclick openPlatform() instead of plain href: copies player's saved alias to clipboard on every click, and if url_alias_param is set appends ?param=alias to the launch URL - Toast notification confirms "Alias copied — paste into login" Co-Authored-By: Claude Sonnet 4.6 --- admin/index.php | 14 +++++--- api/platforms.php | 88 ++++++++++++++++++++++++----------------------- index.php | 26 ++++++++++++-- 3 files changed, 79 insertions(+), 49 deletions(-) diff --git a/admin/index.php b/admin/index.php index 0e14c4d..5b9e026 100644 --- a/admin/index.php +++ b/admin/index.php @@ -811,6 +811,10 @@ tr:hover td{background:rgba(255,255,255,.015)} +
+ + +
PLAY NOW
+
@@ -1405,19 +1406,40 @@ async function refreshUser() { } // ─── PLATFORMS ───────────────────────────────────────────── +function openPlatform(slug, url, aliasParam) { + const alias = savedAliases[slug] || ''; + let launchUrl = url; + if (alias && aliasParam) { + const sep = url.includes('?') ? '&' : '?'; + launchUrl = url + sep + encodeURIComponent(aliasParam) + '=' + encodeURIComponent(alias); + } + window.open(launchUrl, '_blank', 'noopener'); + if (alias) { + navigator.clipboard?.writeText(alias).catch(() => {}); + const t = document.getElementById('platform-alias-toast'); + if (t) { + t.textContent = '📋 "' + alias + '" copied — paste into login'; + t.style.opacity = '1'; t.style.transform = 'translateY(0)'; + clearTimeout(t._timer); + t._timer = setTimeout(() => { t.style.opacity='0'; t.style.transform='translateY(10px)'; }, 3000); + } + } +} + function buildPlatforms() { if (!CFG.platforms || !CFG.platforms.length) return; const grid = document.getElementById('platform-grid'); if (grid) { grid.innerHTML = CFG.platforms.map(p => ` - + `).join(''); } // Populate selects — clear dynamic options first to prevent duplicates on re-call