synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# 🪐 Sync
|
||||||
|
|
||||||
|
Pousse tous les bions (/bions.json) et ploxions sur RepoVerse — tout est un repo. Écrit avec ta session ; auto-login si besoin ; dry-run + idempotent.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `sync` |
|
||||||
|
| fournit | `repoverse` `sync` `bions` `meta` |
|
||||||
|
| bions qu'il nomme | `jOSApps` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/sync/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=sync — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre sync` (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
|
||||||
109
app.blade.php
Normal file
109
app.blade.php
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
{{-- PL0XION sync — POUSSE TOUS LES BIONS + PLOXIONS SUR REPOVERSE (RS-7 : « il faudra
|
||||||
|
mettre tous les bions et les ploxions sur repoverse » ; tout est un repo). Source
|
||||||
|
bions = /bions.json (registre WASM) ; ploxions = window.__PLOXIONS__. Écriture via le
|
||||||
|
proxy même-origine /px/repoverse avec TA session labo (credentials:'same-origin', le
|
||||||
|
serveur injecte la clé) ; 401 → « connecte-toi au labo », 503 → « configure la clé ».
|
||||||
|
Idempotent (GET slug avant POST). Dry-run par défaut.
|
||||||
|
window.jOSApps['sync']. mount(c,ctx)->{unmount}. --}}
|
||||||
|
<style>
|
||||||
|
.sy{display:flex;flex-direction:column;height:100%;background:var(--xr-bg,#070b12);color:#e6eef7;font-family:ui-sans-serif,system-ui;font-size:.84rem}
|
||||||
|
.sy__bar{flex:0 0 auto;display:flex;align-items:center;gap:9px;padding:9px 12px;border-bottom:1px solid rgba(120,180,255,.2);flex-wrap:wrap}
|
||||||
|
.sy__t{font-weight:700;color:rgba(150,200,255,.95)} .sy__sub{font-size:.64rem;color:rgba(185,205,225,.55)} .sy__sp{flex:1}
|
||||||
|
.sy__btn{cursor:pointer;border-radius:9px;border:1px solid rgba(120,180,255,.5);background:rgba(50,90,200,.32);color:#fff;font:700 .76rem ui-sans-serif;padding:8px 13px}
|
||||||
|
.sy__btn:hover{background:rgba(70,110,230,.45)} .sy__btn.ghost{background:transparent;color:#cde} .sy__btn:disabled{opacity:.5;cursor:default}
|
||||||
|
.sy__body{flex:1;min-height:0;overflow:auto;padding:13px;display:flex;flex-direction:column;gap:12px}
|
||||||
|
.sy__card{border:1px solid rgba(120,180,255,.2);border-radius:12px;padding:12px;background:rgba(255,255,255,.02)}
|
||||||
|
.sy__h{font-size:.64rem;text-transform:uppercase;letter-spacing:.05em;color:rgba(160,200,250,.7);margin-bottom:7px}
|
||||||
|
.sy__big{font-size:1.6rem;font-weight:800;color:rgba(150,230,180,.95)} .sy__lbl{font-size:.66rem;color:rgba(185,205,225,.7)}
|
||||||
|
.sy__grid{display:flex;gap:18px;flex-wrap:wrap}
|
||||||
|
.sy__log{font:0.72rem/1.5 ui-monospace,monospace;white-space:pre-wrap;max-height:260px;overflow:auto;color:rgba(190,215,200,.9)}
|
||||||
|
.sy__row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
||||||
|
.sy__warn{font-size:.66rem;color:rgba(245,200,120,.95)}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var ID='sync';
|
||||||
|
function esc(s) { return window.jOSb.esc(s); }
|
||||||
|
function slugify(s){ return String(s||'').toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,80); }
|
||||||
|
var RVBASE='/px/repoverse';
|
||||||
|
function csrf(){return window.jOSb&&window.jOSb.csrf?window.jOSb.csrf():(function(){var m=document.querySelector('meta[name=csrf-token]');return m?(m.getAttribute('content')||m.content||''):'';})();}
|
||||||
|
function rvFetch(path, opts){ opts=opts||{}; opts.credentials='same-origin'; opts.headers=opts.headers||{}; opts.headers['Accept']='application/json'; if(opts.body){ opts.headers['Content-Type']='application/json'; opts.headers['X-CSRF-TOKEN']=csrf(); }
|
||||||
|
return fetch(RVBASE+path, opts).then(function(r){ if(!r.ok)return r.text().then(function(t){ var msg=r.status===401?'connecte-toi au labo':(r.status===503?'configure la clé RepoVerse':('http '+r.status+' '+t.slice(0,80))); var er=new Error(msg); er.status=r.status; throw er; }); return r.status===204?null:r.json(); }); }
|
||||||
|
|
||||||
|
var LIVE=null; // posé au mount : { total, running }
|
||||||
|
function describe(){
|
||||||
|
var total=LIVE?LIVE.total():0, running=LIVE?LIVE.running():false;
|
||||||
|
return { v:1, id:ID, title:'Sync', icon:'🪐', items:[
|
||||||
|
{ p:1, kind:'stat', label:running?'▶ synchronisation':'à pousser', value:total+' repos' }
|
||||||
|
] };
|
||||||
|
}
|
||||||
|
function mount(container, ctx){
|
||||||
|
var bions=[], f64=[], cubions=[], ploxions=[], running=false;
|
||||||
|
container.innerHTML=
|
||||||
|
'<div class="sy"><div class="sy__bar"><span class="sy__t">🪐 Sync</span><span class="sy__sub">bions + ploxions → RepoVerse (tout est un repo)</span><span class="sy__sp"></span>'
|
||||||
|
+ '<button class="sy__btn ghost" data-dry>👁 dry-run</button><button class="sy__btn" data-push disabled>▶ pousser tout</button></div>'
|
||||||
|
+ '<div class="sy__body">'
|
||||||
|
+ '<div class="sy__card"><div class="sy__h">à pousser</div><div class="sy__grid">'
|
||||||
|
+ '<div><div class="sy__big" data-nb>…</div><div class="sy__lbl">bions WASM (i32 + f64) + cubions</div></div>'
|
||||||
|
+ '<div><div class="sy__big" data-np>…</div><div class="sy__lbl">ploxions (__PLOXIONS__)</div></div></div>'
|
||||||
|
+ '<div class="sy__warn" data-auth></div></div>'
|
||||||
|
+ '<div class="sy__card"><div class="sy__h">journal</div><div class="sy__log" data-log>charge les sources…</div></div>'
|
||||||
|
+ '</div><div class="sy__foot" style="flex:0 0 auto;padding:6px 12px;border-top:1px solid rgba(120,180,255,.14);font-size:.62rem;color:rgba(170,200,225,.6)">1 bion = 1 repo (collection Bions) · 1 ploxion = 1 repo (collection Ploxions). Idempotent. Écrit avec TA session RepoVerse ; si pas connecté, « pousser » ouvre le login automatiquement.</div></div>';
|
||||||
|
var logEl=container.querySelector('[data-log]'), nbEl=container.querySelector('[data-nb]'), npEl=container.querySelector('[data-np]'), authEl=container.querySelector('[data-auth]'), pushBtn=container.querySelector('[data-push]');
|
||||||
|
function log(m){ logEl.textContent += (logEl.textContent?'\n':'')+m; logEl.scrollTop=logEl.scrollHeight; }
|
||||||
|
function setlog(m){ logEl.textContent=m; }
|
||||||
|
|
||||||
|
ploxions=(window.__PLOXIONS__||[]).slice(); npEl.textContent=ploxions.length;
|
||||||
|
function getJson(u){ return fetch(u,{headers:{'Accept':'application/json'}}).then(function(r){return r.ok?r.json():null;}).catch(function(){return null;}); }
|
||||||
|
// 3 catalogues : bions i32 (/bions.json) + bions f64 (/bions-f64.json) + cubions de bion (/bion-cubions.json)
|
||||||
|
Promise.all([getJson('/bions.json'), getJson('/bions-f64.json'), getJson('/bion-cubions.json')]).then(function(r){
|
||||||
|
bions=(r[0]&&r[0].bions)||[]; f64=(r[1]&&r[1].bions)||[]; cubions=(r[2]&&r[2].cubions)||[];
|
||||||
|
nbEl.textContent=bions.length+f64.length; pushBtn.disabled=false;
|
||||||
|
setlog('prêt : '+bions.length+' bions i32 + '+f64.length+' bions f64 + '+cubions.length+' cubions + '+ploxions.length+' ploxions. « dry-run » = aperçu, « pousser tout » = écrit sur RepoVerse.');
|
||||||
|
authEl.textContent = 'écrit avec ta session labo — si pas connecté, « pousser » te le dira.';
|
||||||
|
});
|
||||||
|
|
||||||
|
function nodeForBion(b){ return { slug:'bion-'+slugify(b.name), name:'bion '+b.name, type:'document', visibility:'public',
|
||||||
|
description:'BION WASM · '+(b.desc||b.name)+' · '+(b.params||'?')+' params · '+(b.size||'?')+' octets'+(b.test?(' · test '+JSON.stringify(b.test.args)+'→'+b.test.expect):'') }; }
|
||||||
|
function nodeForPloxion(p){ return { slug:'ploxion-'+slugify(p.id), name:p.name||p.id, type:'document', visibility:'public',
|
||||||
|
description:'PLOXION · '+(p.description||p.id)+(p.provides&&p.provides.length?(' · fournit: '+p.provides.join(', ')):'') }; }
|
||||||
|
function nodeForF64(b){ return { slug:'bion-f64-'+slugify(b.name), name:'bion f64 '+b.name, type:'document', visibility:'public',
|
||||||
|
description:'BION WASM f64 · '+(b.desc||b.name)+' · '+(b.params||'?')+' params'+(b.test?(' · test '+JSON.stringify(b.test.args)+'→'+b.test.expect):'') }; }
|
||||||
|
function nodeForCubion(c){ return { slug:'cubion-'+slugify(c.id), name:'cubion '+c.id, type:'document', visibility:'public',
|
||||||
|
description:'CUBION (composition de bions) · '+(c.desc||c.id)+' · xerb: '+(c.xerb||'')+(c.test?(' · '+JSON.stringify(c.test.in)+'→'+c.test.out):'') }; }
|
||||||
|
|
||||||
|
container.querySelector('[data-dry]').onclick=function(){ setlog('— DRY-RUN (aucune écriture) —');
|
||||||
|
log('collection « Bions » + '+bions.length+' nodes, ex :'); bions.slice(0,3).forEach(function(b){ var n=nodeForBion(b); log(' '+n.slug+' — '+n.description.slice(0,70)); });
|
||||||
|
log('collection « Bions f64 » + '+f64.length+' nodes, ex :'); f64.slice(0,3).forEach(function(b){ var n=nodeForF64(b); log(' '+n.slug+' — '+n.description.slice(0,70)); });
|
||||||
|
log('collection « Cubions » + '+cubions.length+' nodes, ex :'); cubions.slice(0,3).forEach(function(c){ var n=nodeForCubion(c); log(' '+n.slug+' — '+n.description.slice(0,70)); });
|
||||||
|
log('collection « Ploxions » + '+ploxions.length+' nodes, ex :'); ploxions.slice(0,3).forEach(function(p){ var n=nodeForPloxion(p); log(' '+n.slug+' — '+n.name); });
|
||||||
|
log('total : '+(bions.length+f64.length+cubions.length+ploxions.length)+' repos. Clique « pousser tout » pour écrire.'); };
|
||||||
|
|
||||||
|
function ensureParent(slug,name,desc){ return rvFetch('/repos/slug/'+slug).catch(function(){ return rvFetch('/repos',{method:'POST',body:JSON.stringify({slug:slug,name:name,description:desc,type:'collection',visibility:'public'})}); }); }
|
||||||
|
function pushOne(node, parentId){ return rvFetch('/repos/slug/'+node.slug).then(function(){ return {skip:true}; }).catch(function(){
|
||||||
|
return rvFetch('/repos',{method:'POST',body:JSON.stringify(node)}).then(function(repo){ var rid=repo&&(repo.id||repo.repo&&repo.repo.id);
|
||||||
|
if(parentId&&rid) rvFetch('/repos/'+parentId+'/links',{method:'POST',body:JSON.stringify({targetRepoId:rid,linkType:'PARENT_OF'})}).catch(function(){}); return {created:true}; }); }); }
|
||||||
|
|
||||||
|
container.querySelector('[data-push]').onclick=function(){ if(running)return; running=true; pushBtn.disabled=true; pushBtn.textContent='…';
|
||||||
|
setlog('création des collections…');
|
||||||
|
Promise.resolve().then(function(){
|
||||||
|
return Promise.all([ensureParent('bions','Bions','Les bions — blocs de base WASM du xerboxion.'), ensureParent('ploxions','Ploxions','Les ploxions du xerboxion.'), ensureParent('bions-f64','Bions f64','Les bions à virgule (f64) du xerboxion.'), ensureParent('cubions','Cubions','Les cubions — compositions de bions.')]);
|
||||||
|
}).then(function(par){ var pb=par[0]&&(par[0].id||par[0].repo&&par[0].repo.id), pp=par[1]&&(par[1].id||par[1].repo&&par[1].repo.id), pf=par[2]&&(par[2].id||par[2].repo&&par[2].repo.id), pc=par[3]&&(par[3].id||par[3].repo&&par[3].repo.id);
|
||||||
|
var items=bions.map(function(b){return {n:nodeForBion(b),pid:pb};})
|
||||||
|
.concat(f64.map(function(b){return {n:nodeForF64(b),pid:pf};}))
|
||||||
|
.concat(cubions.map(function(c){return {n:nodeForCubion(c),pid:pc};}))
|
||||||
|
.concat(ploxions.map(function(p){return {n:nodeForPloxion(p),pid:pp};}));
|
||||||
|
var i=0,created=0,skip=0; log('pousse '+items.length+' repos…');
|
||||||
|
return (function step(){ if(i>=items.length){ log('✓ fini : '+created+' créés, '+skip+' déjà là.'); return; }
|
||||||
|
var it=items[i++]; return pushOne(it.n,it.pid).then(function(r){ if(r.created)created++; else skip++; if(i%5===0)log(' '+i+'/'+items.length+' ('+created+' créés)'); return step(); })
|
||||||
|
.catch(function(e){ log(' ✗ '+it.n.slug+' : '+e.message); return step(); }); })();
|
||||||
|
}).then(function(){ running=false; pushBtn.disabled=false; pushBtn.textContent='▶ pousser tout'; })
|
||||||
|
.catch(function(e){ log('✗ '+e.message); running=false; pushBtn.disabled=false; pushBtn.textContent='▶ pousser tout'; });
|
||||||
|
};
|
||||||
|
LIVE={ total:function(){return bions.length+f64.length+cubions.length+ploxions.length;}, running:function(){return running;} };
|
||||||
|
return {unmount:function(){ LIVE=null; container.innerHTML=''; }};
|
||||||
|
}
|
||||||
|
window.jOSApps=window.jOSApps||{};
|
||||||
|
window.jOSApps[ID]={manifest:{id:ID,name:'Sync',icon:'🪐'},mount:mount,describe:describe};
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user