feat: initial Minipaste

- MinIO-backed paste storage with 8-char base62 IDs
- Paste expiry (1m, 1h, 1d, 1w, never) stored in object metadata
- Raw plain-text endpoint at /raw/:id
- Syntax highlighting in editor and paste view via highlight.js
- In-editor highlight overlay with live language switching
- Download button with correct file extension per language
- Auto-redirect to paste after creation
This commit is contained in:
callum5892
2026-03-10 22:41:22 +00:00
parent 51c03e5f42
commit 933d81a77f
15 changed files with 2278 additions and 158 deletions

346
src/public/style.css Normal file
View File

@@ -0,0 +1,346 @@
/* ─── Custom Properties ─── */
:root {
--bg: #0f1117;
--surface: #1a1d27;
--surface2: #23263a;
--accent: #7c3aed;
--accent-hover: #6d28d9;
--text: #e2e8f0;
--text-muted: #8892a4;
--border: #2a2d3e;
--error: #f87171;
--radius: 6px;
--mono: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
--sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
background: var(--bg);
color: var(--text);
font-family: var(--sans);
line-height: 1.5;
display: flex;
flex-direction: column;
min-height: 100vh;
}
/* ─── Header ─── */
header {
background: var(--surface);
border-bottom: 1px solid var(--border);
height: 54px;
padding: 0 1.5rem;
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
}
.logo {
font-size: 1.15rem;
font-weight: 700;
color: var(--accent);
text-decoration: none;
letter-spacing: -0.01em;
}
.header-actions {
display: flex;
align-items: center;
gap: 0.75rem;
}
/* ─── Main ─── */
main {
flex: 1;
display: flex;
flex-direction: column;
padding: 1.5rem;
max-width: 1040px;
width: 100%;
margin: 0 auto;
}
/* ─── Buttons ─── */
.btn,
button {
display: inline-flex;
align-items: center;
justify-content: center;
background: var(--accent);
color: #fff;
border: none;
border-radius: var(--radius);
padding: 0.4rem 0.9rem;
font-size: 0.85rem;
font-weight: 600;
cursor: pointer;
text-decoration: none;
transition: background 0.15s, opacity 0.15s;
white-space: nowrap;
line-height: 1.4;
font-family: var(--sans);
}
.btn:hover,
button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
/* ─── Editor Card ─── */
.editor-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
.toolbar {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.5rem 0.75rem;
background: var(--surface2);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
select {
background: var(--surface);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 0.3rem 0.55rem;
font-size: 0.85rem;
font-family: var(--sans);
cursor: pointer;
outline: none;
}
select:focus { border-color: var(--accent); }
.char-count {
font-size: 0.78rem;
color: var(--text-muted);
margin-left: auto;
margin-right: 0.25rem;
font-variant-numeric: tabular-nums;
}
.char-count.over { color: var(--error); }
/* ─── Editor body (line numbers + textarea side by side) ─── */
.editor-body {
display: flex;
flex: 1;
overflow: hidden;
min-height: 440px;
}
.editor-stack {
position: relative;
flex: 1;
overflow: hidden;
}
.line-numbers {
padding: 1rem 0.65rem 1rem 0.75rem;
font-family: var(--mono);
font-size: 0.9rem;
line-height: 1.65;
color: var(--text-muted);
text-align: right;
white-space: pre;
overflow: hidden;
user-select: none;
-webkit-user-select: none;
flex-shrink: 0;
min-width: 2.8rem;
background: var(--surface2);
border-right: 1px solid var(--border);
}
textarea#content {
position: absolute;
inset: 0;
background: transparent;
color: transparent;
caret-color: var(--text);
border: none;
outline: none;
padding: 1rem;
font-family: var(--mono);
font-size: 0.9rem;
line-height: 1.65;
resize: none;
tab-size: 2;
overflow: auto;
z-index: 2;
}
textarea#content::placeholder { color: var(--text-muted); }
#editor-highlight {
position: absolute;
inset: 0;
margin: 0;
padding: 1rem;
overflow: hidden;
pointer-events: none;
z-index: 1;
}
#editor-highlight-code {
font-family: var(--mono);
font-size: 0.9rem;
line-height: 1.65;
white-space: pre;
display: block;
min-height: 100%;
}
#editor-highlight-code.hljs {
background: transparent;
padding: 0;
}
/* ─── Result / Error boxes ─── */
.result-box {
margin-top: 1rem;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 0.85rem 1.1rem;
display: flex;
align-items: center;
gap: 0.9rem;
flex-wrap: wrap;
}
.result-label {
font-size: 0.8rem;
color: var(--text-muted);
flex-shrink: 0;
}
.result-box a {
color: var(--accent);
font-family: var(--mono);
font-size: 0.875rem;
word-break: break-all;
flex: 1;
min-width: 0;
}
.error-box {
margin-top: 0.9rem;
color: var(--error);
background: rgba(248, 113, 113, 0.08);
border: 1px solid rgba(248, 113, 113, 0.25);
border-radius: var(--radius);
padding: 0.75rem 1rem;
font-size: 0.875rem;
}
.hidden { display: none !important; }
/* ─── Paste View ─── */
.paste-view { padding-top: 1.25rem; }
.paste-meta {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.75rem;
min-height: 1.5rem;
}
.paste-meta #copy-btn {
margin-left: auto;
}
.paste-meta-actions {
margin-left: auto;
display: flex;
gap: 0.5rem;
}
.lang-badge {
background: var(--surface2);
border: 1px solid var(--border);
border-radius: 4px;
padding: 0.15rem 0.5rem;
font-size: 0.75rem;
font-family: var(--mono);
color: var(--text-muted);
text-transform: lowercase;
}
.paste-date {
font-size: 0.78rem;
color: var(--text-muted);
}
#paste-content {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: auto;
flex: 1;
display: flex;
}
#paste-content pre {
flex: 1;
margin: 0;
padding: 1rem;
overflow: visible;
}
#paste-content code {
font-family: var(--mono);
font-size: 0.9rem;
line-height: 1.65;
white-space: pre;
color: var(--text);
display: block;
}
#paste-content code.hljs {
background: transparent;
padding: 0;
}
/* ─── Not Found / Error state ─── */
.not-found {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
padding: 4rem 2rem;
text-align: center;
gap: 0.75rem;
}
.not-found h2 {
font-size: 4rem;
font-weight: 800;
color: var(--border);
line-height: 1;
}
.not-found p {
color: var(--text-muted);
margin-bottom: 0.5rem;
}
/* ─── Responsive ─── */
@media (max-width: 600px) {
main, header { padding-left: 1rem; padding-right: 1rem; }
.toolbar { flex-wrap: wrap; }
.char-count { order: 3; width: 100%; margin: 0; }
}