From bd69b76124642d16bd453e13cc9e298df7ed2e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=90=E6=91=86=E7=83=82=E5=92=B8=E9=B1=BC?= <51825113+unknown-o@users.noreply.github.com> Date: Tue, 22 Jul 2025 00:55:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E6=AC=A1=E6=95=B0=E9=99=90=E5=88=B6=E5=92=8C?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BB=93=E6=9E=9Cwebhook=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=20(#1355)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 新增重试上传次数限制 * feat: 新增上传后WebHook设置选项 * feat: 新增上传webhook逻辑 * mod: 将功能配置移至直播配置中的更多设置 * mod: 修改webhook传输的信息 * mod: 修正错误的数据类型 Refactor webhook upload logic and update build configs Replaces the 'uploaded_webhook' field with a 'webhook' postprocessor in the upload workflow, updating both backend and frontend to support this change. Updates the Tauri app to use the correct resource path for the sidecar binary, adjusts process management, and modifies build and workflow scripts for improved compatibility. Also bumps the 'stream-gears' crate version to 1.0.1 and adds '_internal' to .gitignore. Update pyinstaller-publish.yml Fix pyinstaller copy metadata (#1357) * Update tauri.conf.json * Update biliup.spec Update pyinstaller-publish.yml feat: 新增上传重试次数限制和上传结果webhook通知 (#1355) * feat: 新增重试上传次数限制 * feat: 新增上传后WebHook设置选项 * feat: 新增上传webhook逻辑 * mod: 将功能配置移至直播配置中的更多设置 * mod: 修改webhook传输的信息 * mod: 修正错误的数据类型 Refactor webhook upload logic and update build configs Replaces the 'uploaded_webhook' field with a 'webhook' postprocessor in the upload workflow, updating both backend and frontend to support this change. Updates the Tauri app to use the correct resource path for the sidecar binary, adjusts process management, and modifies build and workflow scripts for improved compatibility. Also bumps the 'stream-gears' crate version to 1.0.1 and adds '_internal' to .gitignore. --- .github/workflows/docker-publish.yml | 100 +++++++++++----------- .github/workflows/pyinstaller-publish.yml | 3 +- .gitignore | 3 +- Cargo.lock | 2 +- README.md | 2 +- app/ui/TemplateModal.tsx | 42 +++++---- app/ui/plugins/global.tsx | 12 +++ app/upload-manager/edit/page.tsx | 2 +- biliup.spec | 17 +++- biliup/__init__.py | 3 +- biliup/__main__.py | 13 ++- biliup/app.py | 3 +- biliup/config.py | 1 + biliup/engine/upload.py | 19 ++++ biliup/handler.py | 35 +++++++- crates/stream-gears/Cargo.toml | 2 +- tauri-app/src-tauri/src/lib.rs | 95 ++++++++++---------- tauri-app/src-tauri/tauri.conf.json | 4 +- 18 files changed, 230 insertions(+), 128 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 60485e4..e272a0f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,53 +1,53 @@ -#name: Docker -# -#on: -# push: -# # Publish `master` as Docker `latest` image. -# branches: -# - master -# -# # Publish `v1.2.3` tags as releases. -# tags: -# - v* -# -# # Run tests for any PRs. -# pull_request: -# -#jobs: -# # Run tests. -# # See also https://docs.docker.com/docker-hub/builds/automated-testing/ -# test: -# runs-on: ubuntu-latest -# -# steps: -# - uses: actions/checkout@v2 -# -# - name: Get PR number, repo URL, and branch name -# run: | -# if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then -# pr_number=$(jq -r .number < "$GITHUB_EVENT_PATH") -# repo_url=$(jq -r .pull_request.head.repo.clone_url < "$GITHUB_EVENT_PATH") -# branch_name=$GITHUB_HEAD_REF -# else -# pr_number="" -# repo_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY -# branch_name="master" -# fi -# echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV -# echo "REPO_URL=$repo_url" >> $GITHUB_ENV -# echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV -# -# - name: Run tests -# run: | -# if [ -f docker-compose.test.yml ]; then -# docker-compose --file docker-compose.test.yml build -# docker-compose --file docker-compose.test.yml run sut -# else -# docker build \ -# --build-arg repo_url=$REPO_URL \ -# --build-arg branch_name=$BRANCH_NAME \ -# . --file Dockerfile -# fi +name: Docker + +on: + push: + # Publish `master` as Docker `latest` image. + branches: + - master + + # Publish `v1.2.3` tags as releases. + tags: + - v* + + # Run tests for any PRs. + pull_request: + +jobs: + # Run tests. + # See also https://docs.docker.com/docker-hub/builds/automated-testing/ + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Get PR number, repo URL, and branch name + run: | + if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then + pr_number=$(jq -r .number < "$GITHUB_EVENT_PATH") + repo_url=$(jq -r .pull_request.head.repo.clone_url < "$GITHUB_EVENT_PATH") + branch_name=$GITHUB_HEAD_REF + else + pr_number="" + repo_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY + branch_name="master" + fi + echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV + echo "REPO_URL=$repo_url" >> $GITHUB_ENV + echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV + + - name: Run tests + run: | + if [ -f docker-compose.test.yml ]; then + docker-compose --file docker-compose.test.yml build + docker-compose --file docker-compose.test.yml run sut + else + docker build \ + --build-arg repo_url=$REPO_URL \ + --build-arg branch_name=$BRANCH_NAME \ + . --file Dockerfile + fi # # # # Push image to GitHub Packages. diff --git a/.github/workflows/pyinstaller-publish.yml b/.github/workflows/pyinstaller-publish.yml index 5a69524..e98e831 100644 --- a/.github/workflows/pyinstaller-publish.yml +++ b/.github/workflows/pyinstaller-publish.yml @@ -49,7 +49,8 @@ jobs: echo "Moving $SOURCE_PATH to $DESTINATION_PATH" # 使用PowerShell的Move-Item命令进行移动和重命名 - Move-Item -Path $SOURCE_PATH -Destination $DESTINATION_PATH + #Move-Item -Path $SOURCE_PATH -Destination $DESTINATION_PATH + cp -r dist/bbup/* tauri-app/src-tauri/binaries shell: pwsh # Optionally verify that it works (provided that it does not need user interaction) #- run: ./dist/your-code/your-code diff --git a/.gitignore b/.gitignore index 0895e52..22c0712 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,5 @@ data/ .next out downloads/ -target \ No newline at end of file +target +_internal \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index aa607d8..0f371c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5289,7 +5289,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stream-gears" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "biliup", diff --git a/README.md b/README.md index e477260..ee8a40c 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ ## 📜 使用文档 -- [使用文档 »](https://docs.biliup.me) +- [使用文档 »](https://docs.biliup.rs) ## 🚀 快速开始 diff --git a/app/ui/TemplateModal.tsx b/app/ui/TemplateModal.tsx index 657dd73..52c7cb6 100644 --- a/app/ui/TemplateModal.tsx +++ b/app/ui/TemplateModal.tsx @@ -1,6 +1,7 @@ import { Form, Modal, + Input, Notification, Typography, Collapse, @@ -30,9 +31,9 @@ const TemplateModal: React.FC = ({ children, entity, onOk }) const maskStyle = isOpen ? {} : { - WebkitMaskImage: - 'linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 1) 60%, rgba(0, 0, 0, 0.2) 80%, transparent 100%)', - } + WebkitMaskImage: + 'linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 1) 60%, rgba(0, 0, 0, 0.2) 80%, transparent 100%)', + } const collapsed = (
@@ -44,8 +45,17 @@ const TemplateModal: React.FC = ({ children, entity, onOk }) mv = backup/ 移动文件到backup目录下
run = echo hello! 使用当前运行用户在 shell 执行任意命令, +
+ webhook = url + 不填写则是默认的逻辑,上传失败后重试直至达到最大重试次数 +
+ 填写后,是否上传成功的判断由WebHook给出,但失败最大重试次数仍会被限制(前往空间配置-上传重试次数限制处配置) +
+ 上传任务完成后,会将主播信息、稿件信息、捕获的异常等以post模式发送给WebHook,当WebHook返回success字符串时视为上传成功,执行正常后处理流程,否则返回其他任意内容或请求失败均尝试重新上传 +
注意风险。视频文件路径作为标准输入传入 - {/* TODO: 在这里塞插件仓库 */} +
+ TODO: 在这里塞插件仓库
) const toggle = () => { @@ -176,6 +186,7 @@ const TemplateModal: React.FC = ({ children, entity, onOk }) run(运行) mv(移动到) rm(删除文件) + webhook {api.current?.getValue(field)?.cmd !== 'rm' ? ( = ({ children, entity, onOk }) labelPosition="inset" rules={[{ required: true, message }]} style={{ width: 300, marginRight: 16 }} + placeholder={ api.current?.getValue(field)?.cmd === 'webhook' ? 'https://example.com/notify' : undefined } > ) : null}