update default repo to main

This commit is contained in:
yusing 2025-02-23 06:37:48 +08:00
parent 2504510c61
commit 281523ee06
3 changed files with 120 additions and 120 deletions

View file

@ -73,7 +73,7 @@ Setup DNS Records point to machine which runs `GoDoxy`, e.g.
2. Run setup script inside the directory, or [set up manually](#manual-setup) 2. Run setup script inside the directory, or [set up manually](#manual-setup)
```shell ```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/yusing/go-proxy/v0.9/scripts/setup.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/yusing/go-proxy/main/scripts/setup.sh)"
``` ```
3. Start the container `docker compose up -d` and wait for it to be ready 3. Start the container `docker compose up -d` and wait for it to be ready
@ -86,15 +86,15 @@ Setup DNS Records point to machine which runs `GoDoxy`, e.g.
1. Make `config` directory then grab `config.example.yml` into `config/config.yml` 1. Make `config` directory then grab `config.example.yml` into `config/config.yml`
`mkdir -p config && wget https://raw.githubusercontent.com/yusing/go-proxy/v0.9/config.example.yml -O config/config.yml` `mkdir -p config && wget https://raw.githubusercontent.com/yusing/go-proxy/main/config.example.yml -O config/config.yml`
2. Grab `.env.example` into `.env` 2. Grab `.env.example` into `.env`
`wget https://raw.githubusercontent.com/yusing/go-proxy/v0.9/.env.example -O .env` `wget https://raw.githubusercontent.com/yusing/go-proxy/main/.env.example -O .env`
3. Grab `compose.example.yml` into `compose.yml` 3. Grab `compose.example.yml` into `compose.yml`
`wget https://raw.githubusercontent.com/yusing/go-proxy/v0.9/compose.example.yml -O compose.yml` `wget https://raw.githubusercontent.com/yusing/go-proxy/main/compose.example.yml -O compose.yml`
### Folder structrue ### Folder structrue

View file

@ -73,7 +73,7 @@
2. 在目錄內運行安裝腳本,或[手動安裝](#手動安裝) 2. 在目錄內運行安裝腳本,或[手動安裝](#手動安裝)
```shell ```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/yusing/go-proxy/v0.9/scripts/setup.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/yusing/go-proxy/main/scripts/setup.sh)"
``` ```
3. 啟動容器 `docker compose up -d` 並等待就緒 3. 啟動容器 `docker compose up -d` 並等待就緒
@ -86,15 +86,15 @@
1. 建立 `config` 目錄,然後將 `config.example.yml` 下載到 `config/config.yml` 1. 建立 `config` 目錄,然後將 `config.example.yml` 下載到 `config/config.yml`
`mkdir -p config && wget https://raw.githubusercontent.com/yusing/go-proxy/v0.9/config.example.yml -O config/config.yml` `mkdir -p config && wget https://raw.githubusercontent.com/yusing/go-proxy/main/config.example.yml -O config/config.yml`
2. 將 `.env.example` 下載到 `.env` 2. 將 `.env.example` 下載到 `.env`
`wget https://raw.githubusercontent.com/yusing/go-proxy/v0.9/.env.example -O .env` `wget https://raw.githubusercontent.com/yusing/go-proxy/main/.env.example -O .env`
3. 將 `compose.example.yml` 下載到 `compose.yml` 3. 將 `compose.example.yml` 下載到 `compose.yml`
`wget https://raw.githubusercontent.com/yusing/go-proxy/v0.9/compose.example.yml -O compose.yml` `wget https://raw.githubusercontent.com/yusing/go-proxy/main/compose.example.yml -O compose.yml`
### 資料夾結構 ### 資料夾結構

View file

@ -21,26 +21,26 @@ fi
echo "Using ${DOWNLOAD_TOOL} for downloads" echo "Using ${DOWNLOAD_TOOL} for downloads"
get_default_branch() { # get_default_branch() {
local repo="$1" # Format: owner/repo # local repo="$1" # Format: owner/repo
local branch # local branch
if [ "$DOWNLOAD_TOOL" = "curl" ]; then # if [ "$DOWNLOAD_TOOL" = "curl" ]; then
branch=$(curl -sL "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4) # branch=$(curl -sL "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4)
elif [ "$DOWNLOAD_TOOL" = "wget" ]; then # elif [ "$DOWNLOAD_TOOL" = "wget" ]; then
branch=$(wget -qO- "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4) # branch=$(wget -qO- "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4)
fi # fi
if [ -z "$branch" ]; then # if [ -z "$branch" ]; then
echo "main" # Fallback to 'main' if detection fails # echo "main" # Fallback to 'main' if detection fails
else # else
echo "$branch" # echo "$branch"
fi # fi
} # }
# Environment variables with defaults # Environment variables with defaults
REPO="yusing/go-proxy" REPO="yusing/go-proxy"
BRANCH=${BRANCH:-$(get_default_branch "$REPO")} BRANCH=${BRANCH:-"main"}
REPO_URL="https://github.com/$REPO" REPO_URL="https://github.com/$REPO"
WIKI_URL="${REPO_URL}/wiki" WIKI_URL="${REPO_URL}/wiki"
BASE_URL="${REPO_URL}/raw/${BRANCH}" BASE_URL="${REPO_URL}/raw/${BRANCH}"
@ -200,7 +200,7 @@ if [ "$ENABLE_AUTOCERT" == "y" ]; then
# ask for cloudflare api key # ask for cloudflare api key
if [ "$USE_CLOUDFLARE" = "y" ]; then if [ "$USE_CLOUDFLARE" = "y" ]; then
ask_while_empty "Enter cloudflare api key: " CLOUDFLARE_API_KEY ask_while_empty "Enter cloudflare api key: " CLOUDFLARE_API_KEY
cat <<EOF >> "$CONFIG_BASE_PATH/$CONFIG_FILE_NAME" cat <<EOF >>"$CONFIG_BASE_PATH/$CONFIG_FILE_NAME"
autocert: autocert:
provider: cloudflare provider: cloudflare
email: $EMAIL email: $EMAIL