APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
5eed2d607e
commit
ecc8e872f7
8 files changed
+82
-7
No files matched your search
@@ -36,6 +36,15 @@ COPY jeux/ /app/jeux/
|
||||
COPY jeux/ /var/www/html/jeux/
|
||||
COPY version.json /app/version.json
|
||||
COPY version.json /var/www/html/version.json
|
||||
ARG AP_GIT_COMMIT=""
|
||||
ARG BUILD_DATE=""
|
||||
ENV AP_GIT_COMMIT=${AP_GIT_COMMIT}
|
||||
RUN if [ -n "${AP_GIT_COMMIT}" ]; then \
|
||||
sed -i "s/\"commit\": *\"[^\"]*\"/\"commit\": \"${AP_GIT_COMMIT}\"/" /app/version.json /var/www/html/version.json 2>/dev/null || true; \
|
||||
fi && \
|
||||
if [ -n "${BUILD_DATE}" ]; then \
|
||||
sed -i "s/\"build_date\": *\"[^\"]*\"/\"build_date\": \"${BUILD_DATE}\"/" /app/version.json /var/www/html/version.json 2>/dev/null || true; \
|
||||
fi
|
||||
# L'API n'est plus joignable que via Apache : le HTML appelle /api sur le même port (1001)
|
||||
RUN sed -i 's#const API_URL=[^;]*;#const API_URL="";#' /app/index.html /var/www/html/index.html /app/setup.html /var/www/html/setup.html 2>/dev/null || true
|
||||
COPY apache-ap.conf /etc/apache2/sites-available/000-default.conf
|
||||
|
||||
@@ -3508,6 +3508,7 @@ def get_current_commit():
|
||||
|
||||
# 2. Sinon, lecture de version.json (conteneur Docker où .git n'est pas présent)
|
||||
for path in (
|
||||
'/data/version.json',
|
||||
os.path.join(BASE_DIR, 'version.json'),
|
||||
'/app/version.json',
|
||||
'/var/www/html/version.json',
|
||||
@@ -10725,6 +10726,30 @@ class Handler(BaseHTTPRequestHandler):
|
||||
log('modification_identifiants', f"Renommage machine -> {new_name}", request_ip(self), 'AUTH')
|
||||
self.send_json({'ok': True, 'message': 'Machine renommée avec succès', 'name': new_name})
|
||||
return
|
||||
if self.path == '/api/system/update/sync':
|
||||
if not valid_session(self) and auth_state()['configured']: self.send_json({'error':'Authentification requise'},401); return
|
||||
target_commit = str(data.get('commit', '')).strip()
|
||||
if not target_commit:
|
||||
chk = check_gitea_update(force_refresh=True)
|
||||
target_commit = chk.get('latest_commit_full') or chk.get('latest_commit') or ''
|
||||
if not target_commit:
|
||||
raise ValueError('Impossible de déterminer le dernier commit')
|
||||
v_data = {
|
||||
'version': 'V5.5',
|
||||
'commit': target_commit,
|
||||
'build_date': datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||
}
|
||||
for v_path in ('/data/version.json', os.path.join(BASE_DIR, 'version.json'), 'version.json'):
|
||||
try:
|
||||
with open(v_path, 'w', encoding='utf-8') as f:
|
||||
json.dump(v_data, f, indent=2)
|
||||
except Exception:
|
||||
pass
|
||||
with _update_lock:
|
||||
_update_cache['time'] = 0
|
||||
res = check_gitea_update(force_refresh=True)
|
||||
self.send_json({'ok': True, 'update': res, 'message': 'Synchronisé avec succès !'})
|
||||
return
|
||||
if self.path == '/api/backup/inspect':
|
||||
if not valid_session(self) and auth_state()['configured']: self.send_json({'error':'Authentification requise'},401); return
|
||||
fname = str(data.get('filename', 'sauvegarde')).strip()
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
AP-Manageur:
|
||||
build: .
|
||||
image: gitea.yoann-nas.fr/yoannmultigaming/apmanageur.git:latest
|
||||
image: gitea.yoann-nas.fr/yoannmultigaming/apmanageur:latest
|
||||
container_name: ap-manageur
|
||||
restart: unless-stopped
|
||||
network_mode: host # accès direct à la carte Wi-Fi de l'hôte (Apache sur le port 1001)
|
||||
|
||||
+36
-1
@@ -6155,11 +6155,17 @@
|
||||
commande dans le dossier de votre projet sur votre serveur hôte.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" style="justify-content:space-between">
|
||||
<div class="modal-footer" style="justify-content:space-between;flex-wrap:wrap;gap:8px">
|
||||
<div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap">
|
||||
<button type="button" class="secondary" id="btnCheckUpdateManual" onclick="triggerManualUpdateCheck()"
|
||||
style="font-size:12px">
|
||||
🔄 <span data-i18n="btn_recheck">Vérifier à nouveau</span>
|
||||
</button>
|
||||
<button type="button" class="secondary" id="btnSyncUpdateManual" onclick="syncUpdateVersion()"
|
||||
style="font-size:12px;color:var(--green);display:none" title="Marquer cette version comme installée si vous avez déjà la dernière version">
|
||||
✓ <span data-i18n="btn_mark_up_to_date">Je suis déjà à jour</span>
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="secondary" onclick="closeUpdateModal()" data-i18n="btn_close">Fermer</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -9147,6 +9153,9 @@ ${vpnBadgeTopo}
|
||||
if ($('updateDockerCmdSection')) {
|
||||
$('updateDockerCmdSection').style.display = isAvail ? 'block' : 'none';
|
||||
}
|
||||
if ($('btnSyncUpdateManual')) {
|
||||
$('btnSyncUpdateManual').style.display = isAvail ? 'inline-flex' : 'none';
|
||||
}
|
||||
modal.classList.add('active');
|
||||
}
|
||||
window.openUpdateModal = openUpdateModal;
|
||||
@@ -9201,6 +9210,32 @@ ${vpnBadgeTopo}
|
||||
}
|
||||
window.triggerManualUpdateCheck = triggerManualUpdateCheck;
|
||||
|
||||
async function syncUpdateVersion() {
|
||||
const btn = $('btnSyncUpdateManual');
|
||||
if (btn) btn.disabled = true;
|
||||
try {
|
||||
const res = await apiFetch('/api/system/update/sync', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ commit: (lastUpdateData && lastUpdateData.latest_commit_full) || '' })
|
||||
});
|
||||
const d = await res.json();
|
||||
if (res.ok && d.update) {
|
||||
lastUpdateData = d.update;
|
||||
if (status) status.update = d.update;
|
||||
updateApButtons();
|
||||
openUpdateModal();
|
||||
} else {
|
||||
alert(d.error || t('update_sync_error', 'Erreur lors de la synchronisation'));
|
||||
}
|
||||
} catch (e) {
|
||||
alert(e.message || 'Erreur');
|
||||
} finally {
|
||||
if (btn) btn.disabled = false;
|
||||
}
|
||||
}
|
||||
window.syncUpdateVersion = syncUpdateVersion;
|
||||
|
||||
async function toggleBlock(mac, blocked) {
|
||||
return runAction(async () => {
|
||||
try {
|
||||
|
||||
+3
-1
@@ -1281,5 +1281,7 @@ window.I18N['en-gb'] = {
|
||||
"update_no_msg": "No commit message",
|
||||
"update_up_to_date": "AP Manageur is up to date!",
|
||||
"update_up_to_date_desc": "You already have the latest version of the application.",
|
||||
"ap_stopped_no_restart": "AP is stopped (start required)"
|
||||
"ap_stopped_no_restart": "AP is stopped (start required)",
|
||||
"btn_mark_up_to_date": "I am already up to date",
|
||||
"update_sync_error": "Error synchronising version"
|
||||
};
|
||||
+3
-1
@@ -1281,5 +1281,7 @@ window.I18N['en-us'] = {
|
||||
"update_no_msg": "No commit message",
|
||||
"update_up_to_date": "AP Manageur is up to date!",
|
||||
"update_up_to_date_desc": "You already have the latest version of the application.",
|
||||
"ap_stopped_no_restart": "AP is stopped (start required)"
|
||||
"ap_stopped_no_restart": "AP is stopped (start required)",
|
||||
"btn_mark_up_to_date": "I am already up to date",
|
||||
"update_sync_error": "Error synchronizing version"
|
||||
};
|
||||
+3
-1
@@ -1281,5 +1281,7 @@ window.I18N['fr'] = {
|
||||
"update_no_msg": "Aucun message de commit",
|
||||
"update_up_to_date": "AP Manageur est à jour !",
|
||||
"update_up_to_date_desc": "Vous disposez déjà de la version la plus récente de l'application.",
|
||||
"ap_stopped_no_restart": "L'AP est arrêtée (démarrage requis)"
|
||||
"ap_stopped_no_restart": "L'AP est arrêtée (démarrage requis)",
|
||||
"btn_mark_up_to_date": "Je suis déjà à jour",
|
||||
"update_sync_error": "Erreur lors de la synchronisation de la version"
|
||||
};
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "V5.5",
|
||||
"commit": "ceeab6fa4a650ce9a251236971661bc4b39c321f",
|
||||
"build_date": "2026-11-21T03:30:00Z"
|
||||
"commit": "5eed2d607e7e5f5502e783578497747982bde5de",
|
||||
"build_date": "2026-11-21T04:49:09Z"
|
||||
}
|
||||
Reference in new issue
Block a user