sitecheckultra 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/analyzer.js CHANGED
@@ -221,10 +221,15 @@ function parseHtmlSax(html, finalUrl, origin) {
221
221
 
222
222
  // Link capture
223
223
  const internalMap = new Map();
224
- const externalMap = new Map();
224
+ const externalMap = new Map();
225
225
  let activeLink = null;
226
226
  let activeLinkDepth = 0;
227
227
 
228
+ /* Link-Kontext: die zuletzt gesehene Überschrift vor dem <a> ist die
229
+ * Sektion, aus der der Link stammt (z. B. Button "Mehr erfahren" unter H2 "Preise"). */
230
+ let currentSectionHeading = '';
231
+ let currentSectionTag = '';
232
+
228
233
  // Scripts & Images
229
234
  const scriptSet = new Set();
230
235
  let imageCount = 0;
@@ -344,8 +349,8 @@ function parseHtmlSax(html, finalUrl, origin) {
344
349
  const map = isSameOrigin ? internalMap : externalMap;
345
350
  if (!map.has(normalized)) {
346
351
  const linkEntry = isSameOrigin
347
- ? { url: normalized, path: normalized.slice(origin.length) || '/', text: '', nofollow }
348
- : { url: normalized, host: '', text: '', nofollow };
352
+ ? { url: normalized, path: normalized.slice(origin.length) || '/', text: '', nofollow, fromSection: currentSectionHeading, sectionTag: currentSectionTag }
353
+ : { url: normalized, host: '', text: '', nofollow, fromSection: currentSectionHeading, sectionTag: currentSectionTag };
349
354
  if (!isSameOrigin) {
350
355
  try { linkEntry.host = new URL(normalized).host; } catch { linkEntry.host = ''; }
351
356
  }
@@ -456,6 +461,13 @@ function parseHtmlSax(html, finalUrl, origin) {
456
461
  headingCounts[tagKey] = (headingCounts[tagKey] || 0) + 1;
457
462
  headingCounts.total += 1;
458
463
  if (top.level > maxHeadingLevel) maxHeadingLevel = top.level;
464
+ /* Sektions-Kontext für Link-Herkunft: die zuletzt geschlossene
465
+ * Überschrift mit Text ist die nächste Sektion über dem Link.
466
+ * Leere H-Tags lassen den bisherigen Kontext bestehen. */
467
+ if (cleanText && top.level <= 6) {
468
+ currentSectionHeading = cleanText.slice(0, 120);
469
+ currentSectionTag = tagKey;
470
+ }
459
471
  }
460
472
  }
461
473
  }
package/lib/crawler.js CHANGED
@@ -744,10 +744,18 @@ class CrawlManager {
744
744
  url: l.url,
745
745
  type,
746
746
  sources: new Set(),
747
+ sourceUrls: new Map(),
747
748
  sampleText: l.text || ''
748
749
  });
749
750
  }
750
- linkMap.get(l.url).sources.add(p.path);
751
+ linkMap.get(key).sources.add(p.path);
752
+ if (l.fromSection) {
753
+ linkMap.get(key).sourceUrls.set(p.url, {
754
+ path: p.path,
755
+ section: l.fromSection,
756
+ sectionTag: l.sectionTag || ''
757
+ });
758
+ }
751
759
  }
752
760
  };
753
761
  addLinks(p.internalLinks, 'internal');
@@ -811,7 +819,8 @@ class CrawlManager {
811
819
  error,
812
820
  responseTimeMs: Date.now() - started,
813
821
  sampleText: item.sampleText,
814
- sources: [...item.sources]
822
+ sources: [...item.sources],
823
+ sourceDetails: [...item.sourceUrls.values()].map((s) => ({ path: s.path, url: s.url, section: s.section, sectionTag: s.sectionTag }))
815
824
  });
816
825
  crawl.linkCheck.checked = results.length;
817
826
  };
package/lib/exporter.js CHANGED
@@ -267,7 +267,7 @@ export function buildHeadingsSheet(crawl) {
267
267
  }
268
268
 
