Repository navigation
Conversation
Everything above the api/* client layer lived in one file: server loop, inflight throttling, panic isolation, console auth, the route dispatch, ~30 handlers across every feature domain, state management, HTTP helpers, static assets and 27 tests. Module boundaries existed implicitly; they just had no file boundary. Now, mirroring the layered layout of the other services: - web/mod.rs (317) - serve loop, inflight cap, panic isolation, dispatch - web/console_auth.rs - token check, loopback test, cross-site-write guard - web/http.rs - url decode, body limits, JSON responses - web/assets.rs - index + frontend css/js table (IRmsk#54) - web/state.rs - State/Shared, account book restore, per-account clients - web/routes/{login,run,accounts,records,map_data,meta}.rs - one file per feature domain; /api/me and /api/logout moved out of inline dispatch arms into accounts.rs unchanged Pure code motion: route table, auth checks, throttling and every response body stay byte-identical. All 27 web test modules move with the code they cover; test count is unchanged (27 before, 27 after). Closes IRmsk#55.
Owner
|
看到了,谢谢你另外提的这版。拆分我这边先一步推了 main(b8dbeaf),结构和你这个基本一致, PR 你关掉没问题,这个 issue 我没动。 |
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 #55.
Summary
Splits
src/web/mod.rs(3496 lines) into route and service modules, following the layered layout proposed in the issue:Two things worth calling out:
/api/meand/api/logoutwere inline bodies inside the dispatch arms; they are nowhandle_me/handle_logout_currentinroutes/accounts.rs, bodies unchanged.auth_tokenreadsconfig::global()exactly as Typed TOML config with env override layer for PACE_* switches #57 left it.Equivalence
Pure code motion — the route table, auth checks, throttling, and every response body stay byte-identical:
#[test]modules move with the code they cover; 27 before, 27 after, none dropped.cargo test: 526 lib tests + integration tests green.cargo clippy --all-targets: 0 warnings.cargo fmt --check: clean.GET /200, static assets (/console.css,/js/core.js) 200,/api/healthand/api/accountsresponse envelopes byte-identical to before, unknown routes 404,POST /api/me(GET-only route) still 404.No protocol or behavior surface changes.