Skip to content

Commit 9751504

Browse files
authored
Merge pull request #702 from alireza0/sing-box-v.1.12
Sing box v1.12
2 parents 4068096 + 9c3db8c commit 9751504

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2236
-560
lines changed

.github/workflows/docker.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,39 @@ on:
66
workflow_dispatch:
77

88
jobs:
9-
build:
9+
frontend-build:
1010
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4.2.2
14+
with:
15+
submodules: recursive
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
- name: Install dependencies and build frontend
21+
run: |
22+
cd frontend
23+
npm install
24+
npm run build
25+
- name: Upload frontend build artifact
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: frontend-dist
29+
path: frontend/dist/
1130

31+
build:
32+
needs: frontend-build
33+
runs-on: ubuntu-22.04
1234
steps:
1335
- name: Checkout repository
1436
uses: actions/checkout@v4.2.2
37+
- name: Download frontend build artifact
38+
uses: actions/download-artifact@v4
1539
with:
16-
submodules: recursive
17-
40+
name: frontend-dist
41+
path: frontend_dist
1842
- name: Docker meta
1943
id: meta
2044
uses: docker/metadata-action@v5
@@ -26,31 +50,39 @@ jobs:
2650
type=ref,event=branch
2751
type=ref,event=tag
2852
type=pep440,pattern={{version}}
29-
3053
- name: Set up QEMU
3154
uses: docker/setup-qemu-action@v3
32-
3355
- name: Set up Docker Buildx
3456
uses: docker/setup-buildx-action@v3
35-
57+
with:
58+
install: true
59+
buildkitd-flags: --debug
60+
- name: Cache Docker layers
61+
uses: actions/cache@v4
62+
with:
63+
path: /tmp/.buildx-cache
64+
key: ${{ runner.os }}-buildx-${{ github.sha }}
65+
restore-keys: |
66+
${{ runner.os }}-buildx-
3667
- name: Login to Docker Hub
3768
uses: docker/login-action@v3
3869
with:
3970
username: ${{ secrets.DOCKER_HUB_USERNAME }}
4071
password: ${{ secrets.DOCKER_HUB_TOKEN }}
41-
4272
- name: Login to GHCR
4373
uses: docker/login-action@v3
4474
with:
4575
registry: ghcr.io
4676
username: ${{ github.repository_owner }}
4777
password: ${{ secrets.GITHUB_TOKEN }}
48-
4978
- name: Build and push
5079
uses: docker/build-push-action@v6
5180
with:
5281
context: .
82+
file: Dockerfile.frontend-artifact
5383
push: true
54-
platforms: linux/amd64, linux/arm64/v8, linux/arm/v7, linux/arm/v6, linux/386
84+
platforms: linux/amd64, linux/386, linux/arm64/v8, linux/arm/v7, linux/arm/v6
5585
tags: ${{ steps.meta.outputs.tags }}
56-
labels: ${{ steps.meta.outputs.labels }}
86+
labels: ${{ steps.meta.outputs.labels }}
87+
cache-from: type=local,src=/tmp/.buildx-cache
88+
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- armv5
1919
- 386
2020
- s390x
21-
runs-on: ubuntu-20.04
21+
runs-on: ubuntu-22.04
2222
steps:
2323
- name: Checkout repository
2424
uses: actions/checkout@v4.2.2
@@ -92,7 +92,7 @@ jobs:
9292
fi
9393
9494
### Build s-ui
95-
go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_ech,with_utls,with_reality_server,with_acme,with_gvisor" -o sui main.go
95+
go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui main.go
9696
9797
mkdir s-ui
9898
cp sui s-ui/

Dockerfile

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,38 @@ WORKDIR /app
33
COPY frontend/ ./
44
RUN npm install && npm run build
55

6-
FROM golang:1.23-alpine AS backend-builder
6+
FROM golang:1.24-alpine AS backend-builder
77
WORKDIR /app
88
ARG TARGETARCH
9-
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
109
ENV CGO_ENABLED=1
10+
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
1111
ENV GOARCH=$TARGETARCH
12-
RUN apk update && apk --no-cache --update add build-base gcc wget unzip
12+
13+
RUN apk update && apk add --no-cache \
14+
gcc \
15+
musl-dev \
16+
libc-dev \
17+
make \
18+
git \
19+
wget \
20+
unzip \
21+
bash
22+
23+
ENV CC=gcc
24+
1325
COPY . .
14-
COPY --from=front-builder /app/dist/ /app/web/html/
15-
RUN go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_ech,with_utls,with_reality_server,with_acme,with_gvisor" -o sui main.go
26+
COPY --from=front-builder /app/dist/ /app/web/html/
27+
28+
RUN go build -ldflags="-w -s" \
29+
-tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" \
30+
-o sui main.go
1631

