@@ -10757,6 +10799,8 @@ ${vpnBadgeTopo}
tbody.innerHTML = `
| ${escapeHtml(t('backup_list_empty', 'Aucune sauvegarde dans le dossier pour le moment.'))} |
`;
return;
}
+ const curProv = $('backupRemoteProvider')?.value || 'ftp';
+ const provIconHtml = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(curProv) : '☁️ ';
tbody.innerHTML = serverBackupsCache.map(bk => {
const fname = bk.filename || '';
const safeArg = escapeHtml(fname).replace(/'/g, ''');
@@ -10773,7 +10817,7 @@ ${vpnBadgeTopo}
-
+
@@ -10984,6 +11028,21 @@ ${vpnBadgeTopo}
}
}
+ function getRemoteProviderIconHtml(prov) {
+ if (prov === 'gdrive') return ' ';
+ if (prov === 'dropbox') return ' ';
+ if (prov === 'sftp') return '🔐 ';
+ if (prov === 'webdav') return '🌐 ';
+ if (prov === 's3') return '🪣 ';
+ if (prov === 'webhook') return '🔗 ';
+ return '📡 ';
+ }
+
+ function selectBackupRemoteProvider(prov) {
+ if ($('backupRemoteProvider')) $('backupRemoteProvider').value = prov;
+ onBackupRemoteProviderChange();
+ }
+
function onBackupRemoteProviderChange() {
const prov = $('backupRemoteProvider')?.value || 'ftp';
const en = !!($('backupRemoteEnabled') && $('backupRemoteEnabled').checked);
@@ -10993,6 +11052,26 @@ ${vpnBadgeTopo}
const el = $('remoteFields_' + k);
if (el) el.style.display = (k === prov) ? 'block' : 'none';
});
+ document.querySelectorAll('.backup-prov-btn').forEach(btn => {
+ const isSelected = (btn.getAttribute('data-provider') === prov);
+ if (isSelected) {
+ btn.style.borderColor = 'var(--blue)';
+ btn.style.background = 'rgba(56,189,248,0.18)';
+ btn.style.boxShadow = '0 0 0 1px var(--blue)';
+ btn.style.fontWeight = '600';
+ } else {
+ btn.style.borderColor = 'var(--line)';
+ btn.style.background = 'transparent';
+ btn.style.boxShadow = 'none';
+ btn.style.fontWeight = 'normal';
+ }
+ });
+ // Mettre à jour les boutons Distant dans la table des sauvegardes
+ if (serverBackupsCache && serverBackupsCache.length) {
+ const summary = $('backupsListSummary');
+ const sumText = summary ? summary.textContent.split('•')[1]?.trim() : '';
+ renderServerBackupsTable(serverBackupsCache, sumText);
+ }
}
function getBackupRemotePayload() {
@@ -11099,7 +11178,8 @@ ${vpnBadgeTopo}
if (stEl) {
if (rcfg.last_upload_time) {
const icon = rcfg.last_upload_status === 'ok' ? '✅' : '❌';
- stEl.textContent = `${icon} ${t('backup_remote_last_upload', 'Dernier envoi :')} ${rcfg.last_upload_time} (${rcfg.last_upload_file || ''})${rcfg.last_upload_error ? ' — ' + rcfg.last_upload_error : ''}`;
+ const provIcon = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(rcfg.provider || 'ftp') : '';
+ stEl.innerHTML = `${icon} ${provIcon}${escapeHtml(t('backup_remote_last_upload', 'Dernier envoi :'))} ${escapeHtml(rcfg.last_upload_time)} (${escapeHtml(rcfg.last_upload_file || '')})${rcfg.last_upload_error ? ' — ' + escapeHtml(rcfg.last_upload_error) : ''}`;
} else {
stEl.textContent = '';
}
@@ -11176,11 +11256,23 @@ ${vpnBadgeTopo}
async function uploadServerBackupToRemote(filename) {
const msg = $('backupActionMsg');
+ const prov = $('backupRemoteProvider')?.value || 'ftp';
+ const provIcon = (typeof getRemoteProviderIconHtml === 'function') ? getRemoteProviderIconHtml(prov) : '';
+ const provNames = {
+ gdrive: 'Google Drive',
+ dropbox: 'Dropbox',
+ sftp: 'SFTP',
+ ftp: 'FTP',
+ webdav: 'WebDAV',
+ s3: 'S3',
+ webhook: 'Webhook'
+ };
+ const pName = provNames[prov] || prov.toUpperCase();
if (msg) {
msg.style.display = 'block';
msg.style.background = 'rgba(56,189,248,0.12)';
msg.style.color = 'var(--blue)';
- msg.textContent = t('backup_remote_uploading', 'Envoi de « {file} » vers le stockage distant…').replace('{file}', filename);
+ msg.innerHTML = `${provIcon}${escapeHtml(t('backup_remote_uploading', 'Envoi de « {file} » vers le stockage distant…').replace('{file}', filename))} (${escapeHtml(pName)})`;
}
try {
const res = await apiFetch('/api/backups/remote/upload', {
diff --git a/lang/en-gb.js b/lang/en-gb.js
index 0d17c86..28943b9 100644
--- a/lang/en-gb.js
+++ b/lang/en-gb.js
@@ -1225,6 +1225,8 @@ window.I18N['en-gb'] = {
"backup_remote_test_ok": "Connection and upload succeeded!",
"backup_remote_uploading": "Uploading \"{file}\" 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_dropbox_hint": "Direct upload via the official Dropbox Content API v2.",
"backup_btn_remote_push": "Upload to remote storage",
"backup_btn_remote_short": "Remote"
};
diff --git a/lang/en-us.js b/lang/en-us.js
index c40f437..29350fa 100644
--- a/lang/en-us.js
+++ b/lang/en-us.js
@@ -1225,6 +1225,8 @@ window.I18N['en-us'] = {
"backup_remote_test_ok": "Connection and upload succeeded!",
"backup_remote_uploading": "Uploading \"{file}\" 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_dropbox_hint": "Direct upload via the official Dropbox Content API v2.",
"backup_btn_remote_push": "Upload to remote storage",
"backup_btn_remote_short": "Remote"
};
diff --git a/lang/fr.js b/lang/fr.js
index 6c52f0d..bbc35d1 100644
--- a/lang/fr.js
+++ b/lang/fr.js
@@ -1225,6 +1225,8 @@ window.I18N['fr'] = {
"backup_remote_test_ok": "Connexion et transfert réussis !",
"backup_remote_uploading": "Envoi de « {file} » 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_dropbox_hint": "Téléversement direct via l’API officielle Dropbox Content v2.",
"backup_btn_remote_push": "Envoyer vers le stockage distant",
"backup_btn_remote_short": "Distant"
};
|