Compare commits

..

25 Commits
v1.6.1 ... main

Author SHA1 Message Date
64496ba566 feat: Banben 2026-02-07 19:48:49 -08:00
75e7e43465 feat: Banben 2026-02-07 19:47:16 -08:00
efc47cf8bd feat(根系版本): 版本 2026-02-07 19:27:21 -08:00
a8832d4777 更新package.json 2026-02-07 22:21:04 -05:00
b1d246d1ac 更新 package.json 2026-02-07 22:19:05 -05:00
3c0e544c97 feat: Gengx 2026-02-06 20:26:46 -08:00
7df01e454c feat: 修改配置文件 2026-02-06 20:16:21 -08:00
d05cd8ed3d 更新 README.md
Some checks failed
CI / build (20.15.1) (push) Has been cancelled
2026-02-02 23:56:16 -05:00
5ddf9ade01 feat: 2 (#2)
Some checks failed
CI / build (20.15.1) (push) Failing after 19m30s
2026-01-27 20:14:52 -08:00
3b93b95177 🐛 fix: Ci
Some checks failed
CI / build (20.15.1) (push) Has been cancelled
2026-01-27 20:11:44 -08:00
57b841525d feat(ci): Ci
Some checks failed
CI / build (20.15.1) (push) Failing after 14m59s
2026-01-05 04:20:01 -08:00
1e147c8298 feat: Ci
Some checks failed
CI / build (20.15.1) (push) Failing after 14m49s
2026-01-05 03:55:10 -08:00
7419d8ebcd feat: 0
Some checks failed
CI / build (20.15.1) (push) Failing after 14m41s
2026-01-05 03:24:27 -08:00
56a955ae81 feat: 1
All checks were successful
CI / build (20.15.1) (push) Successful in 14m4s
2026-01-05 03:04:09 -08:00
e3aa52af01 merge(main): 合并 develop 到 main 并同步 CI/Docker 修复
Some checks failed
CI / build (20.15.1) (push) Failing after 16m25s
2026-01-03 22:03:52 -08:00
cf55495c1f ci(docker): 更新工作流中的镜像名称和容器名称
All checks were successful
CI / build (20.15.1) (push) Successful in 22m38s
将工作流中的 ppanel 相关镜像和容器名称统一更新为 fastvpn
修复 develop 分支名称拼写错误
2026-01-03 20:32:31 -08:00
c381a2b2ba fix(docker): 修正Dockerfile中的用户创建命令和CI分支条件
Some checks failed
CI / build (20.15.1) (push) Failing after 15m20s
修复Dockerfile中使用addgroup/adduser命令导致的兼容性问题,改用groupadd/useradd
修正CI配置中分支条件判断错误,将dev改为develop
2026-01-03 20:10:53 -08:00
43c909d1f2 ci: 更新构建任务的运行主机为fastvpn-admin01
Some checks failed
CI / build (20.15.1) (push) Failing after 16m8s
2026-01-03 19:50:27 -08:00
9eff6aa40d ci(workflow): 更新分支名称和API地址配置
Some checks failed
CI / build (20.15.1) (push) Has been cancelled
将dev分支重命名为develop分支
统一所有分支的API地址为https://api.hifast.biz
2026-01-03 19:47:44 -08:00
a211035025 ci(workflow): 更新构建任务运行的服务器节点
将构建任务从 fastvpn-admin01 迁移到 fastvpn-admin-web01 节点执行
2026-01-03 19:46:11 -08:00
aa745079db chore: 移除不再使用的GitHub工作流和模板文件
删除以下不再需要的文件:
- GitHub issue和pull request模板
- 自动合并、发布和issue管理的工作流
- VS Code配置文件
2026-01-03 19:44:33 -08:00
11942e2b9f docs: 添加项目说明文档和初始化配置
ci: 添加docker工作流配置并更新项目名称
2026-01-03 19:43:40 -08:00
b31c70a5c1 🐛 fix: 修改样式 2025-12-15 18:30:29 -08:00
75db379624 🐛 fix: 修改样式 2025-12-15 18:29:56 -08:00
c8401af672 🐛 fix: 更新next版本 2025-12-07 05:59:23 -08:00
38 changed files with 1677 additions and 446 deletions

790
.gitea/workflows/docker.yml Normal file
View File

@ -0,0 +1,790 @@
name: CI
on:
push:
branches:
- main
- develop
- cicd
pull_request:
branches:
- main
- develop
- cicd
env:
DOMAIN_URL: git.kxsw.us
REPO: ${{ vars.REPO }}
TELEGRAM_BOT_TOKEN: 8114337882:AAHkEx03HSu7RxN4IHBJJEnsK9aPPzNLIk0
TELEGRAM_CHAT_ID: "-4940243803"
DOCKER_REGISTRY: registry.kxsw.us
DOCKER_BUILDKIT: 1
DOCKER_API_VERSION: "1.44"
# Host SSH - 根据分支动态选择
SSH_HOST: ${{ github.ref_name == 'main' && vars.PRO_SSH_HOST || (github.ref_name == 'develop' && vars.DEV_SSH_HOST || vars.PRO_SSH_HOST) }}
SSH_PORT: ${{ github.ref_name == 'main' && vars.PRO_SSH_PORT || (github.ref_name == 'develop' && vars.DEV_SSH_PORT || vars.PRO_SSH_PORT) }}
SSH_USER: ${{ github.ref_name == 'main' && vars.PRO_SSH_USER || (github.ref_name == 'dedevelopv' && vars.DEV_SSH_USER || vars.PRO_SSH_USER) }}
SSH_PASSWORD: ${{ github.ref_name == 'main' && vars.PRO_SSH_PASSWORD || (github.ref_name == 'dedevelopv' && vars.DEV_SSH_PASSWORD || vars.PRO_SSH_PASSWORD) }}
jobs:
build:
runs-on: fastvpn-admin01
container:
image: node:20
strategy:
matrix:
# 只有node支持版本号别名
node: ['20.15.1']
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 缓存服务健康检查
id: cache-health
continue-on-error: true
run: |
echo "检查缓存服务可用性..."
# 设置缓存可用性标志
CACHE_AVAILABLE=true
# 测试GitHub Actions缓存API
if ! curl -s --connect-timeout 10 --max-time 30 "https://api.github.com/repos/${{ github.repository }}/actions/caches" > /dev/null 2>&1; then
echo "⚠️ GitHub Actions缓存服务不可用将跳过缓存步骤"
CACHE_AVAILABLE=false
else
echo "✅ 缓存服务可用"
fi
echo "CACHE_AVAILABLE=$CACHE_AVAILABLE" >> $GITHUB_ENV
echo "cache-available=$CACHE_AVAILABLE" >> $GITHUB_OUTPUT
- name: 缓存降级提示
if: env.CACHE_AVAILABLE == 'false'
run: |
echo "🔄 缓存服务不可用,构建将在无缓存模式下进行"
echo "⏱️ 这可能会增加构建时间,但不会影响构建结果"
echo "📦 所有依赖将重新下载和安装"
- name: Install system tools (jq, docker, curl)
run: |
set -e
export DEBIAN_FRONTEND=noninteractive
echo "Waiting for apt/dpkg locks (unattended-upgrades) to release..."
# Wait up to 300s for unattended-upgrades/apt/dpkg locks
end=$((SECONDS+300))
while true; do
LOCKS_BUSY=0
# If unattended-upgrades is running, mark busy
if pgrep -x unattended-upgrades >/dev/null 2>&1; then LOCKS_BUSY=1; fi
# If fuser exists, check common lock files
if command -v fuser >/dev/null 2>&1; then
if fuser /var/lib/dpkg/lock >/dev/null 2>&1 \
|| fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 \
|| fuser /var/lib/apt/lists/lock >/dev/null 2>&1; then
LOCKS_BUSY=1
fi
fi
# Break if not busy
if [ "$LOCKS_BUSY" -eq 0 ]; then break; fi
# Timeout after ~5 minutes
if [ $SECONDS -ge $end ]; then
echo "Timeout waiting for apt/dpkg locks, proceeding with Dpkg::Lock::Timeout..."
break
fi
echo "Still waiting for locks..."; sleep 5
done
apt-get update -y -o Dpkg::Lock::Timeout=600
# 基础工具和GPG
apt-get install -y -o Dpkg::Lock::Timeout=600 jq curl ca-certificates gnupg
# 配置Docker官方源安装新版CLI与Buildx插件支持 API 1.44+
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(. /etc/os-release && echo $VERSION_CODENAME) stable" > /etc/apt/sources.list.d/docker.list
apt-get update -y -o Dpkg::Lock::Timeout=600
apt-get install -y -o Dpkg::Lock::Timeout=600 docker-ce-cli docker-buildx-plugin
docker --version
jq --version
curl --version
- name: Set up Docker Buildx
run: |
# Check if buildx is available
if docker buildx version >/dev/null 2>&1; then
echo "Docker Buildx is available"
# Create builder if it doesn't exist
if ! docker buildx ls | grep -q "builder"; then
docker buildx create --name builder --driver docker-container
fi
# Use the builder
docker buildx use builder
docker buildx inspect --bootstrap
else
echo "Docker Buildx not available, using regular docker build"
fi
- name: Install Bun
run: |
echo "=== Installing Bun ==="
echo "Current working directory: $(pwd)"
echo "Current user: $(whoami)"
echo "Home directory: $HOME"
# 设置Bun安装路径
export BUN_INSTALL="$HOME/.bun"
echo "BUN_INSTALL=$BUN_INSTALL" >> $GITHUB_ENV
echo "PATH=$BUN_INSTALL/bin:${PATH}" >> $GITHUB_ENV
# 检查缓存是否存在
if [ -d "$BUN_INSTALL" ]; then
echo "✅ Bun cache found at $BUN_INSTALL"
ls -la "$BUN_INSTALL" || true
else
echo "❌ No Bun cache found, will install fresh"
fi
# 安装Bun
curl -fsSL https://bun.sh/install | bash
# 验证安装
"$BUN_INSTALL/bin/bun" --version
echo "✅ Bun installed successfully"
- name: Configure npm registry (npmmirror) and canvas mirror
run: |
echo "registry=https://registry.npmmirror.com" >> .npmrc
echo "canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas" >> .npmrc
- name: Install dependencies cache (Bun)
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.bun
key: bun-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-${{ runner.os }}-${{ matrix.node }}-
bun-${{ runner.os }}-
- name: Install dependencies cache (node_modules)
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
key: node-modules-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('bun.lock', 'package.json', 'apps/*/package.json', 'packages/*/package.json') }}
restore-keys: |
node-modules-${{ runner.os }}-${{ matrix.node }}-
node-modules-${{ runner.os }}-
- name: 缓存状态检查和设置
run: |
echo "=== 缓存状态检查 ==="
echo "检查缓存恢复状态..."
# 检查各种缓存目录
echo "Bun缓存: $([ -d ~/.bun ] && echo '✅ 已发现' || echo '❌ 缺失')"
echo "node_modules: $([ -d node_modules ] && echo '✅ 已发现' || echo '❌ 缺失')"
echo "Turbo缓存: $([ -d .turbo ] && echo '✅ 已发现' || echo '❌ 缺失')"
# 显示缓存大小
if [ -d ~/.bun ]; then
echo "Bun缓存大小: $(du -sh ~/.bun 2>/dev/null || echo '未知')"
fi
if [ -d node_modules ]; then
echo "node_modules大小: $(du -sh node_modules 2>/dev/null || echo '未知')"
fi
if [ -d .turbo ]; then
echo "Turbo缓存大小: $(du -sh .turbo 2>/dev/null || echo '未知')"
fi
echo "=== 缓存设置 ==="
# 确保缓存目录存在且权限正确
mkdir -p ~/.bun ~/.cache .turbo
chmod -R 755 ~/.bun ~/.cache .turbo 2>/dev/null || true
# 设置Bun环境变量
echo "BUN_INSTALL_CACHE_DIR=$HOME/.cache/bun" >> $GITHUB_ENV
echo "BUN_INSTALL_BIN_DIR=$HOME/.bun/bin" >> $GITHUB_ENV
echo "✅ 缓存目录已准备完成"
- name: Turborepo cache (.turbo)
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('apps//package.json') }}-${{ hashFiles('packages//package.json') }}-${{ hashFiles('bun.lock') }}
restore-keys: |
turbo-${{ runner.os }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('apps//package.json') }}-${{ hashFiles('packages//package.json') }}-
turbo-${{ runner.os }}-${{ hashFiles('turbo.json') }}-
turbo-${{ runner.os }}-
- name: 安装依赖 (bun)
run: |
echo "=== 依赖安装调试信息 ==="
echo "当前目录: $(pwd)"
echo "Bun版本: $(bun --version)"
# 检查node_modules缓存状态
if [ -d "node_modules" ]; then
echo "✅ 发现node_modules缓存"
echo "node_modules大小: $(du -sh node_modules 2>/dev/null || echo '未知')"
else
echo "❌ 未发现node_modules缓存"
fi
# 检查bun.lock文件
if [ -f "bun.lock" ]; then
echo "✅ 发现bun.lock文件"
else
echo "❌ 未发现bun.lock文件"
fi
echo "=== 开始安装依赖 ==="
echo "安装开始时间: $(date)"
bun install --frozen-lockfile
echo "安装完成时间: $(date)"
echo "=== 依赖安装完成 ==="
echo "最终node_modules大小: $(du -sh node_modules 2>/dev/null || echo '未知')"
# 验证缓存效果
echo "=== 缓存效果验证 ==="
if [ -d "node_modules" ]; then
echo "✅ 依赖安装成功"
echo "包数量: $(ls node_modules | wc -l 2>/dev/null || echo '未知')"
else
echo "⚠️ 依赖可能未完全安装"
fi
- name: Decide build target (admin/user/both)
run: |
set -e
COMMIT_MSG="${{ github.event.head_commit.message }}"
BUILD_TARGET="both"
if echo "$COMMIT_MSG" | grep -qi "\[admin-only\]"; then
BUILD_TARGET="admin"
elif echo "$COMMIT_MSG" | grep -qi "\[user-only\]"; then
BUILD_TARGET="user"
else
if git rev-parse HEAD^ >/dev/null 2>&1; then
RANGE="HEAD^..HEAD"
else
RANGE="$(git rev-list --max-parents=0 HEAD)..HEAD"
fi
CHANGED=$(git diff --name-only $RANGE || true)
ADMIN_MATCH=$(echo "$CHANGED" | grep -E '^(apps/admin/|docker/ppanel-admin-web/)' || true)
USER_MATCH=$(echo "$CHANGED" | grep -E '^(apps/user/|docker/ppanel-user-web/)' || true)
PACKAGE_MATCH=$(echo "$CHANGED" | grep -E '^(packages/|turbo.json|package.json|bun.lock)' || true)
if [ -n "$PACKAGE_MATCH" ]; then
BUILD_TARGET="both"
else
if [ -n "$ADMIN_MATCH" ] && [ -z "$USER_MATCH" ]; then BUILD_TARGET="admin"; fi
if [ -n "$USER_MATCH" ] && [ -z "$ADMIN_MATCH" ]; then BUILD_TARGET="user"; fi
if [ -n "$ADMIN_MATCH" ] && [ -n "$USER_MATCH" ]; then BUILD_TARGET="both"; fi
fi
fi
echo "BUILD_TARGET=$BUILD_TARGET" >> $GITHUB_ENV
echo "Decided BUILD_TARGET=$BUILD_TARGET"
- name: Read version from package.json
run: |
if [ "$BUILD_TARGET" = "admin" ]; then
VERSION=$(jq -r .version apps/admin/package.json)
echo "使用 admin 应用版本: $VERSION"
elif [ "$BUILD_TARGET" = "user" ]; then
VERSION=$(jq -r .version apps/user/package.json)
echo "使用 user 应用版本: $VERSION"
else
# both 或其他情况使用根目录版本
VERSION=$(jq -r .version package.json)
echo "使用根目录版本: $VERSION"
fi
if [ "$VERSION" = "null" ] || [ -z "$VERSION" ] || [ "$VERSION" = "undefined" ]; then
echo "检测到版本为空,回退到根目录版本"
VERSION=$(jq -r .version package.json)
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: 根据分支动态设置API地址
run: |
if [ "${{ github.ref_name }}" = "main" ]; then
echo "NEXT_PUBLIC_API_URL=https://api.hifast.biz" >> $GITHUB_ENV
echo "为main分支设置生产环境API地址"
elif [ "${{ github.ref_name }}" = "develop" ]; then
echo "NEXT_PUBLIC_API_URL=https://api.hifast.biz" >> $GITHUB_ENV
echo "为 develop 分支设置开发环境API地址"
else
echo "NEXT_PUBLIC_API_URL=https://api.hifast.biz" >> $GITHUB_ENV
echo "为其他分支设置默认API地址"
fi
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Cache Next.js build artifacts (.next/cache)
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
apps/admin/.next/cache
apps/user/.next/cache
key: nextcache-${{ runner.os }}-${{ hashFiles('apps//package.json') }}-${{ hashFiles('packages//package.json') }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('bun.lock') }}
restore-keys: |
nextcache-${{ runner.os }}-${{ hashFiles('apps//package.json') }}-${{ hashFiles('packages//package.json') }}-
nextcache-${{ runner.os }}-
- name: Cache build outputs
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
apps/admin/.next
apps/user/.next
apps/admin/dist
apps/user/dist
key: build-${{ runner.os }}-${{ hashFiles('apps//*.ts', 'apps//*.tsx', 'apps//*.js', 'apps//*.jsx') }}-${{ hashFiles('packages//*.ts', 'packages//*.tsx') }}-${{ hashFiles('bun.lock') }}
restore-keys: |
build-${{ runner.os }}-${{ hashFiles('apps//*.ts', 'apps//*.tsx', 'apps//*.js', 'apps//*.jsx') }}-
build-${{ runner.os }}-
- name: Cache ESLint
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
.eslintcache
apps/admin/.eslintcache
apps/user/.eslintcache
key: eslint-${{ runner.os }}-${{ hashFiles('.eslintrc*', 'apps//.eslintrc*', 'packages//.eslintrc*') }}-${{ hashFiles('bun.lock') }}
restore-keys: |
eslint-${{ runner.os }}-
- name: Cache TypeScript
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
.tsbuildinfo
apps/admin/.tsbuildinfo
apps/user/.tsbuildinfo
packages//.tsbuildinfo
key: typescript-${{ runner.os }}-${{ hashFiles('tsconfig*.json', 'apps//tsconfig*.json', 'packages//tsconfig*.json') }}-${{ hashFiles('bun.lock') }}
restore-keys: |
typescript-${{ runner.os }}-
- name: 构建管理面板
if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both'
run: bun run build --filter=ppanel-admin-web
- name: 构建用户面板
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
run: bun run build --filter=ppanel-user-web
- name: 构建并推送管理面板Docker镜像
if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both'
run: |
if docker buildx version >/dev/null 2>&1; then
echo "使用docker buildx进行优化构建"
docker buildx build \
--platform linux/amd64 \
--cache-from type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:cache \
--cache-to type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:cache,mode=max \
-f ./docker/ppanel-admin-web/Dockerfile \
-t ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:${{ env.VERSION }} \
--push .
else
echo "使用常规docker构建"
docker build -f ./docker/ppanel-admin-web/Dockerfile -t ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:${{ env.VERSION }} .
docker push ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:${{ env.VERSION }}
fi
- name: 构建并推送用户面板Docker镜像
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
run: |
if docker buildx version >/dev/null 2>&1; then
echo "使用docker buildx进行优化构建"
docker buildx build \
--platform linux/amd64 \
--cache-from type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-user-web:cache \
--cache-to type=registry,ref=${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-user-web:cache,mode=max \
-f ./docker/ppanel-user-web/Dockerfile \
-t ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-user-web:${{ env.VERSION }} \
--push .
else
echo "使用常规docker构建"
docker build -f ./docker/ppanel-user-web/Dockerfile -t ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-user-web:${{ env.VERSION }} .
docker push ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-user-web:${{ env.VERSION }}
fi
- name: SSH连接预检查
if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USER }}
password: ${{ env.SSH_PASSWORD }}
port: ${{ env.SSH_PORT }}
timeout: 300s
command_timeout: 600s
debug: true
script: |
echo "=== SSH连接测试 ==="
echo "连接时间: $(date)"
echo "服务器主机名: $(hostname)"
echo "当前用户: $(whoami)"
echo "系统信息: $(uname -a)"
echo "Docker版本: $(docker --version 2>/dev/null || echo 'Docker未安装')"
echo "✅ SSH连接成功"
- name: 部署管理面板到服务器
if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both'
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USER }}
password: ${{ env.SSH_PASSWORD }}
port: ${{ env.SSH_PORT }}
timeout: 300s
command_timeout: 600s
script: |
echo "=== SSH变量调试信息 ==="
echo "DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}"
echo "VERSION: ${{ env.VERSION }}"
echo "NEXT_PUBLIC_API_URL: ${{ env.NEXT_PUBLIC_API_URL }}"
echo "BRANCH: ${{ env.BRANCH }}"
echo "=== 部署管理面板 ==="
# 网络连通性检查
echo "检查镜像服务器连通性..."
REGISTRY_HOST=$(echo "${{ env.DOCKER_REGISTRY }}" | sed 's|https\?://||' | cut -d'/' -f1)
echo "镜像仓库地址: $REGISTRY_HOST"
if ping -c 3 "$REGISTRY_HOST" > /dev/null 2>&1; then
echo "✅ 镜像服务器连通性正常"
else
echo "⚠️ 镜像服务器ping失败但继续尝试拉取镜像"
fi
# 检查Docker登录状态
echo "检查Docker登录状态..."
if docker info > /dev/null 2>&1; then
echo "✅ Docker服务正常"
else
echo "❌ Docker服务异常"
exit 1
fi
# 拉取镜像(带重试)
echo "拉取Docker镜像..."
for i in {1..3}; do
echo "尝试拉取镜像 ($i/3): ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:${{ env.VERSION }}"
if docker pull ${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:${{ env.VERSION }}; then
echo "✅ 镜像拉取成功"
break
else
echo "❌ 镜像拉取失败,重试 $i/3"
echo "检查网络和镜像仓库状态..."
# 显示详细错误信息
echo "--- 网络诊断信息 ---"
echo "DNS解析测试:"
nslookup "$REGISTRY_HOST" || echo "DNS解析失败"
echo "网络连通性测试:"
ping -c 2 "$REGISTRY_HOST" || echo "ping失败"
echo "Docker镜像仓库连接测试:"
curl -I "https://$REGISTRY_HOST/v2/" 2>/dev/null || echo "仓库API访问失败"
sleep 5
if [ $i -eq 3 ]; then
echo "❌ 镜像拉取失败,部署终止"
echo "请检查:"
echo "1. 网络连接是否正常"
echo "2. 镜像仓库是否可访问"
echo "3. 镜像标签是否存在"
echo "4. Docker登录凭据是否正确"
exit 1
fi
fi
done
# 安全停止和移除容器
echo "检查现有容器状态..."
CONTAINER_NAME="fastvpn-admin-web"
# 检查容器是否存在
if docker ps -aq -f name=$CONTAINER_NAME | grep -q .; then
echo "发现现有容器,开始清理..."
# 检查容器是否正在运行
if docker ps -q -f name=$CONTAINER_NAME | grep -q .; then
echo "停止运行中的容器..."
docker stop $CONTAINER_NAME --time=15 || true
sleep 5
fi
# 检查容器是否正在被移除
echo "检查容器移除状态..."
for i in {1..15}; do
# 尝试获取容器状态
CONTAINER_STATUS=$(docker inspect $CONTAINER_NAME --format='{{.State.Status}}' 2>/dev/null || echo "not_found")
if [ "$CONTAINER_STATUS" = "not_found" ]; then
echo "✅ 容器已不存在"
break
elif [ "$CONTAINER_STATUS" = "removing" ]; then
echo "⏳ 容器正在移除中,等待完成... $i/15"
sleep 3
else
echo "尝试移除容器... $i/15"
if docker rm -f $CONTAINER_NAME 2>/dev/null; then
echo "✅ 容器移除成功"
break
else
echo "⚠️ 容器移除失败,重试..."
sleep 2
fi
fi
# 最后一次尝试强制清理
if [ $i -eq 15 ]; then
echo "🔧 执行强制清理..."
docker kill $CONTAINER_NAME 2>/dev/null || true
sleep 2
docker rm -f $CONTAINER_NAME 2>/dev/null || true
sleep 2
fi
done
else
echo "✅ 未发现现有容器"
fi
echo "启动新容器..."
docker run -d \
--network host \
--name fastvpn-admin-web \
--restart unless-stopped \
-p 3001:3000 \
-e NEXT_PUBLIC_API_URL=${{ env.NEXT_PUBLIC_API_URL }} \
${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-admin-web:${{ env.VERSION }}
# 验证容器启动
echo "验证容器启动状态..."
for i in {1..10}; do
if docker ps -q -f name=fastvpn-admin-web | grep -q .; then
echo "✅ 管理面板部署成功"
docker ps -f name=fastvpn-admin-web --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
exit 0
else
echo "等待容器启动... $i/10"
sleep 3
fi
done
echo "❌ 管理面板部署失败 - 容器未能正常启动"
docker logs fastvpn-admin-web || true
exit 1
- name: 部署用户面板到服务器
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USER }}
password: ${{ env.SSH_PASSWORD }}
port: ${{ env.SSH_PORT }}
timeout: 300s
command_timeout: 600s
debug: true
script: |
echo "=== SSH变量调试信息 ==="
echo "DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}"
echo "VERSION: ${{ env.VERSION }}"
echo "NEXT_PUBLIC_API_URL: ${{ env.NEXT_PUBLIC_API_URL }}"
echo "BRANCH: ${{ env.BRANCH }}"
echo "=== 部署用户面板 ==="
# 网络连通性检查
echo "检查镜像服务器连通性..."
REGISTRY_HOST=$(echo "${{ env.DOCKER_REGISTRY }}" | sed 's|https\?://||' | cut -d'/' -f1)
echo "镜像仓库地址: $REGISTRY_HOST"
if ping -c 3 "$REGISTRY_HOST" > /dev/null 2>&1; then
echo "✅ 镜像服务器连通性正常"
else
echo "⚠️ 镜像服务器ping失败但继续尝试拉取镜像"
fi
# 检查Docker登录状态
echo "检查Docker登录状态..."
if docker info > /dev/null 2>&1; then
echo "✅ Docker服务正常"
else
echo "❌ Docker服务异常"
exit 1
fi
# 拉取镜像(带重试)
echo "拉取Docker镜像..."
for i in {1..3}; do
echo "尝试拉取镜像 ($i/3): ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:${{ env.VERSION }}"
if docker pull ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:${{ env.VERSION }}; then
echo "✅ 镜像拉取成功"
break
else
echo "❌ 镜像拉取失败,重试 $i/3"
echo "检查网络和镜像仓库状态..."
# 显示详细错误信息
echo "--- 网络诊断信息 ---"
echo "DNS解析测试:"
nslookup "$REGISTRY_HOST" || echo "DNS解析失败"
echo "网络连通性测试:"
ping -c 2 "$REGISTRY_HOST" || echo "ping失败"
echo "Docker镜像仓库连接测试:"
curl -I "https://$REGISTRY_HOST/v2/" 2>/dev/null || echo "仓库API访问失败"
sleep 5
if [ $i -eq 3 ]; then
echo "❌ 镜像拉取失败,部署终止"
echo "请检查:"
echo "1. 网络连接是否正常"
echo "2. 镜像仓库是否可访问"
echo "3. 镜像标签是否存在"
echo "4. Docker登录凭据是否正确"
exit 1
fi
fi
done
# 安全停止和移除容器
echo "检查现有容器状态..."
CONTAINER_NAME="ppanel-user-web"
# 检查容器是否存在
if docker ps -aq -f name=$CONTAINER_NAME | grep -q .; then
echo "发现现有容器,开始清理..."
# 检查容器是否正在运行
if docker ps -q -f name=$CONTAINER_NAME | grep -q .; then
echo "停止运行中的容器..."
docker stop $CONTAINER_NAME --time=15 || true
sleep 5
fi
# 检查容器是否正在被移除
echo "检查容器移除状态..."
for i in {1..15}; do
# 尝试获取容器状态
CONTAINER_STATUS=$(docker inspect $CONTAINER_NAME --format='{{.State.Status}}' 2>/dev/null || echo "not_found")
if [ "$CONTAINER_STATUS" = "not_found" ]; then
echo "✅ 容器已不存在"
break
elif [ "$CONTAINER_STATUS" = "removing" ]; then
echo "⏳ 容器正在移除中,等待完成... $i/15"
sleep 3
else
echo "尝试移除容器... $i/15"
if docker rm -f $CONTAINER_NAME 2>/dev/null; then
echo "✅ 容器移除成功"
break
else
echo "⚠️ 容器移除失败,重试..."
sleep 2
fi
fi
# 最后一次尝试强制清理
if [ $i -eq 15 ]; then
echo "🔧 执行强制清理..."
docker kill $CONTAINER_NAME 2>/dev/null || true
sleep 2
docker rm -f $CONTAINER_NAME 2>/dev/null || true
sleep 2
fi
done
else
echo "✅ 未发现现有容器"
fi
echo "启动新容器..."
docker run -d \
--network host \
--name fastvpn-user-web \
--restart unless-stopped \
-p 3002:3000 \
-e NEXT_PUBLIC_API_URL=${{ env.NEXT_PUBLIC_API_URL }} \
${{ env.DOCKER_REGISTRY }}/ppanel/fastvpn-user-web:${{ env.VERSION }}
# 验证容器启动
echo "验证容器启动状态..."
for i in {1..10}; do
if docker ps -q -f name=fastvpn-user-web | grep -q .; then
echo "✅ 用户面板部署成功"
docker ps -f name=fastvpn-user-web --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
exit 0
else
echo "等待容器启动... $i/10"
sleep 3
fi
done
echo "❌ 用户面板部署失败 - 容器未能正常启动"
docker logs fastvpn-user-web || true
exit 1
# 步骤5: TG通知 (成功)
- name: 📱 发送成功通知到Telegram
if: success()
uses: appleboy/telegram-action@master
with:
token: ${{ env.TELEGRAM_BOT_TOKEN }}
to: ${{ env.TELEGRAM_CHAT_ID }}
message: |
✅ 部署成功!
📦 项目: ${{ github.repository }}
🌿 分支: ${{ github.ref_name }}
🔖 版本: ${{ env.VERSION }}
🎯 构建目标: ${{ env.BUILD_TARGET }}
🔗 API地址: ${{ env.NEXT_PUBLIC_API_URL }}
📝 提交: ${{ github.sha }}
👤 提交者: ${{ github.actor }}
🕐 时间: ${{ github.event.head_commit.timestamp }}
🚀 服务已成功部署到生产环境
# 步骤5: TG通知 (失败)
- name: 📱 发送失败通知到Telegram
if: failure()
uses: appleboy/telegram-action@master
with:
token: ${{ env.TELEGRAM_BOT_TOKEN }}
to: ${{ env.TELEGRAM_CHAT_ID }}
message: |
❌ 部署失败!
📦 项目: ${{ github.repository }}
🌿 分支: ${{ github.ref_name }}
🔖 版本: ${{ env.VERSION }}
🎯 构建目标: ${{ env.BUILD_TARGET }}
📝 提交: ${{ github.sha }}
👤 提交者: ${{ github.actor }}
🕐 时间: ${{ github.event.head_commit.timestamp }}
⚠️ 请检查构建日志获取详细信息

