APmanageur Wi-Fi V1.0

This commit is contained in:
yoannmultigaming committed 2026-11-18 20:21:09 +01:00
1 parent 6f048ad433
commit aa0f3f4856
6 files changed
+116 -7

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="100%" height="100%">
<path fill="#0061FF" d="M6 1.807L0 5.629l6 3.822 6.001-3.822L6 1.807zM18 1.807l-6 3.822 6 3.822 6-3.822-6-3.822zM0 13.274l6 3.822 6.001-3.822L6 9.452l-6 3.822zM18 9.452l-6 3.822 6 3.822 6-3.822-6-3.822zM6 18.371l6.001 3.822 6-3.822-6-3.822L6 18.371z"/>
</svg>

After

Width:  |  Height:  |  Size: 350 B

+8
View File
@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 457" width="100%" height="100%">
<path fill="#0066DA" d="M37.7 392.1l22 38.1c4.6 8 11.2 14.3 18.9 18.9q33.2-42.2 46.2-64.8q13.2-22.9 32.5-71.6q-52-6.9-78.7-6.9q-25.7 0-78.8 6.9c0 8.9 2.3 17.8 6.9 25.8z"/>
<path fill="#EA4335" d="M421 440.1c7.7-4.6 14.3-10.9 18.9-18.9l9.2-15.8l43.8-75.9a51.9 51.9 0 0 0 6.9-25.8q-53.3-6.9-78.5-6.9q-27.1 0-78.5 6.9q19 49 32.1 71.6q13.1 22.8 46.4 64.8"/>
<path fill="#00832D" d="M256 143.1q38.4-46.4 53-71.6q11.7-20.3 25.8-64.8C320.4 2.3 311.5 0 302.4 0h-105.8c-9.1 0-18 2.6-25.7 6.9q17.9 51 30.4 72.6q13.8 23.9 48.4 63.6"/>
<path fill="#2684FC" d="M348.5 303.8H163.5L84.6 440.2c7.7 4.6 16.6 6.9 25.8 6.9h291.2c9.2 0 18-2.6 25.8-6.9z"/>
<path fill="#00AC47" d="M256 143.1L167.4 6.9C159.7 11.5 153.1 17.8 148.5 25.8L6.9 277.9A51.9 51.9 0 0 0 0 303.8h163.5z"/>
<path fill="#FFBA00" d="M420.2 151.8L347.4 25.8c-4.6-8-11.2-14.3-18.9-18.9L225.3 143.1l92.5 160.7h157.2c0-8.9-2.3-17.8-6.9-25.8z"/>
</svg>

After

Width:  |  Height:  |  Size: 999 B

