Skip to content

Revert /v1 endpoint migration#975

Merged
boomzero merged 3 commits into
devfrom
revert/v1-endpoint-migration
Apr 12, 2026
Merged

Revert /v1 endpoint migration#975
boomzero merged 3 commits into
devfrom
revert/v1-endpoint-migration

Conversation

@boomzero
Copy link
Copy Markdown
Member

@boomzero boomzero commented Apr 12, 2026

What does this PR aim to accomplish?:

Reverts the /v1 API route prefix changes introduced in #969, while keeping the version metadata bump to 3.4.3.

How does this PR accomplish the above?:

Removes the /v1/ prefix from all backend API endpoints in XMOJ.user.js and messages.html:

  • RequestAPI URL (line 508)
  • WebSocket notification URL (line 646)
  • 4 image upload asset URLs (lines 5024, 5280, 5453, 5711)
  • API_BASE and ASSET_BASE constants in messages.html

Version metadata (@version 3.4.3, package.json, Update.json) is intentionally preserved.


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributor's guide, as well as this entire template.
  2. I have commented on my proposed changes within the code.
  3. I have tested my changes.
  4. I am willing to help maintain this change if there are issues with it later.
  5. It is compatible with the GNU General Public License v3.0
  6. I have squashed any insignificant commits.
  7. I have checked that another pull request for this purpose does not exist.
  8. I have considered and confirmed that this submission will be valuable to others.
  9. I accept that this submission may not be used, and the pull request can be closed at the will of the maintainer.
  10. I give this submission freely and claim no ownership to its content.
  11. Note: AI cannot verify UI compatibility in both new and classic UI — please verify manually before merging.

  • I have read the above and my PR is ready for review. Check this box to confirm

Summary by Sourcery

Revert the /v1 API and asset URL prefix changes to restore compatibility with the original backend routes while keeping the current version metadata intact.

Bug Fixes:

  • Restore API request and WebSocket notification endpoints to use the original non-versioned base URLs.
  • Update image upload and asset URLs to point back to the non-versioned asset service endpoints.

Summary by cubic

Reverts the /v1 endpoint migration and restores the original API and asset routes. Removes /v1 from API base, WebSocket notifications path, and image asset URLs in XMOJ.user.js and messages.html; updates version to 3.4.4 (userscript and package.json) and adds a 3.4.4 entry in Update.json.

Written for commit 57467ea. Summary will update on new commits.

Reverts the API route changes from #969 that added /v1/ prefixes
to all backend endpoints, while preserving the 3.4.3 version bump.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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 recent /v1 API route prefix migration by restoring all backend and asset URLs to their original paths while keeping the version metadata at 3.4.3.

Sequence diagram for message image upload using restored asset endpoint (sequence)

sequenceDiagram
    actor User
    participant Browser
    participant XMOJScript
    participant APIService
    participant AssetService

    User->>Browser: Select image to upload
    Browser->>XMOJScript: onImageSelected(file)
    XMOJScript->>APIService: POST https://api.xmoj-bbs.me/UploadImage
    APIService-->>XMOJScript: { Success, Data.ImageID }
    XMOJScript->>XMOJScript: Build markdown
    Note over XMOJScript: ![](https://assets.xmoj-bbs.me/GetImage?ImageID=ImageID)
    XMOJScript->>Browser: Update editor content
    User->>Browser: View message with image
    Browser->>AssetService: GET https://assets.xmoj-bbs.me/GetImage?ImageID=ImageID
    AssetService-->>Browser: Image bytes
    Browser-->>User: Render embedded image
Loading

File-Level Changes

Change Details Files
Restore backend API base URLs by removing the /v1 path segment from HTTP and WebSocket endpoints.
  • Update RequestAPI HTTP base URL to drop the /v1/ suffix for both local debug and production API hosts
  • Update notification WebSocket URL to remove the /v1 segment from the path while preserving the /ws/notifications endpoint and SessionID query parameter
XMOJ.user.js
Restore asset image URLs to the non-versioned asset routes.
  • Update all markdown image insertion helpers to use https://assets.xmoj-bbs.me/GetImage without the /v1 path component
  • Ensure the generated image markdown still embeds ImageID via query parameter and dispatches input events as before
XMOJ.user.js
Align messages.html constants with reverted API and asset base URLs. messages.html

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

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

Latest commit: 57467ea
Status:⚡️  Build in progress...

View logs

@pull-request-size pull-request-size Bot added size/M and removed size/S labels Apr 12, 2026
@boomzero boomzero merged commit 4caf55d into dev Apr 12, 2026
4 of 5 checks passed
@boomzero boomzero deleted the revert/v1-endpoint-migration branch April 12, 2026 11:32
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:

  • Since both XMOJ.user.js and messages.html now hardcode the same API and asset base URLs without the /v1 prefix, consider centralizing these base URLs in a single configuration/module to avoid divergence the next time an endpoint prefix or domain changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since both XMOJ.user.js and messages.html now hardcode the same API and asset base URLs without the /v1 prefix, consider centralizing these base URLs in a single configuration/module to avoid divergence the next time an endpoint prefix or domain changes.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M 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