palico-bot/public/index.html
Shinuwa 25f22dd363
All checks were successful
Deploy Palico Bot / check (push) Successful in 9s
Deploy Palico Bot / deploy (push) Successful in 7s
Make the jukebox the home page, add seeking and redesign the site
Seeking: the progress bar is now a slider. Releasing it calls
POST /api/player/seek, which restarts ffmpeg at that position and swaps
the audio resource without going through Idle, so the track is neither
finished nor requeued in loop mode.

Structure: the jukebox is served at / and the old home page is gone.
/jukebox/ redirects to / with its query string, and the Discord login
callback now returns to /.

Redesign: a login screen until the visitor is signed in, then an app
layout with a top bar, the library on the left and the player and queue
on the right (sticky, two columns from 1000 px). Small screens get a
mini player while the main one is out of view. Icon buttons, a single
play/pause button, a drop zone for uploads, toast messages and a
refined violet palette with checked contrast. A refused password now
returns to the login screen instead of leaving an empty page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 12:04:03 +01:00

278 lines
13 KiB
HTML

<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<title>Palico Jukebox</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Le jukebox du Palico Bot : la musique du salon vocal Discord." />
<meta name="theme-color" content="#0b0712" />
<link rel="icon" type="image/svg+xml" href="/img/favicon.svg" />
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon.png" />
<link rel="apple-touch-icon" href="/img/apple-touch-icon.png" />
<link rel="stylesheet" href="/style/styles.css" />
</head>
<body>
<header class="topbar">
<div class="topbar__inner">
<a class="brand" href="/">
<img src="/img/favicon.svg" alt="" width="32" height="32" />
<span>Palico Jukebox</span>
</a>
<span id="liveIndicator" class="live-indicator" data-live="false" hidden>Hors ligne</span>
<div id="loggedIn" class="topbar__account" hidden>
<span id="userName" class="topbar__user"></span>
<button id="logoutBtn" class="btn btn--ghost btn--small" type="button">Se déconnecter</button>
</div>
</div>
</header>
<!-- Écran de connexion : affiché tant que la page n'a ni session Discord ni mot de passe. -->
<section id="welcome" class="welcome" aria-labelledby="welcomeTitle" hidden>
<img class="welcome__visual" src="/img/palico-index.webp" alt="" width="640" height="960" />
<div class="welcome__content">
<p class="eyebrow">Le jukebox du Palico Bot</p>
<h1 id="welcomeTitle">Un peu de son pour le Discord !</h1>
<p class="welcome__text">
Ajoute des morceaux et gère la playlist du salon vocal depuis cette page, ou avec
<code>/play</code> sur Discord. Tout est synchronisé en direct.
</p>
<div id="discordLogin" hidden>
<a class="btn btn--discord" href="/auth/discord">
<svg viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
<path
fill="currentColor"
d="M18.59 5.89a15.6 15.6 0 0 0-3.92-1.23c-.17.3-.37.71-.5 1.04a14.5 14.5 0 0 0-4.34 0 10.6 10.6 0 0 0-.51-1.04c-1.38.24-2.69.66-3.92 1.23-2.48 3.74-3.15 7.39-2.82 10.98a15.7 15.7 0 0 0 4.81 2.46c.39-.53.73-1.1 1.03-1.69a10 10 0 0 1-1.62-.79l.4-.31c3.13 1.46 6.52 1.46 9.61 0l.4.31c-.51.31-1.06.57-1.62.79.3.59.64 1.16 1.03 1.69a15.6 15.6 0 0 0 4.81-2.46c.39-4.17-.67-7.78-2.82-10.98ZM8.84 14.67c-.94 0-1.71-.87-1.71-1.94s.75-1.94 1.71-1.94 1.72.87 1.71 1.94c0 1.06-.75 1.94-1.71 1.94Zm6.31 0c-.94 0-1.71-.87-1.71-1.94s.75-1.94 1.71-1.94 1.72.87 1.71 1.94c0 1.06-.75 1.94-1.71 1.94Z"
/>
</svg>
<span>Se connecter avec Discord</span>
</a>
<p class="hint">Réservé aux membres du serveur Discord.</p>
</div>
<details id="keyLogin" class="key-login" hidden>
<summary id="keyLoginSummary">Utiliser le mot de passe</summary>
<form id="settingsForm" class="key-login__form">
<div class="grid grid--two">
<div>
<label for="displayName">Nom affiché</label>
<input
type="text"
id="displayName"
name="displayName"
placeholder="Shinuwa"
autocomplete="nickname"
maxlength="80"
/>
</div>
<div>
<label for="apiKey">Mot de passe</label>
<input
type="password"
id="apiKey"
name="apiKey"
placeholder="Mot de passe"
autocomplete="current-password"
/>
</div>
</div>
<label class="form-checkbox u-mt-1">
<input type="checkbox" id="rememberKey" class="form-checkbox__input" />
<span>Se souvenir de moi sur cet appareil (sinon, oublié à la fermeture de l'onglet)</span>
</label>
<div class="form-actions">
<button type="submit" class="btn btn--primary">Entrer</button>
</div>
</form>
</details>
</div>
</section>
<main id="app" class="layout" hidden>
<!-- Lecteur et file : à droite sur grand écran, restent visibles en faisant défiler. -->
<aside class="layout__side">
<section id="playerSection" class="panel player" aria-labelledby="playerTitle">
<h2 id="playerTitle" class="panel__title">Lecture en cours</h2>
<div id="currentTrack" class="player__track player__track--empty"></div>
<div id="progress" class="seek" hidden>
<label for="seekInput" class="visually-hidden">Position dans le morceau</label>
<input type="range" id="seekInput" class="seek__input" min="0" max="0" step="1" value="0" />
<div class="seek__times">
<span id="progressElapsed">0:00</span>
<span id="progressTotal"></span>
</div>
</div>
<div class="player__controls">
<button class="icon-btn" type="button" data-player-action="shuffle" data-icon="shuffle" aria-label="Mélanger la file" title="Mélanger la file"></button>
<button class="icon-btn icon-btn--primary icon-btn--large js-play-pause" type="button" data-icon="play" aria-label="Lecture" title="Lecture"></button>
<button class="icon-btn" type="button" data-player-action="skip" data-icon="next" aria-label="Morceau suivant" title="Morceau suivant"></button>
<button id="loopBtn" class="icon-btn" type="button" data-icon="loop" aria-pressed="false" aria-label="Boucle" title="Boucle : la file rejoue en continu"></button>
</div>
<button class="btn btn--danger btn--small player__stop" type="button" data-player-action="stop">
Stop et vider la file
</button>
</section>
<section id="queueSection" class="panel queue" aria-labelledby="queueTitle">
<div class="panel__header">
<h2 id="queueTitle" class="panel__title">File d'attente</h2>
<span id="queueSummary" class="badge" hidden></span>
</div>
<ul id="queueList" class="list list--stack"></ul>
<p id="queueEmpty" class="empty">Aucun morceau en attente. Ajoute-en depuis la bibliothèque.</p>
</section>
</aside>
<div class="layout__main">
<section class="panel" aria-labelledby="libraryTitle">
<div class="panel__header">
<div>
<h2 id="libraryTitle" class="panel__title">Bibliothèque</h2>
<p class="panel__subtitle">Les morceaux conservés, rangés en sections.</p>
</div>
<button id="goToUploadBtn" class="btn btn--primary btn--small" type="button" data-icon-before="plus">
Ajouter de la musique
</button>
</div>
<div class="library-tools">
<label for="librarySearch" class="visually-hidden">Rechercher dans la bibliothèque</label>
<input
type="search"
id="librarySearch"
placeholder="Rechercher un titre, une étiquette…"
autocomplete="off"
/>
<div class="toolbar">
<button id="enqueueAllBtn" class="btn btn--small" type="button">Tout ajouter</button>
<button id="enqueueAllShuffledBtn" class="btn btn--small" type="button">Tout ajouter, mélangé</button>
<button id="newSectionBtn" class="btn btn--ghost btn--small" type="button">Nouvelle section</button>
</div>
</div>
<div id="libraryTags" class="tag-list tag-list--filter" role="group" aria-label="Filtrer par étiquette" hidden></div>
<div id="libraryList" class="library"></div>
<p id="libraryEmpty" class="empty">Aucun fichier permanent enregistré.</p>
</section>
<section id="uploadSection" class="panel" aria-labelledby="uploadTitle">
<h2 id="uploadTitle" class="panel__title">Ajouter de la musique</h2>
<p class="panel__subtitle">
Fichiers audio (150 Mo au plus chacun) ou lien direct vers un fichier. Les morceaux
temporaires sont supprimés après lecture.
</p>
<div class="grid grid--two">
<label class="form-checkbox">
<input type="checkbox" id="permanentFile" class="form-checkbox__input" />
<span>Conserver dans la bibliothèque</span>
</label>
<label class="form-checkbox">
<input type="checkbox" id="enqueueFile" checked class="form-checkbox__input" />
<span>Ajouter directement à la file d'attente</span>
</label>
</div>
<div id="uploadSectionField" class="u-mt-1" hidden>
<label for="uploadSectionSelect">Section de la bibliothèque</label>
<select id="uploadSectionSelect"></select>
</div>
<form id="uploadForm" class="u-mt-1">
<input type="file" id="musicFile" name="musicFile" class="visually-hidden" accept="audio/*,video/*" multiple />
<label class="dropzone" for="musicFile">
<span class="dropzone__icon" data-icon="upload"></span>
<span id="dropzoneText" class="dropzone__text">
<strong>Choisis des fichiers</strong> ou glisse-les ici
</span>
</label>
<label for="uploadNotes" class="u-mt-1">Titre (facultatif, pour un seul fichier)</label>
<input
type="text"
id="uploadNotes"
name="notes"
maxlength="200"
placeholder="Par défaut : les tags du fichier, sinon son nom"
/>
<div class="form-actions">
<button type="submit" class="btn btn--primary">Envoyer</button>
</div>
</form>
<ul id="uploadList" class="list upload-list" aria-live="polite"></ul>
<form id="urlForm" class="url-form">
<label for="musicUrl">Lien direct vers un fichier audio</label>
<div class="url-form__row">
<input
type="url"
id="musicUrl"
name="url"
required
maxlength="2000"
placeholder="https://exemple.com/morceau.mp3"
/>
<button type="submit" class="btn btn--primary">Ajouter</button>
</div>
<p class="hint">YouTube et Spotify ne sont pas pris en charge.</p>
</form>
</section>
</div>
</main>
<!-- Petits écrans : rappel du morceau en cours quand le lecteur est hors de vue. -->
<div id="miniPlayer" class="mini-player" hidden>
<button id="miniPlayerInfo" class="mini-player__info" type="button" aria-label="Aller au lecteur">
<span id="miniPlayerCover"></span>
<span id="miniPlayerTitle" class="mini-player__title"></span>
</button>
<button class="icon-btn icon-btn--primary js-play-pause" type="button" data-icon="play" aria-label="Lecture"></button>
<button class="icon-btn" type="button" data-player-action="skip" data-icon="next" aria-label="Morceau suivant"></button>
<div class="mini-player__progress"><div id="miniProgressBar"></div></div>
</div>
<div id="status" class="toast" role="status" aria-live="polite" hidden></div>
<dialog id="editDialog" class="dialog" aria-labelledby="editDialogTitle">
<form id="editForm">
<h2 id="editDialogTitle">Modifier le morceau</h2>
<div class="cover-editor">
<div id="editCoverPreview" class="cover cover--large cover--empty" aria-hidden="true"></div>
<div class="cover-editor__fields">
<label id="editCoverLabel" for="editCoverInput">Pochette</label>
<input type="file" id="editCoverInput" accept="image/png,image/jpeg,image/webp,image/gif" />
<p class="hint">PNG, JPEG, WebP ou GIF, 10 Mo au plus. Réduite à 512 px.</p>
<button id="editCoverRemoveBtn" class="btn btn--ghost btn--small u-mt-1" type="button">
Retirer la pochette
</button>
</div>
</div>
<label id="editNameLabel" for="editNameInput" class="u-mt-1">Titre</label>
<input type="text" id="editNameInput" maxlength="200" required />
<div id="editSectionField">
<label for="editSectionSelect" class="u-mt-1">Section</label>
<select id="editSectionSelect"></select>
</div>
<div id="editTagsField">
<label for="editTagsInput" class="u-mt-1">Étiquettes</label>
<input type="text" id="editTagsInput" maxlength="500" autocomplete="off" placeholder="épique, calme, combat…" />
<p class="hint">Sépare-les par des virgules. Clique sur une étiquette existante pour l'ajouter.</p>
<div id="editTagSuggestions" class="tag-list"></div>
</div>
<div class="form-actions toolbar">
<button id="editCancelBtn" class="btn btn--ghost" type="button">Annuler</button>
<button id="editSaveBtn" class="btn btn--primary" type="submit">Enregistrer</button>
</div>
</form>
</dialog>
<script type="module" src="/scripts/jukebox.js"></script>
</body>
</html>