APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
ab4ed099b7
commit
096529ee90
4 files changed
+37
-7
No files matched your search
+34
-7
@@ -4993,11 +4993,13 @@
|
||||
</div>
|
||||
<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>
|
||||
<input type="checkbox" id="backupRemoteEnabled" onchange="onBackupRemoteProviderChange()">
|
||||
<input type="checkbox" id="backupRemoteEnabled" onchange="onBackupRemoteToggle()">
|
||||
</label>
|
||||
</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">
|
||||
<label class="label" for="backupRemoteProvider" data-i18n="backup_remote_provider_label" style="margin-bottom:8px">Destination distante</label>
|
||||
|
||||
@@ -5154,7 +5156,6 @@
|
||||
</div>
|
||||
<span id="backupRemoteLastStatus" class="muted" style="font-size:12px"></span>
|
||||
</div>
|
||||
<div id="backupRemoteMsg" style="margin-top:10px;font-size:12px;display:none;padding:8px 12px;border-radius:6px"></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>`;
|
||||
return;
|
||||
}
|
||||
const isRemoteEn = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
|
||||
const curProv = $('backupRemoteProvider')?.value || 'ftp';
|
||||
const provIconHtml = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(curProv) : '☁️ ';
|
||||
tbody.innerHTML = serverBackupsCache.map(bk => {
|
||||
@@ -10936,7 +10938,7 @@ ${vpnBadgeTopo}
|
||||
<td style="text-align:right;white-space:nowrap">
|
||||
<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;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 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>
|
||||
@@ -11158,15 +11160,29 @@ ${vpnBadgeTopo}
|
||||
}
|
||||
|
||||
function selectBackupRemoteProvider(prov) {
|
||||
if (!$('backupRemoteEnabled')?.checked) return;
|
||||
if ($('backupRemoteProvider')) $('backupRemoteProvider').value = prov;
|
||||
onBackupRemoteProviderChange();
|
||||
}
|
||||
|
||||
async function onBackupRemoteToggle() {
|
||||
const en = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
|
||||
onBackupRemoteProviderChange();
|
||||
if (!en) {
|
||||
await saveBackupRemoteConfig(true);
|
||||
}
|
||||
}
|
||||
|
||||
function onBackupRemoteProviderChange() {
|
||||
const prov = $('backupRemoteProvider')?.value || 'ftp';
|
||||
const en = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
|
||||
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 => {
|
||||
const el = $('remoteFields_' + k);
|
||||
if (el) el.style.display = (k === prov) ? 'block' : 'none';
|
||||
@@ -11184,6 +11200,7 @@ ${vpnBadgeTopo}
|
||||
btn.style.boxShadow = 'none';
|
||||
btn.style.fontWeight = 'normal';
|
||||
}
|
||||
btn.disabled = !en;
|
||||
});
|
||||
// Mettre à jour les boutons Distant dans la table des sauvegardes
|
||||
if (serverBackupsCache && serverBackupsCache.length) {
|
||||
@@ -11304,7 +11321,7 @@ ${vpnBadgeTopo}
|
||||
onBackupRemoteProviderChange();
|
||||
}
|
||||
|
||||
async function saveBackupRemoteConfig() {
|
||||
async function saveBackupRemoteConfig(silent) {
|
||||
const msg = $('backupRemoteMsg');
|
||||
const btn = $('btnSaveBackupRemote');
|
||||
if (btn) btn.disabled = true;
|
||||
@@ -11317,7 +11334,7 @@ ${vpnBadgeTopo}
|
||||
const d = await res.json();
|
||||
if (!res.ok) throw new Error(d.error || 'Erreur enregistrement');
|
||||
if (d.remote) applyBackupRemoteToUI(d.remote);
|
||||
if (msg) {
|
||||
if (msg && !silent) {
|
||||
msg.style.display = 'block';
|
||||
msg.style.background = 'rgba(50,213,131,0.12)';
|
||||
msg.style.color = 'var(--green)';
|
||||
@@ -11372,6 +11389,16 @@ ${vpnBadgeTopo}
|
||||
}
|
||||
|
||||
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 prov = $('backupRemoteProvider')?.value || 'ftp';
|
||||
const provIcon = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(prov) : '';
|
||||
|
||||
@@ -1227,6 +1227,7 @@ window.I18N['en-gb'] = {
|
||||
"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_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_short": "Remote"
|
||||
};
|
||||
@@ -1227,6 +1227,7 @@ window.I18N['en-us'] = {
|
||||
"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_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_short": "Remote"
|
||||
};
|
||||
@@ -1227,6 +1227,7 @@ window.I18N['fr'] = {
|
||||
"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_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_short": "Distant"
|
||||
};
|
||||
Reference in new issue
Block a user