Skip to content

Release!#908

Merged
boomzero merged 35 commits intomasterfrom
dev
Feb 16, 2026
Merged

Release!#908
boomzero merged 35 commits intomasterfrom
dev

Conversation

@boomzero
Copy link
Member

@boomzero boomzero commented Feb 16, 2026


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. I understand which branch to base my commits and Pull Requests against.
  2. I have commented on my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the GNU General Public License v3.0
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request can be closed at the will of the maintainer.
  9. I give this submission freely and claim no ownership to its content.

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

Summary by cubic

Releases v3.1.0 to dev with real-time WebSocket notifications for BBS/mail mentions and the optional Minimalist Monochrome UI. Adds reliability improvements and UI polish.

  • New Features

    • Notifications: persistent WebSocket with auto-reconnect, ping/pong, and a 60s polling fallback when disconnected. Toasts render instantly using backend-supplied fields.
    • Minimalist Monochrome UI: serif typography, zero-radius, faster animations, centered tables, and dark mode. Navbar/overlay styles gated by the toggle; fonts load via a China CDN.
  • Bug Fixes

    • Prevent CI loops by skipping UpdateVersion when the last commit is from github-actions[bot].
    • Harden notifications: fix reconnect race, escape HTML to prevent XSS, preserve toast DOM, and clear the toast container once to avoid duplicates.
    • UI tweaks: replace loader.gif with Bootstrap spinner, use text labels for STD status, and skip UploadStd when the Std list fetch fails.

Written for commit 068092d. Summary will update on new commits.

boomzero and others added 30 commits February 10, 2026 15:10
Replaces focus-based polling with persistent WebSocket connection to the backend notification service. Notifications now arrive within 1-2 seconds with automatic reconnection and exponential backoff. Maintains polling as fallback for reliability when WebSocket is unavailable.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The backend now includes all required fields (PostTitle, PageNumber, MentionID) in WebSocket notifications, eliminating the need for additional API calls to fetch mention details. This reduces latency and server load for real-time notifications.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…issues

1. Race condition (P1): Store reconnect timer ID to prevent duplicate WebSocket connections when visibilitychange handler and delayed reconnect fire simultaneously

2. XSS vulnerability (P1): Sanitize user-supplied PostTitle with escapeHTML() before rendering to prevent script injection attacks

3. DOM destruction (P2): Replace innerHTML += with appendChild to preserve async GetUsernameHTML() results in mail mention toasts

