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/<branch>/<path> - 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.
This commit is contained in:
@@ -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 二进制下载不完整'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user