Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
e7e15bb
enhance(upstream): proxy target parsing from multiple configs
0xJacky Jul 27, 2025
39ebb72
enhance(cache): handle symlinks in file event handler
0xJacky Jul 27, 2025
05c6b94
Update app.po
iAHTOH Jul 27, 2025
dfebb8b
Merge pull request #1265 from iAHTOH/patch-8
0xJacky Jul 27, 2025
85817f5
fix(backup): [s3] use secure depends on endpoint url #1266
0xJacky Jul 28, 2025
f29238f
feat(certificate): add new components for certificate management and …
0xJacky Jul 28, 2025
3a123cf
feat(notification): add test message API #1262
0xJacky Jul 28, 2025
8ad1f0c
feat: add name filtering to site and stream listing options
0xJacky Jul 28, 2025
bc4cab5
fix(nginx_log): use path instead of log_path
0xJacky Jul 28, 2025
c065c41
feat: add env group rendering and sync nodes preview #1268
0xJacky Jul 28, 2025
a95b2d7
fix(restore): get public key error #1272
0xJacky Jul 29, 2025
16aed0c
enhance(dns_credential): add provider and name filtering options
0xJacky Jul 29, 2025
152569a
feat(env_group): add upstream test type: local, remote, mirror
0xJacky Jul 29, 2025
27a6993
feat(BatchUpgrader): add development option to upgrade selection
0xJacky Jul 29, 2025
552cf5c
feat(upstream): add upstream cards and detail modal
0xJacky Jul 30, 2025
5cef941
refactor(crypto): remove timestamp check in GetPublicKey function #12…
0xJacky Jul 30, 2025
2d4deed
feat(config): add Name attribute to config assignment in EditConfig a…
0xJacky Jul 30, 2025
bf9a5da
chore: update deps
0xJacky Jul 30, 2025
cd05303
fix(config): update path handling #1278
0xJacky Aug 1, 2025
33adfc7
fix(router): proxy ws routes for environments and nginx detail status…
0xJacky Aug 1, 2025
8de49f7
feat(socket): implement formatSocketAddress function for IPv6 handling
0xJacky Aug 1, 2025
e48b678
chore: downgrade rolldown-vite
0xJacky Aug 2, 2025
7b0588c
fix(app): handle IPv6 addresses in socket formatting
0xJacky Aug 2, 2025
e510ae7
fix(directive): update Include directive handling
0xJacky Aug 2, 2025
38ee12f
feat: add EAB supports for ACME user register #1255
0xJacky Aug 2, 2025
e47fc25
feat: add support for IP address in AutoCert options #1208
0xJacky Aug 2, 2025
c5b9b44
feat(cert): implement early renewal logic for short-lived certificates
0xJacky Aug 2, 2025
ad9fa64
feat: add HTTP proxy support for tg notifications #1175
0xJacky Aug 3, 2025
5ea2087
feat(external_notify): add WeCom supports
0xJacky Aug 3, 2025
35ea887
chore: prepare v2.1.15
0xJacky Aug 3, 2025
aa785aa
fix: relativePath computation in config editor
0xJacky Aug 3, 2025
3d82ce5
chore(deps): update devdependency unplugin-auto-import to v20
renovate[bot] Aug 5, 2025
4d6acbb
Merge pull request #1293 from 0xJacky/renovate/unplugin-auto-import-20.x
0xJacky Aug 6, 2025
341caa3
chore(deps): update actions/download-artifact action to v5
renovate[bot] Aug 6, 2025
ada3bf1
Merge pull request #1294 from 0xJacky/renovate/major-github-artifact-…
0xJacky Aug 6, 2025
1130047
chore: update translations
0xJacky Aug 6, 2025
fb1d82f
feat(logging): add debug logging for process checks in nginx
0xJacky Aug 6, 2025
c5750cd
refactor(nginx): replace os.FindProcess with gopsutil for cross-platf…
0xJacky Aug 6, 2025
30db673
feat(self_check): add checks and fixes for conf.d directory existence
0xJacky Aug 6, 2025
3d17514
feat(notification): add error handling component
0xJacky Aug 6, 2025
fb179f4
fix(nginx_log): update log path handling #1292
0xJacky Aug 6, 2025
b69fe05
fix(websocket): replace websocket error handling with helper function
0xJacky Aug 6, 2025
876213a
chore: prepare v2.1.17
0xJacky Aug 6, 2025
924b600
chore(deps): update devdependency unplugin-vue-components to v29
renovate[bot] Aug 6, 2025
78a3580
Merge pull request #1297 from 0xJacky/renovate/unplugin-vue-component…
0xJacky Aug 6, 2025
658d09b
chore(deps): update devdependency @iconify/utils to v3
renovate[bot] Aug 6, 2025
a15ad68
fix(websocket): increase buffer size for websocket channels and impro…
0xJacky Aug 7, 2025
427896c
Merge pull request #1299 from 0xJacky/renovate/iconify-utils-3.x
0xJacky Aug 8, 2025
dd7dcf5
chore(deps): update all non-major dependencies (#1291)
renovate[bot] Aug 9, 2025
d4c3cce
chore: downgrade rolldown-vite to v7.0.11
0xJacky Aug 9, 2025
ff9d0c2
refactor(node-record): simplify retry logic and improve node status h…
0xJacky Aug 9, 2025
29e269f
chore(deps): update actions/checkout action to v5
renovate[bot] Aug 11, 2025
6c4849f
chore: update deps
0xJacky Aug 12, 2025
080ea59
enhance(certificate): add copy functionality and update auto cert states
0xJacky Aug 12, 2025
735fd11
Merge pull request #1305 from 0xJacky/renovate/actions-checkout-5.x
0xJacky Aug 12, 2025
8fc7f99
chore(deps): update all non-major dependencies
renovate[bot] Aug 12, 2025
3eed99a
fix(node): update max interval of 30s for retry
0xJacky Aug 12, 2025
27e5eb9
Merge pull request #1304 from 0xJacky/renovate/all-minor-patch
0xJacky Aug 12, 2025
261c766
refactor: rename env to node, env group to namespace
0xJacky Aug 13, 2025
ccad4d1
feat(namespace): implement namespace loading and filtering in Namespa…
0xJacky Aug 13, 2025
e697d2b
ci: build macos native
0xJacky Aug 13, 2025
a98b024
Merge pull request #1309 from 0xJacky/ci/build-macos-native
0xJacky Aug 13, 2025
3d31267
chore(deps): update all non-major dependencies
renovate[bot] Aug 13, 2025
3ffa80a
fix: migration issues
0xJacky Aug 13, 2025
8f053fa
Merge pull request #1308 from 0xJacky/renovate/all-minor-patch
0xJacky Aug 13, 2025
e2b66fd
feat(dashboard): add sites navigation #1054
0xJacky Aug 14, 2025
89046bf
Merge pull request #1310 from 0xJacky/feat/site-navigation
0xJacky Aug 14, 2025
691e513
chore(deps): update all non-major dependencies (#1313)
renovate[bot] Aug 19, 2025
a766bd2
fix: log index match access_log off incorrectly #1317
0xJacky Aug 19, 2025
0ff4a6e
refactor: nginx log with indexer parse and search
0xJacky Aug 16, 2025
fa18186
feat(nginx_log): add geo map
0xJacky Aug 19, 2025
72e1bd8
Merge pull request #1312 from 0xJacky/refactor/nginx-log
0xJacky Aug 20, 2025
e94f967
chore(deps): update all non-major dependencies
renovate[bot] Aug 20, 2025
ff0245f
Merge pull request #1319 from 0xJacky/renovate/all-minor-patch
0xJacky Aug 20, 2025
d83c4f7
perf(nginx-log): use optimized implementation
0xJacky Aug 20, 2025
4563c1f
perf(nginx-log): high-perf log search and indexing
0xJacky Aug 20, 2025
f44c44c
fix(kernel): stop parent's program when restart
0xJacky Aug 21, 2025
4d0ba38
chore: bug fixes
0xJacky Aug 21, 2025
13ee167
refactor(nginx-log): change time fields to Unix timestamps
0xJacky Aug 21, 2025
d9dd314
enhance(nginx-log): WorldMapChart with localized country names
0xJacky Aug 21, 2025
650fe79
enhance(nginx-log): improved line estimation for files
0xJacky Aug 21, 2025
fc968a3
refactor(nginx-log): optimized parser, indexer, searcher and analyzer
0xJacky Aug 22, 2025
03fbd9b
perf: introduced cache for user, site_config, node
0xJacky Aug 25, 2025
618ff5c
feat(nginx-log): hybrid progress calculation and dynamic estimation
0xJacky Aug 26, 2025
ac2ee3b
enhance(nginx-log): NginxLogList, HourlyChart for better data handling
0xJacky Aug 26, 2025
f2f5a08
feat: use config dir for Bleve index and ensure directory
0xJacky Aug 27, 2025
54313dd
fix(nginx_log): correct Total handling when merging facets
0xJacky Aug 27, 2025
0feb061
chore(deps): update all non-major dependencies
renovate[bot] Aug 28, 2025
2009a7c
Merge pull request #1326 from 0xJacky/renovate/all-minor-patch
0xJacky Aug 28, 2025
4b26a55
enhance: gracefully restart, logging, nginx_log analytics
0xJacky Aug 28, 2025
486add9
feat: 配置管理页面将文件夹和文件分开排序,默认以name字段,升序排序
liheji Aug 29, 2025
89fcba7
Merge pull request #1331 from liheji/dev
0xJacky Aug 29, 2025
869012a
feat(nginx_log): implement log group index deletion and add TabFilter…
0xJacky Aug 29, 2025
b34fa8e
enhance(nginx_log): indexing logic, UI feedback for log availability
0xJacky Aug 29, 2025
3335e60
feat(notification): add support for Ntfy (#1332)
liheji Aug 30, 2025
8d15d1f
enhance(nginx_log): indexing status management
0xJacky Aug 30, 2025
1f478a2
perf(nginx_log): improve indexer throughput
0xJacky Aug 31, 2025
9aa5a26
feat(nginx_log): add advanced indexing settings
0xJacky Aug 31, 2025
a56322d
chore: update docs
0xJacky Aug 31, 2025
8b45bb1
chore: prepare v2.2.0
0xJacky Aug 31, 2025
a982c04
enhance: llm and code completion
0xJacky Sep 1, 2025
becc175
chore(deps): update all non-major dependencies (#1334)
renovate[bot] Sep 1, 2025
c355cb8
feat: add llm sessions and update related logic
0xJacky Sep 2, 2025
7214bef
feat: enhance LLM functionality with nginx configuration context and …
0xJacky Sep 5, 2025
8af6dae
docs: dev translation guide (#1339)
0xJacky Sep 5, 2025
79c0570
chore(deps): update actions/setup-python action to v6 (#1340)
renovate[bot] Sep 5, 2025
e6b16f3
chore(deps): update actions/setup-node action to v5 (#1338)
renovate[bot] Sep 5, 2025
a591cc4
chore(deps): update actions/setup-go action to v6 (#1337)
renovate[bot] Sep 5, 2025
66ba546
feat: add OS context to LLM chat and enhance session management logic
0xJacky Sep 5, 2025
0c83303
feat: add useGlobalApp composable and integrate it into various compo…
0xJacky Sep 6, 2025
16a4f5c
chore: update translations and session tab logic
0xJacky Sep 6, 2025
e3ce9a9
feat(nginx_log): adaptive optimization and worker count adjustment
0xJacky Sep 6, 2025
29ff77a
fix: websocket readPump context handling
0xJacky Sep 6, 2025
1626c61
perf: optimize indexer config for multi-core systems
0xJacky Sep 6, 2025
b8cfd93
fix: logging middleware context
0xJacky Sep 11, 2025
b81a72c
refactor(nginx-log): integrated and optimized shard management
0xJacky Sep 14, 2025
0ac2f65
chore: update deps
0xJacky Sep 15, 2025
352a294
fix: adjust button positioning and improve padding in UpstreamCards
0xJacky Sep 15, 2025
4ec1a50
feat(nginx_log): inject indexer for precise document counting and enh…
0xJacky Sep 18, 2025
a182a81
fix: simplify context type definitions in AutoBackup and DNSCredentials
0xJacky Sep 18, 2025
69ddd24
chore(deps): update dependency uuid to v13 (#1348)
renovate[bot] Sep 18, 2025
e193089
chore(deps): update all non-major dependencies (#1349)
renovate[bot] Sep 18, 2025
2742aec
feat(nginx): add RefreshModulesCache endpoint #1333
0xJacky Sep 19, 2025
464caf5
fix: unable to rename file when modifying in "Manage Configs" #1330
0xJacky Sep 20, 2025
85eb6c9
refactor(nginx-log): add virtual scroll container #1355
0xJacky Sep 20, 2025
d82c603
chore: update deps
0xJacky Sep 22, 2025
8fc7d8a
feat(nginx_log): add advanced indexing status check and update view m…
0xJacky Sep 25, 2025
c141613
chore(deps): update all non-major dependencies (#1359)
renovate[bot] Sep 26, 2025
e04de29
chore: update deps
0xJacky Sep 26, 2025
e5c9153
chore(deps): update dependency macos to v15 (#1360)
renovate[bot] Sep 26, 2025
8839efd
chore(deps): update devdependency unplugin-vue-define-options to v3 (…
renovate[bot] Sep 26, 2025
4a5a433
chore(deps): update dependency vue-echarts to v8 (#1363)
renovate[bot] Sep 30, 2025
09bf16c
chore: update deps
0xJacky Oct 1, 2025
9124b33
feat(nginx_log): add basic log_list fallback when AdvancedIndexing is…
0xJacky Oct 1, 2025
641ce53
chore(deps): update all non-major dependencies (#1364)
renovate[bot] Oct 1, 2025
6567d92
feat(nginx_log): add index_path configuration for custom index storage
0xJacky Oct 1, 2025
eb4dc12
fix(nginx_log): initialize global log parser singleton in modern_serv…
0xJacky Oct 1, 2025
e26a4fa
fix: replace env_group_id with namespace_id in API endpoints and type…
0xJacky Oct 2, 2025
22e3c69
chore(deps): update dependencies and improve error handling
0xJacky Oct 2, 2025
ccedb94
chore: clean up codes
0xJacky Oct 3, 2025
de0467b
feat: allow disabling proxy targets availability test #1327
0xJacky Oct 3, 2025
e71293c
feat: add deploy_mode field to namespace and implement sandbox testin…
0xJacky Oct 4, 2025
29b83da
fix(restore): skipping symlinks outside allowed paths during restore …
0xJacky Oct 4, 2025
f967501
feat(geolite): implement GeoLite2 database download from cloud
0xJacky Oct 4, 2025
5b47ccf
feat(geolite): add GeoLite2 database checks and download functionalit…
0xJacky Oct 4, 2025
6de168c
refactor(upstream): remove init function and implement caching for di…
0xJacky Oct 5, 2025
372af98
fix(namespace-tabs): remove remoteNamespaces computed property and us…
0xJacky Oct 5, 2025
3930aaf
fix(cert): add ACMEUserID to the autoCert function #1372
0xJacky Oct 5, 2025
ae86ef7
fix(upstream): improve caching mechanism for disabled sockets and ens…
0xJacky Oct 5, 2025
35d6469
fix(SocketList): adjust columns settings #1377
0xJacky Oct 6, 2025
49623c2
feat(scanner): enhance scanning functionality with configurable optio…
0xJacky Oct 6, 2025
dc522de
fix: refine regex patterns for server directives (#1384)
LogicDX342 Oct 8, 2025
159c9d2
chore(deps): update github/codeql-action action to v4 (#1383)
renovate[bot] Oct 8, 2025
2457658
fix(backup): allow all paths when the allowed path is the root direct…
0xJacky Oct 8, 2025
e745614
chore(deps): update all non-major dependencies (#1385)
renovate[bot] Oct 8, 2025
9eb759d
fix: support Windows in execShell by replacing /bin/sh with cmd.exe (…
Alireza-Gholiei Oct 12, 2025
a6e1691
fix(template): use path.Join and rename param to avoid Windows embed …
Alireza-Gholiei Oct 16, 2025
acc1b98
chore(deps): update actions/setup-node action to v6 (#1393)
renovate[bot] Oct 16, 2025
1eb5ba1
chore(deps): update devdependency @antfu/eslint-config to v6 (#1395)
renovate[bot] Oct 16, 2025
37b0ee7
chore(deps): update all non-major dependencies (#1396)
renovate[bot] Oct 17, 2025
a6fbd2f
fix(user): remove password from context payload if nil
0xJacky Oct 17, 2025
55ee379
refactor(notification): rename DingTalk to Dingding and update relate…
0xJacky Oct 17, 2025
d256af5
chore: update deps
0xJacky Oct 17, 2025
0992192
chore(deps): update devdependency unplugin-vue-components to v30 (#1400)
renovate[bot] Oct 21, 2025
b26f40d
chore(deps): update all non-major dependencies (#1407)
renovate[bot] Oct 26, 2025
efca2bd
Added translation using Weblate (Thai)
weblate Oct 29, 2025
57cb295
Translated using Weblate (Thai)
weblate Oct 30, 2025
18378f7
chore(deps): update dependency @fingerprintjs/fingerprintjs to v5 (#1…
renovate[bot] Nov 5, 2025
fbda6a9
chore(deps): update vueuse monorepo to v14 (#1404)
renovate[bot] Nov 5, 2025
ad2d2f8
chore(deps): update github artifact actions (#1406)
renovate[bot] Nov 5, 2025
8942521
chore(deps): update devdependency @types/node to v24 (#1410)
renovate[bot] Nov 5, 2025
30379a4
Update link to nginx.conf in getting-started.md (#1424)
SuitDeer Nov 7, 2025
3111adf
chore: update deps
0xJacky Nov 7, 2025
c18ce54
chore(deps): update dependency marked to v17 (#1425)
renovate[bot] Nov 7, 2025
74bcb2e
chore(deps): update all non-major dependencies (#1409)
renovate[bot] Nov 7, 2025
55b17f0
chore: update deps
0xJacky Nov 7, 2025
d24d845
refactor: improved WebSocket handling
0xJacky Nov 9, 2025
cfb6cae
refactor: add config to disable site health check #1427, #1415, #1413
0xJacky Nov 9, 2025
9a62507
enhance(config-list): content filter #1413
0xJacky Nov 9, 2025
8396599
refactor: remove store initialization on mount and unmount
0xJacky Nov 9, 2025
bc0844a
enhance: config restore with mount point handling #1419
0xJacky Nov 10, 2025
c4bd485
enhance: upstream parser for variables #1402
0xJacky Nov 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ tmp_dir = "tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "CGO_ENABLED=1 go build -trimpath -tags=jsoniter,unembed -ldflags=\"-X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'\" -v -o ./tmp/main ."
cmd = "CGO_ENABLED=1 go build -tags=jsoniter,unembed,dev -ldflags=\"-X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'\" -v -o ./tmp/main ."
# Binary file yields from `cmd`.
bin = "tmp/main"
# Customize binary.
full_bin = "APP_ENV=dev APP_USER=air ./tmp/main"
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html", "toml", "po", "conf"]
# Ignore these filename extensions or directories.
exclude_dir = ["assets", "tmp", "vendor", "app/node_modules", "upload", "docs", "resources", ".idea", "cmd"]
exclude_dir = ["assets", "tmp", "vendor", "app/node_modules", "upload", "docs", "resources", ".idea", "cmd", ".go", "log-index"]
# Watch these directories if you specified.
include_dir = []
# Exclude files.
Expand Down
28 changes: 28 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"permissions": {
"allow": [
"Bash(pnpm typecheck:*)",
"Bash(pnpm lint:*)",
"Bash(npm run build:*)",
"Bash(go build:*)",
"Bash(npm run typecheck:*)",
"Bash(mkdir:*)",
"Bash(mv:*)",
"Bash(grep:*)",
"Bash(go test:*)",
"mcp__context7__resolve-library-id",
"mcp__context7__get-library-docs",
"Bash(find:*)",
"Bash(sed:*)",
"Bash(cp:*)",
"mcp__eslint__lint-files",
"Bash(go generate:*)",
"Bash(pnpm eslint:*)",
"Read(//workspaces/cosy/settings/**)",
"Bash(go doc:*)",
"Bash(pnpm exec eslint:*)",
"Bash(go:*)"
],
"deny": []
}
}
7 changes: 6 additions & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ services:
image: nginx-ui-dev
container_name: nginx-ui
volumes:
- ~/.ssh:/root/.ssh
- ../..:/workspaces:cached
- ./go-path:/root/go
- go-modules:/root/go
- ./data/nginx:/etc/nginx
- ./data/nginx-logs:/var/log/nginx
- /var/run/docker.sock:/var/run/docker.sock
command: sleep infinity
environment:
Expand Down Expand Up @@ -80,3 +82,6 @@ services:

networks:
nginxui:

volumes:
go-modules:
5 changes: 5 additions & 0 deletions .devcontainer/start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

# setup git for claude
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true

# install air
go install github.com/air-verse/air@latest

Expand Down
182 changes: 139 additions & 43 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ on:

jobs:
build_app:
runs-on: macos-14
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Set up nodejs
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: current

Expand All @@ -56,29 +56,44 @@ jobs:
corepack enable
corepack prepare pnpm@latest --activate
pnpm install
working-directory: app

- name: Check frontend code style
run: |
pnpm run lint
working-directory: app
pnpm lint

- name: Check frontend types
run: |
pnpm run typecheck
working-directory: app
pnpm typecheck

- name: Build
run: |
npx update-browserslist-db@latest
pnpm build
working-directory: app

- name: Compress frontend with xz
run: |
# Create compressed archive of the entire dist directory
tar -C app -cf - dist | xz -9 -c > app/dist.tar.xz

# Verify compression worked and show savings (macOS compatible)
ORIGINAL_SIZE=$(find app/dist -type f -exec stat -f%z {} \; | awk '{total += $1} END {print total}')
COMPRESSED_SIZE=$(stat -f%z app/dist.tar.xz)

if [[ $ORIGINAL_SIZE -gt 0 ]]; then
SAVINGS=$((100 - COMPRESSED_SIZE * 100 / ORIGINAL_SIZE))
echo "Original size: ${ORIGINAL_SIZE} bytes"
echo "Compressed size: ${COMPRESSED_SIZE} bytes"
echo "Compression savings: ${SAVINGS}%"
else
echo "Compressed size: ${COMPRESSED_SIZE} bytes"
fi

- name: Archive app artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: app-dist
path: app/dist
path: |
app/dist.tar.xz

- name: Prepare publish
if: github.event_name == 'release'
Expand All @@ -97,12 +112,12 @@ jobs:
needs: build_app
strategy:
matrix:
goos: [ linux, darwin, windows ]
goos: [ linux, windows ]
goarch: [ amd64, 386, arm64 ]
exclude:
# Exclude i386 on darwin.
- goarch: 386
goos: darwin
# exclude:
# Exclude i386 on windows (if needed)
# - goarch: 386
# goos: windows
include:
# BEGIN Linux ARM 5 6 7
- goos: linux
Expand Down Expand Up @@ -136,12 +151,12 @@ jobs:
GOARM: ${{ matrix.goarm }}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: ^1.24.5
go-version: ^1.25.4
cache: false

- name: Setup environment
Expand Down Expand Up @@ -179,10 +194,10 @@ jobs:
go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-

- name: Download app artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6
with:
name: app-dist
path: app/dist
path: app/dist.tar.xz

- name: Generate files
env:
Expand All @@ -206,17 +221,6 @@ jobs:
echo "CXX=${{ env.ARCH_NAME }}-linux-musl${{ env.ABI }}-g++" >> $GITHUB_ENV
echo "LD_FLAGS=-w --extldflags '-static'" >> $GITHUB_ENV

- name: Install darwin cross compiler
if: env.GOOS == 'darwin'
run: |
curl -L https://github.com/Hintay/crossosx/releases/latest/download/crossosx.tar.zst -o crossosx.tar.zst
tar xvaf crossosx.tar.zst
echo "LD_LIBRARY_PATH=$(pwd)/crossosx/lib/" >> $GITHUB_ENV
echo "PATH=$(pwd)/crossosx/bin/:$PATH" >> $GITHUB_ENV
echo "CC=${{ env.ARCH_NAME }}-clang" >> $GITHUB_ENV
echo "CXX=${{ env.ARCH_NAME }}-clang++" >> $GITHUB_ENV
echo "LD_FLAGS=-w" >> $GITHUB_ENV

- name: Setup for Windows
if: env.GOOS == 'windows'
run: |
Expand Down Expand Up @@ -257,7 +261,7 @@ jobs:
go build -trimpath -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'" -o dist/$BINARY_NAME -v main.go

- name: Archive backend artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: ${{ env.ARTIFACT }}
path: dist/${{ env.BINARY_NAME }}
Expand Down Expand Up @@ -295,21 +299,113 @@ jobs:
run: |
echo "Uploading ${{ env.DIST }}.tar.gz to R2..."
aws s3 cp ./${{ env.DIST }}.tar.gz s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }}

echo "Uploading ${{ env.DIST }}.tar.gz.digest to R2..."
aws s3 cp ./${{ env.DIST }}.tar.gz.digest s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz.digest --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }}


echo "Upload completed successfully"

build_macos_native:
runs-on: macos-latest
needs: build_app
strategy:
matrix:
goarch: [amd64, arm64]
env:
CGO_ENABLED: 1
GOOS: darwin
GOARCH: ${{ matrix.goarch }}
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ^1.25.4
cache: false

- name: Setup environment
id: info
run: |
export _NAME=$(jq ".darwin[\"$GOARCH\"].name" -r < .github/build/build_info.json)
export _ARTIFACT=nginx-ui-darwin-$GOARCH
export _BINARY=nginx-ui
echo "GOOS: darwin, GOARCH: $GOARCH, RELEASE_NAME: $_NAME, ARTIFACT_NAME: $_ARTIFACT, BINARY_NAME: $_BINARY"
echo "CACHE_NAME=$_NAME" >> $GITHUB_ENV
echo "DIST=nginx-ui-$_NAME" >> $GITHUB_ENV
echo "ARTIFACT=$_ARTIFACT" >> $GITHUB_ENV
echo "BINARY_NAME=$_BINARY" >> $GITHUB_ENV

- name: Setup Go build cache
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-${{ hashFiles('go.mod') }}
restore-keys: |
go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-

- name: Download app artifacts
uses: actions/download-artifact@v6
with:
name: app-dist
path: app/dist.tar.xz

- name: Generate files
run: go generate cmd/version/generate.go

- name: Build with native CGO
run: |
mkdir -p dist
go build -trimpath -tags=jsoniter -ldflags "-w -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'" -o dist/$BINARY_NAME -v main.go

- name: Archive backend artifacts
uses: actions/upload-artifact@v5
with:
name: ${{ env.ARTIFACT }}
path: dist/${{ env.BINARY_NAME }}

- name: Prepare publish
run: |
cp README*.md ./dist
cd dist && tar -zcvf ../${{ env.DIST }}.tar.gz .
cd ..
openssl dgst -sha512 ${{ env.DIST }}.tar.gz | sed 's/([^)]*)//g' | awk '{print $NF}' >> ${{ env.DIST }}.tar.gz.digest

- name: Publish
uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
files: |
${{ env.DIST }}.tar.gz
${{ env.DIST }}.tar.gz.digest

- name: Upload to R2 using S3 API
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/dev'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
run: |
echo "Uploading ${{ env.DIST }}.tar.gz to R2..."
aws s3 cp ./${{ env.DIST }}.tar.gz s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }}

echo "Uploading ${{ env.DIST }}.tar.gz.digest to R2..."
aws s3 cp ./${{ env.DIST }}.tar.gz.digest s3://nginx-ui-dev-build/${{ env.DIST }}.tar.gz.digest --endpoint-url=${{ secrets.R2_S3_API_ENDPOINT }}

echo "Upload completed successfully"

docker-build:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: build
needs: [build, build_macos_native]
env:
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Docker meta
id: meta
Expand All @@ -326,7 +422,7 @@ jobs:
type=raw,value=latest,enable=${{ github.event_name == 'release' && !github.event.release.prerelease }}

- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6
with:
path: ./dist

Expand Down Expand Up @@ -376,11 +472,11 @@ jobs:

update-homebrew:
runs-on: ubuntu-latest
needs: build
needs: [build, build_macos_native]
if: github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Get release info
id: release
Expand Down Expand Up @@ -505,7 +601,7 @@ jobs:
cat nginx-ui.rb

- name: Checkout homebrew-tools repository
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: 0xJacky/homebrew-tools
path: homebrew-tools
Expand Down Expand Up @@ -556,11 +652,11 @@ jobs:

publish-winget:
runs-on: windows-latest
needs: build
needs: [build, build_macos_native]
if: github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Publish to WinGet
uses: vedantmgoyal9/winget-releaser@v2
Expand Down
Loading