新增工具脚本: - scripts/sync-upstream.sh: 主同步脚本,自动从上游拉取并应用配置 - scripts/apply-branding.sh: 自动应用StarFireAPI品牌化修改 - scripts/apply-deploy-config.sh: 自动应用部署配置 - scripts/README.md: 工具使用说明 功能特性: ✅ 自动备份当前分支 ✅ 从上游仓库拉取最新代码 ✅ 自动应用品牌化修改(Sub2API → StarFireAPI) ✅ 自动应用部署配置(端口、Redis、镜像等) ✅ 智能提示和确认 ✅ 支持回滚操作 使用方法: chmod +x scripts/*.sh ./scripts/sync-upstream.sh 修改 .gitignore 以允许追踪自定义同步工具 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
78 lines
4.7 KiB
Bash
78 lines
4.7 KiB
Bash
#!/bin/bash
|
|
# =============================================================================
|
|
# 品牌化修改脚本 - StarFireAPI
|
|
# =============================================================================
|
|
# 功能:自动应用 StarFireAPI 品牌化修改
|
|
# 用法:./scripts/apply-branding.sh
|
|
# =============================================================================
|
|
|
|
set -e
|
|
|
|
# 颜色输出
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
log_info() {
|
|
echo -e "${BLUE}[品牌化]${NC} $1"
|
|
}
|
|
|
|
log_success() {
|
|
echo -e "${GREEN}[品牌化]${NC} $1"
|
|
}
|
|
|
|
# 品牌配置
|
|
BRAND_NAME="StarFireAPI"
|
|
OFFICIAL_SITE="https://anthropic.edu.pl"
|
|
|
|
log_info "开始应用品牌化修改..."
|
|
|
|
# 1. 修改前端页面标题
|
|
log_info "修改页面标题..."
|
|
sed -i 's|<title>Sub2API - AI API Gateway</title>|<title>StarFireAPI - AI API Gateway</title>|g' frontend/index.html
|
|
|
|
# 2. 修改中文语言包
|
|
log_info "修改中文语言包..."
|
|
sed -i "s|viewOnGithub: '在 GitHub 上查看'|viewOnGithub: '查看文档'|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|title: 'Sub2API 安装向导'|title: 'StarFireAPI 安装向导'|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|description: '配置您的 Sub2API 实例'|description: '配置您的 StarFireAPI 实例'|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|github: 'GitHub'|github: '官网'|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|用于 Sub2API 用户登录|用于 StarFireAPI 用户登录|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|siteNamePlaceholder: 'Sub2API'|siteNamePlaceholder: 'StarFireAPI'|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|fromNamePlaceholder: 'Sub2API'|fromNamePlaceholder: 'StarFireAPI'|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|欢迎使用 Sub2API|欢迎使用 StarFireAPI|g" frontend/src/i18n/locales/zh.ts
|
|
sed -i "s|欢迎来到 Sub2API AI 服务平台|欢迎来到 StarFireAPI AI 服务平台|g" frontend/src/i18n/locales/zh.ts
|
|
|
|
# 3. 修改英文语言包
|
|
log_info "修改英文语言包..."
|
|
sed -i "s|viewOnGithub: 'View on GitHub'|viewOnGithub: 'View Documentation'|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|title: 'Sub2API Setup'|title: 'StarFireAPI Setup'|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|description: 'Configure your Sub2API instance'|description: 'Configure your StarFireAPI instance'|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|github: 'GitHub'|github: 'Official Site'|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|for Sub2API end-user login|for StarFireAPI end-user login|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|siteNamePlaceholder: 'Sub2API'|siteNamePlaceholder: 'StarFireAPI'|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|fromNamePlaceholder: 'Sub2API'|fromNamePlaceholder: 'StarFireAPI'|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|Welcome to Sub2API|Welcome to StarFireAPI|g" frontend/src/i18n/locales/en.ts
|
|
sed -i "s|Welcome to the Sub2API AI service platform|Welcome to the StarFireAPI AI service platform|g" frontend/src/i18n/locales/en.ts
|
|
|
|
# 4. 修改 HomeView.vue
|
|
log_info "修改首页..."
|
|
sed -i "s|const siteName = computed(() => appStore.cachedPublicSettings?.site_name || appStore.siteName || 'Sub2API')|const siteName = computed(() => appStore.cachedPublicSettings?.site_name || appStore.siteName || 'StarFireAPI')|g" frontend/src/views/HomeView.vue
|
|
sed -i "s|const githubUrl = 'https://github.com/Wei-Shaw/sub2api'|const officialUrl = 'https://anthropic.edu.pl'|g" frontend/src/views/HomeView.vue
|
|
sed -i "s|:href=\"githubUrl\"|:href=\"officialUrl\"|g" frontend/src/views/HomeView.vue
|
|
sed -i "s|>GitHub</a>|>官网</a>|g" frontend/src/views/HomeView.vue
|
|
|
|
# 5. 修改注册和验证页面
|
|
log_info "修改注册和验证页面..."
|
|
sed -i "s|const siteName = ref<string>('Sub2API')|const siteName = ref<string>('StarFireAPI')|g" frontend/src/views/auth/RegisterView.vue
|
|
sed -i "s|const siteName = ref<string>('Sub2API')|const siteName = ref<string>('StarFireAPI')|g" frontend/src/views/auth/EmailVerifyView.vue
|
|
|
|
# 6. 修改 AppHeader.vue 中的 GitHub 链接
|
|
log_info "修改导航栏链接..."
|
|
# 这个需要更复杂的替换,使用 perl 或手动处理
|
|
if command -v perl &> /dev/null; then
|
|
perl -i -p0e 's|href="https://github.com/Wei-Shaw/sub2api"[^>]*>.*?<path[^>]*fill-rule="evenodd"[^>]*clip-rule="evenodd"[^>]*d="[^"]*"[^>]*/>\s*</svg>|href="https://anthropic.edu.pl"\n target="_blank"\n rel="noopener noreferrer"\n @click="closeDropdown"\n class="dropdown-item"\n >\n <svg class="h-4 w-4" fill="currentColor" viewBox="0 0 24 24">\n <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>\n </svg>|gs' frontend/src/components/layout/AppHeader.vue 2>/dev/null || log_info "AppHeader.vue 需要手动调整 GitHub 链接"
|
|
fi
|
|
|
|
log_success "品牌化修改应用完成"
|