269
269
  export function buildLinksSheet(crawl) {
270
- const headers = ['Ziel-URL', 'Typ', 'Status', 'Defekt', 'Fehler', 'Linktext', 'Gefunden auf'];
270
+ const headers = ['Ziel-URL', 'Typ', 'Status', 'Defekt', 'Fehler', 'Linktext', 'Gefunden auf', 'Sektion (Überschrift)'];
271
271
  const rows = (crawl.linkCheck?.results || []).map((l) => [
272
272
  l.url,
273
273
  l.type === 'external' ? 'Extern' : 'Intern',
@@ -275,7 +275,8 @@ export function buildLinksSheet(crawl) {
275
275
  l.broken ? 'Ja' : 'Nein',
276
276
  l.error || '',
277
277
  l.sampleText || '',
278
- (l.sources || []).join(', ')
278
+ (l.sources || []).join(', '),
279
+ (l.sourceDetails || []).map((d) => `${d.path} → ${d.sectionTag ? d.sectionTag.toUpperCase() + ': ' : ''}${d.section || '–'}`).join(' | ')
279
280
  ]);
280
281
  return { name: 'Link Check', headers, rows };
281
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sitecheckultra",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Site Check Ultra – Website Audit Tool (SEO, AEO, Speed, Mobile, WCAG, H-Baum, Redirects, Schema, Tracking, Link-Check)",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/public/app.js CHANGED
@@ -1328,6 +1328,25 @@ async function init() {
1328
1328
  renderColumnPicker();
1329
1329
  await Promise.all([loadSettings(), refreshCrawlsList()]);
1330
1330
  renderHeaderState();
1331
+
1332
+ // Auto-Reload bei Server-Update: prüfe alle 60s, ob der Server neu gestartet
1333
+ // wurde oder eine andere Version hat (z. B. nach npm-Update). Dann lädt der
1334
+ // Tab einmalig selbst neu — kein manuelles Cmd+R mehr nötig.
1335
+ let lastVersionInfo = null;
1336
+ const checkServerVersion = async () => {
1337
+ try {
1338
+ const v = await api('/api/version');
1339
+ const info = `${v.version}|${v.startedAt}`;
1340
+ if (lastVersionInfo === null) lastVersionInfo = info;
1341
+ else if (info !== lastVersionInfo) {
1342
+ showToast('Neue Version geladen — Seite wird aktualisiert…');
1343
+ setTimeout(() => window.location.reload(), 900);
1344
+ return;
1345
+ }
1346
+ } catch { /* Server offline — nichts tun, SSE zeigt Verbindungsfehler */ }
1347
+ setTimeout(checkServerVersion, 60000);
1348
+ };
1349
+ checkServerVersion();
1331
1350
  }
1332
1351
 
1333
1352
  async function loadSettings() {
@@ -1357,7 +1376,12 @@ async function refreshCrawlsList(selectId = null) {
1357
1376
 
1358
1377
  const legacyCrawls = state.crawlsList.filter((c) => !c.siteIcon && !c.siteLogo);
1359
1378
  // Resolve old crawl branding through the local server; no browser CORS dependency.
1360
- void Promise.all(legacyCrawls.map(async (c) => {
1379
+ // Wichtig: jeder Legacy-Crawl wird nur EINMAL pro Session aufgelöst — frühere
1380
+ // Endlos-Retries (alle 3s pro Crawl) haben den API-Rate-Limiter aufgefressen.
1381
+ if (!state.brandingAttempted) state.brandingAttempted = new Set();
1382
+ const pending = legacyCrawls.filter((c) => !state.brandingAttempted.has(c.id));
1383
+ pending.forEach((c) => state.brandingAttempted.add(c.id));
1384
+ void Promise.all(pending.map(async (c) => {
1361
1385
  try {
1362
1386
  const assets = await api(`/api/crawls/${encodeURIComponent(c.id)}/branding`);
1363
1387
  Object.assign(c, assets);
@@ -1438,6 +1462,9 @@ function renderRecentCrawlsOnWelcome() {
1438
1462
  const host = (c.origin || c.startUrl || '').replace(/^https?:\/\//i, '');
1439
1463
  const running = c.status === 'running';
1440
1464
  const pct = crawlPercent(c);
1465
+ /* Live-Seitenzahl: laufende Crawls nutzen progress.crawled (alle 250ms aktuell),
1466
+ * da pageCount auf Disk nur alle 15s per Autosave gespeichert wird. */
1467
+ const liveCount = running && c.progress ? Math.max(c.progress.crawled || 0, c.pageCount || 0) : (c.pageCount || 0);
1441
1468
  const pillCls = running ? 'pill-blue' : c.status === 'completed' ? 'pill-green' : c.status === 'error' ? 'pill-red' : 'pill-gray';
1442
1469
  const timeLabel = c.status === 'completed' ? 'Fertig' : 'Ende';
1443
1470
  return `
@@ -1446,7 +1473,7 @@ function renderRecentCrawlsOnWelcome() {
1446
1473
  ${crawlAvatarHtml(c)}
1447
1474
  <div class="recent-crawl-content">
1448
1475
  <strong class="recent-crawl-url" title="${escapeHtml(c.startUrl)}">${escapeHtml(c.startUrl)}</strong>
1449
- <div class="recent-crawl-meta">${c.pageCount.toLocaleString('de-DE')} ${c.pageCount === 1 ? 'Seite' : 'Seiten'} · ${c.mode === 'single' ? 'Einzel-URL' : 'Ganze Website'} · Render: ${escapeHtml(c.renderMode)}</div>
1476
+ <div class="recent-crawl-meta">${liveCount.toLocaleString('de-DE')} ${liveCount === 1 ? 'Seite' : 'Seiten'} · ${c.mode === 'single' ? 'Einzel-URL' : 'Ganze Website'} · Render: ${escapeHtml(c.renderMode)}</div>
1450
1477
  <div class="recent-crawl-times">
1451
1478
  <span title="Crawl gestartet">${formatDate(c.createdAt)} · Start ${formatClock(c.createdAt)}</span>
1452
1479
  <span title="Crawl beendet">${timeLabel} ${formatClock(c.finishedAt)}</span>
@@ -1579,7 +1606,11 @@ function attachSse(crawlId) {
1579
1606
  };
1580
1607
  const updateRecentProgress = (crawl) => {
1581
1608
  const summary = state.crawlsList.find((item) => item.id === crawlId);
1582
- if (summary) summary.progress = { ...crawl.progress };
1609
+ const liveCount = Array.isArray(crawl.pages) ? crawl.pages.length : null;
1610
+ if (summary) {
1611
+ summary.progress = { ...crawl.progress };
1612
+ if (liveCount !== null) summary.pageCount = liveCount;
1613
+ }
1583
1614
  const card = document.querySelector(`[data-load-crawl="${CSS.escape(crawlId)}"]`);
1584
1615
  if (!card?.classList.contains('is-running')) return;
1585
1616
  const pct = crawlPercent(crawl);
@@ -1587,6 +1618,11 @@ function attachSse(crawlId) {
1587
1618
  card.querySelector('[data-crawl-progress-text]').textContent = `${crawl.progress?.crawled || 0} / ${total} Seiten · ${pct}%`;
1588
1619
  card.querySelector('[data-crawl-progress-fill]').style.width = `${pct}%`;
1589
1620
  card.querySelector('[role="progressbar"]').setAttribute('aria-valuenow', String(pct));
1621
+ // Meta-Zeile mit der LIVE erfassten Seitenzahl aktualisieren (statt 0 während des Laufs)
1622
+ const meta = card.querySelector('.recent-crawl-meta');
1623
+ if (meta && liveCount !== null) {
1624
+ meta.textContent = `${liveCount.toLocaleString('de-DE')} ${liveCount === 1 ? 'Seite' : 'Seiten'} · ${crawl.mode === 'single' ? 'Einzel-URL' : 'Ganze Website'} · Render: ${escapeHtml(crawl.renderMode || 'auto')}`;
1625
+ }
1590
1626
  const badge = card.querySelector('.toolbar-actions > .pill');
1591
1627
  if (badge) badge.textContent = `Läuft ${pct}%`;
1592
1628
  };
@@ -2274,12 +2310,93 @@ function renderLinksTab() {
2274
2310
  <td><span class="pill ${r.type === 'external' ? 'pill-blue' : 'pill-gray'}">${r.type === 'external' ? 'Extern' : 'Intern'}</span></td>
2275
2311
  <td style="max-width:340px;word-break:break-all"><a href="${escapeHtml(r.url)}" target="_blank" rel="noopener" style="color:var(--accent)">${escapeHtml(r.url)}</a>${r.error ? `<div class="small" style="color:var(--red-text)">${escapeHtml(r.error)}</div>` : ''}</td>
2276
2312
  <td style="max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${escapeHtml(r.sampleText || '–')}</td>
2277
- <td style="max-width:240px;font-family:monospace;font-size:11.5px">${escapeHtml((r.sources || []).slice(0, 3).join(', '))}${r.sources.length > 3 ? ` (+${r.sources.length - 3})` : ''}</td>
2313
+ <td style="max-width:260px">
2314
+ ${renderLinkSourcesCell(r)}
2315
+ </td>
2278
2316
  <td class="num muted">${r.responseTimeMs} ms</td>
2279
2317
  </tr>
2280
2318
  `).join('');
2281
2319
  }
2282
2320
 
2321
+ /* ==================== LINK-QUELLEN (Herkunft) ====================
2322
+ * "Gefunden auf"-Zelle: klickbare Quelle(n) mit Sektions-Überschrift.
2323
+ * Klick auf eine Quelle öffnet den Seiten-Drawer dieser Seite.
2324
+ */
2325
+ let openLinkSourcesPopover = null;
2326
+
2327
+ function closeLinkSourcesPopover() {
2328
+ openLinkSourcesPopover?.remove();
2329
+ openLinkSourcesPopover = null;
2330
+ document.removeEventListener('click', onLinkSourcesOutsideClick, true);
2331
+ }
2332
+
2333
+ function onLinkSourcesOutsideClick(e) {
2334
+ if (openLinkSourcesPopover && !openLinkSourcesPopover.contains(e.target)) closeLinkSourcesPopover();
2335
+ }
2336
+
2337
+ function renderLinkSourcesCell(r) {
2338
+ const count = r.sources?.length || 0;
2339
+ if (!count) return '<span class="muted">–</span>';
2340
+
2341
+ const label = escapeHtml(r.sources.slice(0, 3).join(', '));
2342
+ const more = r.sources.length > 3 ? ` <span class="muted">+${r.sources.length - 3}</span>` : '';
2343
+ return `<button type="button" class="link-source-btn" data-link-source="${escapeHtml(r.url)}" title="Klicken: alle Herkunftsorte dieser Links ansehen">
2344
+ <span class="mono-src">${label}</span>${more}
2345
+ ${r.sourceDetails?.length ? '<span class="src-hint">📍</span>' : ''}
2346
+ </button>`;
2347
+ }
2348
+
2349
+ function showLinkSourcesPopover(anchorBtn, resultUrl) {
2350
+ closeLinkSourcesPopover();
2351
+ const crawl = state.currentCrawl;
2352
+ if (!crawl) return;
2353
+ const result = (crawl.linkCheck?.results || []).find((x) => x.url === resultUrl);
2354
+ if (!result) return;
2355
+
2356
+ // sourceDetails mit Sektion + vollständiger URL für Drawer-Sprung
2357
+ const details = result.sourceDetails || [];
2358
+ const rows = details.map((d) => `
2359
+ <button type="button" class="link-source-row" data-jump-page="${escapeHtml(d.url || '')}">
2360
+ <span class="link-src-path">${escapeHtml(d.path || d.url || '-')}</span>
2361
+ ${d.section ? `<span class="link-src-section">${d.sectionTag ? `<b>${escapeHtml(d.sectionTag.toUpperCase())}</b> ` : ''}${escapeHtml(d.section)}</span>` : '<span class="link-src-section muted">–</span>'}
2362
+ </button>
2363
+ `).join('');
2364
+
2365
+ openLinkSourcesPopover = document.createElement('div');
2366
+ openLinkSourcesPopover.className = 'link-sources-popover';
2367
+ openLinkSourcesPopover.innerHTML = `
2368
+ <div class="link-sources-head">
2369
+ <strong>Herkunft (${details.length || (result.sources || []).length})</strong>
2370
+ <button type="button" class="btn-close" aria-label="Schließen">×</button>
2371
+ </div>
2372
+ <div class="link-sources-list">${rows || '<div class="empty-table">Keine Detail-Infos gespeichert (alter Crawl).</div>'}</div>
2373
+ `;
2374
+
2375
+ // Positionierung am Anchor-Button
2376
+ const rect = anchorBtn.getBoundingClientRect();
2377
+ document.body.appendChild(openLinkSourcesPopover);
2378
+ const popRect = openLinkSourcesPopover.getBoundingClientRect();
2379
+ let top = rect.bottom + 6;
2380
+ let left = Math.min(rect.left, window.innerWidth - popRect.width - 12);
2381
+ if (top + popRect.height > window.innerHeight - 10) {
2382
+ top = Math.max(10, rect.top - popRect.height - 6);
2383
+ }
2384
+ openLinkSourcesPopover.style.top = `${top}px`;
2385
+ openLinkSourcesPopover.style.left = `${Math.max(12, left)}px`;
2386
+
2387
+ openLinkSourcesPopover.querySelector('.btn-close').addEventListener('click', closeLinkSourcesPopover);
2388
+ openLinkSourcesPopover.querySelectorAll('[data-jump-page]').forEach((btn) => {
2389
+ const pageUrl = btn.dataset.jumpPage;
2390
+ if (!pageUrl) return;
2391
+ btn.addEventListener('click', () => {
2392
+ closeLinkSourcesPopover();
2393
+ openDrawer(pageUrl, 'headings');
2394
+ });
2395
+ });
2396
+ openLinkSourcesPopover.addEventListener('click', (e) => e.stopPropagation());
2397
+ document.addEventListener('click', onLinkSourcesOutsideClick, true);
2398
+ }
2399
+
2283
2400
  async function triggerLinkCheck(scope = 'all') {
2284
2401
  if (!state.currentCrawl) return;
2285
2402
  const btn1 = $('btnCheckLinks');
@@ -2523,6 +2640,51 @@ function closeDrawer() {
2523
2640
  state.drawerTrigger = null;
2524
2641
  }
2525
2642
 
2643
+ /* ==================== BILD-VORSCHAU (ALT-FEHLER) ====================
2644
+ * Löst relative Bildpfade zur Seiten-URL auf und zeigt das betroffene Bild
2645
+ * als Thumbnail im Alt-Fehler-Eintrag; Klick öffnet eine Large-Lightbox. */
2646
+ const IMG_THUMB_FALLBACK_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56"><rect width="56" height="56" rx="8" fill="#1f1f1f"/><path d="M20 36 L26 28 L32 34 L36 30 L44 38" stroke="#777" stroke-width="2" fill="none"/><circle cx="24" cy="22" r="3" fill="#777"/></svg>';
2647
+
2648
+ function resolveImgSrc(page, src) {
2649
+ if (!src) return '';
2650
+ try {
2651
+ return new URL(src, page.finalUrl || page.url || state.currentCrawl?.origin).href;
2652
+ } catch {
2653
+ return '';
2654
+ }
2655
+ }
2656
+
2657
+ function openImageLightbox(src, label) {
2658
+ let box = $('imgLightbox');
2659
+ if (!box) {
2660
+ box = document.createElement('div');
2661
+ box.id = 'imgLightbox';
2662
+ box.className = 'modal-backdrop img-lightbox-backdrop';
2663
+ box.innerHTML = `
2664
+ <div class="img-lightbox-card" role="dialog" aria-modal="true" aria-label="Bild-Vorschau">
2665
+ <div class="img-lightbox-head">
2666
+ <span class="img-lightbox-label mono-src"></span>
2667
+ <button type="button" class="btn-close" aria-label="Schließen">×</button>
2668
+ </div>
2669
+ <img class="img-lightbox-img" alt="" />
2670
+ <div class="img-lightbox-foot muted small">
2671
+ <a class="img-lightbox-open" href="#" target="_blank" rel="noopener">Original öffnen ↗</a>
2672
+ </div>
2673
+ </div>`;
2674
+ box.querySelector('.btn-close').addEventListener('click', () => box.classList.add('hidden'));
2675
+ box.addEventListener('click', (e) => { if (e.target === box) box.classList.add('hidden'); });
2676
+ document.body.appendChild(box);
2677
+ }
2678
+ const img = box.querySelector('.img-lightbox-img');
2679
+ img.classList.remove('img-thumb-fail');
2680
+ img.src = src;
2681
+ box.querySelector('.img-lightbox-label').textContent = label || '';
2682
+ const origLink = box.querySelector('.img-lightbox-open');
2683
+ origLink.href = src;
2684
+ origLink.textContent = 'Original öffnen ↗';
2685
+ box.classList.remove('hidden');
2686
+ }
2687
+
2526
2688
  function renderDrawerBody() {
2527
2689
  const page = (state.currentCrawl?.pages || []).find((p) => p.url === state.drawerPageUrl);
2528
2690
  if (!page) return;
@@ -2641,11 +2803,15 @@ function renderDrawerBody() {
2641
2803
  <h3>Bilder &amp; Alt-Texte (${page.imageCount} Bilder · ${page.imagesMissingAltCount} ohne Alt)</h3>
2642
2804
  ${page.imagesMissingAlt?.length ? `
2643
2805
  <div class="meta-grid">
2644
- ${page.imagesMissingAlt.map((img) => `
2645
- <div class="meta-box" style="padding:7px 10px">
2646
- <span class="pill ${img.reason === 'missing' ? 'pill-red' : 'pill-amber'}">${img.reason === 'missing' ? 'Kein alt-Attribut' : 'Leeres alt=""'}</span>
2647
- <div class="small" style="font-family:monospace;margin-top:4px;word-break:break-all">${escapeHtml(img.src || '(inline/data)')}</div>
2648
- </div>
2806
+ ${page.imagesMissingAlt.map((img, i) => `
2807
+ <button type="button" class="meta-box img-issue-box" data-img-issue="${i}" title="Klicken: Bild-Vorschau öffnen">
2808
+ <span class="img-issue-left">
2809
+ <span class="pill ${img.reason === 'missing' ? 'pill-red' : 'pill-amber'}">${img.reason === 'missing' ? 'Kein alt-Attribut' : 'Leeres alt=""'}</span>
2810
+ <img class="img-issue-thumb" src="${escapeHtml(resolveImgSrc(page, img.src))}" alt="" loading="lazy"
2811
+ onerror="this.classList.add('img-thumb-fail')" />
2812
+ </span>
2813
+ <span class="small img-issue-src" style="font-family:monospace;word-break:break-all">${escapeHtml(img.src || '(inline/data)')}</span>
2814
+ </button>
2649
2815
  `).join('')}
2650
2816
  </div>
2651
2817
  ` : `<div class="issue-callout ok">Alle ${page.imageCount} Bilder haben einen Alt-Text.</div>`}
@@ -2706,11 +2872,16 @@ function renderDrawerBody() {
2706
2872
  return `<div class="meta-grid">${links.slice(0, 120).map((l) => {
2707
2873
  const checked = linkStatusMap.get(l.url);
2708
2874
  const statusBadge = checked ? renderStatusPill(checked.status, checked.error) : '';
2875
+ /* Sektions-Herkunft + Sprung zur Ursprungsstelle */
2876
+ const detail = (checked?.sourceDetails || [])[0];
2877
+ const ownSection = checked ? null : (l.fromSection ? { path: page.path, url: page.url, section: l.fromSection, sectionTag: l.sectionTag || '' } : null);
2878
+ const srcDetail = detail || ownSection;
2709
2879
  return `
2710
2880
  <div class="link-detail-row">
2711
2881
  <div class="link-detail-main">
2712
2882
  ${uiIcon('external')}<a href="${escapeHtml(l.url)}" target="_blank" rel="noopener" title="${escapeHtml(l.url)}">${escapeHtml(l.path || l.url)}</a>
2713
2883
  ${l.text ? `<span class="link-detail-anchor">Ankertext: ${escapeHtml(l.text)}</span>` : ''}
2884
+ ${srcDetail ? `<button type="button" class="link-origin-btn" data-jump-drawer-page="${escapeHtml(srcDetail.url || '')}" title="Springen zur Herkunftsstelle: ${escapeHtml(srcDetail.section || '')}">📍 ${srcDetail.sectionTag ? `<b>${escapeHtml(srcDetail.sectionTag.toUpperCase())}</b> ` : ''}${escapeHtml(srcDetail.section || 'Sektion')}</button>` : ''}
2714
2885
  </div>
2715
2886
  <div class="link-detail-status">${l.nofollow ? '<span class="pill pill-amber">nofollow</span> ' : ''}${statusBadge}</div>
2716
2887
  </div>
@@ -3292,6 +3463,20 @@ function bindEvents() {
3292
3463
  renderLinksTab();
3293
3464
  });
3294
3465
 
3466
+ // Link-Quellen: Klick auf "Gefunden auf" öffnet Herkunfts-Popover
3467
+ $('linksTableBody').addEventListener('click', (e) => {
3468
+ const srcBtn = e.target.closest('[data-link-source]');
3469
+ if (srcBtn) {
3470
+ e.stopPropagation();
3471
+ if (openLinkSourcesPopover && openLinkSourcesPopover.dataset.sourceUrl === srcBtn.dataset.linkSource) {
3472
+ closeLinkSourcesPopover();
3473
+ } else {
3474
+ showLinkSourcesPopover(srcBtn, srcBtn.dataset.linkSource);
3475
+ }
3476
+ return;
3477
+ }
3478
+ });
3479
+
3295
3480
  // Redirects Tab
3296
3481
  $('redirectCsvFile').addEventListener('change', async (e) => {
3297
3482
  const file = e.target.files?.[0];
@@ -3323,6 +3508,29 @@ function bindEvents() {
3323
3508
  // Drawer
3324
3509
  $('btnCloseDrawer').addEventListener('click', closeDrawer);
3325
3510
  $('drawerBackdrop').addEventListener('click', closeDrawer);
3511
+ // Alt-Fehler-Eintrag: Klick öffnet Bild-Lightbox
3512
+ $('drawerBody').addEventListener('click', (e) => {
3513
+ const imgBox = e.target.closest('[data-img-issue]');
3514
+ if (!imgBox) return;
3515
+ const page = (state.currentCrawl?.pages || []).find((p) => p.url === state.drawerPageUrl);
3516
+ if (!page) return;
3517
+ const img = (page.imagesMissingAlt || [])[Number(imgBox.dataset.imgIssue)];
3518
+ if (!img) return;
3519
+ openImageLightbox(resolveImgSrc(page, img.src), `${img.src || '(inline/data)'} — ${img.reason === 'missing' ? 'Kein alt-Attribut' : 'Leeres alt=""'}`);
3520
+ });
3521
+ // Link-Herkunft im Drawer: Klick springt zur Ursprungsseite (öffnet deren Drawer)
3522
+ $('drawerBody').addEventListener('click', (e) => {
3523
+ const jumpBtn = e.target.closest('[data-jump-drawer-page]');
3524
+ if (!jumpBtn) return;
3525
+ const pageUrl = jumpBtn.dataset.jumpDrawerPage;
3526
+ if (!pageUrl) return;
3527
+ e.stopPropagation();
3528
+ if (pageUrl === state.drawerPageUrl) {
3529
+ showToast('Der Link befindet sich auf dieser Seite — die Sektion steht im H-Baum-Tab direkt oberhalb.');
3530
+ return;
3531
+ }
3532
+ openDrawer(pageUrl, 'headings');
3533
+ });
3326
3534
  $('drawerTabs').addEventListener('click', (e) => {
3327
3535
  const tab = e.target.closest('.drawer-tab');
3328
3536
  if (!tab) return;
package/public/index.html CHANGED
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com" />
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
10
  <link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
11
- <link rel="stylesheet" href="/styles.css?v=dark-tech-4" />
11
+ <link rel="stylesheet" href="/styles.css?v=dark-tech-7" />
12
12
  </head>
13
13
  <body>
14
14
  <div id="app">
@@ -653,6 +653,6 @@
653
653
  <!-- Toast Notification -->
654
654
  <div class="toast hidden" id="toast"></div>
655
655
 
656
- <script type="module" src="/app.js?v=dark-tech-5"></script>
656
+ <script type="module" src="/app.js?v=dark-tech-7"></script>
657
657
  </body>
658
658
  </html>
package/public/styles.css CHANGED
@@ -2943,6 +2943,205 @@ select:focus-visible {
2943
2943
  padding: 12px 20px 16px;
2944
2944
  }
2945
2945
 
2946
+ /* ==================== LINK-QUELLEN POPOVER ==================== */
2947
+ /* "Gefunden auf"-Zelle im Link-Check: Button öffnet Herkunfts-Liste. */
2948
+ .link-source-btn {
2949
+ display: inline-flex;
2950
+ align-items: center;
2951
+ gap: 6px;
2952
+ max-width: 100%;
2953
+ padding: 3px 8px;
2954
+ background: transparent;
2955
+ border: 1px dashed var(--border);
2956
+ border-radius: 6px;
2957
+ cursor: pointer;
2958
+ font-family: 'Geist Mono', monospace;
2959
+ font-size: 11.5px;
2960
+ transition: border-color 0.12s ease, background 0.12s ease;
2961
+ }
2962
+ .link-source-btn:hover {
2963
+ border-color: var(--accent, #52a8ff);
2964
+ background: rgba(82, 168, 255, 0.08);
2965
+ }
2966
+ .link-source-btn .mono-src {
2967
+ max-width: 210px;
2968
+ overflow: hidden;
2969
+ text-overflow: ellipsis;
2970
+ white-space: nowrap;
2971
+ }
2972
+ .link-source-btn .src-hint { font-size: 9px; opacity: 0.75; }
2973
+
2974
+ .link-sources-popover {
2975
+ position: fixed;
2976
+ z-index: 260;
2977
+ width: min(460px, calc(100vw - 24px));
2978
+ max-height: 60vh;
2979
+ display: flex;
2980
+ flex-direction: column;
2981
+ background: #0a0a0a;
2982
+ border: 1px solid var(--border-strong, #333);
2983
+ border-radius: 10px;
2984
+ box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
2985
+ overflow: hidden;
2986
+ }
2987
+ .link-sources-head {
2988
+ display: flex;
2989
+ align-items: center;
2990
+ justify-content: space-between;
2991
+ padding: 10px 14px;
2992
+ border-bottom: 1px solid var(--border);
2993
+ font-size: 12.5px;
2994
+ }
2995
+ .link-sources-list {
2996
+ overflow: auto;
2997
+ padding: 6px;
2998
+ }
2999
+ .link-source-row {
3000
+ display: flex;
3001
+ flex-direction: column;
3002
+ gap: 2px;
3003
+ width: 100%;
3004
+ padding: 7px 10px;
3005
+ background: transparent;
3006
+ border: 1px solid transparent;
3007
+ border-radius: 7px;
3008
+ cursor: pointer;
3009
+ text-align: left;
3010
+ transition: background 0.1s ease;
3011
+ }
3012
+ .link-source-row:hover { background: #141414; }
3013
+ .link-src-path {
3014
+ font-family: 'Geist Mono', monospace;
3015
+ font-size: 11.5px;
3016
+ color: #ededed;
3017
+ overflow: hidden;
3018
+ text-overflow: ellipsis;
3019
+ white-space: nowrap;
3020
+ }
3021
+ .link-src-section {
3022
+ font-size: 11px;
3023
+ color: #999999;
3024
+ }
3025
+ .link-src-section b {
3026
+ color: #52a8ff;
3027
+ font-weight: 600;
3028
+ }
3029
+
3030
+ /* Herkunfts-Button im Drawer (Links & Redirects Tab) */
3031
+ .link-origin-btn {
3032
+ display: inline-flex;
3033
+ align-items: center;
3034
+ gap: 5px;
3035
+ max-width: 100%;
3036
+ padding: 3px 9px;
3037
+ background: rgba(82, 168, 255, 0.07);
3038
+ border: 1px solid rgba(82, 168, 255, 0.35);
3039
+ border-radius: 6px;
3040
+ cursor: pointer;
3041
+ font-size: 11px;
3042
+ color: #c7c7c7;
3043
+ transition: background 0.12s ease, border-color 0.12s ease;
3044
+ width: fit-content;
3045
+ }
3046
+ .link-origin-btn:hover {
3047
+ background: rgba(82, 168, 255, 0.16);
3048
+ border-color: #52a8ff;
3049
+ }
3050
+ .link-origin-btn b { color: #52a8ff; font-weight: 600; }
3051
+
3052
+ /* ==================== BILD-VORSCHAU (ALT-FEHLER) ==================== */
3053
+ /* Klickbarer Alt-Fehler-Eintrag mit Bild-Thumbnail + Lightbox-Großansicht. */
3054
+ .img-issue-box {
3055
+ display: flex;
3056
+ flex-direction: row;
3057
+ align-items: center;
3058
+ gap: 10px;
3059
+ padding: 7px 10px;
3060
+ background: transparent;
3061
+ border: 1px solid var(--border);
3062
+ border-radius: 8px;
3063
+ cursor: pointer;
3064
+ text-align: left;
3065
+ transition: border-color 0.12s ease, background 0.12s ease;
3066
+ }
3067
+ .img-issue-box:hover {
3068
+ border-color: var(--accent, #52a8ff);
3069
+ background: rgba(82, 168, 255, 0.06);
3070
+ }
3071
+ .img-issue-left {
3072
+ display: flex;
3073
+ flex-direction: column;
3074
+ align-items: flex-start;
3075
+ gap: 5px;
3076
+ flex-shrink: 0;
3077
+ }
3078
+ .img-issue-thumb {
3079
+ width: 56px;
3080
+ height: 56px;
3081
+ object-fit: cover;
3082
+ border-radius: 6px;
3083
+ border: 1px solid var(--border);
3084
+ background: #141414 center/cover no-repeat;
3085
+ }
3086
+ .img-issue-thumb.img-thumb-fail {
3087
+ background: #1f1f1f url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Crect width='56' height='56' rx='8' fill='%231f1f1f'/%3E%3Cpath d='M20 36 L26 28 L32 34 L36 30 L44 38' stroke='%23777' stroke-width='2' fill='none'/%3E%3Ccircle cx='24' cy='22' r='3' fill='%23777'/%3E%3C/svg%3E") center/36px no-repeat;
3088
+ }
3089
+ .img-issue-src {
3090
+ flex: 1 1 auto;
3091
+ min-width: 0;
3092
+ }
3093
+
3094
+ .img-lightbox-backdrop {
3095
+ z-index: 320;
3096
+ display: flex;
3097
+ align-items: center;
3098
+ justify-content: center;
3099
+ }
3100
+ .img-lightbox-card {
3101
+ display: flex;
3102
+ flex-direction: column;
3103
+ max-width: min(900px, calc(100vw - 40px));
3104
+ max-height: min(84vh, 780px);
3105
+ background: #0a0a0a;
3106
+ border: 1px solid var(--border-strong, #333);
3107
+ border-radius: 12px;
3108
+ overflow: hidden;
3109
+ }
3110
+ .img-lightbox-head {
3111
+ display: flex;
3112
+ align-items: center;
3113
+ justify-content: space-between;
3114
+ gap: 12px;
3115
+ padding: 10px 16px;
3116
+ border-bottom: 1px solid var(--border);
3117
+ }
3118
+ .img-lightbox-label {
3119
+ font-family: 'Geist Mono', monospace;
3120
+ font-size: 11.5px;
3121
+ color: #ededed;
3122
+ word-break: break-all;
3123
+ min-width: 0;
3124
+ }
3125
+ .img-lightbox-img {
3126
+ display: block;
3127
+ max-width: 100%;
3128
+ max-height: 62vh;
3129
+ object-fit: contain;
3130
+ background: #000;
3131
+ }
3132
+ .img-lightbox-img.img-thumb-fail {
3133
+ width: 220px;
3134
+ height: 160px;
3135
+ margin: 30px auto;
3136
+ background: #1f1f1f url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Crect width='56' height='56' rx='8' fill='%231f1f1f'/%3E%3Cpath d='M20 36 L26 28 L32 34 L36 30 L44 38' stroke='%23777' stroke-width='2' fill='none'/%3E%3Ccircle cx='24' cy='22' r='3' fill='%23777'/%3E%3C/svg%3E") center/64px no-repeat;
3137
+ }
3138
+ .img-lightbox-foot {
3139
+ padding: 10px 16px 12px;
3140
+ text-align: right;
3141
+ }
3142
+ .img-lightbox-open { color: #52a8ff; text-decoration: none; }
3143
+ .img-lightbox-open:hover { text-decoration: underline; }
3144
+
2946
3145
  /* Definitive dark surfaces; blue is reserved for focus and active selection. */
2947
3146
  .filter-strip,
2948
3147
  #pagesFilterBar {
package/server.js CHANGED
@@ -26,10 +26,12 @@ app.use((_req, res, next) => {
26
26
  next();
27
27
  });
28
28
 
29
- // Simple in-memory Rate Limiter (100 requests per minute per IP)
29
+ // Simple in-memory Rate Limiter (300 requests per minute per IP)
30
+ // Lokales Audit-Tool: SSE-Streaming, Live-Polling und Link-Checks nutzen
31
+ // die API intensiv — 300/min verhindert Missbrauch, ohne legitime Nutzung zu blockieren.
30
32
  const rateLimitMap = new Map();
31
33
  const RATE_LIMIT_WINDOW = 60 * 1000; // 1 minute
32
- const RATE_LIMIT_MAX = 100;
34
+ const RATE_LIMIT_MAX = 300;
33
35
 
34
36
  app.use((req, res, next) => {
35
37
  // Skip rate limiting for static files
@@ -77,7 +79,7 @@ app.use(express.static(path.join(__dirname, 'public'), {
77
79
 
78
80
  // Health & environment info
79
81
  app.get('/api/health', (_req, res) => {
80
- const chromePath = findLocalBrowserPath();
82
+ const chromePath = findLocalBrowserPath();
81
83
  res.json({
82
84
  ok: true,
83
85
  chromeAvailable: Boolean(chromePath),
@@ -85,6 +87,18 @@ app.get('/api/health', (_req, res) => {
85
87
  });
86
88
  });
87
89
 
90
+ // Version-Endpunkt für Client-Auto-Reload: Tab merkt bei Server-Update,
91
+ // dass eine neue Version läuft, und lädt sich selbst neu (kein Cmd+R mehr nötig).
92
+ import { readFileSync } from 'node:fs';
93
+ const PKG_VERSION = (() => {
94
+ try { return JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version; }
95
+ catch { return '0.0.0'; }
96
+ })();
97
+ const SERVER_STARTED_AT = new Date().toISOString();
98
+ app.get('/api/version', (_req, res) => {
99
+ res.json({ version: PKG_VERSION, startedAt: SERVER_STARTED_AT });
100
+ });
101
+
88
102
  // Settings (custom tracking rules)
89
103
  app.get('/api/settings', async (_req, res) => {
90
104
  const settings = await loadSettings();
@@ -344,6 +358,21 @@ const server = app.listen(PORT, '127.0.0.1', async () => {
344
358
  console.log(`Site Check Ultra läuft auf http://localhost:${PORT}`);
345
359
  console.log(`Node.js ${process.version} | Umgebung: ${process.env.NODE_ENV || 'development'}`);
346
360
 
361
+ // Auto-Browser: npm start (direkt ausgeführt, ohne CLI-Wrapper) öffnet die UI selbst.
362
+ // SCU_NO_BROWSER=1 deaktiviert das (z. B. für Headless-Setup oder Tests).
363
+ if (process.env.SCU_NO_BROWSER !== '1') {
364
+ const url = `http://localhost:${PORT}`;
365
+ const cmd = process.platform === 'darwin' ? 'open'
366
+ : process.platform === 'win32' ? 'start ""'
367
+ : 'xdg-open';
368
+ import('node:child_process').then(({ exec }) => {
369
+ exec(`${cmd} "${url}"`, (err) => {
370
+ if (err) console.log(`[startup] Browser konnte nicht geöffnet werden — manuell: ${url}`);
371
+ else console.log(`[startup] Browser geöffnet: ${url}`);
372
+ });
373
+ });
374
+ }
375
+
347
376
  // Resilienz: Crawls, die beim letzten Server-Neustart liefen, werden NICHT
348
377
  // verworfen. Nach kurzer Wartezeit (Server-Ready + Debounce) werden sie
349
378
  // automatisch fortgesetzt — bereits geladene Seiten bleiben erhalten.