View File

@ -1,45 +0,0 @@
name: '🐛 反馈缺陷 Bug Report'
description: '反馈一个问题缺陷 | Report an bug'
title: '[Bug] '
labels: '🐛 Bug'
body:
- type: dropdown
attributes:
label: '💻 系统环境 | Operating System'
options:
- Windows
- macOS
- Ubuntu
- Other Linux
- Other
validations:
required: true
- type: dropdown
attributes:
label: '🌐 浏览器 | Browser'
options:
- Chrome
- Edge
- Safari
- Firefox
- Other
validations:
required: true
- type: textarea
attributes:
label: '🐛 问题描述 | Bug Description'
description: A clear and concise description of the bug.
validations:
required: true
- type: textarea
attributes:
label: '🚦 期望结果 | Expected Behavior'
description: A clear and concise description of what you expected to happen.
- type: textarea
attributes:
label: '📷 复现步骤 | Recurrence Steps'
description: A clear and concise description of how to recurrence.
- type: textarea
attributes:
label: '📝 补充信息 | Additional Information'
description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here.

View File

@ -1,21 +0,0 @@
name: '🌠 功能需求 Feature Request'
description: '需求或建议 | Suggest an idea'
title: '[Request] '
labels: '🌠 Feature Request'
body:
- type: textarea
attributes:
label: '🥰 需求描述 | Feature Description'
description: Please add a clear and concise description of the problem you are seeking to solve with this feature request.
validations:
required: true
- type: textarea
attributes:
label: '🧐 解决方案 | Proposed Solution'
description: Describe the solution you'd like in a clear and concise manner.
validations:
required: true
- type: textarea
attributes:
label: '📝 补充信息 | Additional Information'
description: Add any other context about the problem here.

