Dateitransfer: Server, Seiten, Tests und Docker-Dateien

Hochladen mit Upload-Code, kurzer Link zum Herunterladen, automatische
Löschung nach Ablauf der Frist. Node.js ohne zusätzliche Pakete.

- src/: HTTP-Server, Ablage auf der Platte, Zugriffsbegrenzung
- pages/, public/: Oberfläche in Deutsch und Englisch
- tools/: Transfers auflisten und löschen
- test/: 34 automatische Tests
- Dockerfile, compose.yaml: Betrieb als Container auf 127.0.0.1:8083

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
DerSchandfleckandClaude Fable 5.2 committed 2026-11-16 00:59:41 +01:00
1 parent 51ff6f9d40
commit 278194b707
31 files changed
+5099

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
<!doctype html>
<html lang="de" data-title-de="Seite nicht gefunden" data-title-en="Page not found">
<head>
{{head}}
<title>Seite nicht gefunden – {{siteName}}</title>
</head>
<body>
{{header}}
<main class="container">
<section class="intro">
<h1>
<span lang="de">Seite nicht gefunden</span>
<span lang="en">Page not found</span>
</h1>
<p class="lead">
<span lang="de">Unter dieser Adresse gibt es nichts.</span>
<span lang="en">There is nothing at this address.</span>
</p>
<p>
<a class="button button-secondary" href="/">
<span lang="de">Zur Startseite</span>
<span lang="en">Go to the start page</span>
</a>
</p>
</section>
</main>
{{footer}}
<script type="module" src="/js/common.js"></script>
</body>
</html>
+72
View File
@@ -0,0 +1,72 @@
<!doctype html>
<html lang="de" data-state="{{transferState}}" data-title-de="Dateien herunterladen" data-title-en="Download files">
<head>
{{head}}
<title>Dateien herunterladen – {{siteName}}</title>
</head>
<body>
{{header}}
<main class="container">
<!-- Welcher Abschnitt sichtbar ist, bestimmt data-state am <html>-Element. -->
<section class="intro" id="dl-loading">
<p class="lead">
<span lang="de">Wird geladen …</span>
<span lang="en">Loading …</span>
</p>
<noscript>
<p class="notice notice-warn">
<span lang="de">Zum Anzeigen der Dateien muss JavaScript im Browser eingeschaltet sein.</span>
<span lang="en">Showing the files needs JavaScript to be enabled in your browser.</span>
</p>
</noscript>
</section>
<section id="dl-ready">
<div class="intro">
<h1 id="dl-title"></h1>
<p class="lead" id="dl-meta"></p>
</div>
<div class="card card-flush">
<ul class="file-list file-list-plain" id="dl-list"></ul>
</div>
<p class="hint hint-below">
<span lang="de">Öffne Dateien nur, wenn du der Person vertraust, die dir den Link geschickt hat.</span>
<span lang="en">Only open files if you trust the person who sent you the link.</span>
</p>
</section>
<section class="intro" id="dl-missing">
<h1>
<span lang="de">Diesen Link gibt es nicht mehr</span>
<span lang="en">This link no longer exists</span>
</h1>
<p class="lead">
<span lang="de">Die Dateien sind abgelaufen oder wurden gelöscht. Vielleicht wurde der Link auch nicht vollständig kopiert.</span>
<span lang="en">The files have expired or were deleted. The link may also have been copied incompletely.</span>
</p>
<p>
<a class="button button-secondary" href="/">
<span lang="de">Zur Startseite</span>
<span lang="en">Go to the start page</span>
</a>
</p>
</section>
<section class="intro" id="dl-error">
<h1>
<span lang="de">Das hat nicht geklappt</span>
<span lang="en">That did not work</span>
</h1>
<p class="lead" id="dl-error-text"></p>
<p>
<button type="button" class="button button-secondary" id="dl-retry">
<span lang="de">Erneut versuchen</span>
<span lang="en">Try again</span>
</button>
</p>
</section>
</main>
{{footer}}
<script type="module" src="/js/download.js"></script>
</body>
</html>
+187
View File
@@ -0,0 +1,187 @@
<!doctype html>
<html lang="de" data-title-de="Dateien teilen" data-title-en="Share files">
<head>
{{head}}
<title>Dateien teilen – {{siteName}}</title>
</head>
<body>
{{header}}
<main class="container">
<section class="intro">
<h1>
<span lang="de">Dateien teilen</span>
<span lang="en">Share files</span>
</h1>
<p class="lead">
<span lang="de">Lade Dateien hoch und gib den Link weiter. Nach Ablauf der Frist werden sie automatisch gelöscht.</span>
<span lang="en">Upload files and pass on the link. They are deleted automatically once the time is up.</span>
</p>
</section>
<noscript>
<p class="notice notice-warn">
<span lang="de">Zum Hochladen muss JavaScript im Browser eingeschaltet sein.</span>
<span lang="en">Uploading needs JavaScript to be enabled in your browser.</span>
</p>
</noscript>
<section class="card" id="uploader">
<!-- Schritt 1: Dateien auswählen -->
<form id="step-select" novalidate>
<div class="dropzone" id="dropzone">
<svg class="dropzone-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M12 16V4"/>
<path d="m7 9 5-5 5 5"/>
<path d="M5 16v2a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-2"/>
</svg>
<p class="dropzone-title">
<span lang="de">Dateien hierher ziehen</span>
<span lang="en">Drag files here</span>
</p>
<p class="dropzone-or">
<span lang="de">oder</span>
<span lang="en">or</span>
</p>
<input class="visually-hidden" type="file" id="file-input" multiple>
<label class="button button-secondary" for="file-input">
<span lang="de">Dateien auswählen</span>
<span lang="en">Choose files</span>
</label>
<p class="hint" id="limit-hint"></p>
</div>
<div id="selection" hidden>
<ul class="file-list" id="file-list"></ul>
<div class="selection-summary">
<span id="selection-total"></span>
<button type="button" class="link-button" id="clear-files">
<span lang="de">Alle entfernen</span>
<span lang="en">Remove all</span>
</button>
</div>
</div>
<div class="fields">
<div class="field">
<label for="expiry">
<span lang="de">Verfügbar für</span>
<span lang="en">Available for</span>
</label>
<select id="expiry"></select>
</div>
<div class="field" id="code-field">
<label for="code">
<span lang="de">Upload-Code</span>
<span lang="en">Upload code</span>
</label>
<input type="text" id="code" autocomplete="off" autocapitalize="none" autocorrect="off" spellcheck="false" maxlength="200">
<label class="check">
<input type="checkbox" id="remember-code">
<span lang="de">Auf diesem Gerät merken</span>
<span lang="en">Remember on this device</span>
</label>
</div>
</div>
<p class="hint" id="code-hint">
<span lang="de">Zum Hochladen brauchst du einen Upload-Code. Du bekommst ihn von der Person, die diese Seite betreibt.</span>
<span lang="en">You need an upload code to upload. Ask the person who runs this site for one.</span>
</p>
<p class="notice notice-error" id="form-error" role="alert" hidden></p>
<button type="submit" class="button button-primary button-wide" id="start-upload" disabled>
<span lang="de">Hochladen</span>
<span lang="en">Upload</span>
</button>
</form>
<!-- Schritt 2: Fortschritt -->
<div id="step-progress" hidden>
<h2 class="card-title" id="progress-title" tabindex="-1">
<span lang="de">Wird hochgeladen …</span>
<span lang="en">Uploading …</span>
</h2>
<progress id="progress-bar" max="1000" value="0" aria-labelledby="progress-title"></progress>
<p class="progress-line">
<strong id="progress-percent">0 %</strong>
<span id="progress-detail"></span>
</p>
<p class="hint" id="progress-file"></p>
<p class="notice notice-warn" id="progress-retry" role="status" hidden>
<span lang="de">Verbindung unterbrochen – der Upload wird gleich fortgesetzt …</span>
<span lang="en">Connection interrupted – the upload will continue in a moment …</span>
</p>
<div class="actions">
<button type="button" class="button button-secondary" id="cancel-upload">
<span lang="de">Abbrechen</span>
<span lang="en">Cancel</span>
</button>
</div>
</div>
<!-- Schritt 3: fertig -->
<div id="step-done" hidden>
<div class="done-head">
<svg class="done-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m5 12.5 4.5 4.5L19 7.5"/>
</svg>
<h2 class="card-title" id="done-title" tabindex="-1">
<span lang="de">Fertig – hier ist dein Link</span>
<span lang="en">Done – here is your link</span>
</h2>
</div>
<div class="link-row">
<input type="text" id="share-link" readonly aria-labelledby="done-title">
<button type="button" class="button button-primary" id="copy-link"></button>
</div>
<p class="hint" id="done-info"></p>
<div class="actions">
<a class="button button-secondary" id="open-link" href="/">
<span lang="de">Link öffnen</span>
<span lang="en">Open link</span>
</a>
<button type="button" class="button button-secondary" id="new-upload">
<span lang="de">Weitere Dateien hochladen</span>
<span lang="en">Upload more files</span>
</button>
</div>
</div>
<!-- Upload unterbrochen -->
<div id="step-error" hidden>
<h2 class="card-title" id="error-title" tabindex="-1">
<span lang="de">Upload unterbrochen</span>
<span lang="en">Upload interrupted</span>
</h2>
<p class="notice notice-error" id="upload-error" role="alert"></p>
<p class="hint" id="error-progress"></p>
<div class="actions">
<button type="button" class="button button-primary" id="resume-upload">
<span lang="de">Fortsetzen</span>
<span lang="en">Resume</span>
</button>
<button type="button" class="button button-secondary" id="discard-upload">
<span lang="de">Verwerfen</span>
<span lang="en">Discard</span>
</button>
</div>
</div>
</section>
<section class="recent" id="recent" hidden>
<h2>
<span lang="de">Zuletzt hochgeladen</span>
<span lang="en">Recently uploaded</span>
</h2>
<p class="hint">
<span lang="de">Diese Liste liegt nur in diesem Browser.</span>
<span lang="en">This list is kept in this browser only.</span>
</p>
<ul class="recent-list" id="recent-list"></ul>
<p class="notice notice-error" id="recent-error" role="alert" hidden></p>
</section>
</main>
{{footer}}
<script type="module" src="/js/upload.js"></script>
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
<footer class="site-footer container">
<p>
<span lang="de">Privater Dateitransfer</span>
<span lang="en">Private file transfer</span>
</p>
</footer>
+11
View File
@@ -0,0 +1,11 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="application-name" content="{{siteName}}">
<meta name="robots" content="noindex, nofollow">
<meta name="referrer" content="no-referrer">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f5f4f1">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#131619">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="/css/style.css">
<script src="/js/lang.js"></script>
+7
View File
@@ -0,0 +1,7 @@
<header class="site-header container">
<a class="brand" href="/">{{siteName}}</a>
<div class="lang-switch" role="group" aria-label="Sprache / Language">
<button type="button" data-set-lang="de" aria-pressed="true" aria-label="Deutsch">DE</button>
<button type="button" data-set-lang="en" aria-pressed="false" aria-label="English">EN</button>
</div>
</header>