链接迁移: fork 脚本复活指 Gitea、上游三件套中和、面板自更新链改指本仓

- install-master.sh/install-agent.sh: 二进制下载源由已封账号 aaaamoooo/3x-ui-diy
  改指本仓 Gitea Releases (tag 沿用 v3.7.0-agent.1); README 同步撤下'暂不可用'标注
- install.sh/update.sh: 未被 fork 部署链引用, 整文件替换为中英双语短桩 (exit 1),
  防旧习惯调用时静默装成/更新成上游原版
- x-ui.sh: 保留全部管理功能, 仅中和 install/update/update_dev/update_menu/
  legacy_version/update_shell 的上游下载分支与 uninstall 打印的上游命令,
  一律改为提示本仓 Gitea Releases 地址后退出该分支
- panel.go: 面板自更新运行时耦合处理 — panelUpdaterURL 与版本检查 API 由
  MHSanaei GitHub 改指本仓 Gitea (raw update.sh + /api/v1 releases, 响应字段
  tag_name/body/target_commitish 与原解析结构一致); 下载到的将是本仓 update.sh
  短桩, 面板更新会安全失败而非覆盖成原版
- deploy/cloud-init: curl 上游 install.sh 改为本仓 install-master.sh (Gitea raw);
  头部注明 XUI_* 非交互旋钮与 install-result.env 凭据回显在 fork 安装脚本下无等价物
