Merge branch 'MHSanaei:main' into main

This commit is contained in:
心隨緣動 2025-08-04 21:26:51 +08:00 committed by GitHub
commit f2fc2b83c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 47 additions and 44 deletions

View File

@ -7,7 +7,7 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View File

@ -31,7 +31,7 @@ jobs:
- 386 - 386
- armv5 - armv5
- s390x - s390x
runs-on: ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -42,51 +42,54 @@ jobs:
go-version-file: go.mod go-version-file: go.mod
check-latest: true check-latest: true
- name: Install dependencies
run: |
sudo apt-get update
if [ "${{ matrix.platform }}" == "arm64" ]; then
sudo apt install gcc-aarch64-linux-gnu
elif [ "${{ matrix.platform }}" == "armv7" ]; then
sudo apt install gcc-arm-linux-gnueabihf
elif [ "${{ matrix.platform }}" == "armv6" ]; then
sudo apt install gcc-arm-linux-gnueabihf
elif [ "${{ matrix.platform }}" == "386" ]; then
sudo apt install gcc-i686-linux-gnu
elif [ "${{ matrix.platform }}" == "armv5" ]; then
sudo apt install gcc-arm-linux-gnueabi
elif [ "${{ matrix.platform }}" == "s390x" ]; then
sudo apt install gcc-s390x-linux-gnu
fi
- name: Build 3x-ui - name: Build 3x-ui
run: | run: |
export CGO_ENABLED=1 export CGO_ENABLED=1
export GOOS=linux export GOOS=linux
export GOARCH=${{ matrix.platform }} export GOARCH=${{ matrix.platform }}
if [ "${{ matrix.platform }}" == "arm64" ]; then TOOLCHAIN_URL=""
export GOARCH=arm64 MUSL_CC_HOST="https://github.com/musl-cc/musl.cc/releases/download/v0.0.1" #http://musl.cc
export CC=aarch64-linux-gnu-gcc case "${{ matrix.platform }}" in
elif [ "${{ matrix.platform }}" == "armv7" ]; then amd64)
export GOARCH=arm TOOLCHAIN_URL="$MUSL_CC_HOST/x86_64-linux-musl-cross.tgz"
export GOARM=7 ;;
export CC=arm-linux-gnueabihf-gcc arm64)
elif [ "${{ matrix.platform }}" == "armv6" ]; then TOOLCHAIN_URL="$MUSL_CC_HOST/aarch64-linux-musl-cross.tgz"
export GOARCH=arm ;;
export GOARM=6 armv7)
export CC=arm-linux-gnueabihf-gcc TOOLCHAIN_URL="$MUSL_CC_HOST/armv7l-linux-musleabihf-cross.tgz"
elif [ "${{ matrix.platform }}" == "386" ]; then export GOARCH=arm
export GOARCH=386 export GOARM=7
export CC=i686-linux-gnu-gcc ;;
elif [ "${{ matrix.platform }}" == "armv5" ]; then armv6)
export GOARCH=arm TOOLCHAIN_URL="$MUSL_CC_HOST/armv6-linux-musleabihf-cross.tgz"
export GOARM=5 export GOARCH=arm
export CC=arm-linux-gnueabi-gcc export GOARM=6
elif [ "${{ matrix.platform }}" == "s390x" ]; then ;;
export GOARCH=s390x armv5)
export CC=s390x-linux-gnu-gcc TOOLCHAIN_URL="$MUSL_CC_HOST/arm-linux-musleabi-cross.tgz"
fi export GOARCH=arm
go build -ldflags "-w -s" -o xui-release -v main.go export GOARM=5
;;
386)
TOOLCHAIN_URL="$MUSL_CC_HOST/i686-linux-musl-cross.tgz"
;;
s390x)
TOOLCHAIN_URL="$MUSL_CC_HOST/s390x-linux-musl-cross.tgz"
;;
esac
echo "Downloading musl toolchain for ${{ matrix.platform }}"
curl -LO "$TOOLCHAIN_URL"
tar -xf *.tgz
TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "*-cross" | head -n1)
TOOLCHAIN_DIR=$(realpath "$TOOLCHAIN_DIR")
export PATH="$TOOLCHAIN_DIR/bin:$PATH"
# Detect compiler
export CC=$(find $TOOLCHAIN_DIR/bin -name '*-gcc' | head -n1)
echo "Using CC=$CC"
go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o xui-release -v main.go
file xui-release
ldd xui-release || echo "Static binary confirmed"
mkdir x-ui mkdir x-ui
cp xui-release x-ui/ cp xui-release x-ui/

View File

@ -7,7 +7,7 @@ class AllSetting {
this.webCertFile = ""; this.webCertFile = "";
this.webKeyFile = ""; this.webKeyFile = "";
this.webBasePath = "/"; this.webBasePath = "/";
this.sessionMaxAge = 60; this.sessionMaxAge = 360;
this.pageSize = 50; this.pageSize = 50;
this.expireDiff = 0; this.expireDiff = 0;
this.trafficDiff = 0; this.trafficDiff = 0;

View File

@ -32,7 +32,7 @@ var defaultValueMap = map[string]string{
"webKeyFile": "", "webKeyFile": "",
"secret": random.Seq(32), "secret": random.Seq(32),
"webBasePath": "/", "webBasePath": "/",
"sessionMaxAge": "60", "sessionMaxAge": "360",
"pageSize": "50", "pageSize": "50",
"expireDiff": "0", "expireDiff": "0",
"trafficDiff": "0", "trafficDiff": "0",