Add catbox.moe / litterbox encode & upload (u) - #229
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #228.
Adds an encode & upload action: pressing
uon 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 requiredtime), the curl argument builder, and the clipboard/browser helpers.src/UploadWithProgress.moon(new) — an async curl subprocess with a live progress meter (ESCcancels), plus done and failed states.src/MainPage.moon—u: encode & uploadnext toe: 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— anUpload Destinationrow.src/options.lua—upload_host,litterbox_time,catbox_userhash,upload_curl_path,open_after_upload.tests/testcases/test_upload.py(new) — offline coverage using a stub curl.Notes
401 ... basic auth) and its web upload routes/uploadand/t/uploadreturn404, so it is deliberately excluded.curlfor the multipart form. Whencurlis not onPATH, theuline is hidden and pressinguexplains why.clipboard/textwhen available, otherwisewl-copy/xclip/pbcopy(launched without blocking, since those tools stay alive to own the selection).litterboxuploads expire afterlitterbox_time;catboxuploads are anonymous and kept until 2 years of inactivity, or permanent/manageable whencatbox_userhashis set.Testing