From f4ef3d96a6ecf81fb6fc7074dcf0ee36b27f116e Mon Sep 17 00:00:00 2001 From: aaaamoooo Date: Tue, 20 Oct 2026 11:05:55 +0000 Subject: [PATCH] chore: migrate self-distribution links from GitHub to self-hosted Gitea GitHub accounts suspended; all first-party distribution now served from git.881218.xyz/rogue/NexusGate (Gitea): - raw: /rogue/NexusGate/raw/branch// - release assets and source archives under the same repo path - scripts gain a GIT_BASE variable built from NG_REPO (default rogue/NexusGate); NG_REPO/NG_BRANCH/--repo/--branch semantics unchanged - panel enrollment/uninstall commands in public/app.js point at Gitea raw - install.sh/nexusgate.sh/agent-singbox.sh stats source previously defaulted to the upstream repo (a2899882); defaults now this repo Upstream dependency references (sagernet/sing-box Go module) untouched. --- README.md | 6 +++--- agent-go/INSTALL-GO.md | 4 ++-- public/app.js | 4 ++-- scripts/agent-install.sh | 14 ++++++++------ scripts/agent-singbox.sh | 10 +++++----- scripts/agent-update.sh | 10 ++++++---- scripts/install.sh | 10 ++++++---- scripts/nexusgate.sh | 6 ++++-- 8 files changed, 36 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 53d34d2..2c9cc76 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ ```bash # 克隆仓库 -git clone https://github.com/aaaamoooo/NexusGate.git /opt/nexusgate +git clone https://git.881218.xyz/rogue/NexusGate.git /opt/nexusgate cd /opt/nexusgate # 安装依赖并启动 @@ -39,10 +39,10 @@ OpenWrt 上用 procd 常驻,见 `scripts/` 目录。 3. 在节点机上以 root 运行该命令 ```bash -curl -fsSL https://raw.githubusercontent.com/aaaamoooo/NexusGate/main/scripts/agent-install.sh | bash -s -- --server https://主控域名 --token 你的TOKEN +curl -fsSL https://git.881218.xyz/rogue/NexusGate/raw/branch/main/scripts/agent-install.sh | bash -s -- --server https://主控域名 --token 你的TOKEN ``` -Agent 是 Go 静态二进制,安装时从 GitHub Release 下载,节点机不再需要安装 Node.js。(如需回退旧版 Node Agent,安装时加环境变量 `NG_AGENT_IMPL=node`。) +Agent 是 Go 静态二进制,安装时从 Gitea Release 下载,节点机不再需要安装 Node.js。(如需回退旧版 Node Agent,安装时加环境变量 `NG_AGENT_IMPL=node`。) ## 支持的协议 diff --git a/agent-go/INSTALL-GO.md b/agent-go/INSTALL-GO.md index 5f5529b..21fa80c 100644 --- a/agent-go/INSTALL-GO.md +++ b/agent-go/INSTALL-GO.md @@ -7,8 +7,8 @@ Agent 已从 Node.js(`agent/agent.js`)切换为 Go 静态二进制 ## 新装(scripts/agent-install.sh) -- 默认从 GitHub Release 下载二进制: - `https://github.com/aaaamoooo/NexusGate/releases/download/agent-v0.6.8/nexusgate-agent-linux-` +- 默认从 Gitea Release 下载二进制: + `https://git.881218.xyz/rogue/NexusGate/releases/download/agent-v0.6.8/nexusgate-agent-linux-` (`` 由 `uname -m` 决定:x86_64→amd64,aarch64→arm64) - 安装到 `/opt/nexusgate-agent/nexusgate-agent`(0755)。 - 服务名仍为 `nexusgate-agent`: diff --git a/public/app.js b/public/app.js index 5e99368..54fb0d1 100644 --- a/public/app.js +++ b/public/app.js @@ -535,7 +535,7 @@ document.addEventListener('click', async (event) => { toast('分配已移除'); const node = state.nodes.find((item) => item.id === itemId); await load('chains'); nodeClientsModal(state.nodes.find((item) => item.id === node.id)); } else if (action === 'enroll-server') { const result = await api(`/api/servers/${itemId}/enrollment-token`, { method:'POST', body:'{}' }); - const command = `curl -fsSL https://raw.githubusercontent.com/aaaamoooo/NexusGate/main/scripts/agent-install.sh | bash -s -- --server ${location.origin} --token ${result.token}`; + const command = `curl -fsSL https://git.881218.xyz/rogue/NexusGate/raw/branch/main/scripts/agent-install.sh | bash -s -- --server ${location.origin} --token ${result.token}`; modal('ONE-TIME ENROLLMENT', 'Agent 注册 / 重装命令', `
令牌 30 分钟内有效且只能使用一次。重装会保留本机资源文件,并在 Agent 重启后自动与控制面对账。
${esc(command)}
`); } else if (action === 'copy-uri') { await copyText(button.dataset.value); toast('已复制到剪贴板'); } else if (action === 'qr-uri') { @@ -546,7 +546,7 @@ document.addEventListener('click', async (event) => { } else if (action === 'agent-uninstall') { const command = 'ng-agent uninstall'; - const fallback = 'curl -fsSL https://raw.githubusercontent.com/aaaamoooo/NexusGate/main/scripts/agent-uninstall.sh | bash'; + const fallback = 'curl -fsSL https://git.881218.xyz/rogue/NexusGate/raw/branch/main/scripts/agent-uninstall.sh | bash'; modal('AGENT MAINTENANCE', '在目标服务器 SSH 卸载 Agent', `
先停用并删除关联节点,让在线 Agent 完成资源清理。卸载会停止 NexusGate 专属服务并移除密钥与节点配置。然后在控制台删除设备登记;离线且有待清理项时使用“遗忘离线设备”。遗忘不会远程卸载机器。
${esc(command)}
旧版 Agent 没有 ng-agent 命令时,使用下列兼容命令:
${esc(fallback)}
`); } else if (action === 'retry-cleanup') { const result = await api(`/api/servers/${itemId}/cleanup`, { method:'POST', body:'{}' }); toast(result.queued ? `已重新排队 ${result.queued} 个清理任务` : '清理任务已在队列中,请等待设备上线'); await load(); } diff --git a/scripts/agent-install.sh b/scripts/agent-install.sh index 8a92170..4aae9f5 100755 --- a/scripts/agent-install.sh +++ b/scripts/agent-install.sh @@ -1,12 +1,14 @@ #!/usr/bin/env bash set -Eeuo pipefail -REPO="${NG_REPO:-aaaamoooo/NexusGate}" +REPO="${NG_REPO:-rogue/NexusGate}" BRANCH="${NG_BRANCH:-main}" +# 自建 Gitea 分发基址(raw / release / archive 均由此拼装) +GIT_BASE="https://git.881218.xyz/${REPO}" # Agent 实现:默认 go(静态二进制,节点机不再需要 Node.js)。 # NG_AGENT_IMPL=node 可回退到旧版 Node agent(agent/agent.js + nodejs 包)。 AGENT_IMPL="${NG_AGENT_IMPL:-go}" -# Go agent 二进制所在的 GitHub Release tag +# Go agent 二进制所在的 Gitea Release tag AGENT_RELEASE="${NG_AGENT_RELEASE:-agent-v0.6.8}" CONTROLLER="" TOKEN="" @@ -14,14 +16,14 @@ TOKEN="" die() { printf '错误:%s\n' "$*" >&2; exit 1; } info() { printf '\033[1;36m[NexusGate Agent]\033[0m %s\n' "$*"; } -# NG_LOCAL_SRC 指向本地源码目录时跳过 GitHub 下载(本地改动尚未 push 时用这个) +# NG_LOCAL_SRC 指向本地源码目录时跳过远程下载(本地改动尚未 push 时用这个) fetch() { if [[ -n "${NG_LOCAL_SRC:-}" ]]; then [[ -f "${NG_LOCAL_SRC}/$1" ]] || die "NG_LOCAL_SRC 目录缺少 $1" cp -a "${NG_LOCAL_SRC}/$1" "$2" else - # 加时间戳破坏 GitHub raw 缓存,避免拉到旧版 - curl -fL --retry 3 "https://raw.githubusercontent.com/${REPO}/${BRANCH}/$1?t=$(date +%s)" -o "$2" + # 加时间戳破坏 raw 缓存,避免拉到旧版 + curl -fL --retry 3 "${GIT_BASE}/raw/branch/${BRANCH}/$1?t=$(date +%s)" -o "$2" fi } @@ -50,7 +52,7 @@ fetch_agent_binary() { if [[ -n "${NG_LOCAL_SRC:-}" && -f "${NG_LOCAL_SRC}/agent-go/nexusgate-agent-linux-${arch}" ]]; then cp -a "${NG_LOCAL_SRC}/agent-go/nexusgate-agent-linux-${arch}" "$out" else - curl -fL --retry 3 "https://github.com/${REPO}/releases/download/${AGENT_RELEASE}/nexusgate-agent-linux-${arch}" -o "$out" + curl -fL --retry 3 "${GIT_BASE}/releases/download/${AGENT_RELEASE}/nexusgate-agent-linux-${arch}" -o "$out" fi [[ -s "$out" ]] || die 'Agent 二进制下载不完整' } diff --git a/scripts/agent-singbox.sh b/scripts/agent-singbox.sh index 2b3a9b9..22aa6a8 100644 --- a/scripts/agent-singbox.sh +++ b/scripts/agent-singbox.sh @@ -14,7 +14,7 @@ if [[ -x "$target" && -x "$stats_target" && "${2:-}" != '--force' ]]; then exit 0 fi -# 优先从 GitHub Release 下载预编译二进制,免去现场编译 +# 优先从 Gitea Release 下载预编译二进制,免去现场编译 # Release tag: sing-box-v1.13.21,需上传 nexusgate-sing-box-linux- 和 nexusgate-sing-box-stats-linux- try_prebuilt() { local arch dl_arch release_tag base_url tmp_bin tmp_stats @@ -24,11 +24,11 @@ try_prebuilt() { *) return 1 ;; esac release_tag="${NG_SINGBOX_RELEASE:-sing-box-v1.13.21}" - base_url="https://github.com/aaaamoooo/NexusGate/releases/download/${release_tag}" + base_url="https://git.881218.xyz/${NG_REPO:-rogue/NexusGate}/releases/download/${release_tag}" tmp_bin="$(mktemp /tmp/nexusgate-singbox-bin.XXXXXX)" tmp_stats="$(mktemp /tmp/nexusgate-singbox-stats.XXXXXX)" trap 'rm -f -- "$tmp_bin" "$tmp_stats"' RETURN - printf '尝试从 GitHub Release 下载预编译 sing-box...\n' + printf '尝试从 Gitea Release 下载预编译 sing-box...\n' if curl -fL --retry 2 --connect-timeout 15 -o "$tmp_bin" "${base_url}/nexusgate-sing-box-linux-${dl_arch}" 2>/dev/null && \ curl -fL --retry 2 --connect-timeout 15 -o "$tmp_stats" "${base_url}/nexusgate-sing-box-stats-linux-${dl_arch}" 2>/dev/null; then chmod +x "$tmp_bin" "$tmp_stats" @@ -80,12 +80,12 @@ printf '构建 sing-box %s(启用 V2Ray 统计 API,首次需下载 Go 依赖 GOBIN="$build_dir" GOTOOLCHAIN=auto GOMAXPROCS=1 go install -trimpath -ldflags='-s -w' -p 1 -tags with_v2ray_api "github.com/sagernet/sing-box/cmd/sing-box@${version}" [[ -s "$build_dir/sing-box" ]] || { printf 'sing-box 构建失败\n' >&2; exit 1; } -repo="${NG_REPO:-a2899882/NexusGate}" +repo="${NG_REPO:-rogue/NexusGate}" branch="${NG_BRANCH:-main}" if [[ -n "${NG_STATS_SOURCE:-}" ]]; then install -m 0600 "$NG_STATS_SOURCE" "$stats_source_dir/stats-query.go" else - curl -fL --retry 3 "https://raw.githubusercontent.com/${repo}/${branch}/agent/stats-query.go" -o "$stats_source_dir/stats-query.go" + curl -fL --retry 3 "https://git.881218.xyz/${repo}/raw/branch/${branch}/agent/stats-query.go" -o "$stats_source_dir/stats-query.go" fi ( cd "$stats_source_dir" GOTOOLCHAIN=auto go mod init nexusgate/statsquery diff --git a/scripts/agent-update.sh b/scripts/agent-update.sh index f0f13da..b89aebd 100755 --- a/scripts/agent-update.sh +++ b/scripts/agent-update.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash set -Eeuo pipefail -REPO="${NG_REPO:-aaaamoooo/NexusGate}" +REPO="${NG_REPO:-rogue/NexusGate}" BRANCH="${NG_BRANCH:-main}" -# Go agent 二进制所在的 GitHub Release tag(与 agent-install.sh 保持一致) +# 自建 Gitea 分发基址(raw / release 均由此拼装) +GIT_BASE="https://git.881218.xyz/${REPO}" +# Go agent 二进制所在的 Gitea Release tag(与 agent-install.sh 保持一致) AGENT_RELEASE="${NG_AGENT_RELEASE:-agent-v0.6.8}" die() { printf '错误:%s\n' "$*" >&2; exit 1; } info() { printf '\033[1;36m[NexusGate Agent]\033[0m %s\n' "$*"; } @@ -27,7 +29,7 @@ TARGET_IMPL="go" info "当前 Agent 实现:${CURRENT_IMPL};更新目标:${TARGET_IMPL}" raw_fetch() { - curl -fL --retry 3 "https://raw.githubusercontent.com/${REPO}/${BRANCH}/$1" -o "$2" + curl -fL --retry 3 "${GIT_BASE}/raw/branch/${BRANCH}/$1" -o "$2" } agent_arch() { @@ -45,7 +47,7 @@ fetch_agent_binary() { if [[ -n "${NG_LOCAL_SRC:-}" && -f "${NG_LOCAL_SRC}/agent-go/nexusgate-agent-linux-${arch}" ]]; then cp -a "${NG_LOCAL_SRC}/agent-go/nexusgate-agent-linux-${arch}" "$out" else - curl -fL --retry 3 "https://github.com/${REPO}/releases/download/${AGENT_RELEASE}/nexusgate-agent-linux-${arch}" -o "$out" + curl -fL --retry 3 "${GIT_BASE}/releases/download/${AGENT_RELEASE}/nexusgate-agent-linux-${arch}" -o "$out" fi [[ -s "$out" ]] || die 'Agent 二进制下载不完整' } diff --git a/scripts/install.sh b/scripts/install.sh index e03b9df..abddfb5 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -Eeuo pipefail -REPO="${NG_REPO:-a2899882/NexusGate}" +REPO="${NG_REPO:-rogue/NexusGate}" BRANCH="${NG_BRANCH:-main}" +# 自建 Gitea 分发基址(源码归档由此拼装) +GIT_BASE="https://git.881218.xyz/${REPO}" DOMAIN="" EMAIL="" @@ -61,7 +63,7 @@ fi node_major="$(node -p 'process.versions.node.split(`.`)[0]')" [[ "$node_major" -ge 18 ]] || die "需要 Node.js 18 或更高版本" -# NG_LOCAL_SRC 指向本地源码目录时跳过 GitHub 下载(本地改动尚未 push 时的全新安装用这个) +# NG_LOCAL_SRC 指向本地源码目录时跳过远程下载(本地改动尚未 push 时的全新安装用这个) src_dir="" if [[ -n "${NG_LOCAL_SRC:-}" ]]; then [[ -f "${NG_LOCAL_SRC}/server.js" ]] || die "NG_LOCAL_SRC 目录不完整(缺少 server.js)" @@ -71,10 +73,10 @@ else tmp_dir="$(mktemp -d /tmp/nexusgate-install.XXXXXX)" trap 'rm -rf -- "$tmp_dir"' EXIT info "下载 ${REPO}@${BRANCH}" - curl -fL --retry 3 "https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz" -o "$tmp_dir/source.tgz" + curl -fL --retry 3 "${GIT_BASE}/archive/${BRANCH}.tar.gz" -o "$tmp_dir/source.tgz" mkdir -p "$tmp_dir/source" tar -xzf "$tmp_dir/source.tgz" -C "$tmp_dir/source" - # GitHub tarball 解包后只有一层顶层目录;不用 --strip-components(BusyBox tar 不支持) + # 源码包解包后只有一层顶层目录;不用 --strip-components(BusyBox tar 不支持) src_dir="$(echo "$tmp_dir/source"/*/)" [[ -f "${src_dir}server.js" ]] || die "安装包不完整" fi diff --git a/scripts/nexusgate.sh b/scripts/nexusgate.sh index af9a272..ff36146 100755 --- a/scripts/nexusgate.sh +++ b/scripts/nexusgate.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -Eeuo pipefail -REPO="${NG_REPO:-a2899882/NexusGate}" +REPO="${NG_REPO:-rogue/NexusGate}" BRANCH="${NG_BRANCH:-main}" +# 自建 Gitea 分发基址(源码归档由此拼装) +GIT_BASE="https://git.881218.xyz/${REPO}" die() { printf '错误:%s\n' "$*" >&2; exit 1; } info() { printf '\033[1;36m[NexusGate]\033[0m %s\n' "$*"; } @@ -66,7 +68,7 @@ update_panel() { backup "$current_backup" stage="$(mktemp -d /tmp/nexusgate-update.XXXXXX)" trap 'rm -rf -- "$stage"' RETURN - curl -fL --retry 3 "https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz" -o "$stage/source.tgz" + curl -fL --retry 3 "${GIT_BASE}/archive/${BRANCH}.tar.gz" -o "$stage/source.tgz" mkdir -p "$stage/source" && tar -xzf "$stage/source.tgz" -C "$stage/source" --strip-components=1 [[ -f "$stage/source/server.js" ]] || die "更新包不完整" panel_stop