diff options
| author | Ahmed <git@gumx.cc> | 2026-06-17 15:45:51 +0300 |
|---|---|---|
| committer | Ahmed <git@gumx.cc> | 2026-06-17 15:45:51 +0300 |
| commit | 2faa1fede9cfe79e2bc93e3e5e2444e4f54cb32b (patch) | |
| tree | 8cc2747ee551c51a075553f905156559ba0835dd /files.gumx.cc/upload.html | |
| parent | 12b6af597d9f3c463fdae9e59e3f5a432bf6c004 (diff) | |
fix: style, docs, and few routes
Diffstat (limited to 'files.gumx.cc/upload.html')
| -rw-r--r-- | files.gumx.cc/upload.html | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/files.gumx.cc/upload.html b/files.gumx.cc/upload.html new file mode 100644 index 0000000..e82bd96 --- /dev/null +++ b/files.gumx.cc/upload.html @@ -0,0 +1,83 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="utf-8"> +<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNDAiIGhlaWdodD0iMTQwIiBzdHJva2U9IiMwMDAiPjxwYXRoIHN0cm9rZS13aWR0aD0iMTIyIiBzdHJva2UtZGFzaGFycmF5PSIyLDM4IiBkPSJtOSw3MGgxMjJNNzAsOXYxMjIiLz48cGF0aCBzdHJva2Utd2lkdGg9IjMzIiBzdHJva2UtbGluZWNhcD0icm91bmQiIGQ9Im03MCwzMGgwbTQwLDQwaDBtLTgwLDQwdjBtNDAsMGgwbTQwLDBoMCIvPjwvc3ZnPg=="> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<title>files.gumx.cc / upload</title> +<style> +@font-face { font-family: "Kawkab Mono"; src: url(/fonts/KawkabMono-Regular.woff2); font-weight: normal; } +@font-face { font-family: "Kawkab Mono"; src: url(/fonts/KawkabMono-Bold.woff2); font-weight: bold; } +* { unicode-bidi: plaintext; box-sizing: border-box; } +html { color: black; background-color: white; } +body { font-family: "Kawkab Mono"; font-size: 16px; line-height: 1.4; margin: 0; padding: 4rem 0; min-height: 100%; overflow-wrap: break-word; } +main, header, footer { max-width: 800px; margin-inline: auto; padding: 0 2rem; } +h1, header, footer { text-align: center; } +main { text-align: justify; } +p, h2, h3, h4 { margin: 1em 0 0 0; } +pre { margin: 1em 0; } +pre code { border: thin solid; padding: 1em; display: block; text-align: start; overflow-x: scroll; } +code { font-size: 85%; } +hr { border: none; border-top: thin solid; margin: 1.25rem 0; } +header { margin-bottom: 1em; } +footer { margin-top: 3em; } +input[type="text"], input[type="file"], button { font-family: inherit; font-size: inherit; border: thin solid; padding: 0.3em 0.6em; background: transparent; color: inherit; } +input[type="text"] { width: 100%; } +button { cursor: pointer; } +#result { margin-top: 1em; word-break: break-all; } +@media (max-width: 600px) { body { font-size: 0.9em; } h1 { font-size: 1.8em; } } +@media (prefers-color-scheme: dark) { html { filter: invert(1); } } +</style> +</head> +<body> +<header> +<h1><a href="https://gumx.cc">gumx</a> / <a href="https://files.gumx.cc">files</a> / upload</h1> +</header> +<main> +<p>Upload a file using your token. Files expire after 24 hours by default. Max 256 MB.</p> +<h2>web form</h2> +<p><input type="text" id="token" placeholder="token" autocomplete="off"></p> +<p><input type="file" id="file"></p> +<p><button onclick="upload()">upload</button></p> +<p id="result"></p> +<h2>curl</h2> +<pre><code>curl -F "file=@photo.jpg" -H "Authorization: Bearer YOUR_TOKEN" https://files.gumx.cc/</code></pre> +</main> +<footer> +<hr> +<a href="https://twt.gumx.cc">twt</a> / +<a href="https://git.gumx.cc">git</a> / +<a href="https://mail.gumx.cc">mail</a> / +<a href="https://irc.gumx.cc">irc</a> / +<a href="https://files.gumx.cc">files</a> / +<a href="https://vpn.gumx.cc">vpn</a> / +<a href="https://pgp.gumx.cc">pgp</a> / +<a href="https://demo.gumx.cc">demo</a> / +<a href="https://wk.fo">wk.fo</a> +</footer> +<script> +async function upload() { + const token = document.getElementById('token').value.trim(); + const file = document.getElementById('file').files[0]; + const result = document.getElementById('result'); + if (!token) { result.textContent = 'enter a token'; return; } + if (!file) { result.textContent = 'choose a file'; return; } + result.textContent = 'uploading...'; + try { + const fd = new FormData(); + fd.append('file', file); + const r = await fetch('/', { + method: 'POST', + headers: { 'Authorization': 'Bearer ' + token }, + body: fd + }); + const text = await r.text(); + if (!r.ok) { result.textContent = 'error ' + r.status + ': ' + text; return; } + result.innerHTML = '<a href="' + text.trim() + '">' + text.trim() + '</a>'; + } catch (e) { + result.textContent = 'error: ' + e.message; + } +} +</script> +</body> +</html> |