+99 -7
View File
@@ -4876,9 +4876,37 @@
</div>
<div id="backupRemoteBody">
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;align-items:end;margin-bottom:14px">
<div>
<label class="label" for="backupRemoteProvider" data-i18n="backup_remote_provider_label">Destination distante</label>
<div style="margin-bottom:14px">
<label class="label" for="backupRemoteProvider" data-i18n="backup_remote_provider_label" style="margin-bottom:8px">Destination distante</label>
<!-- Grille de sélection rapide du fournisseur avec les vrais logos officiels -->
<div id="backupProviderSelector" style="display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px">
<button type="button" class="backup-prov-btn secondary" data-provider="ftp" onclick="selectBackupRemoteProvider('ftp')" style="padding:6px 12px;font-size:12px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer">
📡 <span>FTP / FTPS</span>
</button>
<button type="button" class="backup-prov-btn secondary" data-provider="sftp" onclick="selectBackupRemoteProvider('sftp')" style="padding:6px 12px;font-size:12px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer">
🔐 <span>SFTP (SSH)</span>
</button>
<button type="button" class="backup-prov-btn secondary" data-provider="gdrive" onclick="selectBackupRemoteProvider('gdrive')" style="padding:6px 12px;font-size:12px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer">
<img src="/images/gdrive.svg" width="16" height="15" alt="Google Drive" style="object-fit:contain;vertical-align:middle">
<span>Google Drive</span>
</button>
<button type="button" class="backup-prov-btn secondary" data-provider="dropbox" onclick="selectBackupRemoteProvider('dropbox')" style="padding:6px 12px;font-size:12px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer">
<img src="/images/dropbox.svg" width="16" height="16" alt="Dropbox" style="object-fit:contain;vertical-align:middle">
<span>Dropbox</span>
</button>
<button type="button" class="backup-prov-btn secondary" data-provider="webdav" onclick="selectBackupRemoteProvider('webdav')" style="padding:6px 12px;font-size:12px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer">
🌐 <span>WebDAV</span>
</button>
<button type="button" class="backup-prov-btn secondary" data-provider="s3" onclick="selectBackupRemoteProvider('s3')" style="padding:6px 12px;font-size:12px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer">
🪣 <span>S3 / MinIO</span>
</button>
<button type="button" class="backup-prov-btn secondary" data-provider="webhook" onclick="selectBackupRemoteProvider('webhook')" style="padding:6px 12px;font-size:12px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer">
🔗 <span>Webhook</span>
</button>
</div>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;align-items:center">
<select id="backupRemoteProvider" onchange="onBackupRemoteProviderChange()" style="margin-bottom:0">
<option value="ftp">📡 Serveur FTP / FTPS</option>
<option value="sftp">🔐 Serveur SFTP (SSH)</option>
@@ -4888,12 +4916,12 @@
<option value="s3">🪣 S3 / MinIO / Compatible S3</option>
<option value="webhook">🔗 Webhook HTTP (POST / PUT)</option>
</select>
</div>
<label style="display:inline-flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;padding:8px 0;user-select:none">
<input type="checkbox" id="backupRemoteAutoUpload" checked style="width:auto;margin:0">
<span data-i18n="backup_remote_autoupload">Transférer automatiquement à chaque sauvegarde (Cron &amp; manuelle)</span>
</label>
</div>
</div>
<!-- FTP / FTPS -->
<div id="remoteFields_ftp" class="remote-provider-fields" style="background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:14px">
@@ -4934,6 +4962,13 @@
<!-- Google Drive -->
<div id="remoteFields_gdrive" class="remote-provider-fields" style="display:none;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:14px">
<div style="display:flex;align-items:center;gap:12px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--line)">
<img src="/images/gdrive.svg" width="32" height="29" alt="Google Drive" style="object-fit:contain;flex-shrink:0">
<div>
<strong style="font-size:14px;display:flex;align-items:center;gap:8px">Google Drive (API v3)</strong>
<div class="muted" style="font-size:12px" data-i18n="backup_remote_gdrive_hint">Téléversement direct via l’API officielle Google Drive (REST v3 multipart).</div>
</div>
</div>
<div style="display:grid;grid-template-columns:2fr 1fr;gap:10px">
<div><label class="label" for="remoteGdriveToken" data-i18n="backup_remote_token">Jeton d’accès OAuth2 (Access Token)</label><input id="remoteGdriveToken" type="password" placeholder="ya29.a0..."></div>
<div><label class="label" for="remoteGdriveFolder" data-i18n="backup_remote_gdrive_folder">ID du dossier Drive (facultatif)</label><input id="remoteGdriveFolder" type="text" placeholder="1AbCdEfGhIjKlMnOp..."></div>
@@ -4942,6 +4977,13 @@
<!-- Dropbox -->
<div id="remoteFields_dropbox" class="remote-provider-fields" style="display:none;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:14px">
<div style="display:flex;align-items:center;gap:12px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--line)">
<img src="/images/dropbox.svg" width="32" height="32" alt="Dropbox" style="object-fit:contain;flex-shrink:0">
<div>
<strong style="font-size:14px;display:flex;align-items:center;gap:8px">Dropbox (API v2)</strong>
<div class="muted" style="font-size:12px" data-i18n="backup_remote_dropbox_hint">Téléversement direct via l’API officielle Dropbox Content v2.</div>
</div>
</div>
<div style="display:grid;grid-template-columns:2fr 1fr;gap:10px">
<div><label class="label" for="remoteDropboxToken" data-i18n="backup_remote_token">Jeton d’accès (Access Token Dropbox)</label><input id="remoteDropboxToken" type="password" placeholder="sl.B..."></div>
<div><label class="label" for="remoteDropboxPath" data-i18n="backup_remote_path">Dossier distant</label><input id="remoteDropboxPath" type="text" value="/AP-Manageur-Backups/" placeholder="/AP-Manageur-Backups/"></div>
@@ -10757,6 +10799,8 @@ ${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 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, '&#39;');
@@ -10773,7 +10817,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'))}">☁️ ${escapeHtml(t('backup_btn_remote_short', 'Distant'))}</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>
<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>
@@ -10984,6 +11028,21 @@ ${vpnBadgeTopo}
}
}
function getRemoteProviderIconHtml(prov) {
if (prov === 'gdrive') return '<img src="/images/gdrive.svg" width="13" height="12" alt="Drive" style="vertical-align:middle;margin-right:4px;object-fit:contain">';
if (prov === 'dropbox') return '<img src="/images/dropbox.svg" width="13" height="13" alt="Dropbox" style="vertical-align:middle;margin-right:4px;object-fit:contain">';
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', {
+2
View File
@@ -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"
};
+2
View File
@@ -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"
};
+2
View File
@@ -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"
};