Fix deploy and lock down the DM route; add /invitation
All checks were successful
Deploy Palico Bot / deploy (push) Successful in 32s
All checks were successful
Deploy Palico Bot / deploy (push) Successful in 32s
- Deploy workflow: pin node:24-bookworm; install openssh-client only if missing - Auth failure limiter counts only 401s (422/404 no longer lock out clients) - trust proxy configurable (WEB_TRUSTED_PROXIES), never "true" - DM route: loopback connections only, dedicated NOTIFICATIONS_API_KEY, 503 when unset - Jukebox: no polling without a key, stop on 401 - /invitation: posts the temporary invite message after checking the link - Stop tracking storage/library.json; README describes the real deployment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3655b1ad74
commit
6895d20459
16 changed files with 554 additions and 99 deletions
|
|
@ -110,7 +110,9 @@ export function createApiClient({ getApiKey, basePath = "" } = {}) {
|
|||
|
||||
if (!response.ok) {
|
||||
const errorMessage = payload?.error || payload?.message || response.statusText;
|
||||
throw new Error(errorMessage);
|
||||
const error = new Error(errorMessage);
|
||||
error.status = response.status;
|
||||
throw error;
|
||||
}
|
||||
|
||||
return payload;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,12 @@ function refreshAll(options = {}) {
|
|||
}
|
||||
|
||||
async function performRefresh({ silent = false } = {}) {
|
||||
if (!state.apiKey) {
|
||||
stopPolling();
|
||||
setStatus("Renseigne le mot de passe pour accéder au jukebox", "info", false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
clearStatus();
|
||||
}
|
||||
|
|
@ -85,6 +91,12 @@ async function performRefresh({ silent = false } = {}) {
|
|||
renderLibrary();
|
||||
updatePauseResumeButton();
|
||||
} catch (error) {
|
||||
if (error.status === 401) {
|
||||
// Inutile d'insister : chaque échec compte dans la limite anti-force brute du serveur.
|
||||
stopPolling();
|
||||
setStatus("Mot de passe refusé, vérifie-le puis sauvegarde", "error", false);
|
||||
return;
|
||||
}
|
||||
setStatus(`Erreur: ${error.message}`, "error", false);
|
||||
}
|
||||
}
|
||||
|
|
@ -253,10 +265,15 @@ async function handleLibraryAction(action, libraryId) {
|
|||
}
|
||||
|
||||
function startPolling() {
|
||||
clearInterval(pollIntervalId);
|
||||
stopPolling();
|
||||
pollIntervalId = setInterval(() => refreshAll({ silent: true }), 5000);
|
||||
}
|
||||
|
||||
function stopPolling() {
|
||||
clearInterval(pollIntervalId);
|
||||
pollIntervalId = null;
|
||||
}
|
||||
|
||||
function bindEvents() {
|
||||
elements.settingsForm?.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
|
|
@ -266,6 +283,9 @@ function bindEvents() {
|
|||
setStoredDisplayName(state.displayName);
|
||||
setStatus("Paramètres sauvegardés", "success");
|
||||
refreshAll({ silent: true });
|
||||
if (state.apiKey) {
|
||||
startPolling();
|
||||
}
|
||||
});
|
||||
|
||||
elements.uploadForm?.addEventListener("submit", async (event) => {
|
||||
|
|
@ -329,7 +349,9 @@ function initialize() {
|
|||
bindEvents();
|
||||
updatePauseResumeButton();
|
||||
refreshAll();
|
||||
startPolling();
|
||||
if (state.apiKey) {
|
||||
startPolling();
|
||||
}
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue