diff --git a/.github/workflows/UpdateToRelease.yml b/.github/workflows/UpdateToRelease.yml index c66ae438..5f82aa0f 100644 --- a/.github/workflows/UpdateToRelease.yml +++ b/.github/workflows/UpdateToRelease.yml @@ -11,6 +11,8 @@ on: jobs: UpdateToRelease: runs-on: ubuntu-latest + # 添加条件:如果是 bot 触发的则跳过,避免无限循环 + if: github.event.pull_request.user.login != 'github-actions[bot]' permissions: pull-requests: write contents: write @@ -25,7 +27,7 @@ jobs: gh pr comment ${{ github.event.pull_request.number }} --body "请向\`dev\`分支提交pull request, 本pull request将被自动关闭" gh pr close ${{ github.event.pull_request.number }} else - node ./Update/UpdateToRelease.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.number }} "$PR_BODY" + node ./Update/UpdateToRelease.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.pull_request.number }} "$PR_BODY" fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Update.json b/Update.json index b2da406b..1c7bd178 100644 --- a/Update.json +++ b/Update.json @@ -3225,6 +3225,69 @@ } ], "Notes": "No release notes were provided for this release." + }, + "2.6.0": { + "UpdateDate": 1770426020324, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 876, + "Description": "refactor: simplify SubmitLink selection by querying all anchors and finding by text" + }, + { + "PR": 877, + "Description": "fix: problem PID 可能为 null" + }, + { + "PR": 888, + "Description": "Fix AC code export for 5-digit question IDs" + } + ], + "Notes": "No release notes were provided for this release." + }, + "2.6.1": { + "UpdateDate": 1770426401298, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 892, + "Description": "Update to release 2.6.0" + } + ], + "Notes": "No release notes were provided for this release." + }, + "2.7.0": { + "UpdateDate": 1770426883598, + "Prerelease": false, + "UpdateContents": [ + { + "PR": 892, + "Description": "Update to release 2.6.0" + } + ], + "Notes": "No release notes were provided for this release." + }, + "2.7.1": { + "UpdateDate": 1770426896026, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 895, + "Description": "Update to release 2.7.0" + } + ], + "Notes": "No release notes were provided for this release." + }, + "2.7.2": { + "UpdateDate": 1770429143486, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 896, + "Description": "Update to release 2.7.0" + } + ], + "Notes": "No release notes were provided for this release." } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 5c71f748..035aa0e0 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 2.5.3 +// @version 2.7.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen @@ -3008,8 +3008,11 @@ async function main() { let digitMatch = headerLine.match(/\d+/); if (!digitMatch) continue; let CurrentQuestionID = digitMatch[0]; - let newlinePos = CurrentCode.indexOf('\n'); - CurrentCode = CurrentCode.slice(newlinePos + 1); + let bodyStart = lineBreakPos + 1; + if (CurrentCode[lineBreakPos] === '\r' && CurrentCode[lineBreakPos + 1] === '\n') { + bodyStart = lineBreakPos + 2; + } + CurrentCode = CurrentCode.slice(bodyStart); CurrentCode = CurrentCode.replaceAll("\r", ""); Zip.file(CurrentQuestionID + ".cpp", CurrentCode); } diff --git a/package.json b/package.json index 442a5085..d558b7ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "2.5.3", + "version": "2.7.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": {