xmoj-script 1.1.46 → 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
+ }
@@ -11,19 +11,6 @@ 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
- var JSONObject = JSON.parse(JSONFileContent);
15
-
16
- var LastJSONVersion = Object.keys(JSONObject.UpdateHistory)[Object.keys(JSONObject.UpdateHistory).length - 1];
17
- var LastJSVersion = JSFileContent.match(/@version\s+(\d+\.\d+\.\d+)/)[1];
18
- var NpmVersion = execSync("jq -r '.version' package.json").toString().trim();
19
- var LastVersion = LastJSVersion.split(".");
20
- var LastPR = JSONObject.UpdateHistory[LastJSONVersion].UpdateContents[0].PR;
21
- var LastType = JSONObject.UpdateHistory[LastJSONVersion].Prerelease ? "Prerelease" : "Release";
22
- console.log("Last JS version : " + LastJSVersion);
23
- console.log("Last JSON version : " + LastJSONVersion);
24
- console.log("Last PR : " + LastPR);
25
- console.log("Last type : " + LastType);
26
- console.log("npm version : " + NpmVersion);
27
14
  execSync("git config --global user.email \"github-actions[bot]@users.noreply.github.com\"");
28
15
  execSync("git config --global user.name \"github-actions[bot]\"");
29
16
  if (JSONFileContent.includes('//!ci-no-touch')) {
@@ -45,15 +32,27 @@ if (JSONFileContent.includes('//!ci-no-touch')) {
45
32
  console.log('I won\'t touch this. Exiting process.');
46
33
  process.exit(0);
47
34
  }
35
+ var JSONObject = JSON.parse(JSONFileContent);
36
+
37
+ var LastJSONVersion = Object.keys(JSONObject.UpdateHistory)[Object.keys(JSONObject.UpdateHistory).length - 1];
38
+ var LastJSVersion = JSFileContent.match(/@version\s+(\d+\.\d+\.\d+)/)[1];
39
+ var NpmVersion = execSync("jq -r '.version' package.json").toString().trim();
40
+ var LastVersion = LastJSVersion.split(".");
41
+ var LastPR = JSONObject.UpdateHistory[LastJSONVersion].UpdateContents[0].PR;
42
+ var LastType = JSONObject.UpdateHistory[LastJSONVersion].Prerelease ? "Prerelease" : "Release";
43
+ console.log("Last JS version : " + LastJSVersion);
44
+ console.log("Last JSON version : " + LastJSONVersion);
45
+ console.log("Last PR : " + LastPR);
46
+ console.log("Last type : " + LastType);
47
+ console.log("npm version : " + NpmVersion);
48
+
48
49
  if (LastJSONVersion != LastJSVersion) {
49
50
  console.error("XMOJ.user.js and Update.json have different patch versions.");
50
51
  process.exit(1);
51
52
  }
52
53
  if (LastType == "Release") {
53
54
  console.error("Last release is not a prerelease.");
54
- execSync("gh pr comment " + PRNumber + " --body \"请重新提交PR, 谢谢");
55
- execSync("gh pr close " + PRNumber);
56
- process.exit(1);
55
+ process.exit(0);
57
56
  }
58
57
 
59
58
  if (LastJSVersion != NpmVersion) {
@@ -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,19 +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
- execSync("git config --global user.email \"github-actions[bot]@users.noreply.github.com\"");
30
- execSync("git config --global user.name \"github-actions[bot]\"");
31
- if (JSONFileContent.includes('//!ci-no-touch')) {
32
- var updatedContent = JSONFileContent.replace('//!ci-no-touch', '');
33
- writeFileSync(JSONFileName, updatedContent, "utf8");
34
- execSync("git config pull.rebase false");
35
- execSync("git pull");
36
- execSync("git commit -a -m \"" + "remove //!ci-no-touch" + "\"");
37
- execSync("git push -f");
38
- console.log("Pushed to GitHub.");
39
- console.log('I won\'t touch this. Exiting process.');
40
- process.exit(0);
41
- }
42
42
  if (LastJSONVersion != LastJSVersion) {
43
43
  console.error("XMOJ.user.js and Update.json have different patch versions.");
44
44
  process.exit(1);
package/Update.json CHANGED
@@ -1331,6 +1331,17 @@
1331
1331
  "Description": "fix #400 + //ci-no-touch"
1332
1332
  }
1333
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
+ ],
1334
1345
  "Notes": "No release notes were provided for this release."
1335
1346
  }
1336
1347
  }
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.46
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.46",
3
+ "version": "1.1.47",
4
4
  "description": "an improvement script for xmoj.tech",
5
5
  "main": "AddonScript.js",
6
6
  "scripts": {