diff --git a/.github/scripts/lib/comment.ts b/.github/scripts/lib/comment.ts index c669d0828..3c78be178 100644 --- a/.github/scripts/lib/comment.ts +++ b/.github/scripts/lib/comment.ts @@ -6,7 +6,13 @@ export const COMMENT_MARKER = ''; export const DOCKER_COMMENT_MARKER = ''; // 默认代理前缀(加速中国大陆访问 GitHub Release) -export const PROXY_BASE = 'https://nclatest.znin.net'; +// 格式:https://ghfast.top/{full-github-url} +export const PROXY_BASE = 'https://gh.llkk.cc'; + +/** 将 GitHub 直链转换为 ghfast.top 加速链接 */ +export function toProxyUrl (directUrl: string): string { + return `${PROXY_BASE}/${directUrl}`; +} export type BuildStatus = 'success' | 'failure' | 'cancelled' | 'pending' | 'unknown'; @@ -186,13 +192,20 @@ export function generateResultComment ( // 添加快速安装命令 if (installInfo) { - const proxyInstallUrl = installInfo.installUrl.replace('https://github.com', PROXY_BASE); + const directUrl = installInfo.installUrl; + const proxyInstallUrl = toProxyUrl(directUrl); lines.push( '', '---', '', '## 🚀 快速安装 (Linux)', '', + '**直连(需要能访问 GitHub)**', + '```bash', + `curl -sSL ${directUrl} | bash`, + '```', + '', + '**加速(国内推荐,ghfast.top)**', '```bash', `curl -sSL ${proxyInstallUrl} | bash`, '```', diff --git a/.github/scripts/pr-publish-release.ts b/.github/scripts/pr-publish-release.ts index 211171bc7..b0fc2c762 100644 --- a/.github/scripts/pr-publish-release.ts +++ b/.github/scripts/pr-publish-release.ts @@ -21,7 +21,7 @@ import { execSync } from 'node:child_process'; import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync } from 'node:fs'; import { join, basename, resolve } from 'node:path'; import { GitHubAPI, getEnv, setOutput } from './lib/github.ts'; -import { PROXY_BASE } from './lib/comment.ts'; +import { toProxyUrl } from './lib/comment.ts'; interface AssetEntry { name: string; @@ -119,7 +119,8 @@ async function main (): Promise { } // ---- 创建 Release ---- - const proxyInstallUrl = `${downloadBase}/install.sh`.replace('https://github.com', PROXY_BASE); + const directInstallUrl = `${downloadBase}/install.sh`; + const proxyInstallUrl = toProxyUrl(directInstallUrl); const releaseBody = [ `## NapCat PR #${prNumber} 测试版本`, '', @@ -129,6 +130,12 @@ async function main (): Promise { '', '### 快速安装 (Linux)', '', + '**直连(需要能访问 GitHub)**', + '```bash', + `curl -sSL ${directInstallUrl} | bash`, + '```', + '', + '**加速(国内推荐,ghfast.top)**', '```bash', `curl -sSL ${proxyInstallUrl} | bash`, '```',