This commit is contained in:
Ludwig Lehnert
2026-10-03 13:58:22 +00:00
parent 3075d951ba
commit 98b08f6e57
431 changed files with 210848 additions and 60 deletions
+59 -4
View File
@@ -11,7 +11,7 @@ const esc = value => String(value ?? "").replace(/[&<>'"]/g, char => ({"&":"&amp
function actionIcon(action) {
const paths = {
download: '<path d="M12 3v12m-5-5 5 5 5-5"/><path d="M5 16v4h14v-4"/>',
restore: '<path d="M3 11a9 9 0 1 1 2.6 7"/><path d="M3 4v7h7"/>',
restore: '<path d="M5 12a7 7 0 1 1 2.05 4.95"/><path d="m1 8 4 4 4-4"/>',
};
return `<svg class="action-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${paths[action]}</svg>`;
}
@@ -60,6 +60,7 @@ const isoDay = date => date.toISOString().slice(0, 10);
const sum = (rows, field) => (rows || []).reduce((total, row) => total + Number(row[field] || 0), 0);
async function api(path, options = {}) {
if (path.startsWith("/api/") && !["/api/login", "/api/logout", "/api/session"].includes(path)) path = "/admin" + path;
const response = await fetch(path, {
...options,
headers: {"Content-Type": "application/json", ...(options.headers || {})},
@@ -91,11 +92,12 @@ function showLogin() {
}
function showApp(session) {
if (session.role !== "domain-admin") { location.replace("/"); return; }
state.session = {user: session.user, expiresAt: session.expiresAt};
document.querySelector("#session-user").textContent = session.user;
loginView.hidden = true;
appView.hidden = false;
navigate(location.pathname === "/" ? "/overview" : location.pathname, true);
navigate(["/", "/admin", "/admin/"].includes(location.pathname) ? "/admin/overview" : location.pathname, true);
}
function setLoading() { content.innerHTML = '<div class="loading">Wird geladen…</div>'; }
@@ -106,10 +108,12 @@ function empty(message) { return `<div class="empty">${esc(message)}</div>`; }
function badge(text, kind = "") { return `<span class="badge ${kind}">${esc(text)}</span>`; }
function routeFor(path) {
path = path.replace(/^\/admin(?=\/|$)/, "") || "/overview";
if (path.startsWith("/storage/data")) return "storage-data";
if (path.startsWith("/storage/users")) return "storage-users";
if (path.startsWith("/access")) return "access";
if (path.startsWith("/reconciliation")) return "reconciliation";
if (path.startsWith("/documents")) return "documents";
if (path.startsWith("/activity/fslogix")) return "activity-fslogix";
if (path.startsWith("/activity")) return "activity";
if (path.startsWith("/trash")) return "trash";
@@ -124,7 +128,8 @@ async function navigate(path, replace = false) {
if (replace && state.currentPath) history.replaceState({}, "", state.currentPath);
return;
}
if (path === "/shares" || path.startsWith("/shares/")) { path = "/access"; replace = true; }
if (path === "/shares" || path.startsWith("/shares/") || path === "/admin/shares") { path = "/admin/access"; replace = true; }
if (!path.startsWith("/admin/")) path = "/admin" + path;
state.accessDirty = false;
state.currentPath = path;
clearInterval(state.timer);
@@ -138,6 +143,7 @@ async function navigate(path, replace = false) {
if (route === "overview") await renderOverview();
if (route === "access") await renderAccess();
if (route === "reconciliation") await renderReconciliation();
if (route === "documents") await renderDocuments();
if (route === "storage-data") await renderStorage("data");
if (route === "storage-users") await renderStorage("users");
if (route === "activity") await renderActivity();
@@ -489,7 +495,7 @@ async function renderTrash() {
<td class="path">${esc(item.path)}</td>
<td class="numeric">${bytes(item.size)}</td>
<td class="timestamp">${esc(utcTime(item.expiresAt))}</td>
<td><div class="row-actions"><a class="button icon-button" href="/api/trash/download?id=${encodeURIComponent(item.id)}" download aria-label="Herunterladen" title="Herunterladen">${actionIcon("download")}</a><button type="button" class="icon-button" data-restore="${esc(item.id)}" aria-label="Wiederherstellen" title="Wiederherstellen">${actionIcon("restore")}</button></div></td>
<td><div class="row-actions"><a class="button icon-button" href="/admin/api/trash/download?id=${encodeURIComponent(item.id)}" download aria-label="Herunterladen" title="Herunterladen">${actionIcon("download")}</a><button type="button" class="icon-button" data-restore="${esc(item.id)}" aria-label="Wiederherstellen" title="Wiederherstellen">${actionIcon("restore")}</button></div></td>
</tr>`).join("");
}
const shown = result.items.length.toLocaleString("de-DE");
@@ -731,6 +737,55 @@ async function renderReconciliation() {
state.timer = window.setInterval(() => { void poll(); }, 1500);
}
async function renderDocuments() {
content.innerHTML = pageHead("Dokumentindex", "Dateierfassung, Volltextsuche und PDF-Texterkennung.") + `
<section class="panel"><div class="panel-head"><h2 id="document-worker-state" role="status">Status wird geladen…</h2><button type="button" id="document-worker-control" disabled>Anhalten</button></div>
<p id="document-worker-current" class="path"></p>
<progress id="document-worker-progress" max="100" value="0" aria-label="Indexierungsfortschritt"></progress><p id="document-worker-progress-label" class="muted"></p>
<div class="check-list"><div class="check"><span>Letzte Dateierfassung</span><strong id="document-worker-scan">—</strong></div><div class="check"><span>Letztes Lebenszeichen</span><strong id="document-worker-heartbeat">—</strong></div></div>
</section>
<section class="cards" id="document-worker-counts"></section>
<section class="panel"><h2>Ausstehende Wiederholungen</h2><div class="table-wrap document-worker-table"><table><thead><tr><th>Ordner / Datei</th><th>Auftrag</th><th>Versuche</th><th>Nächster Versuch (UTC)</th></tr></thead><tbody id="document-worker-failures"></tbody></table></div></section>
<section class="panel"><h2>Aktivität</h2><div class="table-wrap document-worker-table"><table><thead><tr><th>Zeit (UTC)</th><th>Vorgang</th><th>Ordner / Datei</th><th>Benutzer / Ergebnis</th></tr></thead><tbody id="document-worker-activity"></tbody></table></div></section>`;
const button = document.querySelector("#document-worker-control");
let status, polling = false, controlling = false;
const actionLabels = {started:"Worker gestartet",text:"Text erfassen",ocr:"PDF-Texterkennung",complete:"Abgeschlossen","queued-ocr":"Für OCR vorgemerkt",changed:"Datei verändert",failed:"Wiederholung geplant",interrupted:"Auftrag unterbrochen",pause:"Anhalten",resume:"Fortsetzen"};
const refresh = async () => {
if (polling || !button.isConnected) return;
polling = true;
try {
const data = await api("/api/documents/status");
if (!button.isConnected) return;
status = data;
const paused = data.paused;
const caption = !data.online ? "Worker nicht erreichbar" : paused ? (data.current ? "Wird angehalten…" : "Angehalten") : data.state === "ocr" ? "PDF-Texterkennung läuft" : data.state === "text" ? "Text wird erfasst" : data.scanning ? "Dateikatalog wird aktualisiert" : "Bereit";
document.querySelector("#document-worker-state").textContent = caption;
button.textContent = paused ? "Fortsetzen" : "Anhalten";
button.disabled = controlling;
document.querySelector("#document-worker-current").textContent = data.current ? `${data.current.source} / ${data.current.path}` : "Kein aktiver Auftrag";
document.querySelector("#document-worker-progress").value = data.progress;
document.querySelector("#document-worker-progress-label").textContent = `${data.counts.complete.toLocaleString("de-DE")} von ${data.counts.total.toLocaleString("de-DE")} Dateien erfasst · ${data.progress} %`;
document.querySelector("#document-worker-scan").textContent = data.last_scan ? utcTime(new Date(data.last_scan * 1000)) : "Ausstehend";
document.querySelector("#document-worker-heartbeat").textContent = data.heartbeat ? utcTime(new Date(data.heartbeat * 1000)) : "Ausstehend";
document.querySelector("#document-worker-counts").innerHTML = [["Text-Warteschlange",data.counts.pending],["OCR-Warteschlange",data.counts.ocr],["Wiederholungen",data.counts.errors],["Nur Dateiname",data.counts.nameOnly]].map(([label,value]) => `<article class="card"><span class="label">${label}</span><strong class="value">${value.toLocaleString("de-DE")}</strong></article>`).join("");
document.querySelector("#document-worker-failures").innerHTML = data.failures.length ? data.failures.map(row => `<tr><td class="path">${esc(row.source)} / ${esc(row.path)}</td><td>${row.state === "ocr" ? "OCR" : "Text"}</td><td>${Number(row.attempts)}</td><td class="timestamp">${esc(utcTime(new Date(row.retry_at * 1000)))}</td></tr>`).join("") : '<tr><td colspan="4" class="empty">Keine fehlgeschlagenen Aufträge</td></tr>';
document.querySelector("#document-worker-activity").innerHTML = data.activity.length ? data.activity.map(row => `<tr><td class="timestamp">${esc(utcTime(new Date(row.timestamp * 1000)))}</td><td>${esc(actionLabels[row.action] || row.action)}</td><td class="path">${esc(row.source)}${row.path ? " / " + esc(row.path) : "—"}</td><td>${esc(row.actor || row.message || "—")}</td></tr>`).join("") : '<tr><td colspan="4" class="empty">Noch keine Aktivität</td></tr>';
} catch (error) { notice(error.message); }
finally { polling = false; }
};
button.addEventListener("click", async () => {
if (!status || controlling) return;
controlling = true; button.disabled = true;
try {
await api("/api/documents/control", {method:"POST",body:JSON.stringify({action:status.paused ? "resume" : "pause"})});
notice(status.paused ? "Dokumentindex wird fortgesetzt." : "Dokumentindex wird angehalten.");
} catch (error) { notice(error.message); }
finally { controlling = false; await refresh(); }
});
await refresh();
if (button.isConnected) state.timer = setInterval(() => { void refresh(); }, 1500);
}
async function renderReport() {
content.innerHTML = pageHead("PDF-Bericht", "Vollständiger, druckbarer Stand der Dateiserver-Konfiguration und Belegung.") + `
<section class="panel">
+14 -13
View File
@@ -11,7 +11,7 @@
<section id="login-view" class="login-view" hidden>
<main class="login-card">
<h1>Dateiserver-Verwaltung</h1>
<p>Anmeldung nur für Domänenadministratoren. Ohne Domänenangabe wird automatisch die konfigurierte NetBIOS-Domäne verwendet.</p>
<p>Verwaltung für Domänenadministratoren.</p>
<form id="login-form" class="stack">
<label>Benutzername<input name="username" autocomplete="username" required autofocus placeholder="benutzername"></label>
<label>Passwort<input name="password" type="password" autocomplete="current-password" required></label>
@@ -25,19 +25,20 @@
<aside class="sidebar">
<div class="brand">Dateiserver</div>
<nav id="navigation" aria-label="Hauptnavigation">
<a href="/overview" data-route="overview">Übersicht</a>
<a href="/access" data-route="access">Zugriffsverwaltung</a>
<a href="/reconciliation" data-route="reconciliation">Freigabenabgleich</a>
<a href="/storage/data" data-route="storage-data">Datenbelegung</a>
<a href="/storage/users" data-route="storage-users">Benutzerbelegung</a>
<a href="/activity" data-route="activity">Aktivitätsprotokoll</a>
<a href="/activity/fslogix" data-route="activity-fslogix">FSLogix-Protokoll</a>
<a href="/trash" data-route="trash">Papierkorb</a>
<a href="/backup" data-route="backup">Sicherungen</a>
<a href="/report" data-route="report">PDF-Bericht</a>
<a href="/system" data-route="system">System</a>
<a href="/admin/overview" data-route="overview">Übersicht</a>
<a href="/admin/access" data-route="access">Zugriffsverwaltung</a>
<a href="/admin/documents" data-route="documents">Dokumentindex</a>
<a href="/admin/reconciliation" data-route="reconciliation">Freigabenabgleich</a>
<a href="/admin/storage/data" data-route="storage-data">Datenbelegung</a>
<a href="/admin/storage/users" data-route="storage-users">Benutzerbelegung</a>
<a href="/admin/activity" data-route="activity">Aktivitätsprotokoll</a>
<a href="/admin/activity/fslogix" data-route="activity-fslogix">FSLogix-Protokoll</a>
<a href="/admin/trash" data-route="trash">Papierkorb</a>
<a href="/admin/backup" data-route="backup">Sicherungen</a>
<a href="/admin/report" data-route="report">PDF-Bericht</a>
<a href="/admin/system" data-route="system">System</a>
</nav>
<div class="sidebar-footer"><span id="session-user"></span><button id="logout" class="link-button">Abmelden</button></div>
<div class="sidebar-footer"><a href="/">Dateiansicht</a><span id="session-user"></span><button id="logout" class="link-button">Abmelden</button></div>
</aside>
<header class="mobile-header"><button id="menu-toggle" aria-label="Navigation ein- oder ausblenden">Menü</button><strong>Dateiserver</strong></header>
<main id="content" class="content" tabindex="-1"></main>
+11
View File
@@ -0,0 +1,11 @@
/* Keep Mozilla's viewer controls aligned with the file interface. */
:root {
--body-bg-color: #eee;
--toolbar-bg-color: #eee;
--toolbar-border-bottom: 1px solid #aaa;
--toolbar-icon-bg-color: #333;
--toolbar-icon-hover-bg-color: #111;
}
body, button, input, select { font-family: Arial, sans-serif; }
button, input, select, .doorHanger, .menuContainer { border-radius: 0 !important; }
#secondaryOpenFile, #editorModeButtons { display: none !important; }
+47
View File
@@ -0,0 +1,47 @@
"use strict";
// Configure the upstream generic viewer before its application starts.
const target = window.parent.document;
function configureViewer(event) {
if (event.detail?.source !== window) return;
const options = window.PDFViewerApplicationOptions;
const app = window.PDFViewerApplication;
const file = new URLSearchParams(location.search).get("file") || "";
const match = file.match(/^\/api\/documents\/([a-f0-9]{32})\/content(?:\?v=[a-f0-9]{16})?$/);
if (!match) history.replaceState({}, "", location.pathname + "?file=");
options.setAll({
defaultUrl: "", disablePreferences: true, disableHistory: true,
localeProperties: {lang: "de"}, viewerCssTheme: 1,
enableScripting: false, annotationEditorMode: -1, annotationMode: 1,
enableComment: false, enableAltText: false, enableGuessAltText: false,
enableAltTextModelDownload: false, enableHighlightFloatingButton: false,
enableWebGPU: false, defaultZoomValue: "page-width",
});
// Downloads use the original endpoint and its fresh access checks.
const download = async () => {
if (!match) return;
const link = document.createElement("a");
link.href = `/api/documents/${match[1]}/download`;
link.download = app._docFilename || "";
document.body.append(link); link.click(); link.remove();
};
app.download = app.save = app.downloadOrSave = download;
const run = app.run.bind(app);
app.run = async config => {
await run(config);
if (app._openFileInput) app._openFileInput.disabled = true;
};
const open = app.open.bind(app);
app.open = async args => {
if (!match || args?.url !== file) return;
try { await open(args); }
catch (error) {
// PDF.js already shows these loading errors. Revocation is handled by
// the parent dialog's permission refresh, rather than an unhandled promise.
if (!["ResponseException", "InvalidPDFException", "PasswordException", "UnknownErrorException", "AbortException"].includes(error.name)) throw error;
}
};
}
target.addEventListener("webviewerloaded", configureViewer);
window.addEventListener("pagehide", () => target.removeEventListener("webviewerloaded", configureViewer), {once: true});
document.addEventListener("drop", event => { event.preventDefault(); event.stopImmediatePropagation(); }, true);
+57
View File
@@ -0,0 +1,57 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
<title>Dateiserver · Dateien</title>
<link rel="stylesheet" href="/assets/styles.css">
</head>
<body class="portal">
<section id="login-view" class="login-view" hidden>
<main class="login-card">
<h1>Dateiserver</h1>
<p>Mit Ihrem AD-Benutzerkonto anmelden.</p>
<form id="login-form" class="stack">
<label>Benutzername<input name="username" autocomplete="username" required autofocus placeholder="benutzername"></label>
<label>Passwort<input name="password" type="password" autocomplete="current-password" required></label>
<p id="login-error" class="error" role="alert" hidden></p>
<button type="submit">Anmelden</button>
</form>
</main>
</section>
<div id="portal-view" hidden>
<header class="portal-header"><a href="/" class="portal-brand">Dateiserver</a><div><span id="session-user"></span><a href="/admin/overview" id="admin-link" hidden>Verwaltung</a><button id="logout" class="link-button">Abmelden</button></div></header>
<main class="portal-main">
<header class="page-head"><div><h1>Dateien</h1><p>Dokumente finden und durchsuchen.</p></div></header>
<form id="document-search" class="portal-search" role="search">
<label class="portal-query"><span class="sr-only">Dateien durchsuchen</span><input id="search-query" type="search" placeholder="Dateiname oder Inhalt durchsuchen…" autocomplete="off"></label>
<label><span class="sr-only">Suchbereich</span><select id="search-scope"><option value="all">Name und Inhalt</option><option value="name">Nur Dateiname</option><option value="content">Nur Inhalt</option></select></label>
<button type="submit">Suchen</button>
</form>
<div class="portal-workspace">
<aside class="portal-filters" aria-label="Dateifilter">
<h2>Filter</h2>
<label>Ordner<select id="source-filter"><option value="">Alle Ordner</option></select></label>
<label>Dateityp<select id="type-filter"><option value="">Alle Dateitypen</option></select></label>
<label>Sortieren<select id="sort-filter"><option value="recent">Zuletzt geändert</option><option value="relevance">Beste Treffer</option><option value="name">Dateiname</option><option value="oldest">Älteste zuerst</option></select></label>
<button type="button" id="reset-filters">Filter zurücksetzen</button>
</aside>
<section class="portal-results" aria-label="Suchergebnisse">
<div class="portal-results-head"><p id="result-summary" role="status">Dateien werden geladen…</p><div class="portal-view-options" role="group" aria-label="Ansicht"><button type="button" id="view-grid" aria-pressed="true">Kacheln</button><button type="button" id="view-list" aria-pressed="false">Liste</button></div></div>
<p id="index-progress" class="muted" role="status" hidden></p>
<p id="search-error" class="error" role="alert" hidden></p>
<div id="documents" class="document-grid"></div>
<div class="portal-pagination"><button type="button" id="previous-page" disabled>Zurück</button><span id="page-label"></span><button type="button" id="next-page" disabled>Weiter</button></div>
</section>
</div>
</main>
</div>
<dialog id="document-dialog" class="document-dialog" aria-labelledby="document-title">
<header class="document-dialog-head"><div><h2 id="document-title"></h2><p id="document-location" class="muted"></p></div><div class="row-actions"><a id="document-download" class="button icon-button" aria-label="Herunterladen" title="Herunterladen" download></a><button type="button" id="document-close" class="icon-button" aria-label="Schließen" title="Schließen"></button></div></header>
<div class="document-detail"><div id="document-preview" class="document-preview"></div></div>
</dialog>
<div id="toast" class="toast" role="status" hidden></div>
<script src="/assets/portal.js" defer></script>
</body>
</html>
+157
View File
@@ -0,0 +1,157 @@
"use strict";
const $ = selector => document.querySelector(selector);
const esc = value => String(value ?? "").replace(/[&<>'"]/g, char => ({"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"}[char]));
const snippet = value => esc(value).replace(/\x01/g, "<mark>").replace(/\x02/g, "</mark>");
const sizeLabel = value => {
const units = ["B", "kB", "MB", "GB", "TB"];
let amount = Number(value), index = 0;
while (amount >= 1024 && index < units.length - 1) { amount /= 1024; index++; }
return `${amount.toLocaleString("de-DE", {maximumFractionDigits: index ? 1 : 0})} ${units[index]}`;
};
const modifiedLabel = value => new Intl.DateTimeFormat("de-DE", {dateStyle:"medium",timeZone:"UTC"}).format(new Date(value * 1000));
function icon(name) {
const paths = {
download: '<path d="M12 3v12m-5-5 5 5 5-5"/><path d="M5 16v4h14v-4"/>',
close: '<path d="m6 6 12 12M6 18 18 6"/>',
file: '<path d="M14 2H5v20h14V7zM14 2v5h5M8 12h8M8 16h8"/>',
};
return `<svg class="action-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${paths[name]}</svg>`;
}
const statusLabel = row => ({pending:"Text wird erfasst…",ocr:row.attempts ? "Texterkennung wird erneut versucht…" : "Texterkennung läuft…",failed:"Text konnte noch nicht erfasst werden.","name-only":"Suche nach Dateinamen verfügbar."}[row.state] || "");
let session = null, offset = 0, listMode = false, timer, debounce, request, serial = 0, lastResult = "", activeDocument = null, initialFilters = null;
const pageSize = 40;
async function api(path, options = {}) {
const response = await fetch(path, {...options,credentials:"same-origin",headers:{"Content-Type":"application/json",...(options.headers || {})}});
let body = {};
try { body = await response.json(); } catch (_) { /* Empty response. */ }
if (response.status === 401) { showLogin(); throw new Error("Bitte erneut anmelden."); }
if (!response.ok) throw Object.assign(new Error(body.error || "Anfrage fehlgeschlagen"), {status:response.status});
return body;
}
function notice(message) {
$("#toast").textContent = message; $("#toast").hidden = false;
setTimeout(() => { $("#toast").hidden = true; }, 4000);
}
function showLogin() {
session = null; activeDocument = null; lastResult = ""; clearInterval(timer); clearTimeout(debounce); request?.abort();
$("#documents").replaceChildren();
$("#document-preview").replaceChildren(); delete $("#document-preview").dataset.url;
if ($("#document-dialog").open) $("#document-dialog").close();
$("#portal-view").hidden = true; $("#login-view").hidden = false;
$("#login-form input[name=username]").focus();
}
function showFiles(value) {
session = value;
$("#session-user").textContent = value.user;
$("#admin-link").hidden = value.role !== "domain-admin";
$("#login-view").hidden = true; $("#portal-view").hidden = false;
const params = new URLSearchParams(location.search);
initialFilters = {source:params.get("source") || "",type:params.get("type") || ""};
offset = 0;
for (const [id,key] of [["search-query","q"],["search-scope","scope"],["sort-filter","sort"]]) {
if (params.has(key)) $("#" + id).value = params.get(key);
}
refresh(); clearInterval(timer);
timer = setInterval(() => { if (!document.hidden && session) { refresh(false); if (activeDocument) loadDetail(activeDocument, false); } }, 2000);
}
function filters() {
return new URLSearchParams({q:$("#search-query").value,scope:$("#search-scope").value || "all",source:$("#source-filter").value,type:$("#type-filter").value,sort:$("#sort-filter").value || "recent",limit:pageSize,offset});
}
function updateOptions(select, items, firstLabel) {
const current = select.value || (initialFilters && initialFilters[select.id === "source-filter" ? "source" : "type"]) || "";
const html = `<option value="">${firstLabel}</option>` + items.map(item => `<option value="${esc(item.id)}">${esc(item.label)}</option>`).join("");
if (select.innerHTML !== html) {
select.innerHTML = html;
select.value = current;
if (!select.value) select.value = "";
}
}
async function refresh(userAction = true) {
if (!session) return;
if (!userAction && request) return;
request?.abort();
const controller = new AbortController(); request = controller;
const current = ++serial;
if (userAction) $("#search-error").hidden = true;
try {
const params = filters();
const result = await api("/api/documents?" + params, {signal:controller.signal});
if (current !== serial || !session) return;
history.replaceState({}, "", "/" + (params.get("q") || params.get("source") || params.get("type") ? "?" + params : ""));
updateOptions($("#source-filter"), result.sources.map(source => ({id:source.id,label:source.kind === "private" ? "Mein Private-Ordner" : source.label})), "Alle Ordner");
updateOptions($("#type-filter"), result.types.map(type => ({id:type,label:type.toUpperCase()})), "Alle Dateitypen");
if (initialFilters) {
const changed = $("#source-filter").value !== params.get("source") || $("#type-filter").value !== params.get("type");
initialFilters = null;
if (changed) { request = null; refresh(); return; }
}
$("#result-summary").textContent = `${result.total.toLocaleString("de-DE")} ${result.total === 1 ? "Datei" : "Dateien"}`;
$("#index-progress").hidden = !result.pending;
$("#index-progress").textContent = result.pending ? `Text wird für ${result.pending} ${result.pending === 1 ? "Datei" : "Dateien"} erfasst.` : "";
$("#previous-page").disabled = offset === 0;
$("#next-page").disabled = !result.hasMore;
$("#page-label").textContent = result.total ? `Seite ${Math.floor(offset / pageSize) + 1}` : "";
const signature = JSON.stringify(result.items);
if (signature !== lastResult) {
lastResult = signature;
$("#documents").innerHTML = result.items.length ? result.items.map(row => `<article class="document-card">
<button type="button" class="document-open" data-document="${esc(row.id)}" aria-label="Öffnen: ${esc(row.name)}">
<div class="document-thumbnail">${row.hasPreview ? `<img src="/api/documents/${row.id}/preview?v=${row.version}" loading="lazy" alt="">` : `<div class="document-placeholder">${icon("file")}<span>${esc((row.extension || "Datei").toUpperCase())}</span></div>`}</div>
<div class="document-description"><h2 title="${esc(row.name)}">${esc(row.name)}</h2><p class="document-path" title="${esc(row.path)}">${esc(row.path)}</p><p class="document-excerpt">${snippet(row.snippet || statusLabel(row))}</p></div>
</button><footer><span title="${esc(row.source)}">${esc(row.kind === "private" ? "Private" : row.source)} · ${sizeLabel(row.size)}<small>${modifiedLabel(row.modified)} UTC</small></span><a class="button icon-button" href="/api/documents/${row.id}/download" download="${esc(row.name)}" aria-label="Herunterladen: ${esc(row.name)}" title="Herunterladen">${icon("download")}</a></footer>
</article>`).join("") : '<div class="portal-empty"><h2>Keine Dateien gefunden</h2><p>Suchbegriff oder Filter ändern.</p></div>';
}
$("#search-error").hidden = true;
} catch (error) {
if (error.name !== "AbortError" && session) { $("#search-error").textContent = error.message; $("#search-error").hidden = false; }
} finally { if (request === controller) request = null; }
}
async function loadDetail(id, open = true) {
if (open) activeDocument = id;
try {
const row = await api("/api/documents/" + id);
if (activeDocument !== id || !session) return;
$("#document-title").textContent = row.name;
$("#document-title").title = row.name;
$("#document-location").textContent = `${row.source} / ${row.path} · ${sizeLabel(row.size)}${row.pages ? ` · ${row.pages} ${row.pages === 1 ? "Seite" : "Seiten"}` : ""}`;
const isPdf = row.extension === "pdf";
$("#document-dialog").classList.toggle("pdf-dialog", isPdf);
$("#document-download").href = `/api/documents/${id}/download`;
$("#document-download").download = row.name;
$("#document-download").innerHTML = icon("download");
$("#document-close").innerHTML = icon("close");
const previewUrl = isPdf ? `/assets/vendor/pdfjs/6.3.289-app1/web/viewer.html?file=${encodeURIComponent(`/api/documents/${id}/content?v=${row.version}`)}#zoom=page-width` : row.hasPreview ? `/api/documents/${id}/preview?v=${row.version}` : "";
if ($("#document-preview").dataset.url !== previewUrl) {
$("#document-preview").dataset.url = previewUrl;
$("#document-preview").innerHTML = isPdf ? `<iframe id="document-pdf-viewer" src="${esc(previewUrl)}" title="PDF-Vorschau" allowfullscreen sandbox="allow-scripts allow-same-origin allow-downloads allow-modals"></iframe>` : previewUrl ? `<img src="${previewUrl}" alt="Dokumentvorschau">` : `<div class="document-placeholder">${icon("file")}<p>Keine Bildvorschau verfügbar.</p></div>`;
}
if (open && !$("#document-dialog").open) $("#document-dialog").showModal();
} catch (error) {
if (activeDocument === id) { if ($("#document-dialog").open) $("#document-dialog").close(); activeDocument = null; if (session) notice(error.message); }
}
}
$("#document-dialog").addEventListener("close", () => { activeDocument = null; $("#document-preview").replaceChildren(); delete $("#document-preview").dataset.url; });
$("#document-close").addEventListener("click", () => $("#document-dialog").close());
$("#documents").addEventListener("click", event => { const button = event.target.closest("[data-document]"); if (button) loadDetail(button.dataset.document); });
$("#documents").addEventListener("error", event => { if (event.target.tagName === "IMG") event.target.hidden = true; }, true);
$("#document-search").addEventListener("submit", event => { event.preventDefault(); clearTimeout(debounce); offset = 0; refresh(); });
$("#search-query").addEventListener("input", () => { clearTimeout(debounce); offset = 0; debounce = setTimeout(() => refresh(), 200); });
for (const id of ["search-scope", "source-filter", "type-filter", "sort-filter"]) $("#" + id).addEventListener("change", () => { offset = 0; refresh(); });
$("#reset-filters").addEventListener("click", () => { $("#search-query").value = ""; $("#search-scope").value = "all"; $("#source-filter").value = ""; $("#type-filter").value = ""; offset = 0; refresh(); });
$("#previous-page").addEventListener("click", () => { offset = Math.max(0, offset - pageSize); refresh(); });
$("#next-page").addEventListener("click", () => { offset += pageSize; refresh(); });
for (const [id,mode] of [["view-grid",false],["view-list",true]]) $("#" + id).addEventListener("click", () => {
listMode = mode; $("#documents").classList.toggle("document-list", listMode);
$("#view-grid").setAttribute("aria-pressed", String(!listMode)); $("#view-list").setAttribute("aria-pressed", String(listMode));
});
$("#login-form").addEventListener("submit", async event => {
event.preventDefault(); const form = event.currentTarget, button = form.querySelector("button");
$("#login-error").hidden = true; button.disabled = true;
try { const data = new FormData(form); const value = await api("/api/login", {method:"POST",body:JSON.stringify({username:data.get("username"),password:data.get("password")})}); form.reset(); showFiles(value); }
catch (error) { $("#login-error").textContent = error.message; $("#login-error").hidden = false; }
finally { button.disabled = false; }
});
$("#logout").addEventListener("click", async () => { try { await api("/api/logout", {method:"POST",body:"{}"}); } finally { showLogin(); } });
api("/api/session").then(showFiles).catch(showLogin);
+87
View File
@@ -160,3 +160,90 @@ progress { width: 100%; }
.access-level-caption { font-size: .72rem; }
}
.content:focus { outline: none; }
#document-worker-progress { width: 100%; height: 1rem; accent-color: #555; }
.document-worker-table { max-height: 28rem; overflow: auto; }
.document-worker-table table { min-width: 720px; }
.document-worker-table .path { min-width: 230px; }
.document-worker-table thead { position: sticky; top: 0; background: #fff; }
/* Document browsing shares the admin UI's typography and controls. */
.portal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 2rem; border-bottom: 1px solid #aaa; background: #eee; }
.portal-brand { font-weight: bold; color: #111; text-decoration: none; }
.portal-header > div { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.portal-header #session-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-main { max-width: 1600px; margin: auto; padding: 1.5rem 2rem 3rem; }
.portal-search { display: grid; grid-template-columns: minmax(0,1fr) 190px auto; gap: .6rem; margin-bottom: 1.5rem; }
.portal-search input { padding: .65rem; }
.portal-workspace { display: grid; grid-template-columns: 220px minmax(0,1fr); align-items: start; gap: 1.5rem; }
.portal-filters { display: grid; gap: 1rem; padding: 1rem; border: 1px solid #aaa; }
.portal-filters h2 { margin: 0; }
.portal-results { min-width: 0; }
.portal-results-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.portal-results-head p { margin: 0; }
.portal-view-options { display: flex; gap: .3rem; }
.portal-view-options button[aria-pressed="true"] { background: #ddd; border-color: #111; font-weight: bold; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 1rem; }
.document-card { min-width: 0; border: 1px solid #aaa; background: #fff; overflow: hidden; }
.document-open { display: block; width: 100%; padding: 0; border: 0; background: #fff; text-align: left; white-space: normal; }
.document-thumbnail { display: flex; height: 210px; align-items: center; justify-content: center; background: #f5f5f5; border-bottom: 1px solid #ccc; overflow: hidden; }
.document-thumbnail img { width: 100%; height: 100%; object-fit: contain; }
.document-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; color: #666; }
.document-placeholder .action-icon { width: 48px; height: 48px; stroke-width: 1; }
.document-description { padding: .8rem; }
.document-description h2 { font-size: 1rem; margin: 0 0 .3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-path { font-size: .8rem; color: #666; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-excerpt { height: 3.6em; overflow: hidden; font-size: .85rem; margin: .6rem 0 0; overflow-wrap: anywhere; }
mark { background: #fff0a0; color: #111; }
.document-card footer { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .8rem; border-top: 1px solid #ccc; }
.document-card footer > span { min-width: 0; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-card footer small { display: block; color: #666; }
.document-list { grid-template-columns: 1fr; }
.document-list .document-card { display: flex; align-items: center; }
.document-list .document-open { display: flex; align-items: center; min-width: 0; flex: 1; }
.document-list .document-thumbnail { width: 80px; height: 100px; flex-shrink: 0; border: 0; border-right: 1px solid #ccc; }
.document-list .document-description { min-width: 0; }
.document-list footer { flex-shrink: 0; border: 0; }
.document-list .document-excerpt { height: 1.4em; }
.portal-empty { grid-column: 1/-1; padding: 2rem; border: 1px solid #aaa; text-align: center; color: #666; }
.portal-empty h2 { color: #111; }
.portal-pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.document-dialog { width: min(1150px,calc(100vw - 2rem)); height: min(850px,calc(100dvh - 2rem)); padding: 0; border: 1px solid #aaa; color: #111; background: #fff; }
.document-dialog:has(.document-placeholder) { height: fit-content; }
.document-dialog:has(.document-placeholder) .document-detail { height: auto; }
.document-dialog::backdrop { background: #0006; }
.document-dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid #aaa; }
.document-dialog-head > div:first-child { min-width: 0; }
.document-dialog-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: .3rem; }
.document-dialog-head p { font-size: .85rem; overflow-wrap: anywhere; margin-bottom: 0; }
.document-detail { height: calc(100% - 95px); min-height: 0; }
.document-preview { padding: 1rem; overflow: auto; background: #f5f5f5; }
.document-preview img { display: block; width: 100%; height: auto; }
.document-dialog.pdf-dialog { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; border: 0; }
.document-dialog.pdf-dialog[open] { display: flex; flex-direction: column; }
.pdf-dialog .document-dialog-head { flex-shrink: 0; padding: .6rem 1rem; }
.pdf-dialog .document-detail { flex: 1; height: auto; overflow: hidden; }
.pdf-dialog .document-preview { height: 100%; padding: 0; overflow: hidden; }
#document-pdf-viewer { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 950px) {
.portal-workspace { grid-template-columns: 1fr; gap: 1rem; }
.portal-filters { grid-template-columns: repeat(3,minmax(0,1fr)); gap: .6rem; }
.portal-filters h2 { display: none; }
.portal-filters button { grid-column: 1/-1; }
}
@media (max-width: 600px) {
.portal-header, .portal-main { padding: 1rem; }
.portal-header { align-items: start; }
.portal-header > div { justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
.portal-header #session-user { max-width: 150px; }
.portal-search { grid-template-columns: minmax(0,1fr) auto; }
.portal-query { grid-column: 1/-1; }
.portal-filters { grid-template-columns: 1fr; }
.document-grid { grid-template-columns: 1fr; }
.document-thumbnail { height: 240px; }
.document-list .document-card { flex-wrap: wrap; }
.document-list footer { width: 100%; border-top: 1px solid #ccc; }
.document-detail { display: block; height: auto; }
.document-dialog { overflow: auto; }
.document-dialog-head { gap: .5rem; }
.document-dialog-head .row-actions { flex-wrap: nowrap; }
}
+177
View File
@@ -0,0 +1,177 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEá ETen-B5-H` ^
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE!!�º]aX!!]`�21�> �p �z�$]‚�"R‚d�-Uƒ7�*„␍4„%�+ „Z „{�/…%…<�9K…b�1]†.�"‡ ‰`]‡,�"]ˆ
�"]ˆh�"]‰F�"]Š$�"]‹�"]‹`�"]Œ>�"]��"]�z�"]ŽX�"]�6�"]��"]�r�"]‘P�"]’.�"]“ �"]“j�"]”H�"]•&�"]–�"]–b�"]—@�"]˜�"]˜|�"]™Z�"]š8�"]›�"]›t�"]œR�"]�0�"]ž�"]žl�"]ŸJ�"] (�"]¡�"]¡d�"]¢B�"]£ �"X£~�']¤W�"]¥5�"]¦�"]¦q�"]§O�"]¨-�"]© �"]©i�"]ªG�"]«%�"]¬�"]¬a�"]­?�"]®�"]®{�"]¯Y�"]°7�"]±�"]±s�"]²Q�"]³/�"]´␍�"]´k�"]µI�"]¶'�"]·�"]·c�"]¸A�"]¹�"]¹}�"]º[�"]»9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More