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

+754
View File
@@ -0,0 +1,754 @@
/* Dateitransfer – schlicht und ruhig, hell oder dunkel je nach Geräteeinstellung. */
:root {
color-scheme: light dark;
--bg: #f5f4f1;
--surface: #ffffff;
--surface-2: #faf9f7;
--text: #20242a;
--muted: #667085;
--border: #e4e1db;
--border-strong: #cdc9c1;
--accent: #2f6f6a;
--accent-hover: #275d59;
--accent-soft: #e7f0ef;
--on-accent: #ffffff;
--danger-soft: #fbeceb;
--danger-text: #8f1d17;
--warn-soft: #fdf3d7;
--warn-text: #6a4b00;
--shadow: 0 1px 2px rgb(24 28 36 / 4%), 0 10px 30px rgb(24 28 36 / 6%);
--radius: 16px;
--radius-sm: 10px;
--font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
--mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #131619;
--surface: #1b1f23;
--surface-2: #171a1e;
--text: #e7e9ec;
--muted: #9aa4b2;
--border: #2a3036;
--border-strong: #3b434b;
--accent: #74c2b9;
--accent-hover: #8fd1c9;
--accent-soft: #1c2e2d;
--on-accent: #0c1d1b;
--danger-soft: #3a1f1d;
--danger-text: #ffb4ab;
--warn-soft: #362e14;
--warn-text: #f1dc9c;
--shadow: none;
}
}
/* ------------------------------------------------------------ Grundlagen */
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
/* Platz für die Bildlaufleiste freihalten, damit nichts springt. */
scrollbar-gutter: stable;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
min-height: 100dvh;
margin: 0;
background: var(--bg);
color: var(--text);
font: 1.0625rem/1.55 var(--font);
-webkit-font-smoothing: antialiased;
}
[hidden] {
display: none !important;
}
/* Beide Sprachen stehen im HTML; sichtbar ist die am <html>-Element gesetzte. */
html[lang="de"] [lang="en"],
html[lang="en"] [lang="de"] {
display: none !important;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
h1,
h2,
p {
margin: 0;
}
a {
color: var(--accent);
text-underline-offset: 0.18em;
}
.container {
width: min(100% - 2.5rem, 40rem);
margin-inline: auto;
}
main {
flex: 1;
padding-block: clamp(1.5rem, 7vh, 4.5rem) 3rem;
}
/* ------------------------------------------------------- Kopf und Fuß */
.site-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding-block: 1.25rem;
}
.brand {
display: inline-flex;
align-items: center;
gap: 0.6rem;
color: inherit;
font-weight: 650;
letter-spacing: -0.01em;
text-decoration: none;
}
.brand::before {
content: "";
width: 0.7rem;
height: 0.7rem;
border-radius: 50%;
background: var(--accent);
}
.lang-switch {
display: inline-flex;
padding: 3px;
border: 1px solid var(--border);
border-radius: 999px;
background: var(--surface);
}
.lang-switch button {
padding: 0.3rem 0.7rem;
border: 0;
border-radius: 999px;
background: none;
color: var(--muted);
font: inherit;
font-size: 0.8rem;
font-weight: 650;
letter-spacing: 0.05em;
cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
background: var(--accent-soft);
color: var(--accent);
}
.site-footer {
padding-block: 1.5rem 2rem;
color: var(--muted);
font-size: 0.875rem;
text-align: center;
}
/* ----------------------------------------------------------- Texte */
.intro {
margin-bottom: 2rem;
}
h1 {
font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.5rem);
font-weight: 680;
line-height: 1.12;
letter-spacing: -0.025em;
overflow-wrap: anywhere;
}
.lead {
max-width: 34rem;
margin-top: 0.75rem;
color: var(--muted);
font-size: 1.1rem;
}
.intro .button {
margin-top: 1.5rem;
}
.hint {
color: var(--muted);
font-size: 0.9rem;
}
.hint-below {
margin-top: 1rem;
text-align: center;
}
/* ----------------------------------------------------------- Karte */
.card {
padding: clamp(1.1rem, 4vw, 1.75rem);
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--surface);
box-shadow: var(--shadow);
}
.card-flush {
padding: 0.35rem clamp(0.9rem, 3vw, 1.25rem);
}
.card-title {
font-size: 1.25rem;
font-weight: 650;
letter-spacing: -0.01em;
}
.card-title:focus {
outline: none;
}
/* --------------------------------------------------------- Knöpfe */
.button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
min-height: 2.75rem;
padding: 0.6rem 1.15rem;
border: 1px solid transparent;
border-radius: var(--radius-sm);
font: inherit;
font-weight: 620;
line-height: 1.2;
text-align: center;
text-decoration: none;
cursor: pointer;
transition:
background-color 0.15s,
border-color 0.15s;
}
.button-primary {
background: var(--accent);
color: var(--on-accent);
}
.button-primary:hover:not(:disabled) {
background: var(--accent-hover);
}
.button-secondary {
border-color: var(--border-strong);
background: var(--surface);
color: var(--text);
}
.button-secondary:hover:not(:disabled) {
border-color: var(--muted);
}
.button-danger {
border-color: var(--danger-text);
background: var(--danger-soft);
color: var(--danger-text);
}
.button-small {
min-height: 2.25rem;
padding: 0.4rem 0.8rem;
font-size: 0.9rem;
}
.button-wide {
width: 100%;
margin-top: 1.5rem;
}
.button:disabled {
opacity: 0.45;
cursor: not-allowed;
}
/* Das versteckte Dateifeld gibt seinen Tastaturfokus an den Knopf weiter. */
.visually-hidden:focus-visible + .button {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.link-button {
padding: 0;
border: 0;
background: none;
color: var(--muted);
font: inherit;
font-size: 0.9rem;
text-decoration: underline;
text-underline-offset: 0.18em;
cursor: pointer;
}
.link-button:hover {
color: var(--text);
}
.icon-button {
display: inline-grid;
flex: none;
place-items: center;
width: 2rem;
height: 2rem;
padding: 0;
border: 0;
border-radius: 8px;
background: none;
color: var(--muted);
font: inherit;
font-size: 1.25rem;
line-height: 1;
cursor: pointer;
}
.icon-button:hover {
background: var(--surface-2);
color: var(--text);
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 0.6rem;
margin-top: 1.5rem;
}
/* ------------------------------------------------------- Ablagefläche */
.dropzone {
display: grid;
justify-items: center;
padding: 2.25rem 1.25rem 1.6rem;
border: 1.5px dashed var(--border-strong);
border-radius: var(--radius);
background: var(--surface-2);
text-align: center;
transition:
background-color 0.15s,
border-color 0.15s;
}
.dropzone.is-dragover {
border-color: var(--accent);
background: var(--accent-soft);
}
.dropzone-icon {
width: 3rem;
height: 3rem;
margin-bottom: 0.9rem;
padding: 0.7rem;
border-radius: 50%;
background: var(--accent-soft);
color: var(--accent);
}
.dropzone-title {
font-size: 1.1rem;
font-weight: 620;
}
.dropzone-or {
margin: 0.15rem 0 0.7rem;
color: var(--muted);
font-size: 0.9rem;
}
.dropzone .hint {
margin-top: 1rem;
}
/* --------------------------------------------------------- Dateiliste */
.file-list {
margin: 1.25rem 0 0;
padding: 0;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
list-style: none;
}
.file-list li {
display: flex;
align-items: center;
gap: 0.75rem;
min-height: 3rem;
padding: 0.4rem 0.5rem 0.4rem 0.9rem;
}
.file-list li + li {
border-top: 1px solid var(--border);
}
.file-list-plain {
margin: 0;
border: 0;
}
.file-list-plain li {
min-height: 3.75rem;
padding-inline: 0;
}
.file-name {
display: flex;
flex: 1;
min-width: 0;
}
.file-stem {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-ext {
flex: none;
white-space: nowrap;
}
.file-size {
flex: none;
color: var(--muted);
font-size: 0.9rem;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.selection-summary {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 1rem;
margin-top: 0.6rem;
color: var(--muted);
font-size: 0.9rem;
}
/* ------------------------------------------------------------ Felder */
.fields {
display: grid;
gap: 1rem;
margin-top: 1.5rem;
}
@media (min-width: 34rem) {
.fields {
grid-template-columns: 1fr 1fr;
}
}
.field > label:first-child {
display: block;
margin-bottom: 0.35rem;
font-size: 0.9rem;
font-weight: 620;
}
input[type="text"],
select {
width: 100%;
min-height: 2.75rem;
padding: 0.55rem 0.75rem;
border: 1px solid var(--border-strong);
border-radius: var(--radius-sm);
background: var(--surface);
color: var(--text);
font: inherit;
}
input[type="text"]:focus-visible,
select:focus-visible {
outline-offset: 0;
border-color: var(--accent);
}
input[aria-invalid="true"] {
border-color: var(--danger-text);
}
.check {
display: inline-flex;
align-items: center;
gap: 0.45rem;
margin-top: 0.55rem;
color: var(--muted);
font-size: 0.9rem;
cursor: pointer;
}
.check input {
width: 1rem;
height: 1rem;
margin: 0;
accent-color: var(--accent);
}
#code-hint {
margin-top: 1rem;
}
.notice {
margin-top: 1rem;
padding: 0.7rem 0.9rem;
border-radius: var(--radius-sm);
font-size: 0.95rem;
}
.notice-error {
background: var(--danger-soft);
color: var(--danger-text);
}
.notice-warn {
background: var(--warn-soft);
color: var(--warn-text);
}
/* ------------------------------------------------------- Fortschritt */
progress {
display: block;
width: 100%;
height: 0.6rem;
margin-top: 1.25rem;
overflow: hidden;
border: 0;
border-radius: 999px;
background: var(--border);
appearance: none;
}
progress::-webkit-progress-bar {
border-radius: 999px;
background: var(--border);
}
progress::-webkit-progress-value {
border-radius: 999px;
background: var(--accent);
transition: width 0.25s linear;
}
progress::-moz-progress-bar {
border-radius: 999px;
background: var(--accent);
}
.progress-line {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
gap: 0.25rem 1rem;
margin-top: 0.7rem;
font-variant-numeric: tabular-nums;
}
.progress-line span {
color: var(--muted);
font-size: 0.95rem;
}
#progress-file {
margin-top: 0.35rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ------------------------------------------------------------ Fertig */
.done-head {
display: flex;
align-items: center;
gap: 0.75rem;
}
.done-icon {
flex: none;
width: 2.25rem;
height: 2.25rem;
padding: 0.5rem;
border-radius: 50%;
background: var(--accent-soft);
color: var(--accent);
}
.link-row {
display: flex;
gap: 0.5rem;
margin-top: 1.25rem;
}
.link-row input {
flex: 1;
min-width: 0;
background: var(--surface-2);
font-family: var(--mono);
font-size: 0.95rem;
}
.link-row .button {
flex: none;
min-width: 7rem;
}
@media (max-width: 26rem) {
.link-row {
flex-direction: column;
}
}
#done-info,
#error-progress {
margin-top: 0.75rem;
}
/* ------------------------------------------------- Zuletzt hochgeladen */
.recent {
margin-top: 2.75rem;
}
.recent h2 {
font-size: 1.05rem;
font-weight: 650;
}
.recent-list {
margin: 0.9rem 0 0;
padding: 0;
list-style: none;
}
.recent-list li {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem 1rem;
padding: 0.85rem 0;
border-top: 1px solid var(--border);
}
.recent-main {
flex: 1 1 14rem;
min-width: 0;
}
.recent-link {
display: flex;
min-width: 0;
color: var(--text);
font-weight: 620;
text-decoration: none;
}
.recent-link .file-name {
flex: 0 1 auto;
}
.recent-link:hover .file-stem {
text-decoration: underline;
text-underline-offset: 0.18em;
}
.recent-more {
flex: none;
margin-left: 0.4rem;
color: var(--muted);
font-weight: 400;
white-space: nowrap;
}
.recent-meta {
color: var(--muted);
font-size: 0.875rem;
}
.recent-actions {
display: flex;
flex: none;
gap: 0.5rem;
}
/* ---------------------------------------------------- Download-Seite */
#dl-loading,
#dl-ready,
#dl-missing,
#dl-error {
display: none;
}
html[data-state="loading"] #dl-loading,
html[data-state="ready"] #dl-ready,
html[data-state="missing"] #dl-missing,
html[data-state="error"] #dl-error {
display: block;
}
@media (max-width: 26rem) {
.file-list-plain li {
flex-wrap: wrap;
padding-block: 0.75rem;
}
.file-list-plain .file-name {
flex-basis: 100%;
}
.file-list-plain .file-size {
flex: 1;
}
}
@media (prefers-reduced-motion: reduce) {
* {
transition: none !important;
}
}