Revert "Migrate XMOJ-BBS client endpoints to /v1 routes"#974
Closed
boomzero wants to merge 3 commits into
Closed
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReverts the previous migration of XMOJ-BBS client calls to Sequence diagram for XMOJ client requests using legacy root API routessequenceDiagram
participant User
participant XMOJ_UserScript
participant XMOJ_API as XMOJ_API_root
participant XMOJ_WS as XMOJ_WebSocket_root
participant XMOJ_Assets as XMOJ_Assets_root
User->>XMOJ_UserScript: Trigger API action
XMOJ_UserScript->>XMOJ_API: POST /Action
XMOJ_API-->>XMOJ_UserScript: JSON response
alt Notifications enabled
User->>XMOJ_UserScript: Open notifications
XMOJ_UserScript->>XMOJ_WS: CONNECT /ws/notifications?SessionID=...
XMOJ_WS-->>XMOJ_UserScript: Notification messages
end
alt Image upload in editor
User->>XMOJ_UserScript: Upload image
XMOJ_UserScript->>XMOJ_API: POST /UploadImage
XMOJ_API-->>XMOJ_UserScript: { Success, Data.ImageID }
XMOJ_UserScript->>User: Insert markdown 
User->>XMOJ_Assets: GET /GetImage?ImageID=ImageID
XMOJ_Assets-->>User: Image content
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Deploying xmoj-script-dev-channel with
|
| Latest commit: |
eb122c8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2d8326b0.xmoj-script-dev-channel.pages.dev |
| Branch Preview URL: | https://revert-969-copilot-change-ap.xmoj-script-dev-channel.pages.dev |
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- There are multiple hardcoded API and asset URL strings in
XMOJ.user.js(e.g., for image upload insertion) that mirror the constants now used inmessages.html; consider centralizing these into shared constants to avoid another large-scale edit if the base paths change again. - The WebSocket URL and HTTP API URL constructions duplicate the same base domains and versioning decisions; extracting a single configuration object for
apiBase,assetBase, andwsBasewould make future migrations between/and/v1(or other versions) less error-prone.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There are multiple hardcoded API and asset URL strings in `XMOJ.user.js` (e.g., for image upload insertion) that mirror the constants now used in `messages.html`; consider centralizing these into shared constants to avoid another large-scale edit if the base paths change again.
- The WebSocket URL and HTTP API URL constructions duplicate the same base domains and versioning decisions; extracting a single configuration object for `apiBase`, `assetBase`, and `wsBase` would make future migrations between `/` and `/v1` (or other versions) less error-prone.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Reverts #969
Summary by Sourcery
Revert the previous migration of XMOJ-BBS client endpoints to
/v1routes and restore the original non-versioned API and asset URLs.Bug Fixes:
/v1path format.Build:
Summary by cubic
Reverts the
/v1migration and restores root API, WebSocket, and image paths so requests work with the current backend.https://api.xmoj-bbs.me/for API and/ws/notificationsfor WebSocket (no/v1).https://assets.xmoj-bbs.me/GetImage?ImageID=...for images (no/v1)./v1.messages.htmlconstants to non-/v1bases.Update.jsonmetadata (PR 974) to reflect the revert.Written for commit eb122c8. Summary will update on new commits.