diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 563099c..21dc72e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,6 +132,8 @@ jobs: } - name: Generate checksums run: pnpm checksum setup.exe portable.7z + - name: Copy Legacy Artifacts + run: pnpm copy-legacy - name: Upload Artifacts if: startsWith(github.ref, 'refs/heads/') uses: actions/upload-artifact@v4 @@ -208,6 +210,8 @@ jobs: } - name: Generate checksums run: pnpm checksum setup.exe portable.7z + - name: Copy Legacy Artifacts + run: pnpm copy-legacy - name: Upload Artifacts if: startsWith(github.ref, 'refs/heads/') uses: actions/upload-artifact@v4 @@ -277,6 +281,8 @@ jobs: run: pnpm build:linux --${{ matrix.arch }} - name: Generate checksums run: pnpm checksum .deb .rpm + - name: Copy Legacy Artifacts + run: pnpm copy-legacy - name: Upload Artifacts if: startsWith(github.ref, 'refs/heads/') uses: actions/upload-artifact@v4 @@ -371,6 +377,8 @@ jobs: APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - name: Generate checksums run: pnpm checksum .pkg + - name: Copy Legacy Artifacts + run: pnpm copy-legacy - name: Upload Artifacts if: startsWith(github.ref, 'refs/heads/') uses: actions/upload-artifact@v4 @@ -464,6 +472,8 @@ jobs: APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - name: Generate checksums run: pnpm checksum .pkg + - name: Copy Legacy Artifacts + run: pnpm copy-legacy - name: Upload Artifacts if: startsWith(github.ref, 'refs/heads/') uses: actions/upload-artifact@v4 diff --git a/build/pkg-scripts/preinstall b/build/pkg-scripts/preinstall index c403638..e9c9867 100644 --- a/build/pkg-scripts/preinstall +++ b/build/pkg-scripts/preinstall @@ -22,5 +22,7 @@ rm -f "$HELPER_PATH" # 清理可能存在的旧版本文件 rm -rf "/Applications/Clash Party.app" rm -rf "/Applications/Clash\\ Party.app" +rm -rf "/Applications/Mihomo Party.app" +rm -rf "/Applications/Mihomo\\ Party.app" exit 0 diff --git a/changelog.md b/changelog.md index 21befb1..583d6e4 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,12 @@ - 增加关闭动画开关 - 增加订阅超时时间设置 +### 修复 (Fix) +- 修复 vless 协议 short-id 的解析错误问题 +- 修复 MacOS 进入轻量模式内核退出的问题 +- 修复 AUR 发布问题 +- 修复 改名后升级提示404的问题 + ### 优化 (Optimize) - socket 管理防止内核通信失败 diff --git a/package.json b/package.json index a6db00f..af27b51 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ "prepare:dev": "node scripts/update-version.mjs && node scripts/prepare.mjs", "updater": "node scripts/updater.mjs", "checksum": "node scripts/checksum.mjs", + "copy-legacy": "node scripts/copy-legacy-artifacts.mjs", + "test-copy-legacy": "node scripts/test-copy-legacy.mjs", "telegram": "node scripts/telegram.mjs release", "telegram:dev": "node scripts/telegram.mjs dev", "artifact": "node scripts/artifact.mjs", diff --git a/scripts/copy-legacy-artifacts.mjs b/scripts/copy-legacy-artifacts.mjs new file mode 100644 index 0000000..6416f00 --- /dev/null +++ b/scripts/copy-legacy-artifacts.mjs @@ -0,0 +1,66 @@ +import { readFileSync, readdirSync, writeFileSync, copyFileSync, existsSync } from 'fs' +import { join } from 'path' + +/** + * 复制打包产物并重命名为兼容旧版本的文件名 + * 将 clash-party 重命名为 mihomo-party,用于更新检测兼容性 + */ + +const distDir = 'dist' + +if (!existsSync(distDir)) { + console.log('❌ dist 目录不存在,请先执行打包命令') + process.exit(1) +} + +const files = readdirSync(distDir) +console.log('📦 开始处理打包产物...') + +let copiedCount = 0 + +for (const file of files) { + if (file.includes('clash-party') && !file.endsWith('.sha256')) { + const newFileName = file.replace('clash-party', 'mihomo-party') + const sourcePath = join(distDir, file) + const targetPath = join(distDir, newFileName) + + try { + copyFileSync(sourcePath, targetPath) + console.log(`✅ 复制: ${file} -> ${newFileName}`) + copiedCount++ + + const sha256File = `${file}.sha256` + const sha256Path = join(distDir, sha256File) + + if (existsSync(sha256Path)) { + const newSha256File = `${newFileName}.sha256` + const newSha256Path = join(distDir, newSha256File) + + const sha256Content = readFileSync(sha256Path, 'utf8') + writeFileSync(newSha256Path, sha256Content) + console.log(`✅ 复制校验文件: ${sha256File} -> ${newSha256File}`) + copiedCount++ + } + } catch (error) { + console.error(`❌ 复制文件失败: ${file}`, error.message) + } + } +} + +if (copiedCount > 0) { + console.log(`🎉 成功复制 ${copiedCount} 个文件`) + console.log('📋 现在 dist 目录包含以下文件:') + + const finalFiles = readdirSync(distDir).sort() + finalFiles.forEach(file => { + if (file.includes('clash-party') || file.includes('mihomo-party')) { + const isLegacy = file.includes('mihomo-party') + console.log(` ${isLegacy ? '🔄' : '📦'} ${file}`) + } + }) + + console.log(' 📦 = 原始文件 (clash-party)') + console.log(' 🔄 = 兼容文件 (mihomo-party)') +} else { + console.log('ℹ️ 没有找到需要复制的 clash-party 文件') +}