View File

@ -1,15 +0,0 @@
name: '😇 疑问或帮助 Help Wanted'
description: '疑问或需要帮助 | Need help'
title: '[Question] '
labels: '😇 Help Wanted'
body:
- type: textarea
attributes:
label: '🧐 问题描述 | Proposed Solution'
description: A clear and concise description of the proplem.
validations:
required: true
- type: textarea
attributes:
label: '📝 补充信息 | Additional Information'
description: Add any other context about the problem here.

View File

@ -1,7 +0,0 @@
---
name: '📝 其他 Other'
about: '其他问题 | Other issues'
title: ''
labels: ''
assignees: ''
---

View File

@ -1,17 +0,0 @@
#### 💻 变更类型 | Change Type
<!-- For change type, change [ ] to [x]. -->
- \[ ] ✨ feat
- \[ ] 🐛 fix
- \[ ] 💄 style
- \[ ] 🔨 chore
- \[ ] 📝 docs
#### 🔀 变更说明 | Description of Change
<!-- Thank you for your Pull Request. Please provide a description above. -->
#### 📝 补充信息 | Additional Information
<!-- Add any other context about the Pull Request here. -->

View File

@ -1,30 +0,0 @@
name: Dependabot Auto Merge
on:
pull_request_target:
types: [labeled, edited]
jobs:
merge:
if: contains(github.event.pull_request.labels.*.name, 'dependencies')
name: Dependabot Auto Merge
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install deps
run: pnpm install
- name: Merge
uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
command: merge
target: minor
github-token: ${{ secrets.GH_TOKEN }}

