Repository navigation
Add minimal admin SPA for managing redirects - #3
Merged
Merged
Conversation
Serve admin files before endpoint routing, reserve unknown admin paths, and rely on the default-file canonical redirect. Clear the API-key input and cancel stale requests when disconnecting. Add routing regressions and dependency-free UI behavior tests to CI.
There was a problem hiding this comment.
🟡 Changes recommended
Save and Delete can race to recreate a deleted link, with additional unresolved issues affecting alias preservation, list and editor consistency, and text contrast.
5 open issues
1 file not reviewed
src/prod/Indirection/wwwroot/admin/styles.css: Generated file
What changed in this PR
Adds a dependency-free admin UI at /admin/ for managing redirects through the existing API, while retaining API-key protection.
Changes:
- Adds link listing, search, creation, editing, deletion, and copying, with an in-memory API key.
- Serves static assets before endpoint routing and reserves admin paths.
- Adds integration and UI behavior tests, CI execution, and usage documentation.
| File | Description |
|---|---|
src/test/Indirection.Tests/AdminUiTests.cs |
Tests static assets, reserved routes, and API authentication. |
src/test/admin-ui/app.test.cjs |
Tests UI operations, validation, authentication failures, and disconnect races. |
src/prod/Indirection/wwwroot/admin/styles.css |
Adds responsive styling for the admin interface. |
src/prod/Indirection/wwwroot/admin/index.html |
Defines login, link listing, and editor views. |
src/prod/Indirection/wwwroot/admin/app.js |
Implements API access, link management, and session handling. |
src/prod/Indirection/Program.cs |
Enables static-file serving and reserves admin routes. |
README.md |
Documents UI usage, security behavior, and testing. |
.github/workflows/ci.yml |
Runs UI behavior tests in CI. |
Review effort: Balanced
Co-authored-by: Bpoe <8241635+Bpoe@users.noreply.github.com>
Reject superseded loads with AbortError so login and refresh callers cannot apply success effects after disconnect. Preserve existing aliases in previews as well as writes. Cover stale snapshots and errors, concurrent save/delete guards, reopened editor success/failure, and whitespace aliases with focused regression tests.
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
/admin/using vanilla HTML, CSS, and JavaScript to list, search, create, update, delete, and copy links through the existing/api/v1/linksendpoints./adminto/admin/using default-file middleware. Unknown/admin/*paths return 404 instead of resolving redirect aliases.X-Api-Keyprotection on the management API. The page is public static content; the key stays in page memory, is cleared from the input on connection, and is forgotten on refresh/disconnect. Disconnect cancels pending requests and clears rendered link data.Design and deployment
/adminand paths beneath it are reserved for the UI. Production access should use HTTPS.Validation
/admin,/admin/, and the JS/CSS assets successfully; both HTTP deployment tests passed against that instance, including the complete link lifecycle.Scope
Analytics, click metrics, accounts, new management endpoints, frameworks, and a separate frontend build pipeline are omitted.