Lighten the website and make it more accessible

- Serve the hero images as WebP at their display size: 118 KB and 55 KB
  instead of 3.5 MB and 1.4 MB.
- Add a favicon, an apple-touch icon, a description and a theme colour.
- Announce status messages to screen readers and label the move buttons.
- Offer "Se souvenir de moi" to keep the password on the device, and keep
  working when browser storage is unavailable.
- Fix typos in the jukebox introduction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-29 12:05:57 +01:00
parent 362c7772ba
commit d200040691
11 changed files with 66 additions and 14 deletions

View file

@ -1,20 +1,52 @@
const API_KEY_STORAGE_KEY = "palico-api-key";
const DISPLAY_NAME_STORAGE_KEY = "palico-display-name";
export function getStoredApiKey() {
return sessionStorage.getItem(API_KEY_STORAGE_KEY) || "";
// Le stockage peut être indisponible (navigation privée, cookies bloqués) : la page doit
// fonctionner quand même, simplement sans mémoire.
function storageGet(storage, key) {
try {
return storage.getItem(key);
} catch {
return null;
}
}
export function setStoredApiKey(value) {
sessionStorage.setItem(API_KEY_STORAGE_KEY, value || "");
function storageSet(storage, key, value) {
try {
if (value) {
storage.setItem(key, value);
} else {
storage.removeItem(key);
}
} catch {
// Stockage indisponible.
}
}
export function getStoredApiKey() {
return (
storageGet(sessionStorage, API_KEY_STORAGE_KEY) ||
storageGet(localStorage, API_KEY_STORAGE_KEY) ||
""
);
}
export function isApiKeyRemembered() {
return Boolean(storageGet(localStorage, API_KEY_STORAGE_KEY));
}
// remember : garde la clé sur l'appareil (localStorage) au lieu de l'onglet (sessionStorage).
export function setStoredApiKey(value, { remember = false } = {}) {
storageSet(remember ? localStorage : sessionStorage, API_KEY_STORAGE_KEY, value);
storageSet(remember ? sessionStorage : localStorage, API_KEY_STORAGE_KEY, "");
}
export function getStoredDisplayName() {
return localStorage.getItem(DISPLAY_NAME_STORAGE_KEY) || "";
return storageGet(localStorage, DISPLAY_NAME_STORAGE_KEY) || "";
}
export function setStoredDisplayName(value) {
localStorage.setItem(DISPLAY_NAME_STORAGE_KEY, value || "");
storageSet(localStorage, DISPLAY_NAME_STORAGE_KEY, value);
}
export function createStatusManager(statusElement) {

View file

@ -5,6 +5,7 @@ import {
getStoredApiKey,
getStoredDisplayName,
formatBytes,
isApiKeyRemembered,
formatDate,
setStoredApiKey,
setStoredDisplayName,
@ -22,6 +23,7 @@ const state = {
const elements = {
status: document.getElementById("status"),
apiKeyInput: document.getElementById("apiKey"),
rememberKeyCheckbox: document.getElementById("rememberKey"),
displayNameInput: document.getElementById("displayName"),
settingsForm: document.getElementById("settingsForm"),
uploadForm: document.getElementById("uploadForm"),
@ -171,8 +173,8 @@ function renderQueue() {
</div>
</div>
<div class="media-item__actions">
<button class="btn btn--secondary" data-action="up" data-track="${track.id}">▲</button>
<button class="btn btn--secondary" data-action="down" data-track="${track.id}">▼</button>
<button class="btn btn--secondary" data-action="up" data-track="${track.id}" aria-label="Monter" title="Monter">▲</button>
<button class="btn btn--secondary" data-action="down" data-track="${track.id}" aria-label="Descendre" title="Descendre">▼</button>
<button class="btn btn--danger" data-action="remove" data-track="${track.id}">Supprimer</button>
</div>
`;
@ -312,7 +314,9 @@ function bindEvents() {
event.preventDefault();
state.apiKey = elements.apiKeyInput.value.trim();
state.displayName = elements.displayNameInput.value.trim();
setStoredApiKey(state.apiKey);
setStoredApiKey(state.apiKey, {
remember: elements.rememberKeyCheckbox?.checked,
});
setStoredDisplayName(state.displayName);
setStatus("Paramètres sauvegardés", "success");
refreshAll({ silent: true });
@ -403,6 +407,9 @@ function bindEvents() {
function initialize() {
elements.apiKeyInput.value = state.apiKey;
elements.displayNameInput.value = state.displayName;
if (elements.rememberKeyCheckbox) {
elements.rememberKeyCheckbox.checked = isApiKeyRemembered();
}
bindEvents();
updatePauseResumeButton();
refreshAll();