synchro du labo (0bf0da65) : app.blade.php, README.md

This commit is contained in:
cloudion 2026-11-03 22:39:27 +00:00
parent 7569ef7c38
commit 4632a4178c
2 changed files with 653 additions and 2 deletions

View File

@ -1,3 +1,21 @@
# ploxion-installer # 📥 Installer
PLOXION · UN SEUL endroit pour installer le xerboxion : cet appareil (détection → la recette en un bouton + « installer comme app »), tout le catalogue (Windows portable / msi / PowerShell, APK, iPhone, apt, ISO, extension, Rosa — tailles et dates réelles), faire un boxion (6 étapes + le lien avec/sans agent + relier), admin (activer / désactiver chaque élément, ex. l'ISO, sans redéploiement). Lit /px/installer/catalogue.json. · fournit: installer, telechargements, downloads, boxion-new, lier-boxion, premier-boxion, a2hs UN SEUL endroit pour installer le xerboxion : cet appareil (détection → la recette en un bouton + « installer comme app »), tout le catalogue (Windows portable / msi / PowerShell, APK, iPhone, apt, ISO, extension, Rosa — tailles et dates réelles), faire un boxion (6 étapes + le lien avec/sans agent + relier), admin (activer / désactiver chaque élément, ex. l'ISO, sans redéploiement). Lit /px/installer/catalogue.json.
| | |
| --- | --- |
| id | `installer` |
| fournit | `installer` `telechargements` `downloads` `boxion-new` `lier-boxion` `premier-boxion` `a2hs` |
| bions qu'il nomme | `jOSAppareil` `jOSApps` `jOSBoxion` `jOSMobile` `jOSPorts` `jOSXion` |
| fichiers | `app.blade.php` |
| dans le labo | `resources/views/ploxions/installer/` (dépôt `my_website2`) |
## Contribuer
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=installer — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
- **Dans VS Code** : `xb prendre installer` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
© 2026 chill-tekk · ne pas nuire

633
app.blade.php Normal file
View File

