daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR
git clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
Log | Files | Refs | README | LICENSE

init.ts (1260B)


      1 /**
      2  * Wires the shared daemon-sec effects into this site: the cursor with its
      3  * action pill and the sheet image viewer. (The dot field is mounted by
      4  * SignalField.astro and the hero.) Astro's ClientRouter swaps the body on
      5  * navigation, so both re-bind on every `astro:page-load`.
      6  */
      7 import { mountCursor } from './cursor';
      8 import { initViewer } from './viewer';
      9 
     10 const READ = /^\/(?:sheets|payloads|internal|hacktricks)\/[^?#]+/;
     11 const BROWSE = /^\/(?:[a-z0-9-]+|tags\/[^/?#]+|hacktricks\/section\/[^/?#]+)\/?(?:[?#].*)?$/;
     12 const NOT_BROWSE = /^\/(?:credits|tags)?\/?$/;
     13 
     14 let destroyCursor: (() => void) | null = null;
     15 
     16 export function initDmn(): void {
     17   initViewer();
     18   if (document.querySelector('.dmn-cursor')) return;
     19   destroyCursor?.();
     20   destroyCursor = mountCursor({
     21     linkLabel: (href, link) => {
     22       // The masthead and footer are navigation, not content: no pill.
     23       if (link.closest('.mast, .dfooter')) return null;
     24       if (READ.test(href)) return 'Read';
     25       if (BROWSE.test(href) && !NOT_BROWSE.test(href)) return 'Browse';
     26       return null;
     27     },
     28     /* Dark bands are `.plate`; `.plate-dawn` panels inside them are light. */
     29     isDark: (t) => t.closest('.plate, .plate-dawn')?.classList.contains('plate') ?? false,
     30   });
     31 }