From dd92fcc4d814a746f90adbab22416ca4561c13f1 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 20:02:17 +0800 Subject: [PATCH 01/14] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E6=B5=8B=E8=AF=95=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app-test.yml | 196 +++++++++++++++++++++++++++ README.md | 8 +- 2 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-app-test.yml diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml new file mode 100644 index 0000000..93184c0 --- /dev/null +++ b/.github/workflows/build-app-test.yml @@ -0,0 +1,196 @@ +# AUTO_MAA:A MAA Multi Account Management and Automation Tool +# Copyright © 2024-2025 DLmaster361 + +# This file is part of AUTO_MAA. + +# AUTO_MAA is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. + +# AUTO_MAA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with AUTO_MAA. If not, see . + +# Contact: DLmaster_361@163.com + +name: Build AUTO_MAA Test + +on: + workflow_dispatch: + +permissions: + contents: write + actions: write + +jobs: + + pre_check: + name: Pre Checks + runs-on: ubuntu-latest + + steps: + - name: Repo Check + id: repo_check + run: | + if [[ "$GITHUB_REPOSITORY" != "DLmaster361/AUTO_MAA" ]]; then + echo "When forking this repository to make your own builds, you have to adjust this check." + exit 1 + fi + exit 0 + + build_AUTO_MAA: + runs-on: windows-latest + needs: pre_check + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + pip install -r requirements.txt + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Get version + id: get_version + run: | + $version = (Get-Content resources/version.json | ConvertFrom-Json).main_version + echo "main_version=$version" >> $env:GITHUB_OUTPUT + + - name: Nuitka build main program + uses: Nuitka/Nuitka-Action@main + with: + script-name: main.py + mode: app + enable-plugins: pyside6 + onefile-tempdir-spec: "{TEMP}/AUTO_MAA" + windows-console-mode: disable + windows-icon-from-ico: resources/icons/AUTO_MAA.ico + company-name: AUTO_MAA Team + product-name: AUTO_MAA + file-version: ${{ steps.get_version.outputs.main_version }} + product-version: ${{ steps.get_version.outputs.main_version }} + file-description: AUTO_MAA Component + copyright: Copyright © 2024-2025 DLmaster361 + assume-yes-for-downloads: true + output-file: AUTO_MAA + output-dir: AUTO_MAA + + - name: Upload unsigned artifact + id: upload-unsigned-artifact + uses: actions/upload-artifact@v4 + with: + path: AUTO_MAA/AUTO_MAA.exe + + - name: Sign main program + id: sign_main_program + uses: signpath/github-action-submit-signing-request@v1.2 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' + project-slug: 'AUTO_MAA_Test' + signing-policy-slug: 'test-signing' + artifact-configuration-slug: "single-exe" + github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'AUTO_MAA' + + - name: Add resources to AUTO_MAA directory + shell: pwsh + run: | + $root = "${{ github.workspace }}" + $ver = "${{ steps.get_version.outputs.main_version }}" + Copy-Item "$root/app" "$root/AUTO_MAA/app" -Recurse + Copy-Item "$root/resources" "$root/AUTO_MAA/resources" -Recurse + Copy-Item "$root/main.py" "$root/AUTO_MAA/" + Copy-Item "$root/requirements.txt" "$root/AUTO_MAA/" + Copy-Item "$root/README.md" "$root/AUTO_MAA/" + Copy-Item "$root/LICENSE" "$root/AUTO_MAA/" + + - name: Create Inno Setup script + shell: pwsh + run: | + $root = "${{ github.workspace }}" + $ver = "${{ steps.get_version.outputs.main_version }}" + $iss = Get-Content "$root/app/utils/AUTO_MAA.iss" -Raw + $iss = $iss -replace '#define MyAppVersion ""', "#define MyAppVersion `"$ver`"" + $iss = $iss -replace '#define MyAppPath ""', "#define MyAppPath `"$root/AUTO_MAA`"" + $iss = $iss -replace '#define OutputDir ""', "#define OutputDir `"$root`"" + Set-Content -Path "$root/AUTO_MAA.iss" -Value $iss + + - name: Build setup program + uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 + with: + path: AUTO_MAA.iss + + - name: Compress setup exe + shell: pwsh + run: | + $root = "${{ github.workspace }}" + New-Item -ItemType Directory -Force -Path "$root/AUTO_MAA_Setup" + Move-Item "$root/AUTO_MAA-Setup.exe" "$root/AUTO_MAA_Setup/" + Compress-Archive -Path AUTO_MAA_Setup/* -DestinationPath AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip + + - name: Generate version info + shell: python + run: | + import json + from pathlib import Path + def version_text(version_numb): + while len(version_numb) < 4: + version_numb.append(0) + if version_numb[3] == 0: + return f"v{'.'.join(str(_) for _ in version_numb[0:3])}" + else: + return f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}" + def version_info_markdown(info): + version_info = "" + for key, value in info.items(): + version_info += f"## {key}\n" + for v in value: + version_info += f"- {v}\n" + return version_info + root_path = Path(".") + version = json.loads((root_path / "resources/version.json").read_text(encoding="utf-8")) + main_version_numb = list(map(int, version["main_version"].split("."))) + all_version_info = {} + for v_i in version["version_info"].values(): + for key, value in v_i.items(): + if key in all_version_info: + all_version_info[key] += value.copy() + else: + all_version_info[key] = value.copy() + (root_path / "version_info.txt").write_text( + f"{version_text(main_version_numb)}\n\n\n{version_info_markdown(all_version_info)}", + encoding="utf-8", + ) + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: AUTO_MAA_${{ steps.get_version.outputs.main_version }} + path: AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip + + - name: Upload Version_Info Artifact + uses: actions/upload-artifact@v4 + with: + name: version_info + path: version_info.txt \ No newline at end of file diff --git a/README.md b/README.md index aa5331d..e8343ed 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,12 @@ 可在[《AUTO_MAA开发者协作文档》](https://docs.qq.com/aio/DQ3Z5eHNxdmxFQmZX)的`开发任务`页面中查看开发进度。 +## 特别鸣谢 + +- 下载服务器:由[AoXuan (@ClozyA)](https://github.com/ClozyA) 个人为项目赞助。 + +- EXE签名: Free code signing provided by [SignPath.io](https://signpath.io/), certificate by [SignPath Foundation](https://signpath.org/) + ## 贡献者 感谢以下贡献者对本项目做出的贡献 @@ -87,8 +93,6 @@ ![Alt](https://repobeats.axiom.co/api/embed/6c2f834141eff1ac297db70d12bd11c6236a58a5.svg "Repobeats analytics image") -感谢 [AoXuan (@ClozyA)](https://github.com/ClozyA) 为本项目提供的下载服务器 - ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=DLmaster361/AUTO_MAA&type=Date)](https://star-history.com/#DLmaster361/AUTO_MAA&Date) From 8a438b041f60c8b35aef6c1eada8b4f52b26e96b Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 21:09:03 +0800 Subject: [PATCH 02/14] =?UTF-8?q?ci:=20=E4=BF=AE=E6=AD=A3signpath=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml index 93184c0..0715fcb 100644 --- a/.github/workflows/build-app-test.yml +++ b/.github/workflows/build-app-test.yml @@ -106,14 +106,14 @@ jobs: with: api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' - project-slug: 'AUTO_MAA_Test' + project-slug: 'AUTO_MAA_' signing-policy-slug: 'test-signing' artifact-configuration-slug: "single-exe" github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' wait-for-completion: true output-artifact-directory: 'AUTO_MAA' - - name: Add resources to AUTO_MAA directory + - name: Add other resources shell: pwsh run: | $root = "${{ github.workspace }}" From 2271b5741d4d489fe034051124121806fcb7953e Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 22:08:41 +0800 Subject: [PATCH 03/14] =?UTF-8?q?ci:=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml index 0715fcb..8fc5a21 100644 --- a/.github/workflows/build-app-test.yml +++ b/.github/workflows/build-app-test.yml @@ -108,7 +108,6 @@ jobs: organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' project-slug: 'AUTO_MAA_' signing-policy-slug: 'test-signing' - artifact-configuration-slug: "single-exe" github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' wait-for-completion: true output-artifact-directory: 'AUTO_MAA' From 0b6cc59de1413cb5273583631594cabba5a1fb8f Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 22:38:24 +0800 Subject: [PATCH 04/14] =?UTF-8?q?ci:=20=E6=9E=84=E5=BB=BA=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=B5=8B=E8=AF=95=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app-test.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml index 8fc5a21..a3e0c34 100644 --- a/.github/workflows/build-app-test.yml +++ b/.github/workflows/build-app-test.yml @@ -94,24 +94,6 @@ jobs: output-file: AUTO_MAA output-dir: AUTO_MAA - - name: Upload unsigned artifact - id: upload-unsigned-artifact - uses: actions/upload-artifact@v4 - with: - path: AUTO_MAA/AUTO_MAA.exe - - - name: Sign main program - id: sign_main_program - uses: signpath/github-action-submit-signing-request@v1.2 - with: - api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' - organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' - project-slug: 'AUTO_MAA_' - signing-policy-slug: 'test-signing' - github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' - wait-for-completion: true - output-artifact-directory: 'AUTO_MAA' - - name: Add other resources shell: pwsh run: | From 954c25090bb88e35d5909a25a72e1e22102709d7 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 23:25:08 +0800 Subject: [PATCH 05/14] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/1.yml | 44 ++++++++++++++++++++++++++++ .github/workflows/build-app-test.yml | 19 ++++++++++++ AUTO_MAA/AUTO_MAA.exe | 0 3 files changed, 63 insertions(+) create mode 100644 .github/workflows/1.yml create mode 100644 AUTO_MAA/AUTO_MAA.exe diff --git a/.github/workflows/1.yml b/.github/workflows/1.yml new file mode 100644 index 0000000..e74e4d9 --- /dev/null +++ b/.github/workflows/1.yml @@ -0,0 +1,44 @@ +# AUTO_MAA:A MAA Multi Account Management and Automation Tool +# Copyright © 2024-2025 DLmaster361 + +# This file is part of AUTO_MAA. + +# AUTO_MAA is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. + +# AUTO_MAA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with AUTO_MAA. If not, see . + +# Contact: DLmaster_361@163.com + +name: Build AUTO_MAA Test + +on: + workflow_dispatch: + +permissions: + contents: write + actions: write + +jobs: + + build_AUTO_MAA: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Upload unsigned artifact + id: upload-unsigned-artifact + uses: actions/upload-artifact@v4 + with: + name: AUTO_MAA + path: AUTO_MAA/AUTO_MAA.exe \ No newline at end of file diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml index a3e0c34..4626f64 100644 --- a/.github/workflows/build-app-test.yml +++ b/.github/workflows/build-app-test.yml @@ -94,6 +94,25 @@ jobs: output-file: AUTO_MAA output-dir: AUTO_MAA + - name: Upload unsigned artifact + id: upload-unsigned-artifact + uses: actions/upload-artifact@v4 + with: + name: AUTO_MAA + path: AUTO_MAA/AUTO_MAA.exe + + - name: Sign main program + id: sign_main_program + uses: signpath/github-action-submit-signing-request@v1.2 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' + project-slug: 'AUTO_MAA_' + signing-policy-slug: 'test-signing' + github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'AUTO_MAA' + - name: Add other resources shell: pwsh run: | diff --git a/AUTO_MAA/AUTO_MAA.exe b/AUTO_MAA/AUTO_MAA.exe new file mode 100644 index 0000000..e69de29 From ddbb5b7f194da5a16b7b0393f843a397cc58d654 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 23:25:48 +0800 Subject: [PATCH 06/14] =?UTF-8?q?ci:=20=E5=90=8D=E5=AD=97=E4=BD=9C?= =?UTF-8?q?=E5=87=BA=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/1.yml b/.github/workflows/1.yml index e74e4d9..01d7524 100644 --- a/.github/workflows/1.yml +++ b/.github/workflows/1.yml @@ -18,7 +18,7 @@ # Contact: DLmaster_361@163.com -name: Build AUTO_MAA Test +name: Build AUTO_MAA Test b on: workflow_dispatch: From d2dc0bd295df01ba373d62eb9b7fe54fc94c28bc Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 23:28:15 +0800 Subject: [PATCH 07/14] =?UTF-8?q?ci:=20=E4=B8=8A=E4=BC=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=B9=8B=E4=BA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/1.yml | 2 +- AUTO_MAA/AUTO_MAA.exe => AUTO_MAA.exe | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename AUTO_MAA/AUTO_MAA.exe => AUTO_MAA.exe (100%) diff --git a/.github/workflows/1.yml b/.github/workflows/1.yml index 01d7524..c2c0f0d 100644 --- a/.github/workflows/1.yml +++ b/.github/workflows/1.yml @@ -41,4 +41,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: AUTO_MAA - path: AUTO_MAA/AUTO_MAA.exe \ No newline at end of file + path: AUTO_MAA.exe \ No newline at end of file diff --git a/AUTO_MAA/AUTO_MAA.exe b/AUTO_MAA.exe similarity index 100% rename from AUTO_MAA/AUTO_MAA.exe rename to AUTO_MAA.exe From c009f0c891e41203c165d4414a2fd9097bd4e6cf Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 23:39:09 +0800 Subject: [PATCH 08/14] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/1.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/1.yml b/.github/workflows/1.yml index c2c0f0d..a20cce4 100644 --- a/.github/workflows/1.yml +++ b/.github/workflows/1.yml @@ -41,4 +41,17 @@ jobs: uses: actions/upload-artifact@v4 with: name: AUTO_MAA - path: AUTO_MAA.exe \ No newline at end of file + path: AUTO_MAA.exe + + - name: Sign main program + id: sign_main_program + uses: signpath/github-action-submit-signing-request@v1.2 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' + project-slug: 'AUTO_MAA_' + signing-policy-slug: 'test-signing' + artifact-configuration-slug: "single-exe" + github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'AUTO_MAA' From b04ac4eec6e56bf443532131902113f676526d6d Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Thu, 5 Jun 2025 23:50:56 +0800 Subject: [PATCH 09/14] =?UTF-8?q?ci:=20=E4=BD=BF=E7=94=A8=E9=A2=84?= =?UTF-8?q?=E8=AE=BE=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/1.yml b/.github/workflows/1.yml index a20cce4..450e2f4 100644 --- a/.github/workflows/1.yml +++ b/.github/workflows/1.yml @@ -51,7 +51,7 @@ jobs: organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' project-slug: 'AUTO_MAA_' signing-policy-slug: 'test-signing' - artifact-configuration-slug: "single-exe" + artifact-configuration-slug: "AUTO_MAA" github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' wait-for-completion: true output-artifact-directory: 'AUTO_MAA' From 18dfdba15dd517770afd36e2d491c0ad494a96f1 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Fri, 6 Jun 2025 00:09:01 +0800 Subject: [PATCH 10/14] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/1.yml | 57 ---------------------------- .github/workflows/build-app-test.yml | 33 ++++++++++++---- AUTO_MAA.exe | 0 3 files changed, 25 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/1.yml delete mode 100644 AUTO_MAA.exe diff --git a/.github/workflows/1.yml b/.github/workflows/1.yml deleted file mode 100644 index 450e2f4..0000000 --- a/.github/workflows/1.yml +++ /dev/null @@ -1,57 +0,0 @@ -# AUTO_MAA:A MAA Multi Account Management and Automation Tool -# Copyright © 2024-2025 DLmaster361 - -# This file is part of AUTO_MAA. - -# AUTO_MAA is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published -# by the Free Software Foundation, either version 3 of the License, -# or (at your option) any later version. - -# AUTO_MAA is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -# the GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with AUTO_MAA. If not, see . - -# Contact: DLmaster_361@163.com - -name: Build AUTO_MAA Test b - -on: - workflow_dispatch: - -permissions: - contents: write - actions: write - -jobs: - - build_AUTO_MAA: - runs-on: windows-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Upload unsigned artifact - id: upload-unsigned-artifact - uses: actions/upload-artifact@v4 - with: - name: AUTO_MAA - path: AUTO_MAA.exe - - - name: Sign main program - id: sign_main_program - uses: signpath/github-action-submit-signing-request@v1.2 - with: - api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' - organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' - project-slug: 'AUTO_MAA_' - signing-policy-slug: 'test-signing' - artifact-configuration-slug: "AUTO_MAA" - github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' - wait-for-completion: true - output-artifact-directory: 'AUTO_MAA' diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml index 4626f64..8dbeee0 100644 --- a/.github/workflows/build-app-test.yml +++ b/.github/workflows/build-app-test.yml @@ -94,8 +94,8 @@ jobs: output-file: AUTO_MAA output-dir: AUTO_MAA - - name: Upload unsigned artifact - id: upload-unsigned-artifact + - name: Upload unsigned main program + id: upload-unsigned-main-program uses: actions/upload-artifact@v4 with: name: AUTO_MAA @@ -109,7 +109,8 @@ jobs: organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' project-slug: 'AUTO_MAA_' signing-policy-slug: 'test-signing' - github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}' + artifact-configuration-slug: "AUTO_MAA" + github-artifact-id: '${{ steps.upload-unsigned-main-program.outputs.artifact-id }}' wait-for-completion: true output-artifact-directory: 'AUTO_MAA' @@ -141,13 +142,29 @@ jobs: with: path: AUTO_MAA.iss + - name: Upload unsigned setup program + id: upload-unsigned-setup-program + uses: actions/upload-artifact@v4 + with: + name: AUTO_MAA-Setup + path: AUTO_MAA-Setup.exe + + - name: Sign setup program + id: sign_setup_program + uses: signpath/github-action-submit-signing-request@v1.2 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' + project-slug: 'AUTO_MAA_' + signing-policy-slug: 'test-signing' + artifact-configuration-slug: "AUTO_MAA-Setup" + github-artifact-id: '${{ steps.upload-unsigned-setup-program.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'AUTO_MAA_Setup' + - name: Compress setup exe shell: pwsh - run: | - $root = "${{ github.workspace }}" - New-Item -ItemType Directory -Force -Path "$root/AUTO_MAA_Setup" - Move-Item "$root/AUTO_MAA-Setup.exe" "$root/AUTO_MAA_Setup/" - Compress-Archive -Path AUTO_MAA_Setup/* -DestinationPath AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip + run: Compress-Archive -Path AUTO_MAA_Setup/* -DestinationPath AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip - name: Generate version info shell: python diff --git a/AUTO_MAA.exe b/AUTO_MAA.exe deleted file mode 100644 index e69de29..0000000 From 1cc242fa517baecddf67fe791f88f45c5ecb162d Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Fri, 6 Jun 2025 22:38:37 +0800 Subject: [PATCH 11/14] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=99=A8=E6=B5=8B=E9=80=9F=E4=B8=AD=E6=AD=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/downloader.py | 13 +++++++++++++ resources/version.json | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/ui/downloader.py b/app/ui/downloader.py index bfb1dca..9d4d12e 100644 --- a/app/ui/downloader.py +++ b/app/ui/downloader.py @@ -25,6 +25,7 @@ v4.3 作者:DLmaster_361 """ +from loguru import logger import zipfile import requests import subprocess @@ -86,6 +87,7 @@ class DownloadProcess(QThread): self.download_path = download_path self.check_times = check_times + @logger.catch def run(self) -> None: # 清理可能存在的临时文件 @@ -165,6 +167,7 @@ class ZipExtractProcess(QThread): self.app_path = app_path self.download_path = download_path + @logger.catch def run(self) -> None: try: @@ -238,6 +241,7 @@ class DownloadManager(QDialog): self.download_path = app_path / "DOWNLOAD_TEMP.zip" # 临时下载文件的路径 self.download_process_dict: Dict[str, DownloadProcess] = {} self.timer_dict: Dict[str, QTimer] = {} + self.if_speed_test_accomplish = False self.resize(700, 70) @@ -409,6 +413,15 @@ class DownloadManager(QDialog): if not self.download_process_dict: self.download_process_clear.emit() + # 当有速度大于1 MB/s的链接或存在3个即以上链接测速完成时,停止其他测速 + if not self.if_speed_test_accomplish and ( + sum(1 for speed in self.test_speed_result.values() if speed > 0) >= 3 + or any(speed > 1 for speed in self.test_speed_result.values()) + ): + self.if_speed_test_accomplish = True + for timer in self.timer_dict.values(): + timer.timeout.emit() + if any(speed == -1 for _, speed in self.test_speed_result.items()): return None diff --git a/resources/version.json b/resources/version.json index 589d206..9fc35de 100644 --- a/resources/version.json +++ b/resources/version.json @@ -6,7 +6,8 @@ "公招喜报模板优化" ], "程序优化": [ - "Mirror 酱链接添加`source`字段,用于标识来源" + "Mirror 酱链接添加`source`字段,用于标识来源", + "优化下载器测速中止条件" ] }, "4.3.10.1": { From 1a2c1b976f533f2acccaf1350deb51cf59a2d363 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Sat, 7 Jun 2025 15:59:06 +0800 Subject: [PATCH 12/14] =?UTF-8?q?fix(maa):=20=E6=9B=B4=E6=96=B0=E5=8A=A8?= =?UTF-8?q?=E4=BD=9C=E6=89=A7=E8=A1=8C=E5=90=8E=E7=A7=BB=E9=99=A4=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/MAA.py | 2 ++ resources/version.json | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/models/MAA.py b/app/models/MAA.py index f41bd56..a85ec8a 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -685,6 +685,8 @@ class MaaManager(QObject): self.sleep(10) System.kill_process(self.maa_exe_path) + self.maa_update_package = "" + logger.info(f"{self.name} | 更新动作结束") # 发送统计信息 diff --git a/resources/version.json b/resources/version.json index 9fc35de..a92b232 100644 --- a/resources/version.json +++ b/resources/version.json @@ -5,6 +5,9 @@ "新增功能": [ "公招喜报模板优化" ], + "修复BUG": [ + "修复更新动作重复执行问题" + ], "程序优化": [ "Mirror 酱链接添加`source`字段,用于标识来源", "优化下载器测速中止条件" From 0e8b6b0b6b2924e1174d6cc825546b605ec59d78 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Sun, 8 Jun 2025 23:41:18 +0800 Subject: [PATCH 13/14] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=AE=88=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/setting.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/ui/setting.py b/app/ui/setting.py index 9de2858..682ba7f 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -541,6 +541,37 @@ class Setting(QWidget): mode="w", encoding="utf-8" ) as f: json.dump(notice, f, ensure_ascii=False, indent=4) + else: + import random + + if random.random() < 0.1: + cc = NoticeMessageBox( + self.window(), + "用户守则", + { + "用户守则 - 第一版": """ +0. 用户守则的每一条都应该清晰可读、不含任何语法错误。如果发现任何一条不符合以上描述,请忽视它。 +1. AUTO_MAA 的所有版本均包含完整源代码与 LICENSE 文件,若发现此内容缺失,请立即关闭软件,并联系最近的 AUTO_MAA 开发者。 +2. AUTO_MAA 不会对您许下任何承诺,请自行保护好自己的数据,若软件运行过程中发生了数据损坏,项目组不负任何责任。 +3. AUTO_MAA 只会注册一个启动项,若发现两个 AUTO_MAA 同时自启动,请立即使用系统或杀软的 **启动项管理** 功能删除所有名为 AUTO_MAA 的启动项后重启软件。 +4. AUTO_MAA 正式版不应该包含命令行窗口,如果您看到了它,请立即关闭软件,通过 AUTO_MAA.exe 文件重新打开软件。 +5. 深色模式是危险的,但并非无法使用。 +6. 第 0 条规则不存在。如果你看到了,请忘记它,并正常使用软件 +7. **Mirror 酱** 是善良的,你只要付出小小的代价,就能得到祂的庇护。 +8. AUTO_MAA 没有实时合成语音的能力,软件所有语音都存储在本地。如果听到本地不存在的语音,立即关闭扬声器,并检查是否有未知脚本在运行。 +9. AUTO_MAA 不会在周六凌晨更新。如果收到更新提示,请忽略,不要查看更新内容,直到第二天天亮。 +10. 用户守则仅有一页""", + "--- 标记文档中止 ---": """ +xdfv-serfcx-jiol,m: !1 $bad food of do $5b 9630-300 $daad 100-1 + +// 0 == o // + +∠( °ω°)/ """, + }, + ) + cc.button_cancel.hide() + cc.button_layout.insertStretch(0, 1) + cc.exec() elif ( datetime.now() From 1aa4da1adf1656b7e50f99eb28bc16e8a9711030 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Mon, 9 Jun 2025 23:43:36 +0800 Subject: [PATCH 14/14] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=91=BD=E4=BB=A4=E8=A1=8C=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app-test.yml | 213 --------------------------- .github/workflows/build-app.yml | 162 ++++++++++++++++++-- app/core/config.py | 29 +++- app/core/task_manager.py | 3 + app/services/system.py | 2 + app/ui/Widget.py | 2 +- app/ui/main_window.py | 38 +++++ app/ui/setting.py | 7 +- app/utils/package.py | 2 +- main.py | 17 +++ resources/version.json | 3 +- 11 files changed, 241 insertions(+), 237 deletions(-) delete mode 100644 .github/workflows/build-app-test.yml diff --git a/.github/workflows/build-app-test.yml b/.github/workflows/build-app-test.yml deleted file mode 100644 index 8dbeee0..0000000 --- a/.github/workflows/build-app-test.yml +++ /dev/null @@ -1,213 +0,0 @@ -# AUTO_MAA:A MAA Multi Account Management and Automation Tool -# Copyright © 2024-2025 DLmaster361 - -# This file is part of AUTO_MAA. - -# AUTO_MAA is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published -# by the Free Software Foundation, either version 3 of the License, -# or (at your option) any later version. - -# AUTO_MAA is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -# the GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with AUTO_MAA. If not, see . - -# Contact: DLmaster_361@163.com - -name: Build AUTO_MAA Test - -on: - workflow_dispatch: - -permissions: - contents: write - actions: write - -jobs: - - pre_check: - name: Pre Checks - runs-on: ubuntu-latest - - steps: - - name: Repo Check - id: repo_check - run: | - if [[ "$GITHUB_REPOSITORY" != "DLmaster361/AUTO_MAA" ]]; then - echo "When forking this repository to make your own builds, you have to adjust this check." - exit 1 - fi - exit 0 - - build_AUTO_MAA: - runs-on: windows-latest - needs: pre_check - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - pip install -r requirements.txt - - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - - name: Get version - id: get_version - run: | - $version = (Get-Content resources/version.json | ConvertFrom-Json).main_version - echo "main_version=$version" >> $env:GITHUB_OUTPUT - - - name: Nuitka build main program - uses: Nuitka/Nuitka-Action@main - with: - script-name: main.py - mode: app - enable-plugins: pyside6 - onefile-tempdir-spec: "{TEMP}/AUTO_MAA" - windows-console-mode: disable - windows-icon-from-ico: resources/icons/AUTO_MAA.ico - company-name: AUTO_MAA Team - product-name: AUTO_MAA - file-version: ${{ steps.get_version.outputs.main_version }} - product-version: ${{ steps.get_version.outputs.main_version }} - file-description: AUTO_MAA Component - copyright: Copyright © 2024-2025 DLmaster361 - assume-yes-for-downloads: true - output-file: AUTO_MAA - output-dir: AUTO_MAA - - - name: Upload unsigned main program - id: upload-unsigned-main-program - uses: actions/upload-artifact@v4 - with: - name: AUTO_MAA - path: AUTO_MAA/AUTO_MAA.exe - - - name: Sign main program - id: sign_main_program - uses: signpath/github-action-submit-signing-request@v1.2 - with: - api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' - organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' - project-slug: 'AUTO_MAA_' - signing-policy-slug: 'test-signing' - artifact-configuration-slug: "AUTO_MAA" - github-artifact-id: '${{ steps.upload-unsigned-main-program.outputs.artifact-id }}' - wait-for-completion: true - output-artifact-directory: 'AUTO_MAA' - - - name: Add other resources - shell: pwsh - run: | - $root = "${{ github.workspace }}" - $ver = "${{ steps.get_version.outputs.main_version }}" - Copy-Item "$root/app" "$root/AUTO_MAA/app" -Recurse - Copy-Item "$root/resources" "$root/AUTO_MAA/resources" -Recurse - Copy-Item "$root/main.py" "$root/AUTO_MAA/" - Copy-Item "$root/requirements.txt" "$root/AUTO_MAA/" - Copy-Item "$root/README.md" "$root/AUTO_MAA/" - Copy-Item "$root/LICENSE" "$root/AUTO_MAA/" - - - name: Create Inno Setup script - shell: pwsh - run: | - $root = "${{ github.workspace }}" - $ver = "${{ steps.get_version.outputs.main_version }}" - $iss = Get-Content "$root/app/utils/AUTO_MAA.iss" -Raw - $iss = $iss -replace '#define MyAppVersion ""', "#define MyAppVersion `"$ver`"" - $iss = $iss -replace '#define MyAppPath ""', "#define MyAppPath `"$root/AUTO_MAA`"" - $iss = $iss -replace '#define OutputDir ""', "#define OutputDir `"$root`"" - Set-Content -Path "$root/AUTO_MAA.iss" -Value $iss - - - name: Build setup program - uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 - with: - path: AUTO_MAA.iss - - - name: Upload unsigned setup program - id: upload-unsigned-setup-program - uses: actions/upload-artifact@v4 - with: - name: AUTO_MAA-Setup - path: AUTO_MAA-Setup.exe - - - name: Sign setup program - id: sign_setup_program - uses: signpath/github-action-submit-signing-request@v1.2 - with: - api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' - organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' - project-slug: 'AUTO_MAA_' - signing-policy-slug: 'test-signing' - artifact-configuration-slug: "AUTO_MAA-Setup" - github-artifact-id: '${{ steps.upload-unsigned-setup-program.outputs.artifact-id }}' - wait-for-completion: true - output-artifact-directory: 'AUTO_MAA_Setup' - - - name: Compress setup exe - shell: pwsh - run: Compress-Archive -Path AUTO_MAA_Setup/* -DestinationPath AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip - - - name: Generate version info - shell: python - run: | - import json - from pathlib import Path - def version_text(version_numb): - while len(version_numb) < 4: - version_numb.append(0) - if version_numb[3] == 0: - return f"v{'.'.join(str(_) for _ in version_numb[0:3])}" - else: - return f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}" - def version_info_markdown(info): - version_info = "" - for key, value in info.items(): - version_info += f"## {key}\n" - for v in value: - version_info += f"- {v}\n" - return version_info - root_path = Path(".") - version = json.loads((root_path / "resources/version.json").read_text(encoding="utf-8")) - main_version_numb = list(map(int, version["main_version"].split("."))) - all_version_info = {} - for v_i in version["version_info"].values(): - for key, value in v_i.items(): - if key in all_version_info: - all_version_info[key] += value.copy() - else: - all_version_info[key] = value.copy() - (root_path / "version_info.txt").write_text( - f"{version_text(main_version_numb)}\n\n\n{version_info_markdown(all_version_info)}", - encoding="utf-8", - ) - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: AUTO_MAA_${{ steps.get_version.outputs.main_version }} - path: AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip - - - name: Upload Version_Info Artifact - uses: actions/upload-artifact@v4 - with: - name: version_info - path: version_info.txt \ No newline at end of file diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 575e65c..8bacf40 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -28,9 +28,11 @@ permissions: actions: write jobs: + pre_check: name: Pre Checks runs-on: ubuntu-latest + steps: - name: Repo Check id: repo_check @@ -40,67 +42,198 @@ jobs: exit 1 fi exit 0 + build_AUTO_MAA: runs-on: windows-latest needs: pre_check + steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python 3.12 + + - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: '3.12' + - name: Install dependencies run: | python -m pip install --upgrade pip pip install flake8 pytest pip install -r requirements.txt - choco install innosetup - echo "C:\Program Files (x86)\Inno Setup 6" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Package - id: package + + - name: Get version + id: get_version run: | - copy app\utils\package.py .\ - python package.py - - name: Read version - id: read_version + $version = (Get-Content resources/version.json | ConvertFrom-Json).main_version + echo "main_version=$version" >> $env:GITHUB_OUTPUT + + - name: Nuitka build main program + uses: Nuitka/Nuitka-Action@main + with: + script-name: main.py + mode: app + enable-plugins: pyside6 + onefile-tempdir-spec: "{TEMP}/AUTO_MAA" + windows-console-mode: attach + windows-icon-from-ico: resources/icons/AUTO_MAA.ico + company-name: AUTO_MAA Team + product-name: AUTO_MAA + file-version: ${{ steps.get_version.outputs.main_version }} + product-version: ${{ steps.get_version.outputs.main_version }} + file-description: AUTO_MAA Component + copyright: Copyright © 2024-2025 DLmaster361 + assume-yes-for-downloads: true + output-file: AUTO_MAA + output-dir: AUTO_MAA + + - name: Upload unsigned main program + id: upload-unsigned-main-program + uses: actions/upload-artifact@v4 + with: + name: AUTO_MAA + path: AUTO_MAA/AUTO_MAA.exe + + - name: Sign main program + id: sign_main_program + uses: signpath/github-action-submit-signing-request@v1.2 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' + project-slug: 'AUTO_MAA_' + signing-policy-slug: 'test-signing' + artifact-configuration-slug: "AUTO_MAA" + github-artifact-id: '${{ steps.upload-unsigned-main-program.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'AUTO_MAA' + + - name: Add other resources + shell: pwsh run: | - $MAIN_VERSION=(Get-Content -Path "version_info.txt" -TotalCount 1).Trim() - "AUTO_MAA_version=$MAIN_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append + $root = "${{ github.workspace }}" + $ver = "${{ steps.get_version.outputs.main_version }}" + Copy-Item "$root/app" "$root/AUTO_MAA/app" -Recurse + Copy-Item "$root/resources" "$root/AUTO_MAA/resources" -Recurse + Copy-Item "$root/main.py" "$root/AUTO_MAA/" + Copy-Item "$root/requirements.txt" "$root/AUTO_MAA/" + Copy-Item "$root/README.md" "$root/AUTO_MAA/" + Copy-Item "$root/LICENSE" "$root/AUTO_MAA/" + + - name: Create Inno Setup script + shell: pwsh + run: | + $root = "${{ github.workspace }}" + $ver = "${{ steps.get_version.outputs.main_version }}" + $iss = Get-Content "$root/app/utils/AUTO_MAA.iss" -Raw + $iss = $iss -replace '#define MyAppVersion ""', "#define MyAppVersion `"$ver`"" + $iss = $iss -replace '#define MyAppPath ""', "#define MyAppPath `"$root/AUTO_MAA`"" + $iss = $iss -replace '#define OutputDir ""', "#define OutputDir `"$root`"" + Set-Content -Path "$root/AUTO_MAA.iss" -Value $iss + + - name: Build setup program + uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 + with: + path: AUTO_MAA.iss + + - name: Upload unsigned setup program + id: upload-unsigned-setup-program + uses: actions/upload-artifact@v4 + with: + name: AUTO_MAA-Setup + path: AUTO_MAA-Setup.exe + + - name: Sign setup program + id: sign_setup_program + uses: signpath/github-action-submit-signing-request@v1.2 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '787a1d5f-6177-4f30-9559-d2646473584a' + project-slug: 'AUTO_MAA_' + signing-policy-slug: 'test-signing' + artifact-configuration-slug: "AUTO_MAA-Setup" + github-artifact-id: '${{ steps.upload-unsigned-setup-program.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'AUTO_MAA_Setup' + + - name: Compress setup exe + shell: pwsh + run: Compress-Archive -Path AUTO_MAA_Setup/* -DestinationPath AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip + + - name: Generate version info + shell: python + run: | + import json + from pathlib import Path + def version_text(version_numb): + while len(version_numb) < 4: + version_numb.append(0) + if version_numb[3] == 0: + return f"v{'.'.join(str(_) for _ in version_numb[0:3])}" + else: + return f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}" + def version_info_markdown(info): + version_info = "" + for key, value in info.items(): + version_info += f"## {key}\n" + for v in value: + version_info += f"- {v}\n" + return version_info + root_path = Path(".") + version = json.loads((root_path / "resources/version.json").read_text(encoding="utf-8")) + main_version_numb = list(map(int, version["main_version"].split("."))) + all_version_info = {} + for v_i in version["version_info"].values(): + for key, value in v_i.items(): + if key in all_version_info: + all_version_info[key] += value.copy() + else: + all_version_info[key] = value.copy() + (root_path / "version_info.txt").write_text( + f"{version_text(main_version_numb)}\n\n\n{version_info_markdown(all_version_info)}", + encoding="utf-8", + ) + - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: AUTO_MAA_${{ env.AUTO_MAA_version }} - path: AUTO_MAA_${{ env.AUTO_MAA_version }}.zip + name: AUTO_MAA_${{ steps.get_version.outputs.main_version }} + path: AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip + - name: Upload Version_Info Artifact uses: actions/upload-artifact@v4 with: name: version_info path: version_info.txt + publish_release: name: Publish release needs: build_AUTO_MAA runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v4 + - name: Download artifacts uses: actions/download-artifact@v4 with: pattern: AUTO_MAA_* merge-multiple: true path: artifacts + - name: Download Version_Info uses: actions/download-artifact@v4 with: name: version_info path: ./ + - name: Create release id: create_release run: | @@ -122,6 +255,7 @@ jobs: gh release create "$TAGNAME" --target "main" --title "$NAME" --notes "$NOTES" $PRERELEASE_FLAG artifacts/* env: GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + - name: Trigger MirrorChyanUploading run: | gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan diff --git a/app/core/config.py b/app/core/config.py index 00ea92d..436a4c0 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -27,6 +27,7 @@ v4.3 from loguru import logger from PySide6.QtCore import Signal +import argparse import sqlite3 import json import sys @@ -614,6 +615,27 @@ class AppConfig(GlobalConfig): self.if_ignore_silence = False self.if_database_opened = False + self.search_member() + self.search_queue() + + parser = argparse.ArgumentParser( + prog="AUTO_MAA", + description="A MAA Multi Account Management and Automation Tool", + ) + parser.add_argument( + "--mode", + choices=["gui", "cli"], + default="gui", + help="使用UI界面或命令行模式运行程序", + ) + parser.add_argument( + "--config", + nargs="+", + choices=list(self.member_dict.keys()) + list(self.queue_dict.keys()), + help="指定需要运行哪些配置项", + ) + self.args = parser.parse_args() + self.initialize() def initialize(self) -> None: @@ -636,7 +658,8 @@ class AppConfig(GlobalConfig): def init_logger(self) -> None: """初始化日志记录器""" - logger.remove(0) + if self.args.mode != "cli": + logger.remove(0) logger.add( sink=self.log_path, @@ -649,10 +672,14 @@ class AppConfig(GlobalConfig): retention="1 month", compression="zip", ) + logger.info("") logger.info("===================================") logger.info("AUTO_MAA 主程序") logger.info(f"版本号: v{self.VERSION}") logger.info(f"根目录: {self.app_path}") + logger.info( + f"运行模式: {'图形化界面' if self.args.mode == 'gui' else '命令行界面'}" + ) logger.info("===================================") logger.info("日志记录器初始化完成") diff --git a/app/core/task_manager.py b/app/core/task_manager.py index 87214ff..8d205db 100644 --- a/app/core/task_manager.py +++ b/app/core/task_manager.py @@ -283,6 +283,9 @@ class _TaskManager(QObject): ) ) + if Config.args.mode == "cli" and Config.power_sign == "NoAction": + Config.set_power_sign("KillSelf") + def check_maa_version(self, v: str): """检查MAA版本""" diff --git a/app/services/system.py b/app/services/system.py index eee6a58..0f09e96 100644 --- a/app/services/system.py +++ b/app/services/system.py @@ -112,6 +112,7 @@ class _SystemHandler: Config.main_window.close() QApplication.quit() + sys.exit(0) elif sys.platform.startswith("linux"): @@ -138,6 +139,7 @@ class _SystemHandler: Config.main_window.close() QApplication.quit() + sys.exit(0) def is_startup(self) -> bool: """判断程序是否已经开机自启""" diff --git a/app/ui/Widget.py b/app/ui/Widget.py index c810ccf..3f25e88 100644 --- a/app/ui/Widget.py +++ b/app/ui/Widget.py @@ -162,7 +162,7 @@ class ProgressRingMessageBox(MessageBoxBase): super().__init__(parent) self.title = SubtitleLabel(title) - self.time = 100 + self.time = 100 if Config.args.mode == "gui" else 1 Widget = QWidget() Layout = QHBoxLayout(Widget) self.ring = ProgressRing() diff --git a/app/ui/main_window.py b/app/ui/main_window.py index 1f083b6..9069d82 100644 --- a/app/ui/main_window.py +++ b/app/ui/main_window.py @@ -257,6 +257,9 @@ class AUTO_MAA(MSFluentWindow): ) -> None: """配置窗口状态""" + if Config.args.mode != "gui": + return None + self.switch_theme() if mode == "显示主窗口": @@ -379,6 +382,41 @@ class AUTO_MAA(MSFluentWindow): self.titleBar.minBtn.click() + if Config.args.config: + + for config in [_ for _ in Config.args.config if _ in Config.queue_dict]: + + TaskManager.add_task( + "自动代理_新调度台", + config, + Config.queue_dict["调度队列_1"]["Config"].toDict(), + ) + + for config in [_ for _ in Config.args.config if _ in Config.member_dict]: + + TaskManager.add_task( + "自动代理_新调度台", + "自定义队列", + {"Queue": {"Member_1": config}}, + ) + + if not any( + _ in (list(Config.member_dict.keys()) + list(Config.queue_dict.keys())) + for _ in Config.args.config + ): + + logger.warning( + "当前运行模式为命令行模式,由于您使用了错误的 --config 参数进行配置,程序自动退出" + ) + System.set_power("KillSelf") + + elif Config.args.mode == "cli": + + logger.warning( + "当前运行模式为命令行模式,由于您未使用 --config 参数进行配置,程序自动退出" + ) + System.set_power("KillSelf") + def clean_old_logs(self): """ 删除超过用户设定天数的日志文件(基于目录日期) diff --git a/app/ui/setting.py b/app/ui/setting.py index 682ba7f..bec3b26 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -561,12 +561,7 @@ class Setting(QWidget): 8. AUTO_MAA 没有实时合成语音的能力,软件所有语音都存储在本地。如果听到本地不存在的语音,立即关闭扬声器,并检查是否有未知脚本在运行。 9. AUTO_MAA 不会在周六凌晨更新。如果收到更新提示,请忽略,不要查看更新内容,直到第二天天亮。 10. 用户守则仅有一页""", - "--- 标记文档中止 ---": """ -xdfv-serfcx-jiol,m: !1 $bad food of do $5b 9630-300 $daad 100-1 - -// 0 == o // - -∠( °ω°)/ """, + "--- 标记文档中止 ---": "xdfv-serfcx-jiol,m: !1 $bad food of do $5b 9630-300 $daad 100-1\n\n// 0 == o //\n\n∠( °ω°)/", }, ) cc.button_cancel.hide() diff --git a/app/utils/package.py b/app/utils/package.py index 47478d7..671f65f 100644 --- a/app/utils/package.py +++ b/app/utils/package.py @@ -71,7 +71,7 @@ if __name__ == "__main__": os.system( "powershell -Command python -m nuitka --standalone --onefile --mingw64" - " --enable-plugins=pyside6 --windows-console-mode=disable" + " --enable-plugins=pyside6 --windows-console-mode=attach" " --onefile-tempdir-spec='{TEMP}\\AUTO_MAA'" " --windows-icon-from-ico=resources\\icons\\AUTO_MAA.ico" " --company-name='AUTO_MAA Team' --product-name=AUTO_MAA" diff --git a/main.py b/main.py index 94befdc..8c208a3 100644 --- a/main.py +++ b/main.py @@ -25,6 +25,23 @@ v4.3 作者:DLmaster_361 """ +# 屏蔽广告 +import builtins + + +def no_print(*args, **kwargs): + if ( + args + and isinstance(args[0], str) + and "QFluentWidgets Pro is now released." in args[0] + ): + return + return __builtins__.print(*args, **kwargs) + + +builtins.print = no_print + + from loguru import logger from PySide6.QtWidgets import QApplication from qfluentwidgets import FluentTranslator diff --git a/resources/version.json b/resources/version.json index a92b232..ebc14eb 100644 --- a/resources/version.json +++ b/resources/version.json @@ -3,7 +3,8 @@ "version_info": { "4.3.10.2": { "新增功能": [ - "公招喜报模板优化" + "公招喜报模板优化", + "支持使用命令行调用" ], "修复BUG": [ "修复更新动作重复执行问题"