1732
FROM --platform=$TARGETPLATFORM alpine
1833
LABEL org.opencontainers.image.authors="alireza7@gmail.com"
1934
ENV TZ=Asia/Tehran
2035
WORKDIR /app
21-
RUN apk add --no-cache --update ca-certificates tzdata
22-
COPY --from=backend-builder /app/sui /app/
36+
RUN apk add --no-cache --update ca-certificates tzdata
37+
COPY --from=backend-builder /app/sui /app/
2338
COPY entrypoint.sh /app/
2439
VOLUME [ "s-ui" ]
2540
ENTRYPOINT [ "./entrypoint.sh" ]

Dockerfile.frontend-artifact

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM golang:1.24-alpine AS backend-builder
2+
WORKDIR /app
3+
ARG TARGETARCH
4+
ENV CGO_ENABLED=1
5+
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
6+
ENV GOARCH=$TARGETARCH
7+
8+
RUN apk update && apk add --no-cache \
9+
gcc \
10+
musl-dev \
11+
libc-dev \
12+
make \
13+
git \
14+
wget \
15+
unzip \
16+
bash
17+
18+
ENV CC=gcc
19+
20+
COPY . .
21+
# Copy pre-built frontend files from a known location (provided by workflow artifact)
22+
COPY frontend_dist/ /app/web/html/
23+
24+
RUN go build -ldflags="-w -s" \
25+
-tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" \
26+
-o sui main.go
27+
28+
FROM --platform=$TARGETPLATFORM alpine
29+
LABEL org.opencontainers.image.authors="alireza7@gmail.com"
30+
ENV TZ=Asia/Tehran
31+
WORKDIR /app
32+
RUN apk add --no-cache --update ca-certificates tzdata
33+
COPY --from=backend-builder /app/sui /app/
34+
COPY entrypoint.sh /app/
35+
VOLUME [ "s-ui" ]
36+
ENTRYPOINT [ "./entrypoint.sh" ]

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
| Dark/Light Theme | :heavy_check_mark: |
2828
| API Interface | :heavy_check_mark: |
2929

30+
## Screenshots
31+
32+
!["Main"](https://github.com/alireza0/s-ui-frontend/raw/main/media/main.png)
33+
34+
[Other UI Screenshots](https://github.com/alireza0/s-ui-frontend/blob/main/screenshots.md)
35+
3036
## API Documentation
3137

3238
[API-Documentation Wiki](https://github.com/alireza0/s-ui/wiki/API-Documentation)

api/apiService.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type ApiService struct {
2222
service.InboundService
2323
service.OutboundService
2424
service.EndpointService
25+
service.ServicesService
2526
service.PanelService
2627
service.StatsService
2728
service.ServerService
@@ -81,6 +82,10 @@ func (a *ApiService) getData(c *gin.Context) (interface{}, error) {
8182
if err != nil {
8283
return "", err
8384
}
85+
services, err := a.ServicesService.GetAll()
86+
if err != nil {
87+
return "", err
88+
}
8489
subURI, err := a.SettingService.GetFinalSubURI(strings.Split(c.Request.Host, ":")[0])
8590
if err != nil {
8691
return "", err
@@ -91,6 +96,7 @@ func (a *ApiService) getData(c *gin.Context) (interface{}, error) {
9196
data["inbounds"] = inbounds
9297
data["outbounds"] = outbounds
9398
data["endpoints"] = endpoints
99+
data["services"] = services
94100
data["subURI"] = subURI
95101
data["onlines"] = onlines
96102
} else {
@@ -124,6 +130,12 @@ func (a *ApiService) LoadPartialData(c *gin.Context, objs []string) error {
124130
return err
125131
}
126132
data[obj] = endpoints
133+
case "services":
134+
services, err := a.ServicesService.GetAll()
135+
if err != nil {
136+
return err
137+
}
138+
data[obj] = services
127139
case "tls":
128140
tlsConfigs, err := a.TlsService.GetAll()
129141
if err != nil {

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ mkdir -p web/html
1111
rm -fr web/html/*
1212
cp -R frontend/dist/* web/html/
1313

14-
go build -ldflags "-w -s" -tags "with_quic,with_grpc,with_ech,with_utls,with_reality_server,with_acme,with_gvisor" -o sui main.go
14+
go build -ldflags "-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui main.go

0 commit comments

Comments
 (0)