Skip to content

Commit f40b27f

Browse files
committed
initial commit
0 parents  commit f40b27f

File tree

136 files changed

+16023
-0
lines changed

Some content is hidden

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

136 files changed

+16023
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Question template
3+
about: Ask if it is not clear that it is a bug
4+
title: ''
5+
labels: question
6+
assignees: ''
7+
8+
---
9+
10+

.github/dependabot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "gomod"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"

.github/workflows/docker.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Docker Image CI
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: true
16+
17+
- name: Docker meta
18+
id: meta
19+
uses: docker/metadata-action@v5
20+
with:
21+
images: |
22+
alireza7/s-ui
23+
ghcr.io/alireza0/s-ui
24+
tags: |
25+
type=ref,event=branch
26+
type=ref,event=tag
27+
type=pep440,pattern={{version}}
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Login to Docker Hub
36+
uses: docker/login-action@v3
37+
with:
38+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
39+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
40+
41+
- name: Login to GHCR
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.repository_owner }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
push: true
53+
platforms: linux/amd64,linux/arm64/v8
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release S-UI
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
platform: [amd64, arm64, arm]
14+
runs-on: ubuntu-20.04
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/[email protected]
18+
19+
- name: Setup Go
20+
uses: actions/[email protected]
21+
with:
22+
go-version: '1.21'
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
registry-url: 'https://registry.npmjs.org'
29+
30+
- name: Install dependencies for arm64 and arm
31+
if: matrix.platform == 'arm64' || matrix.platform == 'arm'
32+
run: |
33+
sudo apt-get update
34+
sudo apt install gcc-aarch64-linux-gnu
35+
if [ "${{ matrix.platform }}" == "arm" ]; then
36+
sudo apt install gcc-arm-linux-gnueabihf
37+
fi
38+
39+
- name: Build frontend
40+
run: |
41+
cd frontend
42+
npm install
43+
npm run build
44+
cd ..
45+
mv frontend/dist backend/web/html
46+
47+
- name: Set evironments
48+
run: |
49+
export CGO_ENABLED=1
50+
export GOOS=linux
51+
export GOARCH=${{ matrix.platform }}
52+
if [ "${{ matrix.platform }}" == "arm64" ]; then
53+
export CC=aarch64-linux-gnu-gcc
54+
elif [ "${{ matrix.platform }}" == "arm" ]; then
55+
export CC=arm-linux-gnueabihf-gcc
56+
fi
57+
58+
- name: Build sing-box
59+
run: |
60+
git clone -b v1.8.5 https://github.com/SagerNet/sing-box
61+
cd sing-box
62+
go build -tags with_v2ray_api,with_clash_api,with_grpc,with_quic,with_ech -o sing-box ./cmd/sing-box
63+
cd ..
64+
65+
- name: Build s-ui
66+
run: |
67+
cd backend
68+
go build -o ../sui main.go
69+
cd ..
70+
71+
mkdir s-ui
72+
cp sui s-ui/
73+
cp s-ui.service s-ui/
74+
cp sing-box.service s-ui/
75+
mkdir s-ui/bin
76+
cp sing-box/sing-box s-ui/bin/
77+
cp runSingbox.sh s-ui/bin/
78+
79+
- name: Package
80+
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui
81+
82+
- name: Upload
83+
uses: svenstaro/[email protected]
84+
with:
85+
repo_token: ${{ secrets.GITHUB_TOKEN }}
86+
tag: ${{ github.ref }}
87+
file: s-ui-linux-${{ matrix.platform }}.tar.gz
88+
asset_name: s-ui-linux-${{ matrix.platform }}.tar.gz
89+
prerelease: true
90+
overwrite: true

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
dist/
3+
release/
4+
backup/
5+
bin/
6+
db/
7+
sui
8+
main
9+
tmp
10+
.sync*
11+
*.tar.gz
12+
13+
# local env files
14+
.env.local
15+
.env.*.local
16+
17+
# Log files
18+
*.log*
19+
.cache
20+
21+
# Editor directories and files
22+
.idea
23+
.vscode

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM node:alpine as front-builder
2+
WORKDIR /app
3+
COPY frontend/ ./
4+
RUN npm install && npm run build
5+
6+
FROM golang:1.21-alpine AS backend-builder
7+
WORKDIR /app
8+
ARG TARGETARCH
9+
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
10+
ENV CGO_ENABLED=1
11+
RUN apk --no-cache --update add build-base gcc wget unzip
12+
COPY backend/ ./
13+
COPY --from=front-builder /app/dist/ /app/web/html/
14+
RUN go build -o sui main.go
15+
16+
FROM alpine
17+
LABEL org.opencontainers.image.authors="[email protected]"
18+
ENV TZ=Asia/Tehran
19+
WORKDIR /app
20+
RUN apk add --no-cache --update ca-certificates tzdata
21+
COPY --from=backend-builder /app/sui /app/
22+
VOLUME [ "s-ui" ]
23+
CMD [ "./sui" ]

0 commit comments

Comments
 (0)