Repository navigation
feat(server): per-device approval and separate admin page - #15
Merged
Merged
Conversation
- 按 URL 的 client_id 识别设备,审核开关打开后未批准设备收到 TRANSIENT_ERROR - 判断放在建用户之前;开关关闭时记录设备并自动批准 - 管理页挪到 SELFSYNC_ADMIN_ADDR(默认 127.0.0.1:8081),askama 渲染,中英文 - 管理页拒绝跨站 POST,回环监听时拒绝非本机 Host;同步端口去掉 GET / - 懒猫:打开应用进管理页,仅同步路径免登录;加 dev 构建配置 - 设计见 docs/device-approval.md
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 #13
Adds per-device approval. Instead of a global "allow new registrations" switch, each browser install is approved individually: blocking only new users would not stop someone sending requests with an email that is already registered.
What changes
client_id=<cache_guid>to every sync request URL, so devices are recognised from the firstGET_UPDATES.TRANSIENT_ERROR; the browser keeps retrying and resumes on its own once approved, no restart. When off, devices are recorded and auto-approved, so turning it on later doesn't lock out devices already in use. Rejected devices stay blocked either way.SELFSYNC_ADMIN_ADDR(default127.0.0.1:8081). Server-rendered with askama, no JavaScript, English and Chinese. Shows the device name from syncedDeviceInfoonce a device has synced, else a label parsed from the sync User-Agent (Chrome 141 · Windows).Sec-Fetch-Site, falling back toOriginvsHost); on a loopback bind a non-loopbackHostis refused (DNS rebinding).devicesandsettingstables (new migration, existing ones untouched).lzc-build.dev.ymlto build the image on the box under a separate dev package.Design notes:
docs/device-approval.md.Breaking change
GET /on the sync port is gone; the page moved to the admin port. Docker exposes it as127.0.0.1:8081indocker-compose.yml.Testing
cargo test(48 tests, incl. admission against a real SQLite DB),cargo clippy --all-targets -- -D warnings,cargo fmt --check.Hostget 403.Not yet verified with real browsers:
client_idDeviceInfo🤖 Generated with Claude Code