@ -0,0 +1,633 @@
{{-- PL0XION installer 📥 — UN SEUL ploxion pour tout installer (plan docs/plans/installer-unique-v0.md §2, 19.09.2026).
Fusion (règle « 2 similaires → FUSIONNER », alias rétro-compat) : dl / download (le catalogue), nouveau-boxion (le lien,
avec ou sans agent), lier-boxion (relier : pull + deploy), premier-boxion (les 6 étapes — même clé de progression
xb:premier-boxion, rien ne se perd), reglages › install 📲 (section « cet appareil » montée en embed).
4 sections navigables (?section= / ctx.section / ctx.params.section) : appareil · catalogue · boxion (?etape=lien|relier|…)
· admin (interrupteurs actif/inactif, visible si meta user-admin=1).
Source : GET /px/installer/catalogue.json (contrat v:1, elements[]) → repli /downloads/releases.json (components × releases
normalisés) → dernier repli SECOURS (les 15 éléments du contrat en dur, sans tailles). Admin : POST /px/installer/actif
avec id + actif via jOSb.postJSON (X-CSRF-TOKEN) ; ?tout=1 pour voir les inactifs.
Windows (19.09, RS-7 « je veux avoir le choix : tout, que le boxion, que le xer ») : 3 msi = xerboxion-win64-msi (tout),
-msi-boxion, -msi-xer ; RECETTES.windows = msi tout, zip, msi boxion, msi xer, install-ps1 ; la section « cet appareil »
montre sous la recette le TRIO Tout / Boxion / Xer (MSI[]) : ce que chaque mode installe + le .msi (ou « bientôt »).
Bions : jOSAppareil.get(), jOSXion.enabled() / etat(), jOSiOS.canInstall() / install(), jOSb (esc, copy, toast, postJSON),
jOSBoxion (progression cross-device), jOSPorts (ploxion.installer.cmd / telecharge / actif). describe() = XUI p1-p3. --}}
<style>
.ins{display:flex;flex-direction:column;height:100%;background:var(--xr-bg,#070a0d);color:var(--xr-fg,#dfe8ee);font-family:var(--xr-font-ui,system-ui);font-size:.87rem}
.ins--embed{height:auto;background:transparent}
.ins__h{flex:0 0 auto;padding:12px 14px 0;border-bottom:1px solid var(--xr-line,#16232c)}
.ins__ht{display:flex;align-items:baseline;gap:8px;font-weight:800;color:var(--xr-accent,#6fd3c7);flex-wrap:wrap}
.ins__ht small{color:var(--xr-muted,#5a7784);font-weight:400;font-size:.7rem}
.ins__tabs{display:flex;gap:6px;overflow-x:auto;padding:10px 0 8px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.ins__tabs::-webkit-scrollbar{display:none}
.ins__tab{flex:0 0 auto;cursor:pointer;font:inherit;font-size:.8rem;font-weight:700;padding:8px 13px;min-height:38px;border-radius:999px;border:1px solid var(--xr-line,#1d3540);background:var(--xr-card,#0c1218);color:#8aa2ad}
.ins__tab.on{border-color:#12a594;background:rgba(18,165,148,.16);color:#8fe6d8}
.ins__body{flex:1;min-height:0;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:12px}
.ins--embed .ins__body{padding:4px 0 0;overflow:visible}
.ins__sec{display:flex;flex-direction:column;gap:12px}
.ins__hero{display:flex;align-items:center;gap:12px;padding:14px;border:1px solid #1e5c50;border-radius:14px;background:rgba(18,165,148,.07)}
.ins__hero-ic{font-size:2rem;flex:0 0 auto}
.ins__hero b{display:block}
.ins__hero small{display:block;color:var(--xr-muted,#5a7784);font-size:.72rem;margin-top:2px}
.ins__lbl{font-size:.68rem;color:var(--xr-muted,#5a7784);text-transform:uppercase;letter-spacing:.06em}
.ins__hint{margin:0;font-size:.78rem;line-height:1.55;color:#9fb6be}
.ins__card{border:1px solid var(--xr-line,#16232c);border-radius:14px;background:var(--xr-card,#0c1218);padding:12px 14px;display:flex;flex-direction:column;gap:10px}
.ins__card.off{opacity:.55}
.ins__card.reco{border-color:#12a594;box-shadow:0 0 0 1px rgba(18,165,148,.25)}
.ins__top{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.ins__ic{font-size:1.6rem;width:36px;text-align:center;flex:0 0 auto}
.ins__t{flex:1;min-width:140px}
.ins__t b{display:block;font-size:.95rem}
.ins__t small{display:block;color:var(--xr-muted,#5a7784);font-size:.7rem;margin-top:2px}
.ins__badge{flex:0 0 auto;font-size:.64rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase;padding:3px 8px;border-radius:20px;border:1px solid #26355c;background:#15233f;color:#7cc4ff}
.ins__badge.soon{border-color:#5a3f20;background:#241a10;color:#e0a56a}
.ins__badge.off{border-color:#4a2a2a;background:#1e1010;color:#e08a8a}
.ins__note{margin:0;font-size:.78rem;line-height:1.5;color:#9fb6be}
.ins__note b{color:var(--xr-fg,#dfe8ee)}
.ins__act{display:flex;gap:8px;flex-wrap:wrap}
.ins__btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;cursor:pointer;font:inherit;font-weight:800;font-size:.9rem;padding:12px 18px;min-height:44px;border-radius:11px;border:1px solid #2a6f66;background:linear-gradient(180deg,#12a594,#0c7d70);color:#04110f;text-decoration:none;flex:1 1 auto;box-sizing:border-box}
.ins__btn.ghost{background:transparent;color:#8fe6d8}
.ins__btn:active{transform:scale(.98)}
.ins__cmd{position:relative;background:#05080a;border:1px solid #1d3540;border-radius:10px;padding:12px 12px 46px}
.ins__cmd pre{margin:0;font-family:var(--xr-font-mono,ui-monospace,monospace);font-size:.8rem;line-height:1.5;color:#8fe6d8;white-space:pre-wrap;word-break:break-word}
.ins__cp{position:absolute;right:8px;bottom:8px;cursor:pointer;font:inherit;font-size:.76rem;font-weight:700;padding:6px 10px;min-height:32px;border-radius:8px;border:1px solid #2a6f66;background:#0c2a26;color:#8fe6d8}
.ins__cp.ok{background:#134d33;border-color:#2a8f5e;color:#8fe89f}
.ins__chips{display:flex;gap:6px;flex-wrap:wrap}
.ins__chip{cursor:pointer;font:inherit;font-size:.76rem;font-weight:700;padding:7px 12px;min-height:34px;border-radius:999px;border:1px solid var(--xr-line,#1d3540);background:var(--xr-card,#0c1218);color:#8aa2ad}
.ins__chip.on{border-color:#12a594;background:rgba(18,165,148,.14);color:#8fe6d8}
.ins__sw{position:relative;flex:0 0 auto;width:48px;height:28px;padding:0;border-radius:20px;cursor:pointer;border:1px solid rgba(255,255,255,.08);background:rgba(90,100,130,.4);transition:background .15s}
.ins__sw::after{content:'';position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:left .15s}
.ins__sw.on{background:rgba(18,165,148,.85)} .ins__sw.on::after{left:23px}
.ins__sw[aria-disabled=true]{opacity:.4;cursor:not-allowed}
.ins__lien{font-family:var(--xr-font-mono,ui-monospace,monospace);font-size:.88rem;line-height:1.5;background:#05080a;border:1px solid #1d3540;border-radius:10px;padding:12px;color:#8fe6d8;word-break:break-all;user-select:all}
.ins__big{cursor:pointer;font:inherit;font-weight:800;font-size:1rem;padding:15px;min-height:54px;border-radius:12px;border:1px solid #2a6f66;background:linear-gradient(180deg,#12a594,#0c7d70);color:#04110f}
.ins__big.ok{background:linear-gradient(180deg,#4ad991,#22b673);border-color:#2a8f5e}
.ins__bar{height:8px;border-radius:99px;background:var(--xr-card,#0c1218);border:1px solid var(--xr-line,#16232c);overflow:hidden}
.ins__fill{height:100%;width:0;border-radius:99px;background:linear-gradient(90deg,#0c7d70,#12a594);transition:width .4s}
.ins__st{border:1px solid var(--xr-line,#16232c);border-radius:14px;background:var(--xr-card,#0c1218);overflow:hidden}
.ins__st.done{border-color:#1e5c50}
.ins__sth{display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;user-select:none;min-height:48px;box-sizing:border-box}
.ins__num{flex:0 0 auto;width:26px;height:26px;border-radius:50%;background:#12323b;color:var(--xr-accent,#6fd3c7);font-weight:800;font-size:.74rem;display:flex;align-items:center;justify-content:center}
.ins__st.done .ins__num{background:#0f3d33;color:#4ad991}
.ins__stt{flex:1;min-width:0} .ins__stt b{display:block} .ins__stt small{color:var(--xr-muted,#5a7784);font-size:.7rem}
.ins__chev{color:var(--xr-muted,#5a7784);font-size:.7rem}
.ins__stb{display:none;padding:2px 14px 14px;border-top:1px solid var(--xr-line,#16232c)}
.ins__st.open .ins__stb{display:flex;flex-direction:column;gap:10px}
.ins__p{line-height:1.55;color:#b7c6cf;margin:8px 0 0} .ins__p b{color:var(--xr-fg,#dfe8ee)}
.ins__see{background:rgba(18,165,148,.06);border:1px dashed #1d4a44;border-radius:10px;padding:10px 12px;font-size:.76rem;line-height:1.55;color:#9fb6be}
.ins__see b{color:var(--xr-accent,#6fd3c7)}
.ins__see pre{margin:6px 0 0;font-family:var(--xr-font-mono,ui-monospace,monospace);font-size:.72rem;color:#7fc9bd;white-space:pre-wrap}
.ins__opts{display:flex;gap:10px;flex-wrap:wrap}
.ins__opt{flex:1 1 200px;border:1px solid var(--xr-line,#16232c);border-radius:12px;padding:12px;background:rgba(255,255,255,.015)}
.ins__opt b{display:flex;align-items:center;gap:6px} .ins__opt .c{margin-left:auto;font-size:.7rem;font-weight:800;color:#e8c86f}
.ins__opt p{margin:6px 0 0;font-size:.76rem;line-height:1.5;color:#9fb6be}
.ins__opt.reco{border-color:#12a594;box-shadow:0 0 0 1px rgba(18,165,148,.25)}
.ins__opt .ins__act{margin-top:10px} .ins__opt .ins__btn{padding:9px 12px;min-height:38px;font-size:.8rem}
.ins__opt .ins__note{margin-top:10px}
.ins__doneb{cursor:pointer;font:inherit;font-weight:700;font-size:.8rem;padding:10px 14px;min-height:42px;border-radius:10px;border:1px solid #2a6f66;background:transparent;color:#8fe6d8;align-self:flex-start}
.ins__doneb.on{background:#0f3d33;border-color:#2a8f5e;color:#8fe89f}
.ins__in{display:flex;gap:8px;flex-wrap:wrap}
.ins__in input{flex:1;min-width:160px;font:inherit;font-size:.86rem;padding:11px 12px;border-radius:10px;border:1px solid #1d3540;background:#05080a;color:var(--xr-fg,#dfe8ee)}
.ins__in button{cursor:pointer;font:inherit;font-weight:800;padding:11px 16px;min-height:44px;border-radius:10px;border:1px solid #2a6f66;background:linear-gradient(180deg,#12a594,#0c7d70);color:#04110f}
.ins__res{border-radius:10px;padding:11px 12px;font-size:.8rem;line-height:1.5;display:none}
.ins__res.ok{display:block;background:rgba(74,217,145,.08);border:1px solid #2a8f5e;color:#8fe89f}
.ins__res.ko{display:block;background:rgba(224,110,110,.07);border:1px solid #7a3030;color:#e0a3a3}
.ins__res.wait{display:block;background:rgba(232,200,111,.06);border:1px solid #6f5a2a;color:#e8c86f}
.ins__ta{width:100%;box-sizing:border-box;min-height:84px;font-family:var(--xr-font-mono,ui-monospace,monospace);font-size:.74rem;padding:10px;border-radius:10px;border:1px solid #1d3540;background:#05080a;color:#8fe6d8;resize:vertical}
.ins__path{display:block;width:100%;box-sizing:border-box;margin-top:4px;font-family:var(--xr-font-mono,ui-monospace,monospace);font-size:.8rem;padding:9px 10px;border-radius:9px;border:1px solid #1d3540;background:#05080a;color:#8fe6d8}
.ins__win{border:1px solid #2a8f5e;border-radius:14px;background:rgba(74,217,145,.06);padding:14px;text-align:center;font-weight:800;color:#8fe89f}
.ins__links{display:flex;gap:8px;flex-wrap:wrap}
.ins__lk{cursor:pointer;font:inherit;font-size:.74rem;padding:8px 12px;min-height:36px;border-radius:999px;border:1px solid var(--xr-line,#1d3540);background:var(--xr-card,#0c1218);color:#8aa2ad;text-decoration:none;display:inline-flex;align-items:center}
.ins__empty{color:#8fa2cc;font-size:.86rem;padding:14px 4px}
.ins__foot{font-size:.66rem;color:var(--xr-muted,#5a7784);padding:4px 0 8px}
.ins__grid{display:flex;flex-direction:column;gap:12px}
@media (min-width:720px){ .ins__grid{display:grid;grid-template-columns:1fr 1fr} .ins__btn{flex:0 1 auto} }
</style>
<script>
(function () {
'use strict';
var ID = 'installer';
var CAT = '/px/installer/catalogue.json', REL = '/downloads/releases.json', ACTIF = '/px/installer/actif';
var KEY = 'xb:premier-boxion'; // progression des 6 étapes — même clé que l'ex-premier-boxion : rien ne se perd
var SECTIONS = [['appareil', '📱', 'Cet appareil'], ['catalogue', '🗂', 'Catalogue'], ['boxion', '🖥️', 'Faire un boxion'], ['admin', '👑', 'Admin']];
var PLATS = { windows: '🪟 Windows', android: '🤖 Android', ios: '🍏 iPhone', linux: '🐧 Linux', mac: '🍎 Mac', iso: '💿 ISO', docker: '🐳 Docker', web: '🌐 Web', tous: '✦ Tous' };
var TYPES_N = { pc: 'ordinateur', telephone: 'téléphone', tablette: 'tablette', montre: 'montre', kion: 'kion', cubion: 'cubion', esp: 'ESP', raspberry: 'Raspberry', tv: 'télé', borne: 'borne' };
var OS_N = { windows: 'Windows', android: 'Android', ios: 'iPhone / iPad', linux: 'Linux', mac: 'Mac', autre: 'appareil' };
var OS_I = { windows: '🪟', android: '🤖', ios: '🍏', linux: '🐧', mac: '🍎', autre: '📱' };
// la recette par OS : les ids du contrat, dans l'ordre de préférence (le premier présent + actif gagne)
var RECETTES = { windows: ['xerboxion-win-app', 'xer-bevy-windows', 'xerboxion-win64-msi', 'xerboxion-win64-zip', 'xerboxion-win64-msi-boxion', 'xerboxion-win64-msi-xer', 'install-ps1'], android: ['ploxi0n-apk', 'xerboxion-apk', 'ios-a2hs'], ios: ['ios-a2hs'], linux: ['xerboxion-linux-deb', 'xerboxion-pi-deb', 'apt-setup', 'boxion-new'], mac: ['xerboxion-mac-dmg', 'mac-dock', 'contribuer', 'xerboxion-mac-zip', 'xerboxion-source-zip'], autre: [] };
// releases.json (repli) : fichier → id du contrat
var FICHIER_ID = { '/downloads/xerboxion-win64.zip': 'xerboxion-win64-zip', '/downloads/xerboxion-win64.msi': 'xerboxion-win64-msi', '/downloads/xerboxion-win64-boxion.msi': 'xerboxion-win64-msi-boxion', '/downloads/xerboxion-win64-xer.msi': 'xerboxion-win64-msi-xer', '/downloads/xerboxion-w11.msi': 'xerboxion-w11-msi', '/downloads/xerboxion-windows.zip': 'xerboxion-windows-zip', '/downloads/xerboxion.iso': 'xerboxion-iso', '/downloads/xerboxion.apk': 'xerboxion-apk', '/downloads/xerhud-extension.zip': 'xerhud-extension', '/downloads/rosa-launcher.exe': 'rosa-launcher', '/apt/xer-core.exe': 'xer-core-exe' };
// le TRIO Windows (msi) : le mode que `xion init --mode …` écrit dans xerboxion.json, et ce que chaque mode installe
var MSI = [
{ id: 'xerboxion-win64-msi', mode: 'xerboxion', t: 'Tout', ic: '▢', d: 'cœur (xion.exe) + dossier xerboxion + fenêtres — le xerboxion complet sur ce PC.' },
{ id: 'xerboxion-win64-msi-boxion', mode: 'boxion', t: 'Boxion', ic: '△', d: 'le cœur qui sert les autres appareils, pas de fenêtre — ce PC devient un nœud.' },
{ id: 'xerboxion-win64-msi-xer', mode: 'xer', t: 'Xer', ic: '○', d: 'les fenêtres seulement, vers un boxion existant (le tien ou le nexus).' }
];
var CACHE = null; // dernier catalogue chargé (describe() hors montage)
var LIVE = null; // posé au mount : { els, dev }
function esc(s) { if (window.jOSb && window.jOSb.esc) return window.jOSb.esc(s); var d = document.createElement('div'); d.textContent = (s == null ? '' : s); return d.innerHTML; }
function O() { return location.origin || 'https://labo.j0bot.ch'; }
function isAdmin() {
try { var m = document.querySelector('meta[name="user-admin"]'); if (m && m.getAttribute('content') === '1') return true; } catch (e0) {}
try { if (window.__ADMIN__ === true) return true; } catch (e1) {}
try { if (document.documentElement.getAttribute('data-admin') === '1') return true; } catch (e2) {}
return false;
}
function human(n) { n = +n || 0; if (!n) return ''; return n >= 1048576 ? (n / 1048576).toFixed(1) + ' Mo' : Math.max(1, Math.round(n / 1024)) + ' Ko'; }
function dateCourte(iso) { try { var d = new Date(iso); if (isNaN(d.getTime())) return ''; return ('0' + d.getDate()).slice(-2) + '.' + ('0' + (d.getMonth() + 1)).slice(-2) + '.' + d.getFullYear(); } catch (e) { return ''; } }
function qs(k) { try { return new URLSearchParams(location.search).get(k); } catch (e) { return null; } }
function csrf() { try { if (window.jOSb && window.jOSb.csrf) return window.jOSb.csrf(); var m = document.querySelector('meta[name=csrf-token]'); return m ? m.getAttribute('content') : ''; } catch (e) { return ''; } }
function toast(host, m) { try { if (window.jOSb && window.jOSb.toast) return window.jOSb.toast(host, m); } catch (e0) {} try { if (window.jOS && window.jOS.toast) window.jOS.toast(m); } catch (e1) {} }
function openPx(id) {
try { if (window.jOSui && window.jOSui.tier && window.jOSui.tier() === 'mobile' && window.jOSMobile && window.jOSMobile.open) { window.jOSMobile.open(id, id); return; } } catch (e0) {}
try { if (window.jOS && window.jOS.openPloxion) { window.jOS.openPloxion(id); return; } } catch (e1) {}
try { location.href = '/px/' + id; } catch (e2) {}
}
function copier(txt, btn, lbl) {
lbl = lbl || '📋 copier';
function done() { if (!btn) return; btn.classList.add('ok'); btn.textContent = '✅ copié'; setTimeout(function () { btn.classList.remove('ok'); btn.textContent = lbl; }, 1600); }
function fb() { try { var ta = document.createElement('textarea'); ta.value = txt; ta.style.position = 'fixed'; ta.style.opacity = '0'; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); done(); } catch (e) { if (btn) btn.textContent = 'sélectionne puis copie'; } }
try {
if (window.jOSb && window.jOSb.copy) { var p = window.jOSb.copy(txt); if (p && p.then) p.then(done).catch(fb); else done(); }
else if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(txt).then(done).catch(fb);
else fb();
} catch (e) { fb(); }
}
function fetchJSON(url) {
return fetch(url, { cache: 'no-store', credentials: 'same-origin', headers: { 'Accept': 'application/json' } }).then(function (r) { if (!r || !r.ok) throw new Error('http ' + url); return r.json(); });
}
// ---- un élément du contrat, normalisé (accepte aussi les clés anglaises d'une release) ----
function normaliser(e) {
e = e || {};
var n = {
id: String(e.id || ''), nom: e.nom || e.name || e.id || '', icone: e.icone || e.icon || '▢',
plateforme: e.plateforme || e.platform || 'tous',
genre: e.genre || ((e.commande || e.cmd) ? 'commande' : (e.url ? 'lien' : ((e.fichier || e.file) ? 'fichier' : 'lien'))),
fichier: e.fichier || e.file || null, url: e.url || null, commande: e.commande || e.cmd || null,
version: e.version || '', note: e.note || '', taille: +e.taille || +e.size || 0, date: e.date || null,
actif: (typeof e.actif === 'boolean') ? e.actif : (e.actif_defaut !== false),
present: (e.present === false ? false : (e.present === true ? true : null)),
recommande_pour: Array.isArray(e.recommande_pour) ? e.recommande_pour : []
};
if (n.commande) n.commande = String(n.commande).split('{O}').join(O());
return n;
}
// ---- repli 1 : releases.json (components × releases) → éléments ----
function normaliserReleases(j) {
var out = [];
(j.components || []).forEach(function (c) {
(c.releases || []).forEach(function (r, i) {
var plat = r.platform === 'source' ? 'tous' : (r.platform || 'tous');
var id = (r.file && FICHIER_ID[r.file]) || (c.id + '-' + plat + (r.kind ? '-' + r.kind : '') + (i ? '-' + i : ''));
out.push(normaliser({ id: id, nom: c.name + ' · ' + (r.label || plat), icone: c.icon, plateforme: plat, fichier: r.file || null, commande: r.cmd || null,
version: r.version || j.version || '', note: r.note || c.tagline || '', taille: r.size || 0, present: r.status === 'soon' ? false : null, actif: r.status !== 'soon' }));
});
});
return out;
}
// ---- repli 2 : les éléments du contrat en dur (ni catalogue.json ni releases.json ne répondent) — présence inconnue ----
function SECOURS() {
var o = O();
return [
{ id: 'xerboxion-win64-msi', nom: 'Installeur Windows — tout le système', icone: '🪟', plateforme: 'windows', genre: 'fichier', fichier: '/downloads/xerboxion-win64.msi', note: 'cœur + dossier xerboxion + fenêtres, installé pour toi seul (LOCALAPPDATA\\Programs) + raccourcis menu / bureau', recommande_pour: ['pc', 'portable'] },
{ id: 'xerboxion-win64-zip', nom: 'Windows portable', icone: '🪟', plateforme: 'windows', genre: 'fichier', fichier: '/downloads/xerboxion-win64.zip', note: 'Windows portable : cœur + ploxions + lanceur 3 écrans', recommande_pour: ['pc'] },
{ id: 'xerboxion-win64-msi-boxion', nom: 'Installeur Windows — boxion seulement', icone: '△', plateforme: 'windows', genre: 'fichier', fichier: '/downloads/xerboxion-win64-boxion.msi', note: 'le cœur qui sert les autres appareils, sans fenêtre', recommande_pour: ['pc', 'portable'] },
{ id: 'xerboxion-win64-msi-xer', nom: 'Installeur Windows — xer seulement', icone: '○', plateforme: 'windows', genre: 'fichier', fichier: '/downloads/xerboxion-win64-xer.msi', note: 'les fenêtres seulement, vers un boxion existant', recommande_pour: ['pc', 'portable'] },
{ id: 'install-ps1', nom: 'Windows en une ligne (PowerShell)', icone: '🪟', plateforme: 'windows', genre: 'commande', commande: 'irm ' + o + '/apt/install.ps1 | iex', note: 'colle dans PowerShell', recommande_pour: ['pc'] },
{ id: 'xerboxion-apk', nom: 'Android (APK)', icone: '🤖', plateforme: 'android', genre: 'fichier', fichier: '/downloads/xerboxion.apk', note: 'le launcher Android', recommande_pour: ['telephone', 'tablette'] },
{ id: 'ios-a2hs', nom: 'iPhone : sur l\'écran d\'accueil', icone: '🍏', plateforme: 'ios', genre: 'a2hs', note: 'Partager ▸ Sur l\'écran d\'accueil — plein écran, hors-ligne (PWA)', recommande_pour: ['telephone', 'tablette'] },
{ id: 'apt-setup', nom: 'Linux · apt signé', icone: '🐧', plateforme: 'linux', genre: 'commande', commande: 'curl -fsSL ' + o + '/apt/setup.sh | sudo bash', note: 'puis : sudo apt install xerboxion', recommande_pour: ['pc', 'raspberry'] },
{ id: 'boxion-new', nom: 'Nouveau boxion (avec agent)', icone: '🔗', plateforme: 'linux', genre: 'commande', commande: 'curl -fsSL ' + o + '/boxion/new | bash', note: 'ton propre serveur : enrôlement par code, zéro SSH', recommande_pour: ['raspberry'] },
{ id: 'xerboxion-iso', nom: 'ISO bootable', icone: '💿', plateforme: 'iso', genre: 'fichier', fichier: '/downloads/xerboxion.iso', note: 'QEMU / VirtualBox / clé USB — boote sur une machine nue', recommande_pour: [] },
{ id: 'xerhud-extension', nom: 'Extension navigateur (xerhud)', icone: '🧩', plateforme: 'web', genre: 'fichier', fichier: '/downloads/xerhud-extension.zip', note: 'le HUD dans Chrome / Edge', recommande_pour: [] },
{ id: 'rosa-launcher', nom: 'Rosa · launcher Windows', icone: '🕳', plateforme: 'windows', genre: 'fichier', fichier: '/downloads/rosa-launcher.exe', note: 'le réseau de neurones local (le Xerbion)', recommande_pour: [] },
{ id: 'xer-core-exe', nom: 'xer-core.exe (CLI)', icone: '○', plateforme: 'windows', genre: 'fichier', fichier: '/apt/xer-core.exe', note: 'le cœur Rust seul (xer-core status)', recommande_pour: [] },
{ id: 'xerboxion-w11-msi', nom: 'Ancien launcher Windows 11 (.msi)', icone: '🪟', plateforme: 'windows', genre: 'fichier', fichier: '/downloads/xerboxion-w11.msi', note: 'launcher WebView2 seul (hors ligne impossible) — remplacé par le portable', actif: false, recommande_pour: [] },
{ id: 'xerboxion-windows-zip', nom: 'Ancien launcher Windows (.zip)', icone: '🪟', plateforme: 'windows', genre: 'fichier', fichier: '/downloads/xerboxion-windows.zip', note: 'ancien launcher — remplacé par le portable', actif: false, recommande_pour: [] }
].map(normaliser);
}
function charger(admin, cb) {
fetchJSON(CAT + (admin ? '?tout=1' : '')).then(function (j) {
if (j && j.v === 1 && Array.isArray(j.elements)) return { source: 'catalogue', version: j.version || '', elements: j.elements.map(normaliser) };
throw new Error('forme');
}).catch(function () {
// releases.json : sa liste plate `elements` (le contrat, présence inconnue) si elle existe, sinon les vieux components × releases
return fetchJSON(REL).then(function (j) {
if (j && Array.isArray(j.elements) && j.elements.length) return { source: 'releases', version: j.version || '', elements: j.elements.map(normaliser) };
if (j && Array.isArray(j.components)) return { source: 'releases', version: j.version || '', elements: normaliserReleases(j) };
throw new Error('forme');
});
}).catch(function () { return { source: 'secours', version: '', elements: SECOURS() }; })
.then(function (d) { CACHE = d; cb(d); });
}
// ---- cet appareil : OS (UA) × type (jOSAppareil) × xion local × PWA ----
function appareil() {
var ua = ''; try { ua = navigator.userAgent || ''; } catch (e0) {}
var touch = 0; try { touch = navigator.maxTouchPoints || 0; } catch (e1) {}
var os = /Windows/i.test(ua) ? 'windows' : /Android/i.test(ua) ? 'android' : /iPhone|iPad|iPod/i.test(ua) ? 'ios' : /Macintosh/i.test(ua) ? (touch > 1 ? 'ios' : 'mac') : /Linux|X11|CrOS/i.test(ua) ? 'linux' : 'autre';
var type = null; try { type = window.jOSAppareil && window.jOSAppareil.get(); } catch (e2) {}
if (!type) type = (os === 'android' || os === 'ios') ? 'telephone' : 'pc';
var xion = false, etat = null; try { xion = !!(window.jOSXion && window.jOSXion.enabled()); etat = (window.jOSXion && window.jOSXion.etat) ? window.jOSXion.etat() : null; } catch (e3) {}
var standalone = false; try { standalone = !!((window.matchMedia && window.matchMedia('(display-mode: standalone)').matches) || navigator.standalone === true); } catch (e4) {}
var peutApp = false; try { peutApp = !!((window.jOSiOS && window.jOSiOS.canInstall && window.jOSiOS.canInstall()) || (window.__xbInstall && window.__xbInstall.prompt)); } catch (e5) {}
return { os: os, type: type, xion: xion, etat: etat, standalone: standalone, peutApp: peutApp };
}
function dispo(els) { return (els || []).filter(function (e) { return e.actif !== false && e.present !== false; }); }
function recette(els, dev) {
var d = dispo(els), byId = {}; d.forEach(function (e) { byId[e.id] = e; });
// 1. le catalogue le dit : recommande_pour contient le type jOSAppareil ET la plateforme = l'OS ; entre plusieurs
// recommandés, l'ordre RECETTES[os] tranche (sinon le premier du catalogue gagne — le zip passait devant le msi)
var recos = d.filter(function (e) { return e.recommande_pour.indexOf(dev.type) > -1 && e.plateforme === dev.os; });
var pref = RECETTES[dev.os] || [], r = null;
for (var k = 0; k < pref.length && !r; k++) { r = recos.filter(function (e) { return e.id === pref[k]; })[0] || null; }
r = r || recos[0];
if (r) return r;
// 2. l'ordre de préférence par OS (un Pi / cubion → boxion)
var ids = (dev.type === 'raspberry' || dev.type === 'cubion') ? ['boxion-new', 'apt-setup'] : (RECETTES[dev.os] || RECETTES.autre);
for (var i = 0; i < ids.length; i++) { if (byId[ids[i]]) return byId[ids[i]]; }
// 3. n'importe quoi pour cette plateforme ; sinon web / tous (Mac → le zip source de releases.json) ; A2HS seulement sur mobile
r = d.filter(function (e) { return e.plateforme === dev.os; })[0]; if (r) return r;
var mobile = (dev.os === 'ios' || dev.os === 'android');
var gen = d.filter(function (e) { return e.plateforme === 'web' || e.plateforme === 'tous' || (mobile && e.genre === 'a2hs'); });
return gen.filter(function (e) { return /^xerboxion/.test(e.id) || e.genre === 'a2hs'; })[0] || null; // jamais Rosa ou un outil comme « recette » : plutôt rien + « installer comme app »
}
function installerApp(host) {
try { if (window.jOSiOS && window.jOSiOS.install && window.jOSiOS.canInstall && window.jOSiOS.canInstall()) { window.jOSiOS.install(); return; } } catch (e0) {}
try { if (window.__xbInstall && window.__xbInstall.prompt) { window.__xbInstall.prompt(); return; } } catch (e1) {}
try { if (window.jOSiOS && window.jOSiOS.installHint) { window.jOSiOS.installHint(); return; } } catch (e2) {}
if (/Macintosh/.test(navigator.userAgent) && !(navigator.maxTouchPoints > 1)) { toast(host, /Chrome|Edg/.test(navigator.userAgent) ? 'Menu ⋮ ▸ « Installer… » : le xer devient une app' : 'Safari ▸ Fichier ▸ « Ajouter au Dock » : le xer devient une app (0 Go)'); return; }
toast(host, 'Menu du navigateur ▸ « Installer l\'application » (iPhone : Partager ▸ Sur l\'écran d\'accueil)');
}
// ---- XUI : p1 = la recette (action), p2 = éléments actifs (stat), p3 = la liste ----
function describe() {
var els = LIVE ? LIVE.els() : (CACHE ? CACHE.elements : SECOURS()), dev = LIVE ? LIVE.dev() : appareil();
var r = recette(els, dev), act = dispo(els);
return { v: 1, id: ID, title: 'Installer', icon: '📥', items: [
{ p: 1, kind: 'action', label: r ? ('Installer · ' + r.icone + ' ' + r.nom) : 'Installer', act: { port: 'ploxion.installer.cmd', payload: { cmd: 'recette', id: r ? r.id : null } } },
{ p: 2, kind: 'stat', label: 'éléments actifs', value: act.length },
{ p: 3, kind: 'list', label: 'catalogue', items: act.slice(0, 8).map(function (e) { return { label: e.icone + ' ' + e.nom, value: e.version ? 'v' + e.version : (PLATS[e.plateforme] || e.plateforme), act: { port: 'ploxion.installer.cmd', payload: { cmd: 'ouvrir', id: e.id } } }; }) }
] };
}
function mount(container, ctx) {
ctx = ctx || {};
var embed = !!ctx.embed, admin = isAdmin(), standalone = !!ctx.standalone, params = ctx.params || {};
var section = ctx.section || params.section || qs('section') || 'appareil';
var etape = ctx.etape || params.etape || qs('etape') || null;
var cur = ctx.plateforme || params.plateforme || qs('plateforme') || null;
if (!SECTIONS.some(function (s) { return s[0] === section; })) section = 'appareil';
if (section === 'admin' && !admin) section = 'catalogue';
if (embed) section = ctx.section || 'appareil';
var DEV = appareil(), ELS = [], DATA = null, CMDS = [], alive = true, mode = 'boxion', chemin = '/j0bot.ch/my_website2';
// ---- progression « faire un boxion » (même clé que l'ex-premier-boxion) ----
var st = { done: {}, open: null, url: '' };
try { var raw = JSON.parse(localStorage.getItem(KEY)); if (raw && typeof raw === 'object') st = { done: raw.done || {}, open: raw.open || null, url: raw.url || '' }; } catch (e0) {}
function save() {
try { localStorage.setItem(KEY, JSON.stringify(st)); } catch (e1) {}
try { if (window.jOSBoxion && window.jOSBoxion.saveSoon) window.jOSBoxion.saveSoon('premier-boxion', 'progression', st, 'Mon premier boxion'); } catch (e2) {}
}
var ETAPES = { pourquoi: 'e0', machine: 'e1', lien: 'e2', installation: 'e2', enrolement: 'e3', verifier: 'e4', relier: 'e5', repliquer: 'e5' };
if (etape) { var m0 = ETAPES[etape] || (/^e[0-5]$/.test(etape) ? etape : (/^[0-5]$/.test(etape) ? 'e' + etape : null)); if (m0) st.open = m0; }
container.innerHTML = '<div class="ins' + (embed ? ' ins--embed' : '') + '">'
+ (embed ? '' : '<div class="ins__h"><div class="ins__ht">📥 Installer <small>le xerboxion, partout — un seul endroit</small></div><div class="ins__tabs" data-tabs></div></div>')
+ '<div class="ins__body" data-body><div class="ins__empty">chargement du catalogue…</div></div></div>';
var root = container.querySelector('.ins'), body = root.querySelector('[data-body]'), tabs = root.querySelector('[data-tabs]');
function setSection(s) {
if (s === 'admin' && !admin) s = 'catalogue';
section = s; renderTabs(); render();
if (standalone) { try { var u = new URL(location.href); u.searchParams.set('section', s); history.replaceState(null, '', u.pathname + u.search); } catch (e) {} }
}
function renderTabs() {
if (!tabs) return;
tabs.innerHTML = SECTIONS.filter(function (s) { return s[0] !== 'admin' || admin; }).map(function (s) { return '<button class="ins__tab' + (s[0] === section ? ' on' : '') + '" data-tab="' + s[0] + '">' + s[1] + ' ' + esc(s[2]) + '</button>'; }).join('');
}
function sourceTxt() {
if (!DATA) return '';
if (DATA.source === 'catalogue') return 'catalogue ' + (DATA.version || '') + ' · ' + ELS.length + ' éléments';
if (DATA.source === 'releases') return 'catalogue.json indisponible — releases.json ' + (DATA.version || '') + ' (tailles du manifeste, pas du disque)';
return 'catalogue hors ligne — liens directs';
}
// ---- une carte = un élément ----
function action(e) {
if (e.present === false) return '<p class="ins__note">fichier pas encore sur ce boxion.</p>';
if (e.genre === 'commande' && e.commande) { var i = CMDS.push(e.commande) - 1; return '<div class="ins__cmd"><pre>' + esc(e.commande) + '</pre><button class="ins__cp" data-copy="' + i + '">📋 copier</button></div>'; }
if (e.genre === 'fichier' && e.fichier) return '<div class="ins__act"><a class="ins__btn" href="' + esc(O() + e.fichier) + '" download data-dl="' + esc(e.id) + '">⬇ Télécharger' + (e.taille ? ' · ' + esc(human(e.taille)) : '') + '</a></div>';
if (e.genre === 'lien' && e.url) return '<div class="ins__act"><a class="ins__btn" href="' + esc(e.url) + '" target="_blank" rel="noopener">↗ Ouvrir</a></div>';
if (e.genre === 'a2hs') return '<div class="ins__act"><button class="ins__btn" data-a2hs>📲 Installer comme app</button></div>';
return '';
}
function carte(e, o) {
o = o || {};
var meta = [PLATS[e.plateforme] || e.plateforme, e.version ? 'v' + e.version : '', e.taille ? human(e.taille) : '', e.date ? dateCourte(e.date) : ''].filter(Boolean).join(' · ');
var badges = (e.present === false ? '<span class="ins__badge soon">bientôt</span>' : '') + (e.actif === false ? '<span class="ins__badge off">inactif</span>' : '');
var sw = o.admin ? '<button class="ins__sw' + (e.actif !== false ? ' on' : '') + '" data-sw="' + esc(e.id) + '" role="switch" aria-checked="' + (e.actif !== false ? 'true' : 'false') + '"' + (o.disabled ? ' aria-disabled="true"' : '') + ' title="actif / inactif"></button>' : '';
return '<div class="ins__card' + (e.actif === false ? ' off' : '') + (o.reco ? ' reco' : '') + '" data-el="' + esc(e.id) + '">'
+ '<div class="ins__top"><span class="ins__ic">' + esc(e.icone) + '</span><div class="ins__t"><b>' + esc(e.nom) + '</b><small>' + esc(meta) + '</small></div>' + badges + sw + '</div>'
+ (e.note ? '<p class="ins__note">' + esc(e.note) + '</p>' : '')
+ (o.admin ? '' : action(e)) + '</div>';
}
// ---- 1. cet appareil ----
function secAppareil() {
var r = recette(ELS, DEV), v = '';
try { v = (DEV.etat && DEV.etat.ok && DEV.etat.healthz && DEV.etat.healthz.version) ? ' · v' + DEV.etat.healthz.version : ''; } catch (e) {}
var h = '<div class="ins__sec" data-sec="appareil">'
+ '<div class="ins__hero"><div class="ins__hero-ic">' + (OS_I[DEV.os] || '📱') + '</div><div><b>' + esc(OS_N[DEV.os] || DEV.os) + ' · ' + esc(TYPES_N[DEV.type] || DEV.type) + '</b><small>'
+ (DEV.xion ? 'le xion local tourne ici' + esc(v) : (DEV.standalone ? 'ouvert comme une app' : 'détecté via ton navigateur — le type se change dans Réglages › Xer')) + '</small></div></div>';
if (DEV.xion) h += '<p class="ins__hint">✓ Le cœur xerboxion tourne déjà sur cet appareil (xion local). Rien à installer ici — le catalogue sert pour tes autres appareils.</p>';
if (r) h += '<div class="ins__lbl">recette recommandée</div>' + carte(r, { reco: true });
else h += '<p class="ins__hint">Pas de recette toute faite pour cet appareil — regarde le catalogue.</p>';
h += secMsi(r);
if (DEV.standalone) h += '<p class="ins__hint">✓ Déjà installé comme app sur cet appareil.</p>';
else if (!r || r.genre !== 'a2hs') h += '<div class="ins__card"><div class="ins__top"><span class="ins__ic">📲</span><div class="ins__t"><b>Installer comme app</b><small>plein écran, icône, hors-ligne (PWA)</small></div></div>'
+ (DEV.peutApp ? '<div class="ins__act"><button class="ins__btn" data-a2hs>📲 Installer maintenant</button></div>'
: '<p class="ins__note">' + (DEV.os === 'ios' ? 'Sur iPhone : <b>Partager</b> ▸ <b>Sur l\'écran d\'accueil</b>.' : 'Menu du navigateur ▸ « Installer l\'application » (ou « Ajouter à l\'écran d\'accueil »).') + '</p>') + '</div>';
if (embed) h += '<div class="ins__act"><button class="ins__btn ghost" data-open="installer">📥 Tout le catalogue · faire un boxion</button></div>';
else {
var autres = Object.keys(PLATS).filter(function (p) { return p !== 'tous' && p !== DEV.os && dispo(ELS).some(function (e) { return e.plateforme === p; }); });
if (autres.length) h += '<div class="ins__lbl">un autre appareil ?</div><div class="ins__chips">' + autres.map(function (p) { return '<button class="ins__chip" data-plat="' + p + '">' + esc(PLATS[p]) + '</button>'; }).join('') + '</div>';
}
return h + '</div>';
}
// ---- 1b. Windows : le trio Tout / Boxion / Xer sous la recette — 3 cartes courtes, un .msi chacune (ou « bientôt ») ----
function secMsi(r) {
if (DEV.os !== 'windows') return '';
var byId = {}; ELS.forEach(function (e) { if (e.actif !== false) byId[e.id] = e; });
if (!MSI.some(function (m) { return byId[m.id]; })) return '';
return '<div class="ins__lbl">installeur Windows : tout, boxion ou xer ?</div>'
+ '<p class="ins__hint">Le même dossier portable, trois modes (<b>xion init --mode</b> → xerboxion.json). Choisis ce que ce PC doit être :</p>'
+ '<div class="ins__opts" data-msi>' + MSI.map(function (m) {
var e = byId[m.id], reco = !!(r && e && r.id === e.id), dispo = !!(e && e.present !== false && e.fichier);
return '<div class="ins__opt' + (reco ? ' reco' : '') + '" data-msi-mode="' + m.mode + '"><b>' + m.ic + ' ' + esc(m.t) + (reco ? '<span class="c">✓ recommandé</span>' : '') + '</b><p>' + esc(m.d) + '</p>'
+ (dispo ? '<div class="ins__act"><a class="ins__btn' + (reco ? '' : ' ghost') + '" href="' + esc(O() + e.fichier) + '" download data-dl="' + esc(e.id) + '">⬇ .msi' + (e.taille ? ' · ' + esc(human(e.taille)) : '') + '</a></div>'
: '<p class="ins__note"><span class="ins__badge soon">bientôt</span> ' + (e ? 'fichier pas encore sur ce boxion.' : 'pas encore dans le catalogue.') + '</p>')
+ '</div>';
}).join('') + '</div>';
}
// ---- 2. tout le catalogue ----
function secCatalogue() {
var d = ELS.filter(function (e) { return e.actif !== false && (admin || e.present !== false); });
var plats = Object.keys(PLATS).filter(function (p) { return d.some(function (e) { return e.plateforme === p; }); });
if (cur && plats.indexOf(cur) < 0) cur = null;
var list = cur ? d.filter(function (e) { return e.plateforme === cur; }) : d;
return '<div class="ins__sec" data-sec="catalogue">'
+ '<div class="ins__chips"><button class="ins__chip' + (cur ? '' : ' on') + '" data-f="">✦ Tout</button>' + plats.map(function (p) { return '<button class="ins__chip' + (p === cur ? ' on' : '') + '" data-f="' + p + '">' + esc(PLATS[p]) + '</button>'; }).join('') + '</div>'
+ (list.length ? '<div class="ins__grid">' + list.map(function (e) { return carte(e, {}); }).join('') + '</div>' : '<div class="ins__empty">Rien pour ce filtre — essaie « Tout ».</div>')
+ '<div class="ins__foot">' + esc(sourceTxt()) + '</div></div>';
}
// ---- 3. faire un boxion : les 6 étapes (ex-premier-boxion) + le lien (ex-nouveau-boxion) + relier (ex-lier-boxion) ----
var MODES = {
boxion: { cmd: 'curl -fsSL ' + O() + '/boxion/new | bash', t: 'Avec agent', d: 'installe le xerboxion + un agent (Claude Code) qui pense tout seul.' },
xerboxion: { cmd: 'curl -fsSL ' + O() + '/apt/setup.sh | sudo bash && sudo apt install -y xerboxion', t: 'Sans agent', d: 'installe la VERSION du xerboxion (le DE + le core), sans agent.' }
};
function cmd(txt, lbl) { var i = CMDS.push(txt) - 1; return (lbl ? '<div class="ins__lbl">' + esc(lbl) + '</div>' : '') + '<div class="ins__cmd"><pre>' + esc(txt) + '</pre><button class="ins__cp" data-copy="' + i + '">📋 copier</button></div>'; }
function see(html) { return '<div class="ins__see"><b>ce que tu devrais voir</b><br>' + html + '</div>'; }
function lienCard() {
var m = MODES[mode], i = CMDS.push(m.cmd) - 1;
return '<div class="ins__card"><div class="ins__lbl">🔗 le lien — copie-le, colle-le sur le terminal du nouvel appareil</div>'
+ '<div class="ins__chips">' + Object.keys(MODES).map(function (k) { return '<button class="ins__chip' + (k === mode ? ' on' : '') + '" data-mode="' + k + '">' + esc(MODES[k].t) + '</button>'; }).join('') + '</div>'
+ '<div class="ins__lien">' + esc(m.cmd) + '</div>'
+ '<button class="ins__big" data-copy-big="' + i + '">📋 Copier le lien</button>'
+ '<p class="ins__note">' + esc(m.d) + ' Il affiche un <b>code</b> et attend : tu l\'acceptes dans <b>🔑 Enrôlements</b> (étape 3). Zéro SSH, zéro IP à taper.</p></div>';
}
function deployCmd(p) { return 'cd ' + p + '\ngit pull\ncomposer install --no-dev --optimize-autoloader\nphp artisan migrate --force\nphp artisan config:cache && php artisan view:cache'; }
function relierCard() {
var i = CMDS.push(deployCmd(chemin)) - 1;
return '<div class="ins__card"><div class="ins__lbl">🔁 boxion existant → réplique / backup (ex-lier-boxion)</div>'
+ '<label class="ins__note">chemin du repo sur l\'autre boxion (ajuste si besoin)<input class="ins__path" data-path value="' + esc(chemin) + '"></label>'
+ '<div class="ins__cmd"><pre data-deploy="' + i + '">' + esc(deployCmd(chemin)) + '</pre><button class="ins__cp" data-copy="' + i + '">📋 copier</button></div>'
+ '<p class="ins__note">Un boxion qui tourne déjà : 1) lance ces commandes dessus (à jour), 2) colle le même lien de liaison (étape 2), 3) dans <b>🔑 Enrôlements</b> choisis le rôle <b>réplique / backup</b> → il réplique le cloudion (backup + failover). ⚠️ tu lances tout toi-même — rien n\'est déployé automatiquement d\'ici.</p></div>';
}
var STEPS = [
{ id: 'e0', n: '0', t: 'Pourquoi un boxion', s: 'la souveraineté, en 3 lignes', body: function () {
return '<p class="ins__p">Un <b>boxion</b>, c\'est TON serveur xerboxion : <b>tes données vivent chez toi</b>, pas chez une plateforme. '
+ 'La <b>réplication te suit</b> : ton boxion tire l\'état signé du réseau et le monde continue même si un serveur tombe. '
+ 'Et forker reste libre — tu peux partir avec tout, à tout moment. C\'est ça, la souveraineté.</p>';
} },
{ id: 'e1', n: '1', t: 'La machine', s: 'un vieux PC, un Pi, ou un VPS', body: function () {
return '<div class="ins__opts">'
+ '<div class="ins__opt"><b>🖥 Chez toi <span class="c">0 CHF</span></b><p>Un vieux PC ou un Raspberry Pi qui traîne. Gratuit, vraiment chez toi. Contrepartie honnête : pas joignable depuis internet sans config réseau (ça n\'empêche PAS l\'enrôlement ni la réplication — tout marche en sortie).</p></div>'
+ '<div class="ins__opt"><b>☁️ Un VPS <span class="c">~5–10 CHF/mois</span></b><p>Une petite machine louée (Hetzner, Infomaniak, OVH…). 2 Go de RAM suffisent pour commencer. Joignable depuis partout — l\'étape 4 pourra le vérifier en live.</p></div>'
+ '</div>'
+ '<p class="ins__p">Prérequis : un <b>Linux</b> (Debian / Ubuntu conseillé) et un terminal. Vérifie :</p>'
+ cmd('uname -a')
+ see('une ligne qui commence par <b>Linux</b> — c\'est bon.')
+ cmd('sudo apt-get update && sudo apt-get install -y curl', 'curl, l\'outil de l\'étape suivante')
+ '<p class="ins__p"><b>Docker ?</b> Pas obligatoire pour le boxion lui-même — seulement si tu veux plus tard un agent dans un conteneur isolé (fin de l\'étape 5).</p>';
} },
{ id: 'e2', n: '2', t: 'L\'installation · le lien', s: 'une commande, avec ou sans agent', body: function () {
return '<p class="ins__p">Le flux officiel tient en une commande. Choisis la variante, copie, colle sur la machine de l\'étape 1 :</p>'
+ lienCard()
+ '<p class="ins__p">Envie de voir ce qu\'il ferait <b>sans rien exécuter</b> ?</p>'
+ cmd('curl -fsSL ' + O() + '/boxion/new | bash -s -- --dry-run', 'répétition générale (rien n\'est installé)')
+ '<p class="ins__p">Pour nommer ton boxion dès l\'installation :</p>'
+ cmd('curl -fsSL ' + O() + '/boxion/new | bash -s -- --name mon-boxion', 'l\'installation complète, nommée')
+ see('<pre>╔══════════════════════════════════════════════════╗\n║ BOXION-NEW · enrôlement par approbation 🜂 ║\n║ zéro SSH · aucune IP · le nexus rejoint le xer ║\n╚══════════════════════════════════════════════════╝</pre>puis le script installe les dépendances (curl, tmux, gnupg, node…) tout seul, en tolérant les manques.')
+ '<p class="ins__p">Les deux variantes sont idempotentes : relancer ne casse rien.</p>';
} },
{ id: 'e3', n: '3', t: 'L\'enrôlement au nexus', s: 'le code 🔑 à faire approuver', body: function () {
return '<p class="ins__p">Pendant l\'installation, ton boxion demande à rejoindre le réseau : il génère un secret <b>local</b> (jamais transmis en clair), poste une demande, et affiche <b>un code en grand</b> :</p>'
+ see('<pre>┌───────────────────────────────────────────────┐\n│ TON CODE D\'ENRÔLEMENT : │\n│ &gt;&gt;&gt; ABC234 &lt;&lt;&lt; │\n│ Va dans le ploxion 🔑 « enrolements » et │\n│ ACCEPTE ce code. │\n└───────────────────────────────────────────────┘</pre>')
+ '<p class="ins__p"><b>Laisse ce terminal ouvert</b> : il attend l\'approbation (~10 min max, il re-demande toutes les 3 s). '
+ 'De l\'autre côté, un admin ouvre le ploxion <b>🔑 enrolements</b>, vérifie que le code affiché est bien le tien, et clique <b>Accepter</b>. '
+ 'C\'est le garde-fou : personne ne rejoint le réseau sans qu\'un humain ait comparé les codes.</p>'
+ '<p class="ins__p">Dès l\'approbation, ton terminal affiche <b>✓ approuvé ! token reçu.</b> — un token <b>scopé, court, révocable</b>, rangé dans <b>~/.config/xerboxion/enroll.env</b> (chmod 600). Ne le partage jamais : il te représente.</p>'
+ '<p class="ins__p">Pas d\'admin sous la main ? Passe sur le Discord (bouton en bas), quelqu\'un approuvera.</p>';
} },
{ id: 'e4', n: '4', t: 'Vérifier en live', s: 'ton boxion vit ?', body: function () {
return '<p class="ins__p">Si ton boxion est <b>joignable depuis internet</b> (VPS), colle son URL — je le sonde d\'ici, depuis TON navigateur :</p>'
+ '<div class="ins__in"><input data-url placeholder="mon-boxion.example.ch" value="' + esc(st.url) + '"><button data-probe>tester</button></div>'
+ '<div class="ins__res" data-probe-res></div>'
+ '<p class="ins__p" style="font-size:.74rem;color:#7a929c">Honnêteté du test : la sonde (fetch no-cors, timeout 6 s) dit seulement « <b>quelque chose répond</b> à cette adresse » — elle ne peut pas lire la réponse (CORS) ni prouver que c\'est un xerboxion. Un boxion derrière ta box, non exposé, sera « injoignable d\'ici » tout en vivant très bien.</p>'
+ '<p class="ins__p">Dans ce cas (ou pour une vraie preuve), lance ceci <b>sur n\'importe quelle machine qui voit ton boxion</b> et colle la sortie :</p>'
+ cmd('curl -sSI https://TON-URL/', 'la commande à lancer (remplace TON-URL)')
+ '<textarea class="ins__ta" data-paste placeholder="colle ici la sortie de curl -sSI (ou les dernières lignes de boxion-new)"></textarea>'
+ '<div class="ins__in"><button data-parse>analyser</button></div>'
+ '<div class="ins__res" data-parse-res></div>';
} },
{ id: 'e5', n: '5', t: 'Relier & répliquer', s: 'réplication, pas migration', body: function () {
return '<p class="ins__p">Le principe : on ne déménage <b>jamais</b> des données à la main (dump, copie, migration). Chaque boxion <b>tire</b> l\'état signé et l\'<b>applique</b> — pull / apply. Si ça casse, on re-tire.</p>'
+ relierCard()
+ '<p class="ins__p">L\'installation a déjà déposé le script de mirror. Un premier tour, à la main :</p>'
+ cmd('. ~/.config/xerboxion/enroll.env\nexport ENROLL_TOKEN="$XERBOXION_TOKEN"\nbash ~/fleet/nexus-tor-replicate.sh', 'un mirror ponctuel')
+ see('« ▢ cloudion joignable dans le dark ✓ » puis fetch / verify / apply — la signature GPG du bundle est vérifiée avant d\'appliquer quoi que ce soit.')
+ '<p class="ins__p">Puis le cron continu (toutes les 30 min) :</p>'
+ cmd('bash ~/fleet/nexus-tor-replicate.sh --cron', 'la réplication continue')
+ '<p class="ins__p">Et pour vérifier que ton token tire bien l\'état :</p>'
+ cmd('. ~/.config/xerboxion/enroll.env\ncurl -s -o /dev/null -w \'%{http_code}\\n\' -H "Authorization: Bearer $XERBOXION_TOKEN" ' + O() + '/px/state-bundle.tgz', 'doit répondre 200')
+ see('<b>200</b> — ton boxion tire l\'état. Un <b>401</b> = token expiré : re-fais les étapes 2-3 (ré-enrôlement, c\'est le flux normal).')
+ '<p class="ins__p">Envie d\'un agent dans le boxion (conteneur isolé, nécessite Docker) ?</p>'
+ cmd('export ANTHROPIC_API_KEY=sk-ant-...\ncurl -fsSL ' + O() + '/apt/boxion-start.sh | bash', 'optionnel : l\'agent');
} }
];
function doneCount() { var n = 0; STEPS.forEach(function (s) { if (st.done[s.id]) n++; }); return n; }
function firstOpen() { for (var i = 0; i < STEPS.length; i++) { if (!st.done[STEPS[i].id]) return STEPS[i].id; } return STEPS[STEPS.length - 1].id; }
function secBoxion() {
var n = doneCount();
if (!st.open) st.open = firstOpen();
var sub = n === 0 ? 'Ton propre serveur xerboxion, pas à pas. On y va tranquillement — tout est repris là où tu t\'arrêtes.'
: (n === STEPS.length ? 'Tout est fait. Ton boxion fait partie du réseau. 🜂' : 'Content de te revoir — on reprend à l\'étape ' + firstOpen().slice(1) + '.');
return '<div class="ins__sec" data-sec="boxion">'
+ '<div><div class="ins__ht">🖥️ Ton premier boxion <small>· ' + n + '/' + STEPS.length + ' étapes</small></div><div class="ins__bar" style="margin-top:8px"><div class="ins__fill" style="width:' + Math.round(n / STEPS.length * 100) + '%"></div></div><p class="ins__hint" style="margin-top:6px">' + esc(sub) + '</p></div>'
+ (n === STEPS.length ? '<div class="ins__win">🜂 Ton boxion vit et réplique. Bienvenue dans le réseau — il est un peu plus solide grâce à toi.</div>' : '')
+ STEPS.map(function (s) {
var d = !!st.done[s.id], o = (st.open === s.id);
return '<div class="ins__st' + (d ? ' done' : '') + (o ? ' open' : '') + '" data-st="' + s.id + '"><div class="ins__sth" data-hd="' + s.id + '"><span class="ins__num">' + (d ? '✓' : s.n) + '</span><span class="ins__stt"><b>' + esc(s.t) + '</b><small>' + esc(s.s) + '</small></span><span class="ins__chev">' + (o ? '▲' : '▼') + '</span></div>'
+ '<div class="ins__stb">' + (o ? s.body() + '<button class="ins__doneb' + (d ? ' on' : '') + '" data-done="' + s.id + '">' + (d ? '✓ étape faite — décocher' : '✓ marquer l\'étape comme faite') + '</button>' : '') + '</div></div>';
}).join('')
+ '<div class="ins__links"><button class="ins__lk" data-px="contribuer">🌱 contribuer</button><button class="ins__lk" data-px="quetes">🗺️ quêtes</button><button class="ins__lk" data-px="enrolements">🔑 enrolements (admin)</button><a class="ins__lk" href="https://discord.gg/HQebyWn5tR" target="_blank" rel="noopener">💬 Discord — on t\'aide en live</a></div>'
+ '</div>';
}
// sonde (fetch no-cors + timeout) et lecture d'un « curl -sSI » collé — AUCUNE route serveur (un ping d'URL arbitraire = SSRF)
function normUrl(u) { u = (u || '').trim(); if (!u) return ''; if (!/^https?:\/\//i.test(u)) u = 'https://' + u; return u.replace(/\/+$/, '') + '/'; }
function probe(url, cb) {
var ctrl = null; try { ctrl = new AbortController(); } catch (e0) {}
var fini = false; function fin(ok) { if (fini) return; fini = true; cb(ok); }
var to = setTimeout(function () { try { if (ctrl) ctrl.abort(); } catch (e1) {} fin(false); }, 6000);
try { fetch(url, { mode: 'no-cors', cache: 'no-store', signal: (ctrl ? ctrl.signal : undefined) }).then(function () { clearTimeout(to); fin(true); }).catch(function () { clearTimeout(to); fin(false); }); }
catch (e2) { clearTimeout(to); fin(false); }
}
function parseCurl(txt) {
txt = txt || '';
var m = txt.match(/HTTP\/[0-9.]+\s+(\d{3})/);
if (m) {
var c = +m[1];
if (c >= 200 && c < 400) return { ok: true, msg: 'HTTP ' + c + ' — ton boxion répond. ✓ Il vit.' };
if (c === 401 || c === 403) return { ok: true, msg: 'HTTP ' + c + ' — il répond, accès protégé (normal pour un boxion privé). ✓ Il vit.' };
if (c === 404) return { ok: true, msg: 'HTTP 404 — quelque chose répond à cette adresse (mais pas de page racine). Probablement vivant : vérifie l\'URL.' };
return { ok: false, msg: 'HTTP ' + c + ' — ça répond mais ça souffre. Regarde les logs de ton boxion.' };
}
if (/approuv|token reçu|BOXION COMPLET/i.test(txt)) return { ok: true, msg: 'Sortie de boxion-new reconnue : enrôlement passé. ✓ Ton boxion vit.' };
if (/curl: \(\d+\)/.test(txt)) return { ok: false, msg: 'curl n\'a pas pu joindre l\'adresse (' + (txt.match(/curl: \(\d+\)[^\n]*/) || [''])[0] + '). Vérifie l\'URL / le DNS / le firewall.' };
return { ok: false, msg: 'Je ne reconnais pas cette sortie. Colle la sortie de « curl -sSI https://TON-URL/ » (elle commence par HTTP/…).' };
}
function sonder() {
var inp = body.querySelector('[data-url]'), res = body.querySelector('[data-probe-res]'); if (!inp || !res) return;
var u = normUrl(inp.value); st.url = inp.value.trim(); save();
if (!u) { res.className = 'ins__res ko'; res.textContent = 'Colle d\'abord l\'URL de ton boxion.'; return; }
res.className = 'ins__res wait'; res.textContent = 'Je sonde ' + u + ' …';
probe(u, function (ok) {
if (!alive) return;
if (ok) { res.className = 'ins__res ok'; res.textContent = '✓ Quelque chose répond à ' + u + ' — ton boxion vit ! (sonde no-cors : joignabilité prouvée, contenu non lisible d\'ici)'; if (!st.done.e4) { st.done.e4 = true; save(); setTimeout(function () { if (alive) render(); }, 1200); } }
else { res.className = 'ins__res ko'; res.textContent = '✗ Injoignable d\'ici (timeout / refus). Si ton boxion est chez toi non exposé, c\'est attendu — utilise le mode « colle la sortie de curl » juste en dessous.'; }
});
}
function analyser() {
var pa = body.querySelector('[data-paste]'), res = body.querySelector('[data-parse-res]'); if (!pa || !res) return;
var r = parseCurl(pa.value);
res.className = 'ins__res ' + (r.ok ? 'ok' : 'ko'); res.textContent = (r.ok ? '✓ ' : '✗ ') + r.msg;
if (r.ok && !st.done.e4) { st.done.e4 = true; save(); setTimeout(function () { if (alive) render(); }, 1200); }
}
// ---- 4. admin : tous les éléments, un interrupteur chacun → POST /px/installer/actif ----
function secAdmin() {
var ok = !!(DATA && DATA.source === 'catalogue');
var act = ELS.filter(function (e) { return e.actif !== false; }).length;
return '<div class="ins__sec" data-sec="admin">'
+ '<div class="ins__card"><div class="ins__top"><span class="ins__ic">👑</span><div class="ins__t"><b>' + act + ' actifs / ' + ELS.length + ' éléments</b><small>' + esc(sourceTxt()) + '</small></div><button class="ins__cp" style="position:static" data-refresh>↻ rafraîchir les tailles</button></div>'
+ (ok ? '<p class="ins__note">Un interrupteur → <b>POST /px/installer/actif</b> → storage/app/installer/actifs.json (overlay, sans redéploiement). Inactif = retiré du public, ici et sur xerboxion.org. « bientôt » = fichier absent du disque (vit dans le volume, pas dans git).</p>'
: '<p class="ins__note">⚠️ /px/installer/catalogue.json ne répond pas (repli : ' + esc(DATA ? DATA.source : '…') + ') — les interrupteurs sont inactifs tant que la route n\'est pas là.</p>')
+ '</div>'
+ ELS.map(function (e) { return carte(e, { admin: true, disabled: !ok }); }).join('')
+ '</div>';
}
function basculer(id, btn) {
var e = ELS.filter(function (x) { return x.id === id; })[0]; if (!e) return;
var veut = !(e.actif !== false), corps = { id: id, actif: veut }, p;
btn.setAttribute('aria-disabled', 'true');
try {
p = (window.jOSb && window.jOSb.postJSON) ? window.jOSb.postJSON(ACTIF, corps)
: fetch(ACTIF, { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-CSRF-TOKEN': csrf() }, body: JSON.stringify(corps) }).then(function (r) { if (!r.ok) throw new Error(r.status); return r.json(); });
} catch (er) { p = Promise.reject(er); }
p.then(function (j) {
var el = (j && j.element) ? j.element : j;
if (el && el.id === id) { var n = normaliser(el); Object.keys(n).forEach(function (k) { e[k] = n[k]; }); } else { e.actif = veut; }
toast(container, (e.actif !== false ? '✓ actif : ' : '○ inactif : ') + e.nom);
try { if (window.jOSPorts) window.jOSPorts.emit('installer', 'actif', { id: id, actif: e.actif }); } catch (e2) {}
if (alive) render();
}).catch(function () { btn.removeAttribute('aria-disabled'); toast(container, '✗ pas enregistré (admin connecté ? route /px/installer/actif ?)'); });
}
function render() {
if (!alive) return;
CMDS.length = 0;
body.innerHTML = section === 'catalogue' ? secCatalogue() : section === 'boxion' ? secBoxion() : section === 'admin' ? secAdmin() : secAppareil();
}
function recharger(msg) { charger(admin, function (d) { if (!alive) return; DATA = d; ELS = d.elements; render(); if (msg) toast(container, msg); }); }
// ---- câblage : délégation (un seul listener par événement, jamais de fuite) ----
if (tabs) tabs.addEventListener('click', function (ev) { var t = ev.target.closest('[data-tab]'); if (t) setSection(t.getAttribute('data-tab')); });
body.addEventListener('click', function (ev) {
var t = ev.target.closest('[data-copy],[data-copy-big],[data-a2hs],[data-dl],[data-sw],[data-open],[data-px],[data-plat],[data-f],[data-hd],[data-done],[data-mode],[data-probe],[data-parse],[data-refresh]');
if (!t) return;
var v;
if (t.hasAttribute('data-copy')) { copier(CMDS[+t.getAttribute('data-copy')] || '', t); return; }
if (t.hasAttribute('data-copy-big')) { copier(CMDS[+t.getAttribute('data-copy-big')] || '', t, '📋 Copier le lien'); return; }
if (t.hasAttribute('data-a2hs')) { installerApp(container); return; }
if (t.hasAttribute('data-dl')) { try { if (window.jOSPorts) window.jOSPorts.emit('installer', 'telecharge', { id: t.getAttribute('data-dl') }); } catch (e) {} return; } // le <a download> fait le reste
if (t.hasAttribute('data-sw')) { if (t.getAttribute('aria-disabled') === 'true') return; basculer(t.getAttribute('data-sw'), t); return; }
if (t.hasAttribute('data-open')) { openPx(t.getAttribute('data-open')); return; }
if (t.hasAttribute('data-px')) { openPx(t.getAttribute('data-px')); return; }
if (t.hasAttribute('data-plat')) { cur = t.getAttribute('data-plat'); setSection('catalogue'); return; }
if (t.hasAttribute('data-f')) { cur = t.getAttribute('data-f') || null; render(); return; }
if (t.hasAttribute('data-hd')) { v = t.getAttribute('data-hd'); st.open = (st.open === v ? null : v); save(); render(); return; }
if (t.hasAttribute('data-done')) { v = t.getAttribute('data-done'); if (st.done[v]) delete st.done[v]; else { st.done[v] = true; st.open = firstOpen(); } save(); render(); return; }
if (t.hasAttribute('data-mode')) { mode = t.getAttribute('data-mode'); render(); return; }
if (t.hasAttribute('data-probe')) { sonder(); return; }
if (t.hasAttribute('data-parse')) { analyser(); return; }
if (t.hasAttribute('data-refresh')) { recharger('↻ catalogue rechargé'); return; }
});
body.addEventListener('input', function (ev) {
var t = ev.target; if (!t || !t.hasAttribute) return;
if (t.hasAttribute('data-path')) {
chemin = (t.value || '').trim() || '/j0bot.ch/my_website2';
var pre = body.querySelector('[data-deploy]'); if (pre) { pre.textContent = deployCmd(chemin); CMDS[+pre.getAttribute('data-deploy')] = deployCmd(chemin); }
}
if (t.hasAttribute('data-url')) st.url = (t.value || '').trim();
});
// le bus : XUI (describe → act) et les autres ploxions parlent à l'installer via ploxion.installer.cmd
var offPort = null;
try {
if (window.jOSPorts && window.jOSPorts.on) offPort = window.jOSPorts.on('ploxion.installer.cmd', function (p) {
if (container.isConnected === false) { alive = false; try { offPort && offPort(); } catch (e0) {} } // hôte démonté sans unmount (embed) : on se tait
if (!alive) return;
if (typeof p === 'string') { try { p = JSON.parse(p); } catch (e) { p = { cmd: p }; } }
p = p || {};
if (p.cmd === 'section') { setSection(p.section || 'appareil'); return; }
if (p.cmd === 'ouvrir') { cur = null; setSection('catalogue'); var el = body.querySelector('[data-el="' + String(p.id || '').replace(/["\\]/g, '') + '"]'); if (el && el.scrollIntoView) el.scrollIntoView({ block: 'center' }); return; }
if (p.cmd === 'recette') { setSection('appareil'); var b = body.querySelector('.reco [data-copy], .reco [data-dl], .reco [data-a2hs]'); if (b) b.click(); }
});
} catch (e3) {}
// reprise cross-device de la progression boxion : le boxion sait où tu en es
try {
if (window.jOSBoxion && window.jOSBoxion.authed && window.jOSBoxion.authed() && window.jOSBoxion.load) {
window.jOSBoxion.load('premier-boxion', 'progression').then(function (d) {
if (!alive || !d || !d.data || typeof d.data !== 'object') return;
Object.keys(d.data.done || {}).forEach(function (k) { st.done[k] = d.data.done[k]; });
if (d.data.url && !st.url) st.url = d.data.url;
if (section === 'boxion') render();
}).catch(function () {});
}
} catch (e4) {}
renderTabs();
recharger(null);
LIVE = { els: function () { return ELS; }, dev: function () { return DEV; } };
return { unmount: function () { alive = false; LIVE = null; try { if (offPort) offPort(); } catch (e) {} container.innerHTML = ''; } };
}
window.jOSApps = window.jOSApps || {};
window.jOSApps[ID] = { manifest: { id: ID, name: 'Installer', icon: '📥' }, mount: mount, describe: describe };
})();
</script>