feat(infra): use oss.gogenex.com for app version download URLs

将应用版本的文件下载链接从 API 代理路径改为直接指向对象存储域名。

backend/admin-service (admin-version.controller.ts)
- uploadVersion 上传成功后,downloadUrl 改为:
    https://oss.gogenex.com/app-releases/<storageKey>
  (原:/api/v1/app/version/download/:id 代理路径)
- 读取 OSS_BASE_URL 环境变量,默认 https://oss.gogenex.com

backend/docker-compose.yml
- admin-service 新增 OSS_BASE_URL=https://oss.gogenex.com

infrastructure/minio/deploy.sh
- app-releases bucket 加入公开下载列表
  (APK/IPA 需被移动端直接下载,无需鉴权)

frontend/admin-web
- .env.production 新增 NEXT_PUBLIC_OSS_URL=https://oss.gogenex.com
- .env.development 新增 NEXT_PUBLIC_OSS_URL=https://oss.gogenex.com

MinIO 现状:
  app-releases bucket 已在服务器上设为 anonymous download

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-07 00:42:05 -08:00
parent 4c5f5e2cd9
commit 7ba5401e2f
5 changed files with 12 additions and 3 deletions

View File

@ -359,6 +359,7 @@ services:
- MINIO_ACCESS_KEY=genex-admin
- MINIO_SECRET_KEY=genex-minio-secret
- MINIO_BUCKET=app-releases
- OSS_BASE_URL=https://oss.gogenex.com # Public download base URL for app packages
- JWT_ACCESS_SECRET=dev-access-secret-change-in-production
depends_on:
postgres:

View File

@ -142,9 +142,10 @@ export class AdminVersionController {
createdBy: req.user?.sub,
});
// Set stable download URL pointing to this service's download endpoint
// Direct download URL via MinIO (oss.gogenex.com/app-releases/<storageKey>)
const ossBase = process.env.OSS_BASE_URL || 'https://oss.gogenex.com';
const updated = await this.versionService.updateVersion(version.id, {
downloadUrl: `/api/v1/app/version/download/${version.id}`,
downloadUrl: `${ossBase}/app-releases/${uploadResult.objectName}`,
});
return { code: 0, data: updated };

View File

@ -1,6 +1,9 @@
# API Configuration
NEXT_PUBLIC_API_BASE_URL=http://localhost:8080/api
# Object Storage
NEXT_PUBLIC_OSS_URL=https://oss.gogenex.com
# Application Info
NEXT_PUBLIC_APP_NAME=Genex Admin
NEXT_PUBLIC_VERSION=1.0.0-dev

View File

@ -1,6 +1,9 @@
# API Configuration
NEXT_PUBLIC_API_BASE_URL=https://api.gogenex.com/api
# Object Storage
NEXT_PUBLIC_OSS_URL=https://oss.gogenex.com
# Application Info
NEXT_PUBLIC_APP_NAME=Genex Admin
NEXT_PUBLIC_VERSION=1.0.0

View File

@ -22,7 +22,8 @@ BUCKETS=(
)
# Buckets that should be publicly readable (no auth needed for download)
PUBLIC_BUCKETS=(coupon-images avatars)
# app-releases: APK/IPA packages downloaded directly by mobile apps via oss.gogenex.com
PUBLIC_BUCKETS=(app-releases coupon-images avatars)
_init_buckets() {
local user="${MINIO_ROOT_USER:-genex-admin}"