Repository navigation
feat(nodes): edit XHTTP link options as fields - #542
Merged
Merged
Conversation
2 of 3 tasks
Collaborator
Author
|
Companion honk change: Glassyiris/honk#140 (static rejection reasons for node/provider creation and the documented |
Glassyiris
marked this pull request as ready for review
October 11, 2026 13:42
Glassyiris
enabled auto-merge (squash)
October 11, 2026 14:05
Glassyiris
disabled auto-merge
October 11, 2026 14:06
Zakkaus
requested changes
Oct 11, 2026
Zakkaus
left a comment
Owner
There was a problem hiding this comment.
Thanks, the read/write split works: an unchanged link comes back byte for byte, and checking the edited link with POST /config/validate before the source write is the right guard. A few things before merge:
- The edit dialog shows the length limit but still saves.
useNodesPage.ts:504putsnodeFormReason('node', …)informReasonforeditNode, so an edited link over 8192 characters shows "too long", whileformValidcomes fromnodeEditStateand Save stays enabled. The comment atview.tssays a longer link still fits a source edit, so the length check should apply tonode(create) only. - Header names are written as typed.
xhttp.ts:126keeps a name with surrounding spaces, andObject.fromEntrieskeeps only the last of two rows with the same name, without telling the user. Please trim the names and mark a duplicate name on its row. - Rejections are shown in English.
useNodesPage.ts:67passes the diagnostic's rawmessageintonodes.linkRejected.diagnosticMessageinsrc/i18n/backend.ts:148already turns aConfigDiagnosticinto the translated text; please use it here. - The header comment says more than the code does.
xhttp.ts:2says every other byte survives. That holds for the query, but any field edit writesextraback throughJSON.parseandJSON.stringify, so its spacing changes, and integers past 2^53 would lose precision. Please describe that in the comment. - Screenshots. The dialog changes, so please attach light and dark screenshots of the XHTTP section, closed and open.
- Checklist and commits. The boxes for understanding the change, the commit format and the gates are unchecked, and the three commits have no body. CONTRIBUTING asks for a short English body on each.
- Rebase. Since #541 merged,
package.jsonconflicts onstartupActivity. Keep your 342450: main plus this branch comes to about 342,400 by the CI numbers.
Owner
|
衝突也需要解決 |
Show a vless or trojan XHTTP link's mode, path, host, headers, padding, POST pacing and download peer as fields that rewrite only their own part of the link. Check an edited link with honk's syntax validation before the source write, so a link honk would skip is refused with its reason, and refuse links over the 8192 characters node creation accepts.
The startup paths carry the largest language catalogue, and the XHTTP option labels and help add to all three. CI measured 238517 and 342247 bytes against the previous 238300 and 341850 limits.
honk reads a bare `mux:` line in a node section as the removed standalone mux setting and rejects it, so the edit check refused a valid link for a node named mux and renaming a node to mux broke the source. Write and check that one name quoted; group and DNS references stay unchanged.
Keep pending headers in the node draft and run link preflight inside the shared source-save transaction. Apply only changed XHTTP fields, preserve empty headers, encode apostrophes, and explain missing edit fields. Quote generated node declaration keys uniformly and lazy-load dialog-only subscription fields without increasing size budgets. Update regressions and user documentation.
Glassyiris
force-pushed
the
feat/xhttp-extra
branch
from
October 11, 2026 15:46
d356adb to
06cba6a
Compare
Shorten XHTTP help in all three complete catalogues while retaining the defaults, validation, node-ID and download-peer guidance. Keep the existing size budgets: CI's Node 22 gzip output exceeded login by 10 bytes and Activity by 42 bytes. Verify the production build and size gate with Node 22.23.3, matching CI, and inspect all three languages in the node dialog.
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.
Problem
honk accepts XHTTP options in a vless or trojan link's
extraJSON, but the node dialog only offered the raw link, so changing padding, headers, POST pacing or a download peer meant hand-editing percent-encoded JSON. An edited link that honk cannot read was also written to the source anyway: honk's parser drops such a node entry with only a warning, so the reload succeeded and the node silently disappeared. Adding a node with a link over the API's 8192-character limit failed only at the backend.How I fixed it
src/dae/xhttp.tsreads an XHTTP link into fields and writes back only the parameters whose value changed, keeping every other byte, unknown extra members and the link unchanged when nothing changed; links it cannot represent exactly are left to the raw field. A lazily loadedXhttpOptionsdisclosure in the add and edit node dialogs edits mode, path, host, headers, padding, POST pacing and the download peer through it. Before the source write, an edited link is checked alone withPOST /config/validateinsyntaxmode, and any error, or any warning whose code is notlegacy-*, refuses it with honk's reason; creation refuses links over 8192 characters. The check and the source edit sharenodeKey, which quotes a node namedmux: honk rejects a baremux:line as the removed standalone setting, so the check refused valid edits of such a node and a rename tomuxbroke the source. Strings are added to en, zh-CN and zh-TW, withdocs/pages*.mdand a changelog fragment.Verified
pnpm typecheck,pnpm lint,pnpm check:i18n,pnpm format:checkandpnpm check:genpass.check:sizepassed locally but CI measured the startup paths at 238517 and 342247 bytes, over the 238300 and 341850 limits, because the startup paths carry the largest language catalogue and the new strings add to it; the second commit raisesstartupLoginto 238700 andstartupActivityto 342450.pnpm vitest run: 3760 passed, 1 failed (view.test.ts"gives an expiry to the minute…"), which fails identically onmainwith this machine's locale data; the newnodes.test.tsmux case fails withnodeKeyreplaced byquoteName.playwright test e2e/nodes.spec.tson Chromium: 89 passed on the final head; together withe2e/a11y.spec.ts, 148 passed before the last commit. Against a local honk-core (mock eBPF,native_apiservingdist/), a node added through the fields was written as expected, an edit toxPaddingBytes: 0-10was refused with "XHTTP xPaddingBytes must stay within 1-8192" and left the source untouched, and a valid edit was saved. Not run: the full e2e suite, WebKit/Firefox, screenshots of the new fields. Thelegacy-*rule and the per-field honk messages come from Glassyiris/honk#140, merged intofeat/native-api; with an older honk the guard still refuses skipped links, but the range message is the generic one. A matching doona-docs change has not been opened.Submitted and answered for by (Human responsible, GitHub username): @Glassyiris
Check only claims that are true. A false claim closes the pull request.
main.type(scope): subjectand a short English body.CONTRIBUTING.md; the Verified section records the commands, results and any checks I could not complete.en.jsonand in every complete language's catalogue when I changed interface text.pnpm gen:apiandpnpm check:genwhen I changed the API contract.