This commit is contained in:
Muse
2026-10-20 12:36:50 +00:00
parent 8da3cde494
commit c67f0cb0cf
8 changed files with 87 additions and 3046 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
二进制下载:本仓库 [Releases](https://git.881218.xyz/rogue/3x-ui-agent/releases),按架构选 `x-ui-linux-amd64` 或 `x-ui-linux-arm64`。
> 仓库根目录的 `install-master.sh` / `install-agent.sh` 是早期一键脚本,其下载源仍指向已下线的 GitHub 账号,**暂不可用**;请按下面步骤手动部署。
> 仓库根目录的 `install-master.sh` / `install-agent.sh` 是一键脚本,下载源已迁至本仓 Gitea Releases(tag `v3.7.0-agent.1`),可直接使用;也可按下面步骤手动部署。
### 主控
+6 -3
View File
@@ -10,8 +10,11 @@
# serial console (owner-only); /etc/motd (world-readable) shows just the access
# URL + username. Nothing is baked in advance — every instance is unique.
#
# Requires the non-interactive install.sh (3x-ui with XUI_NONINTERACTIVE support).
# Edit the exported XUI_* knobs in /opt/xui-bootstrap.sh below to customise.
# Fork note (3x-ui-agent): the bootstrap below installs this fork's
# install-master.sh from its own Gitea repository. The fork installer does
# NOT consume the XUI_* non-interactive knobs and does NOT write
# /etc/x-ui/install-result.env, so the XUI_* exports and the credential-
# surfacing block below are inert leftovers from the upstream installer.
# ---------------------------------------------------------------------------
package_update: true
@@ -44,7 +47,7 @@ write_files:
# export XUI_DB_DSN="postgres://user:pass@host:5432/db?sslmode=disable"
# ------------------------------------------------------------------------
curl -fsSL https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh | bash
curl -fsSL https://git.881218.xyz/rogue/3x-ui-agent/raw/branch/main/install-master.sh | bash
# Surface the generated credentials. Full creds (incl. password + API token)
# go ONLY to the serial console (/dev/console, owner-only). /etc/motd is
+2 -2
View File
@@ -31,8 +31,8 @@ case "$ARCH" in
*) error "不支持的架构: $ARCH (仅支持 amd64/arm64)";;
esac
# 二进制下载地址(GitHub release,替换为实际地址)
XUI_URL="${XUI_URL:-https://github.com/aaaamoooo/3x-ui-diy/releases/download/v3.7.0-agent.1/x-ui-linux-${BIN_ARCH}}"
# 二进制下载地址(本仓 Gitea Releases,tag 沿用 v3.7.0-agent.1)
XUI_URL="${XUI_URL:-https://git.881218.xyz/rogue/3x-ui-agent/releases/download/v3.7.0-agent.1/x-ui-linux-${BIN_ARCH}}"
XRAY_VER="26.6.27"
info "创建目录..."
+2 -2
View File
@@ -18,8 +18,8 @@ case "$ARCH" in
*) error "不支持的架构: $ARCH (仅支持 amd64/arm64)";;
esac
# 二进制下载地址(GitHub release,替换为实际地址)
XUI_URL="${XUI_URL:-https://github.com/aaaamoooo/3x-ui-diy/releases/download/v3.7.0-agent.1/x-ui-linux-${BIN_ARCH}}"
# 二进制下载地址(本仓 Gitea Releases,tag 沿用 v3.7.0-agent.1)
XUI_URL="${XUI_URL:-https://git.881218.xyz/rogue/3x-ui-agent/releases/download/v3.7.0-agent.1/x-ui-linux-${BIN_ARCH}}"
XRAY_VER="26.6.27"
info "创建目录..."
+8 -1756
View File
File diff suppressed because it is too large Load Diff
+9 -7
View File
@@ -40,7 +40,7 @@ type PanelUpdateInfo struct {
}
const (
panelUpdaterURL = "https://raw.githubusercontent.com/MHSanaei/3x-ui/main/update.sh"
panelUpdaterURL = "https://git.881218.xyz/rogue/3x-ui-agent/raw/branch/main/update.sh"
maxPanelUpdaterBytes = 2 << 20
// devReleaseTag is the fixed-tag rolling pre-release the CI force-moves to the
// newest main commit; the dev update channel installs from it.
@@ -125,7 +125,7 @@ func (s *PanelService) RestartPanel(delay time.Duration) error {
return nil
}
// GetUpdateInfo checks GitHub for the latest 3x-ui release. When the dev channel
// GetUpdateInfo checks this fork's Gitea repository for the latest release. When the dev channel
// is enabled on a dev build it compares commits against the rolling dev release;
// otherwise it compares versions against the latest stable tag.
func (s *PanelService) GetUpdateInfo() (*PanelUpdateInfo, error) {
@@ -427,12 +427,14 @@ func fetchLatestPanelVersion() (string, error) {
return release.TagName, nil
}
// fetchPanelRelease fetches a release from GitHub. An empty tag resolves the
// latest stable release; a non-empty tag (e.g. dev-latest) resolves that tag.
// fetchPanelRelease fetches a release from this fork's Gitea repository
// (its API returns the same tag_name/body/target_commitish shape). An empty
// tag resolves the latest stable release; a non-empty tag (e.g. dev-latest)
// resolves that tag.
func fetchPanelRelease(tag string) (*service.Release, error) {
url := "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest"
url := "https://git.881218.xyz/api/v1/repos/rogue/3x-ui-agent/releases/latest"
if tag != "" {
url = "https://api.github.com/repos/MHSanaei/3x-ui/releases/tags/" + tag
url = "https://git.881218.xyz/api/v1/repos/rogue/3x-ui-agent/releases/tags/" + tag
}
client := (&service.SettingService{}).NewProxiedHTTPClient(10 * time.Second)
req, reqErr := http.NewRequestWithContext(context.Background(), http.MethodGet, url, nil)
@@ -445,7 +447,7 @@ func fetchPanelRelease(tag string) (*service.Release, error) {
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("GitHub API returned status %d: %s", resp.StatusCode, resp.Status)
return nil, fmt.Errorf("release API returned status %d: %s", resp.StatusCode, resp.Status)
}
var release service.Release
+9 -1232
View File
File diff suppressed because it is too large Load Diff
+50 -43
View File
@@ -129,14 +129,16 @@ before_show_menu() {
}
install() {
bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/install.sh)
if [[ $? == 0 ]]; then
if [[ $# == 0 ]]; then
start
else
start 0
fi
# Fork build (3x-ui-agent): the upstream one-click installer is disabled —
# it would install the stock panel over this fork.
# 本 fork 已禁用上游一键安装(会装成原版)。请从本仓 Releases 手动下载部署:
echo -e "${yellow}This fork does not provide the upstream one-click installer (it installs the stock panel).${plain}"
echo -e "${yellow}Please download the binary manually from this fork's Releases:${plain}"
echo -e "${green}https://git.881218.xyz/rogue/3x-ui-agent/releases${plain}"
if [[ $# == 0 ]]; then
before_show_menu
fi
return 1
}
update() {
@@ -148,11 +150,16 @@ update() {
fi
return 0
fi
bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/update.sh)
if [[ $? == 0 ]]; then
LOGI "Update is complete, Panel has automatically restarted "
# Fork build (3x-ui-agent): the upstream updater is disabled — it would
# overwrite this fork with the stock panel.
# 本 fork 已禁用上游更新(会覆盖成原版)。请手动从本仓 Releases 下载新版二进制替换:
echo -e "${yellow}This fork cannot be updated via the upstream updater (it would overwrite the fork with the stock panel).${plain}"
echo -e "${yellow}Please download the new binary manually from this fork's Releases and replace it:${plain}"
echo -e "${green}https://git.881218.xyz/rogue/3x-ui-agent/releases${plain}"
if [[ $# == 0 ]]; then
before_show_menu
fi
return 1
}
update_dev() {
@@ -164,13 +171,16 @@ update_dev() {
fi
return 0
fi
# XUI_UPDATE_TAG tells update.sh to install the dev-latest pre-release
# instead of the latest stable tag.
XUI_UPDATE_TAG="dev-latest" bash <(curl -Ls https://raw.githubusercontent.com/MHSanaei/3x-ui/main/update.sh)
if [[ $? == 0 ]]; then
LOGI "Dev update is complete, Panel has automatically restarted "
# Fork build (3x-ui-agent): there is no upstream dev channel for this
# fork, and the upstream updater would overwrite it with the stock panel.
# 本 fork 无上游 dev 更新通道。请手动从本仓 Releases 下载新版二进制替换:
echo -e "${yellow}This fork has no upstream dev-channel update (the upstream updater would overwrite the fork).${plain}"
echo -e "${yellow}Please download the new binary manually from this fork's Releases and replace it:${plain}"
echo -e "${green}https://git.881218.xyz/rogue/3x-ui-agent/releases${plain}"
if [[ $# == 0 ]]; then
before_show_menu
fi
return 1
}
replace_xui_script() {
@@ -219,29 +229,28 @@ update_menu() {
return 0
fi
if replace_xui_script "https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh" "false"; then
chmod +x ${xui_folder}/x-ui.sh
echo -e "${green}Update successful. The panel has automatically restarted.${plain}"
exit 0
else
echo -e "${red}Failed to update the menu.${plain}"
return 1
# Fork build (3x-ui-agent): the menu script is maintained in this fork's
# own repository; replacing it from upstream is disabled.
# 本 fork 的菜单脚本随本仓维护,已禁用从上游自替换:
echo -e "${yellow}This fork's menu script is maintained in its own repository; upstream self-update is disabled.${plain}"
echo -e "${green}https://git.881218.xyz/rogue/3x-ui-agent${plain}"
if [[ $# == 0 ]]; then
before_show_menu
fi
return 1
}
legacy_version() {
echo -n "Enter the panel version (like 2.4.0):"
read -r tag_version
if [ -z "$tag_version" ]; then
echo "Panel version cannot be empty. Exiting."
exit 1
# Fork build (3x-ui-agent): installing upstream legacy versions is
# disabled — it would replace this fork with the stock panel.
# 本 fork 已禁用安装上游旧版本(会装成原版)。本 fork 的可用构建见 Releases:
echo -e "${yellow}Installing upstream legacy versions is disabled in this fork.${plain}"
echo -e "${yellow}For available builds of this fork, see its Releases:${plain}"
echo -e "${green}https://git.881218.xyz/rogue/3x-ui-agent/releases${plain}"
if [[ $# == 0 ]]; then
before_show_menu
fi
# Use the entered panel version in the download link
install_command="bash <(curl -Ls "https://raw.githubusercontent.com/mhsanaei/3x-ui/v$tag_version/install.sh") v$tag_version"
echo "Downloading and installing panel version $tag_version..."
eval $install_command
return 1
}
# Function to handle the deletion of the script file
@@ -302,8 +311,8 @@ uninstall() {
echo ""
echo -e "Uninstalled Successfully.\n"
echo "If you need to install this panel again, you can use below command:"
echo -e "${green}bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)${plain}"
echo "If you need to install this fork again, download the binary manually from its Releases page:"
echo -e "${green}https://git.881218.xyz/rogue/3x-ui-agent/releases${plain}"
echo ""
# Trap the SIGTERM signal
trap delete_script SIGTERM
@@ -836,14 +845,12 @@ enable_bbr() {
}
update_shell() {
if replace_xui_script "https://github.com/MHSanaei/3x-ui/raw/main/x-ui.sh" "true"; then
LOGI "Upgrade script succeeded, Please rerun the script"
before_show_menu
else
echo ""
LOGE "Failed to download script, Please check whether the machine can connect Github"
before_show_menu
fi
# Fork build (3x-ui-agent): upstream self-update of this script is
# disabled; the script is maintained in this fork's own repository.
# 本 fork 已禁用脚本自更新(下载源为上游)。脚本随本仓维护:
echo -e "${yellow}Self-update is disabled in this fork; the script is maintained in its own repository:${plain}"
echo -e "${green}https://git.881218.xyz/rogue/3x-ui-agent${plain}"
before_show_menu
}
xui_pid() {