Conversation
Add config files for Claude Code
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>
Add toggleable Minimalist Monochrome UI
Update to release 3.1.0
Deploying xmoj-script-dev-channel with
|
| Latest commit: |
068092d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://176f61bd.xmoj-script-dev-channel.pages.dev |
There was a problem hiding this comment.
💡 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".
| if (lastCommitAuthor === "github-actions[bot]") { | ||
| console.log("Last commit was made by github-actions[bot]. Skipping to prevent infinite loop."); | ||
| process.exit(0); |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
I know, but not important, and will fix in the next rel
| CreateAndShowBBSMentionToast(notification.data); | ||
| } else if (notification.type === 'mail_mention') { | ||
| // Backend now provides all data needed for immediate display | ||
| CreateAndShowMailMentionToast(notification.data); |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
I know, but not important, and will fix in the next rel
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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>
| if (UtilityEnabled("DebugMode")) { | ||
| console.log("WebSocket: Server confirmed connection at timestamp", notification.timestamp); | ||
| } | ||
| } else if (notification.type === 'bbs_mention') { |
There was a problem hiding this comment.
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>
package.json
Outdated
| { | ||
| "name": "xmoj-script", | ||
| "version": "2.7.2", | ||
| "version": "3.0.0", |
There was a problem hiding this comment.
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>
| console.log("WebSocket: Connecting to", wsUrl); | ||
| } | ||
|
|
||
| NotificationSocket = new WebSocket(wsUrl); |
There was a problem hiding this comment.
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>
By submitting this pull request, I confirm the following:
git rebase)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
Bug Fixes
Written for commit 068092d. Summary will update on new commits.