Pass saved alias to platform on launch; copy to clipboard

- 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 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 11:13:45 +00:00
parent 44a98eba15
commit 483026fd07
3 changed files with 79 additions and 49 deletions
+10 -4
View File
@@ -811,6 +811,10 @@ tr:hover td{background:rgba(255,255,255,.015)}
<label class="gm-edit-label">Player URL * <span style="font-weight:400;color:var(--text2)">shown to players — opens the game</span></label>
<input class="fi-sm" id="gf-player-url" type="url" placeholder="https://game.example.com/play" style="width:100%;padding:10px 12px">
</div>
<div style="margin-bottom:10px">
<label class="gm-edit-label">Username URL Param <span style="font-weight:400;color:var(--text2)">— optional: query param name the platform uses to pre-fill login (e.g. <code style="background:rgba(255,255,255,.07);padding:1px 5px;border-radius:3px">username</code>)</span></label>
<input class="fi-sm" id="gf-alias-param" type="text" placeholder="e.g. username, user, login" maxlength="50" style="width:100%;padding:10px 12px">
</div>
<!-- Agent Fields — EDIT mode (master admin only) -->
<div id="gf-agent-edit" style="background:rgba(155,93,229,0.06);border:1px solid rgba(155,93,229,0.2);border-radius:8px;padding:12px 14px;margin-bottom:10px;display:none">
<div style="font-size:12px;font-weight:700;color:var(--purple);letter-spacing:1px;text-transform:uppercase;margin-bottom:10px">🔐 Agent Info — Admin Only</div>
@@ -3051,8 +3055,9 @@ function editGame(id) {
document.getElementById('gf-name').value = g.name;
document.getElementById('gf-slug').value = g.slug;
document.getElementById('gf-slug').disabled = true;
document.getElementById('gf-player-url').value = g.player_url;
document.getElementById('gf-color').value = g.color || '#f0c040';
document.getElementById('gf-player-url').value = g.player_url;
document.getElementById('gf-alias-param').value = g.url_alias_param || '';
document.getElementById('gf-color').value = g.color || '#f0c040';
document.getElementById('gf-color-hex').value = g.color || '#f0c040';
document.getElementById('gf-sort').value = g.sort_order;
document.getElementById('gf-active').value = g.is_active;
@@ -3171,8 +3176,9 @@ async function saveGame() {
id: id ? parseInt(id) : undefined,
name: document.getElementById('gf-name').value.trim(),
slug: document.getElementById('gf-slug').value.trim(),
player_url: document.getElementById('gf-player-url').value.trim(),
agent_link: document.getElementById('gf-agent-link').value.trim(),
player_url: document.getElementById('gf-player-url').value.trim(),
url_alias_param: document.getElementById('gf-alias-param').value.trim(),
agent_link: document.getElementById('gf-agent-link').value.trim(),
agent_login: document.getElementById('gf-agent-login').value.trim(),
agent_password: document.getElementById('gf-agent-password').value.trim(),
games_link: document.getElementById('gf-games-link').value.trim(),