From 7cbae154bf97584e442f94fb9aad9caef5c40c4d Mon Sep 17 00:00:00 2001 From: zxyszx <299979470+zxyszx@users.noreply.github.com> Date: Fri, 14 Aug 2026 06:08:44 +0800 Subject: [PATCH] chore: configure Gitea repository source --- README.en.md | 6 +++--- README.md | 15 +++++---------- README.zh-CN.md | 10 +++++----- apps/web/src/pages/profile.tsx | 2 +- deploy/README.md | 2 +- docs/BACKUP_RESTORE.md | 2 +- docs/GUIDE.md | 4 ++-- install.sh | 13 ++++++++++--- tests/install_test.sh | 19 +++++++++++++++++++ 9 files changed, 47 insertions(+), 26 deletions(-) diff --git a/README.en.md b/README.en.md index eb3e89e..dea5678 100644 --- a/README.en.md +++ b/README.en.md @@ -2,7 +2,7 @@ NewSzxcn Email is a self-hosted mail server with a complete Webmail client and administration console. It bundles Go, React, Postfix, Dovecot, Rspamd, and SQLite into an all-in-one Docker deployment. -[Releases](https://github.com/zxyszx/NewSzxcn-Email/releases) · [Chinese README](README.md) +[Releases](https://gitea.xzys.me/szx/NewSzxcn-Email/releases) · [Chinese README](README.md) ## Features @@ -18,7 +18,7 @@ NewSzxcn Email is a self-hosted mail server with a complete Webmail client and a Debian and Ubuntu on `amd64` or `arm64` are supported. ```bash -curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh | sudo bash +curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh | sudo bash ``` The installer configures `/opt/newszxcn-email`, starts the Docker services, and waits for the health check. DNS records and provider port restrictions must still be configured by the operator. @@ -55,7 +55,7 @@ Open TCP ports `25`, `80`, `443`, `465`, `587`, `993`, and `995` as needed. Publ ## Manual source deployment ```bash -git clone https://github.com/zxyszx/NewSzxcn-Email.git +git clone https://gitea.xzys.me/szx/NewSzxcn-Email.git cd NewSzxcn-Email/deploy cp .env.example .env docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build diff --git a/README.md b/README.md index 82d8fd8..dd69b2b 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,7 @@ NewSzxcn-Email 是一个可自建、可管理、带完整 Webmail 与管理后台的开源邮箱系统。 -[![Release](https://img.shields.io/github/v/release/zxyszx/NewSzxcn-Email?display_name=tag&sort=semver)](https://github.com/zxyszx/NewSzxcn-Email/releases) -[![Docker Release](https://github.com/zxyszx/NewSzxcn-Email/actions/workflows/docker.yml/badge.svg)](https://github.com/zxyszx/NewSzxcn-Email/actions/workflows/docker.yml) -[![CI](https://github.com/zxyszx/NewSzxcn-Email/actions/workflows/ci.yml/badge.svg)](https://github.com/zxyszx/NewSzxcn-Email/actions/workflows/ci.yml) -[![License](https://img.shields.io/github/license/zxyszx/NewSzxcn-Email)](LICENSE) - -[邮箱后台配置指南](docs/GUIDE.md) · [版本发布](https://github.com/zxyszx/NewSzxcn-Email/releases) · [部署文档](deploy/README.md) · [English](README.en.md) +[邮箱后台配置指南](docs/GUIDE.md) · [版本发布](https://gitea.xzys.me/szx/NewSzxcn-Email/releases) · [部署文档](deploy/README.md) · [English](README.en.md) · [MIT License](LICENSE) ## 主要功能 @@ -26,13 +21,13 @@ NewSzxcn-Email 是一个可自建、可管理、带完整 Webmail 与管理后 支持 Debian / Ubuntu 的 `amd64` 与 `arm64` 服务器。建议至少 2 核、2 GB 内存,并准备一个已解析到服务器的邮件主机名,例如 `mail.example.com`。 ```bash -curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh | sudo bash +curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh | sudo bash ``` 已使用 `root` 登录时,也可以使用: ```bash -bash <(curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh) +bash <(curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh) ``` ### 管理面板 @@ -194,7 +189,7 @@ sudo newszxcn-email uninstall 需要自行控制 Compose 配置时: ```bash -git clone https://github.com/zxyszx/NewSzxcn-Email.git +git clone https://gitea.xzys.me/szx/NewSzxcn-Email.git cd NewSzxcn-Email/deploy cp .env.example .env # 编辑 .env @@ -216,7 +211,7 @@ docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build - 后端:Go、Chi、SQLite - 前端:React、TypeScript、TanStack Query、shadcn/ui、Tailwind CSS - 邮件:Postfix、Dovecot、Rspamd -- 部署:Docker、Docker Compose、GitHub Actions、GHCR +- 部署:Docker、Docker Compose、GHCR ## 本地开发 diff --git a/README.zh-CN.md b/README.zh-CN.md index 814cf6e..362dc6c 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -2,7 +2,7 @@ NewSzxcn-Email 是一个可自建、可管理、带完整 Webmail 与管理后台的开源邮箱系统。 -[版本发布](https://github.com/zxyszx/NewSzxcn-Email/releases) · [部署文档](deploy/README.md) · [English](README.en.md) +[版本发布](https://gitea.xzys.me/szx/NewSzxcn-Email/releases) · [部署文档](deploy/README.md) · [English](README.en.md) ## 主要功能 @@ -21,13 +21,13 @@ NewSzxcn-Email 是一个可自建、可管理、带完整 Webmail 与管理后 支持 Debian / Ubuntu 的 `amd64` 与 `arm64` 服务器。建议至少 2 核、2 GB 内存,并准备一个已解析到服务器的邮件主机名,例如 `mail.example.com`。 ```bash -curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh | sudo bash +curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh | sudo bash ``` 已使用 `root` 登录时,也可以使用: ```bash -bash <(curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh) +bash <(curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh) ``` 脚本会自动完成: @@ -123,7 +123,7 @@ sudo newszxcn-email uninstall 需要自行控制 Compose 配置时: ```bash -git clone https://github.com/zxyszx/NewSzxcn-Email.git +git clone https://gitea.xzys.me/szx/NewSzxcn-Email.git cd NewSzxcn-Email/deploy cp .env.example .env # 编辑 .env @@ -145,7 +145,7 @@ docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build - 后端:Go、Chi、SQLite - 前端:React、TypeScript、TanStack Query、shadcn/ui、Tailwind CSS - 邮件:Postfix、Dovecot、Rspamd -- 部署:Docker、Docker Compose、GitHub Actions、GHCR +- 部署:Docker、Docker Compose、GHCR ## 本地开发 diff --git a/apps/web/src/pages/profile.tsx b/apps/web/src/pages/profile.tsx index bbdb7cc..30b0081 100644 --- a/apps/web/src/pages/profile.tsx +++ b/apps/web/src/pages/profile.tsx @@ -393,7 +393,7 @@ export function ProfilePage() { : tab === "apiTokens" - ? + ? : undefined return ( diff --git a/deploy/README.md b/deploy/README.md index 350a0c2..a2b9876 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -5,7 +5,7 @@ 推荐直接使用仓库根目录的管理脚本: ```bash -curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh | sudo bash +curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh | sudo bash ``` 后续操作: diff --git a/docs/BACKUP_RESTORE.md b/docs/BACKUP_RESTORE.md index b367282..7e3aaba 100644 --- a/docs/BACKUP_RESTORE.md +++ b/docs/BACKUP_RESTORE.md @@ -22,7 +22,7 @@ Telegram 消息包含邮局域名、服务器 IP、系统版本、已有域名 确认文件已经上传后,首次执行官方脚本: ```bash -curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh | sudo bash +curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh | sudo bash ``` 脚本显示“尚未安装”管理菜单后,输入 `2`,选择“备份恢复”。在恢复完成后,以后需要管理系统时才使用 `ns` 打开管理菜单。 diff --git a/docs/GUIDE.md b/docs/GUIDE.md index ca275c7..404419e 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -7,7 +7,7 @@ 建议使用 Debian 或 Ubuntu,并提前准备一个已经解析到服务器的邮件主机名,例如 `mail.example.com`。 ```bash -bash <(curl -fsSL https://raw.githubusercontent.com/zxyszx/NewSzxcn-Email/main/install.sh) +bash <(curl -fsSL https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main/install.sh) ``` 安装脚本会依次询问防火墙配置和邮件服务器域名,自动检测邮箱地址域名,再让你选择默认 `admin` 前缀或自定义管理员邮箱前缀,最后输入密码并选择 Web 部署方式。例如输入服务器域名 `mail.newszxcn.com`,确认检测结果 `@newszxcn.com`,选择 `1. 使用默认前缀 admin` 会创建 `admin@newszxcn.com`;选择 `2. 自定义管理员邮箱前缀` 后才需要输入邮箱账号前缀。选择“自动配置 Nginx + SSL”时,脚本会安装 Nginx,并使用官方 `acme.sh` 申请 Let's Encrypt 证书。 @@ -170,4 +170,4 @@ sudo newszxcn-email reset-2fa - [项目说明](../README.md) - [Docker 部署说明](../deploy/README.md) - [API 文档](API.md) -- [版本发布](https://github.com/zxyszx/NewSzxcn-Email/releases) +- [版本发布](https://gitea.xzys.me/szx/NewSzxcn-Email/releases) diff --git a/install.sh b/install.sh index 65f2c59..04c5833 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,14 @@ #!/usr/bin/env bash set -Eeuo pipefail -REPOSITORY="zxyszx/NewSzxcn-Email" -RAW_BASE="https://raw.githubusercontent.com/${REPOSITORY}/main" INSTALL_DIR="${LANQIN_INSTALL_DIR:-/opt/newszxcn-email}" +DEFAULT_RAW_BASE="https://gitea.xzys.me/szx/NewSzxcn-Email/raw/branch/main" +SOURCE_URL_FILE="${INSTALL_DIR}/.source-url" +RAW_BASE="${LANQIN_RAW_BASE:-}" +if [[ -z "${RAW_BASE}" && -s "${SOURCE_URL_FILE}" ]]; then + RAW_BASE="$(tr -d '\r\n' < "${SOURCE_URL_FILE}")" +fi +RAW_BASE="${RAW_BASE:-${DEFAULT_RAW_BASE}}" COMMAND="${1:-menu}" ROLLBACK_FILE="${INSTALL_DIR}/.rollback-image" ROLLBACK_POINTER="${INSTALL_DIR}/.rollback-manifest" @@ -135,6 +140,8 @@ apply_staged_assets() { install -m 0644 "${INSTALL_DIR}/.env.example.new" "${INSTALL_DIR}/.env.example" || return 1 install -m 0755 "${INSTALL_DIR}/.install.sh.new" "${CLI_PATH}.new" || return 1 mv "${CLI_PATH}.new" "${CLI_PATH}" || return 1 + printf '%s\n' "${RAW_BASE}" > "${SOURCE_URL_FILE}" || return 1 + chmod 0644 "${SOURCE_URL_FILE}" || return 1 rm -f "${INSTALL_DIR}/.docker-compose.yml.new" "${INSTALL_DIR}/.env.example.new" "${INSTALL_DIR}/.install.sh.new" } @@ -1524,7 +1531,7 @@ SSL 证书:有效期至 ${certificate_expiry} 重置管理员密码:newszxcn-email reset-password 公开教程: -https://github.com/zxyszx/NewSzxcn-Email/blob/main/docs/GUIDE.md +https://gitea.xzys.me/szx/NewSzxcn-Email/src/branch/main/docs/GUIDE.md EOF install -m 0600 "${tmp}" "${GUIDE_FILE}" rm -f "${tmp}" diff --git a/tests/install_test.sh b/tests/install_test.sh index 0bf1c81..6f1dc45 100644 --- a/tests/install_test.sh +++ b/tests/install_test.sh @@ -126,6 +126,24 @@ test_compose_configuration() { grep -Fq './certs:/certs:ro' "${ROOT_DIR}/deploy/docker-compose.yml" || fail_test "certificate mount missing" } +test_source_url_persistence() ( + local temp_dir + temp_dir="$(mktemp -d)" + INSTALL_DIR="${temp_dir}/install" + SOURCE_URL_FILE="${INSTALL_DIR}/.source-url" + CLI_PATH="${temp_dir}/newszxcn-email" + RAW_BASE="https://gitea.example.test/szx/NewSzxcn-Email/raw/branch/main" + mkdir -p "${INSTALL_DIR}" + printf 'services: {}\n' > "${INSTALL_DIR}/.docker-compose.yml.new" + printf 'LANQIN_IMAGE=test\n' > "${INSTALL_DIR}/.env.example.new" + printf '#!/usr/bin/env bash\nexit 0\n' > "${INSTALL_DIR}/.install.sh.new" + + apply_staged_assets + + assert_eq "${RAW_BASE}" "$(cat "${SOURCE_URL_FILE}")" "persisted installer source URL" + [[ -x "${CLI_PATH}" ]] || fail_test "installed CLI is not executable" +) + test_legacy_configuration_is_preserved() { local temp_dir temp_dir="$(mktemp -d)" @@ -835,6 +853,7 @@ test_install_configuration 1 1 "127.0.0.1:8088" "https://mail.example.com" "fals test_install_configuration 2 2 "127.0.0.1:8088" "https://mail.example.com" "false" test_nginx_configuration test_compose_configuration +test_source_url_persistence test_legacy_configuration_is_preserved test_menu_choice test_menu_rendering