Added lobby auto creation
Docker image / build-and-push (push) Successful in 57s

This commit is contained in:
Aleksandr Bogomiakov
2026-08-06 20:33:27 +01:00
parent 33e01a4a8f
commit c239669932
22 changed files with 3533 additions and 55 deletions
+31 -1
View File
@@ -154,7 +154,7 @@ function renderRows(rows, totalLoaded) {
if (!rows.length) {
const tr = document.createElement('tr');
const td = document.createElement('td');
td.colSpan = 7;
td.colSpan = 8;
td.className = 'empty';
td.textContent = totalLoaded ? 'No lobbies match the selected filters' : 'No data yet';
tr.append(td);
@@ -192,6 +192,35 @@ function renderRows(rows, totalLoaded) {
passPill.textContent = row.hasPassKey ? 'yes' : 'no';
pass.append(passPill);
const action = document.createElement('td');
const createTemplate = document.createElement('button');
const template = {
sourceLobbyId: String(row.id || ''),
lobbyName: row.lobby || `${row.game || 'Custom game'} ${row.map || ''}`.trim(),
serverRegion: String(row.regionId || 0),
customGameId: String(row.customGameId || ''),
customGameMode: String(row.customGameMode || ''),
customMapName: String(row.map || ''),
customMinPlayers: String(row.minPlayerCount || 1),
customMaxPlayers: String(row.maxPlayerCount || 2),
customGameCrc: String(row.customGameCrc || ''),
customGameTimestamp: String(row.customGameTimestamp || ''),
};
createTemplate.type = 'button';
createTemplate.className = 'template-button';
createTemplate.textContent = 'Create template';
createTemplate.title = 'Open the admin page and prefill lobby creation from this lobby';
createTemplate.addEventListener('click', () => {
try {
sessionStorage.setItem('dokaLobbyTemplate', JSON.stringify(template));
window.location.assign('/admin');
} catch {
const fallback = new URLSearchParams({ template: 'lobby', ...template });
window.location.assign(`/admin?${fallback}`);
}
});
action.append(createTemplate);
tr.append(
game,
makeCell(row.lobby),
@@ -200,6 +229,7 @@ function renderRows(rows, totalLoaded) {
makeCell(row.region),
pass,
makeCell(row.leader),
action,
);
fragment.append(tr);
}