xmoj-script 1.1.45 → 1.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ name: Sitemap merge
2
+ on:
3
+ push:
4
+ branches:
5
+ - create-pull-request/patch
6
+ workflow_dispatch:
7
+ jobs:
8
+ create_pull_request:
9
+ name: 'Create PR'
10
+ if: github.ref == 'refs/heads/beta'
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ pull-requests: write
14
+ steps:
15
+ - name: 'Create PR'
16
+ uses: actions/github-script@v6
17
+ with:
18
+ script: |
19
+ const { repo, owner } = context.repo;
20
+ const pulls = await github.rest.pulls.list({
21
+ owner: owner,
22
+ repo: repo,
23
+ head: context.ref,
24
+ base: 'dev',
25
+ state: 'open',
26
+ });
27
+
28
+ if (pulls.data.length < 1) {
29
+ await github.rest.pulls.create({
30
+ title: '[Sitemap] Merge sitemap into dev',
31
+ owner: owner,
32
+ repo: repo,
33
+ head: context.ref,
34
+ base: 'dev',
35
+ body: [
36
+ 'This PR is auto-generated by',
37
+ '[actions/github-script](https://github.com/actions/github-script)',
38
+ ].join('\n'),
39
+ });
40
+ } else {
41
+ const existingPR = pulls.data[0];
42
+ await github.rest.pulls.update({
43
+ owner: owner,
44
+ repo: repo,
45
+ pull_number: existingPR.number,
46
+ body: [
47
+ existingPR.body,
48
+ `Updated by Job ${context.job}`,
49
+ ].join('\n'),
50
+ });
51
+ }
@@ -16,7 +16,7 @@ jobs:
16
16
  fetch-depth: 0
17
17
  - name: Generate new sitemap
18
18
  id: sitemap
19
- uses: cicirello/generate-sitemap@v1.6.1
19
+ uses: cicirello/generate-sitemap@v1.10.0
20
20
  with:
21
21
  additional-extensions: user.js
22
22
  sitemap-format: xml
@@ -11,6 +11,27 @@ const JSONFileName = "./Update.json";
11
11
  const JSFileName = "./XMOJ.user.js";
12
12
  var JSONFileContent = readFileSync(JSONFileName, "utf8");
13
13
  var JSFileContent = readFileSync(JSFileName, "utf8");
14
+ execSync("git config --global user.email \"github-actions[bot]@users.noreply.github.com\"");
15
+ execSync("git config --global user.name \"github-actions[bot]\"");
16
+ if (JSONFileContent.includes('//!ci-no-touch')) {
17
+ var updatedContent = JSONFileContent.replace('//!ci-no-touch', '');
18
+ writeFileSync(JSONFileName, updatedContent, "utf8");
19
+ execSync("git config pull.rebase false");
20
+ execSync("git pull");
21
+ execSync("git push origin --delete actions/temp || true");
22
+ execSync("git checkout -b actions/temp");
23
+ execSync("git commit -a -m \"remove //!ci-no-touch\"");
24
+ execSync("git push -u origin actions/temp -f");
25
+ console.warn("Pushed to actions/temp.");
26
+
27
+ var PRNumber = execSync("gh pr create --title \"Update to release " + CurrentVersion + "\" --body \"Update to release " + CurrentVersion + "\" --base dev --head actions/temp").toString().split("/")[6].trim();
28
+ console.warn("PR #" + PRNumber + " has been created.");
29
+
30
+ execSync("gh pr merge " + PRNumber + " --merge --auto");
31
+ console.warn("PR #" + PRNumber + " has enabled auto merge.");
32
+ console.log('I won\'t touch this. Exiting process.');
33
+ process.exit(0);
34
+ }
14
35
  var JSONObject = JSON.parse(JSONFileContent);
15
36
 
16
37
  var LastJSONVersion = Object.keys(JSONObject.UpdateHistory)[Object.keys(JSONObject.UpdateHistory).length - 1];
@@ -25,24 +46,14 @@ console.log("Last PR : " + LastPR);
25
46
  console.log("Last type : " + LastType);
26
47
  console.log("npm version : " + NpmVersion);
