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 @@
|
||||
# 🔑 Mots de passe
|
||||
|
||||
Générateur de mots de passe crypto : longueur + classes réglables, force en bits, copie. Rien n'est stocké. Composé de bions.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| id | `password` |
|
||||
| fournit | `password` `crypto` `generate` |
|
||||
| bions qu'il nomme | `jOSApps` |
|
||||
| fichiers | `app.blade.php` |
|
||||
| dans le labo | `resources/views/ploxions/password/` (dépôt `my_website2`) |
|
||||
|
||||
## Contribuer
|
||||
|
||||
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=password — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||
- **Dans VS Code** : `xb prendre password` (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
|
||||
92
app.blade.php
Normal file
92
app.blade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
{{-- PL0XION password — générateur de mots de passe (von Neumann, forge PAR BIONS).
|
||||
Aléa CRYPTO (crypto.getRandomValues), longueur + classes réglables, force
|
||||
estimée, copie (bion copy), réglages persistés (bion store) — JAMAIS le mot de
|
||||
passe lui-même. Composé sur window.jOSb. mount(c,ctx)->{unmount}. 100% local. --}}
|
||||
@include('ploxions._bions')
|
||||
<style>
|
||||
.pw { display:flex; flex-direction:column; height:100%; overflow-y:auto; -webkit-overflow-scrolling:touch; background:#0c0b10; color:#ece8f4; font-family:ui-sans-serif,system-ui,sans-serif; gap:14px; padding:16px; align-items:center; justify-content:center; }
|
||||
.pw__out { width:100%; max-width:440px; display:flex; gap:8px; }
|
||||
.pw__field { flex:1; min-width:0; background:rgba(0,0,0,.34); border:1px solid rgba(160,140,255,.3); border-radius:10px; color:#efeaff;
|
||||
padding:13px 12px; font:1.05rem ui-monospace,monospace; word-break:break-all; min-height:1.3em; user-select:all; }
|
||||
.pw__copy { cursor:pointer; flex:0 0 auto; border-radius:10px; border:0; background:#a78bfa; color:#1a1030; font-weight:800; padding:0 16px; }
|
||||
.pw__copy:hover { filter:brightness(1.08); }
|
||||
.pw__bar { width:100%; max-width:440px; height:7px; border-radius:4px; background:rgba(160,140,255,.15); overflow:hidden; }
|
||||
.pw__bar i { display:block; height:100%; width:0; transition:width .2s, background .2s; }
|
||||
.pw__strength { font-size:.72rem; color:rgba(210,200,235,.7); }
|
||||
.pw__cfg { width:100%; max-width:440px; display:flex; flex-direction:column; gap:9px; }
|
||||
.pw__len { display:flex; align-items:center; gap:10px; font-size:.8rem; color:rgba(210,200,235,.8); }
|
||||
.pw__len input[type=range] { flex:1; accent-color:#a78bfa; }
|
||||
.pw__opts { display:flex; gap:7px; flex-wrap:wrap; }
|
||||
.pw__chip { cursor:pointer; font-size:.76rem; padding:6px 12px; border-radius:18px; border:1px solid rgba(160,140,255,.3); background:rgba(28,22,46,.5); color:rgba(220,210,245,.85); user-select:none; }
|
||||
.pw__chip.on { background:rgba(120,90,230,.45); border-color:rgba(167,139,250,.7); color:#fff; }
|
||||
.pw__gen { cursor:pointer; border-radius:10px; border:0; background:#7c5cff; color:#fff; font-weight:800; font-size:.95rem; padding:11px 26px; }
|
||||
.pw__gen:hover { filter:brightness(1.08); }
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var SETS = { maj: 'ABCDEFGHJKLMNPQRSTUVWXYZ', min: 'abcdefghijkmnpqrstuvwxyz', num: '23456789', sym: '!@#$%^&*-_=+?' };
|
||||
function rand(n) { var a = new Uint32Array(1); (window.crypto || window.msCrypto).getRandomValues(a); return a[0] % n; }
|
||||
|
||||
function describe() {
|
||||
var store = window.jOSb ? jOSb.store('xb:password') : { get: function (d) { return d; } };
|
||||
var cfg = store.get({ len: 16, maj: true, min: true, num: true, sym: true }) || { len: 16 };
|
||||
return { v: 1, id: 'password', title: 'Mots de passe', icon: '🔑', items: [
|
||||
{ p: 1, kind: 'stat', label: 'longueur configurée', value: cfg.len + ' caractères' }
|
||||
] };
|
||||
}
|
||||
function mount(container, ctx) {
|
||||
var store = window.jOSb ? jOSb.store('xb:password') : { get: function (d) { return d; }, set: function () {} };
|
||||
var cfg = store.get({ len: 16, maj: true, min: true, num: true, sym: true }) || { len: 16, maj: true, min: true, num: true, sym: true };
|
||||
container.innerHTML =
|
||||
'<div class="pw">'
|
||||
+ ' <div class="pw__out"><div class="pw__field" data-pw>—</div><button class="pw__copy" data-copy>copier</button></div>'
|
||||
+ ' <div class="pw__bar"><i data-bar></i></div><div class="pw__strength" data-strength></div>'
|
||||
+ ' <div class="pw__cfg">'
|
||||
+ ' <div class="pw__len">longueur <input type="range" min="6" max="48" data-len><b data-lenv>16</b></div>'
|
||||
+ ' <div class="pw__opts">'
|
||||
+ ['maj A-Z|maj', 'min a-z|min', 'chiffres 0-9|num', 'symboles|sym'].map(function (o) { var p = o.split('|'); return '<span class="pw__chip" data-opt="' + p[1] + '">' + p[0] + '</span>'; }).join('') + '</div>'
|
||||
+ ' </div>'
|
||||
+ ' <button class="pw__gen" data-gen>⟳ générer</button>'
|
||||
+ '</div>';
|
||||
var elPw = container.querySelector('[data-pw]'), elBar = container.querySelector('[data-bar]'), elStr = container.querySelector('[data-strength]'), elLen = container.querySelector('[data-len]'), elLenV = container.querySelector('[data-lenv]');
|
||||
elLen.value = cfg.len; elLenV.textContent = cfg.len;
|
||||
['maj', 'min', 'num', 'sym'].forEach(function (k) { container.querySelector('[data-opt="' + k + '"]').classList.toggle('on', !!cfg[k]); });
|
||||
|
||||
function pool() { var p = ''; ['maj', 'min', 'num', 'sym'].forEach(function (k) { if (cfg[k]) p += SETS[k]; }); return p; }
|
||||
function gen() {
|
||||
var p = pool(); if (!p) { elPw.textContent = 'choisis au moins une classe'; return; }
|
||||
var out = '', n = cfg.len;
|
||||
// garantit au moins 1 de chaque classe active
|
||||
var active = ['maj', 'min', 'num', 'sym'].filter(function (k) { return cfg[k]; });
|
||||
active.forEach(function (k) { out += SETS[k][rand(SETS[k].length)]; });
|
||||
for (var i = out.length; i < n; i++) out += p[rand(p.length)];
|
||||
out = out.split('').sort(function () { return rand(3) - 1; }).slice(0, n).join('');
|
||||
elPw.textContent = out; strength(out, p.length);
|
||||
}
|
||||
function strength(pw, poolSize) {
|
||||
var bits = pw.length * Math.log2(poolSize || 2);
|
||||
var pct = Math.max(6, Math.min(100, bits / 1.28));
|
||||
var col = bits < 40 ? '#f87171' : bits < 70 ? '#fbbf24' : '#34d399';
|
||||
var lab = bits < 40 ? 'faible' : bits < 70 ? 'correct' : bits < 100 ? 'fort' : 'béton';
|
||||
elBar.style.width = pct + '%'; elBar.style.background = col;
|
||||
elStr.textContent = Math.round(bits) + ' bits d\'entropie · ' + lab;
|
||||
}
|
||||
function save() { store.set(cfg); }
|
||||
|
||||
elLen.addEventListener('input', function () { cfg.len = +elLen.value; elLenV.textContent = cfg.len; save(); gen(); });
|
||||
container.querySelectorAll('[data-opt]').forEach(function (c) { c.addEventListener('click', function () {
|
||||
var k = c.getAttribute('data-opt'); cfg[k] = !cfg[k]; c.classList.toggle('on', cfg[k]); save(); gen(); }); });
|
||||
container.querySelector('[data-gen]').addEventListener('click', gen);
|
||||
container.querySelector('[data-copy]').addEventListener('click', function () {
|
||||
var v = elPw.textContent; if (!v || v.indexOf(' ') >= 0) return;
|
||||
if (window.jOSb) { jOSb.copy(v); jOSb.toast(container, '✓ copié (colle-le vite)'); }
|
||||
});
|
||||
|
||||
gen();
|
||||
return { unmount: function () { container.innerHTML = ''; } };
|
||||
}
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['password'] = { manifest: { id: 'password', name: 'Mots de passe', icon: '🔑' }, mount: mount, describe: describe };
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user