feat: configurable gateway public_url for settings endpoints (v0.6.3) - #96
Merged
Merged
Conversation
… endpoint card (v0.6.3) Rant 2026-08-19T20:37:37: settings '接入方式' endpoint URLs were hardcoded (https://gateway.aitokenpool.local/v1|/anthropic). - config [server].public_url (default http://localhost:8080, decoupled from listen addr); documented in config.example.toml + README - GET /api/config returns {public_url} (unauthenticated, non-sensitive) - frontend builds endpoints as {public_url}/v1 and {public_url}/anthropic at render time; falls back to location.origin when config unreachable - tests: config.rs default assertion + route test; 113/113 pass
9 tasks
argszero
added a commit
that referenced
this pull request
Sep 13, 2026
`ui/index.html` carries every `data-i18n` string twice: once as the element's static text (the fallback) and once in the pack (`ui/js/i18n.js`). `applyStatic()` overwrites the element with the pack value on DOMContentLoaded, so the fallback is normally invisible — but it is still a second source of truth, and two of its entries state things that are no longer true: - `ops.hours.sub`: 「按小时用量记录 · 本地时区」. The backend buckets `today_hours` by UTC (`src/routes/ops.rs:5`, `:115`) and the pack says 「服务端 UTC 时区」. Introduced already-contradictory in 09e4121 (#157). - `settings.ep.note`: 「部署后替换为你的网关域名(原型占位说明)」 — a verbatim copy of the prototype (docs/prototype/aitokenpool-console.html:705) including the 「原型占位说明」 marker. The endpoint card became config-driven in e74f7fc (#96) and the pack was updated then; only the static fallback was left behind. Both static strings are now identical to their pack entry. Data-only (HTML text), zero behaviour change: the rendered UI already showed the pack value, so no user-visible output changes. No i18n key added or removed (786 keys before and after), no JS/CSS touched, so no cache-bust. The remaining fallback divergences are deliberate older wording (which is the fallback's purpose) and are left alone; only false/stale text is a defect. Co-authored-by: argszero <argszero@argszerodeMac-mini.local>
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.
Summary
Settings page '接入方式' endpoint URLs were hardcoded to
https://gateway.aitokenpool.local/v1and/anthropic. This PR makes them config-driven (host rant 2026-08-19T20:37:37, project: aitokenpool).Changes:
[server].public_urlfield (defaulthttp://localhost:8080, decoupled from the listenaddr); documented inconfig/config.example.toml+ READMEGET /api/config→{"public_url": "..."}(unauthenticated, non-sensitive; reusable for future frontend config)ui/js/app.js): endpoint card built at render time as{public_url}/v1and{public_url}/anthropic; falls back tolocation.originwhen config is unreachable (same-origin deploys stay correct);Live.publicUrlloaded during session initserver_public_url_defaults_to_localhost(config) +config_returns_public_url(route); full suite 113/113 greenRelated Issue
Rant: 2026-08-19T20:37:37.082472+08:00 (接入方式 URL 配置化 — 不再硬编码域名)
Tests
cargo test— 113/113 pass (2 new)cargo fmt --checkcleancargo clippy --all-targets -- -D warningscleannode --checkapp.js / i18n.js/api/config→ configured value,/healthzv0.6.3, index 200