From 7ba5401e2f9fc617722f141e20f29640ead40b17 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 7 Mar 2026 00:42:05 -0800 Subject: [PATCH] feat(infra): use oss.gogenex.com for app version download URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将应用版本的文件下载链接从 API 代理路径改为直接指向对象存储域名。 backend/admin-service (admin-version.controller.ts) - uploadVersion 上传成功后,downloadUrl 改为: https://oss.gogenex.com/app-releases/ (原:/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 --- backend/docker-compose.yml | 1 + .../interface/http/controllers/admin-version.controller.ts | 5 +++-- frontend/admin-web/.env.development | 3 +++ frontend/admin-web/.env.production | 3 +++ infrastructure/minio/deploy.sh | 3 ++- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index 77c7b49..3388b2d 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -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: diff --git a/backend/services/admin-service/src/interface/http/controllers/admin-version.controller.ts b/backend/services/admin-service/src/interface/http/controllers/admin-version.controller.ts index 254ca75..3696f70 100644 --- a/backend/services/admin-service/src/interface/http/controllers/admin-version.controller.ts +++ b/backend/services/admin-service/src/interface/http/controllers/admin-version.controller.ts @@ -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/) + 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 }; diff --git a/frontend/admin-web/.env.development b/frontend/admin-web/.env.development index 1ee373b..fcb636a 100644 --- a/frontend/admin-web/.env.development +++ b/frontend/admin-web/.env.development @@ -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 diff --git a/frontend/admin-web/.env.production b/frontend/admin-web/.env.production index 851dfb0..ce17f41 100644 --- a/frontend/admin-web/.env.production +++ b/frontend/admin-web/.env.production @@ -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 diff --git a/infrastructure/minio/deploy.sh b/infrastructure/minio/deploy.sh index 41c5291..8a3924b 100644 --- a/infrastructure/minio/deploy.sh +++ b/infrastructure/minio/deploy.sh @@ -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}"