Commit Graph
19 Commits
Author SHA1 Message Date
lucioandClaude Opus 4.8 f013e1f22b Compress over-limit images client-side to fit instead of rejecting them
Previously an image at/over the upload size limit was simply rejected with
"File too large", and the limit was hardcoded to 50 MB in the client even when
the server was configured lower. Now:

- The configured image limit (upload.max_size_mb) is surfaced to the client via
  pageData.UploadMaxMB and passed to GlimmerUpload.init({maxImageMB}).
- Selecting an over-limit image prompts to compress it in the browser to fit;
  the oversized original is never uploaded (Cancel aborts). Images over 10 MB
  but under the limit get an optional "compress for faster upload" prompt.
- compressToTarget iteratively fits the file just under the limit: it tries a
  JPEG quality ladder (0.85 → 0.4) at each resolution and halves the resolution
  on failure, down to a 320 px floor, targeting 95% of the limit for headroom.
  If it can't get under the limit it reports the smallest size achieved and
  uploads nothing.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-04 23:24:11 -07:00
lucioandClaude Opus 4.8 1be1e0c001 Fix large image uploads failing with bogus CSRF 403 + add client-side compression
The upload handlers called verifyCSRF (which reads a form value, implicitly
triggering ParseMultipartForm) before parsing the multipart body. When a file
exceeded the MaxBytesReader cap, the parse failed, FormValue returned "", and
the request was rejected as "Invalid CSRF token" (403) instead of a proper
413 "File too large". Small images parsed fine, so only large uploads broke.

- handlers.go: parse the multipart form explicitly before the CSRF check in
  both handleUpload and handleFileUpload; report oversized bodies as 413 via
  errors.As(http.MaxBytesError) instead of a fragile error-string compare.
- upload.js: offer in-browser canvas compression (downscale + JPEG re-encode)
  for images over 10 MB before upload; falls back to the original on failure.
- server.go: allow blob: in CSP img-src so the compressor canvas can load the
  selected file.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-04 23:03:38 -07:00
lucio 1c3940dc5c added missing files 2026-06-02 01:24:35 -07:00
lucio 2f5c31499d security review 2026-06-02 01:24:19 -07:00
lucio a9e2ba548b Add Codex project instructions 2026-05-22 01:15:56 -07:00
lucio 4ca04bf8ed Add authenticated MCP endpoint 2026-05-22 01:14:51 -07:00
lucioandClaude Opus 4.6 1b91014d1c Preserve original upload filenames, share upload JS, polish UI, update docs
- Adds an "uploads" SQLite table (filename → original_name) so the user's
  original filename is preserved and used in Content-Disposition headers and
  the admin listing instead of the on-disk hex name.
- Extracts shared upload logic to static/upload.js (window.GlimmerUpload),
  deduplicating ~80 lines between the uploads page and the paste editor.
- Adds size hints on upload buttons, an extension chip + original name in the
  uploads table, and a .ext-chip style.
- Updates CLAUDE.md and README.md (route table, schema, features, project
  structure) to reflect the new endpoint and behaviour.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-05-21 01:43:38 -07:00
lucioandClaude Opus 4.6 b069027d56 Add generic file upload support to pastebin (5 MB max)
Adds a new POST /admin/upload-file endpoint for uploading any file type
alongside the existing image upload. Files are served with
Content-Disposition: attachment to prevent same-origin XSS via uploaded
HTML/SVG/JS. The display filename embedded in markdown link responses is
sanitized to block markdown injection.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-05-21 00:48:14 -07:00
lucio d788210aa9 Add CLAUDE.md for project documentation and guidelines 2026-04-08 01:34:27 -07:00
lucio 70c6deea57 readme update 2026-04-08 01:14:02 -07:00
lucio b45c837c1a Add image upload functionality with management interface 2026-04-08 01:06:12 -07:00
lucio f80903c7eb Implement hidden paste feature with QR code generation and access token handling 2026-04-08 00:13:47 -07:00
Clawy 22fe12012b Add favicon with sparkle theme and link to all templates 2026-04-02 10:59:40 +00:00
lucioandClaude Opus 4.6 a22c4939c2 Replace client-side QR with server-side endpoint for admin dashboard
The JS QR library (qr.min.js) produced unscannable codes. Replaced with
a /admin/qr/{slug} endpoint using the same server-side rsc.io/qr that
already works on the home page.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-04-02 03:41:00 -07:00
lucioandClaude Sonnet 4.6 a75f5b35f2 Fix action button sizing and add QR modal to admin dashboard
- Normalize Edit/QR/Del button sizes in role=group with consistent
  padding, font-size, and white-space:nowrap
- Add QR button to each link row in My Links and Anonymous Links tables
- QR modal uses <dialog> + qr.min.js to generate an inline SVG on click

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 03:28:57 -07:00
lucioandClaude Opus 4.6 1bfad9ed7c Rename project to Glimmer for luci.ooo
Rebrand from "urlshort" to "Glimmer" across the entire codebase:
Go module/imports, build targets, HTML templates, deploy scripts
(including renaming service files), config, and README.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-04-02 03:00:08 -07:00
lucio 5abdf2b6f2 added .claude in gitignore 2026-04-02 03:00:08 -07:00
lucioandClaude Sonnet 4.6 60a09fa878 Initial commit: URL shortener + pastebin with dark admin UI and deploy scripts
Features:
- URL shortener with QR codes, click tracking, deduplication, rate limiting
- Pastebin with Markdown rendering, access tokens, raw view
- Admin dashboard: dark theme, stats bar, Quick Links tiles with favicons,
  card-based layout, format/token badges, empty states
- CSRF protection, bcrypt auth, in-memory sessions, security headers
- Pure-Go SQLite (no CGo), single self-contained binary

Deploy:
- deploy/install.sh: auto-detects systemd vs SysV init
- deploy/urlshort.service: hardened systemd unit
- deploy/urlshort.init: SysV init script for older Ubuntu

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-02 03:00:08 -07:00
lucio 013ff09132 Initial commit 2026-04-02 02:45:43 -07:00