mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-analyse.git
synced 2026-11-29 06:02:04 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
parent
0f0faaf1ed
commit
9643708292
22
README.md
22
README.md
@ -1,3 +1,21 @@
|
||||
# ploxion-analyse
|
||||
# 🔬 Analyse
|
||||
|
||||
PLOXION · Le wireshark des ploxions : capture en direct tous les paquets — events du bus jOSPorts + appels réseau (fetch, méthode/statut/durée). Filtre (bus/réseau/texte), pause, inspecte chaque paquet. Voir ce qui se passe vraiment dans un ploxion. · fournit: analyse, wireshark, bus, réseau, debug
|
||||
Le wireshark des ploxions : capture en direct tous les paquets — events du bus jOSPorts + appels réseau (fetch, méthode/statut/durée). Filtre (bus/réseau/texte), pause, inspecte chaque paquet. Voir ce qui se passe vraiment dans un ploxion.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| id | `analyse` |
|
||||
| fournit | `analyse` `wireshark` `bus` `réseau` `debug` |
|
||||
| bions qu'il nomme | `jOSApps` `jOSPorts` `jOSWireshark` |
|
||||
| fichiers | `app.blade.php` |
|
||||
| dans le labo | `resources/views/ploxions/analyse/` (dépôt `my_website2`) |
|
||||
|
||||
## Contribuer
|
||||
|
||||
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=analyse — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||
- **Dans VS Code** : `xb prendre analyse` (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
|
||||
|
||||
153
app.blade.php
Normal file
153
app.blade.php
Normal file
@ -0,0 +1,153 @@
|
||||
{{-- PL0XION analyse — le WIRESHARK des ploxions (RS-7 : « bion wireshark + bion api,
|
||||
voir tous les packets et ce qui se passe dans le ploxion »). Lit window.jOSWireshark
|
||||
(capture globale, dans _ploxion_ports) : (a) events du BUS jOSPorts, (b) appels
|
||||
RÉSEAU (fetch) avec méthode/statut/durée/taille. Filtres (tout/bus/net + texte),
|
||||
pause, clear, clic = inspecter le packet. Si ouvert sur un ploxion précis
|
||||
(ctx.scope = id, via le bouton 🔬 « koin analyse »), pré-filtré sur lui.
|
||||
100% client-side, lecture seule (ne lit pas les corps réseau → zéro casse).
|
||||
Droit au silence §4.4 (désabo au unmount). window.jOSApps['analyse'].
|
||||
mount(c,ctx)->{unmount}. --}}
|
||||
@include('ploxions._bions')
|
||||
<style>
|
||||
.an { display:flex; flex-direction:column; height:100%; background:#06080c; color:rgba(220,230,242,.92);
|
||||
font-family:ui-sans-serif,system-ui,sans-serif; font-size:.8rem; }
|
||||
.an__bar { flex:0 0 auto; display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding:7px 10px; border-bottom:1px solid rgba(80,200,170,.18); }
|
||||
.an__t { font-weight:700; color:rgba(120,225,190,.95); } .an__t b { color:#fff; }
|
||||
.an__scope { font-size:.64rem; color:rgba(255,200,120,.85); }
|
||||
.an__sp { flex:1; }
|
||||
.an__tab { cursor:pointer; font-size:.7rem; padding:3px 10px; border-radius:20px; border:1px solid rgba(80,200,170,.3); background:none; color:rgba(150,215,195,.85); }
|
||||
.an__tab.on { background:rgba(80,200,170,.16); color:#fff; border-color:rgba(80,200,170,.6); }
|
||||
.an__in { flex:0 1 160px; min-width:90px; background:rgba(10,16,24,.8); color:#e8eef6; border:1px solid rgba(80,200,170,.28); border-radius:7px; padding:4px 8px; font-size:.74rem; }
|
||||
.an__b { cursor:pointer; font-size:.7rem; padding:3px 9px; border-radius:7px; border:1px solid rgba(140,150,180,.3); background:none; color:rgba(210,215,230,.85); }
|
||||
.an__b.on { border-color:rgba(255,180,90,.6); color:rgba(255,200,120,.95); }
|
||||
.an__body { flex:1; min-height:0; overflow-y:auto; font-family:'Share Tech Mono',ui-monospace,monospace; font-size:.72rem; }
|
||||
.an__row { display:flex; gap:8px; padding:3px 10px; border-bottom:1px solid rgba(120,160,180,.07); cursor:pointer; align-items:baseline; }
|
||||
.an__row:hover { background:rgba(80,200,170,.08); }
|
||||
.an__tm { color:rgba(150,170,195,.5); flex:0 0 auto; }
|
||||
.an__k { flex:0 0 auto; font-size:.6rem; text-transform:uppercase; padding:0 5px; border-radius:4px; }
|
||||
.an__k.bus { color:rgba(140,195,255,.95); border:1px solid rgba(140,195,255,.3); }
|
||||
.an__k.net { color:rgba(120,225,190,.95); border:1px solid rgba(120,225,190,.3); }
|
||||
.an__lb { flex:1; min-width:0; color:rgba(220,230,242,.9); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||
.an__meta { flex:0 0 auto; color:rgba(160,180,205,.6); }
|
||||
.an__row.err .an__meta { color:rgba(255,130,130,.9); }
|
||||
.an__row.ok .an__meta { color:rgba(120,220,160,.85); }
|
||||
.an__msg { text-align:center; color:rgba(190,212,228,.5); padding:22px; font-size:.74rem; font-family:ui-sans-serif,system-ui,sans-serif; }
|
||||
.an__det { flex:0 0 auto; max-height:0; overflow:hidden; transition:max-height .2s; border-top:1px solid rgba(80,200,170,.18); background:#0a0f16; }
|
||||
.an__det.open { max-height:42%; overflow-y:auto; }
|
||||
.an__det pre { margin:0; padding:10px 12px; white-space:pre-wrap; word-break:break-word; font-size:.72rem; color:rgba(200,220,235,.9); }
|
||||
.an__det .h { padding:6px 12px; font-size:.66rem; color:rgba(120,225,190,.9); border-bottom:1px solid rgba(80,200,170,.14); display:flex; }
|
||||
.an__det .h b { color:#fff; } .an__det .h .x { margin-left:auto; cursor:pointer; }
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
function esc(s) { return window.jOSb.esc(s); }
|
||||
function hhmmss(ts) { var d = new Date(ts); return ('0' + d.getHours()).slice(-2) + ':' + ('0' + d.getMinutes()).slice(-2) + ':' + ('0' + d.getSeconds()).slice(-2) + '.' + ('00' + d.getMilliseconds()).slice(-3); }
|
||||
|
||||
function describe() {
|
||||
var n = window.jOSWireshark ? window.jOSWireshark.list().length : 0;
|
||||
return { v: 1, id: 'analyse', title: 'Analyse', icon: '🔬', items: [
|
||||
{ p: 1, kind: 'stat', label: 'paquets capturés', value: n }
|
||||
] };
|
||||
}
|
||||
function mount(container, ctx) {
|
||||
var alive = true, unsub = null, paused = false, kind = 'tout';
|
||||
var scope = (ctx && ctx.scope) ? ('' + ctx.scope) : '';
|
||||
var rows = []; // copie locale des packets retenus
|
||||
|
||||
if (!window.jOSWireshark) {
|
||||
container.innerHTML = '<div class="an"><div class="an__msg">jOSWireshark indisponible (le bus n\'est pas chargé).</div></div>';
|
||||
return { unmount: function () { container.innerHTML = ''; } };
|
||||
}
|
||||
|
||||
container.innerHTML =
|
||||
'<div class="an">'
|
||||
+ '<div class="an__bar"><span class="an__t">🔬 <b>ANALYSE</b></span>'
|
||||
+ (scope ? '<span class="an__scope">· ' + esc(scope) + '</span>' : '')
|
||||
+ '<span class="an__sp"></span>'
|
||||
+ '<button class="an__tab on" data-k="tout">tout</button>'
|
||||
+ '<button class="an__tab" data-k="bus">bus</button>'
|
||||
+ '<button class="an__tab" data-k="net">réseau</button>'
|
||||
+ '<input class="an__in" data-q placeholder="filtre…" value="' + esc(scope) + '">'
|
||||
+ '<button class="an__b" data-pause title="pause">⏸</button>'
|
||||
+ '<button class="an__b" data-clear title="vider">🗑</button>'
|
||||
+ '<span class="an__meta" data-cnt></span></div>'
|
||||
+ '<div class="an__body" data-body><div class="an__msg">en écoute… (utilise/ouvre un ploxion, les paquets arrivent)</div></div>'
|
||||
+ '<div class="an__det" data-det></div>'
|
||||
+ '</div>';
|
||||
|
||||
var elBody = container.querySelector('[data-body]');
|
||||
var elDet = container.querySelector('[data-det]');
|
||||
var elCnt = container.querySelector('[data-cnt]');
|
||||
var elQ = container.querySelector('[data-q]');
|
||||
|
||||
function pass(e) {
|
||||
if (kind !== 'tout' && e.kind !== kind) return false;
|
||||
var q = (elQ.value || '').trim().toLowerCase();
|
||||
if (q) { var hay = (e.label + ' ' + (e.detail || '')).toLowerCase(); if (hay.indexOf(q) < 0) return false; }
|
||||
return true;
|
||||
}
|
||||
function rowHtml(e) {
|
||||
var cls = e.kind === 'net' ? (e.status >= 200 && e.status < 400 ? 'ok' : (e.status === 0 || e.status === -1 || e.status >= 400 ? 'err' : '')) : '';
|
||||
var meta = e.kind === 'net' ? ((e.status || '·') + (e.ms != null ? ' · ' + e.ms + 'ms' : '')) : '';
|
||||
return '<div class="an__row ' + cls + '" data-id="' + e.id + '">'
|
||||
+ '<span class="an__tm">' + hhmmss(e.ts) + '</span>'
|
||||
+ '<span class="an__k ' + e.kind + '">' + (e.kind === 'net' ? 'net' : 'bus') + '</span>'
|
||||
+ '<span class="an__lb">' + esc(e.label) + '</span>'
|
||||
+ '<span class="an__meta">' + esc(meta) + '</span></div>';
|
||||
}
|
||||
function renderAll() {
|
||||
rows = window.jOSWireshark.list().filter(pass);
|
||||
if (!rows.length) { elBody.innerHTML = '<div class="an__msg">aucun paquet' + (elQ.value ? ' (filtre « ' + esc(elQ.value) +' »)' : '') + '.</div>'; updateCnt(); return; }
|
||||
elBody.innerHTML = rows.slice(-400).map(rowHtml).join('');
|
||||
elBody.scrollTop = elBody.scrollHeight;
|
||||
updateCnt();
|
||||
}
|
||||
function updateCnt() { elCnt.textContent = rows.length + ' pkt'; }
|
||||
|
||||
function onWire(e) {
|
||||
if (!alive || paused) return;
|
||||
if (!pass(e)) return;
|
||||
rows.push(e);
|
||||
var atBottom = (elBody.scrollHeight - elBody.scrollTop - elBody.clientHeight) < 40;
|
||||
if (elBody.querySelector('.an__msg')) elBody.innerHTML = '';
|
||||
elBody.insertAdjacentHTML('beforeend', rowHtml(e));
|
||||
while (elBody.children.length > 400) elBody.removeChild(elBody.firstChild);
|
||||
if (atBottom) elBody.scrollTop = elBody.scrollHeight;
|
||||
updateCnt();
|
||||
}
|
||||
|
||||
// tabs
|
||||
container.querySelector('.an__bar').addEventListener('click', function (e) {
|
||||
var t = e.target.closest('[data-k]'); if (!t) return;
|
||||
kind = t.getAttribute('data-k');
|
||||
container.querySelectorAll('.an__tab').forEach(function (x) { x.classList.toggle('on', x === t); });
|
||||
renderAll();
|
||||
});
|
||||
elQ.addEventListener('input', renderAll);
|
||||
container.querySelector('[data-pause]').addEventListener('click', function () {
|
||||
paused = !paused; this.classList.toggle('on', paused); this.textContent = paused ? '▶' : '⏸';
|
||||
if (!paused) renderAll();
|
||||
});
|
||||
container.querySelector('[data-clear]').addEventListener('click', function () { window.jOSWireshark.clear(); renderAll(); elDet.classList.remove('open'); });
|
||||
|
||||
// inspecter un packet
|
||||
elBody.addEventListener('click', function (e) {
|
||||
var r = e.target.closest('[data-id]'); if (!r) return;
|
||||
var id = +r.getAttribute('data-id');
|
||||
var pkt = window.jOSWireshark.list().filter(function (x) { return x.id === id; })[0];
|
||||
if (!pkt) return;
|
||||
elDet.innerHTML = '<div class="h">paquet #' + pkt.id + ' · <b>' + esc(pkt.kind) + '</b> · ' + hhmmss(pkt.ts) + '<span class="x" data-close>✕</span></div>'
|
||||
+ '<pre>' + esc(JSON.stringify(pkt, null, 2)) + '</pre>';
|
||||
elDet.classList.add('open');
|
||||
elDet.querySelector('[data-close]').addEventListener('click', function () { elDet.classList.remove('open'); });
|
||||
});
|
||||
|
||||
renderAll();
|
||||
unsub = window.jOSWireshark.subscribe(onWire);
|
||||
return { unmount: function () { alive = false; if (typeof unsub === 'function') { try { unsub(); } catch (e) {} } container.innerHTML = ''; } };
|
||||
}
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['analyse'] = { manifest: { id: 'analyse', name: 'Analyse', icon: '🔬' }, mount: mount, describe: describe };
|
||||
})();
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user