View File

@ -1,22 +0,0 @@
name: Issue Check Inactive
on:
schedule:
- cron: '0 0 */15 * *'
permissions:
contents: read
jobs:
issue-check-inactive:
permissions:
issues: write # for actions-cool/issues-helper to update issues
pull-requests: write # for actions-cool/issues-helper to update PRs
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v3
with:
actions: 'check-inactive'
inactive-label: 'Inactive'
inactive-day: 30

View File

@ -1,46 +0,0 @@
name: Issue Close Require
on:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
jobs:
issue-close-require:
permissions:
issues: write # for actions-cool/issues-helper to update issues
pull-requests: write # for actions-cool/issues-helper to update PRs
runs-on: ubuntu-latest
steps:
- name: need reproduce
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
labels: '✅ Fixed'
inactive-day: 3
body: |
Since the issue was labeled with `✅ Fixed`, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply.
由于该 issue 被标记为已修复,同时 3 天未收到回应。现关闭 issue若有任何问题可评论回复。
- name: need reproduce
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
labels: '🤔 Need Reproduce'
inactive-day: 3
body: |
Since the issue was labeled with `🤔 Need Reproduce`, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply.
由于该 issue 被标记为需要更多信息,却 3 天未收到回应。现关闭 issue若有任何问题可评论回复。
- name: need reproduce
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
labels: "🙅🏻‍♀️ WON'T DO"
inactive-day: 3
body: |
Since the issue was labeled with `🙅🏻‍♀️ WON'T DO`, and no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply.
由于该 issue 被标记为暂不处理,同时 3 天未收到回应。现关闭 issue若有任何问题可评论回复。

View File

@ -1,25 +0,0 @@
name: Issue Remove Inactive
on:
issues:
types: [edited]
issue_comment:
types: [created, edited]
permissions:
contents: read
jobs:
issue-remove-inactive:
permissions:
issues: write # for actions-cool/issues-helper to update issues
pull-requests: write # for actions-cool/issues-helper to update PRs
runs-on: ubuntu-latest
steps:
- name: remove inactive
if: github.event.issue.state == 'open' && github.actor == github.event.issue.user.login
uses: actions-cool/issues-helper@v3
with:
actions: 'remove-labels'
issue-number: ${{ github.event.issue.number }}
labels: 'Inactive'

View File

@ -1,89 +0,0 @@
name: Publish Release Assets
on:
release:
types: [published]
permissions:
contents: write
jobs:
publish:
name: Publish Release Assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 'latest'
- name: Cache Bun dependencies
uses: actions/cache@v3
with:
path: |
~/.bun
key: ${{ runner.os }}-bun-cache-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-cache-
- name: Install deps
run: bun install --cache
- name: Build
run: bun run build
- name: Run publish script
run: |
chmod +x scripts/publish.sh
./scripts/publish.sh
- name: Upload tar.gz file to release
uses: softprops/action-gh-release@v2
with:
files: |
out/ppanel-admin-web.tar.gz
out/ppanel-user-web.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install jq
run: sudo apt-get install -y jq
- name: Extract version from package.json
id: version
run: echo "PPANEL_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
- name: Build and push Docker image for ppanel-admin-web
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/ppanel-admin-web/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/ppanel-admin-web:latest
${{ secrets.DOCKER_USERNAME }}/ppanel-admin-web:${{ env.PPANEL_VERSION }}
- name: Build and push Docker image for ppanel-user-web
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/ppanel-user-web/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/ppanel-user-web:latest
${{ secrets.DOCKER_USERNAME }}/ppanel-user-web:${{ env.PPANEL_VERSION }}

View File

@ -1,42 +0,0 @@
name: Build and Release
on:
push:
branches: [main, next, beta]
permissions:
contents: write
jobs:
release:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 'latest'
- name: Cache Bun dependencies
uses: actions/cache@v3
with:
path: |
~/.bun
node_modules
key: ${{ runner.os }}-bun-cache-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-cache-
- name: Install deps
run: bun install
- name: Build
run: bun run build
- name: Release
id: release
run: bun run release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

15
.vscode/settings.json vendored
View File

@ -1,15 +0,0 @@
{
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.ts": "${capture}.js",
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts",
"*.jsx": "${capture}.js",
"*.tsx": "${capture}.ts",
"README.md": "*.md, LICENSE"
}
}

View File

@ -4,7 +4,7 @@
<img width="160" src="https://raw.githubusercontent.com/perfect-panel/ppanel-assets/refs/heads/main/logo.svg">
<h1>PPanel web</h1>
<h1>PPanel web hifastvpn</h1>
This is a PPanel web powered by PPanel

View File

@ -6,7 +6,7 @@
<h1>PPanel 前端</h1>
这是由 PPanel 提供支持的前端
这是由 PPanel 提供支持的前端1
[英文](./README.md)
·

View File

