Repository navigation
feat(cli): add --scheme and --with-name to the send URL - #398
Open
claudiodangelis wants to merge 1 commit into
Open
claudiodangelis wants to merge 1 commit into
claudiodangelis wants to merge 1 commit into
Conversation
Some apps download files from links with their own scheme, and need the URL to end with the name of the file: the Zepp app installs watch faces on Amazfit watches from QR codes of links like zpkd1://host/path/watchface.zpk (#397). - --scheme puts another scheme in the send URL instead of http or https. It only changes the URL: the server still uses http, or https with --secure, and the URL used to open the QR code in the browser and the receive URL are unchanged. Invalid schemes are rejected. - --with-name (-w) adds the name of the file, escaped, to the end of the send URL. Only that exact name is served; the URL without the name keeps working. The two are independent, both work with qrcp and qrcp send, and can be set in the configuration file (scheme, withName) or with QRCP_SCHEME and QRCP_WITHNAME. The CI e2e jobs check both on Linux and macOS.
This branch has not been deployed
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 #397.
Some apps download files from links with their own scheme, and some need the URL to end with the name of the file. For example, the Zepp app installs watch faces on Amazfit watches from QR codes of links like
zpkd1://host/path/watchface.zpk. This adds two independent options tosend:--schemeputs another scheme in the send URL instead ofhttporhttps. It only changes the URL: the server still uses HTTP, or HTTPS with--secure. The URL used to open the QR code in the browser (--browser) and the receive URL are unchanged. Invalid schemes (per RFC 3986) are rejected, and a trailing://is ignored.--with-name/-wadds the name of the file, escaped, to the end of the send URL, e.g./send/abc/watchface.zpk. Only that exact name is served; the URL without the name keeps working.qrcp --scheme zpkd1 -w watchface.zpk # zpkd1://192.168.1.10:8080/send/abc/watchface.zpkBoth work with
qrcpandqrcp send(notreceive), and can be set in the configuration file (scheme,withName) or withQRCP_SCHEMEandQRCP_WITHNAME. The README documents them in a new "Links for Other Apps" section.Tests
server/url_test.go: scheme validation; the scheme only changesSendURL, and the file is still served over HTTP; the default URL has no name and the named URL isn't served without-w; with-wthe file is served at its name, which is escaped (spaces,%,#,?, non-ASCII), only the exact name is served, and the URL follows a newSend; both options together;receiveis unchanged.config/load_test.go: the keys are read from the file and the environment, flags override them, and the defaults are unchanged.cmd/send_test.go: bothqrcpandqrcp sendtake the flags,-wis--with-name,receivedoesn't take them, and they are parsed.qrcp --scheme zpkd1 -w "watch face.zpk", checks the printed URL and downloads the file over HTTP.Not verified
Whether the Zepp app downloads
zpkd1://links over plain HTTP from a local server; the issue author is asked to try it.