APmanageur Wi-Fi V1.0

This commit is contained in:
yoannmultigaming committed 2026-11-18 23:58:35 +01:00
1 parent ab4ed099b7
commit 096529ee90
4 files changed
+37 -7

No files matched your search

+34 -7
View File
@@ -4993,11 +4993,13 @@
</div> </div>
<label style="display:inline-flex;align-items:center;gap:10px;cursor:pointer;font-weight:600;user-select:none"> <label style="display:inline-flex;align-items:center;gap:10px;cursor:pointer;font-weight:600;user-select:none">
<span data-i18n="backup_remote_enable">Activer le stockage distant</span> <span data-i18n="backup_remote_enable">Activer le stockage distant</span>
<input type="checkbox" id="backupRemoteEnabled" onchange="onBackupRemoteProviderChange()"> <input type="checkbox" id="backupRemoteEnabled" onchange="onBackupRemoteToggle()">
</label> </label>
</div> </div>
<div id="backupRemoteBody"> <div id="backupRemoteMsg" style="margin-top:10px;font-size:12px;display:none;padding:8px 12px;border-radius:6px"></div>
<div id="backupRemoteBody" style="display:none">
<div style="margin-bottom:14px"> <div style="margin-bottom:14px">
<label class="label" for="backupRemoteProvider" data-i18n="backup_remote_provider_label" style="margin-bottom:8px">Destination distante</label> <label class="label" for="backupRemoteProvider" data-i18n="backup_remote_provider_label" style="margin-bottom:8px">Destination distante</label>
@@ -5154,7 +5156,6 @@
</div> </div>
<span id="backupRemoteLastStatus" class="muted" style="font-size:12px"></span> <span id="backupRemoteLastStatus" class="muted" style="font-size:12px"></span>
</div> </div>
<div id="backupRemoteMsg" style="margin-top:10px;font-size:12px;display:none;padding:8px 12px;border-radius:6px"></div>
</div> </div>
</div> </div>
@@ -10918,6 +10919,7 @@ ${vpnBadgeTopo}
tbody.innerHTML = `<tr><td colspan="5" class="empty">${escapeHtml(t('backup_list_empty', 'Aucune sauvegarde dans le dossier pour le moment.'))}</td></tr>`; tbody.innerHTML = `<tr><td colspan="5" class="empty">${escapeHtml(t('backup_list_empty', 'Aucune sauvegarde dans le dossier pour le moment.'))}</td></tr>`;
return; return;
} }
const isRemoteEn = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
const curProv = $('backupRemoteProvider')?.value || 'ftp'; const curProv = $('backupRemoteProvider')?.value || 'ftp';
const provIconHtml = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(curProv) : '☁️ '; const provIconHtml = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(curProv) : '☁️ ';
tbody.innerHTML = serverBackupsCache.map(bk => { tbody.innerHTML = serverBackupsCache.map(bk => {
@@ -10936,7 +10938,7 @@ ${vpnBadgeTopo}
<td style="text-align:right;white-space:nowrap"> <td style="text-align:right;white-space:nowrap">
<div style="display:inline-flex;gap:6px;flex-wrap:wrap;justify-content:flex-end"> <div style="display:inline-flex;gap:6px;flex-wrap:wrap;justify-content:flex-end">
<button type="button" class="secondary" style="padding:5px 10px;font-size:12px" onclick="downloadServerBackup('${safeArg}')" title="${escapeHtml(t('backup_btn_export', 'Exporter'))}">⬇️ ${escapeHtml(t('backup_btn_export', 'Exporter'))}</button> <button type="button" class="secondary" style="padding:5px 10px;font-size:12px" onclick="downloadServerBackup('${safeArg}')" title="${escapeHtml(t('backup_btn_export', 'Exporter'))}">⬇️ ${escapeHtml(t('backup_btn_export', 'Exporter'))}</button>
<button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--green);color:var(--green)" onclick="uploadServerBackupToRemote('${safeArg}')" title="${escapeHtml(t('backup_btn_remote_push', 'Envoyer vers le stockage distant'))}">${provIconHtml}${escapeHtml(t('backup_btn_remote_short', 'Distant'))}</button> ${isRemoteEn ? `<button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--green);color:var(--green)" onclick="uploadServerBackupToRemote('${safeArg}')" title="${escapeHtml(t('backup_btn_remote_push', 'Envoyer vers le stockage distant'))}">${provIconHtml}${escapeHtml(t('backup_btn_remote_short', 'Distant'))}</button>` : ''}
<button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--blue);color:var(--blue)" onclick="restoreServerBackup('${safeArg}')" title="${escapeHtml(t('backup_btn_restore', 'Restaurer'))}">♻️ ${escapeHtml(t('backup_btn_restore', 'Restaurer'))}</button> <button type="button" class="secondary" style="padding:5px 10px;font-size:12px;border-color:var(--blue);color:var(--blue)" onclick="restoreServerBackup('${safeArg}')" title="${escapeHtml(t('backup_btn_restore', 'Restaurer'))}">♻️ ${escapeHtml(t('backup_btn_restore', 'Restaurer'))}</button>
<button type="button" class="secondary danger" style="padding:5px 10px;font-size:12px;border-color:rgba(239,68,68,0.45);color:var(--red)" onclick="deleteServerBackup('${safeArg}')" title="${escapeHtml(t('btn_delete', 'Supprimer'))}">🗑️</button> <button type="button" class="secondary danger" style="padding:5px 10px;font-size:12px;border-color:rgba(239,68,68,0.45);color:var(--red)" onclick="deleteServerBackup('${safeArg}')" title="${escapeHtml(t('btn_delete', 'Supprimer'))}">🗑️</button>
</div> </div>
@@ -11158,15 +11160,29 @@ ${vpnBadgeTopo}
} }
function selectBackupRemoteProvider(prov) { function selectBackupRemoteProvider(prov) {
if (!$('backupRemoteEnabled')?.checked) return;
if ($('backupRemoteProvider')) $('backupRemoteProvider').value = prov; if ($('backupRemoteProvider')) $('backupRemoteProvider').value = prov;
onBackupRemoteProviderChange(); onBackupRemoteProviderChange();
} }
async function onBackupRemoteToggle() {
const en = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
onBackupRemoteProviderChange();
if (!en) {
await saveBackupRemoteConfig(true);
}
}
function onBackupRemoteProviderChange() { function onBackupRemoteProviderChange() {
const prov = $('backupRemoteProvider')?.value || 'ftp'; const prov = $('backupRemoteProvider')?.value || 'ftp';
const en = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked); const en = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
const body = $('backupRemoteBody'); const body = $('backupRemoteBody');
if (body) body.style.opacity = en ? '1' : '0.72'; if (body) {
body.style.display = en ? 'block' : 'none';
body.querySelectorAll('input, select, textarea, button').forEach(el => {
el.disabled = !en;
});
}
['ftp', 'sftp', 'gdrive', 'dropbox', 'webdav', 's3', 'webhook'].forEach(k => { ['ftp', 'sftp', 'gdrive', 'dropbox', 'webdav', 's3', 'webhook'].forEach(k => {
const el = $('remoteFields_' + k); const el = $('remoteFields_' + k);
if (el) el.style.display = (k === prov) ? 'block' : 'none'; if (el) el.style.display = (k === prov) ? 'block' : 'none';
@@ -11184,6 +11200,7 @@ ${vpnBadgeTopo}
btn.style.boxShadow = 'none'; btn.style.boxShadow = 'none';
btn.style.fontWeight = 'normal'; btn.style.fontWeight = 'normal';
} }
btn.disabled = !en;
}); });
// Mettre à jour les boutons Distant dans la table des sauvegardes // Mettre à jour les boutons Distant dans la table des sauvegardes
if (serverBackupsCache && serverBackupsCache.length) { if (serverBackupsCache && serverBackupsCache.length) {
@@ -11304,7 +11321,7 @@ ${vpnBadgeTopo}
onBackupRemoteProviderChange(); onBackupRemoteProviderChange();
} }
async function saveBackupRemoteConfig() { async function saveBackupRemoteConfig(silent) {
const msg = $('backupRemoteMsg'); const msg = $('backupRemoteMsg');
const btn = $('btnSaveBackupRemote'); const btn = $('btnSaveBackupRemote');
if (btn) btn.disabled = true; if (btn) btn.disabled = true;
@@ -11317,7 +11334,7 @@ ${vpnBadgeTopo}
const d = await res.json(); const d = await res.json();
if (!res.ok) throw new Error(d.error || 'Erreur enregistrement'); if (!res.ok) throw new Error(d.error || 'Erreur enregistrement');
if (d.remote) applyBackupRemoteToUI(d.remote); if (d.remote) applyBackupRemoteToUI(d.remote);
if (msg) { if (msg && !silent) {
msg.style.display = 'block'; msg.style.display = 'block';
msg.style.background = 'rgba(50,213,131,0.12)'; msg.style.background = 'rgba(50,213,131,0.12)';
msg.style.color = 'var(--green)'; msg.style.color = 'var(--green)';
@@ -11372,6 +11389,16 @@ ${vpnBadgeTopo}
} }
async function uploadServerBackupToRemote(filename) { async function uploadServerBackupToRemote(filename) {
if (!$('backupRemoteEnabled') || !$('backupRemoteEnabled').checked) {
const msg = $('backupActionMsg');
if (msg) {
msg.style.display = 'block';
msg.style.background = 'rgba(239,68,68,0.12)';
msg.style.color = 'var(--red)';
msg.textContent = '❌ ' + t('backup_remote_disabled_err', 'Le stockage distant n’est pas activé. Veuillez l’activer dans les réglages ci-dessus.');
}
return;
}
const msg = $('backupActionMsg'); const msg = $('backupActionMsg');
const prov = $('backupRemoteProvider')?.value || 'ftp'; const prov = $('backupRemoteProvider')?.value || 'ftp';
const provIcon = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(prov) : ''; const provIcon = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(prov) : '';
+1
View File
@@ -1227,6 +1227,7 @@ window.I18N['en-gb'] = {
"backup_remote_upload_ok": "Backup uploaded to remote storage!", "backup_remote_upload_ok": "Backup uploaded to remote storage!",
"backup_remote_gdrive_hint": "Direct upload via the official Google Drive API (REST v3 multipart).", "backup_remote_gdrive_hint": "Direct upload via the official Google Drive API (REST v3 multipart).",
"backup_remote_dropbox_hint": "Direct upload via the official Dropbox Content API v2.", "backup_remote_dropbox_hint": "Direct upload via the official Dropbox Content API v2.",
"backup_remote_disabled_err": "Remote storage is not enabled. Please enable it in the settings above.",
"backup_btn_remote_push": "Upload to remote storage", "backup_btn_remote_push": "Upload to remote storage",
"backup_btn_remote_short": "Remote" "backup_btn_remote_short": "Remote"
}; };
+1
View File
@@ -1227,6 +1227,7 @@ window.I18N['en-us'] = {
"backup_remote_upload_ok": "Backup uploaded to remote storage!", "backup_remote_upload_ok": "Backup uploaded to remote storage!",
"backup_remote_gdrive_hint": "Direct upload via the official Google Drive API (REST v3 multipart).", "backup_remote_gdrive_hint": "Direct upload via the official Google Drive API (REST v3 multipart).",
"backup_remote_dropbox_hint": "Direct upload via the official Dropbox Content API v2.", "backup_remote_dropbox_hint": "Direct upload via the official Dropbox Content API v2.",
"backup_remote_disabled_err": "Remote storage is not enabled. Please enable it in the settings above.",
"backup_btn_remote_push": "Upload to remote storage", "backup_btn_remote_push": "Upload to remote storage",
"backup_btn_remote_short": "Remote" "backup_btn_remote_short": "Remote"
}; };
+1
View File
@@ -1227,6 +1227,7 @@ window.I18N['fr'] = {
"backup_remote_upload_ok": "Sauvegarde transférée vers le stockage distant !", "backup_remote_upload_ok": "Sauvegarde transférée vers le stockage distant !",
"backup_remote_gdrive_hint": "Téléversement direct via l’API officielle Google Drive (REST v3 multipart).", "backup_remote_gdrive_hint": "Téléversement direct via l’API officielle Google Drive (REST v3 multipart).",
"backup_remote_dropbox_hint": "Téléversement direct via l’API officielle Dropbox Content v2.", "backup_remote_dropbox_hint": "Téléversement direct via l’API officielle Dropbox Content v2.",
"backup_remote_disabled_err": "Le stockage distant n’est pas activé. Veuillez l’activer dans les réglages ci-dessus.",
"backup_btn_remote_push": "Envoyer vers le stockage distant", "backup_btn_remote_push": "Envoyer vers le stockage distant",
"backup_btn_remote_short": "Distant" "backup_btn_remote_short": "Distant"
}; };