Rebrand to Black Sheep Bluff + bug fixes + F5 reconnect

- Rename identity/ folder (was idetity typo), update all references
- Page title: "Black Sheep Bluff – Wer ist das schwarze Schaf?"
- Fix gtl_rooms.updated_at not updated on submit_answer and vote actions
- Implement F5 reconnect: save role/room/pkey to sessionStorage on join,
  restore on page reload via tryRestoreSession()
- Clear sessionStorage on leave()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
danny 2026-06-14 12:31:51 +02:00
parent 44e5b48c3c
commit 01cd98aaf4
10 changed files with 41 additions and 11 deletions

View file

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title>Admin – Black Sheep Bluff</title>
<link rel="icon" href="idetity/favicon.png" type="image/png">
<link rel="icon" href="identity/favicon.png" type="image/png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
@ -125,7 +125,7 @@
<body>
<div class="wrap">
<nav>
<a href="index.html" class="nav-logo"><img src="idetity/favicon.png" style="width:22px;height:22px;vertical-align:middle;margin-right:7px;border-radius:6px">Black Sheep Bluff</a>
<a href="index.html" class="nav-logo"><img src="identity/favicon.png" style="width:22px;height:22px;vertical-align:middle;margin-right:7px;border-radius:6px">Black Sheep Bluff</a>
<div class="nav-links">
<a href="index.html">Spiel</a>
<a href="profile.php">Profil</a>

View file

@ -329,6 +329,7 @@ try {
$pdo->prepare(
'UPDATE gtl_players SET answer=?, answered=1, updated_at=? WHERE room_code=? AND pkey=?'
)->execute([$answer, $now, $code, $pkey]);
$pdo->prepare('UPDATE gtl_rooms SET updated_at=? WHERE code=?')->execute([$now, $code]);
respond(['ok' => true]);
break;
@ -380,6 +381,7 @@ try {
$pdo->prepare(
'UPDATE gtl_players SET vote_for=?, updated_at=? WHERE room_code=? AND pkey=?'
)->execute([$voteFor !== '' ? $voteFor : null, $now, $code, $pkey]);
$pdo->prepare('UPDATE gtl_rooms SET updated_at=? WHERE code=?')->execute([$now, $code]);
respond(['ok' => true]);
break;

View file

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 285 KiB

After

Width:  |  Height:  |  Size: 285 KiB

Before After
Before After

View file

@ -4,8 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title>Black Sheep Bluff – Guess the Imposter</title>
<link rel="icon" href="idetity/favicon.png" type="image/png">
<title>Black Sheep Bluff – Wer ist das schwarze Schaf?</title>
<link rel="icon" href="identity/favicon.png" type="image/png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
@ -233,7 +233,7 @@
<body>
<div class="wrap">
<nav>
<a href="index.html" class="nav-logo"><img src="idetity/favicon.png" style="width:24px;height:24px;vertical-align:middle;margin-right:7px;border-radius:6px">Black Sheep Bluff</a>
<a href="index.html" class="nav-logo"><img src="identity/favicon.png" style="width:24px;height:24px;vertical-align:middle;margin-right:7px;border-radius:6px">Black Sheep Bluff</a>
<div style="display:flex;align-items:center;gap:10px">
<span class="nav-user" id="navUser"></span>
<div class="nav-links">
@ -245,7 +245,7 @@
</nav>
<div class="brand">
<img src="idetity/logo.png" alt="Black Sheep Bluff" class="brand-logo">
<img src="identity/logo.png" alt="Black Sheep Bluff" class="brand-logo">
<p class="tag">Imposters bekommen eine andere Frage. Findet sie!</p>
</div>
@ -475,6 +475,7 @@ const App = (() => {
role='host'; room=d.state.code; hostPass=pass;
selectedImposters=new Set(d.state.liarKeys||[]);
questionsLoaded=false;
sessionStorage.setItem('bsb_session',JSON.stringify({role:'host',room:d.state.code,pass}));
show('lobby',false); show('playerView',false); show('hostView',true);
$('hRoom').textContent=room;
render(d.state); startPoll();
@ -487,6 +488,7 @@ const App = (() => {
try{
const d=await api('player_join',{code,name:nm});
role='player'; room=d.state.code; pkey=d.pkey; name=nm;
sessionStorage.setItem('bsb_session',JSON.stringify({role:'player',room:d.state.code,pkey:d.pkey,name:nm}));
show('lobby',false); show('hostView',false); show('playerView',true);
$('pRoom').textContent=room; $('pName').textContent=nm;
render(d.state); startPoll();
@ -898,10 +900,36 @@ const App = (() => {
clearInterval(timer); role=room=pkey=name=null;
lastState=null; selectedImposters=new Set(); questionsLoaded=false; lastJSON='';
lastRoundNum=-1;
sessionStorage.removeItem('bsb_session');
show('playerView',false); show('hostView',false); show('lobby',true);
}
initAuth();
async function tryRestoreSession(){
const raw=sessionStorage.getItem('bsb_session');
if(!raw) return false;
try{
const s=JSON.parse(raw);
if(s.role==='host'){
const d=await api('host_open',{code:s.room,pass:s.pass});
role='host'; room=d.state.code; hostPass=s.pass;
selectedImposters=new Set(d.state.liarKeys||[]); questionsLoaded=false;
show('lobby',false); show('playerView',false); show('hostView',true);
$('hRoom').textContent=room;
render(d.state); startPoll(); return true;
} else if(s.role==='player'){
// rejoin: server keeps the player row, just re-enter view
const d=await api('state',{code:s.room},'GET');
if(!d.state.players[s.pkey]) throw new Error('not found');
role='player'; room=s.room; pkey=s.pkey; name=s.name;
show('lobby',false); show('hostView',false); show('playerView',true);
$('pRoom').textContent=room; $('pName').textContent=name;
render(d.state); startPoll(); return true;
}
}catch(e){ sessionStorage.removeItem('bsb_session'); }
return false;
}
initAuth().then(()=>tryRestoreSession());
return {
hostOpen, playerJoin, submitAnswer, vote, removePlayer, score, reveal, openVoting, resolveRound,

View file

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title>Login – Black Sheep Bluff</title>
<link rel="icon" href="idetity/favicon.png" type="image/png">
<link rel="icon" href="identity/favicon.png" type="image/png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
@ -73,7 +73,7 @@
<body>
<div class="wrap">
<div class="brand">
<img src="idetity/logo.png" alt="Black Sheep Bluff" class="brand-logo">
<img src="identity/logo.png" alt="Black Sheep Bluff" class="brand-logo">
<p class="tag">Melde dich an</p>
</div>

View file

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title>Profil – Black Sheep Bluff</title>
<link rel="icon" href="idetity/favicon.png" type="image/png">
<link rel="icon" href="identity/favicon.png" type="image/png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
@ -175,7 +175,7 @@ button:disabled{opacity:.45;cursor:not-allowed}
<body>
<nav>
<a href="index.html" class="nav-logo"><img src="idetity/favicon.png" style="width:22px;height:22px;vertical-align:middle;margin-right:7px;border-radius:6px">Black Sheep Bluff</a>
<a href="index.html" class="nav-logo"><img src="identity/favicon.png" style="width:22px;height:22px;vertical-align:middle;margin-right:7px;border-radius:6px">Black Sheep Bluff</a>
<div class="nav-links">
<a href="index.html">Spiel</a>
<a href="profile.php" class="active">Profil</a>