diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bb5d0d7f5..f87a8a94cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,9 +6,23 @@ on: - 'v*' branches-ignore: - 'master' + paths: + - '3rdparty/include/**' + - 'include/**' + - 'src/**' + - 'cmake/**' + - 'CMakeLists.txt' + - 'MAA.sln' pull_request: branches: - 'dev' + paths: + - '3rdparty/include/**' + - 'include/**' + - 'src/**' + - 'cmake/**' + - 'CMakeLists.txt' + - 'MAA.sln' workflow_dispatch: jobs: diff --git a/.github/workflows/dev-build-linux.yml b/.github/workflows/dev-build-linux.yml deleted file mode 100644 index 4705a06878..0000000000 --- a/.github/workflows/dev-build-linux.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: dev-build-linux - -on: - push: - branches-ignore: - - master - paths: - - 'src/MaaCore/**' - - '3rdparty/**' - - 'include/**' - - 'resource/**' - - 'cmake/**' - - CMakeLists.txt - pull_request: - branches: - - dev - paths: - - 'src/MaaCore/**' - - '3rdparty/**' - - 'include/**' - - 'resource/**' - - 'cmake/**' - - CMakeLists.txt - -jobs: - linux-latest: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Setup ccache - uses: Chocobo1/setup-ccache-action@v1 - with: - remove_stale_cache: false - - name: Bootstrap MaaDeps - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - python3 maadeps-download.py - - name: Build MAA - env: - CC: ccache gcc-12 - CXX: ccache g++-12 - run: | - mkdir -p build - cmake -B build \ - -DINSTALL_THIRD_LIBS=ON \ - -DINSTALL_RESOURCE=OFF \ - -DINSTALL_PYTHON=OFF - # -DFASTDEPLOY_DIRECTORY=~/fastdeploy \ - # -DOPENCV_DIRECTORY=~/opencv/lib/cmake/opencv4 \ - cmake --build build --parallel $(nproc --all) - - mkdir -p install - cmake --install build --prefix install - - - name: tar files - run: | - mkdir -p release - cd install - tar czvf $GITHUB_WORKSPACE/release/MaaAssistantArknights.tar.gz . - - - uses: actions/upload-artifact@v3 - with: - name: MAA-linux - path: release/*.tar.gz diff --git a/.github/workflows/dev-build-mac.yml b/.github/workflows/dev-build-mac.yml deleted file mode 100644 index eb74098dd0..0000000000 --- a/.github/workflows/dev-build-mac.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: dev-build-mac - -on: - push: - branches-ignore: - - master - paths: - - 'src/MaaCore/**' - - 'src/MaaMacGui/**' - - '3rdparty/**' - - 'include/**' - - 'resource/**' - - 'cmake/**' - - CMakeLists.txt - pull_request: - branches: - - dev - paths: - - 'src/MaaCore/**' - - 'src/MaaMacGui/**' - - '3rdparty/**' - - 'include/**' - - 'resource/**' - - 'cmake/**' - - CMakeLists.txt - -jobs: - macos-latest: - runs-on: macos-12 - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 100 - - name: Cache Homebrew - uses: actions/cache@v3 - with: - path: $(brew --prefix) - key: ${{ runner.os }}-homebrew-${{ hashFiles('.config/brew/Brewfile') }} - - name: Install Dependencies - run: | - brew update --preinstall - brew install ninja pkg-config range-v3 - - name: Bootstrap MaaDeps - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - python3 maadeps-download.py - - name: Configure MaaCore - run: | - cmake -B build -GNinja -DBUILD_XCFRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURES=x86_64 - - name: Build libMaaCore - run: cmake --build build - - name: Build MAA - working-directory: src/MaaMacGui - run: xcodebuild CODE_SIGN_IDENTITY="-" DEVELOPMENT_TEAM="-" -derivedDataPath DerivedData -project MeoAsstMac.xcodeproj -scheme MAA - - uses: actions/upload-artifact@v3 - with: - name: MAA-macos - path: src/MaaMacGui/DerivedData/Build/Products/Debug diff --git a/.github/workflows/dev-build-win.yml b/.github/workflows/dev-build-win.yml deleted file mode 100644 index 4eeac829e1..0000000000 --- a/.github/workflows/dev-build-win.yml +++ /dev/null @@ -1,91 +0,0 @@ -# ------------------------------------------------------------------------------ -# -# -# This code was generated. -# -# - To turn off auto-generation set: -# -# [GitHubActions (AutoGenerate = false)] -# -# - To trigger manual generation invoke: -# -# nuke --generate-configuration GitHubActions_dev-build-win --host GitHubActions -# -# -# ------------------------------------------------------------------------------ - -name: dev-build-win - -on: - push: - branches-ignore: - - master - paths: - - 'src/MaaCore/**' - - 'src/MaaWpfGui/**' - - '3rdparty/**' - - 'tools/MaaBuilder/**' - - tools/MaaBuilder.sln - - 'include/**' - - 'resource/**' - - MAA.sln - pull_request: - branches: - - dev - paths: - - 'src/MaaCore/**' - - 'src/MaaWpfGui/**' - - '3rdparty/**' - - 'tools/MaaBuilder/**' - - tools/MaaBuilder.sln - - 'include/**' - - 'resource/**' - - MAA.sln - workflow_dispatch: - inputs: - Reason: - description: "Reason" - required: true - ReleaseSimulation: - description: "Release Simulation" - required: true - -jobs: - windows-latest: - strategy: - matrix: - include: - - msbuild_target: x64 - lowercase_target: x64 - - msbuild_target: ARM64 - lowercase_target: arm64 - fail-fast: false - env: - MAABUILDER_TARGET_PLATFORM: ${{ matrix.msbuild_target }} - name: windows-latest - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: Cache .nuke/temp, ~/.nuget/packages - uses: actions/cache@v3 - with: - path: | - .nuke/temp - ~/.nuget/packages - key: ${{ runner.os }}-${{ matrix.msbuild_target }}-${{ hashFiles('**/global.json', '**/*.csproj') }} - - name: Bootstrap MaaDeps - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - python3 maadeps-download.py ${{ matrix.lowercase_target }}-windows - - name: Run './build.cmd DevBuild' - run: | - ./build.cmd DevBuild - env: - Reason: ${{ github.event.inputs.Reason }} - ReleaseSimulation: ${{ github.event.inputs.ReleaseSimulation }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v3 - with: - name: MAA-win-${{ matrix.lowercase_target }} - path: artifacts diff --git a/.github/workflows/gen-changelog.yml b/.github/workflows/gen-changelog.yml new file mode 100644 index 0000000000..48429a5132 --- /dev/null +++ b/.github/workflows/gen-changelog.yml @@ -0,0 +1,47 @@ +name: gen-changelog + +on: + workflow_dispatch: + inputs: + commit_message: + description: 'Commit Message' + type: string + required: false + +jobs: + gen: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Generate Changelog + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + python3 tools/ChangelogGenerator/changelog_generator.py + + - name: Add files to git + run: | + git status + + git config user.name "$env:GITHUB_ACTOR" + git config user.email "$env:GITHUB_ACTOR@users.noreply.github.com" + git add . + + $commit_msg = "${{ github.event.inputs.commit_message }}" + if (-not [string]::IsNullOrWhiteSpace($commit_msg)) { + $commit_msg = $commit_msg.Trim() + } else { + $commit_msg = "docs: Auto Generate Changelog - $(Get-Date -Format 'yyyy-MM-dd')" + } + git commit -m "$commit_msg" + git switch -c changelog + + - name: Push changes # push the output folder to your repo + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + force: true + branch: changelog diff --git a/.github/workflows/issue-checker.yml b/.github/workflows/issue-checker.yml index e590525b7a..d16723314f 100644 --- a/.github/workflows/issue-checker.yml +++ b/.github/workflows/issue-checker.yml @@ -6,7 +6,6 @@ on: types: [opened, edited] issue_comment: types: [created, edited] - push: permissions: contents: read diff --git a/.github/workflows/release-nightly-ota.yml b/.github/workflows/release-nightly-ota.yml index 9509f624a7..89e3d2fc2c 100644 --- a/.github/workflows/release-nightly-ota.yml +++ b/.github/workflows/release-nightly-ota.yml @@ -144,8 +144,7 @@ jobs: run: | mkdir -pv build-ota && cd build-ota cd ${{ needs.build-win-nightly.outputs.tag }} - mkdir -pv content - unzip -q -O GB2312 -o *.zip -x '*.lib' -x '*.pdb' -x '*.exp' -x '*.config' -x '*.xml' -d content + zip -d *.zip '*.lib' '*.pdb' '*.exp' '*.config' '*.xml' cd .. gh release list --repo 'MaaAssistantArknights/MaaAssistantArknights' --limit ${{ inputs.limit || 30 }} | tee ./release_maa.txt diff --git a/.github/workflows/release-ota.yml b/.github/workflows/release-ota.yml index a77eb0def8..83bdb19e3d 100644 --- a/.github/workflows/release-ota.yml +++ b/.github/workflows/release-ota.yml @@ -54,10 +54,8 @@ jobs: run: | mkdir -pv build-ota/${{ env.release_tag }} cd build-ota/${{ env.release_tag }} - mkdir -pv content gh release download ${{ env.release_tag }} --repo 'MaaAssistantArknights/MaaAssistantArknights' --pattern "MAA-${{ env.release_tag }}-win-${{ matrix.target }}.zip" --clobber - unzip -q -O GB2312 -o "*.zip" -d 'content' - mv *.zip .. + cp *.zip .. env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: "Build OTA" diff --git a/.github/workflows/smoke-testing.yml b/.github/workflows/smoke-testing.yml new file mode 100644 index 0000000000..894d543a4e --- /dev/null +++ b/.github/workflows/smoke-testing.yml @@ -0,0 +1,55 @@ +name: test + +on: + push: + paths: + - '3rdparty/include/**' + - 'include/**' + - 'src/**' + - 'cmake/**' + - 'CMakeLists.txt' + - 'MAA.sln' + - 'resource/**' + - 'MaaDeps/**' + pull_request: + paths: + - '3rdparty/include/**' + - 'include/**' + - 'src/**' + - 'cmake/**' + - 'CMakeLists.txt' + - 'MAA.sln' + - 'resource/**' + - 'MaaDeps/**' + workflow_dispatch: + +jobs: + smoke-testing: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + - uses: NuGet/setup-nuget@v1.2.0 + - run: nuget restore MAA.sln + + - name: Bootstrap MaaDeps + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + python3 maadeps-download.py x64-windows + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + - name: Build MaaSample + run: | + MSBUILD src/Cpp/MaaSample.slnf /t:rebuild /p:Configuration="Debug" /p:Platform="x64" /m + + - name: Run Testing + run: | + .\x64\Debug\Sample.exe + + - name: Upload Logs + uses: actions/upload-artifact@v3 + with: + name: log + path: .\x64\Debug\debug diff --git a/CHANGELOG.md b/CHANGELOG.md index 34cb2375f2..77afd06384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,92 +1,18 @@ -## v4.16.0-beta.1 - -### 新增 - -- 牛牛抽卡! @MistEO @hguandl -- 新增肉鸽刷指路鳞(请在设置中打开) @MistEO @hguandl -- 新增内置保全作业 雷神工业测试平台 浊蒂版,更稳定 (#4528) @junyihan233 @MistEO -- Mac UI 支持启动 iOS 客户端 @hguandl -- Mac UI 仓库结果导出 JSON @hguandl -- 干员 BOX 识别增加等级和精英度 (#4438) @GD-GK @MistEO +## v4.16.0-rc.1 ### 改进 -- 优化资源加载速度 @MistEO @hguandl -- 大幅优化视频识别切片准确率 @MistEO -- 优化干员 BOX 识别准确率 @MistEO -- Vision 相关代码 超级大重构 @MistEO -- 优化保全雷神工业第五层部署逻辑 (#4503) @AnnoyingFlowers -- Win UI 添加模拟器检测错误日志输出、启动等待结束提示 @ABA2396 -- Win UI Add InstanceManager (#4422) (#4486) @moomiji -- Win UI 脚本运行不阻塞 UI (#4422) (#4486) @moomiji -- Win UI 优化主界面布局 @ABA2396 -- Win UI Do not save config on startup @MistEO -- Win UI 减慢弹出速率 @moomiji -- Mac UI 运行时防止系统进入睡眠 @hguandl -- Mac UI 启动前加载外服资源 @hguandl -- Mac UI 添加视频识别说明 @hguandl -- Auto Update Game Resources - 2023-04-27 @MistEO +- Mac UI 添加全选/取消任务的菜单和快捷键 @hguandl +- 更新保全作业 雷神工业测试平台_浊蒂版.json (#4563) @junyihan233 ### 修复 -- 修复 Win UI Changelog 弹窗 (#4422) (#4486) @moomiji -- 修复剿灭模式下任务失败时备选关卡为未在列表的主线关卡被跳过的问题 @ABA2396 -- 修复主线导航 ocrReplace 错误 @ABA2396 -- Mac UI 修复自定义基建文件权限 @hguandl -- 修复任务还未结束时就显示 Link Start @ABA2396 -- 部分肉鸽地图无法正确部署 (#4522) @LingXii -- 再次修复肉鸽“瞻前顾后”关卡名识别错误 @MistEO -- 修复识别工具失去焦点重置界面问题 @ABA2396 -- 修复启动时自动开启模拟器后无法自动停止 @ABA2396 -- 修复只自动开启模拟器时停不下来的情况 @moomiji -- 修复二次点击 StartButton1 时误触 StartButton2 @ABA2396 -- Mac UI 修复干员识别适配 @hguandl -- 修复路径检查错误 @ABA2396 -- Win UI SettingsView displayed incompletely @moomiji -- 修复开启 `启动MAA后自动开启模拟器` 报错 @ABA2396 -- perf: TryToStartEmulator 执行不更改按钮状态 #4533 @ABA2396 -- 修复开始唤醒任务提前结束,导致基建等任务点进商店的问题 @MistEO -- 修复 mac 上访问好友任务出错 +- 修复抽卡有时候进不去的问题 @MistEO ### 其他 -- Win UI 同时加载 API @ABA2396 -- 更新一图流上传接口 @MistEO -- 从 maa-website 转移文档 (#4545) @horror-proton -- add r2 release mirror @GalvinGao @MistEO -- Auto Tag Release PR (#4531) @MistEO -- 升级 macOS 编译环境,清理多余依赖 @hguandl -- 代码清理 @MistEO @hguandl @ABA2396 -- 修复 Win UI 绑定错误 @ABA2396 - -### For overseas - -#### Common - -- Added CI that automatically updates game resources, including all overseas clients resources (but needs to be manually triggered). If you want to create a pull request to update game resources, you can use \ -> `Actions` -> `res-update-game` -> `Run workflow` to update resources instead of manual update. @MistEO -- Fix the recognition error of recruiting senior operators @MistEO -- fix #4471: Add loading instructions for overseas clients resource files @hguandl - -#### YostarJP - -- Doc : Add EPISODE11 Depot (#4506) @wallsman -- Doc : JP Update EPISODE11「淬火煙塵」 (#4504) @wallsman - -#### YostarEN - -- Resolve recruit failure for Supporter @hguandl - -#### txwy - -- 繁中服 傀影肉鴿道具 (#4491) @vonnoq -- 繁中服 保全物件/傀影關卡識別 (#4489) @vonnoq - -### For develops - -**由于我们的文档正在迁移,为避免造成更多的 conflicts,近期新接口还请参考 Win UI 或 Mac UI 集成逻辑** - -- 新增抽卡功能,[集成参考](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/f644f8c548568220b61955c0369c9ac6c7bceec4/src/MaaWpfGui/Main/AsstProxy.cs#L1662) @MistEO -- 肉鸽新增刷 `指路鳞` 选项,[集成参考](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/f644f8c548568220b61955c0369c9ac6c7bceec4/src/MaaWpfGui/Main/AsstProxy.cs#L1588), [回调参考](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/f644f8c548568220b61955c0369c9ac6c7bceec4/src/MaaWpfGui/Main/AsstProxy.cs#L774) @MistEO -- 干员 BOX 识别,潜能 改成 1-6 @MistEO -- 新增自动更新游戏资源 CI: `res-update-game` @MistEO -- Add Debug configuration (#4474) @dantmnf @MistEO +- 修正文档干员 box 识别潜能字段 为 [1,6] @MistEO +- 加快更新包构建速度 (#4517) @horror-proton +- 新增 CI,自动生成 changelog @MistEO +- 新增 CI,自动冒烟测试 (#4565) @MistEO +- 优化了一些 CI @MistEO diff --git a/docs/3.2-回调消息协议.md b/docs/3.2-回调消息协议.md index 9f8ebf9b11..b3180e2c82 100644 --- a/docs/3.2-回调消息协议.md +++ b/docs/3.2-回调消息协议.md @@ -582,8 +582,8 @@ Todo "own": true, // 是否拥有 "elite": 2, // 精英度 0,1,2 "level": 50, // 干员等级 - "potential": 5, // 干员潜能 0-5 - "rarity": 5 // 干员稀有度 1-6 + "potential": 6, // 干员潜能 [1, 6] + "rarity": 5 // 干员稀有度 [1, 6] }, { "id": "char_003_kalts", @@ -591,7 +591,7 @@ Todo "own": true, "elite": 2, "level": 50, - "potential": 0, + "potential": 1, "rarity": 6 } ] diff --git a/docs/en-us/3.2-CALLBACK_SCHEMA.md b/docs/en-us/3.2-CALLBACK_SCHEMA.md index 262c057032..82e0f8a861 100644 --- a/docs/en-us/3.2-CALLBACK_SCHEMA.md +++ b/docs/en-us/3.2-CALLBACK_SCHEMA.md @@ -574,7 +574,8 @@ Todo "own": true, // Whether owned "elite": 2, // Elite level 0, 1, 2 "level": 50, // Operator level - "potential": 5 // Operator potential 0-5 + "potential": 6, // Operator potential [1, 6] + "rarity": 5 // [1, 6] }, { "id": "char_003_kalts", @@ -582,10 +583,11 @@ Todo "own": true, "elite": 2, "level": 50, - "potential": 0 + "potential": 1, + "rarity": 6 } ] ``` - + - `UnsupportedLevel`
Unsupported level name diff --git a/docs/ja-jp/3.2-コールバックAPI.md b/docs/ja-jp/3.2-コールバックAPI.md index 42a7ee13d7..cc3e068bb4 100644 --- a/docs/ja-jp/3.2-コールバックAPI.md +++ b/docs/ja-jp/3.2-コールバックAPI.md @@ -543,7 +543,8 @@ Todo "own": true, // 持っているのでしょうか? "elite": 2, // エリート主義 0, 1, 2 "level": 50, // グレード - "potential": 5 // ポテンシャル 0-5 + "potential": 6, // ポテンシャル [1, 6] + "rarity": 5 // [1, 6] }, { "id": "char_003_kalts", @@ -551,7 +552,8 @@ Todo "own": true, "elite": 2, "level": 50, - "potential": 0 + "potential": 1, + "rarity": 6 } ] ``` diff --git a/docs/zh-tw/3.2-回呼訊息協定.md b/docs/zh-tw/3.2-回呼訊息協定.md index feab29d4b3..5dc7ec4177 100644 --- a/docs/zh-tw/3.2-回呼訊息協定.md +++ b/docs/zh-tw/3.2-回呼訊息協定.md @@ -543,7 +543,8 @@ Todo "own": true, // 是否擁有 "elite": 2, // 精英度 0, 1, 2 "level": 50, // 幹員等級 - "potential": 5 // 幹員潛能 0-5 + "potential": 6, // 幹員潛能 [1, 6] + "rarity": 5 // [1, 6] }, { "id": "char_003_kalts", @@ -551,7 +552,8 @@ Todo "own": true, "elite": 2, "level": 50, - "potential": 0 + "potential": 1, + "rarity": 6 } ] ``` diff --git a/resource/copilot/SSS_雷神工业测试平台_浊蒂版.json b/resource/copilot/SSS_雷神工业测试平台_浊蒂版.json index bc6796a768..440b1e3815 100644 --- a/resource/copilot/SSS_雷神工业测试平台_浊蒂版.json +++ b/resource/copilot/SSS_雷神工业测试平台_浊蒂版.json @@ -78,6 +78,7 @@ "豆苗", "夜半", "伺夜", + "缪尔赛思", "桃金娘", "极境", "琴柳", diff --git a/resource/tasks.json b/resource/tasks.json index b93c8768c9..e3fe0d4d4b 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -12056,6 +12056,7 @@ 156 ], "next": [ + "GachaEnter", "GachaEnter@LoadingText", "DoGacha" ] diff --git a/src/Cpp/MaaSample.slnf b/src/Cpp/MaaSample.slnf new file mode 100644 index 0000000000..75414af9fe --- /dev/null +++ b/src/Cpp/MaaSample.slnf @@ -0,0 +1,10 @@ +{ + "solution": { + "path": "..\\..\\MAA.sln", + "projects": [ + "src\\MaaCore\\MaaCore.vcxproj", + "src\\Cpp\\MaaSample.vcxproj", + "src\\SyncRes\\SyncRes.csproj", + ] + } +} diff --git a/src/Cpp/main.cpp b/src/Cpp/main.cpp index 04ee59ba71..c3cc5ae573 100644 --- a/src/Cpp/main.cpp +++ b/src/Cpp/main.cpp @@ -33,7 +33,7 @@ int main([[maybe_unused]] int argc, char** argv) #ifndef ASST_DEBUG AsstAsyncConnect(ptr, "adb", "127.0.0.1:5555", nullptr, true); #else - AsstAsyncConnect(ptr, "adb", "127.0.0.1:3439", "General", true); + AsstAsyncConnect(ptr, "adb", "127.0.0.1:5555", "DEBUG", true); #endif if (!AsstConnected(ptr)) { std::cerr << "connect failed" << std::endl; @@ -94,7 +94,7 @@ int main([[maybe_unused]] int argc, char** argv) #else - AsstAppendTask(ptr, "Custom", R"({"task_names": [ "GachaOnce" ] })"); + AsstAppendTask(ptr, "Debug", nullptr); #endif diff --git a/src/MaaCore/Assistant.cpp b/src/MaaCore/Assistant.cpp index 7df8c1a6a5..1054327c8c 100644 --- a/src/MaaCore/Assistant.cpp +++ b/src/MaaCore/Assistant.cpp @@ -322,7 +322,7 @@ std::vector asst::Assistant::get_tasks_list() const bool asst::Assistant::start(bool block) { LogTraceFunction; - Log.trace("Start |", block ? "block" : "non block"); + Log.info("Start |", block ? "block" : "non block"); if (!m_thread_idle) { return false; @@ -341,7 +341,7 @@ bool asst::Assistant::start(bool block) bool Assistant::stop(bool block) { LogTraceFunction; - Log.trace("Stop |", block ? "block" : "non block"); + Log.info("Stop |", block ? "block" : "non block"); m_thread_idle = true; diff --git a/src/MaaMacGui b/src/MaaMacGui index 70261711aa..813ffdd881 160000 --- a/src/MaaMacGui +++ b/src/MaaMacGui @@ -1 +1 @@ -Subproject commit 70261711aa52bd34917dd718be27e87519d7fa40 +Subproject commit 813ffdd881c324cdfdfb51ddcd438138c7cd1786 diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs index d7bd9428e5..f5b2f88496 100644 --- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs @@ -252,7 +252,7 @@ namespace MaaWpfGui.ViewModels.UI foreach (var file in Directory.GetFiles(extractDir, "*", SearchOption.AllDirectories)) { var fileName = Path.GetFileName(file); - if (fileName == "removelist.txt" || fileName == "md5sum.txt") + if (fileName == "removelist.txt" || fileName == "filelist.txt") { continue; } diff --git a/src/Python/asst/updater.py b/src/Python/asst/updater.py index 1f917daa2a..c1e7b8f113 100644 --- a/src/Python/asst/updater.py +++ b/src/Python/asst/updater.py @@ -201,9 +201,9 @@ class Updater: f.close() remove_with_print(removelist_path) - md5sum_path = os.path.join(self.path, 'md5sum.txt') - if os.path.isfile(md5sum_path): - remove_with_print(md5sum_path) + filelist_path = os.path.join(self.path, 'filelist.txt') + if os.path.isfile(filelist_path): + remove_with_print(filelist_path) for file in os.listdir(self.path): if 'OTA' in file: file_path = os.path.join(self.path, file) diff --git a/tools/ChangelogGenerator/changelog_generator.py b/tools/ChangelogGenerator/changelog_generator.py index 87716c0a15..9bd76cf269 100644 --- a/tools/ChangelogGenerator/changelog_generator.py +++ b/tools/ChangelogGenerator/changelog_generator.py @@ -2,7 +2,8 @@ from argparse import ArgumentParser import os import json import re -import requests +import urllib.request +import urllib.error cur_dir = os.path.dirname(__file__) contributors_path = os.path.abspath(os.path.join(cur_dir, 'contributors.json')) @@ -157,13 +158,42 @@ def print_commits(commits: dict, indent: str = "", need_sort: bool = True) -> (s return ret_message, ret_contributor + +def retry_urlopen(*args, **kwargs): + import time + import http.client + for _ in range(5): + try: + resp: http.client.HTTPResponse = urllib.request.urlopen(*args, **kwargs) + return resp + except urllib.error.HTTPError as e: + if e.status == 403 and e.headers.get("x-ratelimit-remaining") == "0": + # rate limit + t0 = time.time() + reset_time = t0 + 10 + try: + reset_time = int(e.headers.get("x-ratelimit-reset", 0)) + except ValueError: + pass + reset_time = max(reset_time, t0 + 10) + print(f"rate limit exceeded, retrying after {reset_time - t0:.1f} seconds") + time.sleep(reset_time - t0) + continue + raise + + # 贡献者名字转账号名 def convert_contributors_name(name: str, commit_hash: str, name_type: str): global contributors if name not in contributors: try: - github_info = requests.get(f"https://api.github.com/repos/MaaAssistantArknights/MaaAssistantArknights/commits/{commit_hash}") - userid = json.loads(github_info.text)[name_type]['login'] + req = urllib.request.Request(f"https://api.github.com/repos/MaaAssistantArknights/MaaAssistantArknights/commits/{commit_hash}") + token = os.environ.get("GH_TOKEN", os.environ.get("GITHUB_TOKEN", None)) + if token: + req.add_header("Authorization", f"Bearer {token}") + resp = retry_urlopen(req).read() + print(resp) + userid = json.loads(resp)[name_type]['login'] contributors.update({name: userid}) return userid except Exception as e: diff --git a/tools/OTAPacker/build.sh b/tools/OTAPacker/build.sh index a85ccdc42a..6e6a6b9c48 100755 --- a/tools/OTAPacker/build.sh +++ b/tools/OTAPacker/build.sh @@ -15,32 +15,27 @@ latest_tag=$(head -n 1 "$releases_txt") while read tag; do echo "::group::$tag" - if [ ! -d "$tag"/content ]; then + if [ ! -f "$tag"/MAA-$tag-win-$arch.zip ]; then mkdir -pv "$tag" - cd "$tag" echo "Downloading $tag" gh release download "$tag" --repo $source_repo --pattern "MAA-$tag-win-$arch.zip" --clobber \ || gh release download "$tag" --repo $source_repo_fallback --pattern "MAA-$tag-win-$arch.zip" --clobber \ || { echo "::warning:: win $arch not found in release $tag skipping."; echo "::endgroup::"; continue; } - mkdir -pv 'content' - unzip -q -O GB2312 -o "*.zip" -d 'content' - rm -fv *.zip - cd $working_dir + mv MAA-$tag-win-$arch.zip $tag else - echo "$tag"/content/ already exists + echo "$tag"/MAA-$tag-win-$arch.zip already exists fi if [[ "$tag" == "$latest_tag" ]]; then - cd "$latest_tag"/content/ - find * -type f -exec md5sum '{}' \; > md5sum.txt - cd $working_dir + find "$latest_tag" else - echo "Comparing and installing files $tag...$latest_tag" - mkdir -pv "$tag"/pkg - "$script_dir"/makeota.sh "$tag"/content "$latest_tag"/content "$tag"/pkg - echo "Creating zip archive" - cd "$tag"/pkg - zip -q -9 -r "$working_dir"/"MAAComponent-OTA-${tag}_${latest_tag}-win-$arch.zip" . + "$script_dir"/zipota.sh \ + $tag/MAA-$tag-win-$arch.zip \ + $latest_tag/MAA-$latest_tag-win-$arch.zip \ + "$working_dir"/"MAAComponent-OTA-${tag}_${latest_tag}-win-$arch.zip" + + rm -fv $tag/MAA-$tag-win-$arch.zip + cd $working_dir fi diff --git a/tools/OTAPacker/ziplist.sh b/tools/OTAPacker/ziplist.sh new file mode 100755 index 0000000000..9dff735373 --- /dev/null +++ b/tools/OTAPacker/ziplist.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +zipinfo -O GB2312 -v $1 \ + | sed -n -e '/^Central directory entry/,+3p' -e '/32-bit CRC value (hex):/p' | grep '^ ' \ + | sed -e 's/^ //g' | sed -z 's/\n32-bit CRC value (hex):\s*/\t/g' \ + | awk '{last = $NF; $NF=""; print last,$0}' diff --git a/tools/OTAPacker/zipota.sh b/tools/OTAPacker/zipota.sh new file mode 100755 index 0000000000..d2281fcdf2 --- /dev/null +++ b/tools/OTAPacker/zipota.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +script_dir="$(dirname $(realpath "$0"))" + +from_zip="$1" +to_zip="$2" +out_zip="$3" + +from_list="$("$script_dir"/ziplist.sh "$from_zip" | sort)" +to_list="$("$script_dir"/ziplist.sh "$to_zip" | sort)" + +# files with same name and content +comm_list="$(comm -12 <(echo "$from_list") <(echo "$to_list"))" + +from_fn="$(echo "$from_list" | cut -d\ -f2- | sort)" +to_fn="$(echo "$to_list" | cut -d\ -f2- | sort)" + +cp -v "$to_zip" "$out_zip" + +echo "$comm_list" | cut -d\ -f2- | xargs zip --delete "$out_zip" + +tmpdir=$(mktemp -d /tmp/zipota-files.XXX) + +comm -23 <(echo "$from_fn") <(echo "$to_fn") > "$tmpdir"/removelist.txt +echo "$to_fn" > "$tmpdir"/filelist.txt + +zip -r -j "$out_zip" "$tmpdir"/removelist.txt "$tmpdir"/filelist.txt + +rm -rf $tmpdir