Note: Mail mention matching issue (violation #2) was already resolved by previous commit that passes notification.data directly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ns[bot]

This prevents infinite loops where the bot commits version updates,
which triggers the workflow again, causing another commit.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
New "极简黑白界面风格" option under Beautify settings that overhauls
the visual design with a monochrome palette, serif typography
(Playfair Display + Source Serif 4), zero border-radius, and
line-based visual structure.

Key changes:
- Comprehensive monochrome CSS with dark mode support (charcoal bg)
- CSS variables for automatic light/dark theme switching
- Sharp-cornered cards, modals, toasts with inverted headers
- Monochrome buttons with filled primary / outlined secondary
- Colored status buttons preserved (success/danger/warning/info)
- Faster animations (100ms) and dropdown transitions
- Problem switcher with solid bg, hidden on narrow screens
- Copy button visibility fix in inverted headers
- Image containment (max-width: 100%)
- Table cell center alignment
- Non-blocking status page fetches to reduce layout shift
- Font loading via <link> element to avoid FOUC
- Fully toggleable: disabling reverts to original Bootstrap styles

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…j-code-navigator agent

- Emphasize the importance of using xmoj-code-navigator for exploring, searching, and understanding XMOJ.user.js
- Provide guidelines on when and how to use the xmoj-code-navigator agent
- Explain the benefits of using the agent over loading the entire file
- Replace std status emojis with text labels ([STD]/[OK]/[ERR])
- Replace loader.gif with Bootstrap spinner
- Add table margin-top for spacing from elements above
- Use bare element selectors for table header styling
- Fix table cell text-align center
- Soften dark mode colors (charcoal #1a1a1a bg, #e5e5e5 text)
- Fix copy button visibility in inverted headers
- Hide problem switcher on narrow screens
- Differentiate btn-primary (filled) from btn-secondary (outlined)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Navbar applyStyles now conditionally applies monochrome (flat, full-width)
  or original (rounded, margin) styles based on MonochromeUI setting
- Fixes inconsistency where createOverlay assumed rounded corners but
  navbar was always flat
- Switch Google Fonts CDN from fonts.googleapis.com to fonts.loli.net
  for China accessibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When GetStdList returns Success: false, StdList remains null. Previously
this fell through to the else branch, triggering redundant UploadStd
requests for already-uploaded problems. Now the entire upload block is
skipped when StdList is null.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hendragon-bot hendragon-bot bot added user-script This issue or pull request is related to the main user script update-script Related to our update infrastructure! labels Feb 16, 2026
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 16, 2026

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

Latest commit: 068092d
Status: ✅  Deploy successful!
Preview URL: https://176f61bd.xmoj-script-dev-channel.pages.dev

View logs

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c31dceda90

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +13 to +15
if (lastCommitAuthor === "github-actions[bot]") {
console.log("Last commit was made by github-actions[bot]. Skipping to prevent infinite loop.");
process.exit(0);

Choose a reason for hiding this comment

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

P2 Badge Allow metadata updates after initial bot version commit

The UpdateVersion workflow is already guarded against bot-triggered loops by if: ... github.actor != 'github-actions[bot]' in .github/workflows/UpdateVersion.yml, but this additional last-commit-author check exits whenever the PR branch tip is authored by the bot. That means after the first automated version bump commit, later human pull_request.edited runs (used to adjust PR title/body release notes) immediately process.exit(0), so Update.json description/notes timestamps stop updating even though the workflow was intentionally triggered.

Useful? React with 👍 / 👎.

Copy link
Member Author

Choose a reason for hiding this comment

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

I know, but not important, and will fix in the next rel

Comment on lines +654 to +657
CreateAndShowBBSMentionToast(notification.data);
} else if (notification.type === 'mail_mention') {
// Backend now provides all data needed for immediate display
CreateAndShowMailMentionToast(notification.data);

Choose a reason for hiding this comment

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

P2 Badge Gate WebSocket toast types by per-feature popup settings

When the socket is connected, notification events are rendered unconditionally: bbs_mention and mail_mention both call toast builders without checking UtilityEnabled("BBSPopup") / UtilityEnabled("MessagePopup"). In practice this causes users who disabled one reminder type to still receive that toast type whenever the backend emits it, while the polling fallback respects the toggles, so behavior changes incorrectly based on connection state.

Useful? React with 👍 / 👎.

Copy link
Member Author

Choose a reason for hiding this comment

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

I know, but not important, and will fix in the next rel

Copy link

@cubic-dev-ai cubic-dev-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.

4 issues found across 10 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="XMOJ.user.js">

<violation number="1" location="XMOJ.user.js:577">
P2: WebSocket resource leak: `ConnectNotificationSocket` does not close the existing WebSocket before creating a new one. The old socket's `onclose` handler will still fire and call `ReconnectNotificationSocket()`, potentially creating duplicate connections. Close the existing socket first and remove its event handlers to prevent the stale `onclose` from triggering reconnection logic.</violation>

<violation number="2" location="XMOJ.user.js:652">
P2: WebSocket notification handler does not respect user preferences. The `bbs_mention` handler should check `UtilityEnabled("BBSPopup")` before showing the toast, matching the behavior of the polling fallback. Currently, users who disabled BBS notifications will still receive them when connected via WebSocket.</violation>

<violation number="3" location="XMOJ.user.js:655">
P2: WebSocket notification handler does not respect user preferences. The `mail_mention` handler should check `UtilityEnabled("MessagePopup")` before showing the toast, matching the behavior of the polling fallback. Currently, users who disabled mail notifications will still receive them when connected via WebSocket.</violation>
</file>

<file name="package.json">

<violation number="1" location="package.json:3">
P2: Version numbers are managed by the automated UpdateVersion workflow; manual edits to package.json violate the repo’s release process and can desync version tracking. Revert this change and let the automation bump versions.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

} else if (notification.type === 'bbs_mention') {
// Backend now provides all data needed for immediate display
CreateAndShowBBSMentionToast(notification.data);
} else if (notification.type === 'mail_mention') {
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 16, 2026

Choose a reason for hiding this comment

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

P2: WebSocket notification handler does not respect user preferences. The mail_mention handler should check UtilityEnabled("MessagePopup") before showing the toast, matching the behavior of the polling fallback. Currently, users who disabled mail notifications will still receive them when connected via WebSocket.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At XMOJ.user.js, line 655:

<comment>WebSocket notification handler does not respect user preferences. The `mail_mention` handler should check `UtilityEnabled("MessagePopup")` before showing the toast, matching the behavior of the polling fallback. Currently, users who disabled mail notifications will still receive them when connected via WebSocket.</comment>

<file context>
@@ -533,6 +533,287 @@ let RequestAPI = (Action, Data, CallBack) => {
+        } else if (notification.type === 'bbs_mention') {
+            // Backend now provides all data needed for immediate display
+            CreateAndShowBBSMentionToast(notification.data);
+        } else if (notification.type === 'mail_mention') {
+            // Backend now provides all data needed for immediate display
+            CreateAndShowMailMentionToast(notification.data);
</file context>
Fix with Cubic

if (UtilityEnabled("DebugMode")) {
console.log("WebSocket: Server confirmed connection at timestamp", notification.timestamp);
}
} else if (notification.type === 'bbs_mention') {
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 16, 2026

Choose a reason for hiding this comment

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

P2: WebSocket notification handler does not respect user preferences. The bbs_mention handler should check UtilityEnabled("BBSPopup") before showing the toast, matching the behavior of the polling fallback. Currently, users who disabled BBS notifications will still receive them when connected via WebSocket.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At XMOJ.user.js, line 652:

<comment>WebSocket notification handler does not respect user preferences. The `bbs_mention` handler should check `UtilityEnabled("BBSPopup")` before showing the toast, matching the behavior of the polling fallback. Currently, users who disabled BBS notifications will still receive them when connected via WebSocket.</comment>

<file context>
@@ -533,6 +533,287 @@ let RequestAPI = (Action, Data, CallBack) => {
+            if (UtilityEnabled("DebugMode")) {
+                console.log("WebSocket: Server confirmed connection at timestamp", notification.timestamp);
+            }
+        } else if (notification.type === 'bbs_mention') {
+            // Backend now provides all data needed for immediate display
+            CreateAndShowBBSMentionToast(notification.data);
</file context>
Fix with Cubic

package.json Outdated
{
"name": "xmoj-script",
"version": "2.7.2",
"version": "3.0.0",
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 16, 2026

Choose a reason for hiding this comment

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

P2: Version numbers are managed by the automated UpdateVersion workflow; manual edits to package.json violate the repo’s release process and can desync version tracking. Revert this change and let the automation bump versions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 3:

<comment>Version numbers are managed by the automated UpdateVersion workflow; manual edits to package.json violate the repo’s release process and can desync version tracking. Revert this change and let the automation bump versions.</comment>

<file context>
@@ -1,6 +1,6 @@
 {
   "name": "xmoj-script",
-  "version": "2.7.2",
+  "version": "3.0.0",
   "description": "an improvement script for xmoj.tech",
   "main": "AddonScript.js",
</file context>
Fix with Cubic

console.log("WebSocket: Connecting to", wsUrl);
}

NotificationSocket = new WebSocket(wsUrl);
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 16, 2026

Choose a reason for hiding this comment

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

P2: WebSocket resource leak: ConnectNotificationSocket does not close the existing WebSocket before creating a new one. The old socket's onclose handler will still fire and call ReconnectNotificationSocket(), potentially creating duplicate connections. Close the existing socket first and remove its event handlers to prevent the stale onclose from triggering reconnection logic.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At XMOJ.user.js, line 577:

<comment>WebSocket resource leak: `ConnectNotificationSocket` does not close the existing WebSocket before creating a new one. The old socket's `onclose` handler will still fire and call `ReconnectNotificationSocket()`, potentially creating duplicate connections. Close the existing socket first and remove its event handlers to prevent the stale `onclose` from triggering reconnection logic.</comment>

<file context>
@@ -533,6 +533,287 @@ let RequestAPI = (Action, Data, CallBack) => {
+            console.log("WebSocket: Connecting to", wsUrl);
+        }
+
+        NotificationSocket = new WebSocket(wsUrl);
+
+        NotificationSocket.onopen = () => {
</file context>
Fix with Cubic

@boomzero boomzero merged commit 4a671fc into master Feb 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL update-script Related to our update infrastructure! user-script This issue or pull request is related to the main user script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant