diff --git a/.github/workflows/UpdateVersion.yml b/.github/workflows/UpdateVersion.yml index 74a49224..6112841f 100644 --- a/.github/workflows/UpdateVersion.yml +++ b/.github/workflows/UpdateVersion.yml @@ -14,7 +14,7 @@ jobs: pull-requests: write contents: write runs-on: ubuntu-latest - if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'github-actions[bot]' + if: github.event.pull_request.head.repo.full_name == github.repository && !endsWith(github.actor, '[bot]') steps: - name: Generate a token id: generate_token @@ -26,4 +26,4 @@ jobs: - name: Update version env: PR_BODY: ${{ github.event.pull_request.body }} - run: node ./Update/UpdateVersion.js ${{ steps.generate_token.outputs.token }} ${{ github.event.number }} "${{ github.event.pull_request.title }}" "$PR_BODY" + run: node ./Update/UpdateVersion.js ${{ steps.generate_token.outputs.token }} ${{ github.event.number }} "${{ github.event.pull_request.title }}" "$PR_BODY" "${{ github.event.action }}" diff --git a/Update.json b/Update.json index a732b808..3cde5c6c 100644 --- a/Update.json +++ b/Update.json @@ -3396,6 +3396,17 @@ } ], "Notes": "Fix contest ranking table colors in dark mode (contestrank-oi.php and contestrank-correct.php)" + }, + "3.2.2": { + "UpdateDate": 1771848993140, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 919, + "Description": "Gate WebSocket toast notifications by per-feature popup settings" + } + ], + "Notes": "Fix WebSocket notification toasts ignoring per-feature popup settings (BBSPopup/MessagePopup)." } } } \ No newline at end of file diff --git a/Update/UpdateVersion.js b/Update/UpdateVersion.js index cd744cd8..891d2c46 100644 --- a/Update/UpdateVersion.js +++ b/Update/UpdateVersion.js @@ -8,9 +8,14 @@ execSync("gh pr checkout " + PRNumber); console.info("PR #" + PRNumber + " has been checked out."); // Check if the last commit was made by github-actions[bot] +// Only skip for synchronize events (push-triggered) to prevent infinite loops. +// For edited events (PR title/body changes), allow metadata updates even when +// the branch tip is a bot commit. +const eventAction = String(process.argv[6] || ""); const lastCommitAuthor = execSync("git log -1 --pretty=format:'%an'").toString().trim(); console.log("Last commit author: " + lastCommitAuthor); -if (lastCommitAuthor === "github-actions[bot]") { +console.log("Event action : " + eventAction); +if (lastCommitAuthor === "github-actions[bot]" && eventAction !== "edited") { console.log("Last commit was made by github-actions[bot]. Skipping to prevent infinite loop."); process.exit(0); } diff --git a/XMOJ.user.js b/XMOJ.user.js index f442f8af..76c959ad 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 3.2.1 +// @version 3.2.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen @@ -650,11 +650,13 @@ function HandleNotificationMessage(event) { 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); + if (UtilityEnabled("BBSPopup")) { + CreateAndShowBBSMentionToast(notification.data); + } } else if (notification.type === 'mail_mention') { - // Backend now provides all data needed for immediate display - CreateAndShowMailMentionToast(notification.data); + if (UtilityEnabled("MessagePopup")) { + CreateAndShowMailMentionToast(notification.data); + } } else if (notification.type === 'pong') { if (UtilityEnabled("DebugMode")) { console.log("WebSocket: Received pong"); diff --git a/package.json b/package.json index 33bff641..48211b03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "3.2.1", + "version": "3.2.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": {