27
48
 
28
- if (JSONFileContent.includes('//ci-no-touch')) {
29
- var updatedContent = JSONFileContent.replace('//ci-no-touch', '');
30
- writeFileSync(JSONFileName, updatedContent, "utf8");
31
- console.log('I won\'t touch this. Exiting process.');
32
- process.exit(0);
33
- }
34
49
  if (LastJSONVersion != LastJSVersion) {
35
50
  console.error("XMOJ.user.js and Update.json have different patch versions.");
36
51
  process.exit(1);
37
52
  }
38
53
  if (LastType == "Release") {
39
54
  console.error("Last release is not a prerelease.");
40
- execSync("gh pr comment " + PRNumber + " --body \"请重新提交PR, 谢谢");
41
- execSync("gh pr close " + PRNumber);
42
- process.exit(1);
55
+ process.exit(0);
43
56
  }
44
- execSync("git config --global user.email \"github-actions[bot]@users.noreply.github.com\"");
45
- execSync("git config --global user.name \"github-actions[bot]\"");
46
57
 
47
58
  if (LastJSVersion != NpmVersion) {
48
59
  console.warn("Assuming you manually ran npm version.");
@@ -11,6 +11,19 @@ const JSONFileName = "./Update.json";
11
11
  const JSFileName = "./XMOJ.user.js";
12
12
  var JSONFileContent = readFileSync(JSONFileName, "utf8");
13
13
  var JSFileContent = readFileSync(JSFileName, "utf8");
14
+ execSync("git config --global user.email \"github-actions[bot]@users.noreply.github.com\"");
15
+ execSync("git config --global user.name \"github-actions[bot]\"");
16
+ if (JSONFileContent.includes('//!ci-no-touch')) {
17
+ var updatedContent = JSONFileContent.replace('//!ci-no-touch', '');
18
+ writeFileSync(JSONFileName, updatedContent, "utf8");
19
+ execSync("git config pull.rebase false");
20
+ execSync("git pull");
21
+ execSync("git commit -a -m \"" + "remove //!ci-no-touch" + "\"");
22
+ execSync("git push -f");
23
+ console.log("Pushed to GitHub.");
24
+ console.log('I won\'t touch this. Exiting process.');
25
+ process.exit(0);
26
+ }
14
27
  var JSONObject = JSON.parse(JSONFileContent);
15
28
 
16
29
  var LastJSONVersion = Object.keys(JSONObject.UpdateHistory)[Object.keys(JSONObject.UpdateHistory).length - 1];
@@ -26,13 +39,6 @@ console.log("Last PR : " + LastPR);
26
39
  console.log("Last description : " + LastDescription);
27
40
  console.log("Last release online: " + LastReleaseVersionOnline);
28
41
  console.log("npm version : " + NpmVersion);
29
-
30
- if (JSONFileContent.includes('//ci-no-touch')) {
31
- var updatedContent = JSONFileContent.replace('//ci-no-touch', '');
32
- writeFileSync(JSONFileName, updatedContent, "utf8");
33
- console.log('I won\'t touch this. Exiting process.');
34
- process.exit(0);
35
- }
36
42
  if (LastJSONVersion != LastJSVersion) {
37
43
  console.error("XMOJ.user.js and Update.json have different patch versions.");
38
44
  process.exit(1);
package/Update.json CHANGED
@@ -1309,6 +1309,40 @@
1309
1309
  }
1310
1310
  ],
1311
1311
  "Notes": "No release notes were provided for this release."
1312
+ },
1313
+ "1.1.46": {
1314
+ "UpdateDate": 1708137046736,
1315
+ "Prerelease": false,
1316
+ "UpdateContents": [
1317
+ {
1318
+ "PR": 445,
1319
+ "Description": "fix [Bug] 右上角用户名点击后无反应 "
1320
+ },
1321
+ {
1322
+ "PR": 447,
1323
+ "Description": "fix the unpkg-cdn option"
1324
+ },
1325
+ {
1326
+ "PR": 449,
1327
+ "Description": "regression!"
1328
+ },
1329
+ {
1330
+ "PR": 454,
1331
+ "Description": "fix #400 + //ci-no-touch"
1332
+ }
1333
+ ],
1334
+ "Notes": "A lot of QoL improvements!"
1335
+ },
1336
+ "1.1.47": {
1337
+ "UpdateDate": 1708774235039,
1338
+ "Prerelease": true,
1339
+ "UpdateContents": [
1340
+ {
1341
+ "PR": 476,
1342
+ "Description": "新增下载项并且允许管理员用户直接获取标程"
1343
+ }
1344
+ ],
1345
+ "Notes": "No release notes were provided for this release."
1312
1346
  }
