修改version号定义位置

This commit is contained in:
huangxd- committed 2025-09-14 07:19:00 +08:00
1 parent a7d6414903
commit ce299335a4
5 files changed
+9 -9

No files matched your search

+4 -4
View File
@@ -17,11 +17,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
# 读取 version 文件并设置版本号
- name: Read version from file
# 从 worker.js 中读取版本号
- name: Read version from worker.js
id: version
run: |
VERSION=$(cat danmu_api/version)
VERSION=$(grep 'const VERSION' danmu_api/worker.js | sed -E 's/.*const VERSION = "(.*)".*/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
# 设置 Docker 镜像缓存(可选,加速构建)
@@ -43,4 +43,4 @@ jobs:
# 推送 Docker 镜像到 Docker Hub
- name: Push Docker image to Docker Hub
run: |
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ secrets.DOCKER_USERNAME }}/danmu-api:${{ env.VERSION }} --push .
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ secrets.DOCKER_USERNAME }}/danmu-api:${{ env.VERSION }} --push .
+1 -2
View File
@@ -1,4 +1,4 @@
# MuMu 弹幕 API 服务器
# LogVar 弹幕 API 服务器
一个人人都能部署的基于 js 的弹幕 API 服务器,兼容弹弹play的搜索、详情查询和弹幕获取功能,并提供日志记录,支持vercel/cloudflare/docker/claw等部署方式。
@@ -117,7 +117,6 @@ danmu_api/
├── danmu_api/
│ ├── README.md # 项目文档
│ ├── server.js # 本地node启动脚本
│ ├── version # 定义版本号
│ ├── worker.js # 主 API 服务器代码
│ ├── worker.test.js # 测试文件
├── .gitignore
-1
View File
@@ -1 +0,0 @@
0.0.1
+3 -1
View File
@@ -1,5 +1,6 @@
// 全局状态(Cloudflare 和 Vercel 都可能重用实例)
// ⚠️ 不是持久化存储,每次冷启动会丢失
const VERSION = "0.0.2";
let animes = [];
let episodeIds = [];
let episodeNum = 10001; // 全局变量,用于自增 ID
@@ -687,7 +688,8 @@ async function handleRequest(req, env) {
if (path === "/" && method === "GET") {
log("log", "Accessed homepage with repository information");
return jsonResponse({
message: "Welcome to the MuMu Danmu API server",
message: "Welcome to the LogVar Danmu API server",
version: VERSION,
repository: "https://github.com/huangxd-/danmu_api.git",
description: "一个人人都能部署的基于 js 的弹幕 API 服务器,兼容弹弹play的搜索、详情查询和弹幕获取功能,并提供日志记录,支持vercel/cloudflare/docker/claw等部署方式",
notice: "本项目仅为个人爱好开发,代码开源。如有任何侵权行为,请联系本人删除。"
+1 -1
View File
@@ -32,7 +32,7 @@ test('worker.js API endpoints', async (t) => {
assert.equal(res.status, 200);
assert.equal(res.headers.get('Content-Type'), 'application/json');
assert.deepEqual(body.message, 'Welcome to the MuMu Danmu API server');
assert.deepEqual(body.message, 'Welcome to the LogVar Danmu API server');
});
await t.test('GET tencent danmu', async () => {