From 8204895199f725044629a80e814a00a479d75cac Mon Sep 17 00:00:00 2001 From: Rust Date: Wed, 29 Oct 2025 11:29:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9C=A8=E7=BA=BF=E6=89=93?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 1af2aa64f26db5f7e3d41409e714be1789f17345) --- .github/workflows/build-multiplatform.yml | 32 ++++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-multiplatform.yml b/.github/workflows/build-multiplatform.yml index 3c9ae82..643bf33 100644 --- a/.github/workflows/build-multiplatform.yml +++ b/.github/workflows/build-multiplatform.yml @@ -45,6 +45,11 @@ on: required: true default: 'https://xpp5.oss-ap-southeast-1.aliyuncs.com/bear1.txt' type: string + encryption_key: + description: '加密密钥' + required: true + default: 'c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx' + type: string platforms: description: '构建平台 (多选: android,windows,macos,linux)' required: true @@ -293,7 +298,7 @@ jobs: name: libcore-android path: android/app/libs/ - - name: ⚙️ 配置 API 和 OSS + - name: ⚙️ 配置 API、OSS 和加密密钥 run: | CONFIG_FILE="lib/app/common/app_config.dart" API_DOMAIN="${{ inputs.api_domain || 'api.maodag.top' }}" @@ -301,16 +306,22 @@ jobs: OSS_URL_2="${{ inputs.oss_url_2 || 'https://xgp3.oss-ap-northeast-1.aliyuncs.com/bear1.txt' }}" OSS_URL_3="${{ inputs.oss_url_3 || 'https://xpp4.oss-ap-northeast-2.aliyuncs.com/bear1.txt' }}" OSS_URL_4="${{ inputs.oss_url_4 || 'https://xpp5.oss-ap-southeast-1.aliyuncs.com/bear1.txt' }}" + ENCRYPTION_KEY="${{ inputs.encryption_key || 'c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx' }}" echo "🔧 配置参数:" echo " API: $API_DOMAIN" echo " OSS: $OSS_URL_1" + echo " 密钥: ${ENCRYPTION_KEY:0:10}..." + + # 转义密钥中的特殊字符 + ENCRYPTION_KEY_ESCAPED=$(echo "$ENCRYPTION_KEY" | sed 's/[[.*^$()+?{|]/\\&/g') sed -i "s|api\.maodag\.top|$API_DOMAIN|g" "$CONFIG_FILE" sed -i "s|https://ppp2\.oss-cn-hongkong\.aliyuncs\.com/bear1\.txt|$OSS_URL_1|g" "$CONFIG_FILE" sed -i "s|https://xgp3\.oss-ap-northeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_2|g" "$CONFIG_FILE" sed -i "s|https://xpp4\.oss-ap-northeast-2\.aliyuncs\.com/bear1\.txt|$OSS_URL_3|g" "$CONFIG_FILE" sed -i "s|https://xpp5\.oss-ap-southeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_4|g" "$CONFIG_FILE" + sed -i "s|c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx|$ENCRYPTION_KEY_ESCAPED|g" "$CONFIG_FILE" echo "✅ 配置完成" @@ -372,7 +383,7 @@ jobs: name: libcore-windows path: libcore/bin/ - - name: ⚙️ 配置 API 和 OSS + - name: ⚙️ 配置 API、OSS 和加密密钥 shell: bash run: | CONFIG_FILE="lib/app/common/app_config.dart" @@ -381,12 +392,16 @@ jobs: OSS_URL_2="${{ inputs.oss_url_2 || 'https://xgp3.oss-ap-northeast-1.aliyuncs.com/bear1.txt' }}" OSS_URL_3="${{ inputs.oss_url_3 || 'https://xpp4.oss-ap-northeast-2.aliyuncs.com/bear1.txt' }}" OSS_URL_4="${{ inputs.oss_url_4 || 'https://xpp5.oss-ap-southeast-1.aliyuncs.com/bear1.txt' }}" + ENCRYPTION_KEY="${{ inputs.encryption_key || 'c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx' }}" + + ENCRYPTION_KEY_ESCAPED=$(echo "$ENCRYPTION_KEY" | sed 's/[[.*^$()+?{|]/\\&/g') sed -i "s|api\.maodag\.top|$API_DOMAIN|g" "$CONFIG_FILE" sed -i "s|https://ppp2\.oss-cn-hongkong\.aliyuncs\.com/bear1\.txt|$OSS_URL_1|g" "$CONFIG_FILE" sed -i "s|https://xgp3\.oss-ap-northeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_2|g" "$CONFIG_FILE" sed -i "s|https://xpp4\.oss-ap-northeast-2\.aliyuncs\.com/bear1\.txt|$OSS_URL_3|g" "$CONFIG_FILE" sed -i "s|https://xpp5\.oss-ap-southeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_4|g" "$CONFIG_FILE" + sed -i "s|c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx|$ENCRYPTION_KEY_ESCAPED|g" "$CONFIG_FILE" - name: 📦 安装 Flutter 依赖 run: | @@ -466,7 +481,7 @@ jobs: run: | chmod +x libcore/bin/HiddifyCli - - name: ⚙️ 配置 API 和 OSS + - name: ⚙️ 配置 API、OSS 和加密密钥 run: | CONFIG_FILE="lib/app/common/app_config.dart" API_DOMAIN="${{ inputs.api_domain || 'api.maodag.top' }}" @@ -474,12 +489,17 @@ jobs: OSS_URL_2="${{ inputs.oss_url_2 || 'https://xgp3.oss-ap-northeast-1.aliyuncs.com/bear1.txt' }}" OSS_URL_3="${{ inputs.oss_url_3 || 'https://xpp4.oss-ap-northeast-2.aliyuncs.com/bear1.txt' }}" OSS_URL_4="${{ inputs.oss_url_4 || 'https://xpp5.oss-ap-southeast-1.aliyuncs.com/bear1.txt' }}" + ENCRYPTION_KEY="${{ inputs.encryption_key || 'c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx' }}" + + # macOS 使用不同的 sed 语法,需要转义 + ENCRYPTION_KEY_ESCAPED=$(echo "$ENCRYPTION_KEY" | sed 's/[[.*^$()+?{|]/\\&/g') sed -i '' "s|api\.maodag\.top|$API_DOMAIN|g" "$CONFIG_FILE" sed -i '' "s|https://ppp2\.oss-cn-hongkong\.aliyuncs\.com/bear1\.txt|$OSS_URL_1|g" "$CONFIG_FILE" sed -i '' "s|https://xgp3\.oss-ap-northeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_2|g" "$CONFIG_FILE" sed -i '' "s|https://xpp4\.oss-ap-northeast-2\.aliyuncs\.com/bear1\.txt|$OSS_URL_3|g" "$CONFIG_FILE" sed -i '' "s|https://xpp5\.oss-ap-southeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_4|g" "$CONFIG_FILE" + sed -i '' "s|c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx|$ENCRYPTION_KEY_ESCAPED|g" "$CONFIG_FILE" - name: 📦 安装 Flutter 依赖 run: | @@ -549,7 +569,7 @@ jobs: run: | chmod +x libcore/bin/HiddifyCli - - name: ⚙️ 配置 API 和 OSS + - name: ⚙️ 配置 API、OSS 和加密密钥 run: | CONFIG_FILE="lib/app/common/app_config.dart" API_DOMAIN="${{ inputs.api_domain || 'api.maodag.top' }}" @@ -557,12 +577,16 @@ jobs: OSS_URL_2="${{ inputs.oss_url_2 || 'https://xgp3.oss-ap-northeast-1.aliyuncs.com/bear1.txt' }}" OSS_URL_3="${{ inputs.oss_url_3 || 'https://xpp4.oss-ap-northeast-2.aliyuncs.com/bear1.txt' }}" OSS_URL_4="${{ inputs.oss_url_4 || 'https://xpp5.oss-ap-southeast-1.aliyuncs.com/bear1.txt' }}" + ENCRYPTION_KEY="${{ inputs.encryption_key || 'c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx' }}" + + ENCRYPTION_KEY_ESCAPED=$(echo "$ENCRYPTION_KEY" | sed 's/[[.*^$()+?{|]/\\&/g') sed -i "s|api\.maodag\.top|$API_DOMAIN|g" "$CONFIG_FILE" sed -i "s|https://ppp2\.oss-cn-hongkong\.aliyuncs\.com/bear1\.txt|$OSS_URL_1|g" "$CONFIG_FILE" sed -i "s|https://xgp3\.oss-ap-northeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_2|g" "$CONFIG_FILE" sed -i "s|https://xpp4\.oss-ap-northeast-2\.aliyuncs\.com/bear1\.txt|$OSS_URL_3|g" "$CONFIG_FILE" sed -i "s|https://xpp5\.oss-ap-southeast-1\.aliyuncs\.com/bear1\.txt|$OSS_URL_4|g" "$CONFIG_FILE" + sed -i "s|c0qhq99a-nq8h-ropg-wrlc-ezj4dlkxqpzx|$ENCRYPTION_KEY_ESCAPED|g" "$CONFIG_FILE" - name: 📦 安装 Flutter 依赖 run: |