tracker
All repositories: gitoria
2.7 KB
// login.js — the small bridge between ident's <ident-selector> and the tracker shell (components/main.hl; the same// as calendar's/gitoria's login.js — copied unchanged, creator: "login.js is correct, as thats for externals in// general"). Plain JS because hl:web cannot listen to a custom DOM event: `ident-login`// (event.detail.code, the one-time code) goes into the hidden input #identcode, whose `change` the shell handles// (→ face trackerLogin, server-side exchange). The shell keeps the selector element's class at `in` / `out`; it is// mirrored here into the selector's `loggedIn` (false = back to "choose ident").// BACK TO THE PAGE: the "Log in with ident" click gets `?next=<this page>` in its return URL (project.hl safePath).// RUNS ONCE PER DOCUMENT: hl:web re-creates the header and its <script>s when the login state flips, the// selector element is then a NEW one; listeners sit on `document`, the CURRENT #selector is looked up each// time, and a one-time code is handed to the shell at most once.(() => {if (window.__trackerLogin) { window.__trackerLogin.sync(); return; }const sync = () => {const sel = document.getElementById('selector');// not upgraded yet: a property set now would shadow the element's own accessorif (!sel || !window.customElements || !customElements.get('ident-selector')) return;const want = sel.classList.contains('in');if (sel.loggedIn !== want) sel.loggedIn = want;};new MutationObserver(sync).observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeFilter: ['class'] });if (window.customElements) customElements.whenDefined('ident-selector').then(sync);const handed = new Set();document.addEventListener('ident-login', (e) => {const code = e.detail && e.detail.code;const input = document.getElementById('identcode');if (!input || !code || handed.has(code)) return; // a one-time code is exchanged oncehanded.add(code);input.value = code;input.dispatchEvent(new Event('change', { bubbles: true }));});const withNext = (a) => {try {const u = new URL(a.href);const ret = new URL(u.searchParams.get('return'));const here = location.pathname + location.search;ret.search = '';if (here !== '/' && here.length <= 500) ret.searchParams.set('next', here);u.searchParams.set('return', ret.href);a.href = u.href;} catch (err) { /* keep the server's href: the login still works, it returns to / */ }};const onButton = (e) => {const a = e.target && e.target.closest && e.target.closest('#loginbutton');if (a) withNext(a);};for (const t of ['click', 'auxclick', 'contextmenu']) document.addEventListener(t, onButton, true);window.__trackerLogin = { sync };})();
Branches
Latest commits
- e5b99aecmission 046: photoQueue in slices (people.hl photoQueueStart/Step, jobs.hl photoTick), tests/photoqueue.hlmre
- 31dcf2admission 045: report, LOGmre
- 9c3971d0tests/persons-skip-count.hlmre
- 4d72e365mission 045mre
- b9cae4c9slices: skip and count non-row values from range(); merge persons pass falls back to iterate; guard testmre
- 3db7dc31merge w44-jobs-slices into w43-trkmemmre
- 593dab6fmission 043: report, LOGmre
- 1a5a4818boot scans back to iterate (slices measured slower: titles 114 s, episodes 141 s, persons failed); lambda per rowmre
- 03d29893boot scans read primary-key slices (lib/slices.hl from mission 044): iterate is eager too; people view log line back; allShows/allEpisodes stay for toolsmre
- 23375c58mission 044: report, LOG, STATUSmre
- c6fd928emission 044: 4096 slices for tables over 200 K rows, 15 ms budget, TRACKER_SLICE_DEPTH for testsmre
- fb057680mission 044: jobs.hl imports mergeLeft (gate found it), mission file, slices benchmre
- 0d6293ebmission 043: mission filemre
- d25bd14amission 044: sliced merge prepare + sliced collections prepare; jobs-dump old/new check + bulk fixturemre
- 633ee210mission 044: sliced table scans (slices.hl, pk-range slices) for the adult/kind/status/art/credits/details-repair queuesmre
- 55bbd619boot: one streamed pass per table (lib/bootscan.hl) instead of find(null,null) per module; follows/watches/franchises scans streammre
- 1d465d3ere-vendor plugins to Hybriel master f9614007 (mpackdb #202 copy fix, libmpackdb sha 6fb3b9d6)mre
- 6648ba44mission 042: real-browser E2E on ce6f2e0a re-vendor 69/0 at 390 + 1280mre
- 3ed3a0efmission 042: gates old/new equal (browser #41 route-table regex accepts unescaped hl:web output), real-data TTFB, E2E blocked by lisbeth lockmre
- d5b61e90LOG 042mre