@ -87,6 +87,7 @@ export default function EmailSettingsForm() {
const form = useForm<EmailSettingsFormData>({
resolver: zodResolver(emailSettingsSchema),
shouldUnregister: false,
defaultValues: {
id: 0,
method: 'email',
@ -416,8 +417,8 @@ export default function EmailSettingsForm() {
<FormControl>
<HTMLEditor
placeholder={t('email.inputPlaceholder')}
value={field.value}
onBlur={field.onChange}
value={field.value ?? ''}
onChange={field.onChange}
/>
</FormControl>
<div className='mt-4 space-y-2 border-t pt-4'>
@ -480,8 +481,8 @@ export default function EmailSettingsForm() {
<FormControl>
<HTMLEditor
placeholder={t('email.inputPlaceholder')}
value={field.value}
onBlur={field.onChange}
value={field.value ?? ''}
onChange={field.onChange}
/>
</FormControl>
<div className='mt-4 space-y-2 border-t pt-4'>
@ -525,8 +526,8 @@ export default function EmailSettingsForm() {
<FormControl>
<HTMLEditor
placeholder={t('email.inputPlaceholder')}
value={field.value}
onBlur={field.onChange}
value={field.value ?? ''}
onChange={field.onChange}
/>
</FormControl>
<div className='mt-4 space-y-2 border-t pt-4'>
@ -580,8 +581,8 @@ export default function EmailSettingsForm() {
<FormControl>
<HTMLEditor
placeholder={t('email.inputPlaceholder')}
value={field.value}
onBlur={field.onChange}
value={field.value ?? ''}
onChange={field.onChange}
/>
</FormControl>
<div className='mt-4 space-y-2 border-t pt-4'>

View File

@ -0,0 +1,450 @@
'use client';
import {
createAppVersion,
deleteAppVersion,
getAppVersionList,
updateAppVersion,
} from '@/services/admin/application';
import { zodResolver } from '@hookform/resolvers/zod';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { Button } from '@workspace/ui/components/button';
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@workspace/ui/components/dialog';
import {
Form,
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from '@workspace/ui/components/form';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@workspace/ui/components/select';
import { Switch } from '@workspace/ui/components/switch';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@workspace/ui/components/table';
import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input';
import { Icon } from '@workspace/ui/custom-components/icon';
import { useTranslations } from 'next-intl';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { toast } from 'sonner';
import { z } from 'zod';
const versionSchema = z.object({
id: z.number().optional(),
platform: z.string().min(1),
version: z.string().min(1),
min_version: z.string().optional(),
url: z.string().url(),
description: z.string().optional(),
force_update: z.boolean(),
is_default: z.boolean(),
is_in_review: z.boolean(),
});
type VersionFormData = z.infer<typeof versionSchema>;
export default function VersionPage() {
const t = useTranslations('system');
const queryClient = useQueryClient();
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [open, setOpen] = useState(false);
const [editingVersion, setEditingVersion] = useState<API.ApplicationVersion | null>(null);
const { data } = useQuery({
queryKey: ['app-versions', page, pageSize],
queryFn: async () => {
const res = await getAppVersionList({ page, size: pageSize });
return res.data?.data;
},
});
const form = useForm<VersionFormData>({
resolver: zodResolver(versionSchema),
defaultValues: {
platform: 'android',
version: '',
min_version: '',
url: '',
description: '',
force_update: false,
is_default: false,
is_in_review: false,
},
});
const createMutation = useMutation({
mutationFn: createAppVersion,
onSuccess: () => {
toast.success(t('common.saveSuccess'));
setOpen(false);
form.reset();
queryClient.invalidateQueries({ queryKey: ['app-versions'] });
},
onError: () => {
toast.error(t('common.saveFailed'));
},
});
const updateMutation = useMutation({
mutationFn: updateAppVersion,
onSuccess: () => {
toast.success(t('common.saveSuccess'));
setOpen(false);
setEditingVersion(null);
form.reset();
queryClient.invalidateQueries({ queryKey: ['app-versions'] });
},
onError: () => {
toast.error(t('common.saveFailed'));
},
});
const deleteMutation = useMutation({
mutationFn: deleteAppVersion,
onSuccess: () => {
toast.success(t('common.saveSuccess'));
queryClient.invalidateQueries({ queryKey: ['app-versions'] });
},
onError: () => {
toast.error(t('common.saveFailed'));
},
});
const onSubmit = (values: VersionFormData) => {
const payload = {
...values,
description: JSON.stringify({ 'en-US': values.description, 'zh-CN': values.description }),
};
if (editingVersion) {
updateMutation.mutate({ ...payload, id: editingVersion.id } as API.UpdateAppVersionRequest);
} else {
createMutation.mutate(payload as API.CreateAppVersionRequest);
}
};
const handleEdit = (version: API.ApplicationVersion) => {
setEditingVersion(version);
let desc = '';
if (version.description && typeof version.description === 'object') {
desc = Object.values(version.description)[0] || '';
} else if (typeof version.description === 'string') {
try {
const parsed = JSON.parse(version.description);
desc = (Object.values(parsed)[0] as string) || '';
} catch (e) {
desc = version.description;
}
}
form.reset({
platform: version.platform,
version: version.version,
min_version: version.min_version,
url: version.url,
description: desc,
force_update: version.force_update,
is_default: version.is_default,
is_in_review: version.is_in_review,
});
setOpen(true);
};
const handleDelete = (id: number) => {
if (confirm(t('version.confirmDelete'))) {
deleteMutation.mutate({ id });
}
};
const handleOpenChange = (open: boolean) => {
setOpen(open);
if (!open) {
setEditingVersion(null);
form.reset({
platform: 'android',
version: '',
min_version: '',
url: '',
description: '',
force_update: false,
is_default: false,
is_in_review: false,
});
}
};
return (
<div className='space-y-4'>
<div className='flex items-center justify-between'>
<h2 className='text-2xl font-bold tracking-tight'>{t('version.title')}</h2>
<Button onClick={() => handleOpenChange(true)}>
<Icon icon='mdi:plus' className='mr-2 h-4 w-4' />
{t('version.create')}
</Button>
</div>
<div className='rounded-md border'>
<Table>
<TableHeader>
<TableRow>
<TableHead>ID</TableHead>
<TableHead>{t('version.platform')}</TableHead>
<TableHead>{t('version.versionNumber')}</TableHead>
<TableHead>{t('version.url')}</TableHead>
<TableHead>{t('version.force')}</TableHead>
<TableHead>{t('version.default')}</TableHead>
<TableHead>{t('version.actions')}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data?.list?.map((version: API.ApplicationVersion) => (
<TableRow key={version.id}>
<TableCell>{version.id}</TableCell>
<TableCell>{version.platform}</TableCell>
<TableCell>{version.version}</TableCell>
<TableCell className='max-w-[200px] truncate' title={version.url}>
{version.url}
</TableCell>
<TableCell>{version.force_update ? t('version.yes') : t('version.no')}</TableCell>
<TableCell>{version.is_default ? t('version.yes') : t('version.no')}</TableCell>
<TableCell>
<div className='flex space-x-2'>
<Button variant='ghost' size='icon' onClick={() => handleEdit(version)}>
<Icon icon='mdi:pencil' className='h-4 w-4' />
</Button>
<Button variant='ghost' size='icon' onClick={() => handleDelete(version.id)}>
<Icon icon='mdi:delete' className='h-4 w-4 text-red-500' />
</Button>
</div>
</TableCell>
</TableRow>
))}
{!data?.list?.length && (
<TableRow>
<TableCell colSpan={7} className='h-24 text-center'>
{t('version.noResults')}
</TableCell>
</TableRow>
)}
</TableBody>
</Table>
</div>
<div className='flex items-center justify-between py-2'>
<div className='text-muted-foreground text-sm'>
{t('version.total', { count: data?.total || 0 })}
</div>
<div className='flex items-center space-x-2'>
<Select value={String(pageSize)} onValueChange={(val) => setPageSize(Number(val))}>
<SelectTrigger className='w-[80px]'>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value='10'>10</SelectItem>
<SelectItem value='20'>20</SelectItem>
<SelectItem value='50'>50</SelectItem>
</SelectContent>
</Select>
<Button
variant='outline'
size='sm'
onClick={() => setPage(Math.max(1, page - 1))}
disabled={page <= 1}
>
{t('version.previous')}
</Button>
<span className='text-sm'>{t('version.page', { page })}</span>
<Button
variant='outline'
size='sm'
onClick={() => setPage(page + 1)}
disabled={!data?.list?.length || data.list.length < pageSize}
>
{t('version.next')}
</Button>
</div>
</div>
<Dialog open={open} onOpenChange={handleOpenChange}>
<DialogContent className='sm:max-w-[600px]'>
<DialogHeader>
<DialogTitle>
{editingVersion ? t('version.edit') : t('version.createVersion')}
</DialogTitle>
</DialogHeader>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className='space-y-4'>
<div className='grid grid-cols-2 gap-4'>
<FormField
control={form.control}
name='platform'
render={({ field }) => (
<FormItem>
<FormLabel>{t('version.platform')}</FormLabel>
<Select onValueChange={field.onChange} defaultValue={field.value}>
<FormControl>
<SelectTrigger>
<SelectValue placeholder={t('version.platformPlaceholder')} />
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value='android'>Android</SelectItem>
<SelectItem value='ios'>iOS</SelectItem>
<SelectItem value='windows'>Windows</SelectItem>
<SelectItem value='macos'>macOS</SelectItem>
<SelectItem value='linux'>Linux</SelectItem>
<SelectItem value='harmony'>Harmony</SelectItem>
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name='version'
render={({ field }) => (
<FormItem>
<FormLabel>{t('version.versionNumber')}</FormLabel>
<FormControl>
<EnhancedInput
value={field.value}
onValueChange={field.onChange}
placeholder={t('version.versionPlaceholder')}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
<div className='grid grid-cols-2 gap-4'>
<FormField
control={form.control}
name='min_version'
render={({ field }) => (
<FormItem>
<FormLabel>{t('version.minVersion')}</FormLabel>
<FormControl>
<EnhancedInput
value={field.value}
onValueChange={field.onChange}
placeholder={t('version.versionPlaceholder')}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name='url'
render={({ field }) => (
<FormItem>
<FormLabel>{t('version.downloadUrl')}</FormLabel>
<FormControl>
<EnhancedInput
value={field.value}
onValueChange={field.onChange}
placeholder='https://...'
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
<FormField
control={form.control}
name='description'
render={({ field }) => (
<FormItem>
<FormLabel>{t('version.descriptionField')}</FormLabel>
<FormControl>
<EnhancedInput
value={field.value}
onValueChange={field.onChange}
placeholder={t('version.descriptionPlaceholder')}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className='flex flex-row gap-4'>
<FormField
control={form.control}
name='force_update'
render={({ field }) => (
<FormItem className='flex flex-1 flex-row items-center justify-between rounded-lg border p-3 shadow-sm'>
<div className='space-y-0.5'>
<FormLabel>{t('version.forceUpdate')}</FormLabel>
</div>
<FormControl>
<Switch checked={field.value} onCheckedChange={field.onChange} />
</FormControl>
</FormItem>
)}
/>
<FormField
control={form.control}
name='is_default'
render={({ field }) => (
<FormItem className='flex flex-1 flex-row items-center justify-between rounded-lg border p-3 shadow-sm'>
<div className='space-y-0.5'>
<FormLabel>{t('version.default')}</FormLabel>
</div>
<FormControl>
<Switch checked={field.value} onCheckedChange={field.onChange} />
</FormControl>
</FormItem>
)}
/>
<FormField
control={form.control}
name='is_in_review'
render={({ field }) => (
<FormItem className='flex flex-1 flex-row items-center justify-between rounded-lg border p-3 shadow-sm'>
<div className='space-y-0.5'>
<FormLabel>{t('version.inReview')}</FormLabel>
</div>
<FormControl>
<Switch checked={field.value} onCheckedChange={field.onChange} />
</FormControl>
</FormItem>
)}
/>
</div>
<DialogFooter>
<Button type='submit'>
{editingVersion ? t('version.update') : t('version.create')}
</Button>
</DialogFooter>
</form>
</Form>
</DialogContent>
</Dialog>
</div>
);
}

View File

@ -38,6 +38,7 @@ const currencySchema = z.object({
access_key: z.string().optional(),
currency_unit: z.string().min(1),
currency_symbol: z.string().min(1),
fixed_rate: z.number().optional(),
});
type CurrencyFormData = z.infer<typeof currencySchema>;
@ -62,6 +63,7 @@ export default function CurrencyConfig() {
access_key: '',
currency_unit: 'USD',
currency_symbol: '$',
fixed_rate: 0,
},
});
@ -170,6 +172,26 @@ export default function CurrencyConfig() {
</FormItem>
)}
/>
<FormField
control={form.control}
name='fixed_rate'
render={({ field }) => (
<FormItem>
<FormLabel>{t('currency.fixedRate')}</FormLabel>
<FormControl>
<EnhancedInput
type='number'
placeholder={t('currency.fixedRatePlaceholder', { defaultValue: '0' })}
value={field.value}
onValueChange={(val) => field.onChange(Number(val))}
/>
</FormControl>
<FormDescription>{t('currency.fixedRateDescription')}</FormDescription>
<FormMessage />
</FormItem>
)}
/>
</form>
</Form>
</ScrollArea>

View File

@ -1,6 +1,5 @@
'use client';
import { Display } from '@/components/display';
import { ProTable, ProTableActions } from '@/components/pro-table';
import {
createUser,
@ -12,7 +11,6 @@ import {
import { useSubscribe } from '@/store/subscribe';
import { formatDate } from '@/utils/common';
import { useQuery } from '@tanstack/react-query';
import { Badge } from '@workspace/ui/components/badge';
import { Button } from '@workspace/ui/components/button';
import {
DropdownMenu,
@ -20,6 +18,13 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from '@workspace/ui/components/dropdown-menu';
import { Input } from '@workspace/ui/components/input';
import {
Popover,
PopoverClose,
PopoverContent,
PopoverTrigger,
} from '@workspace/ui/components/popover';
import { ScrollArea } from '@workspace/ui/components/scroll-area';
import {
Sheet,
@ -31,6 +36,7 @@ import {
import { Switch } from '@workspace/ui/components/switch';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@workspace/ui/components/tabs';
import { ConfirmButton } from '@workspace/ui/custom-components/confirm-button';
import { FilePenLine } from 'lucide-react';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
@ -38,11 +44,69 @@ import { useRef, useState } from 'react';
import { toast } from 'sonner';
import { UserDetail } from './user-detail';
import UserForm from './user-form';
import { AuthMethodsForm } from './user-profile/auth-methods-form';
import { BasicInfoForm } from './user-profile/basic-info-form';
import { NotifySettingsForm } from './user-profile/notify-settings-form';
import UserSubscription from './user-subscription';
function getDeviceTypeInfo(userAgent = '') {
let deviceType = 'Unknown';
const ua = userAgent.toLowerCase();
if (ua.includes('android')) {
deviceType = 'Android';
} else if (ua.includes('iphone') || ua.includes('ios')) {
deviceType = 'iPhone';
} else if (ua.includes('ipad')) {
deviceType = 'iPad';
} else if (ua.includes('mac os') || ua.includes('mac')) {
deviceType = 'Mac';
} else if (ua.includes('windows')) {
deviceType = 'Windows';
} else if (ua.includes('linux')) {
deviceType = 'Linux';
}
return { deviceType };
}
// 为 RemarkForm 组件定义 props 类型
interface RemarkFormProps {
initialRemark?: string | null;
onSave: (remark: string) => void;
CloseComponent: React.ComponentType<{ asChild?: boolean; children: React.ReactNode }>;
}
// 新的子组件,在管理它自己的备注状态
const RemarkForm: React.FC<RemarkFormProps> = ({ onSave, initialRemark, CloseComponent }) => {
const [remark, setRemark] = useState<string>(initialRemark ?? '');
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setRemark(event.target.value);
};
const handleSaveClick = () => {
onSave(remark);
};
return (
<>
<div className='mb-2 text-sm font-semibold'></div>
<Input
type='text'
value={remark}
onChange={handleInputChange}
placeholder='在此输入备注...'
className='w-full'
/>
<CloseComponent asChild>
<Button onClick={handleSaveClick} variant='default' size={'sm'} className={'mt-2'}>
</Button>
</CloseComponent>
</>
);
};
export default function Page() {
const t = useTranslations('user');
const [loading, setLoading] = useState(false);
@ -56,6 +120,7 @@ export default function Page() {
user_id: sp.get('user_id') || undefined,
subscribe_id: sp.get('subscribe_id') || undefined,
user_subscribe_id: sp.get('user_subscribe_id') || undefined,
device_id: sp.get('device_id') || undefined,
};
return (
@ -128,20 +193,96 @@ export default function Page() {
},
{
accessorKey: 'auth_methods',
header: t('userName'),
header: '绑定邮箱',
cell: ({ row }) => {
const method = row.original.auth_methods?.[0];
const method = row.original.auth_methods;
return (
<div>
<Badge className='mr-1 uppercase' title={method?.verified ? t('verified') : ''}>
{method?.auth_type}
</Badge>
{method?.auth_identifier}
<Popover>
<PopoverTrigger>
<div className={'flex items-center'}>
{method?.find((v) => v.auth_type === 'email')?.auth_identifier || '待绑定'}
{row.original?.remark ? `${row.original.remark}` : ''}
<FilePenLine size={14} className={'text-primary ml-2'} />
</div>
</PopoverTrigger>
<PopoverContent className={'w-64'}>
<RemarkForm
initialRemark={row.original.remark}
CloseComponent={PopoverClose}
onSave={async (remark) => {
const {
auth_methods,
user_devices,
enable_balance_notify,
enable_login_notify,
enable_subscribe_notify,
enable_trade_notify,
updated_at,
created_at,
id,
...rest
} = row.original;
await updateUserBasicInfo({
user_id: id,
...rest,
remark,
} as unknown as API.UpdateUserBasiceInfoRequest);
toast.success(t('updateSuccess'));
ref.current?.refresh();
}}
/>
</PopoverContent>
</Popover>
</div>
);
},
},
{
accessorKey: 'user_devices',
header: '绑定设备',
cell: ({ row }) => {
const devices = row?.original.user_devices ?? [];
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
{devices.map((v, index) => {
const { deviceType } = getDeviceTypeInfo(v.user_agent);
return (
<div key={v.id + '_wrapper'}>
<div
style={{
padding: '4px 6px',
background: '#f8f8f8',
borderRadius: '4px',
border: '1px solid #e0e0e0',
fontSize: '12px',
lineHeight: '16px',
}}
>
<div style={{ fontWeight: 500 }}>
ID{v.id}{deviceType}
</div>
</div>
{index !== devices.length - 1 && (
<div
style={{
height: '1px',
background: '#eee',
margin: '4px 0',
}}
></div>
)}
</div>
);
})}
</div>
);
},
},
/*{
accessorKey: 'balance',
header: t('balance'),
cell: ({ row }) => <Display type='currency' value={row.getValue('balance')} />,
@ -155,12 +296,31 @@ export default function Page() {
accessorKey: 'commission',
header: t('commission'),
cell: ({ row }) => <Display type='currency' value={row.getValue('commission')} />,
},
},*/
{
accessorKey: 'refer_code',
header: t('inviteCode'),
cell: ({ row }) => row.getValue('refer_code') || '--',
},
{
accessorKey: 'last_login_time',
header: '最后登录时间',
cell: ({ row }) => {
const v = (row.original as any)?.last_login_time;
if (!v) return '---';
const ts = Number(v);
const ms = ts < 1e12 ? ts * 1000 : ts;
return formatDate(ms) as any;
},
},
{
accessorKey: 'member_status',
header: '会员状态',
cell: ({ row }) => {
const v = (row.original as any)?.member_status;
return <span className='text-sm'>{v ?? '---'}</span>;
},
},
{
accessorKey: 'referer_id',
header: t('referer'),
@ -203,6 +363,10 @@ export default function Page() {
key: 'user_subscribe_id',
placeholder: t('subscriptionId'),
},
{
key: 'device_id',
placeholder: '设备id',
},
]}
actions={{
render: (row) => {
@ -281,7 +445,7 @@ function ProfileSheet({ userId }: { userId: number }) {
<TabsList className='mb-3'>
<TabsTrigger value='basic'>{t('basicInfoTitle')}</TabsTrigger>
<TabsTrigger value='notify'>{t('notifySettingsTitle')}</TabsTrigger>
<TabsTrigger value='auth'>{t('authMethodsTitle')}</TabsTrigger>
{/*<TabsTrigger value='auth'>{t('authMethodsTitle')}</TabsTrigger>*/}
</TabsList>
<TabsContent value='basic' className='mt-0'>
<BasicInfoForm user={user} refetch={refetch as any} />
@ -289,9 +453,9 @@ function ProfileSheet({ userId }: { userId: number }) {
<TabsContent value='notify' className='mt-0'>
<NotifySettingsForm user={user} refetch={refetch as any} />
</TabsContent>
<TabsContent value='auth' className='mt-0'>
{/*<TabsContent value='auth' className='mt-0'>
<AuthMethodsForm user={user} refetch={refetch as any} />
</TabsContent>
</TabsContent>*/}
</Tabs>
</ScrollArea>
)}

View File

@ -148,7 +148,8 @@ export function UserDetail({ id }: { id: number }) {
const identifier =
data?.auth_methods.find((m) => m.auth_type === 'email')?.auth_identifier ||
data?.auth_methods[0]?.auth_identifier;
`设备Id${data?.user_devices[0]?.id}` ||
'账号不存在';
return (
<HoverCard>

View File

@ -77,6 +77,11 @@ export const navs = [
icon: 'flat-color-icons:currency-exchange',
},
{ title: 'ADS Config', url: '/dashboard/ads', icon: 'flat-color-icons:electrical-sensor' },
{
title: 'Version Management',
url: '/dashboard/settings/version',
icon: 'flat-color-icons:kindle',
},
],
},

View File

@ -1,16 +1,13 @@
{
"ADS Config": "ADS Config",
"Announcement Management": "Announcement Management",
"Auth Control": "Auth Control",
"Balance": "Balance",
"Commerce": "Commerce",
"Commission": "Commission",
"Coupon Management": "Coupon Management",
"Dashboard": "Dashboard",
"Document Management": "Document Management",
"Email": "Email",
"Gift": "Gift",
"Login": "Login",
@ -23,7 +20,6 @@
"Order Management": "Order Management",
"Payment Config": "Payment Config",
"Product Management": "Product Management",
"Register": "Register",
"Reset Subscribe": "Reset Subscribe",
"Server Management": "Server Management",
@ -34,10 +30,10 @@
"System": "System",
"System Config": "System Config",
"System Tool": "System Tool",
"Ticket Management": "Ticket Management",
"Traffic Details": "Traffic Details",
"User Detail": "User Detail",
"User Management": "User Management",
"Users & Support": "Users & Support"
"Users & Support": "Users & Support",
"Version Management": "Version Management"
}

View File

@ -18,7 +18,10 @@
"currencySymbolPlaceholder": "$",
"currencyUnit": "Currency Unit",
"currencyUnitDescription": "Used for display purposes only; changing this will affect all currency units in the system",
"currencyUnitPlaceholder": "USD"
"currencyUnitPlaceholder": "USD",
"fixedRate": "Fixed Exchange Rate",
"fixedRatePlaceholder": "0",
"fixedRateDescription": "If a fixed rate is set, it will be used instead of the API rate"
},
"invite": {
"title": "Invitation Settings",
@ -135,5 +138,35 @@
"inputPlaceholder": "Please enter",
"saveSuccess": "Save Successful",
"saveFailed": "Save Failed"
},
"version": {
"title": "Version Management",
"description": "Manage app versions for all platforms",
"create": "Create",
"edit": "Edit Version",
"createVersion": "Create Version",
"platform": "Platform",
"platformPlaceholder": "Select platform",
"versionNumber": "Version",
"versionPlaceholder": "1.0.0",
"minVersion": "Min Version",
"downloadUrl": "Download URL",
"descriptionField": "Description",
"descriptionPlaceholder": "Update description...",
"forceUpdate": "Force Update",
"default": "Default",
"inReview": "In Review",
"actions": "Actions",
"url": "URL",
"force": "Force",
"total": "Total: {count} items",
"previous": "Previous",
"next": "Next",
"page": "Page {page}",
"noResults": "No results.",
"yes": "Yes",
"no": "No",
"update": "Update",
"confirmDelete": "Are you sure you want to delete?"
}
}

View File

@ -1,16 +1,13 @@
{
"ADS Config": "广告配置",
"Announcement Management": "公告管理",
"Auth Control": "认证控制",
"Balance": "余额变动",
"Commerce": "商务",
"Commission": "佣金记录",
"Coupon Management": "优惠券管理",
"Dashboard": "仪表盘",
"Document Management": "文档管理",
"Email": "邮件日志",
"Gift": "赠送记录",
"Login": "登录日志",
@ -23,7 +20,6 @@
"Order Management": "订单管理",
"Payment Config": "支付配置",
"Product Management": "商品管理",
"Register": "注册日志",
"Reset Subscribe": "重置订阅",
"Server Management": "服务器管理",
@ -34,10 +30,10 @@
"System": "系统",
"System Config": "系统配置",
"System Tool": "系统工具",
"Ticket Management": "工单管理",
"Traffic Details": "流量明细",
"User Detail": "用户详情",
"User Management": "用户管理",
"Users & Support": "用户与支持"
"Users & Support": "用户与支持",
"Version Management": "版本管理"
}

View File

@ -18,7 +18,10 @@
"currencySymbolPlaceholder": "$",
"currencyUnit": "货币单位",
"currencyUnitDescription": "仅用于展示使用,更改后系统中所有的货币单位都将发生变更",
"currencyUnitPlaceholder": "USD"
"currencyUnitPlaceholder": "USD",
"fixedRate": "固定汇率",
"fixedRatePlaceholder": "0",
"fixedRateDescription": "如果设置了固定汇率将使用此值而非API获取的汇率"
},
"invite": {
"title": "邀请设置",
@ -137,5 +140,35 @@
"inputPlaceholder": "请输入",
"saveSuccess": "保存成功",
"saveFailed": "保存失败"
},
"version": {
"title": "版本管理",
"description": "管理各平台应用版本信息",
"create": "创建",
"edit": "编辑版本",
"createVersion": "创建版本",
"platform": "平台",
"platformPlaceholder": "选择平台",
"versionNumber": "版本号",
"versionPlaceholder": "1.0.0",
"minVersion": "最低版本",
"downloadUrl": "下载链接",
"descriptionField": "描述",
"descriptionPlaceholder": "更新说明...",
"forceUpdate": "强制更新",
"default": "默认版本",
"inReview": "审核中",
"actions": "操作",
"url": "下载地址",
"force": "强制",
"total": "共 {count} 条",
"previous": "上一页",
"next": "下一页",
"page": "第 {page} 页",
"noResults": "暂无数据",
"yes": "是",
"no": "否",
"update": "更新",
"confirmDelete": "确定要删除吗?"
}
}

View File

@ -21,7 +21,7 @@
"js-yaml": "^4.1.0",
"mlkem-wasm": "^0.0.6",
"nanoid": "^5.1.5",
"next": "^15.5.2",
"next": "15.5.7",
"next-intl": "^3.26.3",
"next-runtime-env": "^3.3.0",
"next-themes": "^0.4.6",

View File

@ -85,3 +85,71 @@ export async function getSubscribeApplicationList(
},
);
}
/** Create App Version POST /v1/admin/application/version */
export async function createAppVersion(
body: API.CreateAppVersionRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.ApplicationVersion }>(
'/v1/admin/application/version',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
},
);
}
/** Update App Version PUT /v1/admin/application/version */
export async function updateAppVersion(
body: API.UpdateAppVersionRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.ApplicationVersion }>(
'/v1/admin/application/version',
{
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
},
);
}
/** Delete App Version DELETE /v1/admin/application/version */
export async function deleteAppVersion(
body: API.DeleteAppVersionRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/application/version', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Get App Version List GET /v1/admin/application/version/list */
export async function getAppVersionList(
params: API.GetAppVersionListParams,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.GetAppVersionListResponse }>(
'/v1/admin/application/version/list',
{
method: 'GET',
params: {
...params,
},
...(options || {}),
},
);
}

View File

@ -65,10 +65,53 @@ declare namespace API {
type ApplicationVersion = {
id: number;
platform: string;
url: string;
version: string;
description: string;
min_version?: string;
force_update: boolean;
description: Record<string, string>;
is_default: boolean;
is_in_review: boolean;
created_at: number;
};
type CreateAppVersionRequest = {
platform: string;
version: string;
min_version?: string;
force_update?: boolean;
description?: string;
url: string;
is_default?: boolean;
is_in_review?: boolean;
};
type UpdateAppVersionRequest = {
id: number;
platform: string;
version: string;
min_version?: string;
force_update?: boolean;
description?: string;
url: string;
is_default?: boolean;
is_in_review?: boolean;
};
type DeleteAppVersionRequest = {
id: number;
};
type GetAppVersionListParams = {
page?: number;
size?: number;
platform?: string;
};
type GetAppVersionListResponse = {
total: number;
list: ApplicationVersion[];
};
type AppUserSubcbribe = {
@ -398,6 +441,7 @@ declare namespace API {
access_key: string;
currency_unit: string;
currency_symbol: string;
fixed_rate?: number;
};
type DeleteAdsRequest = {
@ -2360,6 +2404,7 @@ declare namespace API {
id: number;
avatar: string;
balance: number;
remark: string;
commission: number;
referral_percentage: number;
only_first_purchase: boolean;

View File

@ -20,7 +20,7 @@
"framer-motion": "^12.23.12",
"gray-matter": "^4.0.3",
"lucide-react": "^0.542.0",
"next": "^15.5.2",
"next": "15.5.7",
"next-intl": "^3.26.3",
"next-runtime-env": "^3.3.0",
"next-themes": "^0.4.6",

View File

@ -115,7 +115,7 @@
"js-yaml": "^4.1.0",
"mlkem-wasm": "^0.0.6",
"nanoid": "^5.1.5",
"next": "^15.5.2",
"next": "15.5.7",
"next-intl": "^3.26.3",
"next-runtime-env": "^3.3.0",
"next-themes": "^0.4.6",
@ -151,7 +151,7 @@
"framer-motion": "^12.23.12",
"gray-matter": "^4.0.3",
"lucide-react": "^0.542.0",
"next": "^15.5.2",
"next": "15.5.7",
"next-intl": "^3.26.3",
"next-runtime-env": "^3.3.0",
"next-themes": "^0.4.6",
@ -528,27 +528,27 @@
"@netlify/plugin-nextjs": ["@netlify/plugin-nextjs@5.14.0", "", {}, "sha512-8WEnVm88Ed6v6j/D0iqXDSnAW8Mf9P2CDVgBG3x2+vkiEI48X6Na7KnoQRyi6oulgA6foHIPWqgQIClsPiW20A=="],
"@next/env": ["@next/env@15.5.6", "", {}, "sha512-3qBGRW+sCGzgbpc5TS1a0p7eNxnOarGVQhZxfvTdnV0gFI61lX7QNtQ4V1TSREctXzYn5NetbUsLvyqwLFJM6Q=="],
"@next/env": ["@next/env@15.5.7", "", {}, "sha512-4h6Y2NyEkIEN7Z8YxkA27pq6zTkS09bUSYC0xjd0NpwFxjnIKeZEeH591o5WECSmjpUhLn3H2QLJcDye3Uzcvg=="],
"@next/eslint-plugin-next": ["@next/eslint-plugin-next@15.5.6", "", { "dependencies": { "fast-glob": "3.3.1" } }, "sha512-YxDvsT2fwy1j5gMqk3ppXlsgDopHnkM4BoxSVASbvvgh5zgsK8lvWerDzPip8k3WVzsTZ1O7A7si1KNfN4OZfQ=="],
"@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@15.5.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ES3nRz7N+L5Umz4KoGfZ4XX6gwHplwPhioVRc25+QNsDa7RtUF/z8wJcbuQ2Tffm5RZwuN2A063eapoJ1u4nPg=="],
"@next/swc-darwin-arm64": ["@next/swc-darwin-arm64@15.5.7", "", { "os": "darwin", "cpu": "arm64" }, "sha512-IZwtxCEpI91HVU/rAUOOobWSZv4P2DeTtNaCdHqLcTJU4wdNXgAySvKa/qJCgR5m6KI8UsKDXtO2B31jcaw1Yw=="],
"@next/swc-darwin-x64": ["@next/swc-darwin-x64@15.5.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-JIGcytAyk9LQp2/nuVZPAtj8uaJ/zZhsKOASTjxDug0SPU9LAM3wy6nPU735M1OqacR4U20LHVF5v5Wnl9ptTA=="],
"@next/swc-darwin-x64": ["@next/swc-darwin-x64@15.5.7", "", { "os": "darwin", "cpu": "x64" }, "sha512-UP6CaDBcqaCBuiq/gfCEJw7sPEoX1aIjZHnBWN9v9qYHQdMKvCKcAVs4OX1vIjeE+tC5EIuwDTVIoXpUes29lg=="],
"@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@15.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-qvz4SVKQ0P3/Im9zcS2RmfFL/UCQnsJKJwQSkissbngnB/12c6bZTCB0gHTexz1s6d/mD0+egPKXAIRFVS7hQg=="],
"@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@15.5.7", "", { "os": "linux", "cpu": "arm64" }, "sha512-NCslw3GrNIw7OgmRBxHtdWFQYhexoUCq+0oS2ccjyYLtcn1SzGzeM54jpTFonIMUjNbHmpKpziXnpxhSWLcmBA=="],
"@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@15.5.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-FsbGVw3SJz1hZlvnWD+T6GFgV9/NYDeLTNQB2MXoPN5u9VA9OEDy6fJEfePfsUKAhJufFbZLgp0cPxMuV6SV0w=="],
"@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@15.5.7", "", { "os": "linux", "cpu": "arm64" }, "sha512-nfymt+SE5cvtTrG9u1wdoxBr9bVB7mtKTcj0ltRn6gkP/2Nu1zM5ei8rwP9qKQP0Y//umK+TtkKgNtfboBxRrw=="],
"@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@15.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-3QnHGFWlnvAgyxFxt2Ny8PTpXtQD7kVEeaFat5oPAHHI192WKYB+VIKZijtHLGdBBvc16tiAkPTDmQNOQ0dyrA=="],
"@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@15.5.7", "", { "os": "linux", "cpu": "x64" }, "sha512-hvXcZvCaaEbCZcVzcY7E1uXN9xWZfFvkNHwbe/n4OkRhFWrs1J1QV+4U1BN06tXLdaS4DazEGXwgqnu/VMcmqw=="],
"@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@15.5.6", "", { "os": "linux", "cpu": "x64" }, "sha512-OsGX148sL+TqMK9YFaPFPoIaJKbFJJxFzkXZljIgA9hjMjdruKht6xDCEv1HLtlLNfkx3c5w2GLKhj7veBQizQ=="],
"@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@15.5.7", "", { "os": "linux", "cpu": "x64" }, "sha512-4IUO539b8FmF0odY6/SqANJdgwn1xs1GkPO5doZugwZ3ETF6JUdckk7RGmsfSf7ws8Qb2YB5It33mvNL/0acqA=="],
"@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@15.5.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-ONOMrqWxdzXDJNh2n60H6gGyKed42Ieu6UTVPZteXpuKbLZTH4G4eBMsr5qWgOBA+s7F+uB4OJbZnrkEDnZ5Fg=="],
"@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@15.5.7", "", { "os": "win32", "cpu": "arm64" }, "sha512-CpJVTkYI3ZajQkC5vajM7/ApKJUOlm6uP4BknM3XKvJ7VXAvCqSjSLmM0LKdYzn6nBJVSjdclx8nYJSa3xlTgQ=="],
"@next/swc-win32-ia32-msvc": ["@next/swc-win32-ia32-msvc@14.2.33", "", { "os": "win32", "cpu": "ia32" }, "sha512-pc9LpGNKhJ0dXQhZ5QMmYxtARwwmWLpeocFmVG5Z0DzWq5Uf0izcI8tLc+qOpqxO1PWqZ5A7J1blrUIKrIFc7Q=="],
"@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@15.5.6", "", { "os": "win32", "cpu": "x64" }, "sha512-pxK4VIjFRx1MY92UycLOOw7dTdvccWsNETQ0kDHkBlcFH1GrTLUjSiHU1ohrznnux6TqRHgv5oflhfIWZwVROQ=="],
"@next/swc-win32-x64-msvc": ["@next/swc-win32-x64-msvc@15.5.7", "", { "os": "win32", "cpu": "x64" }, "sha512-gMzgBX164I6DN+9/PGA+9dQiwmTkE4TloBNx8Kv9UiGARsr9Nba7IpcBRA1iTV9vwlYnrE3Uy6I7Aj6qLjQuqw=="],
"@noble/curves": ["@noble/curves@2.0.1", "", { "dependencies": { "@noble/hashes": "2.0.1" } }, "sha512-vs1Az2OOTBiP4q0pwjW5aF0xp9n4MxVrmkFBxc6EKZc6ddYx5gaZiAsZoq0uRRXWbi3AT/sBqn05eRPtn1JCPw=="],
@ -1918,7 +1918,7 @@
"netmask": ["netmask@2.0.2", "", {}, "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg=="],
"next": ["next@15.5.6", "", { "dependencies": { "@next/env": "15.5.6", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "15.5.6", "@next/swc-darwin-x64": "15.5.6", "@next/swc-linux-arm64-gnu": "15.5.6", "@next/swc-linux-arm64-musl": "15.5.6", "@next/swc-linux-x64-gnu": "15.5.6", "@next/swc-linux-x64-musl": "15.5.6", "@next/swc-win32-arm64-msvc": "15.5.6", "@next/swc-win32-x64-msvc": "15.5.6", "sharp": "^0.34.3" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-zTxsnI3LQo3c9HSdSf91O1jMNsEzIXDShXd4wVdg9y5shwLqBXi4ZtUUJyB86KGVSJLZx0PFONvO54aheGX8QQ=="],
"next": ["next@15.5.7", "", { "dependencies": { "@next/env": "15.5.7", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "15.5.7", "@next/swc-darwin-x64": "15.5.7", "@next/swc-linux-arm64-gnu": "15.5.7", "@next/swc-linux-arm64-musl": "15.5.7", "@next/swc-linux-x64-gnu": "15.5.7", "@next/swc-linux-x64-musl": "15.5.7", "@next/swc-win32-arm64-msvc": "15.5.7", "@next/swc-win32-x64-msvc": "15.5.7", "sharp": "^0.34.3" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-+t2/0jIJ48kUpGKkdlhgkv+zPTEOoXyr60qXe68eB/pl3CMJaLeIGjzp5D6Oqt25hCBiBTt8wEeeAzfJvUKnPQ=="],
"next-intl": ["next-intl@3.26.5", "", { "dependencies": { "@formatjs/intl-localematcher": "^0.5.4", "negotiator": "^1.0.0", "use-intl": "^3.26.5" }, "peerDependencies": { "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0" } }, "sha512-EQlCIfY0jOhRldiFxwSXG+ImwkQtDEfQeSOEQp6ieAGSLWGlgjdb/Ck/O7wMfC430ZHGeUKVKax8KGusTPKCgg=="],

View File

@ -5,7 +5,13 @@ services:
context: ../
dockerfile: ./docker/ppanel-admin-web/Dockerfile
environment:
NEXT_PUBLIC_API_URL: 'https://api.ppanel.dev'
NEXT_PUBLIC_API_URL: 'https://api.hifast.biz'
NEXT_PUBLIC_DEFAULT_LANGUAGE: 'en-US'
NEXT_PUBLIC_SITE_URL: 'https://4d3vsw8.88xgaen.hifast.biz'
NEXT_PUBLIC_DEFAULT_USER_EMAIL: 'admin@ppanel.dev'
NEXT_PUBLIC_DEFAULT_USER_PASSWORD: 'password'
# 使用 host 模式可解决网络连接问题,但需注意端口冲突(默认 3000
# network_mode: "host"
restart: always
ports:
- 3001:3000

View File

@ -5,8 +5,8 @@ FROM oven/bun:latest AS base
WORKDIR /app
# Create a non-root user for running the production application
RUN addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 nextjs
RUN groupadd -r -g 1001 nodejs \
&& useradd -r -u 1001 -g nodejs nextjs
# Change to non-root user
USER nextjs

View File

@ -5,8 +5,8 @@ FROM oven/bun:latest AS base
WORKDIR /app
# Create non-root user and set permissions
RUN addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 nextjs
RUN groupadd -r -g 1001 nodejs \
&& useradd -r -u 1001 -g nodejs nextjs
# Copy build output and static files
COPY ./apps/user/.next/standalone ./

View File

@ -1,14 +1,14 @@
{
"name": "ppanel-web",
"version": "1.6.1",
"version": "1.6.4",
"private": true,
"homepage": "https://github.com/perfect-panel/ppanel-web",
"homepage": "https://github.com/perfect-panel/fastvpn-web",
"bugs": {
"url": "https://github.com/perfect-panel/ppanel-web/issues/new"
"url": "https://github.com/perfect-panel/fastvpn-web/issues/new"
},
"repository": {
"type": "git",
"url": "https://github.com/perfect-panel/ppanel-web.git"
"url": "https://github.com/perfect-panel/fastvpn-web.git"
},
"license": "GUN",
"workspaces": [

View File

@ -10,6 +10,7 @@ const Popover = PopoverPrimitive.Root;
const PopoverTrigger = PopoverPrimitive.Trigger;
const PopoverAnchor = PopoverPrimitive.Anchor;
const PopoverClose = PopoverPrimitive.Close;
const PopoverContent = React.forwardRef<
React.ElementRef<typeof PopoverPrimitive.Content>,
@ -30,4 +31,4 @@ const PopoverContent = React.forwardRef<
));
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger };

View File

@ -109,7 +109,7 @@ export function ProTable<
const [rowCount, setRowCount] = useState<number>(0);
const [pagination, setPagination] = useState({
pageIndex: 0,
pageSize: 10,
pageSize: 200,
});
const loading = useRef(false);

View File

@ -35,16 +35,10 @@ else
fi
# Set up pre-commit hook
setup_husky_hook "pre-commit" "#!/bin/sh
. \"\$(dirname \"\$0\")/_/husky.sh\"
npx --no-install lint-staged"
setup_husky_hook "pre-commit" "npx --no-install lint-staged"
# Set up commit-msg hook
setup_husky_hook "commit-msg" "#!/bin/sh
. \"\$(dirname \"\$0\")/_/husky.sh\"
npx --no-install commitlint --edit \"\$1\""
setup_husky_hook "commit-msg" "npx --no-install commitlint --edit \"\$1\""
# Function to globally install an npm package if not installed
install_global_package() {