chore: switch repository links to gitea
This commit is contained in:
+5
-5
@@ -401,12 +401,12 @@ OPS_ENABLED=true
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update Configuration (在线更新配置)
|
||||
# -----------------------------------------------------------------------------
|
||||
# GitHub repository used for online update checks and binary downloads
|
||||
# 在线更新检查和二进制下载使用的 GitHub 仓库
|
||||
UPDATE_GITHUB_REPO=man209111-cpu/sub2api
|
||||
# code repository used for online update checks and binary downloads
|
||||
# 在线更新检查和二进制下载使用的 代码仓库
|
||||
UPDATE_GITHUB_REPO=kgod/sub2api
|
||||
|
||||
# Proxy URL for accessing GitHub (used for online updates and pricing data)
|
||||
# 用于访问 GitHub 的代理地址(用于在线更新和定价数据获取)
|
||||
# Proxy URL for repository update checks and pricing data
|
||||
# 用于访问代码仓库更新接口和定价数据的代理地址
|
||||
# Supports: http, https, socks5, socks5h
|
||||
# Examples:
|
||||
# HTTP proxy: http://127.0.0.1:7890
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ docker run -d \
|
||||
-p 8080:8080 \
|
||||
-e DATABASE_URL="postgres://user:pass@host:5432/sub2api" \
|
||||
-e REDIS_URL="redis://host:6379" \
|
||||
weishaw/sub2api:latest
|
||||
git.jianshixingqiu.com/kgod/sub2api:latest
|
||||
```
|
||||
|
||||
## Docker Compose
|
||||
@@ -20,7 +20,7 @@ version: '3.8'
|
||||
|
||||
services:
|
||||
sub2api:
|
||||
image: weishaw/sub2api:latest
|
||||
image: git.jianshixingqiu.com/kgod/sub2api:latest
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
@@ -72,5 +72,5 @@ volumes:
|
||||
|
||||
## Links
|
||||
|
||||
- [GitHub Repository](https://github.com/weishaw/sub2api)
|
||||
- [Documentation](https://github.com/weishaw/sub2api#readme)
|
||||
- [Gitea Repository](http://git.jianshixingqiu.com/kgod/sub2api)
|
||||
- [Documentation](http://git.jianshixingqiu.com/kgod/sub2api#readme)
|
||||
|
||||
+2
-2
@@ -73,9 +73,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build \
|
||||
FROM ${ALPINE_IMAGE}
|
||||
|
||||
# Labels
|
||||
LABEL maintainer="Wei-Shaw <github.com/Wei-Shaw>"
|
||||
LABEL maintainer="kgod <http://git.jianshixingqiu.com/kgod/sub2api>"
|
||||
LABEL description="Sub2API - AI API Gateway Platform"
|
||||
LABEL org.opencontainers.image.source="https://github.com/Wei-Shaw/sub2api"
|
||||
LABEL org.opencontainers.image.source="http://git.jianshixingqiu.com/kgod/sub2api"
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
|
||||
+5
-5
@@ -35,10 +35,10 @@ Use the automated preparation script for the easiest setup:
|
||||
|
||||
```bash
|
||||
# Download and run the preparation script
|
||||
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/docker-deploy.sh | bash
|
||||
curl -sSL http://git.jianshixingqiu.com/kgod/sub2api/raw/branch/main/deploy/docker-deploy.sh | bash
|
||||
|
||||
# Or download first, then run
|
||||
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/docker-deploy.sh -o docker-deploy.sh
|
||||
curl -sSL http://git.jianshixingqiu.com/kgod/sub2api/raw/branch/main/deploy/docker-deploy.sh -o docker-deploy.sh
|
||||
chmod +x docker-deploy.sh
|
||||
./docker-deploy.sh
|
||||
```
|
||||
@@ -71,7 +71,7 @@ If you prefer manual control:
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://github.com/Wei-Shaw/sub2api.git
|
||||
git clone http://git.jianshixingqiu.com/kgod/sub2api.git
|
||||
cd sub2api/deploy
|
||||
|
||||
# Configure environment
|
||||
@@ -353,12 +353,12 @@ For production servers using systemd.
|
||||
### One-Line Installation
|
||||
|
||||
```bash
|
||||
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | sudo bash
|
||||
curl -sSL http://git.jianshixingqiu.com/kgod/sub2api/raw/branch/main/deploy/install.sh | sudo bash
|
||||
```
|
||||
|
||||
### Manual Installation
|
||||
|
||||
1. Download the latest release from [GitHub Releases](https://github.com/Wei-Shaw/sub2api/releases)
|
||||
1. Download the latest release from [Gitea Releases](http://git.jianshixingqiu.com/kgod/sub2api/releases)
|
||||
2. Extract and copy the binary to `/opt/sub2api/`
|
||||
3. Copy `sub2api.service` to `/etc/systemd/system/`
|
||||
4. Run:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Copy this file to /etc/sub2api/config.yaml and modify as needed
|
||||
# 复制此文件到 /etc/sub2api/config.yaml 并根据需要修改
|
||||
#
|
||||
# Documentation / 文档: https://github.com/Wei-Shaw/sub2api
|
||||
# Documentation / 文档: http://git.jianshixingqiu.com/kgod/sub2api
|
||||
|
||||
# =============================================================================
|
||||
# Server Configuration
|
||||
@@ -1093,11 +1093,11 @@ gemini:
|
||||
# Update Configuration (在线更新配置)
|
||||
# =============================================================================
|
||||
update:
|
||||
# GitHub repository used for online update checks and binary downloads.
|
||||
# 在线更新检查和二进制下载使用的 GitHub 仓库。
|
||||
github_repo: "man209111-cpu/sub2api"
|
||||
# Proxy URL for accessing GitHub (used for online updates and pricing data)
|
||||
# 用于访问 GitHub 的代理地址(用于在线更新和定价数据获取)
|
||||
# code repository used for online update checks and binary downloads.
|
||||
# 在线更新检查和二进制下载使用的 代码仓库。
|
||||
github_repo: "kgod/sub2api"
|
||||
# Proxy URL for repository update checks and pricing data
|
||||
# 用于访问代码仓库更新接口和定价数据的代理地址
|
||||
# Supports: http, https, socks5, socks5h
|
||||
# Examples:
|
||||
# - HTTP proxy: "http://127.0.0.1:7890"
|
||||
|
||||
@@ -24,7 +24,7 @@ services:
|
||||
# Sub2API Application
|
||||
# ===========================================================================
|
||||
sub2api:
|
||||
image: ghcr.io/man209111-cpu/sub2api:latest
|
||||
image: git.jianshixingqiu.com/kgod/sub2api:latest
|
||||
container_name: sub2api
|
||||
restart: unless-stopped
|
||||
ulimits:
|
||||
@@ -144,9 +144,9 @@ services:
|
||||
# =======================================================================
|
||||
# Update Configuration (在线更新配置)
|
||||
# =======================================================================
|
||||
# GitHub repo for online update checks and binary downloads
|
||||
- UPDATE_GITHUB_REPO=${UPDATE_GITHUB_REPO:-man209111-cpu/sub2api}
|
||||
# Proxy for accessing GitHub (online updates + pricing data)
|
||||
# code repository for online update checks and binary downloads
|
||||
- UPDATE_GITHUB_REPO=${UPDATE_GITHUB_REPO:-kgod/sub2api}
|
||||
# Proxy for repository update checks and pricing data
|
||||
# Examples: http://host:port, socks5://host:port
|
||||
- UPDATE_PROXY_URL=${UPDATE_PROXY_URL:-socks5://admin%40sub2api.local:m729066849@172.16.32.16:3389}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
services:
|
||||
sub2api:
|
||||
image: weishaw/sub2api:latest
|
||||
image: git.jianshixingqiu.com/kgod/sub2api:latest
|
||||
container_name: sub2api
|
||||
restart: unless-stopped
|
||||
ulimits:
|
||||
@@ -92,7 +92,7 @@ services:
|
||||
# =======================================================================
|
||||
# Update Configuration (在线更新配置)
|
||||
# =======================================================================
|
||||
- UPDATE_GITHUB_REPO=${UPDATE_GITHUB_REPO:-man209111-cpu/sub2api}
|
||||
- UPDATE_GITHUB_REPO=${UPDATE_GITHUB_REPO:-kgod/sub2api}
|
||||
- UPDATE_PROXY_URL=${UPDATE_PROXY_URL:-socks5://admin%40sub2api.local:m729066849@172.16.32.16:3389}
|
||||
|
||||
# Built-in OAuth client secrets (optional)
|
||||
|
||||
@@ -16,7 +16,7 @@ services:
|
||||
# Sub2API Application
|
||||
# ===========================================================================
|
||||
sub2api:
|
||||
image: ghcr.io/man209111-cpu/sub2api:latest
|
||||
image: git.jianshixingqiu.com/kgod/sub2api:latest
|
||||
container_name: sub2api
|
||||
restart: unless-stopped
|
||||
ulimits:
|
||||
@@ -140,9 +140,9 @@ services:
|
||||
# =======================================================================
|
||||
# Update Configuration (在线更新配置)
|
||||
# =======================================================================
|
||||
# GitHub repo for online update checks and binary downloads
|
||||
- UPDATE_GITHUB_REPO=${UPDATE_GITHUB_REPO:-man209111-cpu/sub2api}
|
||||
# Proxy for accessing GitHub (online updates + pricing data)
|
||||
# code repository for online update checks and binary downloads
|
||||
- UPDATE_GITHUB_REPO=${UPDATE_GITHUB_REPO:-kgod/sub2api}
|
||||
# Proxy for repository update checks and pricing data
|
||||
# Examples: http://host:port, socks5://host:port
|
||||
- UPDATE_PROXY_URL=${UPDATE_PROXY_URL:-socks5://admin%40sub2api.local:m729066849@172.16.32.16:3389}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# GitHub raw content base URL
|
||||
GITHUB_RAW_URL="https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy"
|
||||
# Gitea raw content base URL
|
||||
REPO_RAW_URL="http://git.jianshixingqiu.com/kgod/sub2api/raw/branch/main/deploy"
|
||||
|
||||
# Print colored message
|
||||
print_info() {
|
||||
@@ -78,9 +78,9 @@ main() {
|
||||
# Download docker-compose.local.yml and save as docker-compose.yml
|
||||
print_info "Downloading docker-compose.yml..."
|
||||
if command_exists curl; then
|
||||
curl -sSL "${GITHUB_RAW_URL}/docker-compose.local.yml" -o docker-compose.yml
|
||||
curl -sSL "${REPO_RAW_URL}/docker-compose.local.yml" -o docker-compose.yml
|
||||
elif command_exists wget; then
|
||||
wget -q "${GITHUB_RAW_URL}/docker-compose.local.yml" -O docker-compose.yml
|
||||
wget -q "${REPO_RAW_URL}/docker-compose.local.yml" -O docker-compose.yml
|
||||
else
|
||||
print_error "Neither curl nor wget is installed. Please install one of them."
|
||||
exit 1
|
||||
@@ -90,9 +90,9 @@ main() {
|
||||
# Download .env.example
|
||||
print_info "Downloading .env.example..."
|
||||
if command_exists curl; then
|
||||
curl -sSL "${GITHUB_RAW_URL}/.env.example" -o .env.example
|
||||
curl -sSL "${REPO_RAW_URL}/.env.example" -o .env.example
|
||||
else
|
||||
wget -q "${GITHUB_RAW_URL}/.env.example" -O .env.example
|
||||
wget -q "${REPO_RAW_URL}/.env.example" -O .env.example
|
||||
fi
|
||||
print_success "Downloaded .env.example"
|
||||
|
||||
|
||||
+24
-11
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Sub2API Installation Script
|
||||
# Sub2API 安装脚本
|
||||
# Usage: curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/install.sh | bash
|
||||
# Usage: curl -sSL http://git.jianshixingqiu.com/kgod/sub2api/raw/branch/main/deploy/install.sh | bash
|
||||
#
|
||||
|
||||
set -e
|
||||
@@ -15,8 +15,10 @@ BLUE='\033[0;34m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
GITHUB_REPO="Wei-Shaw/sub2api"
|
||||
# Repository configuration
|
||||
GITEA_BASE_URL="http://git.jianshixingqiu.com"
|
||||
GITEA_API_URL="${GITEA_BASE_URL}/api/v1"
|
||||
GITEA_REPO="kgod/sub2api"
|
||||
INSTALL_DIR="/opt/sub2api"
|
||||
SERVICE_NAME="sub2api"
|
||||
SERVICE_USER="sub2api"
|
||||
@@ -468,7 +470,7 @@ check_dependencies() {
|
||||
# Get latest release version
|
||||
get_latest_version() {
|
||||
print_info "$(msg 'fetching_version')"
|
||||
LATEST_VERSION=$(curl -s --connect-timeout 10 --max-time 30 "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
LATEST_VERSION=$(curl -s --connect-timeout 10 --max-time 30 "${GITEA_API_URL}/repos/${GITEA_REPO}/releases/latest" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"tag_name"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
|
||||
|
||||
if [ -z "$LATEST_VERSION" ]; then
|
||||
print_error "$(msg 'failed_get_version')"
|
||||
@@ -484,7 +486,7 @@ list_versions() {
|
||||
print_info "$(msg 'fetching_versions')"
|
||||
|
||||
local versions
|
||||
versions=$(curl -s --connect-timeout 10 --max-time 30 "https://api.github.com/repos/${GITHUB_REPO}/releases" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | head -20)
|
||||
versions=$(curl -s --connect-timeout 10 --max-time 30 "${GITEA_API_URL}/repos/${GITEA_REPO}/releases" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"tag_name"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/' | head -20)
|
||||
|
||||
if [ -z "$versions" ]; then
|
||||
print_error "$(msg 'failed_get_version')"
|
||||
@@ -521,11 +523,11 @@ validate_version() {
|
||||
|
||||
# Check if the release exists
|
||||
local http_code
|
||||
http_code=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 --max-time 30 "https://api.github.com/repos/${GITHUB_REPO}/releases/tags/${version}" 2>/dev/null)
|
||||
http_code=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 --max-time 30 "${GITEA_API_URL}/repos/${GITEA_REPO}/releases/tags/${version}" 2>/dev/null)
|
||||
|
||||
# Check for network errors (empty or non-numeric response)
|
||||
if [ -z "$http_code" ] || ! [[ "$http_code" =~ ^[0-9]+$ ]]; then
|
||||
print_error "Network error: Failed to connect to GitHub API" >&2
|
||||
print_error "Network error: Failed to connect to Gitea API" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -554,8 +556,19 @@ get_current_version() {
|
||||
download_and_extract() {
|
||||
local version_num=${LATEST_VERSION#v}
|
||||
local archive_name="sub2api_${version_num}_${OS}_${ARCH}.tar.gz"
|
||||
local download_url="https://github.com/${GITHUB_REPO}/releases/download/${LATEST_VERSION}/${archive_name}"
|
||||
local checksum_url="https://github.com/${GITHUB_REPO}/releases/download/${LATEST_VERSION}/checksums.txt"
|
||||
local release_json
|
||||
local download_url
|
||||
local checksum_url
|
||||
|
||||
release_json=$(curl -s --connect-timeout 10 --max-time 30 "${GITEA_API_URL}/repos/${GITEA_REPO}/releases/tags/${LATEST_VERSION}" 2>/dev/null || true)
|
||||
download_url=$(printf '%s' "$release_json" | tr '{' '\n' | grep "\"name\"[[:space:]]*:[[:space:]]*\"${archive_name}\"" | sed -n -E 's/.*"browser_download_url"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/p' | head -1)
|
||||
checksum_url=$(printf '%s' "$release_json" | tr '{' '\n' | grep '"name"[[:space:]]*:[[:space:]]*"checksums.txt"' | sed -n -E 's/.*"browser_download_url"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/p' | head -1)
|
||||
|
||||
if [ -z "$download_url" ]; then
|
||||
print_error "$(msg 'download_failed'): ${archive_name}"
|
||||
print_info "No matching release asset found at ${GITEA_BASE_URL}/${GITEA_REPO}/releases/tag/${LATEST_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_info "$(msg 'downloading') ${archive_name}..."
|
||||
|
||||
@@ -571,7 +584,7 @@ download_and_extract() {
|
||||
|
||||
# Download and verify checksum
|
||||
print_info "$(msg 'verifying_checksum')"
|
||||
if curl -sL "$checksum_url" -o "$TEMP_DIR/checksums.txt" 2>/dev/null; then
|
||||
if [ -n "$checksum_url" ] && curl -sL "$checksum_url" -o "$TEMP_DIR/checksums.txt" 2>/dev/null; then
|
||||
local expected_checksum=$(grep "$archive_name" "$TEMP_DIR/checksums.txt" | awk '{print $1}')
|
||||
local actual_checksum=$(sha256sum "$TEMP_DIR/$archive_name" | awk '{print $1}')
|
||||
|
||||
@@ -655,7 +668,7 @@ install_service() {
|
||||
cat > /etc/systemd/system/sub2api.service << EOF
|
||||
[Unit]
|
||||
Description=Sub2API - AI API Gateway Platform
|
||||
Documentation=https://github.com/Wei-Shaw/sub2api
|
||||
Documentation=http://git.jianshixingqiu.com/kgod/sub2api
|
||||
After=network.target postgresql.service redis.service
|
||||
Wants=postgresql.service redis.service
|
||||
|
||||
|
||||
Reference in New Issue
Block a user