1313
1347
  }
1314
1348
  }
package/XMOJ.png CHANGED
Binary file
package/XMOJ.user.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // ==UserScript==
2
2
  // @name XMOJ
3
- // @version 1.1.45
3
+ // @version 1.1.47
4
4
  // @description XMOJ增强脚本
5
5
  // @author @XMOJ-Script-dev, @langningchen and the community
6
6
  // @namespace https://github/langningchen
@@ -1631,7 +1631,7 @@ async function main() {
1631
1631
  TempHTML += "</a>";
1632
1632
  if (Points[SolutionID] != undefined) {
1633
1633
  TempHTML += "<span style=\"margin-left: 5px\" class=\"badge text-bg-info\">" + Points[SolutionID] + "</span>";
1634
- if (Points[SolutionID].substring(0, Points[SolutionID].length - 1) >= 50) {
1634
+ if ((Points[SolutionID].substring(0, Points[SolutionID].length - 1) >= 50)||(IsAdmin)) {
1635
1635
  TempHTML += `<a href="https://www.xmoj.tech/showsource.php?pid=${PID}&ByUserScript=1" class="ms-1 link-secondary">查看标程</a>`;
1636
1636
  }
1637
1637
  }
@@ -3412,6 +3412,10 @@ int main()
3412
3412
  "Name": "Visual Studio Code",
3413
3413
  "Image": "https://code.visualstudio.com/favicon.ico",
3414
3414
  "URL": "https://code.visualstudio.com/Download"
3415
+ }, {
3416
+ "Name": "Microsoft Visual Studio",
3417
+ "Image": "https://visualstudio.microsoft.com/wp-content/uploads/2021/10/Product-Icon.svg",
3418
+ "URL": "https://visualstudio.microsoft.com/zh-hans/"
3415
3419
  }, {
3416
3420
  "Name": "Lazarus",
3417
3421
  "Image": "https://a.fsdn.com/allura/p/lazarus/icon",
@@ -3428,6 +3432,14 @@ int main()
3428
3432
  "Name": "VirtualBox",
3429
3433
  "Image": "https://www.virtualbox.org/graphics/vbox_logo2_gradient.png",
3430
3434
  "URL": "https://www.virtualbox.org/wiki/Downloads"
3435
+ }, {
3436
+ "Name": "VMware Workstation Pro",
3437
+ "Image": "https://www.vmware.com/content/dam/digitalmarketing/vmware/en/images/gallery/thumbnails/tn-vmware-workstation-pro.png",
3438
+ "URL": "https://www.vmware.com/go/getworkstation-win"
3439
+ }, {
3440
+ "Name": "VMware Workstation Pro - Product Key",
3441
+ "Image": "https://www.vmware.com/content/dam/digitalmarketing/vmware/en/images/gallery/illustrations/illu-tech-laptop-whtbg.png",
3442
+ "URL": "https://raw.githubusercontent.com/zhouyiqing0304/VMware-Workstation-Pro-Action-Keys/main/README.md"
3431
3443
  }, {
3432
3444
  "Name": "MinGW",
3433
3445
  "Image": "https://www.mingw-w64.org/logo.svg",
@@ -4607,4 +4619,4 @@ int main()
4607
4619
  }
4608
4620
  }
4609
4621
 
4610
- main();
4622
+ main();
package/favicon.ico CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmoj-script",
3
- "version": "1.1.45",
3
+ "version": "1.1.47",
4
4
  "description": "an improvement script for xmoj.tech",
5
5
  "main": "AddonScript.js",
6
6
  "scripts": {