Skip to content

Revert "Migrate XMOJ-BBS client endpoints to /v1 routes"#974

Closed
boomzero wants to merge 3 commits into
devfrom
revert-969-copilot/change-apis-to-v1-again
Closed

Revert "Migrate XMOJ-BBS client endpoints to /v1 routes"#974
boomzero wants to merge 3 commits into
devfrom
revert-969-copilot/change-apis-to-v1-again

Conversation

@boomzero
Copy link
Copy Markdown
Member

@boomzero boomzero commented Apr 12, 2026

Reverts #969

Summary by Sourcery

Revert the previous migration of XMOJ-BBS client endpoints to /v1 routes and restore the original non-versioned API and asset URLs.

Bug Fixes:

  • Restore compatibility with existing non-versioned XMOJ-BBS API and WebSocket endpoints.
  • Restore image asset URLs to the previous non-/v1 path format.

Build:

  • Revert package and userscript version numbers back to 3.4.2.

Summary by cubic

Reverts the /v1 migration and restores root API, WebSocket, and image paths so requests work with the current backend.

  • Bug Fixes
    • Use https://api.xmoj-bbs.me/ for API and /ws/notifications for WebSocket (no /v1).
    • Use https://assets.xmoj-bbs.me/GetImage?ImageID=... for images (no /v1).
    • Revert local dev URLs to non-/v1.
    • Update messages.html constants to non-/v1 bases.
    • Keep 3.4.3 prerelease and update Update.json metadata (PR 974) to reflect the revert.

Written for commit eb122c8. Summary will update on new commits.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 12, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Reverts the previous migration of XMOJ-BBS client calls to /v1 routes, restoring legacy root (/) API and asset endpoints and rolling back the script/package version number.

Sequence diagram for XMOJ client requests using legacy root API routes

sequenceDiagram
    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 ![](https://assets.xmoj-bbs.me/GetImage?ImageID=ImageID)
        User->>XMOJ_Assets: GET /GetImage?ImageID=ImageID
        XMOJ_Assets-->>User: Image content
    end
Loading

File-Level Changes

Change Details Files
Restore legacy non-/v1 HTTP and WebSocket API endpoints for the XMOJ-BBS backend.
  • Change RequestAPI base URL selection to use https://api.xmoj-bbs.me/ and http://127.0.0.1:8787/ instead of their /v1/ variants.
  • Update notification WebSocket URL construction to drop the /v1 path segment and reconnect to /ws/notifications.
XMOJ.user.js
messages.html
Revert asset service URLs used for embedded images back to non-/v1 paths.
  • Update all Markdown image URL templates to use https://assets.xmoj-bbs.me/GetImage?ImageID=... instead of the /v1/GetImage path.
  • Align the ASSET_BASE constant with the reverted image URL format.
XMOJ.user.js
messages.html
Roll back script/package version metadata to match the pre-migration release.
  • Decrement the userscript @Version field from 3.4.3 to 3.4.2.
  • Revert npm package.json version from 3.4.3 to 3.4.2.
  • Ensure Update.json contents (not fully shown in diff) are consistent with the reverted versioning, if applicable.
XMOJ.user.js
package.json
Update.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@hendragon-bot hendragon-bot Bot added user-script This issue or pull request is related to the main user script website This issue or pull request is related to website related files labels Apr 12, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 12, 2026

Deploying xmoj-script-dev-channel with  Cloudflare Pages  Cloudflare Pages

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

View logs

@pull-request-size pull-request-size Bot added size/S and removed size/M labels Apr 12, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@boomzero boomzero closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S user-script This issue or pull request is related to the main user script website This issue or pull request is related to website related files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant