Compare commits

...

2 Commits

Author SHA1 Message Date
admin 3fa0674cbb Merge branch 'main' of https://git.viaeon.com/admin/TaskPool-React
Build and Deploy / build-and-push (push) Failing after 5s
2026-07-26 08:44:58 +08:00
admin e6956aa001 Initial commit: TaskPool React panel
- React frontend with route-level code splitting
- Backend rebranded from Baihu to TaskPool
- DB brand migration script and local compatibility
2026-07-26 08:43:52 +08:00
321 changed files with 16876 additions and 3527 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ tmp_dir = "bin"
[build]
args_bin = []
entrypoint = "./bin/baihu"
entrypoint = "./bin/taskpool"
cmd = ":"
full_bin = "go run main.go server"
delay = 1000
+1 -1
View File
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 使用文档
url: https://github.com/engigu/baihu/blob/main/README.md
url: https://github.com/engigu/taskpool/blob/main/README.md
about: 提交 issue 前请先查阅文档。
+1 -1
View File
@@ -14,7 +14,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: baihu
IMAGE_NAME: taskpool
jobs:
build:
+1 -1
View File
@@ -11,7 +11,7 @@ concurrency:
env:
REGISTRY: ghcr.io
IMAGE_NAME: baihu
IMAGE_NAME: taskpool
jobs:
build:
+1 -1
View File
@@ -7,7 +7,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: baihu
IMAGE_NAME: taskpool
jobs:
build:
+1 -1
View File
@@ -13,7 +13,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: baihu
IMAGE_NAME: taskpool
jobs:
build:
+28 -28
View File
@@ -7,7 +7,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: baihu
IMAGE_NAME: taskpool
jobs:
build-binaries:
@@ -38,20 +38,20 @@ jobs:
run: |
VERSION=${{ github.ref_name }}
BUILD_TIME=$(TZ='Asia/Shanghai' date '+%Y/%m/%d %H:%M:%S')
LDFLAGS="-s -w -X 'github.com/engigu/baihu-panel/internal/constant.Version=$VERSION' -X 'github.com/engigu/baihu-panel/internal/constant.BuildTime=$BUILD_TIME'"
LDFLAGS="-s -w -X 'github.com/engigu/taskpool/internal/constant.Version=$VERSION' -X 'github.com/engigu/taskpool/internal/constant.BuildTime=$BUILD_TIME'"
# Prepare static assets for embedding
rm -rf internal/static/dist
cp -r web/dist internal/static/dist
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags web -ldflags="$LDFLAGS" -o baihu-linux-amd64 main.go
tar -czvf baihu-linux-amd64.tar.gz baihu-linux-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags web -ldflags="$LDFLAGS" -o baihu-linux-arm64 main.go
tar -czvf baihu-linux-arm64.tar.gz baihu-linux-arm64
CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -tags web -ldflags="$LDFLAGS" -o baihu-android-arm64 main.go
tar -czvf baihu-android-arm64.tar.gz baihu-android-arm64
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -trimpath -tags web -ldflags="$LDFLAGS" -o baihu-linux-armv7 main.go
tar -czvf baihu-linux-armv7.tar.gz baihu-linux-armv7
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags web -ldflags="$LDFLAGS" -o taskpool-linux-amd64 main.go
tar -czvf taskpool-linux-amd64.tar.gz taskpool-linux-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags web -ldflags="$LDFLAGS" -o taskpool-linux-arm64 main.go
tar -czvf taskpool-linux-arm64.tar.gz taskpool-linux-arm64
CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -tags web -ldflags="$LDFLAGS" -o taskpool-android-arm64 main.go
tar -czvf taskpool-android-arm64.tar.gz taskpool-android-arm64
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -trimpath -tags web -ldflags="$LDFLAGS" -o taskpool-linux-armv7 main.go
tar -czvf taskpool-linux-armv7.tar.gz taskpool-linux-armv7
- name: Build Agent Binaries
run: |
@@ -62,28 +62,28 @@ jobs:
echo "$VERSION" > data/agent/version.txt
# Linux AMD64
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/baihu-agent-linux-amd64 . && cd ..
cd data/agent && cp ../../agent/config.example.ini . && tar -czvf baihu-agent-linux-amd64.tar.gz baihu-agent-linux-amd64 config.example.ini && rm baihu-agent-linux-amd64 && cd ../..
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/taskpool-agent-linux-amd64 . && cd ..
cd data/agent && cp ../../agent/config.example.ini . && tar -czvf taskpool-agent-linux-amd64.tar.gz taskpool-agent-linux-amd64 config.example.ini && rm taskpool-agent-linux-amd64 && cd ../..
# Linux ARM64
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/baihu-agent-linux-arm64 . && cd ..
cd data/agent && tar -czvf baihu-agent-linux-arm64.tar.gz baihu-agent-linux-arm64 config.example.ini && rm baihu-agent-linux-arm64 && cd ../..
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/taskpool-agent-linux-arm64 . && cd ..
cd data/agent && tar -czvf taskpool-agent-linux-arm64.tar.gz taskpool-agent-linux-arm64 config.example.ini && rm taskpool-agent-linux-arm64 && cd ../..
# Windows AMD64
cd agent && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/baihu-agent-windows-amd64.exe . && cd ..
cd data/agent && zip baihu-agent-windows-amd64.zip baihu-agent-windows-amd64.exe config.example.ini && rm baihu-agent-windows-amd64.exe && cd ../..
cd agent && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/taskpool-agent-windows-amd64.exe . && cd ..
cd data/agent && zip taskpool-agent-windows-amd64.zip taskpool-agent-windows-amd64.exe config.example.ini && rm taskpool-agent-windows-amd64.exe && cd ../..
# Darwin AMD64
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/baihu-agent-darwin-amd64 . && cd ..
cd data/agent && tar -czvf baihu-agent-darwin-amd64.tar.gz baihu-agent-darwin-amd64 config.example.ini && rm baihu-agent-darwin-amd64 && cd ../..
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/taskpool-agent-darwin-amd64 . && cd ..
cd data/agent && tar -czvf taskpool-agent-darwin-amd64.tar.gz taskpool-agent-darwin-amd64 config.example.ini && rm taskpool-agent-darwin-amd64 && cd ../..
# Darwin ARM64
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/baihu-agent-darwin-arm64 . && cd ..
cd data/agent && tar -czvf baihu-agent-darwin-arm64.tar.gz baihu-agent-darwin-arm64 config.example.ini && rm baihu-agent-darwin-arm64 && cd ../..
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$AGENT_LDFLAGS" -o ../data/agent/taskpool-agent-darwin-arm64 . && cd ..
cd data/agent && tar -czvf taskpool-agent-darwin-arm64.tar.gz taskpool-agent-darwin-arm64 config.example.ini && rm taskpool-agent-darwin-arm64 && cd ../..
# Android ARM64
cd agent && CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -ldflags="$AGENT_LDFLAGS" -o ../data/agent/baihu-agent-android-arm64 . && cd ..
cd data/agent && tar -czvf baihu-agent-android-arm64.tar.gz baihu-agent-android-arm64 config.example.ini && rm baihu-agent-android-arm64 && cd ../..
cd agent && CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -ldflags="$AGENT_LDFLAGS" -o ../data/agent/taskpool-agent-android-arm64 . && cd ..
cd data/agent && tar -czvf taskpool-agent-android-arm64.tar.gz taskpool-agent-android-arm64 config.example.ini && rm taskpool-agent-android-arm64 && cd ../..
- name: Prepare Release Notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -102,12 +102,12 @@ jobs:
tag_name: ${{ github.ref_name }}
body_path: FINAL_CHANGELOG.md
files: |
baihu-linux-amd64.tar.gz
baihu-linux-arm64.tar.gz
baihu-linux-armv7.tar.gz
baihu-android-arm64.tar.gz
data/agent/baihu-agent-*.tar.gz
data/agent/baihu-agent-*.zip
taskpool-linux-amd64.tar.gz
taskpool-linux-arm64.tar.gz
taskpool-linux-armv7.tar.gz
taskpool-android-arm64.tar.gz
data/agent/taskpool-agent-*.tar.gz
data/agent/taskpool-agent-*.zip
build:
runs-on: ubuntu-latest
+9 -2
View File
@@ -1,5 +1,5 @@
# Binaries
baihu
taskpool
*.exe
*.dll
*.so
@@ -21,7 +21,7 @@ envs/
configs/config.ini
agent/config.ini
agent/agent.pid
agent/baihu-agent
agent/taskpool-agent
web/dist/
web/dev-dist/
@@ -69,3 +69,10 @@ builtin/**/*.pyc
.agents/
# Local secrets / runtime
cookies.txt
debug.log
backend-dev.log
.ref-baihu/
scripts/e2e-check.mjs.bak
+6 -6
View File
@@ -19,15 +19,15 @@
---
> 出于安全及环境隔离考虑,推荐使用 Docker/Compose 部署方式。[镜像地址](https://github.com/engigu/baihu-panel/pkgs/container/baihu)
> 出于安全及环境隔离考虑,推荐使用 Docker/Compose 部署方式。[镜像地址](https://github.com/engigu/taskpool/pkgs/container/taskpool)
### 🐳 方式一:Docker 部署(推荐)
[部署文档](https://github.com/engigu/baihu-panel?tab=readme-ov-file#%E5%BF%AB%E9%80%9F%E9%83%A8%E7%BD%B2)
[部署文档](https://github.com/engigu/taskpool?tab=readme-ov-file#%E5%BF%AB%E9%80%9F%E9%83%A8%E7%BD%B2)
### 🚀 方式二:单文件部署
从当前 Release 的附件中下载对应架构的部署压缩包(如 `baihu-linux-amd64.tar.gz`),然后使用以下命令提取并运行:
从当前 Release 的附件中下载对应架构的部署压缩包(如 `taskpool-linux-amd64.tar.gz`),然后使用以下命令提取并运行:
**⚠️ 重要前置依赖:手动安装 `mise`**
单文件直接运行依赖宿主机系统环境,请务必先安装 [mise](https://mise.jdx.dev/getting-started.html) 供任务调度及环境管理使用:
@@ -38,9 +38,9 @@ export PATH="~/.local/share/mise/bin:~/.local/share/mise/shims:$PATH"
**运行面板:**
```bash
tar -xzvf baihu-linux-amd64.tar.gz
chmod +x baihu-linux-amd64
./baihu-linux-amd64 server
tar -xzvf taskpool-linux-amd64.tar.gz
chmod +x taskpool-linux-amd64
./taskpool-linux-amd64 server
```
---
+14 -14
View File
@@ -1,12 +1,12 @@
# Variables
BINARY=bin/baihu
BINARY=bin/taskpool
GOBUILD=go build
GOCLEAN=go clean
GOGET=go get
GOMOD=go mod
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_TIME=$(shell date '+%Y/%m/%d %H:%M:%S')
LDFLAGS=-ldflags="-s -w -X 'github.com/engigu/baihu-panel/internal/constant.Version=$(VERSION)' -X 'github.com/engigu/baihu-panel/internal/constant.BuildTime=$(BUILD_TIME)'"
LDFLAGS=-ldflags="-s -w -X 'github.com/engigu/taskpool/internal/constant.Version=$(VERSION)' -X 'github.com/engigu/taskpool/internal/constant.BuildTime=$(BUILD_TIME)'"
TAGS_WEB=-tags web
@@ -66,7 +66,7 @@ release-android:
@mkdir -p bin
rm -rf internal/static/dist
cp -r web/dist internal/static/dist
CGO_ENABLED=0 GOOS=android GOARCH=arm64 $(GOBUILD) -trimpath $(LDFLAGS) $(TAGS_WEB) -o bin/baihu-android-arm64 main.go
CGO_ENABLED=0 GOOS=android GOARCH=arm64 $(GOBUILD) -trimpath $(LDFLAGS) $(TAGS_WEB) -o bin/taskpool-android-arm64 main.go
# Build release version (Frontend + Backend with embedded assets)
release-binary:
@@ -82,39 +82,39 @@ build-all: release
# Build agent for all platforms
build-agent: build-agent-linux-amd64 build-agent-linux-arm64 build-agent-android-arm64 build-agent-windows-amd64 build-agent-darwin-amd64 build-agent-darwin-arm64
@echo "All agent packages built in data/agent/"
@ls -lh data/agent/baihu-agent-*
@ls -lh data/agent/taskpool-agent-*
AGENT_LDFLAGS=-s -w -X 'main.Version=$(VERSION)' -X 'main.BuildTime=$(BUILD_TIME)'
build-agent-linux-amd64:
@mkdir -p data/agent
@echo "$(VERSION)" > data/agent/version.txt
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/baihu-agent-linux-amd64 .
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/taskpool-agent-linux-amd64 .
build-agent-linux-arm64:
@mkdir -p data/agent
@echo "$(VERSION)" > data/agent/version.txt
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/baihu-agent-linux-arm64 .
cd agent && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/taskpool-agent-linux-arm64 .
build-agent-android-arm64:
@mkdir -p data/agent
@echo "$(VERSION)" > data/agent/version.txt
cd agent && CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/baihu-agent-android-arm64 .
cd agent && CGO_ENABLED=0 GOOS=android GOARCH=arm64 go build -trimpath -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/taskpool-agent-android-arm64 .
build-agent-windows-amd64:
@mkdir -p data/agent
@echo "$(VERSION)" > data/agent/version.txt
cd agent && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/baihu-agent-windows-amd64.exe .
cd agent && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/taskpool-agent-windows-amd64.exe .
build-agent-darwin-amd64:
@mkdir -p data/agent
@echo "$(VERSION)" > data/agent/version.txt
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/baihu-agent-darwin-amd64 .
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/taskpool-agent-darwin-amd64 .
build-agent-darwin-arm64:
@mkdir -p data/agent
@echo "$(VERSION)" > data/agent/version.txt
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/baihu-agent-darwin-arm64 .
cd agent && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$(AGENT_LDFLAGS)" -o ../data/agent/taskpool-agent-darwin-arm64 .
# Clean built files
clean:
@@ -149,8 +149,8 @@ agent-dev:
# Run agent
agent-run:
@mkdir -p bin
$(GOBUILD) -o bin/baihu-agent ./agent
./bin/baihu-agent run -c ../agent/config.ini
$(GOBUILD) -o bin/taskpool-agent ./agent
./bin/taskpool-agent run -c ../agent/config.ini
# Install dependencies
deps:
@@ -169,11 +169,11 @@ docs-build:
# Docker build
docker-build:
docker build -t baihu:dev -f docker/Dockerfile .
docker build -t taskpool:dev -f docker/Dockerfile .
# Docker run
docker-run:
docker run -p 8052:8052 baihu:dev
docker run -p 8052:8052 taskpool:dev
# Docker compose up
docker-up:
+2 -2
View File
@@ -1,4 +1,4 @@
Baihu Panel (白虎面板)
TaskPool (任务池)
Copyright 2025 engigu
This product includes software developed by engigu.
@@ -12,7 +12,7 @@ redistribution of this Work or Derivative Works thereof must retain
this NOTICE file and the attribution contained within.
YOU MUST NOT REMOVE THE ORIGINAL AUTHOR'S NAME ("engigu"), COPYRIGHT
NOTICES, OR THE PROJECT NAME ("Baihu Panel" / "白虎面板") FROM ANY
NOTICES, OR THE PROJECT NAME ("TaskPool" / "任务池") FROM ANY
PART OF THE SOURCE CODE, UI, OR DOCUMENTATION.
Any derivative work or modified version must include a prominent and
+97 -97
View File
@@ -1,16 +1,16 @@
# 白虎面板
# 任务池
[![Hits](https://hits.sh/github.com/engigu/baihu-panel.svg?view=today-total)](https://hits.sh/github.com/engigu/baihu-panel/)
![Version](https://img.shields.io/github/v/tag/engigu/baihu-panel?color=44cc11&label=docker%20version&sort=semver)
![Image Size](https://ghcr-badge.egpl.dev/engigu/baihu/size?color=%2344cc11&tag=latest&label=docker+image&trim=)
![Image pulls](https://img.shields.io/badge/dynamic/json?url=https://ghcr-badge.elias.eu.org/api/engigu/baihu-panel/baihu&query=downloadCount&style=flat&label=docker%20pulls&color=44cc11)
[![Hits](https://hits.sh/github.com/engigu/taskpool.svg?view=today-total)](https://hits.sh/github.com/engigu/taskpool/)
![Version](https://img.shields.io/github/v/tag/engigu/taskpool?color=44cc11&label=docker%20version&sort=semver)
![Image Size](https://ghcr-badge.egpl.dev/engigu/taskpool/size?color=%2344cc11&tag=latest&label=docker+image&trim=)
![Image pulls](https://img.shields.io/badge/dynamic/json?url=https://ghcr-badge.elias.eu.org/api/engigu/taskpool/taskpool&query=downloadCount&style=flat&label=docker%20pulls&color=44cc11)
白虎面板 (Baihu Panel) 是一款极致轻量、高性能的自动化任务调度平台。采用 Go + Vue3 架构,专注于高性能与低系统开销。通过深度集成 Mise 运行时管理,它原生支持 Python、Node.js、Go、Rust、PHP 等所有主流语言环境的动态安装(几乎所有的版本)与统一依赖管理。支持 Docker/Docker-Compose 一键部署,开箱即用,是您理想的轻量化脚本托管与任务调度解决方案。
任务池 (TaskPool) 是一款极致轻量、高性能的自动化任务调度平台。采用 Go + Vue3 架构,专注于高性能与低系统开销。通过深度集成 Mise 运行时管理,它原生支持 Python、Node.js、Go、Rust、PHP 等所有主流语言环境的动态安装(几乎所有的版本)与统一依赖管理。支持 Docker/Docker-Compose 一键部署,开箱即用,是您理想的轻量化脚本托管与任务调度解决方案。
演示站点(演示站点的服务器比较烂,见谅) [演示站点](https://baihu-demo-site.qwapi.eu.org/)
演示站点(演示站点的服务器比较烂,见谅) [演示站点](https://taskpool-demo-site.qwapi.eu.org/)
文档说明 [文档说明](https://engigu.github.io/baihu-panel/)
文档说明 [文档说明](https://engigu.github.io/taskpool/)
## 更新日志 ☕
@@ -19,7 +19,7 @@
**2026.06.28** - **节点互联与终端 UX**:全面升级节点互联架构(支持变量同步、OpenConnect 协议及同步大屏);优化移动端终端交互,引入 Worker 边界防护防 OOM。
**2026.06.12** - **调度器与资源实时监控**:新增对面板运行资源、并发调度池(Worker)及内存堆栈的实时高频监控指标展示。
**2026.05.29** - **自定义前端 (WebUI)**:新增 WebUI 插件化管理机制,支持上传管理第三方前端包 (`.tar.gz`) 接管内置界面,支持深度主题化定制。详情请看[前端定制说明文档](docs/guide/webui.md)
**2026.04.16** - **内建脚本助手库 (Built-in SDK)**:新增 Python 与 Node.js 的轻量化助手库,实现脚本内 “零代码配置” 通知投递;配套新增 `baihu builtininstall` 自动化安装命令。
**2026.04.16** - **内建脚本助手库 (Built-in SDK)**:新增 Python 与 Node.js 的轻量化助手库,实现脚本内 “零代码配置” 通知投递;配套新增 `taskpool builtininstall` 自动化安装命令。
**2026.04.14** - **PWA 与通知渠道增强**:支持 PWA (Progressive Web App) 动态配置,站点标题与图标可由后端实时控制;新增 **VoceChat** 通知渠道支持;增强 **Bark** 推送,支持自建服务器配置。
**2026.03.27** - **安全机密管理 (GitHub Secrets 风格)**:新增系统级机密(Secret)管理功能。支持 AES-GCM 工业级加密存储,秘钥内存留存销毁;支持执行日志自动脱敏打码;支持仅在计划任务调度时按需注入,终端与测试运行物理隔离,全面提升敏感配置安全性。
**2026.03.19** - **仓库同步增强**:新增对青龙仓库格式指令的深度兼容,支持从远程 Git 仓库自动同步脚本并基于注释解析自动创建面板任务,支持白名单、黑名单、依赖保留等高级筛选特性。
@@ -44,7 +44,7 @@
同样的定时场景和代码,这个项目的情况如下(cpu执行定时跳变不超过`20%`):
![baihu.gif](https://f.pz.al/pzal/2025/12/24/f0d171f9a686d.gif)
![taskpool.gif](https://f.pz.al/pzal/2025/12/24/f0d171f9a686d.gif)
如果项目有用,请帮忙点个star。
@@ -107,7 +107,7 @@
- 严格权限隔离:机密仅在定时任务调度时注入,终端/测试环境不可见
### 节点互联体系 (New)
- 支持 OpenConnect 协议,轻松实现多台白虎面板之间的互联互通
- 支持 OpenConnect 协议,轻松实现多台任务池之间的互联互通
- 支持节点间的环境变量无缝同步(保留原有结构与 ID)
- 集成同步管理控制台,统一查看与控制各节点状态与负载指标
- 底层路由深度适配穿透隧道,完美支持分布式前端代理访问
@@ -133,7 +133,7 @@
<summary><b>点击展开查看已支持的语言及依赖管理详情</b></summary>
### 脚本运行环境
白虎面板原生支持以下脚本的定时执行:
任务池原生支持以下脚本的定时执行:
- **Python3**, **Node.js**, **Bash** (标准版镜像内置环境)
- 通过 **Mise** 扩展:支持几乎所有主流编程语言的动态安装与切换。
- **Minimal 版**:不预置 Python/Node,仅内置 Mise 底座,由用户按需安装。
@@ -168,7 +168,7 @@
## 效果图
![baihu-display.gif](https://raw.githubusercontent.com/engigu/resources/refs/heads/images/baihu-display.gif)
![taskpool-display.gif](https://raw.githubusercontent.com/engigu/resources/refs/heads/images/taskpool-display.gif)
<!-- TODO: 添加效果图 -->
## 快速部署
@@ -203,7 +203,7 @@
```bash
docker run -d \
--name baihu \
--name taskpool \
-p 8052:8052 \
-v $(pwd)/data:/app/data \
-v $(pwd)/envs:/app/envs \
@@ -211,26 +211,26 @@ docker run -d \
-e BH_SERVER_PORT=8052 \
-e BH_SERVER_HOST=0.0.0.0 \
-e BH_DB_TYPE=sqlite \
-e BH_DB_PATH=/app/data/baihu.db \
-e BH_DB_TABLE_PREFIX=baihu_ \
-e BAIHU_SECRET_KEY=your_secret_key_here \
-e BH_DB_PATH=/app/data/taskpool.db \
-e BH_DB_TABLE_PREFIX=taskpool_ \
-e TASKPOOL_SECRET_KEY=your_secret_key_here \
--restart unless-stopped \
ghcr.io/engigu/baihu:latest
ghcr.io/engigu/taskpool:latest
```
> **提示**:如需通过反向代理部署在子路径(如 `/baihu`),添加环境变量:
> **提示**:如需通过反向代理部署在子路径(如 `/taskpool`),添加环境变量:
> ```bash
> -e BH_SERVER_URL_PREFIX=/baihu
> -e BH_SERVER_URL_PREFIX=/taskpool
> ```
> 配置后访问地址为 `http://your-domain.com/baihu/`,详见下方「URL 前缀配置」说明。
> 配置后访问地址为 `http://your-domain.com/taskpool/`,详见下方「URL 前缀配置」说明。
**Docker ComposeSQLite):**
```yaml
services:
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
ports:
- "8052:8052"
volumes:
@@ -241,10 +241,10 @@ services:
- BH_SERVER_PORT=8052
- BH_SERVER_HOST=0.0.0.0
- BH_DB_TYPE=sqlite
- BH_DB_PATH=/app/data/baihu.db
- BH_DB_TABLE_PREFIX=baihu_
- BAIHU_SECRET_KEY=your_secret_key_here
# - BH_SERVER_URL_PREFIX=/baihu # 可选:配置 URL 前缀用于反向代理
- BH_DB_PATH=/app/data/taskpool.db
- BH_DB_TABLE_PREFIX=taskpool_
- TASKPOOL_SECRET_KEY=your_secret_key_here
# - BH_SERVER_URL_PREFIX=/taskpool # 可选:配置 URL 前缀用于反向代理
logging:
driver: json-file
options:
@@ -257,7 +257,7 @@ services:
```bash
docker run -d \
--name baihu \
--name taskpool \
-p 8052:8052 \
-v $(pwd)/data:/app/data \
-v $(pwd)/envs:/app/envs \
@@ -269,22 +269,22 @@ docker run -d \
-e BH_DB_PORT=3306 \
-e BH_DB_USER=root \
-e BH_DB_PASSWORD=your_password \
-e BH_DB_NAME=baihu \
-e BH_DB_TABLE_PREFIX=baihu_ \
-e BAIHU_SECRET_KEY=your_secret_key_here \
-e BH_DB_NAME=taskpool \
-e BH_DB_TABLE_PREFIX=taskpool_ \
-e TASKPOOL_SECRET_KEY=your_secret_key_here \
--restart unless-stopped \
ghcr.io/engigu/baihu:latest
ghcr.io/engigu/taskpool:latest
```
> **提示**:如需配置 URL 前缀,添加 `-e BH_SERVER_URL_PREFIX=/baihu`
> **提示**:如需配置 URL 前缀,添加 `-e BH_SERVER_URL_PREFIX=/taskpool`
**Docker ComposeMySQL):**
```yaml
services:
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
ports:
- "8052:8052"
volumes:
@@ -294,15 +294,15 @@ services:
- TZ=Asia/Shanghai
- BH_SERVER_PORT=8052
- BH_SERVER_HOST=0.0.0.0
# - BH_SERVER_URL_PREFIX=/baihu # 可选:配置 URL 前缀
# - BH_SERVER_URL_PREFIX=/taskpool # 可选:配置 URL 前缀
- BH_DB_TYPE=mysql
- BH_DB_HOST=mysql-server
- BH_DB_PORT=3306
- BH_DB_USER=root
- BH_DB_PASSWORD=your_password
- BH_DB_NAME=baihu
- BH_DB_TABLE_PREFIX=baihu_
- BAIHU_SECRET_KEY=your_secret_key_here
- BH_DB_NAME=taskpool
- BH_DB_TABLE_PREFIX=taskpool_
- TASKPOOL_SECRET_KEY=your_secret_key_here
logging:
driver: json-file
options:
@@ -322,24 +322,24 @@ services:
```bash
docker run -d \
--name baihu \
--name taskpool \
-p 8052:8052 \
-v $(pwd)/data:/app/data \
-v $(pwd)/configs:/app/configs \
-v $(pwd)/envs:/app/envs \
-e TZ=Asia/Shanghai \
-e BAIHU_SECRET_KEY=your_secret_key_here \
-e TASKPOOL_SECRET_KEY=your_secret_key_here \
--restart unless-stopped \
ghcr.io/engigu/baihu:latest
ghcr.io/engigu/taskpool:latest
```
**Docker Compose**
```yaml
services:
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
ports:
- "8052:8052"
volumes:
@@ -348,7 +348,7 @@ services:
- ./envs:/app/envs
environment:
- TZ=Asia/Shanghai
- BAIHU_SECRET_KEY=your_secret_key_here
- TASKPOOL_SECRET_KEY=your_secret_key_here
logging:
driver: json-file
options:
@@ -365,15 +365,15 @@ services:
[server]
port = 8052
host = 0.0.0.0
# 可选:配置 URL 前缀用于反向代理,例如 /baihu
# 可选:配置 URL 前缀用于反向代理,例如 /taskpool
url_prefix =
# 全局会话 Cookie 名称
cookie_name = BHToken
[database]
type = sqlite
path = ./data/baihu.db
table_prefix = baihu_
path = ./data/taskpool.db
table_prefix = taskpool_
```
</details>
@@ -381,11 +381,11 @@ table_prefix = baihu_
<details>
<summary><b>方式三:配合独立中心化消息服务部署(非必需/仅供参考)</b></summary>
> 🎉 **好消息**:自白虎面板最新版本起,系统已**原生内置**了完整强大的消息推送功能!您可直接在面板「消息推送」菜单内绑定十余种主流渠道和系统通知事件,原配合外置的 `Message-Push-Nest` 部署方式已不再是使用面板的基础要求。您可随时直接使用上方的第一种简单命令开箱即用体验。
> 🎉 **好消息**:自任务池最新版本起,系统已**原生内置**了完整强大的消息推送功能!您可直接在面板「消息推送」菜单内绑定十余种主流渠道和系统通知事件,原配合外置的 `Message-Push-Nest` 部署方式已不再是使用面板的基础要求。您可随时直接使用上方的第一种简单命令开箱即用体验。
>
> 以下「白虎 + 消息聚合服务」的联合部署内容被予以保留,专为仍然需要「中心化通知网关」的重度企业解耦用户作为参考:
> 以下「任务池 + 消息聚合服务」的联合部署内容被予以保留,专为仍然需要「中心化通知网关」的重度企业解耦用户作为参考:
白虎面板通过系统集成也可轻松连接独立的消息聚合服务。这里推荐使用 [Message-Push-Nest](https://github.com/engigu/Message-Push-Nest) 作为分布式的统一消息推送中心。
任务池通过系统集成也可轻松连接独立的消息聚合服务。这里推荐使用 [Message-Push-Nest](https://github.com/engigu/Message-Push-Nest) 作为分布式的统一消息推送中心。
**使用 SQLite**
@@ -393,10 +393,10 @@ table_prefix = baihu_
```yaml
services:
# 白虎面板
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
# 任务池
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
ports:
- "8052:8052"
volumes:
@@ -407,9 +407,9 @@ services:
- BH_SERVER_PORT=8052
- BH_SERVER_HOST=0.0.0.0
- BH_DB_TYPE=sqlite
- BH_DB_PATH=/app/data/baihu.db
- BH_DB_TABLE_PREFIX=baihu_
- BAIHU_SECRET_KEY=your_secret_key_here
- BH_DB_PATH=/app/data/taskpool.db
- BH_DB_TABLE_PREFIX=taskpool_
- TASKPOOL_SECRET_KEY=your_secret_key_here
logging:
driver: json-file
options:
@@ -446,10 +446,10 @@ services:
```yaml
services:
# 白虎面板
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
# 任务池
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
ports:
- "8052:8052"
volumes:
@@ -464,9 +464,9 @@ services:
- BH_DB_PORT=3306
- BH_DB_USER=root
- BH_DB_PASSWORD=your_password # 修改为你的 MySQL 密码
- BH_DB_NAME=baihu
- BH_DB_TABLE_PREFIX=baihu_
- BAIHU_SECRET_KEY=your_secret_key_here
- BH_DB_NAME=taskpool
- BH_DB_TABLE_PREFIX=taskpool_
- TASKPOOL_SECRET_KEY=your_secret_key_here
logging:
driver: json-file
options:
@@ -508,15 +508,15 @@ docker-compose up -d
```
**访问地址:**
- 白虎面板http://localhost:8052
- 任务池http://localhost:8052
- 消息推送服务:http://localhost:8053
> 注意:使用 MySQL 方式时,请先在 MySQL 中创建 `baihu` 和 `message_nest` 两个数据库,并修改配置中的 MySQL 地址和密码。也可以使用同一个数据库。
> 注意:使用 MySQL 方式时,请先在 MySQL 中创建 `taskpool` 和 `message_nest` 两个数据库,并修改配置中的 MySQL 地址和密码。也可以使用同一个数据库。
**在任务中使用推送**
如今你无需依赖任何外部服务,可以通过面板自身完成:
1. 进入白虎面板「消息推送」模块,新建你需要通知的渠道。
1. 进入任务池「消息推送」模块,新建你需要通知的渠道。
2. 可以在「事件绑定」中直接设定**自动化系统通知**(如监控任务失败或脚本异常中止时进行自动提醒)。
3. 如需在自己的脚本逻辑内动态推送,可以点击「脚本调用」页面,立刻获取一键调用的 Shell / API 代码,内嵌进你的业务逻辑中即可完成推信!
@@ -533,7 +533,7 @@ docker-compose up -d
<details>
<summary><b>方式四:Nginx 反向代理部署(HTTPS</b></summary>
如果需要通过域名和 HTTPS 访问白虎面板,可以使用 Nginx 作为反向代理。
如果需要通过域名和 HTTPS 访问任务池,可以使用 Nginx 作为反向代理。
**Nginx 配置示例:**
@@ -609,16 +609,16 @@ nginx -t && nginx -s reload
<details>
<summary><b>命令行工具 (CLI)</b></summary>
白虎面板在环境内内置了同名的 `baihu` 命令行工具。如果您在终端内需要执行系统级别的操作,可以使用以下命令:
任务池在环境内内置了同名的 `taskpool` 命令行工具。如果您在终端内需要执行系统级别的操作,可以使用以下命令:
```bash
baihu server # 以前台方式启动面板的后台进程服务(面板启动指令)
baihu reposync # 供定时任务调用,将远程 Git 仓库的高级特性同步到本地目录中
baihu resetpwd # 交互式重置系统 admin 账号密码(密码丢失时可通过进入终端重置)
baihu restore <file> # 使用本地的 .zip 备份压缩包文件,一条命令直接全量恢复系统数据
taskpool server # 以前台方式启动面板的后台进程服务(面板启动指令)
taskpool reposync # 供定时任务调用,将远程 Git 仓库的高级特性同步到本地目录中
taskpool resetpwd # 交互式重置系统 admin 账号密码(密码丢失时可通过进入终端重置)
taskpool restore <file> # 使用本地的 .zip 备份压缩包文件,一条命令直接全量恢复系统数据
```
终端执行 `baihu` 会直接打印内置支持的高级命令帮助列表。
终端执行 `taskpool` 会直接打印内置支持的高级命令帮助列表。
</details>
@@ -626,9 +626,9 @@ baihu restore <file> # 使用本地的 .zip 备份压缩包文件,一条
```
./
├── baihu # 可执行文件
├── taskpool # 可执行文件
├── data/ # 数据目录(自动创建)
│ ├── baihu.db # SQLite 数据库
│ ├── taskpool.db # SQLite 数据库
│ └── scripts/ # 脚本文件存储
├── configs/
│ └── config.ini # 配置文件(自动创建)
@@ -646,7 +646,7 @@ baihu restore <file> # 使用本地的 .zip 备份压缩包文件,一条
- 自动注入 `MISE_DATA_DIR` 等环境变量,确保运行时数据指向持久化目录。
-`mise shims` 路径加入系统 `PATH`,实现 Python、Node.js 等多版本环境的全局无感调用。
4. **依赖管理预设**:默认配置 Python 清华源(PIP)镜像,优化 Node.js 默认内存上限。
5. **启动应用**:运行 `baihu` 面板主进程。
5. **启动应用**:运行 `taskpool` 面板主进程。
> **提示**:通过挂载 `./envs:/app/envs`,您通过面板安装的所有编程语言运行时以及通过「依赖管理」安装的所有第三方库都会永久保留,容器升级或重启后无需重新安装。
@@ -672,7 +672,7 @@ port = 3306
user = root
password =
dbname = bh_panel
table_prefix = baihu_
table_prefix = taskpool_
```
### 环境变量
@@ -691,42 +691,42 @@ table_prefix = baihu_
| `BH_DB_USER` | database.user | 数据库用户 | root |
| `BH_DB_PASSWORD` | database.password | 数据库密码 | - |
| `BH_DB_NAME` | database.dbname | 数据库名称 | bh_panel |
| `BH_DB_PATH` | database.path | SQLite 文件路径 | ./data/baihu.db |
| `BH_DB_TABLE_PREFIX` | database.table_prefix | 表前缀 | baihu_ |
| `BAIHU_SECRET_KEY` | - | 系统加密秘钥,用于机密功能(**注:仅支持环境变量设置,不支持配置文件**) | - |
| `BH_DB_PATH` | database.path | SQLite 文件路径 | ./data/taskpool.db |
| `BH_DB_TABLE_PREFIX` | database.table_prefix | 表前缀 | taskpool_ |
| `TASKPOOL_SECRET_KEY` | - | 系统加密秘钥,用于机密功能(**注:仅支持环境变量设置,不支持配置文件**) | - |
### URL 前缀配置
如果需要通过反向代理(如 Nginx)将白虎面板部署在子路径下,可以配置 URL 前缀。
如果需要通过反向代理(如 Nginx)将任务池部署在子路径下,可以配置 URL 前缀。
**配置方式:**
```bash
# 方式一:配置文件
[server]
url_prefix = /baihu
url_prefix = /taskpool
# 方式二:环境变量
-e BH_SERVER_URL_PREFIX=/baihu
-e BH_SERVER_URL_PREFIX=/taskpool
```
**配置效果:**
配置 `url_prefix = /baihu` 后,访问路径变为:
配置 `url_prefix = /taskpool` 后,访问路径变为:
| 类型 | 路径示例 |
|------|---------|
| 前端页面 | `http://your-domain.com/baihu/` |
| 登录页面 | `http://your-domain.com/baihu/login` |
| 任务管理 | `http://your-domain.com/baihu/tasks` |
| API 接口 | `http://your-domain.com/baihu/api/v1/*` |
| WebSocket | `ws://your-domain.com/baihu/api/v1/terminal/ws` |
| 前端页面 | `http://your-domain.com/taskpool/` |
| 登录页面 | `http://your-domain.com/taskpool/login` |
| 任务管理 | `http://your-domain.com/taskpool/tasks` |
| API 接口 | `http://your-domain.com/taskpool/api/v1/*` |
| WebSocket | `ws://your-domain.com/taskpool/api/v1/terminal/ws` |
**Nginx 反向代理配置示例:**
```nginx
location /baihu/ {
proxy_pass http://localhost:8052/baihu/;
location /taskpool/ {
proxy_pass http://localhost:8052/taskpool/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
@@ -757,7 +757,7 @@ location /baihu/ {
## 免责声明 ⚠️
白虎面板(Baihu Panel)仅作为一个轻量级的任务托管与调度平台,本项目及相关代码**不提供、不内置任何具有实际业务逻辑的第三方脚本**。
任务池(TaskPool)仅作为一个轻量级的任务托管与调度平台,本项目及相关代码**不提供、不内置任何具有实际业务逻辑的第三方脚本**。
在使用本项目时,请您务必知悉并同意以下条款:
+3 -3
View File
@@ -4,9 +4,9 @@ tmp_dir = "bin"
[build]
args_bin = []
bin = "./bin/baihu-agent"
cmd = "go build -o ./bin/baihu-agent ./agent"
full_bin = "./bin/baihu-agent run -c ../agent/config.ini"
bin = "./bin/taskpool-agent"
cmd = "go build -o ./bin/taskpool-agent ./agent"
full_bin = "./bin/taskpool-agent run -c ../agent/config.ini"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata", "web", "data", "envs", "configs", "bin"]
exclude_file = []
+4 -4
View File
@@ -13,10 +13,10 @@ import (
"sync"
"time"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/executor"
"github.com/engigu/baihu-panel/internal/logger"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/executor"
"github.com/engigu/taskpool/internal/logger"
"github.com/engigu/taskpool/internal/utils"
"github.com/gorilla/websocket"
)
+2 -2
View File
@@ -2,8 +2,8 @@
# 主服务器地址(http/httpsAgent 会自动转换为 WebSocket 连接)
# 如果主服务配置了url_prefix, 这里要也要加上路径
server_url = http://192.168.1.100:8052
# 比如 url_prefix=/baihu
; server_url = http://192.168.1.100:8052/baihu
# 比如 url_prefix=/taskpool
; server_url = http://192.168.1.100:8052/taskpool
# Agent 名称(留空则使用主机名)
name =
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"path/filepath"
"strings"
"github.com/engigu/baihu-panel/internal/systime"
"github.com/engigu/taskpool/internal/systime"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"gopkg.in/natefinch/lumberjack.v2"
+11 -11
View File
@@ -13,13 +13,13 @@ import (
"syscall"
"time"
internalLogger "github.com/engigu/baihu-panel/internal/logger"
"github.com/engigu/baihu-panel/internal/systime"
"github.com/engigu/baihu-panel/internal/utils"
internalLogger "github.com/engigu/taskpool/internal/logger"
"github.com/engigu/taskpool/internal/systime"
"github.com/engigu/taskpool/internal/utils"
)
const ServiceName = "baihu-agent"
const ServiceDesc = "Baihu Agent Service"
const ServiceName = "taskpool-agent"
const ServiceDesc = "TaskPool Agent Service"
// 版本信息(通过 ldflags 注入)
var (
@@ -86,7 +86,7 @@ func main() {
case "uninstall":
cmdUninstall()
case "version", "-v", "--version":
fmt.Printf("Baihu Agent v%s\n", Version)
fmt.Printf("TaskPool Agent v%s\n", Version)
if BuildTime != "" {
fmt.Printf("Build Time: %s\n", BuildTime)
}
@@ -102,10 +102,10 @@ func main() {
func printUsage() {
var binName = filepath.Base(os.Args[0])
if binName == "main" || binName == "debug" {
binName = "baihu-agent"
binName = "taskpool-agent"
}
fmt.Printf(`Baihu Agent v%s
fmt.Printf(`TaskPool Agent v%s
用法:
%s <命令> [选项]
@@ -131,7 +131,7 @@ func printUsage() {
%s run
%s stop
%s logs
%s start -c /etc/baihu/config.ini
%s start -c /etc/taskpool/config.ini
%s install
%s status
%s tasks
@@ -192,7 +192,7 @@ func cmdStart() {
config.Name = hostname
}
log.Infof("Baihu Agent Version: %s", Version)
log.Infof("TaskPool Agent Version: %s", Version)
if BuildTime != "" {
log.Infof("构建时间: %s", BuildTime)
}
@@ -259,7 +259,7 @@ func cmdRun() {
config.Name = hostname
}
log.Infof("Baihu Agent Version: %s", Version)
log.Infof("TaskPool Agent Version: %s", Version)
if BuildTime != "" {
log.Infof("构建时间: %s", BuildTime)
}
+2 -2
View File
@@ -58,9 +58,9 @@ func (a *Agent) selfUpdate() {
// 解压并找到二进制文件
var newBinary []byte
binaryName := "baihu-agent"
binaryName := "taskpool-agent"
if runtime.GOOS == "windows" {
binaryName = "baihu-agent.exe"
binaryName = "taskpool-agent.exe"
}
for {
+1 -1
View File
@@ -8,7 +8,7 @@ const { URL } = require('url');
function request(urlStr, method = 'GET', data = null) {
const token = process.env.BHPKG_OPENAPI_TOKEN || process.env.OPENAPI_TOKEN || process.env.BHPKG_NOTIFY_TOKEN;
if (!token) {
throw new Error(`没有正确配置或缺少 BHPKG_OPENAPI_TOKEN 环境变量以使用 env 函数。请在白虎面板的任务设置中配置这些 Key。`);
throw new Error(`没有正确配置或缺少 BHPKG_OPENAPI_TOKEN 环境变量以使用 env 函数。请在任务池的任务设置中配置这些 Key。`);
}
const parsedUrl = new URL(urlStr);
+1 -1
View File
@@ -13,7 +13,7 @@ function notify(title, text, channelId) {
const missing = [];
if (!token) missing.push("BHPKG_NOTIFY_TOKEN");
if (!channel) missing.push("BHPKG_NOTIFY_CHANNEL");
throw new Error(`没有正确配置或缺少 ${missing.join(" 和 ")} 环境变量以使用 notify 函数。请在白虎面板的任务设置中配置这些 Key。`);
throw new Error(`没有正确配置或缺少 ${missing.join(" 和 ")} 环境变量以使用 notify 函数。请在任务池的任务设置中配置这些 Key。`);
}
const notifyUrl = process.env.BHPKG_NOTIFY_URL || 'http://localhost:8052/api/v1/notify/send';
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "baihu",
"name": "taskpool",
"version": "1.0.0",
"description": "Baihu Panel internal helper for Node.js",
"description": "TaskPool internal helper for Node.js",
"main": "index.js",
"license": "MIT"
}
+1 -1
View File
@@ -8,7 +8,7 @@ const { URL } = require('url');
function request(urlStr, method = 'GET', data = null) {
const token = process.env.BHPKG_OPENAPI_TOKEN || process.env.OPENAPI_TOKEN || process.env.BHPKG_NOTIFY_TOKEN;
if (!token) {
throw new Error(`没有正确配置或缺少 BHPKG_OPENAPI_TOKEN 环境变量以使用 task 函数。请在白虎面板的任务设置中配置这些 Key。`);
throw new Error(`没有正确配置或缺少 BHPKG_OPENAPI_TOKEN 环境变量以使用 task 函数。请在任务池的任务设置中配置这些 Key。`);
}
const parsedUrl = new URL(urlStr);
+4 -4
View File
@@ -1,10 +1,10 @@
from setuptools import setup, find_packages
setup(
name='baihu',
name='taskpool',
version='1.0.0',
description='Baihu Panel internal helper for Python',
packages=['baihu'],
package_dir={'baihu': 'baihu'},
description='TaskPool internal helper for Python',
packages=['taskpool'],
package_dir={'taskpool': 'taskpool'},
python_requires='>=3.6',
)
+56
View File
@@ -0,0 +1,56 @@
import os
from .notify import notify as _notify
from .env import (
get_envs,
get_env,
add_envs,
add_env,
update_env,
delete_envs,
delete_env
)
from .task import (
get_tasks,
get_task,
update_task,
delete_task,
execute_task,
stop_task,
get_last_results
)
def notify(title, text):
"""
发送内建通知。
会在调用时校验环境变量:BHPKG_NOTIFY_TOKEN, BHPKG_NOTIFY_CHANNEL
"""
_TOKEN = os.environ.get("BHPKG_NOTIFY_TOKEN")
_CHANNEL = os.environ.get("BHPKG_NOTIFY_CHANNEL")
if not _TOKEN or not _CHANNEL:
missing = []
if not _TOKEN: missing.append("BHPKG_NOTIFY_TOKEN")
if not _CHANNEL: missing.append("BHPKG_NOTIFY_CHANNEL")
error_msg = f"缺少必要的环境变量以使用 taskpool 模块: {', '.join(missing)}。请在任务池的任务设置中配置指定的 Key。"
raise RuntimeError(error_msg)
return _notify(title, text)
__all__ = [
'notify',
'get_envs',
'get_env',
'add_envs',
'add_env',
'update_env',
'delete_envs',
'delete_env',
'get_tasks',
'get_task',
'update_task',
'delete_task',
'execute_task',
'stop_task',
'get_last_results'
]
+133
View File
@@ -0,0 +1,133 @@
import os
import json
import urllib.request
import urllib.error
def _get_headers():
token = os.environ.get("BHPKG_OPENAPI_TOKEN") or os.environ.get("OPENAPI_TOKEN") or os.environ.get("BHPKG_NOTIFY_TOKEN")
if not token:
raise RuntimeError("没有正确配置或缺少 BHPKG_OPENAPI_TOKEN 环境变量以使用 env 函数。请在任务池的任务设置中配置这些 Key。")
return {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}"
}
def _get_envs_url():
url = os.environ.get("BHPKG_OPENAPI_URL") or os.environ.get("OPENAPI_URL")
if url:
return url
notify_url = os.environ.get("BHPKG_NOTIFY_URL", "http://localhost:8052/api/v1/notify/send")
for target in ["/api/v1/notify/send/", "/api/v1/notify/send", "/api/v1/notify/", "/api/v1/notify"]:
if target in notify_url:
return notify_url.replace(target, "/open2api/v1/env")
return "http://localhost:8052/open2api/v1/env"
def _request(url, method="GET", data=None):
headers = _get_headers()
payload = None
if data is not None:
payload = json.dumps(data).encode("utf-8")
req = urllib.request.Request(url, data=payload, headers=headers, method=method)
try:
with urllib.request.urlopen(req) as resp:
body = resp.read().decode("utf-8")
if not body:
return {}
parsed = json.loads(body)
if isinstance(parsed, dict) and parsed.get("code") is not None and parsed.get("code") != 200:
msg = parsed.get("msg") or parsed.get("message") or "未知错误"
raise RuntimeError(f"请求失败 [{parsed.get('code')}]: {msg}")
return parsed
except urllib.error.HTTPError as e:
err_body = e.read().decode("utf-8")
try:
err_json = json.loads(err_body)
msg = err_json.get("msg") or err_json.get("message") or err_body
except Exception:
msg = err_body
raise RuntimeError(f"请求失败 [{e.code}]: {msg}")
except Exception as e:
raise RuntimeError(f"请求发生异常: {e}")
def get_envs():
"""
获取所有的环境变量列表。
"""
url = f"{_get_envs_url()}/all"
res = _request(url, "GET")
return res.get("data", [])
def get_env(name):
"""
根据变量名获取环境变量。如果不存在则返回 None。
"""
envs = get_envs()
for env in envs:
if env.get("name") == name:
return env
return None
def add_envs(envs_list):
"""
批量添加环境变量。
envs_list: 包含环境变量字典的列表,如 [{"name": "KEY", "value": "VAL", "remark": "备注"}]
"""
url = _get_envs_url()
added_envs = []
for env in envs_list:
if "name" not in env or "value" not in env:
raise ValueError("环境变量必须包含 'name''value'")
res = _request(url, "POST", env)
if "data" in res:
added_envs.append(res["data"])
return added_envs
def add_env(name, value, remark="", type="normal", hidden=True, enabled=True):
"""
添加单个环境变量。
"""
url = _get_envs_url()
payload = {
"name": name,
"value": value,
"remark": remark,
"type": type,
"hidden": hidden,
"enabled": enabled
}
res = _request(url, "POST", payload)
return res.get("data")
def update_env(id, name, value, remark=None, type=None, hidden=None, enabled=None):
"""
根据 ID 更新环境变量。
"""
url = f"{_get_envs_url()}/{id}"
payload = {}
if name is not None: payload["name"] = name
if value is not None: payload["value"] = value
if remark is not None: payload["remark"] = remark
if type is not None: payload["type"] = type
if hidden is not None: payload["hidden"] = hidden
if enabled is not None: payload["enabled"] = enabled
res = _request(url, "PUT", payload)
return res.get("data")
def delete_envs(ids):
"""
批量删除环境变量。
"""
for fid in ids:
delete_env(fid)
def delete_env(id):
"""
根据 ID 删除指定的环境变量。
"""
url = f"{_get_envs_url()}/{id}"
_request(url, "DELETE")
return True
+32
View File
@@ -0,0 +1,32 @@
import os
import json
import urllib.request
def notify(title, text, channel_id=None):
"""
发送内建通知。
"""
token = os.environ.get("BHPKG_NOTIFY_TOKEN")
url = os.environ.get("BHPKG_NOTIFY_URL", "http://localhost:8052/api/v1/notify/send")
default_channel = os.environ.get("BHPKG_NOTIFY_CHANNEL")
cid = channel_id or default_channel
if not url or not token or not cid:
return
payload = {
"channel_id": cid,
"title": title,
"text": text
}
data = json.dumps(payload).encode('utf-8')
req = urllib.request.Request(url, data=data, method='POST')
req.add_header('Content-Type', 'application/json')
req.add_header('notify-token', token)
with urllib.request.urlopen(req) as resp:
return resp.read().decode('utf-8')
+128
View File
@@ -0,0 +1,128 @@
import os
import json
import urllib.request
import urllib.error
def _get_headers():
token = os.environ.get("BHPKG_OPENAPI_TOKEN") or os.environ.get("OPENAPI_TOKEN") or os.environ.get("BHPKG_NOTIFY_TOKEN")
if not token:
raise RuntimeError("没有正确配置或缺少 BHPKG_OPENAPI_TOKEN 环境变量以使用 task 函数。请在任务池的任务设置中配置这些 Key。")
return {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}"
}
def _get_base_url():
url = os.environ.get("BHPKG_OPENAPI_URL") or os.environ.get("OPENAPI_URL")
if url:
# If openapi_url ends with /env, replace it with nothing or use base
if url.endswith("/env"):
return url[:-4]
elif url.endswith("/env/"):
return url[:-5]
return url
notify_url = os.environ.get("BHPKG_NOTIFY_URL", "http://localhost:8052/api/v1/notify/send")
for target in ["/api/v1/notify/send/", "/api/v1/notify/send", "/api/v1/notify/", "/api/v1/notify"]:
if target in notify_url:
return notify_url.replace(target, "/open2api/v1")
return "http://localhost:8052/open2api/v1"
def _request(url, method="GET", data=None):
headers = _get_headers()
payload = None
if data is not None:
payload = json.dumps(data).encode("utf-8")
req = urllib.request.Request(url, data=payload, headers=headers, method=method)
try:
with urllib.request.urlopen(req) as resp:
body = resp.read().decode("utf-8")
if not body:
return {}
parsed = json.loads(body)
if isinstance(parsed, dict) and parsed.get("code") is not None and parsed.get("code") != 200:
msg = parsed.get("msg") or parsed.get("message") or "未知错误"
raise RuntimeError(f"请求失败 [{parsed.get('code')}]: {msg}")
return parsed
except urllib.error.HTTPError as e:
err_body = e.read().decode("utf-8")
try:
err_json = json.loads(err_body)
msg = err_json.get("msg") or err_json.get("message") or err_body
except Exception:
msg = err_body
raise RuntimeError(f"请求失败 [{e.code}]: {msg}")
except Exception as e:
raise RuntimeError(f"请求发生异常: {e}")
def get_tasks():
"""
获取全部任务列表。
"""
url = f"{_get_base_url()}/tasks"
res = _request(url, "GET")
return res.get("data", [])
def get_task(id):
"""
根据 ID 获取单个任务的详细信息。
"""
url = f"{_get_base_url()}/tasks/{id}"
res = _request(url, "GET")
return res.get("data")
def update_task(id, name=None, command=None, remark=None, pin_type=None, trigger_type=None, schedule=None, timeout=None, work_dir=None, retry_count=None, retry_interval=None, random_range=None, enabled=None):
"""
根据 ID 更新任务。
"""
url = f"{_get_base_url()}/tasks/{id}"
payload = {}
if name is not None: payload["name"] = name
if command is not None: payload["command"] = command
if remark is not None: payload["remark"] = remark
if pin_type is not None: payload["pin_type"] = pin_type
if trigger_type is not None: payload["trigger_type"] = trigger_type
if schedule is not None: payload["schedule"] = schedule
if timeout is not None: payload["timeout"] = timeout
if work_dir is not None: payload["work_dir"] = work_dir
if retry_count is not None: payload["retry_count"] = retry_count
if retry_interval is not None: payload["retry_interval"] = retry_interval
if random_range is not None: payload["random_range"] = random_range
if enabled is not None: payload["enabled"] = enabled
res = _request(url, "PUT", payload)
return res.get("data")
def delete_task(id):
"""
根据 ID 删除指定任务。
"""
url = f"{_get_base_url()}/tasks/{id}"
_request(url, "DELETE")
return True
def execute_task(id):
"""
触发执行特定任务。
"""
url = f"{_get_base_url()}/execute/task/{id}"
res = _request(url, "POST")
return res.get("data")
def stop_task(log_id):
"""
根据日志 ID 停止正在运行的任务。
"""
url = f"{_get_base_url()}/tasks/stop/{log_id}"
res = _request(url, "POST")
return res.get("data")
def get_last_results():
"""
获取最近的执行结果列表。
"""
url = f"{_get_base_url()}/execute/results"
res = _request(url, "GET")
return res.get("data", [])
+3 -3
View File
@@ -8,12 +8,12 @@ import (
"path/filepath"
"runtime"
"github.com/engigu/baihu-panel/cmd/clibase"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/cmd/clibase"
"github.com/engigu/taskpool/internal/utils"
)
func printHelp() {
clibase.PrintSubCommandUsage("白虎面板内建依赖安装工具", "baihu builtininstall", "", nil)
clibase.PrintSubCommandUsage("任务池内建依赖安装工具", "taskpool builtininstall", "", nil)
}
// Run 执行内建包安装逻辑
+3 -3
View File
@@ -6,8 +6,8 @@ import (
"os"
"strings"
"github.com/engigu/baihu-panel/internal/bootstrap"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/taskpool/internal/bootstrap"
"github.com/engigu/taskpool/internal/services"
)
// InitContext 统一封装命令行所需的初始化上下文逻辑
@@ -26,7 +26,7 @@ func InitContext(requireSettings bool) error {
func PrintDBConfigHint(commandExample string) {
fmt.Println(">> 提示: 程序当前可能连接到了默认的空 SQLite 数据库。")
fmt.Println(">> 若您的生产环境使用的是 MySQL 或指定路径配置,请在执行命令时携带配置文件路径环境变量,例如:")
fmt.Printf(">> BH_CONFIG_PATH=/app/data/config.ini baihu %s\n", commandExample)
fmt.Printf(">> BH_CONFIG_PATH=/app/data/config.ini taskpool %s\n", commandExample)
}
// PrintSubCommandUsage 打印一致风格的子程序帮助信息
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"strings"
"github.com/engigu/baihu-panel/internal/bootstrap"
"github.com/engigu/taskpool/internal/bootstrap"
)
// CallInternalAPI 封装底层进程间 HTTP 通信,统一处理网络连接错误及业务级异常提取
+9 -9
View File
@@ -1,15 +1,15 @@
package cmd
import (
"github.com/engigu/baihu-panel/cmd/builtininstall"
"github.com/engigu/baihu-panel/cmd/depinstall"
"github.com/engigu/baihu-panel/cmd/reposync"
"github.com/engigu/baihu-panel/cmd/resetpwd"
"github.com/engigu/baihu-panel/cmd/restore"
"github.com/engigu/baihu-panel/cmd/task"
"github.com/engigu/baihu-panel/cmd/version"
"github.com/engigu/baihu-panel/cmd/webui"
// "github.com/engigu/baihu-panel/cmd/migrate"
"github.com/engigu/taskpool/cmd/builtininstall"
"github.com/engigu/taskpool/cmd/depinstall"
"github.com/engigu/taskpool/cmd/reposync"
"github.com/engigu/taskpool/cmd/resetpwd"
"github.com/engigu/taskpool/cmd/restore"
"github.com/engigu/taskpool/cmd/task"
"github.com/engigu/taskpool/cmd/version"
"github.com/engigu/taskpool/cmd/webui"
// "github.com/engigu/taskpool/cmd/migrate"
)
// CommandHandler 定义命令执行函数
+7 -7
View File
@@ -6,18 +6,18 @@ import (
"os"
"strings"
"github.com/engigu/baihu-panel/cmd/clibase"
"github.com/engigu/baihu-panel/internal/database"
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/services/deps"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/cmd/clibase"
"github.com/engigu/taskpool/internal/database"
"github.com/engigu/taskpool/internal/models"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/services/deps"
"github.com/engigu/taskpool/internal/utils"
)
// Run 依赖自动补全命令入口
func Run(args []string) {
if len(args) == 0 {
fmt.Println("用法: baihu depinstall <log_id>")
fmt.Println("用法: taskpool depinstall <log_id>")
return
}
+2 -2
View File
@@ -2,8 +2,8 @@ package migrate
import (
"fmt"
"github.com/engigu/baihu-panel/internal/bootstrap"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/taskpool/internal/bootstrap"
"github.com/engigu/taskpool/internal/services"
)
func Run(args []string) {
+9 -9
View File
@@ -12,10 +12,10 @@ import (
"strings"
"time"
"github.com/engigu/baihu-panel/cmd/clibase"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/services/repo"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/cmd/clibase"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/services/repo"
"github.com/engigu/taskpool/internal/utils"
)
type Config struct {
@@ -70,13 +70,13 @@ func Run(args []string) {
fs.StringVar(&cfg.RepoName, "repo-name", "", "Custom repository directory name")
printHelp := func() {
fmt.Fprintf(os.Stderr, "\n白虎面板仓库同步工具 (Reposync)\n\n")
fmt.Fprintf(os.Stderr, "\n任务池仓库同步工具 (Reposync)\n\n")
fmt.Fprintf(os.Stderr, "用法:\n")
fmt.Fprintf(os.Stderr, " baihu reposync [参数]\n\n")
fmt.Fprintf(os.Stderr, " taskpool reposync [参数]\n\n")
fmt.Fprintf(os.Stderr, "参数详情:\n")
fs.PrintDefaults()
fmt.Fprintf(os.Stderr, "\n示例:\n")
fmt.Fprintf(os.Stderr, " baihu reposync --source-url https://github.com/xxx/repo.git --target-path $SCRIPTS_DIR$/repo1\n\n")
fmt.Fprintf(os.Stderr, " taskpool reposync --source-url https://github.com/xxx/repo.git --target-path $SCRIPTS_DIR$/repo1\n\n")
}
if len(args) > 0 && (args[0] == "-h" || args[0] == "--help") {
@@ -513,7 +513,7 @@ func preserve(baseDir string, paths string) func() {
preservedList := strings.Split(paths, ",")
// 优化:将临时目录创建在 baseDir 同一级或内部,确保在同一个文件系统,使得 Rename 是 O(1) 瞬时完成的
tmpParent, err := os.MkdirTemp(baseDir, ".baihu_sync_preserve_*")
tmpParent, err := os.MkdirTemp(baseDir, ".taskpool_sync_preserve_*")
if err != nil {
fmt.Printf("警告: 无法在目标目录创建临时目录用于保留文件: %v\n", err)
return func() {}
@@ -548,7 +548,7 @@ func preserve(baseDir string, paths string) func() {
for _, fullPath := range matches {
relPath, err := filepath.Rel(baseDir, fullPath)
// 同时要排除掉临时目录本身以及上级路径
if err != nil || strings.HasPrefix(relPath, "..") || relPath == "." || strings.HasPrefix(relPath, ".baihu_sync_preserve") {
if err != nil || strings.HasPrefix(relPath, "..") || relPath == "." || strings.HasPrefix(relPath, ".taskpool_sync_preserve") {
continue
}
+4 -4
View File
@@ -7,13 +7,13 @@ import (
"os"
"strings"
"github.com/engigu/baihu-panel/cmd/clibase"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/cmd/clibase"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/utils"
)
func printHelp() {
clibase.PrintSubCommandUsage("白虎面板用户密码重置工具", "baihu resetpwd [用户名]", " baihu resetpwd admin", nil)
clibase.PrintSubCommandUsage("任务池用户密码重置工具", "taskpool resetpwd [用户名]", " taskpool resetpwd admin", nil)
}
func Run(args []string) {
+3 -3
View File
@@ -6,12 +6,12 @@ import (
"os"
"path/filepath"
"github.com/engigu/baihu-panel/cmd/clibase"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/taskpool/cmd/clibase"
"github.com/engigu/taskpool/internal/services"
)
func printHelp() {
clibase.PrintSubCommandUsage("白虎面板系统数据恢复工具", "baihu restore <备份文件.zip>", " baihu restore backup_20231027.zip", nil)
clibase.PrintSubCommandUsage("任务池系统数据恢复工具", "taskpool restore <备份文件.zip>", " taskpool restore backup_20231027.zip", nil)
}
func Run(args []string) {
+15 -15
View File
@@ -6,21 +6,21 @@ import (
"os"
"strings"
"github.com/engigu/baihu-panel/cmd/clibase"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/database"
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/cmd/clibase"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/database"
"github.com/engigu/taskpool/internal/models"
"github.com/engigu/taskpool/internal/utils"
)
// 打印主帮助
func printMainHelp() {
fmt.Fprintf(os.Stderr, "\n白虎面板任务命令行管理工具 (Task CLI)\n\n")
fmt.Fprintf(os.Stderr, "\n任务池任务命令行管理工具 (Task CLI)\n\n")
fmt.Fprintf(os.Stderr, "说明:\n")
fmt.Fprintf(os.Stderr, " 本工具原生兼容管理普通任务 (task) 与仓库同步任务 (repo)。\n")
fmt.Fprintf(os.Stderr, " 操作目标支持传入精确任务ID、任务名称模糊/精准查找,或使用快捷字面量 'repo' 一键操作主力仓库。\n\n")
fmt.Fprintf(os.Stderr, "用法:\n")
fmt.Fprintf(os.Stderr, " baihu task <子命令> [参数]\n\n")
fmt.Fprintf(os.Stderr, " taskpool task <子命令> [参数]\n\n")
fmt.Fprintf(os.Stderr, "可用子命令:\n")
fmt.Fprintf(os.Stderr, " list 查询并输出任务列表\n")
fmt.Fprintf(os.Stderr, " run 手动立即触发执行指定的任务或仓库\n")
@@ -28,7 +28,7 @@ func printMainHelp() {
fmt.Fprintf(os.Stderr, " disable 禁用指定的任务或仓库(同步从后台调度队列摘除)\n")
fmt.Fprintf(os.Stderr, " status 查看指定任务或仓库最近一次执行的完整输出与状态\n")
fmt.Fprintf(os.Stderr, " history 查看指定任务或仓库近期的多次执行流水记录\n\n")
fmt.Fprintf(os.Stderr, "使用 'baihu task <子命令> --help' 查看具体子命令的参数说明和示例。\n\n")
fmt.Fprintf(os.Stderr, "使用 'taskpool task <子命令> --help' 查看具体子命令的参数说明和示例。\n\n")
}
// resolveTaskID 智能解析目标任务ID:支持直接传入真实ID、任务名称,或传入 "repo" 快捷操作系统中唯一的仓库同步任务
@@ -109,7 +109,7 @@ func runList(args []string) {
sizePtr := fs.Int("size", 20, "每页展示条数")
fs.Usage = func() {
clibase.PrintSubCommandUsage("白虎面板任务列表查询工具", "baihu task list [参数]", " baihu task list\n baihu task list -page 2 -size 10\n baihu task list -name \"签到\"", fs)
clibase.PrintSubCommandUsage("任务池任务列表查询工具", "taskpool task list [参数]", " taskpool task list\n taskpool task list -page 2 -size 10\n taskpool task list -name \"签到\"", fs)
}
if err := fs.Parse(args); err != nil {
@@ -174,7 +174,7 @@ func runList(args []string) {
func runExecute(args []string) {
fs := flag.NewFlagSet("run", flag.ExitOnError)
fs.Usage = func() {
clibase.PrintSubCommandUsage("白虎面板手动任务触发工具", "baihu task run <任务ID/名称/repo>", " baihu task run a1b2c3d4\n baihu task run \"自动签到\"\n baihu task run repo", nil)
clibase.PrintSubCommandUsage("任务池手动任务触发工具", "taskpool task run <任务ID/名称/repo>", " taskpool task run a1b2c3d4\n taskpool task run \"自动签到\"\n taskpool task run repo", nil)
}
if err := fs.Parse(args); err != nil {
@@ -199,7 +199,7 @@ func runExecute(args []string) {
}
fmt.Printf(">> 任务 [%s] 触发指令下发成功!已进入后台调度队列排队或执行。\n", taskID)
fmt.Printf(">> 提示: 可以使用 'baihu task status %s' 查看近期执行输出。\n", taskID)
fmt.Printf(">> 提示: 可以使用 'taskpool task status %s' 查看近期执行输出。\n", taskID)
}
func runToggle(action string, args []string) {
@@ -212,7 +212,7 @@ func runToggle(action string, args []string) {
}
fs.Usage = func() {
clibase.PrintSubCommandUsage(fmt.Sprintf("白虎面板任务%s工具", actionName), fmt.Sprintf("baihu task %s <任务ID/名称/repo>", action), fmt.Sprintf(" baihu task %s a1b2c3d4\n baihu task %s repo", action, action), nil)
clibase.PrintSubCommandUsage(fmt.Sprintf("任务池任务%s工具", actionName), fmt.Sprintf("taskpool task %s <任务ID/名称/repo>", action), fmt.Sprintf(" taskpool task %s a1b2c3d4\n taskpool task %s repo", action, action), nil)
}
if err := fs.Parse(args); err != nil {
@@ -244,7 +244,7 @@ func runToggle(action string, args []string) {
func runStatus(args []string) {
fs := flag.NewFlagSet("status", flag.ExitOnError)
fs.Usage = func() {
clibase.PrintSubCommandUsage("白虎面板任务执行状态与日志查看工具", "baihu task status <任务ID/名称/repo> [日志ID]", " baihu task status a1b2c3d4\n baihu task status repo\n baihu task status \"自动签到\"", nil)
clibase.PrintSubCommandUsage("任务池任务执行状态与日志查看工具", "taskpool task status <任务ID/名称/repo> [日志ID]", " taskpool task status a1b2c3d4\n taskpool task status repo\n taskpool task status \"自动签到\"", nil)
}
if err := fs.Parse(args); err != nil {
@@ -334,7 +334,7 @@ func runHistory(args []string) {
limitPtr := fs.Int("limit", 10, "展示的最近历史记录条数")
fs.Usage = func() {
clibase.PrintSubCommandUsage("白虎面板任务执行历史查看工具", "baihu task history <任务ID/名称/repo> [参数]", " baihu task history a1b2c3d4\n baihu task history repo\n baihu task history repo -limit 20", fs)
clibase.PrintSubCommandUsage("任务池任务执行历史查看工具", "taskpool task history <任务ID/名称/repo> [参数]", " taskpool task history a1b2c3d4\n taskpool task history repo\n taskpool task history repo -limit 20", fs)
}
if err := fs.Parse(args); err != nil {
@@ -394,5 +394,5 @@ func runHistory(args []string) {
}
}
fmt.Println("====================================================================================================")
fmt.Printf("提示: 结合命令 'baihu task status %s <日志ID>' 查看特定历史日志内容。\n", taskID)
fmt.Printf("提示: 结合命令 'taskpool task status %s <日志ID>' 查看特定历史日志内容。\n", taskID)
}
+2 -2
View File
@@ -3,9 +3,9 @@ package version
import (
"fmt"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/taskpool/internal/constant"
)
func Run(args []string) {
fmt.Printf("baihu-panel %s (Build time: %s)\n", constant.Version, constant.BuildTime)
fmt.Printf("taskpool %s (Build time: %s)\n", constant.Version, constant.BuildTime)
}
+6 -6
View File
@@ -5,14 +5,14 @@ import (
"os"
"strings"
"github.com/engigu/baihu-panel/cmd/clibase"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/taskpool/cmd/clibase"
"github.com/engigu/taskpool/internal/services"
)
func printMainHelp() {
fmt.Fprintf(os.Stderr, "\n白虎面板 WebUI 命令行管理工具\n\n")
fmt.Fprintf(os.Stderr, "\n任务池 WebUI 命令行管理工具\n\n")
fmt.Fprintf(os.Stderr, "用法:\n")
fmt.Fprintf(os.Stderr, " baihu webui <子命令> [参数]\n\n")
fmt.Fprintf(os.Stderr, " taskpool webui <子命令> [参数]\n\n")
fmt.Fprintf(os.Stderr, "可用子命令:\n")
fmt.Fprintf(os.Stderr, " list 列出当前安装的所有前端资源包\n")
fmt.Fprintf(os.Stderr, " set 设置激活指定的 WebUI\n")
@@ -93,7 +93,7 @@ func runList(args []string) {
func runSet(args []string) {
if len(args) < 1 {
fmt.Fprintf(os.Stderr, "错误: 缺少目标 WebUI 名称。\n用法: baihu webui set <name>\n")
fmt.Fprintf(os.Stderr, "错误: 缺少目标 WebUI 名称。\n用法: taskpool webui set <name>\n")
return
}
name := args[0]
@@ -118,7 +118,7 @@ func runReset(args []string) {
func runDelete(args []string) {
if len(args) < 1 {
fmt.Fprintf(os.Stderr, "错误: 缺少目标 WebUI 名称。\n用法: baihu webui delete <name>\n")
fmt.Fprintf(os.Stderr, "错误: 缺少目标 WebUI 名称。\n用法: taskpool webui delete <name>\n")
return
}
name := args[0]
+5 -5
View File
@@ -3,8 +3,8 @@
port = 8052
# 服务监听地址
host = 0.0.0.0
# URL前缀,例如 /baihu,留空则无前缀
# 配置后:前端路径为 /baihu/*,后端API路径为 /baihu/api/v1/*
# URL前缀,例如 /taskpool,留空则无前缀
# 配置后:前端路径为 /taskpool/*,后端API路径为 /taskpool/api/v1/*
url_prefix =
# 全局会话 Cookie 名称
cookie_name = BHToken
@@ -21,15 +21,15 @@ user = root
# 数据库密码
password =
# 数据库名称
dbname = baihu
dbname = taskpool
# 数据库文件路径 (仅 sqlite)
path = data/baihu.db
path = data/taskpool.db
# 数据库 DSN (仅 mysql/postgres, 如果设置则优先使用。注意:需同时将 type 设置为 mysql 或 postgres)
# 例如 (MySQL): user:password@unix(/var/run/mysqld/mysqld.sock)/dbname?charset=utf8mb4&parseTime=True&loc=Local
# 例如 (Postgres): postgres://user:password@localhost:5432/dbname?sslmode=disable
dsn =
# 表前缀
table_prefix = baihu_
table_prefix = taskpool_
# SSL 模式 (仅 mysql/postgres): postgres 支持 disable/require/verify-ca/verify-full; mysql 支持 true/skip-verify
# ssl_mode = disable
+4 -4
View File
@@ -1,7 +1,7 @@
[server]
port = 8055
host = 0.0.0.0
; url_prefix = /baihu
; url_prefix = /taskpool
message_server = http://message-nest-demo-site.qwapi.eu.org/
pprof_enabled=true
@@ -13,9 +13,9 @@ host = app.engigu.cn
port = 33066
user = root
password = Gq19940507+****+
dbname = baihu-test2
table_prefix = baihu_
dbname = taskpool-test2
table_prefix = taskpool_
; debug = true
[security]
secret = baihu_secret_key_change_me
secret = taskpool_secret_key_change_me
+10 -10
View File
@@ -1,16 +1,16 @@
services:
baihu-dev:
taskpool-dev:
build:
context: .
dockerfile: docker/Dockerfile.dev
container_name: baihu-dev
container_name: taskpool-dev
ports:
- "8052:8052"
- "5173:5173"
volumes:
- .:/app:Z
- baihu-envs:/app/envs
- baihu-node-modules:/app/web/node_modules
- taskpool-envs:/app/envs
- taskpool-node-modules:/app/web/node_modules
- go-path:/go
- npm-cache:/var/cache/npm
environment:
@@ -22,11 +22,11 @@ services:
tty: true
volumes:
baihu-envs:
name: baihu_dev_envs
baihu-node-modules:
name: baihu_dev_node_modules
taskpool-envs:
name: taskpool_dev_envs
taskpool-node-modules:
name: taskpool_dev_node_modules
go-path:
name: baihu_dev_go_path
name: taskpool_dev_go_path
npm-cache:
name: baihu_dev_npm_cache
name: taskpool_dev_npm_cache
+5 -5
View File
@@ -1,9 +1,9 @@
services:
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
ports:
- "8052:8052"
volumes:
@@ -20,7 +20,7 @@ services:
# - BH_DB_PORT=3306
# - BH_DB_USER=root
# - BH_DB_PASSWORD=password
# - BH_DB_NAME=baihu
# - BH_DB_TABLE_PREFIX=baihu_
# - BH_DB_NAME=taskpool
# - BH_DB_TABLE_PREFIX=taskpool_
# - BH_SECRET=your_secret_key
restart: unless-stopped
+9 -9
View File
@@ -74,8 +74,8 @@ RUN --mount=type=cache,target=/go/pkg/mod \
VERSION_VAL=$(cat /build-info/version.txt) && \
BUILD_TIME_VAL=$(cat /build-info/build_time.txt) && \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -ldflags="-s -w -X github.com/engigu/baihu-panel/internal/constant.Version=${VERSION_VAL} -X 'github.com/engigu/baihu-panel/internal/constant.BuildTime=${BUILD_TIME_VAL}'" \
-o baihu .
go build -ldflags="-s -w -X github.com/engigu/taskpool/internal/constant.Version=${VERSION_VAL} -X 'github.com/engigu/taskpool/internal/constant.BuildTime=${BUILD_TIME_VAL}'" \
-o taskpool .
# ================================
# Stage 3: Build Agent (all platforms)
@@ -113,8 +113,8 @@ RUN --mount=type=cache,target=/go/pkg/mod \
local os=$1; local arch=$2; local suffix=$3; \
local tmpdir="build-$os-$arch"; \
mkdir -p $tmpdir && cp config.example.ini $tmpdir/ && \
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags="${LDFLAGS}" -o $tmpdir/baihu-agent$suffix . && \
(cd $tmpdir && tar -czvf /opt/agent/baihu-agent-$os-$arch.tar.gz baihu-agent$suffix config.example.ini) && \
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags="${LDFLAGS}" -o $tmpdir/taskpool-agent$suffix . && \
(cd $tmpdir && tar -czvf /opt/agent/taskpool-agent-$os-$arch.tar.gz taskpool-agent$suffix config.example.ini) && \
rm -rf $tmpdir; \
} ; \
build_agent linux amd64 "" & pid1=$!; \
@@ -128,7 +128,7 @@ RUN --mount=type=cache,target=/go/pkg/mod \
# Stage 4: Final image
# ================================
ARG BASE_TAG
FROM ghcr.io/engigu/baihu:${BASE_TAG}
FROM ghcr.io/engigu/taskpool:${BASE_TAG}
ENV TZ=Asia/Shanghai
ENV LANG=C.UTF-8
@@ -150,10 +150,10 @@ ENV PATH="/app/envs/mise/shims:/app/envs/mise/bin:$PATH"
WORKDIR /app
# Copy Go binary
COPY --from=backend-builder /app/baihu .
COPY --from=backend-builder /app/taskpool .
# Copy frontend assets to /www/baihu (No embed in Docker)
COPY --from=frontend-builder /app/web/dist /www/baihu
# Copy frontend assets to /www/taskpool (No embed in Docker)
COPY --from=frontend-builder /app/web/dist /www/taskpool
# Copy configs and entrypoint
COPY --from=backend-builder /app/configs ./configs
@@ -171,7 +171,7 @@ COPY docker/mise-hook.sh /etc/profile.d/mise-hook.sh
RUN chmod +x docker-entrypoint.sh \
&& cat /etc/profile.d/mise-hook.sh >> /etc/bash.bashrc \
&& echo "set encoding=utf-8" >> /etc/vim/vimrc \
&& ln -sf /app/baihu /usr/local/bin/baihu
&& ln -sf /app/taskpool /usr/local/bin/taskpool
ENV MISE_TRUSTED_CONFIG_PATHS=/app/data/scripts
+9 -9
View File
@@ -63,8 +63,8 @@ RUN go run github.com/swaggo/swag/cmd/swag@latest init -g main.go -o ./openapi_d
RUN VERSION_VAL=$(cat /build-info/version.txt) && \
BUILD_TIME_VAL=$(cat /build-info/build_time.txt) && \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -ldflags="-s -w -X github.com/engigu/baihu-panel/internal/constant.Version=${VERSION_VAL} -X 'github.com/engigu/baihu-panel/internal/constant.BuildTime=${BUILD_TIME_VAL}'" \
-o baihu .
go build -ldflags="-s -w -X github.com/engigu/taskpool/internal/constant.Version=${VERSION_VAL} -X 'github.com/engigu/taskpool/internal/constant.BuildTime=${BUILD_TIME_VAL}'" \
-o taskpool .
# ================================
# Stage 3: Build Agent (all platforms)
@@ -94,9 +94,9 @@ RUN VERSION_VAL=$(cat /build-info/version.txt) && \
echo "${VERSION_VAL}" > /opt/agent/version.txt && \
build_agent() { \
local os=$1; local arch=$2; local suffix=$3; \
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags="${LDFLAGS}" -o baihu-agent$suffix . && \
tar -czvf /opt/agent/baihu-agent-$os-$arch.tar.gz baihu-agent$suffix config.example.ini && \
rm baihu-agent$suffix; \
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -ldflags="${LDFLAGS}" -o taskpool-agent$suffix . && \
tar -czvf /opt/agent/taskpool-agent-$os-$arch.tar.gz taskpool-agent$suffix config.example.ini && \
rm taskpool-agent$suffix; \
} && \
build_agent linux amd64 "" && \
build_agent linux arm64 "" && \
@@ -107,7 +107,7 @@ RUN VERSION_VAL=$(cat /build-info/version.txt) && \
# ================================
# Stage 4: Final image
# ================================
FROM ghcr.io/engigu/baihu:${BASE_TAG}
FROM ghcr.io/engigu/taskpool:${BASE_TAG}
ENV TZ=Asia/Shanghai
ENV LANG=C.UTF-8
@@ -119,10 +119,10 @@ ENV PATH="/app/envs/mise/shims:/app/envs/mise/bin:$PATH"
WORKDIR /app
# Copy Go binary
COPY --from=backend-builder /app/baihu .
COPY --from=backend-builder /app/taskpool .
# Copy frontend assets
COPY --from=frontend-builder /app/web/dist /www/baihu
COPY --from=frontend-builder /app/web/dist /www/taskpool
# Copy configs and entrypoint
COPY --from=backend-builder /app/configs ./configs
@@ -138,7 +138,7 @@ COPY docker/mise-hook.sh /etc/profile.d/mise-hook.sh
RUN chmod +x docker-entrypoint.sh \
&& cat /etc/profile.d/mise-hook.sh >> /etc/bash.bashrc \
&& echo "set encoding=utf-8" >> /etc/vim/vimrc \
&& ln -sf /app/baihu /usr/local/bin/baihu
&& ln -sf /app/taskpool /usr/local/bin/taskpool
ENV MISE_TRUSTED_CONFIG_PATHS=/app/data/scripts
+4 -4
View File
@@ -67,14 +67,14 @@ log "mise version: $(mise --version 2>/dev/null | head -n 1)"
[ -x "$(command -v npm)" ] && log "npm: $(npm --version 2>&1 | head -n 1) at $(which npm)" || log "npm: not installed"
# ============================
# 将 baihu 注册到全局命令
# 将 taskpool 注册到全局命令
# ============================
ln -sf /app/baihu /usr/local/bin/baihu
ln -sf /app/taskpool /usr/local/bin/taskpool
# ============================
# 启动应用
# ============================
printf "\n\033[1;32m>>> Environment setup complete. Starting Baihu Server...\033[0m\n\n"
printf "\n\033[1;32m>>> Environment setup complete. Starting TaskPool Server...\033[0m\n\n"
cd /app
exec baihu server
exec taskpool server
+4 -4
View File
@@ -78,14 +78,14 @@ log "Checking npm..."
log " - npm: $(npm --version 2>&1 | head -n 1 || echo "not found")"
# ============================
# 将 baihu 注册到全局命令
# 将 taskpool 注册到全局命令
# ============================
ln -sf /app/baihu /usr/local/bin/baihu
ln -sf /app/taskpool /usr/local/bin/taskpool
# ============================
# 启动应用
# ============================
printf "\n\033[1;32m>>> Environment setup complete. Starting Baihu Server...\033[0m\n\n"
printf "\n\033[1;32m>>> Environment setup complete. Starting TaskPool Server...\033[0m\n\n"
cd /app
exec baihu server
exec taskpool server
+3 -3
View File
@@ -2,9 +2,9 @@ import { defineConfig } from 'vitepress'
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'baihu-panel',
title: 'taskpool',
description: '轻量易用的定时任务面板,支持多语言脚本、依赖管理与日志查看',
base: '/baihu-panel/',
base: '/taskpool/',
lang: 'zh-CN',
head: [
['link', { rel: 'stylesheet', href: 'https://fonts.loli.net/css2?family=Noto+Sans+SC:wght@400;500;700&family=Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap' }],
@@ -73,7 +73,7 @@ export default defineConfig({
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/engigu/baihu-panel' }
{ icon: 'github', link: 'https://github.com/engigu/taskpool' }
],
footer: {
+1 -1
View File
@@ -9,7 +9,7 @@ async function scrapeAll() {
let reachedEnd = false;
while (!reachedEnd) {
console.log(`Fetching page ${page}...`);
const url = `https://github.com/engigu/baihu-panel/pkgs/container/baihu/versions?page=${page}`;
const url = `https://github.com/engigu/taskpool/pkgs/container/taskpool/versions?page=${page}`;
let html;
let success = false;
for (let retry = 1; retry <= 3; retry++) {
+1 -1
View File
@@ -12,7 +12,7 @@ import '@scalar/api-reference/style.css'
<ApiReference
:configuration="{
spec: {
url: '/baihu-panel/swagger.json'
url: '/taskpool/swagger.json'
},
theme: 'alternate',
showSidebar: true,
+4 -4
View File
@@ -1,6 +1,6 @@
# 更新日志 ☕
本页面记录了baihu-panel的主要版本更新历史。
本页面记录了taskpool的主要版本更新历史。
## 最近更新概览
@@ -13,7 +13,7 @@
- **样式与体验优化**:将“状态”列宽度由 `w-8` 扩大至 `w-14` 消除因加入排序图标导致的文字折行与表头挤压;去除了 Dialog 自动聚焦时产生的窗口边缘白色高亮聚焦线。
### 2026.06.28 - 全新节点互联功能发布! (v1.1.17)
- **节点互联体系 (New)**:新增开放连接(OpenConnect)协议支持,轻松打通并管理多个白虎面板实例;全新上线同步管理面板,可实时总览所有连接节点的资源开销与各项负载指标;支持了跨节点间的环境变量全量无缝同步(完美保留原始结构与关联 ID);底层路由机制迎来全面升级,完美支持基于穿透隧道的前端互联访问代理。
- **节点互联体系 (New)**:新增开放连接(OpenConnect)协议支持,轻松打通并管理多个任务池实例;全新上线同步管理面板,可实时总览所有连接节点的资源开销与各项负载指标;支持了跨节点间的环境变量全量无缝同步(完美保留原始结构与关联 ID);底层路由机制迎来全面升级,完美支持基于穿透隧道的前端互联访问代理。
- **终端体验优化**:针对移动端深度优化终端(xterm)交互,禁用移动端点击自动弹出软键盘,支持选中内容后 Ctrl+C 快捷复制,并大幅提升了小屏幕下的滑动流畅性。
- **调度器安全**:为 Worker 数量和队列大小添加了边界验证及安全限制,从底层防止高并发场景下出现 OOM 问题。
- **UI 体验优化**:修复了大屏模式下环境变量表格删除按钮丢失的问题;MasterView 按钮在小屏幕下支持自适应填满;增加了演示模式下互联角色的操作限制。
@@ -37,8 +37,8 @@
### 2026.04.16 - 内建脚本助手库 (Built-in SDK)
- **内建助手库 (Built-in SDK) (New)**:新增 Python 与 Node.js 的轻量级助手库 `baihu`。通过环境自动注入机制实现“零配置”通知投递,开发者无需在脚本中显式配置 TOKEN 或 URL。
- **环境自动初始化**:新增 `baihu builtininstall` 命令行工具,支持一键为 `mise` 管理的所有多语言版本同步安装/刷新内建包依赖。
- **内建助手库 (Built-in SDK) (New)**:新增 Python 与 Node.js 的轻量级助手库 `taskpool`。通过环境自动注入机制实现“零配置”通知投递,开发者无需在脚本中显式配置 TOKEN 或 URL。
- **环境自动初始化**:新增 `taskpool builtininstall` 命令行工具,支持一键为 `mise` 管理的所有多语言版本同步安装/刷新内建包依赖。
- **体验与文档升级**:重构了「脚本调用」UI 指引,简化了集成步骤说明,并统一了全局 UI 字体规范。
### 2026.04.14 - PWA 支持与推送渠道扩展
+28 -28
View File
@@ -1,16 +1,16 @@
# 命令行工具 (CLI)
baihu-panel在环境内内置了同名的 `baihu` 命令行工具。如果您在终端内需要执行系统级别的操作,可以使用这些内置命令。
taskpool在环境内内置了同名的 `taskpool` 命令行工具。如果您在终端内需要执行系统级别的操作,可以使用这些内置命令。
## 常用核心指令
| 命令 | 描述 |
| :--- | :--- |
| `baihu server` | 面板启动指令,运行服务端后台进程。 |
| `baihu reposync` | 供定时任务调用,将远程 Git 仓库的高级特性同步到本地目录中。 |
| `baihu resetpwd` | 交互式重置系统 admin 账号密码(密码丢失时可通过进入终端重置)。 |
| `baihu restore <file>` | 使用本地的 .zip 备份压缩包文件,一条命令直接全量恢复系统数据。 |
| `baihu task` | 极速只读与控制台常驻任务管理(支持查询列表、手动触发、查看状态及开关控制)。 |
| `taskpool server` | 面板启动指令,运行服务端后台进程。 |
| `taskpool reposync` | 供定时任务调用,将远程 Git 仓库的高级特性同步到本地目录中。 |
| `taskpool resetpwd` | 交互式重置系统 admin 账号密码(密码丢失时可通过进入终端重置)。 |
| `taskpool restore <file>` | 使用本地的 .zip 备份压缩包文件,一条命令直接全量恢复系统数据。 |
| `taskpool task` | 极速只读与控制台常驻任务管理(支持查询列表、手动触发、查看状态及开关控制)。 |
---
@@ -19,20 +19,20 @@ baihu-panel在环境内内置了同名的 `baihu` 命令行工具。如果您在
### 1. 密码重置
您可以进入 Docker 容器或通过 ssh 连入宿主机控制台:
```bash
docker exec -it baihu baihu resetpwd
docker exec -it taskpool taskpool resetpwd
```
然后根据提示,输入新的管理员密码即可重置成功。
### 2. 手动启动
如果是通过手动部署二进制文件,可以使用 `baihu server` 启动:
如果是通过手动部署二进制文件,可以使用 `taskpool server` 启动:
```bash
nohup ./baihu server > /dev/null 2>&1 &
nohup ./taskpool server > /dev/null 2>&1 &
```
### 3. 数据恢复
上传备份后的 ZIP 文件至容器目录:
```bash
docker exec -it baihu baihu restore /app/data/backup-2026xxxx.zip
docker exec -it taskpool taskpool restore /app/data/backup-2026xxxx.zip
```
该操作会全量覆盖现有数据库和脚本文件,请谨慎操作。
@@ -40,7 +40,7 @@ docker exec -it baihu baihu restore /app/data/backup-2026xxxx.zip
## `reposync` 参数详解
`baihu reposync` 是面板核心的同步命令,除了在任务中自动调用外,您也可以通过命令行手动执行。
`taskpool reposync` 是面板核心的同步命令,除了在任务中自动调用外,您也可以通过命令行手动执行。
### 参数列表
@@ -71,13 +71,13 @@ docker exec -it baihu baihu restore /app/data/backup-2026xxxx.zip
#### 1. 基础 Git 仓库同步
将指定仓库克隆或拉取到特定目录:
```bash
baihu reposync --source-url https://github.com/example/repo.git --target-path /app/data/scripts/example_repo
taskpool reposync --source-url https://github.com/example/repo.git --target-path /app/data/scripts/example_repo
```
#### 2. 启用代理的同步
针对 Github 仓库使用加速代理,并限定只保留 `.js``.py` 脚本:
```bash
baihu reposync --source-url https://github.com/example/repo.git \
taskpool reposync --source-url https://github.com/example/repo.git \
--target-path /app/data/scripts/example_repo \
--proxy ghproxy \
--extensions ".js|.py"
@@ -86,7 +86,7 @@ baihu reposync --source-url https://github.com/example/repo.git \
#### 3. 稀疏检出 (Sparse Checkout)
当仓库庞大时,仅同步特定的子目录或文件:
```bash
baihu reposync --source-url https://github.com/example/repo.git \
taskpool reposync --source-url https://github.com/example/repo.git \
--target-path /app/data/scripts/example_repo \
--path "scripts/daily"
```
@@ -94,7 +94,7 @@ baihu reposync --source-url https://github.com/example/repo.git \
#### 4. 单文件下载模式
如果只需要仓库中的某一个脚本文件:
```bash
baihu reposync --source-url https://github.com/example/repo.git \
taskpool reposync --source-url https://github.com/example/repo.git \
--target-path /app/data/scripts/ \
--single-file true \
--path "main_script.py"
@@ -103,7 +103,7 @@ baihu reposync --source-url https://github.com/example/repo.git \
#### 5. 高级过滤与青龙注释解析
使用黑名单排除特定脚本,并开启青龙格式注释解析以自动生成定时任务:
```bash
baihu reposync --source-url https://github.com/example/repo.git \
taskpool reposync --source-url https://github.com/example/repo.git \
--target-path /app/data/scripts/example_repo \
--blacklist "test|mock" \
--dependence "package.json|requirements.txt" \
@@ -112,9 +112,9 @@ baihu reposync --source-url https://github.com/example/repo.git \
---
## `baihu task` 任务管理指令集
## `taskpool task` 任务管理指令集
`baihu task` 是一组专为纯终端操作与自动化脚本调度打造的轻量级任务管理子命令集。它能够绕过繁重的界面操作,直接提供闪电般的本地查询与安全指令下发控制。
`taskpool task` 是一组专为纯终端操作与自动化脚本调度打造的轻量级任务管理子命令集。它能够绕过繁重的界面操作,直接提供闪电般的本地查询与安全指令下发控制。
### 支持子命令
@@ -122,45 +122,45 @@ baihu reposync --source-url https://github.com/example/repo.git \
查询并分页展示系统内配置的所有任务概览。
```bash
# 默认展示前 20 条
baihu task list
taskpool task list
# 指定关键词过滤,并查看第 2 页 (每页展示 10 条)
baihu task list -q "签到" -page 2 -size 10
taskpool task list -q "签到" -page 2 -size 10
```
#### 2. 手动立即触发 (`run`)
手动向常驻后台服务下发指令,立即异步运行指定的任务。
```bash
baihu task run a1b2c3d4
taskpool task run a1b2c3d4
```
#### 3. 任务状态切换 (`enable` / `disable`)
快速启用或禁用系统任务。
```bash
baihu task enable a1b2c3d4
baihu task disable a1b2c3d4
taskpool task enable a1b2c3d4
taskpool task disable a1b2c3d4
```
#### 4. 实时执行状态追踪 (`status`)
查看指定任务最新一次执行的详细输出日志和最终退出码。
```bash
# 查看最近一条日志
baihu task status a1b2c3d4
taskpool task status a1b2c3d4
# 查看指定历史日志条目的完整输出
baihu task status a1b2c3d4 log_123456
taskpool task status a1b2c3d4 log_123456
```
#### 5. 近期执行历史流水 (`history`)
列出某任务最近的多次运行记录(包含耗时、执行时间及状态结果)。
```bash
baihu task history a1b2c3d4
taskpool task history a1b2c3d4
```
> [!TIP]
> 所有的 `baihu task` 子命令均原生支持单独传入 `--help` 参数获取具体的示例和选项清单。例如:`baihu task list --help`。
> 所有的 `taskpool task` 子命令均原生支持单独传入 `--help` 参数获取具体的示例和选项清单。例如:`taskpool task list --help`。
---
## 其他帮助
终端内直接执行 `baihu` 即可在控制台直接打印内置支持详细说明和命令列表参数。
终端内直接执行 `taskpool` 即可在控制台直接打印内置支持详细说明和命令列表参数。
+12 -12
View File
@@ -1,6 +1,6 @@
# 系统配置手册
baihu-panel支持通过环境变量和配置文件两种核心方式进行系统参数微调。
taskpool支持通过环境变量和配置文件两种核心方式进行系统参数微调。
## 环境变量配置 (优先级最高)
@@ -19,12 +19,12 @@ baihu-panel支持通过环境变量和配置文件两种核心方式进行系统
| `BH_DB_PORT` | database.port | 数据库端口 | 3306 |
| `BH_DB_USER` | database.user | 数据库用户名 | root |
| `BH_DB_PASSWORD` | database.password | 数据库密码 | - |
| `BH_DB_NAME` | database.dbname | 数据库库名 | baihu |
| `BH_DB_PATH` | database.path | SQLite 物理文件存储路径 | ./data/baihu.db |
| `BH_DB_NAME` | database.dbname | 数据库库名 | taskpool |
| `BH_DB_PATH` | database.path | SQLite 物理文件存储路径 | ./data/taskpool.db |
| `BH_DB_DSN` | database.dsn | 数据库 DSN (仅 mysql/postgres, 优先级高。**需对应设置 type**) | - |
| `BH_DB_TABLE_PREFIX` | database.table_prefix | 数据库表前缀 | baihu_ |
| `BH_DB_TABLE_PREFIX` | database.table_prefix | 数据库表前缀 | taskpool_ |
| `BH_DB_SSL_MODE` | database.ssl_mode | SSL 模式: postgres 支持 disable/require/verify-ca/verify-full; mysql 支持 true/skip-verify | - |
| `BAIHU_SECRET_KEY` | - | 系统加密秘钥,用于机密变量功能(**注:仅支持环境变量设置,不支持配置文件**) | - |
| `TASKPOOL_SECRET_KEY` | - | 系统加密秘钥,用于机密变量功能(**注:仅支持环境变量设置,不支持配置文件**) | - |
---
@@ -43,19 +43,19 @@ volumes:
[server]
port = 8052
host = 0.0.0.0
# 配置 URL 前缀用于反向代理,例如 /baihu/
url_prefix = /baihu
# 配置 URL 前缀用于反向代理,例如 /taskpool/
url_prefix = /taskpool
# 全局会话 Cookie 名称
cookie_name = BHToken
[database]
type = sqlite
path = /app/data/baihu.db
path = /app/data/taskpool.db
# 数据库连接示例 (Unix Socket / DSN):
# 注意:使用 dsn 时,type 必须设为 mysql 或 postgres
# dsn = user:password@unix(/var/run/mysqld/mysqld.sock)/dbname?charset=utf8mb4&parseTime=True&loc=Local
# dsn = postgres://user:password@localhost:5432/dbname?sslmode=disable
table_prefix = baihu_
table_prefix = taskpool_
```
---
@@ -72,12 +72,12 @@ table_prefix = baihu_
## 机密管理 (Secret Management)
baihu-panel提供了一套基于 **AES-GCM** 工业级标准的安全机密管理系统,其设计理念参考了 GitHub Actions Secrets。
taskpool提供了一套基于 **AES-GCM** 工业级标准的安全机密管理系统,其设计理念参考了 GitHub Actions Secrets。
### 核心特性
1. **强加密存储**:所有标记为“机密”的变量在数据库中均以加密密文形式存储。
2. **秘钥安全**:通过环境变量 `BAIHU_SECRET_KEY` 注入加密秘钥。系统读取秘钥后会立即将其从进程环境变量中销毁(Unset),确保秘钥仅驻留在内存中。
2. **秘钥安全**:通过环境变量 `TASKPOOL_SECRET_KEY` 注入加密秘钥。系统读取秘钥后会立即将其从进程环境变量中销毁(Unset),确保秘钥仅驻留在内存中。
3. **日志自动脱敏**:系统会自动扫描任务执行生成的实时日志流。一旦发现机密明文,将自动替换为 `********`,防止敏感信息通过日志泄露。
4. **严格权限隔离**
- 机密内容**仅在计划任务由调度器定时执行时**才会注入到环境。
@@ -85,6 +85,6 @@ baihu-panel提供了一套基于 **AES-GCM** 工业级标准的安全机密管
### 配置建议
- 建议在 Docker/Compose 启动项中设置 `BAIHU_SECRET_KEY` 为一个复杂的随机字符串。
- 建议在 Docker/Compose 启动项中设置 `TASKPOOL_SECRET_KEY` 为一个复杂的随机字符串。
- 不要将该秘钥写入 `config.ini` 或提交到版本控制系统。
+1 -1
View File
@@ -1,6 +1,6 @@
# 数据仪表
数据仪表提供了baihu-panel的全局运行状态、任务执行统计及关键指标的可视化展示。
数据仪表提供了taskpool的全局运行状态、任务执行统计及关键指标的可视化展示。
## 主要功能
+24 -24
View File
@@ -30,7 +30,7 @@
### SQLite (默认)
```bash
docker run -d \
--name baihu \
--name taskpool \
-p 8052:8052 \
-v $(pwd)/data:/app/data \
-v $(pwd)/envs:/app/envs \
@@ -38,16 +38,16 @@ docker run -d \
-e BH_SERVER_PORT=8052 \
-e BH_SERVER_HOST=0.0.0.0 \
-e BH_DB_TYPE=sqlite \
-e BH_DB_PATH=/app/data/baihu.db \
-e BH_DB_TABLE_PREFIX=baihu_ \
-e BH_DB_PATH=/app/data/taskpool.db \
-e BH_DB_TABLE_PREFIX=taskpool_ \
--restart unless-stopped \
ghcr.io/engigu/baihu:latest
ghcr.io/engigu/taskpool:latest
```
### MySQL
```bash
docker run -d \
--name baihu \
--name taskpool \
-p 8052:8052 \
-v $(pwd)/data:/app/data \
-v $(pwd)/envs:/app/envs \
@@ -59,10 +59,10 @@ docker run -d \
-e BH_DB_PORT=3306 \
-e BH_DB_USER=root \
-e BH_DB_PASSWORD=your_password \
-e BH_DB_NAME=baihu \
-e BH_DB_TABLE_PREFIX=baihu_ \
-e BH_DB_NAME=taskpool \
-e BH_DB_TABLE_PREFIX=taskpool_ \
--restart unless-stopped \
ghcr.io/engigu/baihu:latest
ghcr.io/engigu/taskpool:latest
```
---
@@ -74,9 +74,9 @@ docker run -d \
### 核心部署模板
```yaml
services:
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
ports:
- "8052:8052"
volumes:
@@ -87,9 +87,9 @@ services:
- BH_SERVER_PORT=8052
- BH_SERVER_HOST=0.0.0.0
- BH_DB_TYPE=sqlite
- BH_DB_PATH=/app/data/baihu.db
- BH_DB_TABLE_PREFIX=baihu_
# - BH_SERVER_URL_PREFIX=/baihu # 可选:配置 URL 前缀用于反向代理
- BH_DB_PATH=/app/data/taskpool.db
- BH_DB_TABLE_PREFIX=taskpool_
# - BH_SERVER_URL_PREFIX=/taskpool # 可选:配置 URL 前缀用于反向代理
logging:
driver: json-file
options:
@@ -121,7 +121,7 @@ volumes:
2. **Mise 同步**:自动将镜像内置的 Mise 核心运行时激活文件同步到持久化挂载目录中,确保容器重启后环境依然可用。
3. **运行时激活**:动态注入环境变量,将 `mise shims` 路径加入系统 `PATH`
4. **包管理预设**:自动为 Python 配置清华源 (PIP) 镜像,配置 Node.js 内存限制。
5. **主进程启动**:运行 `baihu server` 开启面板。
5. **主进程启动**:运行 `taskpool server` 开启面板。
> **提示**:通过持久化挂载 `./envs` 目录,您安装的所有运行时版本和第三方依赖库均会永久保留。
@@ -129,13 +129,13 @@ volumes:
## 自动更新 Docker 镜像
如果您希望baihu-panel能够自动拉取最新镜像并无感更新,推荐使用 **Watchtower**。Watchtower 会定期检查被监控容器的基础镜像,当发现有新版本推送时,它会自动拉取新镜像、使用与原容器完全相同的配置重启容器。
如果您希望taskpool能够自动拉取最新镜像并无感更新,推荐使用 **Watchtower**。Watchtower 会定期检查被监控容器的基础镜像,当发现有新版本推送时,它会自动拉取新镜像、使用与原容器完全相同的配置重启容器。
由于baihu-panel采用持久化挂载(数据和环境都在外部),因此自动更新不会造成任何数据丢失。
由于taskpool采用持久化挂载(数据和环境都在外部),因此自动更新不会造成任何数据丢失。
### 方式一:独立一行命令运行 Watchtower(推荐)
执行以下命令,Watchtower 将会自动在每天凌晨 3 点自动检查并更新名为 `baihu` 的容器:
执行以下命令,Watchtower 将会自动在每天凌晨 3 点自动检查并更新名为 `taskpool` 的容器:
```bash
docker run -d \
@@ -146,11 +146,11 @@ docker run -d \
-e WATCHTOWER_CLEANUP=true \
--restart unless-stopped \
containrrr/watchtower \
baihu
taskpool
```
> **参数说明**
> - 结尾处的 `baihu` 为指定仅监控更新名为 `baihu` 的容器。若不加此参数,则会自动更新宿主机上所有的 Docker 容器。
> - 结尾处的 `taskpool` 为指定仅监控更新名为 `taskpool` 的容器。若不加此参数,则会自动更新宿主机上所有的 Docker 容器。
> - `WATCHTOWER_CLEANUP=true`:更新成功后自动删除旧版本的废弃镜像,防止存储空间被占满。
> - `WATCHTOWER_SCHEDULE`:设置定时检查的 Cron 表达式(秒 分 时 日 月 周)。
@@ -160,9 +160,9 @@ docker run -d \
```yaml
services:
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
# ... 省略端口、挂载等其他配置 ...
watchtower:
@@ -174,7 +174,7 @@ services:
- TZ=Asia/Shanghai
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_SCHEDULE="0 0 3 * * *"
command: baihu
command: taskpool
restart: unless-stopped
```
+3 -3
View File
@@ -1,6 +1,6 @@
# 免责声明
baihu-panelBaihu Panel)及其开发者在提供本项目的同时,默认用户已完全知悉并同意以下条款:
taskpoolTaskPool)及其开发者在提供本项目的同时,默认用户已完全知悉并同意以下条款:
## 1. 免责保证
@@ -15,10 +15,10 @@ baihu-panelBaihu Panel)及其开发者在提供本项目的同时,默认
## 3. 授权与使用
- **合理镜像申请**:由于项目涉及到网络请求和资产调度,请遵循相关的开源协议进行公平、合理的使用。
- **禁止非法用途**:严禁将baihu-panel用于任何违反中华人民共和国法律法规及相关组织政策的行为。
- **禁止非法用途**:严禁将taskpool用于任何违反中华人民共和国法律法规及相关组织政策的行为。
---
## 4. 联系我们
如果您在使用过程中发现任何技术问题,欢迎通过 GitHub [Issues](https://github.com/engigu/baihu-panel/issues) 反馈。
如果您在使用过程中发现任何技术问题,欢迎通过 GitHub [Issues](https://github.com/engigu/taskpool/issues) 反馈。
+19 -19
View File
@@ -9,16 +9,16 @@
## 部署方式对比
baihu-panel强烈建议采用 **单独部署浏览器服务(如 Browserless** 的方案,而不是在白虎镜像内部安装浏览器。
taskpool强烈建议采用 **单独部署浏览器服务(如 Browserless** 的方案,而不是在任务池镜像内部安装浏览器。
### 本地部署 (在白虎容器内安装) 的缺点
- **资源争抢**:浏览器是极度的“内存/CPU 杀手”,在同一容器内运行多任务极易导致白虎主进程因 OOM (内存溢出) 而崩溃。
### 本地部署 (在任务池容器内安装) 的缺点
- **资源争抢**:浏览器是极度的“内存/CPU 杀手”,在同一容器内运行多任务极易导致任务池主进程因 OOM (内存溢出) 而崩溃。
- **镜像臃肿**:安装 Chromium 后,原本精简的 Docker 镜像体积会暴增数倍(增加 500MB+),导致拉取和更新缓慢。
- **依赖环境复杂**:在精简镜像中安装浏览器常会遇到各种缺失 `.so` 库文件的底层错误,排查极其困难。
- **不利于扩展**:无法实现多节点负载均衡,一个容器内的资源始终是有限的。
### 远程部署 (Browserless) 的优势
- **性能隔离**:浏览器的负载波动不会影响baihu-panel的稳定性。
- **性能隔离**:浏览器的负载波动不会影响taskpool的稳定性。
- **开箱即用**:专业的浏览器镜像是针对性优化的,包含所有底层依赖和沙箱安全配置。
- **可视化调试**:大多数服务(如 Browserless)支持通过 VNC 同步查看浏览器画面,方便排查脚本逻辑。
- **弹性伸缩**:支持多会话、多实例模式,可以应对高并发爬虫需求。
@@ -27,7 +27,7 @@ baihu-panel强烈建议采用 **单独部署浏览器服务(如 Browserless
## 准备工作
baihu-panel中运行浏览器自动化脚本前,需要先配置好对应的 **语言环境****第三方依赖包**
taskpool中运行浏览器自动化脚本前,需要先配置好对应的 **语言环境****第三方依赖包**
### 1. Node.js 环境 (JavaScript)
如果您使用 `playwright.js` 脚本:
@@ -55,7 +55,7 @@ baihu-panel强烈建议采用 **单独部署浏览器服务(如 Browserless
## 适用场景
- 验证白虎到 Browserless 的网络连通性
- 验证任务池到 Browserless 的网络连通性
- 验证远程浏览器地址和 Token 是否配置正确
- 快速测试浏览器自动化脚本是否能正常运行
- 快速确认 Node.js / Python 语言环境是否已经配置完成
@@ -63,7 +63,7 @@ baihu-panel强烈建议采用 **单独部署浏览器服务(如 Browserless
## 推荐部署方式
建议配合 `browserless/chromium` 一起使用,再由白虎中的脚本连接远程浏览器服务。
建议配合 `browserless/chromium` 一起使用,再由任务池中的脚本连接远程浏览器服务。
参考 `docker-compose.yml`
@@ -91,9 +91,9 @@ services:
timeout: 10s
retries: 3
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
restart: unless-stopped
ports:
- "8052:8052"
@@ -105,8 +105,8 @@ services:
- BH_SERVER_PORT=8052
- BH_SERVER_HOST=0.0.0.0
- BH_DB_TYPE=sqlite
- BH_DB_PATH=/app/data/baihu.db
- BH_DB_TABLE_PREFIX=baihu_
- BH_DB_PATH=/app/data/taskpool.db
- BH_DB_TABLE_PREFIX=taskpool_
logging:
driver: json-file
options:
@@ -118,10 +118,10 @@ services:
## 使用步骤
1. 启动 `browser``baihu` 服务。
2.白虎的“语言依赖”中安装对应包。
1. 启动 `browser``taskpool` 服务。
2.任务池的“语言依赖”中安装对应包。
3. 按实际环境修改脚本中的 Browserless 地址和 Token。
4.白虎中创建任务并运行对应脚本。
4.任务池中创建任务并运行对应脚本。
Python 示例的核心写法如下:
@@ -141,7 +141,7 @@ with sync_playwright() as p:
## 运行前检查
- Browserless 服务已经正常启动
- 白虎可以访问 Browserless 地址
- 任务池可以访问 Browserless 地址
- `TOKEN` 与 Browserless 配置保持一致
- 脚本中的地址、端口和协议填写正确
@@ -158,7 +158,7 @@ with sync_playwright() as p:
这是预期行为。
如果你使用的是 Browserless 这类远程浏览器服务,Playwright 只是作为客户端发起连接,不需要在白虎容器里再下载本地浏览器,所以通常不要执行 `playwright install`
如果你使用的是 Browserless 这类远程浏览器服务,Playwright 只是作为客户端发起连接,不需要在任务池容器里再下载本地浏览器,所以通常不要执行 `playwright install`
### 3. 连接不上 Browserless
@@ -166,7 +166,7 @@ with sync_playwright() as p:
- Browserless 服务是否正常启动
- Token 是否正确
- 白虎与 Browserless 是否在同一网络中
- 任务池与 Browserless 是否在同一网络中
- 地址是否写成了当前运行环境可访问的地址
### 4. 页面打开超时
@@ -188,4 +188,4 @@ with sync_playwright() as p:
## 说明
这组示例主要用于快速验证白虎与远程浏览器服务之间的连通性,以及对应语言环境是否已经配置完成。
这组示例主要用于快速验证任务池与远程浏览器服务之间的连通性,以及对应语言环境是否已经配置完成。
+31 -31
View File
@@ -1,6 +1,6 @@
# 内置库示例
baihu-panel提供了一个名为 `baihu` 的内建包(Built-in SDK),支持 Python 和 Node.js。通过该内置库,您可以在脚本中实现**消息推送**、**环境变量管理**以及**任务执行控制**等高级功能。
taskpool提供了一个名为 `taskpool` 的内建包(Built-in SDK),支持 Python 和 Node.js。通过该内置库,您可以在脚本中实现**消息推送**、**环境变量管理**以及**任务执行控制**等高级功能。
---
@@ -9,10 +9,10 @@ baihu-panel提供了一个名为 `baihu` 的内建包(Built-in SDK),支持
在运行内置库脚本之前,请确保完成了以下步骤:
### 1. 安装内置包
baihu-panel的「终端」页面中,或者通过创建临时任务执行以下命令,为面板管理的所有语言环境安装 `baihu` 包:
taskpool的「终端」页面中,或者通过创建临时任务执行以下命令,为面板管理的所有语言环境安装 `taskpool` 包:
```bash
baihu builtininstall
taskpool builtininstall
```
### 2. 配置环境变量
@@ -36,14 +36,14 @@ baihu builtininstall
::: code-group
```python [Python]
import baihu
import taskpool
def main():
print("正在尝试发送 Python 内建通知...")
try:
# 调用内置 notify 函数
# 内部会自动使用环境变量进行鉴权和投递
response = baihu.notify(
response = taskpool.notify(
title="Python 任务提醒",
text="这是一条来自 Python 示例脚本的通知消息。调用非常简单!"
)
@@ -59,13 +59,13 @@ if __name__ == "__main__":
```
```javascript [Node.js]
const baihu = require('baihu');
const taskpool = require('taskpool');
console.log("正在尝试发送 Node.js 内建通知...");
try {
// 简单的一行代码即可完成推送,内置包采用异步非阻塞发送
baihu.notify(
taskpool.notify(
"Node.js 任务提醒",
"这是一条来自 Node.js 示例脚本的通知消息。无需配置 API 地址或 Token。"
);
@@ -104,20 +104,20 @@ try {
::: code-group
```python [Python]
import baihu
import taskpool
def main():
print("====== 开始运行 Python 环境变量管理示例 ======")
try:
# 1. 获取全部环境变量
envs = baihu.get_envs()
envs = taskpool.get_envs()
print(f"当前共有 {len(envs)} 个环境变量")
# 2. 新增一个临时环境变量
new_env_name = "BHPKG_TEST_KEY"
new_env_val = "HelloBaihu"
new_env_val = "HelloTaskPool"
print(f"正在创建环境变量: {new_env_name}...")
created_env = baihu.add_env(
created_env = taskpool.add_env(
name=new_env_name,
value=new_env_val,
remark="Python SDK 测试自动创建"
@@ -125,14 +125,14 @@ def main():
print(f"创建成功: ID={created_env.get('id')}, Name={created_env.get('name')}")
# 3. 查询刚才创建的环境变量详情
checked_env = baihu.get_env(new_env_name)
checked_env = taskpool.get_env(new_env_name)
if checked_env:
print(f"成功查询到变量: {checked_env.get('name')} = {checked_env.get('value')}")
# 4. 修改该环境变量的值
updated_val = "HelloBaihu_Updated"
updated_val = "HelloTaskPool_Updated"
print(f"正在修改环境变量的值为: {updated_val}...")
updated_env = baihu.update_env(
updated_env = taskpool.update_env(
id=checked_env.get("id"),
name=new_env_name,
value=updated_val,
@@ -142,7 +142,7 @@ def main():
# 5. 删除该临时环境变量
print(f"正在删除临时环境变量: ID={checked_env.get('id')}...")
baihu.delete_env(checked_env.get("id"))
taskpool.delete_env(checked_env.get("id"))
print("删除成功!")
except Exception as e:
@@ -154,20 +154,20 @@ if __name__ == "__main__":
```
```javascript [Node.js]
const baihu = require('baihu');
const taskpool = require('taskpool');
async function main() {
console.log("====== 开始运行 Node.js 环境变量管理示例 ======");
try {
// 1. 获取全部环境变量
const envs = await baihu.getEnvs();
const envs = await taskpool.getEnvs();
console.log(`当前共有 ${envs.length} 个环境变量`);
// 2. 新增一个临时环境变量
const newEnvName = "BHPKG_TEST_KEY_JS";
const newEnvVal = "HelloBaihuJS";
const newEnvVal = "HelloTaskPoolJS";
console.log(`正在创建环境变量: ${newEnvName}...`);
const createdEnv = await baihu.addEnv(
const createdEnv = await taskpool.addEnv(
newEnvName,
newEnvVal,
"Node.js SDK 测试自动创建"
@@ -175,14 +175,14 @@ async function main() {
console.log(`创建成功: ID={createdEnv.id}, Name={createdEnv.name}`);
// 3. 查询该环境变量
const checkedEnv = await baihu.getEnv(newEnvName);
const checkedEnv = await taskpool.getEnv(newEnvName);
if (checkedEnv) {
console.log(`成功查询到变量: ${checkedEnv.name} = ${checkedEnv.value}`);
// 4. 修改该环境变量的值
const updatedVal = "HelloBaihuJS_Updated";
const updatedVal = "HelloTaskPoolJS_Updated";
console.log(`正在修改环境变量的值为: ${updatedVal}...`);
const updatedEnv = await baihu.updateEnv(
const updatedEnv = await taskpool.updateEnv(
checkedEnv.id,
newEnvName,
updatedVal,
@@ -192,7 +192,7 @@ async function main() {
// 5. 删除该临时环境变量
console.log(`正在删除临时环境变量: ID={checkedEnv.id}...`);
await baihu.deleteEnv(checkedEnv.id);
await taskpool.deleteEnv(checkedEnv.id);
console.log("删除成功!");
}
@@ -229,13 +229,13 @@ main();
::: code-group
```python [Python]
import baihu
import taskpool
def main():
print("====== 开始运行 Python 任务管理与执行控制示例 ======")
try:
# 1. 获取所有任务列表
tasks = baihu.get_tasks()
tasks = taskpool.get_tasks()
print(f"成功获取到 {len(tasks)} 个定时任务:")
for task in tasks[:5]: # 仅打印前5个
print(f" - [{task.get('id')}] {task.get('name')} (表达式: {task.get('schedule')}, 备注: {task.get('remark')})")
@@ -244,11 +244,11 @@ def main():
if tasks:
target_task = tasks[0]
print(f"\n尝试手动触发任务运行: [{target_task.get('id')}] {target_task.get('name')}...")
baihu.execute_task(target_task.get("id"))
taskpool.execute_task(target_task.get("id"))
print("执行指令发送成功。")
# 3. 获取最近的执行结果列表
results = baihu.get_last_results()
results = taskpool.get_last_results()
print(f"\n最近共有 {len(results)} 条任务执行记录。")
except Exception as e:
@@ -260,13 +260,13 @@ if __name__ == "__main__":
```
```javascript [Node.js]
const baihu = require('baihu');
const taskpool = require('taskpool');
async function main() {
console.log("====== 开始运行 Node.js 任务管理与执行控制示例 ======");
try {
// 1. 获取所有任务列表
const tasks = await baihu.getTasks();
const tasks = await taskpool.getTasks();
console.log(`成功获取到 ${tasks.length} 个定时任务:`);
tasks.slice(0, 5).forEach(task => { // 仅展示前5项
console.log(` - [${task.id}] ${task.name} (表达式: ${task.schedule || ''}, 备注: ${task.remark || ''})`);
@@ -276,12 +276,12 @@ async function main() {
if (tasks.length > 0) {
const targetTask = tasks[0];
console.log(`\n尝试手动触发任务运行: [${targetTask.id}] ${targetTask.name}...`);
await baihu.executeTask(targetTask.id);
await taskpool.executeTask(targetTask.id);
console.log("执行指令发送成功。");
}
// 3. 获取最近的执行结果列表
const results = await baihu.getLastResults();
const results = await taskpool.getLastResults();
console.log(`\n最近共有 ${results.length} 条任务执行记录。`);
} catch (e) {
+2 -2
View File
@@ -1,8 +1,8 @@
# 脚本示例
白虎内置了一批可直接参考的脚本示例,适合用来验证运行环境、演示常见用法,或者作为你自己脚本的起点。
任务池内置了一批可直接参考的脚本示例,适合用来验证运行环境、演示常见用法,或者作为你自己脚本的起点。
如果你使用 Docker 镜像启动白虎,容器启动后会自动将仓库中的 `example` 目录同步到脚本目录下。通常你可以在脚本目录中看到:
如果你使用 Docker 镜像启动任务池,容器启动后会自动将仓库中的 `example` 目录同步到脚本目录下。通常你可以在脚本目录中看到:
```text
example/
+6 -6
View File
@@ -1,16 +1,16 @@
# Linux 系统依赖处理
在使用baihu-panel时,您可能会在运行某些脚本时遇到缺少底层 Linux 系统级依赖(例如 `apt``apk` 包)的情况。这篇指南将详细讲解如何优雅、持久地解决这些依赖问题。
在使用taskpool时,您可能会在运行某些脚本时遇到缺少底层 Linux 系统级依赖(例如 `apt``apk` 包)的情况。这篇指南将详细讲解如何优雅、持久地解决这些依赖问题。
## 背景与痛点
baihu-panel通常以 Docker 容器的形式运行。Docker 的文件系统具有以下特性:
taskpool通常以 Docker 容器的形式运行。Docker 的文件系统具有以下特性:
- **挂载目录(持久化)**:像 `data/` 这样的目录被映射到了宿主机,其中的数据(如脚本、日志、配置文件)在重启或升级镜像时会保留。
- **容器层(非持久化)**:容器自身的系统目录(如 `/usr/bin`, `/lib`, `/etc`)是临时层。如果您直接在终端里手动执行 `apt-get install xxx`,虽然当下可以立即使用,**但在容器被销毁重建或更新镜像后,这些刚安装的系统包就会全部丢失。**(注意:仅仅是普通的 `docker restart` 重启容器并不会丢失,只有重建容器时才会重置)
## 核心解决思路
为了解决依赖丢失的问题,baihu-panel提供了一种自动化的解决方案:**利用 `baihu_startup`(开机触发)类型的定时任务,在面板每次启动时自动执行一段依赖安装脚本。**
为了解决依赖丢失的问题,taskpool提供了一种自动化的解决方案:**利用 `taskpool_startup`(开机触发)类型的定时任务,在面板每次启动时自动执行一段依赖安装脚本。**
这样,无论您如何更新镜像或重启容器,系统依赖都能在面板核心服务就绪前自动被补充安装,并且对后续的普通脚本任务透明。
@@ -22,7 +22,7 @@ baihu-panel通常以 Docker 容器的形式运行。Docker 的文件系统具有
首先,在您的脚本目录(通常为 `data/scripts` 下,或者您可以单独建一个 `data/scripts/deps` 目录)创建一个 Shell 脚本,例如 `install_my_deps.sh`
由于baihu-panel的镜像目前均基于 Debian 系统,您可以直接在脚本中使用 `apt``apt-get` 命令来管理系统依赖。
由于taskpool的镜像目前均基于 Debian 系统,您可以直接在脚本中使用 `apt``apt-get` 命令来管理系统依赖。
**示例 1:安装 Puppeteer (无头浏览器) 的依赖动态库**
```bash
@@ -82,7 +82,7 @@ echo "系统依赖安装完成!"
1. 进入面板的 **「定时任务」** 页面,点击 **「新建任务」**。
2. **任务名称**: 填写容易辨识的名称,例如 “安装系统底层依赖”。
3. **执行命令**: 输入执行该脚本的命令,例如 `bash deps/install_my_deps.sh` (假设您将脚本放在了 `deps` 文件夹下)。
4. **触发类型**: 在下拉菜单中选择 **`baihu_startup` (开机触发)**。
4. **触发类型**: 在下拉菜单中选择 **`taskpool_startup` (开机触发)**。
5. **保存** 任务。
现在,你可以尝试在终端中执行一下该任务验证脚本是否无误。一旦无误,未来每次容器重启,面板都会自动在后台静默执行这个任务,确保环境完备。
@@ -97,7 +97,7 @@ echo "系统依赖安装完成!"
如果您在安装 PHP 时遇到 `autoconf not found``buildconf failed`,可以直接使用项目根目录下的预设示例脚本:
- **路径位置**: `example/deps/install_php_env_deps.sh`
- **使用方法**: 新建 `baihu_startup` 触发类型的任务,执行命令填写 `bash example/deps/install_php_env_deps.sh` 即可。
- **使用方法**: 新建 `taskpool_startup` 触发类型的任务,执行命令填写 `bash example/deps/install_php_env_deps.sh` 即可。
此示例脚本中还包含了“检测是否已安装再决定是否执行 apt install”的逻辑,您可以查阅其源码作为编写自己依赖脚本的最佳实践参考。
+2 -2
View File
@@ -1,6 +1,6 @@
# 访问面板
部署成功并启动容器后,您只需通过浏览器即可访问baihu-panel。
部署成功并启动容器后,您只需通过浏览器即可访问taskpool。
## 默认账号
@@ -11,7 +11,7 @@
> **如何查找初始密码**
> 运行容器后,在命令行执行:
> ```bash
> docker logs baihu | grep "管理员账号创建成功"
> docker logs taskpool | grep "管理员账号创建成功"
> ```
> 找到包含密码的内容后登录,登录后建议首选操作:**修改管理员密码**。
+1 -1
View File
@@ -1,6 +1,6 @@
# 面板互联 (Interconnect)
面板互联功能允许您将多个面板(baihu-panel)连接在一起,形成主从(Master-Child)架构的集群。这使得您可以在一个中心化的主面板上集中监控和管理所有的子节点,极大地简化了多面板环境下的运维工作。
面板互联功能允许您将多个面板(taskpool)连接在一起,形成主从(Master-Child)架构的集群。这使得您可以在一个中心化的主面板上集中监控和管理所有的子节点,极大地简化了多面板环境下的运维工作。
## 核心特性
+1 -1
View File
@@ -1,6 +1,6 @@
# 项目介绍
baihu-panel (Baihu Panel) 是一款极致轻量、高性能的自动化任务调度平台。采用 Go + Vue3 架构,专注于高性能与低系统开销。
taskpool (TaskPool) 是一款极致轻量、高性能的自动化任务调度平台。采用 Go + Vue3 架构,专注于高性能与低系统开销。
## 核心亮点
+4 -4
View File
@@ -1,10 +1,10 @@
# 语言依赖
baihu-panel深度集成了 **Mise** 运行时管理器,这使得它具备多版本语言环境的高灵活性和隔离性。
taskpool深度集成了 **Mise** 运行时管理器,这使得它具备多版本语言环境的高灵活性和隔离性。
## 脚本运行环境
baihu-panel原生支持以下脚本的定时执行:
taskpool原生支持以下脚本的定时执行:
- **Python3**, **Node.js**, **Bash** (标准版镜像内置环境)
- 通过 **Mise** 扩展:支持几乎所有主流编程语言的动态安装与切换。
@@ -51,7 +51,7 @@ baihu-panel原生支持以下脚本的定时执行:
### 安装 Ansible
baihu-panel推荐通过 `mise` 结合 `pipx` 安装 Ansible,以保持环境隔离且全局可用:
taskpool推荐通过 `mise` 结合 `pipx` 安装 Ansible,以保持环境隔离且全局可用:
```bash
# 首先安装 pipx
@@ -69,6 +69,6 @@ mise use -g ansible@latest
## 隔离机制说明
- baihu-panel通过动态注入 `PATH` 环境和 `mise shims` 将语言环境暴露给系统。
- taskpool通过动态注入 `PATH` 环境和 `mise shims` 将语言环境暴露给系统。
- 每个任务在执行前都会根据任务配置自动加载对应的运行时环境变量。
- **运行时激活**:自动将 `MISE_DATA_DIR` 等环境变量指向宿主机的持久化挂载目录,确保护持久化可用。
+5 -5
View File
@@ -1,6 +1,6 @@
# Nginx 反向代理配置
如果您需要通过域名和 HTTPS 访问baihu-panel,推荐使用 Nginx 作为反向代理并配置 WebSocket 负载均衡。
如果您需要通过域名和 HTTPS 访问taskpool,推荐使用 Nginx 作为反向代理并配置 WebSocket 负载均衡。
## Nginx 反向代理配置示例
@@ -31,7 +31,7 @@ server {
error_log /var/log/nginx/example.error.log warn;
location / {
proxy_pass http://127.0.0.1:8052; # 指定baihu-panel宿主机 IP 和端口
proxy_pass http://127.0.0.1:8052; # 指定taskpool宿主机 IP 和端口
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -59,10 +59,10 @@ server {
### 3. 子路径部署场景
如果您是通过 `BH_SERVER_URL_PREFIX=/baihu` 进行子路径托管,请修改 `location` 参数:
如果您是通过 `BH_SERVER_URL_PREFIX=/taskpool` 进行子路径托管,请修改 `location` 参数:
```nginx
location /baihu/ {
proxy_pass http://127.0.0.1:8052/baihu/;
location /taskpool/ {
proxy_pass http://127.0.0.1:8052/taskpool/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
+13 -13
View File
@@ -18,7 +18,7 @@
## 推送使用路径
baihu-panel提供了两种不同层面的通知推送方式,满足从“自动报警”到“程序内自定义推送”的全场景需求。
taskpool提供了两种不同层面的通知推送方式,满足从“自动报警”到“程序内自定义推送”的全场景需求。
---
@@ -37,7 +37,7 @@ baihu-panel提供了两种不同层面的通知推送方式,满足从“自动
### 路径二:脚本手动调用 (内置助手库 - 推荐)
baihu-panel提供了一套**零配置**的内建助手库(Built-in SDK),支持 Python 和 Node.js。除了支持极简的消息通知投递外,它还支持管理面板的**环境变量**与**定时任务控制**。
taskpool提供了一套**零配置**的内建助手库(Built-in SDK),支持 Python 和 Node.js。除了支持极简的消息通知投递外,它还支持管理面板的**环境变量**与**定时任务控制**。
#### 1. 如何获取配置 Key
在使用助手库前,请确保您已经在任务设置的“环境变量”或“机密”中配置了以下对应 Key:
@@ -50,10 +50,10 @@ baihu-panel提供了一套**零配置**的内建助手库(Built-in SDK),
- `BHPKG_OPENAPI_URL` (可选):默认为本地面板 API 地址。
#### 2. 环境初始化
在开始编写脚本前,您需要在终端执行以下命令,为面板管理的所有语言环境安装 `baihu` 包:
在开始编写脚本前,您需要在终端执行以下命令,为面板管理的所有语言环境安装 `taskpool` 包:
```bash
baihu builtininstall
taskpool builtininstall
```
*该操作会将助手库安装到 mise 管理的所有版本中,确保 import 成功。*
@@ -61,27 +61,27 @@ baihu builtininstall
##### Python (同步调用)
```python
import baihu
import taskpool
# 消息通知
baihu.notify("任务标题", "通知正文内容")
taskpool.notify("任务标题", "通知正文内容")
# 环境变量与任务管理(详细用法见内置库示例)
envs = baihu.get_envs()
tasks = baihu.get_tasks()
envs = taskpool.get_envs()
tasks = taskpool.get_tasks()
```
##### Node.js (异步调用)
```javascript
const baihu = require('baihu');
const taskpool = require('taskpool');
// 消息通知
baihu.notify("任务标题", "通知正文内容");
taskpool.notify("任务标题", "通知正文内容");
// 环境变量与任务管理(详细用法见内置库示例)
(async () => {
const envs = await baihu.getEnvs();
const tasks = await baihu.getTasks();
const envs = await taskpool.getEnvs();
const tasks = await taskpool.getTasks();
})();
```
@@ -128,5 +128,5 @@ def send_notify(title, content):
除了配置发送路径,您还可以在消息中心进行以下操作:
- **发送记录 (审计)**:实时记录每一条通过baihu-panel发送至外部的消息,方便追溯。
- **发送记录 (审计)**:实时记录每一条通过taskpool发送至外部的消息,方便追溯。
- **回执查询**:在 **「消息日志」** 页面查看到每条推送的详细状态,如果发送失败,会提供原始的错误响应代码以供排查。
+1 -1
View File
@@ -144,7 +144,7 @@ const filteredStats = computed(() => {
# 镜像下载量统计
本页面展示 GitHub Container Registry 上白虎面板`ghcr.io/engigu/baihu`)各版本镜像的 Pull(下载)数量统计。数据在文档部署时自动更新。
本页面展示 GitHub Container Registry 上任务池`ghcr.io/engigu/taskpool`)各版本镜像的 Pull(下载)数量统计。数据在文档部署时自动更新。
<div class="update-time-box">
<span>数据更新时间:</span>
+1 -1
View File
@@ -1,6 +1,6 @@
# 脚本管理
脚本管理提供了baihu-panel的在线文件资源浏览器和编辑器。
脚本管理提供了taskpool的在线文件资源浏览器和编辑器。
## 资源管理器
+1 -1
View File
@@ -1,6 +1,6 @@
# 仓库同步 (Repo)
仓库同步允许baihu-panel直接以 Git 仓库的形式管理和更新脚本库,极大地方便了脚本的大规模分发与自动化部署。
仓库同步允许taskpool直接以 Git 仓库的形式管理和更新脚本库,极大地方便了脚本的大规模分发与自动化部署。
## 同步源管理
+4 -4
View File
@@ -1,6 +1,6 @@
# 定时任务
定时任务是baihu-panel的核心模块,支持对各类多语言脚本、命令进行精细化执行管理。
定时任务是taskpool的核心模块,支持对各类多语言脚本、命令进行精细化执行管理。
## 任务属性
@@ -24,11 +24,11 @@
## 特殊任务类型
除了标准的 Cron 定时触发,baihu-panel还支持以下特殊触发场景:
除了标准的 Cron 定时触发,taskpool还支持以下特殊触发场景:
### 开机启动任务 (`baihu_startup`)
### 开机启动任务 (`taskpool_startup`)
当您在定时规则(Schedule)中填写 `baihu_startup` 时,该任务将被标记为**系统启动任务**。
当您在定时规则(Schedule)中填写 `taskpool_startup` 时,该任务将被标记为**系统启动任务**。
- **触发时机**: 面板主进程启动或重启完成后立即执行。
- **应用场景**:
- 自动挂载磁盘或网络共享。
+1 -1
View File
@@ -1,6 +1,6 @@
# 功能特性
baihu-panel不仅提供基础的脚本执行功能,还集成了众多的实用工具和管理模块。
taskpool不仅提供基础的脚本执行功能,还集成了众多的实用工具和管理模块。
## 数据仪表
+13 -13
View File
@@ -1,6 +1,6 @@
# 前端定制 (WebUI)
baihu-panel支持完全接管和替换默认系统面板界面。你可以开发自己专属的前端主题,甚至添加自定义的前端交互功能,并打包为独立的 WebUI 资源包上传至系统应用。
taskpool支持完全接管和替换默认系统面板界面。你可以开发自己专属的前端主题,甚至添加自定义的前端交互功能,并打包为独立的 WebUI 资源包上传至系统应用。
> [!IMPORTANT]
> **安全与一致性维护声明**
@@ -21,33 +21,33 @@ baihu-panel支持完全接管和替换默认系统面板界面。你可以开发
> 自定义前端包若存在 Bug 或打包不完整可能导致界面白屏。如果不慎应用了错误或不兼容的包,请使用下方命令行工具恢复。
### 2. 命令行 (CLI) 运维
当界面因异常白屏无法访问时,可以进入baihu-panel容器/服务器终端,使用 `baihu webui` 命令一键管理或恢复:
当界面因异常白屏无法访问时,可以进入taskpool容器/服务器终端,使用 `taskpool webui` 命令一键管理或恢复:
- **一键恢复默认内置界面**
```bash
baihu webui reset
taskpool webui reset
```
- **查看已安装的资源包列表**
```bash
baihu webui list
taskpool webui list
```
- **手动切换/启用前端包**
```bash
baihu webui set <包名>
taskpool webui set <包名>
```
- **删除指定的前端包**
```bash
baihu webui delete <包名>
taskpool webui delete <包名>
```
---
## 开发自定义前端
baihu-panel的前端架构是完全解耦的。你可以选择以下两种方式之一来定制专属前端:
taskpool的前端架构是完全解耦的。你可以选择以下两种方式之一来定制专属前端:
### 方式一:基于现有代码二次开发(推荐)
如果你只是想修改部分样式、布局,或者在原有功能基础上增加新特性,最简单的方式是 **Fork `baihu-panel` 项目**。
如果你只是想修改部分样式、布局,或者在原有功能基础上增加新特性,最简单的方式是 **Fork `taskpool` 项目**。
1. Fork 本项目并克隆代码到本地。
2. 直接在项目的 `web/` 目录下,对现有的 Vue3 源码进行修改与定制。
3. 修改完成后,利用项目自带的 Makefile 打包命令(见下方说明)一键将你的修改编译为独立的 WebUI 资源包。
@@ -55,7 +55,7 @@ baihu-panel的前端架构是完全解耦的。你可以选择以下两种方式
### 方式二:从零开始全新开发
如果你想用自己熟悉的技术栈(如 React, Angular,或者是纯静态的 HTML/JS)完全重写整个面板,这也是完全支持的!你只需要按照下方的核心规范进行开发和打包即可。
### 1. 核心校验规则
baihu-panel后端提取并启用前端资源时,会执行以下强校验:
taskpool后端提取并启用前端资源时,会执行以下强校验:
1. **压缩包根目录下必须包含 `index.html`**:作为单页应用 (SPA) 的静态入口文件。
2. **压缩包根目录下必须包含 `uimanifest.json`**:声明该前端包的元数据信息。
@@ -67,7 +67,7 @@ baihu-panel后端提取并启用前端资源时,会执行以下强校验:
"name": "custom-neon-theme",
"version": "1.0.2",
"author": "YourName",
"description": "baihu-panel霓虹暗黑风定制前端主题",
"description": "taskpool霓虹暗黑风定制前端主题",
"min_panel_version": "1.0.0"
}
```
@@ -78,7 +78,7 @@ baihu-panel后端提取并启用前端资源时,会执行以下强校验:
在独立开发自定义前端时,需要配置请求与后端的通信地址及代理:
- **后端默认服务地址与端口**
baihu-panel后端服务默认运行在端口 `8052` 上,本地调试 API 的基础 URL 通常为:
taskpool后端服务默认运行在端口 `8052` 上,本地调试 API 的基础 URL 通常为:
`http://127.0.0.1:8052/api/v1`
- **本地开发环境代理配置(以 Vite 为例)**:
@@ -88,7 +88,7 @@ baihu-panel后端提取并启用前端资源时,会执行以下强校验:
server: {
proxy: {
'/api/v1': {
target: 'http://127.0.0.1:8052', // 本地运行的baihu-panel后端地址
target: 'http://127.0.0.1:8052', // 本地运行的taskpool后端地址
changeOrigin: true
}
}
@@ -116,7 +116,7 @@ baihu-panel后端提取并启用前端资源时,会执行以下强校验:
## 打包前端资源包(现成)
你可以利用baihu-panel项目自带的 `Makefile` 脚本,在现在的前端页面进行修改,将开发好的前端项目快速编译打包成标准的 `.tar.gz` 前端资源包, 自己使用或者分享使用。
你可以利用taskpool项目自带的 `Makefile` 脚本,在现在的前端页面进行修改,将开发好的前端项目快速编译打包成标准的 `.tar.gz` 前端资源包, 自己使用或者分享使用。
### 使用 Makefile 打包
+3 -3
View File
@@ -3,19 +3,19 @@
layout: home
hero:
name: "baihu-panel"
name: "taskpool"
text: "极致轻量、高性能的自动化任务调度平台"
tagline: "采用 Go + Vue3 架构,专注于高性能与低系统开销。"
image:
src: /logo.svg
alt: Baihu Logo
alt: TaskPool Logo
actions:
- theme: brand
text: 快速开始
link: /guide/introduction
- theme: alt
text: 查看源码
link: https://github.com/engigu/baihu-panel
link: https://github.com/engigu/taskpool
features:
- title: 极致轻量
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "baihu-docs",
"name": "taskpool-docs",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "baihu-docs",
"name": "taskpool-docs",
"version": "1.0.0",
"dependencies": {
"@scalar/api-reference": "^1.48.2",
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "baihu-docs",
"name": "taskpool-docs",
"version": "1.0.0",
"scripts": {
"docs:dev": "vitepress dev",
+8 -8
View File
@@ -1,4 +1,4 @@
const baihu = require('baihu');
const taskpool = require('taskpool');
/**
* 内建工具环境变量管理测试示例 (Node.js)
@@ -13,14 +13,14 @@ async function main() {
try {
// 获取全部环境变量
const envs = await baihu.getEnvs();
const envs = await taskpool.getEnvs();
console.log(`当前共有 ${envs.length} 个环境变量`);
// 新增一个临时环境变量
const newEnvName = "BHPKG_TEST_KEY_JS";
const newEnvVal = "HelloBaihuJS";
const newEnvVal = "HelloTaskPoolJS";
console.log(`正在创建环境变量: ${newEnvName}...`);
const createdEnv = await baihu.addEnv(
const createdEnv = await taskpool.addEnv(
newEnvName,
newEnvVal,
"Node.js SDK 测试自动创建"
@@ -28,14 +28,14 @@ async function main() {
console.log(`创建成功: ID=${createdEnv.id}, Name=${createdEnv.name}`);
// 查询该环境变量
const checkedEnv = await baihu.getEnv(newEnvName);
const checkedEnv = await taskpool.getEnv(newEnvName);
if (checkedEnv) {
console.log(`成功查询到变量: ${checkedEnv.name} = ${checkedEnv.value}`);
// 修改该环境变量的值
const updatedVal = "HelloBaihuJS_Updated";
const updatedVal = "HelloTaskPoolJS_Updated";
console.log(`正在修改环境变量的值为: ${updatedVal}...`);
const updatedEnv = await baihu.updateEnv(
const updatedEnv = await taskpool.updateEnv(
checkedEnv.id,
newEnvName,
updatedVal,
@@ -45,7 +45,7 @@ async function main() {
// 删除该临时环境变量
console.log(`正在删除临时环境变量: ID=${checkedEnv.id}...`);
await baihu.deleteEnv(checkedEnv.id);
await taskpool.deleteEnv(checkedEnv.id);
console.log("删除成功!");
}
+9 -9
View File
@@ -1,9 +1,9 @@
import baihu
import taskpool
# 内建工具环境变量管理测试示例 (Python)
#
# 前提条件:
# 1. 已经在环境中安装了 baihu 包(例如通过 `baihu builtininstall`
# 1. 已经在环境中安装了 taskpool 包(例如通过 `taskpool builtininstall`
# 2. 环境中已注入有效环境变量:
# - BHPKG_OPENAPI_TOKEN (必填,用于管理接口鉴权)
@@ -12,14 +12,14 @@ def main():
try:
# 获取全部环境变量
envs = baihu.get_envs()
envs = taskpool.get_envs()
print(f"当前共有 {len(envs)} 个环境变量")
# 新增一个临时环境变量
new_env_name = "BHPKG_TEST_KEY"
new_env_val = "HelloBaihu"
new_env_val = "HelloTaskPool"
print(f"正在创建环境变量: {new_env_name}...")
created_env = baihu.add_env(
created_env = taskpool.add_env(
name=new_env_name,
value=new_env_val,
remark="Python SDK 测试自动创建"
@@ -27,14 +27,14 @@ def main():
print(f"创建成功: ID={created_env.get('id')}, Name={created_env.get('name')}")
# 查询刚才创建的环境变量详情
checked_env = baihu.get_env(new_env_name)
checked_env = taskpool.get_env(new_env_name)
if checked_env:
print(f"成功查询到变量: {checked_env.get('name')} = {checked_env.get('value')}")
# 修改该环境变量的值
updated_val = "HelloBaihu_Updated"
updated_val = "HelloTaskPool_Updated"
print(f"正在修改环境变量的值为: {updated_val}...")
updated_env = baihu.update_env(
updated_env = taskpool.update_env(
id=checked_env.get("id"),
name=new_env_name,
value=updated_val,
@@ -44,7 +44,7 @@ def main():
# 删除该临时环境变量
print(f"正在删除临时环境变量: ID={checked_env.get('id')}...")
baihu.delete_env(checked_env.get("id"))
taskpool.delete_env(checked_env.get("id"))
print("删除成功!")
except Exception as e:
+3 -3
View File
@@ -1,4 +1,4 @@
const baihu = require('baihu');
const taskpool = require('taskpool');
/**
* 内建通知测试示例 (Node.js)
@@ -12,7 +12,7 @@ console.log("正在尝试发送 Node.js 内建通知...");
try {
// 简单的一行代码即可完成推送
baihu.notify(
taskpool.notify(
"Node.js 任务提醒",
"这是一条来自 Node.js 示例脚本的通知消息。无需配置 API 地址或 Token。"
);
@@ -22,5 +22,5 @@ try {
} catch (e) {
console.error(`通知失败: ${e.message}`);
console.error("请检查环境变量是否注入,或是否已运行过 'baihu builtininstall'。");
console.error("请检查环境变量是否注入,或是否已运行过 'taskpool builtininstall'。");
}
+3 -3
View File
@@ -1,9 +1,9 @@
import baihu
import taskpool
# 内建通知测试示例 (Python)
#
# 前提条件:
# 1. 已经在环境中安装了 baihu 包(例如通过 `baihu builtininstall`
# 1. 已经在环境中安装了 taskpool 包(例如通过 `taskpool builtininstall`
# 2. 环境中已注入有效环境变量:
# - BHPKG_NOTIFY_TOKEN
# - BHPKG_NOTIFY_CHANNEL
@@ -13,7 +13,7 @@ def main():
try:
# 调用内建 notify 函数
# 内部会自动使用 BHPKG_NOTIFY_TOKEN & BHPKG_NOTIFY_CHANNEL 进行鉴权和投递
response = baihu.notify(
response = taskpool.notify(
title="Python 任务提醒",
text="这是一条来自 Python 示例脚本的通知消息。调用非常简单!"
)
+4 -4
View File
@@ -1,4 +1,4 @@
const baihu = require('baihu');
const taskpool = require('taskpool');
/**
* 内建工具任务管理测试示例 (Node.js)
@@ -13,7 +13,7 @@ async function main() {
try {
// 获取所有任务列表
const tasks = await baihu.getTasks();
const tasks = await taskpool.getTasks();
console.log(`成功获取到 ${tasks.length} 个定时任务:`);
tasks.slice(0, 5).forEach(task => { // 仅展示前5项
console.log(` - [${task.id}] ${task.name} (表达式: ${task.schedule || ''}, 备注: ${task.remark || ''})`);
@@ -23,12 +23,12 @@ async function main() {
if (tasks.length > 0) {
const targetTask = tasks[0];
console.log(`\n尝试手动触发任务运行: [${targetTask.id}] ${targetTask.name}...`);
await baihu.executeTask(targetTask.id);
await taskpool.executeTask(targetTask.id);
console.log("执行指令发送成功。");
}
// 获取最近的执行结果列表
const results = await baihu.getLastResults();
const results = await taskpool.getLastResults();
console.log(`\n最近共有 ${results.length} 条任务执行记录。`);
} catch (e) {
+5 -5
View File
@@ -1,9 +1,9 @@
import baihu
import taskpool
# 内建工具任务管理与执行控制测试示例 (Python)
#
# 前提条件:
# 1. 已经在环境中安装了 baihu 包(例如通过 `baihu builtininstall`
# 1. 已经在环境中安装了 taskpool 包(例如通过 `taskpool builtininstall`
# 2. 环境中已注入有效环境变量:
# - BHPKG_OPENAPI_TOKEN (必填,用于管理接口鉴权)
@@ -12,7 +12,7 @@ def main():
try:
# 获取所有任务列表
tasks = baihu.get_tasks()
tasks = taskpool.get_tasks()
print(f"成功获取到 {len(tasks)} 个定时任务:")
for task in tasks[:5]: # 仅打印前5个
print(f" - [{task.get('id')}] {task.get('name')} (表达式: {task.get('schedule')}, 备注: {task.get('remark')})")
@@ -21,11 +21,11 @@ def main():
if tasks:
target_task = tasks[0]
print(f"\n尝试手动触发任务运行: [{target_task.get('id')}] {target_task.get('name')}...")
result = baihu.execute_task(target_task.get("id"))
result = taskpool.execute_task(target_task.get("id"))
print("执行指令发送成功。")
# 获取最近的执行结果列表
results = baihu.get_last_results()
results = taskpool.get_last_results()
print(f"\n最近共有 {len(results)} 条任务执行记录。")
except Exception as e:
+1 -1
View File
@@ -1,6 +1,6 @@
"""
Python 示例:通过 Playwright 连接 Browserless,并抓取页面截图。
运行前请先在 Baihu 的“语言依赖”中为 Python 安装 playwright 包。
运行前请先在 TaskPool 的“语言依赖”中为 Python 安装 playwright 包。
如果使用 Browserless,请不要执行 `playwright install`。
"""
+17 -17
View File
@@ -1,6 +1,6 @@
# Playwright 示例
这组示例用于演示如何在 Baihu 中通过远程 Browserless / Chromium 服务执行浏览器自动化,并完成一次最小可用的页面截图。
这组示例用于演示如何在 TaskPool 中通过远程 Browserless / Chromium 服务执行浏览器自动化,并完成一次最小可用的页面截图。
当前目录包含两个脚本:
@@ -16,11 +16,11 @@ example/
- `playwright.py`Python 示例,使用 `playwright` 连接 Browserless
其中 Python 方案是最主流、也最接近 Puppeteer 使用体验的一种。
同时建议在 Baihu 中为 Python 示例安装并使用 Python `3.11` 版本,因为过高版本的 Python 可能会出现依赖安装失败。
同时建议在 TaskPool 中为 Python 示例安装并使用 Python `3.11` 版本,因为过高版本的 Python 可能会出现依赖安装失败。
## 先安装语言依赖
运行脚本前,请先到 Baihu 的“语言依赖”页面安装对应的包,否则任务会因为缺少模块而失败。
运行脚本前,请先到 TaskPool 的“语言依赖”页面安装对应的包,否则任务会因为缺少模块而失败。
- 运行 `playwright.js` 前,请在 Node.js 语言依赖中安装:`puppeteer-core`
- 运行 `playwright.py` 前,请在 Python 语言依赖中安装:`playwright`
@@ -36,13 +36,13 @@ example/
## 适用场景
- 验证 Baihu 到 Browserless 的网络连通性
- 验证 TaskPool 到 Browserless 的网络连通性
- 验证远程浏览器地址和 Token 是否配置正确
- 快速测试浏览器自动化脚本是否能正常运行
## 推荐部署方式
建议配合 `browserless/chromium` 一起使用,再由 Baihu 中的脚本连接远程浏览器服务。
建议配合 `browserless/chromium` 一起使用,再由 TaskPool 中的脚本连接远程浏览器服务。
参考 `docker-compose.yml`
@@ -70,9 +70,9 @@ services:
timeout: 10s
retries: 3
baihu:
image: ghcr.io/engigu/baihu:latest
container_name: baihu
taskpool:
image: ghcr.io/engigu/taskpool:latest
container_name: taskpool
restart: unless-stopped
ports:
- "8052:8052"
@@ -84,8 +84,8 @@ services:
- BH_SERVER_PORT=8052
- BH_SERVER_HOST=0.0.0.0
- BH_DB_TYPE=sqlite
- BH_DB_PATH=/app/data/baihu.db
- BH_DB_TABLE_PREFIX=baihu_
- BH_DB_PATH=/app/data/taskpool.db
- BH_DB_TABLE_PREFIX=taskpool_
logging:
driver: json-file
options:
@@ -97,10 +97,10 @@ services:
## 使用步骤
1. 启动 `browser``baihu` 服务。
2.Baihu 的“语言依赖”中安装对应包。
1. 启动 `browser``taskpool` 服务。
2.TaskPool 的“语言依赖”中安装对应包。
3. 按实际环境修改脚本中的 Browserless 地址和 Token。
4.Baihu 中创建任务并运行对应脚本。
4.TaskPool 中创建任务并运行对应脚本。
Python 示例的核心写法如下:
@@ -120,7 +120,7 @@ with sync_playwright() as p:
## 运行前检查
- Browserless 服务已经正常启动
- Baihu 可以访问 Browserless 地址
- TaskPool 可以访问 Browserless 地址
- `TOKEN` 与 Browserless 配置保持一致
- 脚本中的地址、端口和协议填写正确
@@ -137,7 +137,7 @@ with sync_playwright() as p:
这是预期行为。
如果你使用的是 Browserless 这类远程浏览器服务,Playwright 只是作为客户端发起连接,不需要在白虎容器里再下载本地浏览器,所以通常不要执行 `playwright install`
如果你使用的是 Browserless 这类远程浏览器服务,Playwright 只是作为客户端发起连接,不需要在任务池容器里再下载本地浏览器,所以通常不要执行 `playwright install`
### 3. 连接不上 Browserless
@@ -145,7 +145,7 @@ with sync_playwright() as p:
- Browserless 服务是否正常启动
- Token 是否正确
- Baihu 与 Browserless 是否在同一网络中
- TaskPool 与 Browserless 是否在同一网络中
- 地址是否写成了当前运行环境可访问的地址
### 4. 页面打开超时
@@ -167,4 +167,4 @@ with sync_playwright() as p:
## 说明
这组示例主要用于快速验证 Baihu 与远程浏览器服务之间的连通性,以及对应语言环境是否已经配置完成。
这组示例主要用于快速验证 TaskPool 与远程浏览器服务之间的连通性,以及对应语言环境是否已经配置完成。
+1 -1
View File
@@ -1,4 +1,4 @@
module github.com/engigu/baihu-panel
module github.com/engigu/taskpool
go 1.26.0
+21 -12
View File
@@ -8,14 +8,14 @@ import (
"sync"
"time"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/database"
"github.com/engigu/baihu-panel/internal/executor"
"github.com/engigu/baihu-panel/internal/logger"
"github.com/engigu/baihu-panel/internal/router"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/tunnel"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/database"
"github.com/engigu/taskpool/internal/executor"
"github.com/engigu/taskpool/internal/logger"
"github.com/engigu/taskpool/internal/router"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/tunnel"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
@@ -59,7 +59,7 @@ func InitBasic() *App {
app.initConfigWithPath("")
app.initDatabase()
logger.Infof("[System] 低于1.0.11版本升级最新版本错误指引: https://github.com/engigu/baihu-panel/issues/64")
logger.Infof("[System] 低于1.0.11版本升级最新版本错误指引: https://github.com/engigu/taskpool/issues/64")
globalApp = app
})
return globalApp
@@ -93,21 +93,30 @@ func (a *App) initConfigWithPath(path string) {
return
}
a.setupBaihuBin()
a.setupTaskPoolBin()
}
func (a *App) setupBaihuBin() {
func (a *App) setupTaskPoolBin() {
binDir := filepath.Join(constant.DataDir, "bin")
_ = os.MkdirAll(binDir, 0755)
exe, err := os.Executable()
if err == nil {
linkPath := filepath.Join(binDir, "baihu")
// 新命令名
linkPath := filepath.Join(binDir, "taskpool")
if runtime.GOOS == "windows" {
linkPath += ".exe"
}
os.Remove(linkPath)
_ = os.Symlink(exe, linkPath)
// 兼容旧命令名 baihu
legacyPath := filepath.Join(binDir, "baihu")
if runtime.GOOS == "windows" {
legacyPath += ".exe"
}
os.Remove(legacyPath)
_ = os.Symlink(exe, legacyPath)
}
}
+2 -2
View File
@@ -9,7 +9,7 @@ import (
"strings"
"time"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/taskpool/internal/services"
)
// SendInternalRequest 向常驻后台主服务安全发送内部通信请求
@@ -49,7 +49,7 @@ func SendInternalRequest(method, relPath string, payload interface{}) ([]byte, i
client := &http.Client{Timeout: 5 * time.Second}
resp, err := client.Do(req)
if err != nil {
return nil, 0, fmt.Errorf("网络连接失败,请确保白虎面板常驻后台服务正在运行中: %v", err)
return nil, 0, fmt.Errorf("网络连接失败,请确保任务池常驻后台服务正在运行中: %v", err)
}
defer resp.Body.Close()
+3 -3
View File
@@ -3,9 +3,9 @@ package cache
import (
"sync"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/database"
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/database"
"github.com/engigu/taskpool/internal/models"
)
// siteCache 站点设置内存缓存
+4 -4
View File
@@ -127,9 +127,9 @@ const (
PinTypeNone = "none"
PinTypeTop = "top"
// 触发类型
// 触发类型(新值 taskpool_startup;读取时兼容旧值 baihu_startup
TriggerTypeCron = "cron"
TriggerTypeBaihuStartup = "baihu_startup"
TriggerTypeTaskPoolStartup = "taskpool_startup"
// Agent 状态
AgentStatusOnline = "online"
@@ -209,7 +209,7 @@ var DefaultIcon = `<svg t="1766107903919" class="icon" viewBox="0 0 1024 1024" v
// DefaultSettings 默认系统设置
var DefaultSettings = map[string]map[string]string{
SectionSite: {
KeyTitle: "白虎面板",
KeyTitle: "任务池",
KeySubtitle: "极致轻量、高性能的自动化任务调度平台",
KeyIcon: DefaultIcon,
KeyPageSize: "10",
@@ -222,7 +222,7 @@ var DefaultSettings = map[string]map[string]string{
KeyRateInterval: "200",
},
SectionNotify: {
KeyNotifyPrefix: "[白虎面板]",
KeyNotifyPrefix: "[任务池]",
// Login
KeyNotifyTemplateUserLoginTitle: "用户登录(成功/失败)",
KeyNotifyTemplateUserLoginText: "用户 {{username}} 在 IP {{ip}} 登录{{status_label}}\n{{message}}",
+1 -1
View File
@@ -26,7 +26,7 @@ func init() {
rootDir := ResolveAppRootDir()
ConfigPath = filepath.Clean(filepath.Join(rootDir, "configs", "config.ini"))
DataDir = filepath.Clean(filepath.Join(rootDir, "data"))
DefaultDBPath = filepath.Clean(filepath.Join(rootDir, "data", "baihu.db"))
DefaultDBPath = filepath.Clean(filepath.Join(rootDir, "data", "taskpool.db"))
WebDistDir = filepath.Clean(filepath.Join(rootDir, "web", "dist"))
ScriptsWorkDir = filepath.Clean(filepath.Join(rootDir, "data", "scripts"))
}
+3 -3
View File
@@ -52,7 +52,7 @@ func initSentences() {
func GetRandomSentence() string {
initSentences()
if lineCount <= 0 {
return "欢迎使用白虎面板"
return "欢迎使用任务池"
}
targetIndex := rand.Intn(lineCount)
@@ -69,7 +69,7 @@ func GetRandomSentence() string {
// 提取行并清理两端的空白字符(包括 \r, \n)
line := bytes.TrimSpace(sentenceData[start:end])
if len(line) == 0 {
return "欢迎使用白虎面板"
return "欢迎使用任务池"
}
var sData []string
@@ -86,5 +86,5 @@ func GetRandomSentence() string {
return name
}
return "欢迎使用白虎面板"
return "欢迎使用任务池"
}
+7 -7
View File
@@ -7,13 +7,13 @@ import (
"strings"
"time"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/logger"
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/baihu-panel/internal/models/vo"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/services/tasks"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/logger"
"github.com/engigu/taskpool/internal/models"
"github.com/engigu/taskpool/internal/models/vo"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/services/tasks"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
+2 -2
View File
@@ -1,8 +1,8 @@
package controllers
import (
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
+5 -5
View File
@@ -5,11 +5,11 @@ import (
"sync"
"time"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/eventbus"
"github.com/engigu/baihu-panel/internal/middleware"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/eventbus"
"github.com/engigu/taskpool/internal/middleware"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
+5 -5
View File
@@ -4,11 +4,11 @@ import (
"sort"
"time"
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/database"
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/baihu-panel/internal/services/tasks"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/database"
"github.com/engigu/taskpool/internal/models"
"github.com/engigu/taskpool/internal/services/tasks"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
+3 -3
View File
@@ -1,9 +1,9 @@
package controllers
import (
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/models"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
@@ -5,11 +5,11 @@ import (
"os"
"strings"
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/baihu-panel/internal/models/vo"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/services/deps"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/models"
"github.com/engigu/taskpool/internal/models/vo"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/services/deps"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
@@ -410,10 +410,10 @@ func (c *DependencyController) GetDepInstallCommand(ctx *gin.Context) {
execPath, err := os.Executable()
if err != nil {
execPath = "baihu" // 兜底
execPath = "taskpool" // 兜底
}
// 构造命令,比如: "F:\workspace\baihu-panel\baihu.exe" depinstall <log_id>
// 构造命令,比如: "F:\workspace\taskpool\taskpool.exe" depinstall <log_id>
cmdStr := fmt.Sprintf("%q depinstall %s", execPath, logID)
utils.Success(ctx, gin.H{
"command": cmdStr,
+7 -7
View File
@@ -1,13 +1,13 @@
package controllers
import (
"github.com/engigu/baihu-panel/internal/constant"
"github.com/engigu/baihu-panel/internal/database"
"github.com/engigu/baihu-panel/internal/models"
"github.com/engigu/baihu-panel/internal/models/vo"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/baihu-panel/internal/services/relation"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/constant"
"github.com/engigu/taskpool/internal/database"
"github.com/engigu/taskpool/internal/models"
"github.com/engigu/taskpool/internal/models/vo"
"github.com/engigu/taskpool/internal/services"
"github.com/engigu/taskpool/internal/services/relation"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
+3 -3
View File
@@ -3,9 +3,9 @@ package controllers
import (
"strconv"
"github.com/engigu/baihu-panel/internal/models/vo"
"github.com/engigu/baihu-panel/internal/services/tasks"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/models/vo"
"github.com/engigu/taskpool/internal/services/tasks"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
+2 -2
View File
@@ -7,7 +7,7 @@ import (
"strings"
"time"
"github.com/engigu/baihu-panel/internal/utils"
"github.com/engigu/taskpool/internal/utils"
"github.com/gin-gonic/gin"
)
@@ -534,7 +534,7 @@ func (fc *FileController) DownloadZip(c *gin.Context) {
validatedAbsPaths = append(validatedAbsPaths, fullPath)
}
fileName := "baihu-export-" + time.Now().Format("20060102-150405") + ".zip"
fileName := "taskpool-export-" + time.Now().Format("20060102-150405") + ".zip"
if len(validatedAbsPaths) == 1 {
fileName = filepath.Base(validatedAbsPaths[0]) + ".zip"
}
+1 -1
View File
@@ -3,7 +3,7 @@ package controllers
import (
"net/http"
"github.com/engigu/baihu-panel/internal/services"
"github.com/engigu/taskpool/internal/services"
"github.com/gin-gonic/gin"
)

Some files were not shown because too many files have changed in this diff Show More