Skip to content

Add catbox.moe / litterbox encode & upload (u) - #229

Merged
ekisu merged 2 commits into
masterfrom
feat/catbox-upload
Sep 14, 2026
Merged

ekisu merged 2 commits into
masterfrom
feat/catbox-upload

Conversation

@ekisu

@ekisu ekisu commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Closes #228.

Adds an encode & upload action: pressing u on the WebM maker page runs the normal encoder and then uploads the finished clip to the destination configured in the options.

upload-demo.mp4

(The demo throttles the upload so the progress meter is visible.)

What changed

  • src/upload.moon (new) — the two Catbox host adapters (both use the same anonymous multipart request; litterbox adds a required time), the curl argument builder, and the clipboard/browser helpers.
  • src/UploadWithProgress.moon (new) — an async curl subprocess with a live progress meter (ESC cancels), plus done and failed states.
  • src/MainPage.moonu: encode & upload next to e: encode; hidden when curl is missing.
  • src/encode.moon — an optional completion callback so the upload runs after a successful encode. The detached path is skipped for uploads so completion is known.
  • src/EncodeOptionsPage.moon — an Upload Destination row.
  • src/options.luaupload_host, litterbox_time, catbox_userhash, upload_curl_path, open_after_upload.
  • tests/testcases/test_upload.py (new) — offline coverage using a stub curl.

Notes

  • Only Catbox services are offered. Streamable's upload API requires an account (401 ... basic auth) and its web upload routes /upload and /t/upload return 404, so it is deliberately excluded.
  • Uploads use curl for the multipart form. When curl is not on PATH, the u line is hidden and pressing u explains why.
  • The resulting URL is written via mpv's clipboard/text when available, otherwise wl-copy / xclip / pbcopy (launched without blocking, since those tools stay alive to own the selection).
  • litterbox uploads expire after litterbox_time; catbox uploads are anonymous and kept until 2 years of inactivity, or permanent/manageable when catbox_userhash is set.

Testing

nix-shell tests/default.nix --run "make && python -m tests.run_tests"
# Ran 40 tests ... OK (skipped=2)

Implements #228 for the Catbox services, which share an anonymous
multipart upload API:

- New `u: encode & upload` action on the main page, next to `e: encode`.
  It runs the normal encoder and then uploads the resulting file.
- Destination is configured in the options (`Upload Destination`) and in
  webm.conf: `upload_host` (catbox | litterbox), `litterbox_time`,
  `catbox_userhash`, `upload_curl_path`, `open_after_upload`.
- New UploadWithProgress page: async curl subprocess with live progress
  (ESC cancels), plus done and failed states. The resulting URL is copied
  to the clipboard.
- src/upload.moon holds the host adapters, curl argument builder and the
  clipboard/browser helpers. The `u` line is hidden when curl is missing.
- Streamable is intentionally not offered: its upload API requires an
  account (HTTP 401) and its web upload routes return 404.
- Offline integration tests use a stub curl to cover both hosts and the
  missing-range abort path.
- command_native_async requires a callback on older mpv (0.33 calls it
  unconditionally), so pass a no-op instead of nil.
- Set the done state before copying/opening so a clipboard or browser
  failure cannot suppress the result.
- Run the catbox and litterbox cases as separate tests instead of
  reopening pages via an IPC keypress, which older mpv handles
  inconsistently in the harness.
@ekisu
ekisu merged commit 9f15d3c into master Sep 14, 2026
2 checks passed
@ekisu
ekisu deleted the feat/catbox-upload branch September 14, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Upload to catbox.moe

1 participant