Compare commits

...
49 Commits
Author SHA1 Message Date
yisier 243ff1c692 release 2026-08-25 15:29:12 +08:00
yisier 585e10559e release 2026-08-25 14:08:54 +08:00
yisier 368f4e193b release 2026-08-25 13:49:33 +08:00
yisier d958b0c743 release 2026-08-25 11:57:55 +08:00
yisier fd1503eed5 release 2026-08-25 11:37:40 +08:00
yisier f10695b0bf release 2026-08-25 10:25:03 +08:00
yisier ae22bdbe32 release 2026-08-25 10:19:08 +08:00
yisier f7aba34d1e release 2026-08-25 10:17:55 +08:00
yisier c3e8950139 tcp_npcgui.go 2026-08-25 10:09:05 +08:00
yisier d0228eb2ce macos 2026-08-24 18:05:03 +08:00
yisier b8daf8c3b8 gui 重构, wails 升级到 3.0 2026-08-24 17:59:43 +08:00
yisier 9a6a1fff4c 客户端内网地址为 192.169.x.x 等非标准私网段时,Web 面板客户端列表不显示本机 IP 2026-08-24 13:49:36 +08:00
yisier 49865d57d9 Merge pull request #349 from OctoBored/fix/star-history-chart
修复 README 中 Star History 图表失效问题
2026-08-14 16:52:48 +08:00
OctoBored 1dd7c85876 修复 README 中 Star History 图表失效问题
Star History 图表因 GitHub 星标数据接口限制已无法正常显示,现切换到可正常工作的数据源,图表恢复可用。
2026-08-13 15:15:53 +00:00
yisier dd16ce6659 Web 面板languages.xml使用 NPS 版本号作为缓存标识 2026-08-09 15:27:47 +08:00
yisier 16381ce7e0 配置 allow_ports 后随机生成端口问题 2026-08-09 15:20:41 +08:00
yisier 3e9cccb86e 客户端、隧道、域名解析修改接口支持修改流量数据 2026-08-08 20:13:51 +08:00
yisier f91156a0cb NPC 安装到系统服务失败 BUG 2026-08-08 15:05:29 +08:00
yisier 7231be3944 解决客户端/服务端在线更新失败问题 2026-07-12 22:51:56 -06:00
yisier 1ebbee14a5 back tar.gz 2026-07-12 22:31:56 -06:00
yisier f2fe889a7c 将打包格式从 tar.gz 改为 zip 2026-07-12 22:17:54 -06:00
yisier e19af0a4d1 解决客户端建连失败后的半连接假死问题 2026-07-12 22:00:52 -06:00
yisier c62a3424bc 修复HTTP正向代理和SOCKS5认证问题 2026-07-12 21:31:06 -06:00
yisier 8508c9bd5e 解决私密代理和P2P连接的TLS启用问题 2026-07-12 19:37:53 -06:00
yisier 253c58f3c8 Web 管理端客户端/隧道/域名列表业务字段支持服务端排序(备注、状态、在线等) 2026-07-12 19:28:00 -06:00
yisier 0a096ffef4 解决握手过程中的连接超时和资源堆积问题 2026-07-12 19:05:52 -06:00
yisier b45dfe048e 新增客户端内网地址上报功能 2026-07-12 18:38:47 -06:00
yisier 3c848e5216 nps -server 安装成功后 web_port 未正常显示BUG 2026-07-12 18:20:19 -06:00
yisier 0d77cd92d5 管理界面完全从可执行文件内嵌资源加载 2026-07-12 18:04:09 -06:00
yisier b9642cc9c3 修复 Android 构建脚本中的 Fyne 工具安装路径 2026-07-04 23:50:26 -06:00
yisier c6a70c53a0 添加批量删除功能 2026-07-04 23:27:32 -06:00
yisier 70a50254d6 决 MIPS 架构运行时出现非法指令错误 2026-07-04 23:16:35 -06:00
yisier 8aacbc7bc5 解决新增编辑隧道时重复提交问题 2026-07-04 23:10:14 -06:00
yisier 67cefe1278 修复HTTP代理在SVN客户端无法正常检出的问题 2026-07-04 22:39:37 -06:00
yisier c972af584c doc 2026-06-08 15:33:12 -06:00
yisier 8e889710d7 Update README.md 2026-06-08 15:18:07 -06:00
yisier af6f9243ff md 2026-06-08 15:11:18 -06:00
yisier 9a56ea5d51 doc 2026-06-08 15:06:48 -06:00
yisier 173eeba97f md 2026-06-08 15:02:08 -06:00
yisier ca6371edb1 doc 2026-06-08 14:49:43 -06:00
yisier f57b2b7b34 doc 2026-06-08 00:29:40 -06:00
yisier e263b062c5 docs 2026-06-08 00:19:52 -06:00
yisier 29b064d65f docs 2026-06-08 00:18:04 -06:00
yisier bf6b762371 docs 2026-06-08 00:16:42 -06:00
yisier 2b5aefd1e8 doc 2026-06-08 00:11:12 -06:00
yisier 438d5084c9 doc 2026-06-07 23:46:21 -06:00
yisier e3ed556f0f doc 2026-06-07 22:35:49 -06:00
yisier cfb53ca703 doc 2026-06-07 11:04:50 -06:00
yisier 0afd382e6c doc 2026-06-07 11:03:11 -06:00
182 changed files with 8424 additions and 3826 deletions
+60
View File
@@ -0,0 +1,60 @@
name: Deploy Docs to GitHub Pages
on:
push:
branches: [master]
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# 并发:同一时刻只允许一次部署,新的提交会取消上一个未完成的运行
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # lastUpdated 需要完整 git 历史
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
working-directory: docs
run: npm install --legacy-peer-deps
- name: Build VuePress site
working-directory: docs
run: npm run docs:build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vuepress/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+59 -70
View File
@@ -1,6 +1,9 @@
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
@@ -9,7 +12,7 @@ permissions:
env:
GUI_DIR: cmd/npc/npc-gui
FRONTEND_DIR: cmd/npc/npc-gui/frontend
WAILS_VERSION: v2.11.0
WAILS_VERSION: v3.0.0-beta.12
APP_NAME: npc-gui
jobs:
@@ -37,7 +40,7 @@ jobs:
./build.assets.sh
- name: Upload
uses: softprops/action-gh-release@v2
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
with:
files: |
freebsd_386_client.tar.gz
@@ -92,7 +95,7 @@ jobs:
ls -la android_client.apk
- name: Upload
uses: softprops/action-gh-release@v2
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
with:
files: |
android_client.apk
@@ -171,36 +174,26 @@ jobs:
cache-dependency-path: ${{ env.FRONTEND_DIR }}/yarn.lock
- name: Enable Yarn (corepack)
run: corepack enable
- name: Install frontend dependencies
run: yarn install --frozen-lockfile
working-directory: ${{ env.FRONTEND_DIR }}
- name: Build frontend
run: yarn build
working-directory: ${{ env.FRONTEND_DIR }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GUI_DIR }}/go.mod
check-latest: true
- name: Install Wails CLI
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
run: go install github.com/wailsapp/wails/v3/cmd/wails3@${{ env.WAILS_VERSION }}
working-directory: ${{ env.GUI_DIR }}
- name: Build and package (Windows)
shell: pwsh
working-directory: ${{ env.GUI_DIR }}
run: |
$wails = Join-Path (go env GOPATH) "bin\wails.exe"
$tagArgs = @()
if ($env:WAILS_TAGS) { $tagArgs += @("-tags", $env:WAILS_TAGS) }
& $wails build -m -s -trimpath -skipbindings @tagArgs -platform ${{ matrix.platform }} -o "$env:APP_NAME.exe"
Set-Location build\bin
$env:GOOS = "windows"
$env:GOARCH = "${{ matrix.arch }}"
wails3 build --tags npcgui
Set-Location bin
$zipName = "$env:APP_NAME-${{ matrix.os_name }}-${{ matrix.arch }}.zip"
$exe = Get-ChildItem -Path . -Filter *.exe | Select-Object -First 1
if (-not $exe) {
$exe = Get-ChildItem -Path . -File | Select-Object -First 1
}
if (-not $exe) {
Write-Host "No build output found in build/bin"
Write-Host "No build output found in bin"
Get-ChildItem -Path . | Format-Table -AutoSize
exit 1
}
@@ -209,20 +202,30 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: windows-builds-${{ matrix.arch }}
path: ${{ env.GUI_DIR }}/build/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
path: ${{ env.GUI_DIR }}/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
- name: Upload Windows release asset
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
with:
files: ${{ env.GUI_DIR }}/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ==================== macOS GUI ====================
build_macos_gui:
runs-on: macos-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- platform: darwin/amd64
os_name: darwin
arch: amd64
os: macos-14
- platform: darwin/arm64
os_name: darwin
arch: arm64
os: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4
@@ -234,34 +237,33 @@ jobs:
cache-dependency-path: ${{ env.FRONTEND_DIR }}/yarn.lock
- name: Enable Yarn (corepack)
run: corepack enable
- name: Install frontend dependencies
run: yarn install --frozen-lockfile
working-directory: ${{ env.FRONTEND_DIR }}
- name: Build frontend
run: yarn build
working-directory: ${{ env.FRONTEND_DIR }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GUI_DIR }}/go.mod
check-latest: true
- name: Install Wails CLI
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
run: go install github.com/wailsapp/wails/v3/cmd/wails3@${{ env.WAILS_VERSION }}
working-directory: ${{ env.GUI_DIR }}
- name: Build and package (macOS)
shell: bash
working-directory: ${{ env.GUI_DIR }}
run: |
wails="$(go env GOPATH)/bin/wails"
tagArgs=()
if [ -n "$WAILS_TAGS" ]; then
tagArgs+=( -tags "$WAILS_TAGS" )
fi
"$wails" build -m -s -trimpath -skipbindings "${tagArgs[@]}" -platform "${{ matrix.platform }}" -o "$APP_NAME"
cd build/bin
app="$(ls -1d *.app 2>/dev/null | head -n 1)"
export GOOS=darwin
export GOARCH="${{ matrix.arch }}"
# wails3 package builds with EXTRA_TAGS=npcgui (Package has no --tags
# flag; the var flows into the build dep) and then assembles a proper
# bin/npc-gui.app bundle with ad-hoc codesign.
wails3 package EXTRA_TAGS=npcgui
cd bin
# Guard the .app lookups so a no-match does not abort the script
# under `set -e -o pipefail`; keep the raw-binary fallback as safety.
app="$(ls -1d *.app 2>/dev/null | head -n 1 || true)"
if [ -z "$app" ]; then
echo "No .app found in build/bin"
app="$(find . -maxdepth 1 -type f -perm -111 -exec basename {} \; | head -n 1 || true)"
fi
if [ -z "$app" ]; then
echo "No build output found in bin"
ls -la
exit 1
fi
@@ -270,13 +272,19 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: macos-builds-${{ matrix.arch }}
path: ${{ env.GUI_DIR }}/build/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
path: ${{ env.GUI_DIR }}/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
- name: Upload macOS release asset
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
with:
files: ${{ env.GUI_DIR }}/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ==================== Linux GUI ====================
build_linux_gui:
runs-on: ubuntu-latest
env:
WAILS_TAGS: webkit2_41
strategy:
matrix:
include:
@@ -289,7 +297,7 @@ jobs:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
sudo apt-get install -y build-essential libgtk-4-dev libwebkitgtk-6.0-dev libsoup-3.0-dev libjavascriptcoregtk-6.0-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config
- name: Set up Node.js
uses: actions/setup-node@v4
with:
@@ -298,34 +306,25 @@ jobs:
cache-dependency-path: ${{ env.FRONTEND_DIR }}/yarn.lock
- name: Enable Yarn (corepack)
run: corepack enable
- name: Install frontend dependencies
run: yarn install --frozen-lockfile
working-directory: ${{ env.FRONTEND_DIR }}
- name: Build frontend
run: yarn build
working-directory: ${{ env.FRONTEND_DIR }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.GUI_DIR }}/go.mod
check-latest: true
- name: Install Wails CLI
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
run: go install github.com/wailsapp/wails/v3/cmd/wails3@${{ env.WAILS_VERSION }}
working-directory: ${{ env.GUI_DIR }}
- name: Build and package (Linux)
shell: bash
working-directory: ${{ env.GUI_DIR }}
run: |
wails="$(go env GOPATH)/bin/wails"
tagArgs=()
if [ -n "$WAILS_TAGS" ]; then
tagArgs+=( -tags "$WAILS_TAGS" )
fi
"$wails" build -m -s -trimpath -skipbindings "${tagArgs[@]}" -platform "${{ matrix.platform }}" -o "$APP_NAME"
cd build/bin
export GOOS=linux
export GOARCH="${{ matrix.arch }}"
wails3 build --tags npcgui
cd bin
bin="$(find . -maxdepth 1 -type f -perm -111 -printf '%f\n' | head -n 1)"
if [ -z "$bin" ]; then
echo "No executable file found in build/bin"
echo "No executable file found in bin"
ls -la
exit 1
fi
@@ -334,22 +333,12 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: linux-builds-${{ matrix.arch }}
path: ${{ env.GUI_DIR }}/build/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
# ==================== GUI Release 上传 ====================
upload_gui_release:
runs-on: ubuntu-latest
needs: [build_windows_gui, build_macos_gui, build_linux_gui]
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
- name: Upload release assets
path: ${{ env.GUI_DIR }}/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
- name: Upload Linux release asset
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
with:
files: release-assets/**/*.zip
files: ${{ env.GUI_DIR }}/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+28 -1
View File
@@ -1,2 +1,29 @@
.idea
nps
nps
# Go build outputs
/npc
/nps.exe
/npc.exe
# Node.js / VuePress
node_modules/
yarn.lock
pnpm-lock.yaml
# VuePress build artifacts
docs/.vuepress/.cache/
docs/.vuepress/.temp/
docs/.vuepress/dist/
# VuePress dev runtime
docs/vuepress-dev.log
docs/vuepress-dev.err.log
docs/vuepress-dev.pid
docs/node_modules/
docs/yarn.lock
docs/.vscode
# OS
.DS_Store
Thumbs.db
+35 -35
View File
@@ -17,41 +17,41 @@ deploy:
token: ${GH_TOKEN}
cleanup: false
file:
- freebsd_386_client.tar.gz
- freebsd_386_server.tar.gz
- freebsd_amd64_client.tar.gz
- freebsd_amd64_server.tar.gz
- freebsd_arm_client.tar.gz
- freebsd_arm_server.tar.gz
- linux_386_client.tar.gz
- linux_386_server.tar.gz
- linux_amd64_client.tar.gz
- linux_amd64_server.tar.gz
- linux_arm64_client.tar.gz
- linux_arm64_server.tar.gz
- linux_arm_v5_client.tar.gz
- linux_arm_v6_client.tar.gz
- linux_arm_v7_client.tar.gz
- linux_arm_v5_server.tar.gz
- linux_arm_v6_server.tar.gz
- linux_arm_v7_server.tar.gz
- linux_mips64le_client.tar.gz
- linux_mips64le_server.tar.gz
- linux_mips64_client.tar.gz
- linux_mips64_server.tar.gz
- linux_mipsle_client.tar.gz
- linux_mipsle_server.tar.gz
- linux_mips_client.tar.gz
- linux_mips_server.tar.gz
- darwin_amd64_client.tar.gz
- darwin_amd64_server.tar.gz
- windows_386_client.tar.gz
- windows_386_server.tar.gz
- windows_amd64_client.tar.gz
- windows_amd64_server.tar.gz
- npc_syno.spk
- npc_sdk.tar.gz
- android_client.apk
- freebsd_386_client.tar.gz
- freebsd_386_server.tar.gz
- freebsd_amd64_client.tar.gz
- freebsd_amd64_server.tar.gz
- freebsd_arm_client.tar.gz
- freebsd_arm_server.tar.gz
- linux_386_client.tar.gz
- linux_386_server.tar.gz
- linux_amd64_client.tar.gz
- linux_amd64_server.tar.gz
- linux_arm64_client.tar.gz
- linux_arm64_server.tar.gz
- linux_arm_v5_client.tar.gz
- linux_arm_v6_client.tar.gz
- linux_arm_v7_client.tar.gz
- linux_arm_v5_server.tar.gz
- linux_arm_v6_server.tar.gz
- linux_arm_v7_server.tar.gz
- linux_mips64le_client.tar.gz
- linux_mips64le_server.tar.gz
- linux_mips64_client.tar.gz
- linux_mips64_server.tar.gz
- linux_mipsle_client.tar.gz
- linux_mipsle_server.tar.gz
- linux_mips_client.tar.gz
- linux_mips_server.tar.gz
- darwin_amd64_client.tar.gz
- darwin_amd64_server.tar.gz
- windows_386_client.tar.gz
- windows_386_server.tar.gz
- windows_amd64_client.tar.gz
- windows_amd64_server.tar.gz
- npc_syno.spk
- npc_sdk.tar.gz
- android_client.apk
on:
tags: true
all_branches: true
+54 -253
View File
@@ -1,274 +1,75 @@
# NPS
[新特性文档](https://dqg9t9eulqq.feishu.cn/wiki/FmVVwDcEGiTZxekYJl5ccuFanlg?from=from_copylink)
[原版文档](https://ehang.io/nps/documents)
# 说明
由于nps已经停更多年,存留了不少bug和未完善的功能。
此版本基于 nps 0.26.10的基础上二次开发而来。
### 交流
聊天灌水QQ群:619833483,热心群主可提供免费远程协助👍👍👍
![Version](https://img.shields.io/badge/version-v0.26.38-blue)
![License](https://img.shields.io/badge/license-GPL--3.0-green)
![Go](https://img.shields.io/badge/Go-%3E%3D1.22-00ADD8?logo=go)
***DockerHub***: [NPS](https://hub.docker.com/r/yisier1/nps) [NPC](https://hub.docker.com/r/yisier1/npc)
> 一款轻量级、高性能、功能强大的内网穿透代理服务器,基于 [ehang-io/nps](https://github.com/ehang-io/nps) 0.26.10 二次开发 —— 修复大量 bug,持续更新中。
> 💬 聊天灌水 QQ 群:**619833483**(热心群主可提供免费远程协助)
***宝塔面板***:[宝塔面板 Docker](docs/bt.md)
### 📖 在线文档
<small>[完整文档](https://yisier.github.io/nps) · [更新日志](https://yisier.github.io/nps/changelog/) · [程序安装](https://yisier.github.io/nps/install/#%E7%A8%8B%E5%BA%8F%E5%AE%89%E8%A3%85) · [宝塔面板](https://yisier.github.io/nps/install/#%E5%AE%9D%E5%A1%94%E9%9D%A2%E6%9D%BF-%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2) · [Docker安装](https://yisier.github.io/nps/install/#docker-%E5%AE%89%E8%A3%85)</small>
强烈推荐使用无配置文件模式启动客户端(删除掉npc.exe 目录下的`conf`文件夹即可),所有数据应该在服务端保存和配置,而客户端只做连接转发。客户端配置文件对小白极不友好,配置繁琐,容易出错。
0.26.21 版本后的客户端,无需再通过命令行方式启动、安装、卸载客户端,直接双击运行,按照提示输入指令即可完成,非常方便。
---
## 💰 赞助 / 推荐
#### ☁️ [雨云 — 国内便宜稳定的云服务器,首月 5 折](https://www.rainyun.com/MjY0MzY1_)
500M 带宽,高仿物理机,云服务器**15 元起**,通过此链接注册首月 5 折。
# 广告
[NPS云穿透](https://natnps.com/register?utm_from=MQ==),免费3M带宽,2条隧道;6.8元12M带宽,10条隧道;13.8元24M带宽,20条隧道。
雨云,500M带宽服务器;云服务器15元起,[专属连接,首月5折](https://www.rainyun.com/MjY0MzY1_)。
#### 🚀 [NATNPS 云穿透 — 免费 3M 带宽 / 2 条隧道](https://natnps.com/register?utm_from=MQ==)
无需自备服务器,注册即用。免费版 3M 带宽 2 条隧道;6.8 元 12M 带宽 10 条隧道;13.8 元 24M 带宽 20 条隧道。
# 快速上手
***服务端启动/安装:***`./npc(.exe) -server`
---
## 🚀 快速开始
![img.png](image/new/server.png)
### 下载
***客户端启动/安装:*** `./npc(.exe)`
从 [releases](https://github.com/yisier/nps/releases) 下载对应平台版本。服务端 `nps` 和客户端 `npc` 是独立的压缩包。
![image](image/new/cmd.png)
### 服务端
```shell
./nps -server # 交互菜单:安装/卸载/启动/停止/更新
```
首次启动自动生成 `conf/nps.conf`,随机生成 `web_password`、`auth_key`、`auth_crypt_key`,请从启动日志或 `nps.conf` 获取。
![img](https://raw.githubusercontent.com/yisier/nps/master/docs/.vuepress/public/image/new/server.png)
### 客户端
```shell
./npc # 直接双击运行,按提示输入即可
```
在 Web 后台复制【快捷启动命令】,客户端粘贴即可注册系统服务、启停或卸载。
![image](https://raw.githubusercontent.com/yisier/nps/master/docs/.vuepress/public/image/new/cmd.png)
# 更新日志
- 2026-06-04 v0.26.34
- 新增:
- `nps -server` 管理脚本欢迎语显示当前版本号,更新版本时比对版本,已是最新则直接退出,避免无谓覆盖 [#328](https://github.com/yisier/nps/issues/328)
- `npc` 管理脚本欢迎语显示当前版本号,新增 `[5] 更新客户端` 选项,更新并替换 npc 二进制
- 客户端新增到期时间字段,创建/修改客户端时可选填写,到期后自动暂停客户端 [#322](https://github.com/yisier/nps/issues/322)
- 修复:
- Dashboard IO 速率采集阻塞请求 500ms,改为后台采集缓存,消除 Sleep 等待
- ServerStatus 切片并发读写不安全,添加 RWMutex 保护
- flowSession goroutine 泄漏,改为仅在 StartNewServer 启动一次
- GetTunnel 双重遍历 sync.Map 性能问题,合并为单次 Range
- Bridge Client 字段并发读写不安全,添加 Mutex 保护
- TLS ClientHello recordLen 无上限,添加 16KB 限制防止内存耗尽
- SOCKS5 地址解析未检查 Read 返回值,改用 io.ReadFull
- 文件存储 panic 改为错误日志,defer 清理临时文件防止泄漏
- GenerateServerPort 可能无限循环,限制 1000 次重试
- P2P UDP 无超时永久阻塞,添加 30s ReadDeadline
- P2P goroutine 退出控制改用 context,修复潜在泄漏
- 客户端 UDP ReadFrom 错误后未退出,修复无效数据继续处理
- [#324](https://github.com/yisier/nps/issues/324) 隧道/域名解析/UDP 流量始终为 0
- muxPackager buffer pool 泄漏:UnPack() 错误路径未归还 windowBuff 导致内存持续增长
- bridge 客户端重连时旧 WORK_CHAN/WORK_FILE mux 未关闭,底层连接和 goroutine 永不释放
- pmux 连接超时泄漏:process() channel 发送超时后连接未关闭,且 ACCEPT_TIME_OUT 单位错误(10ns 应为 10s)
- pmux 关闭流程 panic:加 done channel + WaitGroup 保证 Close() 等所有 process() 退出后再 close conn channel;process() 入口设 ReadDeadline 防止阻塞读导致 wg.Wait() 死锁;PortListener 加 done channel 唤醒 Accept()
- 优化:ioutil.WriteFile → os.WriteFile、rand.Seed → rand.New 本地随机源
- 2026-05-23 v0.26.33
- 新增:
- 配置文件自动生成:启动时若 conf 目录或 nps.conf 不存在,自动创建并写入默认配置,方便 Docker 部署
- 首次启动默认 web_username/admin、web_password、auth_key、auth_crypt_key 均改为随机生成,并打印到终端,提升安全性
- Web 静态文件打包进可执行文件 + 静态文件 URL 加入版本号参数,升级后自动刷新缓存,部署无需单独拷贝 web 目录
- 精简发布包:去除打包时冗余的 conf/nps.conf、web 目录
- 清理失效配置项:移除 appname、runmode、https_default_cert_file、https_default_key_file、https_just_proxy
- 修复:
- [#184](https://github.com/yisier/nps/issues/184) 限速导致隧道中断:UpdateClient 在 RateLimit=0 时创建零速率令牌桶导致永久阻塞
- [#159](https://github.com/yisier/nps/issues/159) 关闭隧道端口仍可用:StopServer 错误时提前返回未更新状态 + 重复 OpenTask case 导致隧道被自动重启
- [#170](https://github.com/yisier/nps/issues/170) TCP 负载均衡只有一个后端可达:GetRandomTarget 未处理 \r 换行符和尾部空行
- [#319](https://github.com/yisier/nps/issues/319) 客户端列表不显示实时网速:NowRate 计算逻辑错误,改为统计每秒实际消耗字节数
- [#306](https://github.com/yisier/nps/issues/306) [#316](https://github.com/yisier/nps/issues/316) TCP Basic 认证与域名解析冲突:移除 TCP 隧道 Basic 认证探测,域名解析继续使用客户端 Basic 认证
#### 命令行直接启动
- 2026-03-27 v0.26.32
- 修复:
- 客户端注册参数未正确处理[快捷启动命令]和[TLS快捷启动命令] [#303](https://github.com/yisier/nps/issues/303)
- 修复https反向代理bug,感谢[okawao](https://github.com/okawao) 的 PR
- 2026-03-23 v0.26.31
- 新增:
- 域名解析记录开关功能 [#314](https://github.com/yisier/nps/issues/314)
- TCP隧道增加Basic认证 [306](https://github.com/yisier/nps/issues/306)
- 修复:
- 新增隧道出现secret mode keys must be unique [301](https://github.com/yisier/nps/issues/301)
```shell
npc -server=ip:8024 -vkey=xxx # 标准
npc -server=ip:8025 -vkey=xxx -tls_enable=true # TLS 桥接
npc -server=ip:8024 -vkey=vkey1,vkey2 # 多隧道
```
---
## ☕ 请作者喝杯咖啡
> 如果这个项目帮到了你,可以请作者喝杯咖啡 ☕ 感谢支持!
![微信/支付宝扫码赞赏](docs/.vuepress/public/image/payme.png)
- 2026-03-12 v0.26.30
修复:
- http 协议 websocket 错误,感谢[xiaozonglong](https://github.com/xiaozonglong) 提供的 home assistant 环境 ,[#268](https://github.com/yisier/nps/issues/268),[#296](https://github.com/yisier/nps/issues/296)
- 域名解析中,主机url点击无法跳转非80端口 [311](https://github.com/yisier/nps/issues/311)
- 新增的主机配置页面,客户端ID异常 [#310](https://github.com/yisier/nps/issues/310)
- 自动 HTTPS(301) 按照 `https_proxy_port` 配置的端口号跳转
- 2026-01-24 v0.26.29
新增:
GUI 客户端,基于 Wails 开发,[点击查看了解更多](https://github.com/yisier/nps/blob/master/cmd/npc/npc-gui/README.md),需要 WebView2 运行时,可通过两种方式添加客户端。
方式1:直接输入快捷启动命令即可
方式2:手动添加客户端,输入-server -vkey等参数
![img.png](image/new/gui.png)
修复:
Android 包未构建到 Release [72](https://github.com/yisier/nps/issues/72)
---
- 2025-12-06 v0.26.28
-【全局参数】页面新增`服务地址`配置项,用于客户端命令地址显示、隧道访问地址显示 [293](https://github.com/yisier/nps/issues/293)
-【IP授权功能优化】,通过穿透的端口去提交 IP 认证,感谢 [Aqamoe](https://github.com/Aqamoe) 的建议 [291](https://github.com/yisier/nps/issues/291)
-【重构限速器实现】提升性能和准确性
## 📈 Star History
[![Star History Chart](https://star-history.dera.page/svg?repos=yisier/nps&type=Date)](https://star-history.dera.page/#yisier/nps&Date)
- 2025-11-05 v0.26.27
新增:
- 1.客户端新增【IP白名单】,可通过两种方式添加IP:
- 方式1️⃣:在【客户端】新建/修改页面,配置IP授权密码,不在IP白名单的外网访问将被跳转到 IP 授权页面,输入正确的授权密码,即可完成添加 IP。
- 方式2️⃣:在【客户端】新建/修改页面,直接添加IP到白名单中。
![img.png](image/new/ip.png)
- 2.客户端配置移除【压缩】和【加密】功能,此功能会显著提高内存和CPU占用率,"利大于弊"。
- 3.客户端默认不再提供配置文件,***强烈推荐使用无配置文件模式启动客户端***
---
## 📃 License
- 2025-08-15 v0.26.26
修复:
- windows注册服务 使用tls无法连接 [269](https://github.com/yisier/nps/issues/269)
- 域名解析自动HTTPS逻辑bug [273](https://github.com/yisier/nps/issues/273)
- 2025-05-28 v0.26.25
新增:
- nps增加`nps(.exe) -server` 命令,用于管理NPS服务,安装和卸载服务在 Linux 下需要有 sudo 权限,Windows 下需要有管理员权限。
![img.png](image/new/server.png)
- 增加【TLS快捷启动命令】,可用于在tls模式下,快速启动客户端。 [257](https://github.com/yisier/nps/issues/257)
- 2025-04-16 v0.26.24
新增:
- 隧道支持复制功能,在隧道页面增加复制按钮,除了端口号为随机生成外,其他参数全部拷贝。[251](https://github.com/yisier/nps/issues/251)
修复:
- 私密代理连接时服务端会报错退出,[250](https://github.com/yisier/nps/issues/250)
- 2025-04-11 v0.26.23
新增:
- TCP 隧道支持 Proxy Protocol 协议来传递经过请求的真实 IP。![img.png](image/new/protocol.png)
修复:
- 客户端较多时,协程增长过快,感谢 [@huanglei288766](https://github.com/yisier/nps/pull/244) 的PR
- 2025-01-23 v0.26.22
优化:
- 客户端注册系统服务时,(新版客户端注册方式,非 install 命令) 将按照 `npc-[vkey].log` 格式保存日志,每个客户端VKEY单独一个日志文件,windows 日志位于 `npc.exe` 同级目录下,linux 位于 `/var/log/`目录。
- 域名模式,HTTPS证书支持上传文件和文件路径,系统将自动识别路径还是证书内容。 [#175](https://github.com/yisier/nps/issues/175)
修复:
- ipv6地址显示不全 [#237](https://github.com/yisier/nps/issues/237)
- 2025-01-07 v0.26.21
新增:
- 客户端列表页面新增【快捷启动命令】,此命令为连接地址+链接秘钥的base64编码,方便一键启动、一键安装客户端。
- 域名解析和隧道列表增加访问地址,可以点击隧道链接,直接网页打开。 [#234](https://github.com/yisier/nps/issues/234)
优化:
- 修改vkey生成方式,由16位缩短至10位,截取uuid前10位,避免重复。
- 优化客户端启动方式,当npc文件目录下无配置文件时,可直接双击运行客户端,输入命令完成启动、安装、卸载客户端,直接启动和安装服务时需要输入【快捷启动命令】,卸载服务、启动服务、停止服务时,只需输入隧道秘钥【vkey】即可。安装服务以 nps-client-vkey 方式命名 ,实现注册多个服务。
![image](image/new/cmd.png)
**注意**
强烈推荐使用无配置文件模式启动客户端,所有数据应该在服务端保存和配置,而客户端只做连接转发。客户端配置文件对小白极不友好,配置繁琐,容易出错。
- 2024-11-07 v0.26.20
新增:
- 客户端增加创建时间
修复:
- 客户端限速单位不统一 [#185](https://github.com/yisier/nps/issues/185)
- 增加从下拉选择客户端,隧道列表排序,新增编辑后不会刷新界面 [#183](https://github.com/yisier/nps/issues/183)
- 隧道数量限制无法统计域名映射 [#209](https://github.com/yisier/nps/issues/209)
- 2024-06-01 v0.26.19
- golang 版本升级到 1.22.
- 增加自动https,自动将http 重定向(301)到 https.
- 客户端命令行方式启动支持多个隧道ID,使用逗号拼接,示例:`npc -server=xxx:8024 -vkey=ytkpyr0er676m0r7,iwnbjfbvygvzyzzt` .
- 移除 nps.conf 参数 `https_just_proxy` , 调整 https 处理逻辑,如果上传了 https 证书,则由nps负责SSL (此方式可以获取真实IP),
否则走端口转发模式(使用本地证书,nps 获取不到真实IP), 如下图所示。
![image](image/new/https.png)
- 2024-02-27 v0.26.18
***新增***:nps.conf 新增 `tls_bridge_port=8025` 参数,当 `tls_enable=true` 时,nps 会监听8025端口,作为 tls 的连接端口。
客户端可以选择连接 tls 端口或者非 tls 端口: `npc.exe -server=xxx:8024 -vkey=xxx` 或 `npc.exe -server=xxx:8025 -vkey=xxx -tls_enable=true`
- 2024-01-31 v0.26.17
***说明***:考虑到 npc 历史版本客户端众多,版本号不同旧版本客户端无法连接,为了兼容,仓库版本号将继续沿用 0.26.xx
- 2024-01-02 v0.27.01 (已作废,功能移动到v0.26.17 版本)
***新增***:tls 流量加密,(客户端忽略证书校验,谨慎使用,客户端与服务端需要同时开启,或同时关闭),使用方式:
服务端:nps.conf `tls_enable=true`;
客户端:npc.conf `tls_enable=true` 或者 `npc.exe -server=xxx -vkey=xxx -tls_enable=true`
- 2023-06-01 v0.26.16
***修复***:https 流量不统计 Bug 修复。
***新增***:新增全局黑名单IP,用于防止被肉鸡扫描端口或被恶意攻击。
***新增***:新增客户端上次在线时间。
- 2023-02-24 v0.26.15
***修复***:更新程序 url 更改到当前仓库中
***修复***:nps 在外部路径启动时找不到配置文件
***新增***:增加 nps 启动参数,`-conf_path=D:\test\nps`,可用于加载指定nps配置文件和web文件目录。
***window 使用示例:***
直接启动:`nps.exe -conf_path=D:\test\nps`
安装:`nps.exe install -conf_path=D:\test\nps`
安装启动:`nps.exe start`
***linux 使用示例:***
直接启动:`./nps -conf_path=/app/nps`
安装:`./nps install -conf_path=/app/nps`
安装启动:`nps start -conf_path=/app/nps`
- 2022-12-30 v0.26.14
***修复***:API 鉴权漏洞修复
- 2022-12-19
***修复***:某些场景下丢包导致服务端意外退出
***优化***:新增隧道时,不指定服务端口时,将自动生成端口号
***优化***:API返回ID, `/client/add/, /index/addhost/,/index/add/ `
***优化***:域名解析、隧道页面,增加[唯一验证密钥],方便搜查
- 2022-10-30
***新增***:在管理面板中新增客户端时,可以配置多个黑名单IP,用于防止被肉鸡扫描端口或被恶意攻击。
***优化***:0.26.12 版本还原了注册系统功能,使用方式和以前一样。无论是否注册了系统服务,直接执行 nps 时只会读取当前目录下的配置文件。
- 2022-10-27
***新增***:在管理面板登录时开启验证码校验,开启方式:nps.conf `open_captcha=true`,感谢 [@dongFangTuring](https://github.com/dongFangTuring) 提供的PR
- 2022-10-24:
***修复***:HTTP协议支持WebSocket(稳定性待测试)
- 2022-10-21:
***修复***:HTTP协议下实时统计流量,能够精准的限制住流量(上下行对等)
***优化***:删除HTTP隧道时,客户端已用流量不再清空
- 2022-10-19:
***BUG***:在TCP协议下,流量统计有问题,只有当连接断开时才会统计流量。例如,限制客户端流量20m,当传输100m的文件时,也能传输成功。
***修复***:TCP协议下实时统计流量,能够精准的限制住流量(上下行对等)
***优化***:删除TCP隧道时,客户端已用流量不再清空
![image](image/new/tcp_limit.png)
- 2022-09-14:
修改NPS工作目录为当前可执行文件目录(即配置文件和nps可执行文件放在同一目录下,直接执行nps文件即可),去除注册系统服务,启动、停止、升级等命令
# 捐赠
![image](image/new/payCode.png)
GPL-3.0 License — 基于 [ehang-io/nps](https://github.com/ehang-io/nps) 0.26.10 二次开发。
+46 -6
View File
@@ -117,6 +117,37 @@ func (s *Bridge) StartTunnel() error {
return nil
}
// requestClientLocalAddr asks the client for private/LAN IPs on the main signal conn.
// New clients reply with WriteLenContent; old clients ignore the flag and we time out.
func (s *Bridge) requestClientLocalAddr(id int, c *conn.Conn) {
if c == nil || c.Conn == nil {
return
}
if _, err := c.Write([]byte(common.REPORT_LOCAL_IP)); err != nil {
return
}
_ = c.Conn.SetReadDeadline(time.Now().Add(2 * time.Second))
defer func() {
// clear deadline so health / later reads are not affected
_ = c.Conn.SetReadDeadline(time.Time{})
}()
b, err := c.GetShortLenContent()
if err != nil {
logs.Trace("clientId %d did not report local addr (old client or timeout): %v", id, err)
return
}
localAddr := strings.TrimSpace(string(b))
if localAddr == "" {
return
}
if client, err := file.GetDb().GetClient(id); err == nil {
client.Lock()
client.LocalAddr = localAddr
client.Unlock()
logs.Info("clientId %d local addr: %s", id, localAddr)
}
}
// get health information form client
func (s *Bridge) GetHealthFromClient(id int, c *conn.Conn) {
for {
@@ -185,6 +216,7 @@ func (s *Bridge) GetHealthFromClient(id int, c *conn.Conn) {
// 验证失败,返回错误验证flag,并且关闭连接
func (s *Bridge) verifyError(c *conn.Conn) {
c.Write([]byte(common.VERIFY_EER))
c.Close()
}
func (s *Bridge) verifySuccess(c *conn.Conn) {
@@ -192,16 +224,19 @@ func (s *Bridge) verifySuccess(c *conn.Conn) {
}
func (s *Bridge) cliProcess(c *conn.Conn) {
// 握手 10s 超时:扫描/半开连接不会一直占着 goroutine;成功后清掉
_ = c.SetReadDeadline(time.Now().Add(10 * time.Second))
//read test flag
if _, err := c.GetShortContent(3); err != nil {
logs.Info("The client %s connect error", c.Conn.RemoteAddr(), err.Error())
c.Close()
return
}
//version check
if b, err := c.GetShortLenContent(); err != nil || string(b) != version.GetVersion() {
//logs.Info("The client %s version does not match", c.Conn.RemoteAddr())
//c.Close()
//return
//version check(版本不匹配仍兼容放行;读失败则断开)
if _, err := c.GetShortLenContent(); err != nil {
c.Close()
return
}
//version get
var vs []byte
@@ -213,7 +248,7 @@ func (s *Bridge) cliProcess(c *conn.Conn) {
}
//write server version to client
c.Write([]byte(crypt.Md5(version.GetVersion())))
c.SetReadDeadlineBySecond(5)
_ = c.SetReadDeadline(time.Now().Add(10 * time.Second))
var buf []byte
//get vKey from client
if buf, err = c.GetShortContent(32); err != nil {
@@ -230,9 +265,12 @@ func (s *Bridge) cliProcess(c *conn.Conn) {
s.verifySuccess(c)
}
if flag, err := c.ReadFlag(); err == nil {
// 握手完成,交给 typeDeal 做长连接
_ = c.SetReadDeadline(time.Time{})
s.typeDeal(flag, c, id, string(vs))
} else {
logs.Warn(err, flag)
c.Close()
}
return
}
@@ -285,6 +323,8 @@ func (s *Bridge) typeDeal(typeVal string, c *conn.Conn, id int, vs string) {
oldSignal.WriteClose()
}
}
// Request private/LAN IPs from client. Old clients ignore the flag; short timeout keeps compatibility.
s.requestClientLocalAddr(id, c)
go s.GetHealthFromClient(id, c)
logs.Info("clientId %d connection succeeded, address:%s ", id, c.Conn.RemoteAddr())
case common.WORK_CHAN:
+1 -1
View File
@@ -18,7 +18,7 @@ export PATH="/usr/local/go/bin:$PATH"
export GOTOOLCHAIN=auto
go version
GO111MODULE=on go install fyne.io/fyne/v2/cmd/fyne@latest
GO111MODULE=on go install fyne.io/tools/cmd/fyne@latest
export PATH="$PATH:$(go env GOPATH)/bin"
#mkdir -p /go/src/fyne.io
#cd src/fyne.io
+25 -25
View File
@@ -8,79 +8,79 @@ tar -czvf npc_sdk.tar.gz npc_sdk.dll npc_sdk.so npc_sdk.h
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_amd64_client.tar.gz npc
tar -czvf linux_amd64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_386_client.tar.gz npc
tar -czvf linux_386_client.tar.gz npc
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf freebsd_386_client.tar.gz npc
tar -czvf freebsd_386_client.tar.gz npc
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf freebsd_amd64_client.tar.gz npc
tar -czvf freebsd_amd64_client.tar.gz npc
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf freebsd_arm_client.tar.gz npc
tar -czvf freebsd_arm_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm_v7_client.tar.gz npc
tar -czvf linux_arm_v7_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm_v6_client.tar.gz npc
tar -czvf linux_arm_v6_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm_v5_client.tar.gz npc
tar -czvf linux_arm_v5_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm64_client.tar.gz npc
tar -czvf linux_arm64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips64_client.tar.gz npc
tar -czvf linux_mips64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips64le_client.tar.gz npc
tar -czvf linux_mips64le_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mipsle_client.tar.gz npc
tar -czvf linux_mipsle_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips_client.tar.gz npc
tar -czvf linux_mips_client.tar.gz npc
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf windows_386_client.tar.gz npc.exe
tar -czvf windows_386_client.tar.gz npc.exe
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf windows_amd64_client.tar.gz npc.exe
tar -czvf windows_amd64_client.tar.gz npc.exe
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf darwin_amd64_client.tar.gz npc
tar -czvf darwin_amd64_client.tar.gz npc
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf darwin_arm64_client.tar.gz npc
tar -czvf darwin_arm64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
@@ -125,22 +125,22 @@ tar -czvf freebsd_amd64_server.tar.gz nps
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mips_server.tar.gz nps
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mips64_server.tar.gz nps
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mips64le_server.tar.gz nps
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mipsle_server.tar.gz nps
+26 -26
View File
@@ -1,5 +1,5 @@
#/bash/sh
export VERSION=0.26.33
export VERSION=0.26.38
export GOPROXY=direct
sudo apt-get update
@@ -13,71 +13,71 @@ tar -xvf upx-3.95-amd64_linux.tar.xz
cp upx-3.95-amd64_linux/upx ./
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_amd64_client.tar.gz npc
tar -czvf linux_amd64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_386_client.tar.gz npc
tar -czvf linux_386_client.tar.gz npc
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf freebsd_386_client.tar.gz npc
tar -czvf freebsd_386_client.tar.gz npc
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf freebsd_amd64_client.tar.gz npc
tar -czvf freebsd_amd64_client.tar.gz npc
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf freebsd_arm_client.tar.gz npc
tar -czvf freebsd_arm_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm_v7_client.tar.gz npc
tar -czvf linux_arm_v7_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm_v6_client.tar.gz npc
tar -czvf linux_arm_v6_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm_v5_client.tar.gz npc
tar -czvf linux_arm_v5_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_arm64_client.tar.gz npc
tar -czvf linux_arm64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips64le_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips64le_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mipsle_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mipsle_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf linux_mips_client.tar.gz npc
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf windows_386_client.tar.gz npc.exe
tar -czvf windows_386_client.tar.gz npc.exe
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf windows_amd64_client.tar.gz npc.exe
tar -czvf windows_amd64_client.tar.gz npc.exe
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf darwin_amd64_client.tar.gz npc
tar -czvf darwin_amd64_client.tar.gz npc
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
tar -czvf darwin_arm64_client.tar.gz npc
tar -czvf darwin_arm64_client.tar.gz npc
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
@@ -116,19 +116,19 @@ CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -st
tar -czvf freebsd_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mips_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mips64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le GOMIPS64=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mips64le_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
tar -czvf linux_mipsle_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
+41 -11
View File
@@ -34,7 +34,16 @@ type TRPClient struct {
cnf *config.Config
disconnectTime int
once sync.Once
logger *logs.BeeLogger // 每个客户端独立的 logger
closeCh chan struct{} // closed when client is shutting down; stops ping
logger Logger // 每客户端独立的 logger,未设置时使用全局 logger
}
// Logger 客户端日志接口,GUI / CLI 均可注入实现
type Logger interface {
Info(format string, v ...interface{})
Error(format string, v ...interface{})
Warn(format string, v ...interface{})
Trace(format string, v ...interface{})
}
// new client
@@ -48,12 +57,13 @@ func NewRPClient(svraddr string, vKey string, bridgeConnType string, proxyUrl st
cnf: cnf,
disconnectTime: disconnectTime,
once: sync.Once{},
closeCh: make(chan struct{}),
logger: nil, // 默认使用全局 logger,可通过 SetLogger 设置
}
}
// SetLogger 设置客户端的独立 logger
func (s *TRPClient) SetLogger(logger *logs.BeeLogger) {
func (s *TRPClient) SetLogger(logger Logger) {
s.logger = logger
}
@@ -134,6 +144,7 @@ retry:
// handle main connection
func (s *TRPClient) handleMain() {
mainLoop:
for {
flags, err := s.signal.ReadFlag()
if err != nil {
@@ -141,11 +152,19 @@ func (s *TRPClient) handleMain() {
break
}
switch flags {
case common.REPORT_LOCAL_IP:
// server requests private/LAN IPs (new nps); ignore failures so main loop continues
localIPs := common.GetLocalIPs(s.signal.Conn)
if err := s.signal.WriteLenContent([]byte(localIPs)); err != nil {
s.logWarn("report local ip failed: %s", err.Error())
} else {
s.logInfo("reported local addr: %s", localIPs)
}
case common.NEW_UDP_CONN:
//read server udp addr and password
if lAddr, err := s.signal.GetShortLenContent(); err != nil {
s.logWarn(err.Error())
return
break mainLoop
} else if pwd, err := s.signal.GetShortLenContent(); err == nil {
var localAddr string
//The local port remains unchanged for a certain period of time
@@ -153,7 +172,7 @@ func (s *TRPClient) handleMain() {
tmpConn, err := common.GetLocalUdpAddr()
if err != nil {
s.logError(err.Error())
return
break mainLoop
}
localAddr = tmpConn.LocalAddr().String()
} else {
@@ -203,7 +222,10 @@ func (s *TRPClient) newUdpConn(localAddr, rAddr string, md5Password string) {
func (s *TRPClient) newChan() {
tunnel, err := NewConn(s.bridgeConnType, s.vKey, s.svrAddr, common.WORK_CHAN, s.proxyUrl)
if err != nil {
s.logError("connect to %s error: %v", s.svrAddr, err)
// WORK_MAIN may already be up; without Close the client stays half-connected
// (handleMain blocks, outer reconnect loop never runs). See #115.
s.logError("connect to %s error: %v, client will reconnect", s.svrAddr, err)
s.Close()
return
}
s.tunnel = nps_mux.NewMux(tunnel.Conn, s.bridgeConnType, s.disconnectTime)
@@ -239,8 +261,9 @@ func (s *TRPClient) handleChan(src net.Conn) {
srcConn.Close()
targetConn.Close()
}()
br := bufio.NewReader(srcConn)
for {
if r, err := http.ReadRequest(bufio.NewReader(srcConn)); err != nil {
if r, err := http.ReadRequest(br); err != nil {
srcConn.Close()
targetConn.Close()
break
@@ -375,14 +398,18 @@ func (s *TRPClient) handleUdp(serverConn net.Conn) {
// Whether the monitor channel is closed
func (s *TRPClient) ping() {
s.ticker = time.NewTicker(time.Second * 5)
loop:
defer s.ticker.Stop()
for {
select {
case <-s.ticker.C:
// tunnel still nil: newChan failed or still connecting; if Close already ran, closeCh fires.
// tunnel established then closed: tear down so outer loop can reconnect.
if s.tunnel != nil && s.tunnel.IsClose() {
s.Close()
break loop
return
}
case <-s.closeCh:
return
}
}
}
@@ -394,13 +421,16 @@ func (s *TRPClient) Close() {
func (s *TRPClient) closing() {
CloseClient = true
NowStatus = 0
// unblock ping; safe: closing runs only once via once.Do
select {
case <-s.closeCh:
default:
close(s.closeCh)
}
if s.tunnel != nil {
_ = s.tunnel.Close()
}
if s.signal != nil {
_ = s.signal.Close()
}
if s.ticker != nil {
s.ticker.Stop()
}
}
+10 -1
View File
@@ -23,5 +23,14 @@ Thumbs.db
# 构建临时文件
*.tmp
build/windows/
*.syso
dist/
# wails3 构建输出
bin/
# wails3 task 缓存
.task/
# NSIS 打包产物(WebView2 bootstrapper / 安装器)
build/windows/nsis/*.exe
+99 -13
View File
@@ -1,4 +1,6 @@
# NPS 客户端 GUI (Wails 版本)
# NPS 客户端 GUI (Wails v3 版本)
基于 [Wails v3](https://v3.wails.io/)(beta)构建的 NPS 客户端图形界面。
## 快捷命令格式
@@ -17,25 +19,109 @@ nps:MyServer|127.0.0.1:8024|mykey123|false
bnBzOk15U2VydmVyfDEyNy4wLjAuMTo4MDI0fG15a2V5MTIzfGZhbHNl
```
## 安装与运行
## 前置要求
### 前置要求
- Go 1.21+
- Go 1.25+(wails v3 最低要求)
- Node.js 16+
- Yarn
- Wails v3 CLI(wails3)
### 开发模式
安装 Wails CLI:
```bash
cd npc-gui
# 安装依赖
yarn install
# 运行开发服务器
wails dev
go install github.com/wailsapp/wails/v3/cmd/wails3@v3.0.0-beta.12
```
## 启动 / 调试
### 开发模式(热重载)
```bash
cd cmd/npc/npc-gui
# 启动开发模式:自动执行前端依赖安装、bindings 生成、yarn build:dev、
# Go 编译并运行应用(无需手动 yarn build)
# Vite 端口默认为 9245,自定义端口用 -port(如 -port 34115)
wails3 dev
```
### 构建
```bash
cd cmd/npc/npc-gui
# 构建当前平台(前端构建 + bindings 生成 + Go 编译自动完成)
wails3 build --tags npcgui
```
产物输出到 `bin/` 目录(如 Windows 为 `bin/npc-gui.exe`)。
### 跨平台构建
通过 `GOOS`/`GOARCH` 环境变量指定目标平台:
```bash
# Windows amd64(在非 Windows 上需 Docker 镜像 wails-cross 支持 CGO 交叉编译)
GOOS=windows GOARCH=amd64 wails3 build --tags npcgui
# macOS
GOOS=darwin GOARCH=arm64 wails3 build --tags npcgui
# Linux(需要 libgtk-3-dev / libwebkit2gtk-4.1-dev)
GOOS=linux GOARCH=amd64 wails3 build --tags npcgui
```
### 打包安装包
```bash
# Windows NSIS 安装器(需要 makensis)
wails3 package
# 或指定安装范围(user = 免 UAC 按用户安装)
wails3 package INSTALL_SCOPE=user
```
### 手动生成前端绑定
Go 侧绑定方法签名变更后,重新生成前端 bindings:
```bash
cd cmd/npc/npc-gui
wails3 generate bindings
```
生成结果位于 `frontend/bindings/`。
### 常用任务
```bash
wails3 task --list # 列出所有 Taskfile 任务
wails3 task build # 等价于 wails3 build
wails3 task run # 运行已构建的产物
wails3 update build-assets # 刷新 build/ 目录构建资产
```
## 项目结构(v3)
```
cmd/npc/npc-gui/
├── Taskfile.yml # 根任务定义(APP_NAME、包管理器、端口)
├── main.go # 应用入口(application.New + 窗口 + 服务注册)
├── app_bindings.go # App 服务(前端可调用的绑定方法)
├── tray.go # 系统托盘(v3 内置 SystemTray)
├── build/
│ ├── config.yml # 应用信息、版本、dev 模式配置
│ ├── Taskfile.yml # 公共任务(前端安装/构建、bindings 生成、图标)
│ └── windows|darwin|linux/ # 各平台构建资产与打包模板
└── frontend/
├── bindings/ # wails3 generate bindings 生成(已提交)
├── src/App.vue # 主界面(import { App as AppAPI } from '../bindings/npc-gui/index.js')
└── dist/ # 前端构建产物(embed 进二进制)
```
## 构建标签
- `npcgui`:GUI 客户端构建必须传入(排除 `server/proxy/tcp.go` 中的服务端隧道实现,见 `server/proxy/tcp_npcgui.go` 占位实现)
## 配置存储
@@ -44,4 +130,4 @@ wails dev
- Linux: `~/.config/npc/npc_data.json`
- macOS: `~/Library/Application Support/npc/npc_data.json`
客户端日志默认保存在 `<配置目录>/npc/logs/`,可在设置中修改日志目录。
+37
View File
@@ -0,0 +1,37 @@
version: '3'
vars:
APP_NAME: "npc-gui"
BIN_DIR: "bin"
PACKAGE_MANAGER: "yarn"
VITE_PORT: '{{.WAILS_VITE_PORT | default 34115}}'
# Target OS for build/package/run. Defaults to the host OS, and is overridden
# by `wails3 build GOOS=...` (or the GOOS env var) for cross-compilation.
GOOS: '{{.GOOS | default OS}}'
includes:
common: ./build/Taskfile.yml
windows: ./build/windows/Taskfile.yml
darwin: ./build/darwin/Taskfile.yml
linux: ./build/linux/Taskfile.yml
tasks:
build:
summary: Builds the application
cmds:
- task: "{{.GOOS}}:build"
package:
summary: Packages a production build of the application
cmds:
- task: "{{.GOOS}}:package"
run:
summary: Runs the application
cmds:
- task: "{{.GOOS}}:run"
dev:
summary: Runs the application in development mode
cmds:
- wails3 dev -config ./build/config.yml -port {{.VITE_PORT}}
+67 -219
View File
@@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log/slog"
"os"
"path/filepath"
"strings"
@@ -14,13 +15,13 @@ import (
"ehang.io/nps/client"
"ehang.io/nps/lib/version"
_ "github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
"github.com/wailsapp/wails/v3/pkg/application"
)
type App struct {
ctx context.Context
app *application.App
window *application.WebviewWindow
tray *application.SystemTray
}
// ShortClient 与前端结构对应
@@ -49,33 +50,22 @@ var (
// 改为用 context 管理内置客户端,而不是外部进程
running = make(map[string]context.CancelFunc)
clients = make(map[string]*client.TRPClient)
clientErrors = make(map[string]string) // 存储客户端连接错误信息
clientConnected = make(map[string]bool) // 存储客户端连接状态 (true=connected)
clientAttempted = make(map[string]bool) // 存储客户端是否尝试过连接
clientLoggers = make(map[string]*logs.BeeLogger) // 为每个客户端单独管理 logger
statusMu sync.Mutex // 状态锁
clientErrors = make(map[string]string) // 存储客户端连接错误信息
clientConnected = make(map[string]bool) // 存储客户端连接状态 (true=connected)
clientAttempted = make(map[string]bool) // 存储客户端是否尝试过连接
statusMu sync.Mutex // 状态锁
runningMu sync.Mutex
loggerMu sync.Mutex // 保护 clientLoggers 的并发访问
disconnectTimeout = 60
connType = "tcp"
// 日志缓存机制,避免频繁读取文件
logsCacheMu sync.RWMutex
logsCache = make(map[string][]ConnectionLog) // 缓存:clientId -> logs
logsCacheTime = make(map[string]time.Time) // 缓存时间:clientId -> time
logsCacheTTL = 2 * time.Second // 缓存有效期 2 秒
)
func NewApp() *App { return &App{} }
func NewApp(app *application.App, window *application.WebviewWindow) *App {
return &App{app: app, window: window}
}
func (a *App) startup(ctx context.Context) {
// 保存 context,用于后续调用 runtime API
a.ctx = ctx
// 初始化日志系统,只使用 store logger(内存缓存)
// 每个客户端有自己独立的日志文件,不需要全局日志文件
logs.SetLogger("store")
logs.SetLevel(logs.LevelDebug)
func (a *App) ServiceStartup(ctx context.Context, options application.ServiceOptions) error {
// 初始化日志系统:应用日志走 slog,客户端日志走内存缓冲 + JSON 文件
initAppLogger()
// 同步开机启动状态:检查配置与实际注册表是否一致
go func() {
@@ -84,21 +74,32 @@ func (a *App) startup(ctx context.Context) {
actualEnabled := isStartupEnabled()
if store.Settings.StartupEnabled && !actualEnabled {
// 配置说启用,但实际未启用,则启用之
logs.Info("同步开机启动状态:启用")
slog.Info("同步开机启动状态:启用")
if err := enableStartup(); err != nil {
logs.Error("同步开机启动失败: %v", err)
slog.Error("同步开机启动失败", "err", err)
}
} else if !store.Settings.StartupEnabled && actualEnabled {
// 配置说禁用,但实际已启用,则禁用之
logs.Info("同步开机启动状态:禁用")
slog.Info("同步开机启动状态:禁用")
if err := disableStartup(); err != nil {
logs.Error("同步开机启动失败: %v", err)
slog.Error("同步开机启动失败", "err", err)
}
}
}
}()
go a.startTray()
a.startTray()
return nil
}
func (a *App) ServiceShutdown() error {
setQuitting()
closeAllLogStores()
if a.tray != nil {
a.tray.Destroy()
a.tray = nil
}
return nil
}
func getLogsPath() string {
@@ -137,53 +138,6 @@ func getClientLogFilePath(vkey string) string {
return filepath.Join(logsDir, fmt.Sprintf("npc-client-%s.log", vkey))
}
// initClientLogger 为客户端初始化独立的 logger
func initClientLogger(vkey string) {
loggerMu.Lock()
defer loggerMu.Unlock()
if _, exists := clientLoggers[vkey]; !exists {
// 为每个客户端创建独立的 BeeLogger
logger := logs.NewLogger()
// 设置为 Debug 级别,可以看到 Trace 日志
logger.SetLevel(logs.LevelDebug)
// 设置独立的日志文件
logFilePath := getClientLogFilePath(vkey)
// Windows 路径中的反斜杠需要转义
escapedPath := strings.ReplaceAll(logFilePath, "\\", "\\\\")
logger.SetLogger(logs.AdapterFile, `{"filename":"`+escapedPath+`","daily":true,"maxdays":7}`)
clientLoggers[vkey] = logger
}
}
// getClientLogger 获取客户端的 logger
func getClientLogger(id string) *logs.BeeLogger {
loggerMu.Lock()
defer loggerMu.Unlock()
return clientLoggers[id]
}
// closeClientLogger 关闭客户端的 logger
func closeClientLogger(id string) {
loggerMu.Lock()
defer loggerMu.Unlock()
if logger, exists := clientLoggers[id]; exists {
if logger != nil {
logger.Close()
}
delete(clientLoggers, id)
}
}
func (a *App) shutdown(ctx context.Context) {
setQuitting()
QuitTray()
wailsRuntime.Quit(a.ctx)
}
// 持久化文件结构(向后兼容旧的仅数组格式)
type GuiSettings struct {
StartupEnabled bool `json:"startupEnabled"`
@@ -338,16 +292,16 @@ func (a *App) SaveGuiSettings(s GuiSettings) error {
if oldStartupEnabled != s.StartupEnabled {
if s.StartupEnabled {
if err := enableStartup(); err != nil {
logs.Error("启用开机启动失败: %v", err)
slog.Error("启用开机启动失败", "err", err)
return fmt.Errorf("启用开机启动失败: %v", err)
}
logs.Info("已启用开机启动")
slog.Info("已启用开机启动")
} else {
if err := disableStartup(); err != nil {
logs.Error("禁用开机启动失败: %v", err)
slog.Error("禁用开机启动失败", "err", err)
return fmt.Errorf("禁用开机启动失败: %v", err)
}
logs.Info("已禁用开机启动")
slog.Info("已禁用开机启动")
}
}
@@ -387,7 +341,7 @@ func (a *App) GetDefaultLogDir() string {
// SelectDirectory 打开目录选择对话框
func (a *App) SelectDirectory() (string, error) {
logs.Info("SelectDirectory 被调用")
slog.Info("SelectDirectory 被调用")
// 获取当前设置的日志目录作为默认目录
defaultDir := ""
@@ -396,20 +350,23 @@ func (a *App) SelectDirectory() (string, error) {
defaultDir = store.Settings.LogDir
}
logs.Info("默认目录: %s", defaultDir)
slog.Info("默认目录", "dir", defaultDir)
// 打开目录选择对话框
selectedDir, err := wailsRuntime.OpenDirectoryDialog(a.ctx, wailsRuntime.OpenDialogOptions{
Title: "选择日志目录",
DefaultDirectory: defaultDir,
dialog := a.app.Dialog.OpenFileWithOptions(&application.OpenFileDialogOptions{
CanChooseDirectories: true,
CanChooseFiles: false,
Title: "选择日志目录",
Directory: defaultDir,
})
selectedDir, err := dialog.PromptForSingleSelection()
if err != nil {
logs.Error("打开目录选择对话框失败: %v", err)
slog.Error("打开目录选择对话框失败", "err", err)
return "", err
}
logs.Info("用户选择的目录: %s", selectedDir)
slog.Info("用户选择的目录", "dir", selectedDir)
return selectedDir, nil
}
@@ -563,13 +520,13 @@ func (a *App) RemoveShortcut(name, addr, key string) error {
func (a *App) ToggleClient(name, addr, key string, tls bool, runningState bool) error {
id := addr + "|" + key
logs.Info("ToggleClient called: name=%s, addr=%s, tls=%v, runningState=%v", name, addr, tls, runningState)
slog.Info("ToggleClient called", "name", name, "addr", addr, "tls", tls, "runningState", runningState)
runningMu.Lock()
defer runningMu.Unlock()
if runningState {
// start npc client in goroutine
if _, ok := running[id]; !ok {
logs.Info("Starting NPC client: %s", id)
slog.Info("Starting NPC client", "id", id)
ctx, cancel := context.WithCancel(context.Background())
running[id] = cancel
// 清除之前的状态
@@ -580,12 +537,12 @@ func (a *App) ToggleClient(name, addr, key string, tls bool, runningState bool)
statusMu.Unlock()
go startNpcClientWithContext(ctx, id, addr, key, tls)
} else {
logs.Info("Client already running: %s", id)
slog.Info("Client already running", "id", id)
}
} else {
// stop the client
if cancel, ok := running[id]; ok {
logs.Info("Stopping NPC client: %s", id)
slog.Info("Stopping NPC client", "id", id)
cancel()
delete(running, id)
// 清除状态
@@ -600,7 +557,7 @@ func (a *App) ToggleClient(name, addr, key string, tls bool, runningState bool)
delete(clients, id)
}
} else {
logs.Info("Client not running, nothing to stop: %s", id)
slog.Info("Client not running, nothing to stop", "id", id)
}
}
return nil
@@ -618,21 +575,17 @@ func startNpcClient(id, server, vkey string, tlsEnable bool) {
// startNpcClientWithContext 在给定的 context 中运行 npc 客户端
func startNpcClientWithContext(ctx context.Context, id, server, vkey string, tlsEnable bool) {
// 为该客户端初始化独立的日志文件
initClientLogger(id)
clientLogger := getClientLogger(id)
// 为该客户端准备日志存储(内存缓冲 + 独立日志文件)
store := getClientLogStore(id)
clientLogger := &trpcLogger{store: store}
client.SetTlsEnable(tlsEnable)
if clientLogger != nil {
clientLogger.Info("启动 NPC 客户端: server=%s, vkey=%s, tls=%v", server, vkey, tlsEnable)
}
clientLogger.Info("启动 NPC 客户端: server=%s, vkey=%s, tls=%v", server, vkey, tlsEnable)
for {
select {
case <-ctx.Done():
if clientLogger != nil {
clientLogger.Info("停止 NPC 客户端")
}
clientLogger.Info("停止 NPC 客户端")
statusMu.Lock()
delete(clientConnected, id)
delete(clientAttempted, id)
@@ -644,15 +597,11 @@ func startNpcClientWithContext(ctx context.Context, id, server, vkey string, tls
delete(clients, id)
}
runningMu.Unlock()
// 关闭客户端日志
closeClientLogger(id)
return
default:
}
if clientLogger != nil {
clientLogger.Info("连接服务器")
}
clientLogger.Info("连接服务器")
// 重置连接状态,准备新的连接尝试
statusMu.Lock()
@@ -662,9 +611,7 @@ func startNpcClientWithContext(ctx context.Context, id, server, vkey string, tls
rpcClient := client.NewRPClient(server, vkey, connType, "", nil, disconnectTimeout)
// 设置客户端的独立 logger
if clientLogger != nil {
rpcClient.SetLogger(clientLogger)
}
rpcClient.SetLogger(clientLogger)
// 将客户端保存到全局 map
runningMu.Lock()
@@ -678,9 +625,7 @@ func startNpcClientWithContext(ctx context.Context, id, server, vkey string, tls
go func() {
select {
case <-ctx.Done():
if clientLogger != nil {
clientLogger.Info("Context 已取消,关闭客户端")
}
clientLogger.Info("Context 已取消,关闭客户端")
rpcClient.Close()
}
}()
@@ -690,9 +635,7 @@ func startNpcClientWithContext(ctx context.Context, id, server, vkey string, tls
// 检查 context 是否已取消
select {
case <-ctx.Done():
if clientLogger != nil {
clientLogger.Info("停止 NPC 客户端")
}
clientLogger.Info("停止 NPC 客户端")
statusMu.Lock()
delete(clientConnected, id)
delete(clientAttempted, id)
@@ -704,8 +647,6 @@ func startNpcClientWithContext(ctx context.Context, id, server, vkey string, tls
delete(clients, id)
}
runningMu.Unlock()
// 关闭客户端日志
closeClientLogger(id)
return
case <-time.After(5 * time.Second):
// 继续重新连接
@@ -721,7 +662,7 @@ func monitorFirstConnection(ctx context.Context, id string, rpcClient *client.TR
initialTimeout := time.After(5 * time.Second)
connected := false
clientLogger := getClientLogger(id)
clientLogger := &trpcLogger{store: getClientLogStore(id)}
for {
select {
@@ -734,9 +675,7 @@ func monitorFirstConnection(ctx context.Context, id string, rpcClient *client.TR
clientConnected[id] = false
clientErrors[id] = "连接服务器失败,正在重新连接..."
statusMu.Unlock()
if clientLogger != nil {
clientLogger.Error("连接服务器失败 (timeout),将自动重连")
}
clientLogger.Error("连接服务器失败 (timeout),将自动重连")
}
// 即使超时,也继续监听连接状态变化
case <-ticker.C:
@@ -749,9 +688,7 @@ func monitorFirstConnection(ctx context.Context, id string, rpcClient *client.TR
clientConnected[id] = true
delete(clientErrors, id)
statusMu.Unlock()
if clientLogger != nil {
clientLogger.Info("客户端连接成功")
}
clientLogger.Info("客户端连接成功")
connected = true
}
} else {
@@ -761,9 +698,7 @@ func monitorFirstConnection(ctx context.Context, id string, rpcClient *client.TR
clientConnected[id] = false
clientErrors[id] = "连接已断开,正在重新连接..."
statusMu.Unlock()
if clientLogger != nil {
clientLogger.Warn("客户端连接已断开")
}
clientLogger.Warn("客户端连接已断开")
connected = false
}
}
@@ -771,101 +706,14 @@ func monitorFirstConnection(ctx context.Context, id string, rpcClient *client.TR
}
}
// GetConnectionLogs 获取指定客户端的连接日志(从独立日志文件读取)
// GetConnectionLogs 获取指定客户端的连接日志(直接读内存缓冲,无需解析文件)
func (a *App) GetConnectionLogs(clientId string) ([]ConnectionLog, error) {
// 检查缓存是否有效
logsCacheMu.RLock()
if cachedLogs, exists := logsCache[clientId]; exists {
if cacheTime, ok := logsCacheTime[clientId]; ok {
if time.Since(cacheTime) < logsCacheTTL {
// 缓存仍然有效
logsCacheMu.RUnlock()
return cachedLogs, nil
}
}
}
logsCacheMu.RUnlock()
// 缓存过期或不存在,重新读取日志
// 读取该客户端的独立日志文件
clientLogFile := getClientLogFilePath(clientId)
data, err := os.ReadFile(clientLogFile)
if err != nil {
// 如果文件不存在或读取失败,返回空日志
return []ConnectionLog{}, nil
}
logContent := string(data)
if logContent == "" {
return []ConnectionLog{}, nil
}
var result []ConnectionLog
lines := strings.Split(logContent, "\n")
for _, line := range lines {
line = strings.TrimSpace(line)
if line == "" {
continue
}
// 判断日志类型
logType := "info"
if strings.Contains(line, "[E]") {
logType = "error"
} else if strings.Contains(line, "[W]") {
logType = "warning"
} else if strings.Contains(line, "成功") || strings.Contains(line, "connected") || strings.Contains(line, "Success") {
logType = "success"
}
// 提取时间戳(日志格式通常是:2026-01-09 11:04:56 或 11:04:56)
var timestamp string
timeFields := strings.Fields(line)
if len(timeFields) >= 2 {
// 尝试获取前两个字段作为日期和时间
timestamp = timeFields[0] + " " + timeFields[1]
} else if len(timeFields) >= 1 {
timestamp = timeFields[0]
}
log := ConnectionLog{
Timestamp: timestamp,
Message: line,
Type: logType,
ClientId: clientId,
}
result = append(result, log)
}
// 更新缓存
logsCacheMu.Lock()
logsCache[clientId] = result
logsCacheTime[clientId] = time.Now()
logsCacheMu.Unlock()
return result, nil
return getClientLogStore(clientId).snapshot(), nil
}
// ClearConnectionLogs 清空指定客户端的连接日志文件
// ClearConnectionLogs 清空指定客户端的连接日志(内存缓冲与日志文件)
func (a *App) ClearConnectionLogs(clientId string) error {
// 获取日志文件路径
clientLogFile := getClientLogFilePath(clientId)
// 清空日志文件内容(写入空字符串)
if err := os.WriteFile(clientLogFile, []byte(""), 0o644); err != nil {
return err
}
// 清空缓存
logsCacheMu.Lock()
delete(logsCache, clientId)
delete(logsCacheTime, clientId)
logsCacheMu.Unlock()
return nil
return getClientLogStore(clientId).clear()
}
// getExecutablePath 获取当前可执行文件的完整路径
+398
View File
@@ -0,0 +1,398 @@
version: '3'
tasks:
go:mod:tidy:
summary: Runs `go mod tidy`
internal: true
# Universal/multi-arch builds invoke this concurrently from parallel deps;
# two `go mod tidy` processes racing on go.mod can corrupt it (#4637).
run: once
cmds:
- go mod tidy
install:frontend:deps:
summary: Install frontend dependencies
run: once
cmds:
- task: install:frontend:deps:{{.PACKAGE_MANAGER}}
install:frontend:deps:npm:
dir: frontend
sources:
- package.json
- package-lock.json
generates:
- node_modules
preconditions:
- sh: npm version
msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/"
cmds:
- npm install
install:frontend:deps:bun:
dir: frontend
sources:
- package.json
- bun.lock
- bun.lockb
generates:
- node_modules
preconditions:
- sh: bun --version
msg: "bun not found"
cmds:
- bun install
install:frontend:deps:pnpm:
dir: frontend
sources:
- package.json
- pnpm-lock.yaml
generates:
- node_modules
preconditions:
- sh: pnpm --version
msg: "pnpm not found"
cmds:
- pnpm install
install:frontend:deps:yarn:
dir: frontend
sources:
- package.json
- yarn.lock
status:
- test -d node_modules || test -f .pnp.cjs
preconditions:
- sh: yarn --version
msg: "yarn not found"
cmds:
- yarn install
build:frontend:
label: build:frontend (DEV={{.DEV}} RUNNER={{.PACKAGE_MANAGER}})
summary: Build the frontend project
# darwin:build:universal runs its per-arch builds as parallel deps, each of
# which depends on this task. Without run:once the two executions race:
# one regenerates frontend/bindings (-clean deletes it first) while the
# other's bundler is reading it, failing intermittently with
# 'Could not resolve "./bindings/<pkg>"' (#4637).
run: once
dir: frontend
sources:
- "**/*"
- exclude: node_modules/**/*
generates:
- dist/**/*
deps:
- task: install:frontend:deps
- task: generate:bindings
vars:
BUILD_FLAGS:
ref: .BUILD_FLAGS
OBFUSCATED:
ref: .OBFUSCATED
cmds:
- task: frontend:run
vars:
SCRIPT: '{{if eq .DEV "true"}}build:dev{{else}}build{{end}}'
env:
PRODUCTION: '{{if eq .DEV "true"}}false{{else}}true{{end}}'
frontend:run:
summary: Run a frontend script with selected runner
cmds:
- task: frontend:run:{{.PACKAGE_MANAGER}}
vars:
SCRIPT: "{{.SCRIPT}}"
vars:
SCRIPT: "{{.SCRIPT}}"
frontend:run:npm:
dir: frontend
cmds:
- npm run {{.SCRIPT}} -q
vars:
SCRIPT: "{{.SCRIPT}}"
frontend:run:yarn:
dir: frontend
cmds:
- yarn {{.SCRIPT}}
vars:
SCRIPT: "{{.SCRIPT}}"
frontend:run:pnpm:
dir: frontend
cmds:
- pnpm run {{.SCRIPT}}
vars:
SCRIPT: "{{.SCRIPT}}"
frontend:run:bun:
dir: frontend
cmds:
- bun run {{.SCRIPT}}
vars:
SCRIPT: "{{.SCRIPT}}"
frontend:vendor:puppertino:
summary: Fetches Puppertino CSS into frontend/public for consistent mobile styling
sources:
- frontend/public/puppertino/puppertino.css
generates:
- frontend/public/puppertino/puppertino.css
cmds:
- |
set -euo pipefail
mkdir -p frontend/public/puppertino
# If bundled Puppertino exists, prefer it. Otherwise, try to fetch, but don't fail build on error.
if [ ! -f frontend/public/puppertino/puppertino.css ]; then
echo "No bundled Puppertino found. Attempting to fetch from GitHub..."
if curl -fsSL https://raw.githubusercontent.com/codedgar/Puppertino/main/dist/css/full.css -o frontend/public/puppertino/puppertino.css; then
curl -fsSL https://raw.githubusercontent.com/codedgar/Puppertino/main/LICENSE -o frontend/public/puppertino/LICENSE || true
echo "Puppertino CSS downloaded to frontend/public/puppertino/puppertino.css"
else
echo "Warning: Could not fetch Puppertino CSS. Proceeding without download since template may bundle it."
fi
else
echo "Using bundled Puppertino at frontend/public/puppertino/puppertino.css"
fi
# Ensure index.html includes Puppertino CSS and button classes
INDEX_HTML=frontend/index.html
if [ -f "$INDEX_HTML" ]; then
if ! grep -q 'href="/puppertino/puppertino.css"' "$INDEX_HTML"; then
# Insert Puppertino link tag after style.css link
awk '
/href="\/style.css"\/?/ && !x { print; print " <link rel=\"stylesheet\" href=\"/puppertino/puppertino.css\"/>"; x=1; next }1
' "$INDEX_HTML" > "$INDEX_HTML.tmp" && mv "$INDEX_HTML.tmp" "$INDEX_HTML"
fi
# Replace default .btn with Puppertino primary button classes if present
sed -E -i'' 's/class=\"btn\"/class=\"p-btn p-prim-col\"/g' "$INDEX_HTML" || true
fi
generate:bindings:
summary: Generates bindings for the frontend
run: once
deps:
- task: go:mod:tidy
sources:
- "**/*.[jt]s"
- exclude: frontend/**/*
- frontend/bindings/**/* # Rerun when switching between dev/production mode causes changes in output
- "**/*.go"
- go.mod
- go.sum
generates:
- frontend/bindings/**/*
cmds:
- wails3 generate bindings -f '{{.BUILD_FLAGS}}' -clean=true -time-type=Date{{if eq .OBFUSCATED "true"}} -obfuscated{{end}}
generate:icons:
summary: Generates Windows `.ico` and Mac `.icns` from an image; on macOS, `-iconcomposerinput appicon.icon -macassetdir darwin` also produces `Assets.car` from a `.icon` file (skipped on other platforms).
run: once
dir: build
sources:
- "appicon.png"
- "appicon.icon"
generates:
- "darwin/icons.icns"
- "windows/icon.ico"
cmds:
- wails3 generate icons -input appicon.png -macfilename darwin/icons.icns -windowsfilename windows/icon.ico -iconcomposerinput appicon.icon -macassetdir darwin
dev:frontend:
summary: Runs the frontend in development mode
deps:
- task: install:frontend:deps
cmds:
- task: frontend:dev:{{.PACKAGE_MANAGER}}
frontend:dev:npm:
dir: frontend
cmds:
- npm run dev -- --port {{.VITE_PORT}} --strictPort
frontend:dev:yarn:
dir: frontend
cmds:
- yarn dev --port {{.VITE_PORT}} --strictPort
frontend:dev:pnpm:
dir: frontend
cmds:
- pnpm dev --port {{.VITE_PORT}} --strictPort
frontend:dev:bun:
dir: frontend
cmds:
- bun run dev --port {{.VITE_PORT}} --strictPort
update:build-assets:
summary: Updates the build assets
dir: build
cmds:
- wails3 update build-assets -name "{{.APP_NAME}}" -binaryname "{{.APP_NAME}}" -config config.yml -dir .
build:server:
summary: Builds the application in server mode (no GUI, HTTP server only)
desc: |
Builds a production server binary by default: -tags server,production,
-trimpath and a stripped binary, mirroring the desktop `build` task.
Server mode runs as a pure HTTP server without native GUI dependencies.
Usage: task build:server [DEV=true] [OBFUSCATED=true] [EXTRA_TAGS=tag1,tag2]
DEV=true development server (-tags server, no strip, inlining kept)
OBFUSCATED=true obfuscated build via garble (requires garble installed)
EXTRA_TAGS additional comma-separated build tags
deps:
- task: build:frontend
vars:
DEV:
ref: .DEV
BUILD_FLAGS:
ref: .BUILD_FLAGS
OBFUSCATED:
ref: .OBFUSCATED
preconditions:
- sh: '{{if eq .OBFUSCATED "true"}}command -v garble >/dev/null 2>&1{{else}}true{{end}}'
msg: "garble is required for obfuscated builds. Install it with: go install mvdan.cc/garble@v0.16.0 (requires Go 1.24+). See https://github.com/burrowers/garble/releases for version/toolchain compatibility."
cmds:
- '{{if eq .OBFUSCATED "true"}}garble {{.GARBLE_ARGS}} build{{else}}go build{{end}} {{.BUILD_FLAGS}} -o "{{.BIN_DIR}}/{{.APP_NAME}}-server{{exeExt}}"'
vars:
BUILD_FLAGS: '-tags server{{if eq .DEV "true"}}{{if eq .OBFUSCATED "true"}},wails_obfuscated{{end}}{{if .EXTRA_TAGS}},{{.EXTRA_TAGS}}{{end}} -buildvcs=false -gcflags=all="-l"{{else}},production{{if eq .OBFUSCATED "true"}},wails_obfuscated{{end}}{{if .EXTRA_TAGS}},{{.EXTRA_TAGS}}{{end}} -trimpath -buildvcs=false -ldflags="-w -s"{{end}}'
run:server:
summary: Builds and runs a development server (DEV=true)
deps:
- task: build:server
vars:
DEV: "true"
cmds:
- '"./{{.BIN_DIR}}/{{.APP_NAME}}-server{{exeExt}}"'
build:docker:
summary: Builds a Docker image for server mode deployment
desc: |
Creates a minimal Docker image containing the production server binary.
Defaults to a pure-Go static binary on a distroless/static base. The
production frontend is built first so the embedded assets are current.
Usage: task build:docker [TAG=myapp:latest] [CGO_ENABLED=1] [GO_IMAGE=...] [RUNTIME_IMAGE=...]
For CGO apps, set CGO_ENABLED=1 with libc-compatible builder/runtime images, e.g.:
task build:docker CGO_ENABLED=1 GO_IMAGE=golang:bookworm RUNTIME_IMAGE=gcr.io/distroless/base-debian12
deps:
# Build the production frontend so frontend/dist (embedded by the Go build
# inside the image) is present and current in the Docker build context.
# Pass the server,production tags so binding generation analyses the same
# build the Docker image compiles, not the default-tag build.
- task: build:frontend
vars:
BUILD_FLAGS: "-tags server,production"
cmds:
- >-
docker build
--build-arg CGO_ENABLED={{.CGO_ENABLED | default "0"}}
--build-arg GO_IMAGE={{.GO_IMAGE | default "golang:alpine"}}
--build-arg RUNTIME_IMAGE={{.RUNTIME_IMAGE | default "gcr.io/distroless/static-debian12"}}
-t {{.TAG | default (printf "%s:latest" .APP_NAME)}}
-f build/docker/Dockerfile.server .
vars:
TAG: "{{.TAG}}"
preconditions:
- sh: docker info > /dev/null 2>&1
msg: "Docker is required. Please install Docker first."
- sh: test -f build/docker/Dockerfile.server
msg: "Dockerfile.server not found. Run 'wails3 update build-assets' to generate it."
run:docker:
summary: Builds and runs the Docker image
desc: |
Builds the Docker image and runs it, exposing port 8080.
Usage: task run:docker [TAG=myapp:latest] [PORT=8080]
Note: The internal container port is always 8080. The PORT variable
only changes the host port mapping. Ensure your app uses port 8080
or modify the Dockerfile to match your ServerOptions.Port setting.
deps:
- task: build:docker
vars:
TAG:
ref: .TAG
cmds:
- docker run --rm -p {{.PORT | default "8080"}}:8080 {{.TAG | default (printf "%s:latest" .APP_NAME)}}
vars:
TAG: "{{.TAG}}"
PORT: "{{.PORT}}"
setup:docker:
summary: Builds Docker image for cross-compilation (~800MB download)
desc: |
Builds the Docker image needed for cross-compiling to any platform.
Run this once to enable cross-platform builds from any OS.
cmds:
- docker build -t wails-cross -f build/docker/Dockerfile.cross build/docker/
preconditions:
- sh: docker info > /dev/null 2>&1
msg: "Docker is required. Please install Docker first."
ios:device:list:
summary: Lists connected iOS devices (UDIDs)
cmds:
- xcrun xcdevice list
ios:run:device:
summary: Build, install, and launch on a physical iPhone using Apple tools (xcodebuild/devicectl)
vars:
PROJECT: '{{.PROJECT}}' # e.g., build/ios/xcode/<YourProject>.xcodeproj
SCHEME: '{{.SCHEME}}' # e.g., ios.dev
CONFIG: '{{.CONFIG | default "Debug"}}'
DERIVED: '{{.DERIVED | default "build/ios/DerivedData"}}'
UDID: '{{.UDID}}' # from `task ios:device:list`
BUNDLE_ID: '{{.BUNDLE_ID}}' # e.g., com.yourco.wails.ios.dev
TEAM_ID: '{{.TEAM_ID}}' # optional, if your project is not already set up for signing
preconditions:
- sh: xcrun -f xcodebuild
msg: "xcodebuild not found. Please install Xcode."
- sh: xcrun -f devicectl
msg: "devicectl not found. Please update to Xcode 15+ (which includes devicectl)."
- sh: test -n '{{.PROJECT}}'
msg: "Set PROJECT to your .xcodeproj path (e.g., PROJECT=build/ios/xcode/App.xcodeproj)."
- sh: test -n '{{.SCHEME}}'
msg: "Set SCHEME to your app scheme (e.g., SCHEME=ios.dev)."
- sh: test -n '{{.UDID}}'
msg: "Set UDID to your device UDID (see: task ios:device:list)."
- sh: test -n '{{.BUNDLE_ID}}'
msg: "Set BUNDLE_ID to your app's bundle identifier (e.g., com.yourco.wails.ios.dev)."
cmds:
- |
set -euo pipefail
echo "Building for device: UDID={{.UDID}} SCHEME={{.SCHEME}} PROJECT={{.PROJECT}}"
XCB_ARGS=(
-project "{{.PROJECT}}"
-scheme "{{.SCHEME}}"
-configuration "{{.CONFIG}}"
-destination "id={{.UDID}}"
-derivedDataPath "{{.DERIVED}}"
-allowProvisioningUpdates
-allowProvisioningDeviceRegistration
)
# Optionally inject signing identifiers if provided
if [ -n '{{.TEAM_ID}}' ]; then XCB_ARGS+=(DEVELOPMENT_TEAM={{.TEAM_ID}}); fi
if [ -n '{{.BUNDLE_ID}}' ]; then XCB_ARGS+=(PRODUCT_BUNDLE_IDENTIFIER={{.BUNDLE_ID}}); fi
xcodebuild "${XCB_ARGS[@]}" build | xcpretty || true
# If xcpretty isn't installed, run without it
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
xcodebuild "${XCB_ARGS[@]}" build
fi
# Find built .app
APP_PATH=$(find "{{.DERIVED}}/Build/Products" -type d -name "*.app" -maxdepth 3 | head -n 1)
if [ -z "$APP_PATH" ]; then
echo "Could not locate built .app under {{.DERIVED}}/Build/Products" >&2
exit 1
fi
echo "Installing: $APP_PATH"
xcrun devicectl device install app --device "{{.UDID}}" "$APP_PATH"
echo "Launching: {{.BUNDLE_ID}}"
xcrun devicectl device process launch --device "{{.UDID}}" --stderr console --stdout console "{{.BUNDLE_ID}}"
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 583 533" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-246,-251)">
<g id="Ebene1">
<path d="M246,251L265,784L401,784L506,450L507,450L505,784L641,784L829,251L682,251L596,567L595,567L596,251L478,251L378,568L391,251L246,251Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 698 B

@@ -0,0 +1,51 @@
{
"fill" : {
"automatic-gradient" : "extended-gray:1.00000,1.00000"
},
"groups" : [
{
"layers" : [
{
"fill-specializations" : [
{
"appearance" : "dark",
"value" : {
"solid" : "srgb:0.92143,0.92145,0.92144,1.00000"
}
},
{
"appearance" : "tinted",
"value" : {
"solid" : "srgb:0.83742,0.83744,0.83743,1.00000"
}
}
],
"image-name" : "wails_icon_vector.svg",
"name" : "wails_icon_vector",
"position" : {
"scale" : 0.85,
"translation-in-points" : [
0.0,
0.0
]
}
}
],
"shadow" : {
"kind" : "neutral",
"opacity" : 0.5
},
"specular" : true,
"translucency" : {
"enabled" : true,
"value" : 0.5
}
}
],
"supported-platforms" : {
"circles" : [
"watchOS"
],
"squares" : "shared"
}
}
+79
View File
@@ -0,0 +1,79 @@
# This file contains the configuration for this project.
# When you update `info` or `fileAssociations`, run `wails3 task common:update:build-assets` to update the assets.
# Note that this will overwrite any changes you have made to the assets.
version: '3'
# This information is used to generate the build assets.
info:
companyName: "My Company" # The name of the company
productName: "My Product" # The name of the application
productIdentifier: "com.mycompany.myproduct" # The unique product identifier
description: "A program that does X" # The application description
copyright: "(c) 2025, My Company" # Copyright text
comments: "Some Product Comments" # Comments
version: "0.0.1" # The application version
# cfBundleIconName: "appicon" # The macOS icon name in Assets.car icon bundles (optional)
# # Should match the name of your .icon file without the extension
# # If not set and Assets.car exists, defaults to "appicon"
# iOS build configuration (uncomment to customise iOS project generation)
# Note: Keys under `ios` OVERRIDE values under `info` when set.
# ios:
# # The iOS bundle identifier used in the generated Xcode project (CFBundleIdentifier)
# bundleID: "com.mycompany.myproduct"
# # The display name shown under the app icon (CFBundleDisplayName/CFBundleName)
# displayName: "My Product"
# # The app version to embed in Info.plist (CFBundleShortVersionString/CFBundleVersion)
# version: "0.0.1"
# # The company/organisation name for templates and project settings
# company: "My Company"
# # Additional comments to embed in Info.plist metadata
# comments: "Some Product Comments"
# Dev mode configuration
dev_mode:
root_path: .
log_level: warn
debounce: 1000
ignore:
dir:
- .git
- node_modules
- frontend
- bin
file:
- .DS_Store
- .gitignore
- .gitkeep
- "*_test.go"
watched_extension:
- "*.go"
- "*.js" # Watch for changes to JS/TS files included using the //wails:include directive.
- "*.ts" # The frontend directory will be excluded entirely by the setting above.
git_ignore: true
executes:
- cmd: wails3 build DEV=true
type: blocking
- cmd: wails3 task common:dev:frontend
type: background
- cmd: wails3 task run
type: primary
# File Associations
# More information at: https://v3.wails.io/noit/done/yet
fileAssociations:
# - ext: wails
# name: Wails
# description: Wails Application File
# iconName: wailsFileIcon
# role: Editor
# - ext: jpg
# name: JPEG
# description: Image File
# iconName: jpegFileIcon
# role: Editor
# mimeType: image/jpeg # (optional)
# Other data
other:
- name: My Other Data
Binary file not shown.
@@ -0,0 +1,34 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>NPS Client</string>
<key>CFBundleExecutable</key>
<string>npc-gui</string>
<key>CFBundleIdentifier</key>
<string>com.nps.client</string>
<key>CFBundleVersion</key>
<string>0.26.38</string>
<key>CFBundleGetInfoString</key>
<string>NPS 客户端</string>
<key>CFBundleShortVersionString</key>
<string>0.26.38</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>CFBundleIconName</key>
<string>appicon</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 NPS</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
</dict>
</plist>
+29
View File
@@ -0,0 +1,29 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleName</key>
<string>NPS Client</string>
<key>CFBundleExecutable</key>
<string>npc-gui</string>
<key>CFBundleIdentifier</key>
<string>com.nps.client</string>
<key>CFBundleVersion</key>
<string>0.26.38</string>
<key>CFBundleGetInfoString</key>
<string>NPS 客户端</string>
<key>CFBundleShortVersionString</key>
<string>0.26.38</string>
<key>CFBundleIconFile</key>
<string>icons</string>
<key>CFBundleIconName</key>
<string>appicon</string>
<key>LSMinimumSystemVersion</key>
<string>12.0.0</string>
<key>NSHighResolutionCapable</key>
<string>true</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2026 NPS</string>
</dict>
</plist>
+220
View File
@@ -0,0 +1,220 @@
version: '3'
includes:
common: ../Taskfile.yml
vars:
# Docker image for cross-compilation (used when building on non-macOS)
CROSS_IMAGE: wails-cross
tasks:
build:
summary: Builds the application
cmds:
- task: '{{if eq OS "darwin"}}build:native{{else}}build:docker{{end}}'
vars:
ARCH: '{{.ARCH}}'
DEV: '{{.DEV}}'
OUTPUT: '{{.OUTPUT}}'
EXTRA_TAGS: '{{.EXTRA_TAGS}}'
OBFUSCATED: '{{.OBFUSCATED}}'
GARBLE_ARGS: '{{.GARBLE_ARGS}}'
vars:
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
build:native:
summary: Builds the application natively on macOS
internal: true
deps:
- task: common:go:mod:tidy
- task: common:build:frontend
vars:
BUILD_FLAGS:
ref: .BUILD_FLAGS
OBFUSCATED:
ref: .OBFUSCATED
DEV:
ref: .DEV
- task: common:generate:icons
preconditions:
- sh: '{{if eq .OBFUSCATED "true"}}command -v garble >/dev/null 2>&1{{else}}true{{end}}'
msg: "garble is required for obfuscated builds. Install it with: go install mvdan.cc/garble@v0.16.0 (requires Go 1.24+). See https://github.com/burrowers/garble/releases for version/toolchain compatibility."
cmds:
- '{{if eq .OBFUSCATED "true"}}garble {{.GARBLE_ARGS}} build{{else}}go build{{end}} {{.BUILD_FLAGS}} -o "{{.OUTPUT}}"'
vars:
BUILD_FLAGS: '{{if eq .DEV "true"}}{{if or .EXTRA_TAGS (eq .OBFUSCATED "true")}}-tags {{if eq .OBFUSCATED "true"}}wails_obfuscated{{if .EXTRA_TAGS}},{{end}}{{end}}{{.EXTRA_TAGS}} {{end}}-buildvcs=false -gcflags=all="-l"{{else}}-tags production{{if eq .OBFUSCATED "true"}},wails_obfuscated{{end}}{{if .EXTRA_TAGS}},{{.EXTRA_TAGS}}{{end}} -trimpath -buildvcs=false -ldflags="-w -s"{{end}}'
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
env:
GOOS: darwin
CGO_ENABLED: 1
GOARCH: '{{.ARCH | default ARCH}}'
CGO_CFLAGS: "-mmacosx-version-min=12.0"
CGO_LDFLAGS: "-mmacosx-version-min=12.0"
MACOSX_DEPLOYMENT_TARGET: "12.0"
build:docker:
summary: Cross-compiles for macOS using Docker (for Linux/Windows hosts)
internal: true
deps:
- task: common:build:frontend
vars:
OBFUSCATED:
ref: .OBFUSCATED
- task: common:generate:icons
preconditions:
- sh: docker info > /dev/null 2>&1
msg: "Docker is required for cross-compilation. Please install Docker."
- sh: docker image inspect {{.CROSS_IMAGE}} > /dev/null 2>&1
msg: |
Docker image '{{.CROSS_IMAGE}}' not found.
Build it first: wails3 task setup:docker
cmds:
- docker run --rm -v "{{.ROOT_DIR}}:/app" {{.DOCKER_MOUNTS}} -e APP_NAME="{{.APP_NAME}}" {{if .EXTRA_TAGS}}-e EXTRA_TAGS="{{.EXTRA_TAGS}}"{{end}} {{if eq .OBFUSCATED "true"}}-e OBFUSCATED=true{{end}} {{if .GARBLE_ARGS}}-e GARBLE_ARGS="{{.GARBLE_ARGS}}"{{end}} {{.CROSS_IMAGE}} darwin {{.DOCKER_ARCH}}
- cmd: docker run --rm -v "{{.ROOT_DIR}}:/app" alpine chown -R $(id -u):$(id -g) /app/bin
platforms: [linux, darwin]
- mkdir -p {{.BIN_DIR}}
- mv "bin/{{.APP_NAME}}-darwin-{{.DOCKER_ARCH}}" "{{.OUTPUT}}"
vars:
DOCKER_ARCH: '{{if eq .ARCH "arm64"}}arm64{{else if eq .ARCH "amd64"}}amd64{{else}}arm64{{end}}'
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
# Generate Docker volume mounts: Go module cache + go.mod replace directives
# Uses wails3 tool docker-mounts for cross-platform compatibility (Windows/Linux/macOS)
DOCKER_MOUNTS:
sh: 'wails3 tool docker-mounts'
build:universal:
summary: Builds darwin universal binary (arm64 + amd64)
deps:
- task: build
vars:
ARCH: amd64
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-amd64"
- task: build
vars:
ARCH: arm64
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
cmds:
- task: '{{if eq OS "darwin"}}build:universal:lipo:native{{else}}build:universal:lipo:go{{end}}'
build:universal:lipo:native:
summary: Creates universal binary using native lipo (macOS)
internal: true
cmds:
- lipo -create -output "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
- rm "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
build:universal:lipo:go:
summary: Creates universal binary using wails3 tool lipo (Linux/Windows)
internal: true
cmds:
- wails3 tool lipo -output "{{.BIN_DIR}}/{{.APP_NAME}}" -input "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" -input "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
- rm -f "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
package:
summary: Packages the application into a `.app` bundle
deps:
- task: build
cmds:
- task: create:app:bundle
package:universal:
summary: Packages darwin universal binary (arm64 + amd64)
deps:
- task: build:universal
cmds:
- task: create:app:bundle
package:dmg:
summary: Packages the application into a styled `.dmg`
deps:
- task: package
cmds:
- task: create:dmg
create:dmg:
summary: Creates a configurable `.dmg` from the `.app` bundle
platforms: [darwin]
cmds:
- >-
wails3 tool package --format dmg --name "{{.APP_NAME}}" --out "{{.BIN_DIR}}"
--background "{{.DMG_BACKGROUND}}"
--volume-icon "{{.DMG_VOLUME_ICON}}"
--file-icon "{{.DMG_FILE_ICON}}"
--window-width "{{.DMG_WINDOW_WIDTH}}"
--window-height "{{.DMG_WINDOW_HEIGHT}}"
{{if .DMG_FILES}}--files "{{.DMG_FILES}}"{{end}}
vars:
DMG_BACKGROUND: '{{.DMG_BACKGROUND | default "build/darwin/dmg-background.png"}}'
DMG_VOLUME_ICON: '{{.DMG_VOLUME_ICON | default "build/darwin/icons.icns"}}'
DMG_FILE_ICON: '{{.DMG_FILE_ICON | default "build/darwin/dmg-file-icon.icns"}}'
DMG_WINDOW_WIDTH: '{{.DMG_WINDOW_WIDTH | default "540"}}'
DMG_WINDOW_HEIGHT: '{{.DMG_WINDOW_HEIGHT | default "380"}}'
DMG_FILES: '{{.DMG_FILES | default ""}}'
create:app:bundle:
summary: Creates an `.app` bundle
cmds:
- mkdir -p "{{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS"
- mkdir -p "{{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources"
- cp build/darwin/icons.icns "{{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources"
- |
if [ -f build/darwin/Assets.car ]; then
cp build/darwin/Assets.car "{{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources"
fi
- cp "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS"
- cp build/darwin/Info.plist "{{.BIN_DIR}}/{{.APP_NAME}}.app/Contents"
- task: '{{if eq OS "darwin"}}codesign:adhoc{{else}}codesign:skip{{end}}'
codesign:adhoc:
summary: Ad-hoc signs the app bundle (macOS only)
internal: true
cmds:
- codesign --force --deep --sign - "{{.BIN_DIR}}/{{.APP_NAME}}.app"
codesign:skip:
summary: Skips codesigning when cross-compiling
internal: true
cmds:
- 'echo "Skipping codesign (not available on {{OS}}). Sign the .app on macOS before distribution."'
run:
cmds:
- mkdir -p "{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS"
- mkdir -p "{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Resources"
- cp build/darwin/icons.icns "{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Resources"
- |
if [ -f build/darwin/Assets.car ]; then
cp build/darwin/Assets.car "{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Resources"
fi
- cp "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS"
- cp "build/darwin/Info.dev.plist" "{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Info.plist"
- codesign --force --deep --sign - "{{.BIN_DIR}}/{{.APP_NAME}}.dev.app"
- '"{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS/{{.APP_NAME}}"'
sign:
summary: Signs the application bundle with Developer ID
desc: |
Signs the .app bundle for distribution.
Uses signing identity from `wails3 setup` (stored in ~/.config/wails/defaults.yaml).
Override with: task darwin:sign -- --identity "Developer ID Application: ..."
deps:
- task: package
cmds:
- wails3 tool sign --input "{{.BIN_DIR}}/{{.APP_NAME}}.app" {{.CLI_ARGS}}
sign:notarize:
summary: Signs and notarizes the application bundle
desc: |
Signs the .app bundle and submits it for notarization.
Uses signing identity and keychain profile from `wails3 setup`.
First-time setup:
wails3 setup
deps:
- task: package
cmds:
- wails3 tool sign --input "{{.BIN_DIR}}/{{.APP_NAME}}.app" --notarize {{.CLI_ARGS}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.
@@ -0,0 +1,225 @@
# Cross-compile Wails v3 apps to any platform
#
# Darwin: Zig + macOS SDK
# Linux: Native GCC when host matches target, Zig for cross-arch
# Windows: Zig + bundled mingw
#
# Usage:
# docker build -t wails-cross -f Dockerfile.cross .
# docker run --rm -v $(pwd):/app wails-cross darwin arm64
# docker run --rm -v $(pwd):/app wails-cross darwin amd64
# docker run --rm -v $(pwd):/app wails-cross linux amd64
# docker run --rm -v $(pwd):/app wails-cross linux arm64
# docker run --rm -v $(pwd):/app wails-cross windows amd64
# docker run --rm -v $(pwd):/app wails-cross windows arm64
# Debian 13 provides the GTK >= 4.14 API baseline used by the default Linux backend.
FROM golang:1.26-trixie
ARG TARGETARCH
ARG GARBLE_VERSION=v0.16.0
# Install base tools, GCC, and GTK/WebKit dev packages
RUN apt-get update && apt-get install -y --no-install-recommends \
curl xz-utils python3 nodejs npm pkg-config gcc libc6-dev \
libgtk-3-dev libwebkit2gtk-4.1-dev \
libgtk-4-dev libwebkitgtk-6.0-dev \
&& pkg-config --atleast-version=4.14 gtk4 \
&& pkg-config --exists webkitgtk-6.0 \
&& pkg-config --exists gtk+-3.0 \
&& pkg-config --exists webkit2gtk-4.1 \
&& rm -rf /var/lib/apt/lists/*
RUN go install mvdan.cc/garble@${GARBLE_VERSION}
# Install Zig - automatically selects correct binary for host architecture.
# The SHA-256 is fetched from Zig's official download manifest and verified
# before extraction to protect against MITM or corrupted downloads.
ARG ZIG_VERSION=0.14.0
RUN ZIG_ARCH=$(case "${TARGETARCH}" in arm64) echo "aarch64" ;; *) echo "x86_64" ;; esac) && \
ZIG_FILE="zig-linux-${ZIG_ARCH}-${ZIG_VERSION}.tar.xz" && \
curl -fSL "https://ziglang.org/download/${ZIG_VERSION}/${ZIG_FILE}" -o "/tmp/${ZIG_FILE}" && \
EXPECTED=$(curl -fsSL "https://ziglang.org/download/index.json" | \
python3 -c "import json,sys; d=json.load(sys.stdin); print(d[sys.argv[1]][sys.argv[2]+'-linux']['shasum'])" \
"${ZIG_VERSION}" "${ZIG_ARCH}") && \
echo "${EXPECTED} /tmp/${ZIG_FILE}" | sha256sum -c - && \
tar -xJ -f "/tmp/${ZIG_FILE}" -C /opt && \
rm "/tmp/${ZIG_FILE}" && \
ln -s /opt/zig-linux-${ZIG_ARCH}-${ZIG_VERSION}/zig /usr/local/bin/zig
# Download macOS SDK (required for darwin targets)
ARG MACOS_SDK_VERSION=14.5
RUN curl -L "https://github.com/joseluisq/macosx-sdks/releases/download/${MACOS_SDK_VERSION}/MacOSX${MACOS_SDK_VERSION}.sdk.tar.xz" \
| tar -xJ -C /opt \
&& mv /opt/MacOSX${MACOS_SDK_VERSION}.sdk /opt/macos-sdk
ENV MACOS_SDK_PATH=/opt/macos-sdk
# Create Zig CC wrappers for cross-compilation targets
# Darwin and Windows use Zig; Linux uses native GCC (run with --platform for cross-arch)
# Darwin arm64
COPY <<'ZIGWRAP' /usr/local/bin/zcc-darwin-arm64
#!/bin/sh
ARGS=""
SKIP_NEXT=0
for arg in "$@"; do
if [ $SKIP_NEXT -eq 1 ]; then
SKIP_NEXT=0
continue
fi
case "$arg" in
-target) SKIP_NEXT=1 ;;
-mmacosx-version-min=*) ;;
*) ARGS="$ARGS $arg" ;;
esac
done
exec zig cc -fno-sanitize=all -target aarch64-macos-none -isysroot /opt/macos-sdk -I/opt/macos-sdk/usr/include -L/opt/macos-sdk/usr/lib -F/opt/macos-sdk/System/Library/Frameworks -w $ARGS
ZIGWRAP
RUN chmod +x /usr/local/bin/zcc-darwin-arm64
# Darwin amd64
COPY <<'ZIGWRAP' /usr/local/bin/zcc-darwin-amd64
#!/bin/sh
ARGS=""
SKIP_NEXT=0
for arg in "$@"; do
if [ $SKIP_NEXT -eq 1 ]; then
SKIP_NEXT=0
continue
fi
case "$arg" in
-target) SKIP_NEXT=1 ;;
-mmacosx-version-min=*) ;;
*) ARGS="$ARGS $arg" ;;
esac
done
exec zig cc -fno-sanitize=all -target x86_64-macos-none -isysroot /opt/macos-sdk -I/opt/macos-sdk/usr/include -L/opt/macos-sdk/usr/lib -F/opt/macos-sdk/System/Library/Frameworks -w $ARGS
ZIGWRAP
RUN chmod +x /usr/local/bin/zcc-darwin-amd64
# Windows amd64 - uses Zig's bundled mingw
COPY <<'ZIGWRAP' /usr/local/bin/zcc-windows-amd64
#!/bin/sh
ARGS=""
SKIP_NEXT=0
for arg in "$@"; do
if [ $SKIP_NEXT -eq 1 ]; then
SKIP_NEXT=0
continue
fi
case "$arg" in
-target) SKIP_NEXT=1 ;;
-Wl,*) ;;
*) ARGS="$ARGS $arg" ;;
esac
done
exec zig cc -target x86_64-windows-gnu $ARGS
ZIGWRAP
RUN chmod +x /usr/local/bin/zcc-windows-amd64
# Windows arm64 - uses Zig's bundled mingw
COPY <<'ZIGWRAP' /usr/local/bin/zcc-windows-arm64
#!/bin/sh
ARGS=""
SKIP_NEXT=0
for arg in "$@"; do
if [ $SKIP_NEXT -eq 1 ]; then
SKIP_NEXT=0
continue
fi
case "$arg" in
-target) SKIP_NEXT=1 ;;
-Wl,*) ;;
*) ARGS="$ARGS $arg" ;;
esac
done
exec zig cc -target aarch64-windows-gnu $ARGS
ZIGWRAP
RUN chmod +x /usr/local/bin/zcc-windows-arm64
# Build script
COPY <<'SCRIPT' /usr/local/bin/build.sh
#!/bin/sh
set -e
OS=${1:-darwin}
ARCH=${2:-arm64}
case "${OS}-${ARCH}" in
darwin-arm64|darwin-aarch64)
export CC=zcc-darwin-arm64
export GOARCH=arm64
export GOOS=darwin
;;
darwin-amd64|darwin-x86_64)
export CC=zcc-darwin-amd64
export GOARCH=amd64
export GOOS=darwin
;;
linux-arm64|linux-aarch64)
export CC=gcc
export GOARCH=arm64
export GOOS=linux
;;
linux-amd64|linux-x86_64)
export CC=gcc
export GOARCH=amd64
export GOOS=linux
;;
windows-arm64|windows-aarch64)
export CC=zcc-windows-arm64
export GOARCH=arm64
export GOOS=windows
;;
windows-amd64|windows-x86_64)
export CC=zcc-windows-amd64
export GOARCH=amd64
export GOOS=windows
;;
*)
echo "Usage: <os> <arch>"
echo " os: darwin, linux, windows"
echo " arch: amd64, arm64"
exit 1
;;
esac
export CGO_ENABLED=1
export CGO_CFLAGS="-w"
# Build frontend if exists and not already built (host may have built it)
if [ -d "frontend" ] && [ -f "frontend/package.json" ] && [ ! -d "frontend/dist" ]; then
(cd frontend && npm install --silent && npm run build --silent)
fi
# Build
APP=${APP_NAME:-$(basename $(pwd))}
mkdir -p bin
EXT=""
LDFLAGS="-s -w"
if [ "$GOOS" = "windows" ]; then
EXT=".exe"
LDFLAGS="-s -w -H windowsgui"
fi
TAGS="production"
if [ -n "$EXTRA_TAGS" ]; then
TAGS="${TAGS},${EXTRA_TAGS}"
fi
COMPILER="go build"
if [ "$OBFUSCATED" = "true" ]; then
COMPILER="garble ${GARBLE_ARGS} build"
TAGS="${TAGS},wails_obfuscated"
fi
${COMPILER} -tags "$TAGS" -trimpath -buildvcs=false -ldflags="$LDFLAGS" -o bin/${APP}-${GOOS}-${GOARCH}${EXT} .
echo "Built: bin/${APP}-${GOOS}-${GOARCH}${EXT}"
SCRIPT
RUN chmod +x /usr/local/bin/build.sh
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/build.sh"]
CMD ["darwin", "arm64"]
@@ -0,0 +1,67 @@
# Wails Server Mode Dockerfile
# Multi-stage build for a minimal image.
#
# Defaults produce a pure-Go, fully static binary on a distroless/static base:
# the smallest, most secure image, and correct for the default (CGO-free) app.
#
# If your app needs CGO, override the build args, e.g.:
# docker build --build-arg CGO_ENABLED=1 \
# --build-arg GO_IMAGE=golang:bookworm \
# --build-arg RUNTIME_IMAGE=gcr.io/distroless/base-debian12 \
# -f build/docker/Dockerfile.server .
# CGO needs a C toolchain in the builder and a libc in the runtime image; keep
# the builder and runtime libc compatible (a glibc builder -> a glibc runtime).
# The Taskfile passes these through: task build:docker CGO_ENABLED=1 GO_IMAGE=... RUNTIME_IMAGE=...
ARG GO_IMAGE=golang:alpine
ARG RUNTIME_IMAGE=gcr.io/distroless/static-debian12
ARG CGO_ENABLED=0
# Build stage
FROM ${GO_IMAGE} AS builder
ARG CGO_ENABLED
WORKDIR /app
# Install build dependencies: git always; a C compiler only when CGO is enabled.
# Supports both apk (alpine) and apt (debian/bookworm) base images.
RUN if command -v apk >/dev/null 2>&1; then \
apk add --no-cache git $([ "$CGO_ENABLED" = "1" ] && echo gcc musl-dev); \
else \
apt-get update && apt-get install -y --no-install-recommends git $([ "$CGO_ENABLED" = "1" ] && echo gcc libc6-dev) && rm -rf /var/lib/apt/lists/*; \
fi
# Copy source code
COPY . .
# Remove local replace directive if present (for production builds)
RUN sed -i '/^replace/d' go.mod || true
# Download dependencies
RUN go mod tidy
# Build the production server binary.
# - server,production tags: HTTP server mode with production code paths (no dev
# logger/asset middleware), matching the desktop production build.
# - CGO_ENABLED defaults to 0 for a fully static binary (distroless/static);
# override with --build-arg CGO_ENABLED=1 (see header) for CGO apps.
RUN CGO_ENABLED=${CGO_ENABLED} go build -tags server,production -trimpath -buildvcs=false -ldflags="-s -w" -o server .
# Runtime stage - minimal image
FROM ${RUNTIME_IMAGE}
# Copy the binary
COPY --from=builder /app/server /server
# Copy frontend assets
COPY --from=builder /app/frontend/dist /frontend/dist
# Expose the default port
EXPOSE 8080
# Bind to all interfaces (required for Docker)
# Can be overridden at runtime with -e WAILS_SERVER_HOST=...
ENV WAILS_SERVER_HOST=0.0.0.0
# Run the server
ENTRYPOINT ["/server"]
+220
View File
@@ -0,0 +1,220 @@
version: '3'
includes:
common: ../Taskfile.yml
vars:
# Signing configuration - edit these values for your project
# PGP_KEY: "path/to/signing-key.asc"
# SIGN_ROLE: "builder" # Options: origin, maint, archive, builder
#
# Password is stored securely in system keychain. Run: wails3 setup signing
# Docker image for cross-compilation (used when building on non-Linux or no CC available)
CROSS_IMAGE: wails-cross
tasks:
build:
summary: Builds the application for Linux
cmds:
# Linux requires CGO - use Docker when:
# 1. Cross-compiling from non-Linux, OR
# 2. No C compiler is available, OR
# 3. Target architecture differs from host architecture (cross-arch compilation)
- task: '{{if and (eq OS "linux") (eq .HAS_CC "true") (eq .TARGET_ARCH ARCH)}}build:native{{else}}build:docker{{end}}'
vars:
ARCH: '{{.ARCH}}'
DEV: '{{.DEV}}'
OUTPUT: '{{.OUTPUT}}'
EXTRA_TAGS: '{{.EXTRA_TAGS}}'
OBFUSCATED: '{{.OBFUSCATED}}'
GARBLE_ARGS: '{{.GARBLE_ARGS}}'
vars:
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
# Determine target architecture (defaults to host ARCH if not specified)
TARGET_ARCH: '{{.ARCH | default ARCH}}'
# Check if a C compiler is available (gcc or clang) — cross-platform via wails3 tool
HAS_CC:
sh: 'wails3 tool has "gcc|clang"'
build:native:
summary: Builds the application natively on Linux
internal: true
deps:
- task: common:go:mod:tidy
- task: common:build:frontend
vars:
BUILD_FLAGS:
ref: .BUILD_FLAGS
OBFUSCATED:
ref: .OBFUSCATED
DEV:
ref: .DEV
- task: common:generate:icons
- task: generate:dotdesktop
preconditions:
- sh: '{{if eq .OBFUSCATED "true"}}command -v garble >/dev/null 2>&1{{else}}true{{end}}'
msg: "garble is required for obfuscated builds. Install it with: go install mvdan.cc/garble@v0.16.0 (requires Go 1.24+). See https://github.com/burrowers/garble/releases for version/toolchain compatibility."
cmds:
- '{{if eq .OBFUSCATED "true"}}garble {{.GARBLE_ARGS}} build{{else}}go build{{end}} {{.BUILD_FLAGS}} -o {{.OUTPUT}}'
vars:
BUILD_FLAGS: '{{if eq .DEV "true"}}{{if or .EXTRA_TAGS (eq .OBFUSCATED "true")}}-tags {{if eq .OBFUSCATED "true"}}wails_obfuscated{{if .EXTRA_TAGS}},{{end}}{{end}}{{.EXTRA_TAGS}} {{end}}-buildvcs=false -gcflags=all="-l"{{else}}-tags production{{if eq .OBFUSCATED "true"}},wails_obfuscated{{end}}{{if .EXTRA_TAGS}},{{.EXTRA_TAGS}}{{end}} -trimpath -buildvcs=false -ldflags="-w -s"{{end}}'
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
env:
GOOS: linux
CGO_ENABLED: 1
GOARCH: '{{.ARCH | default ARCH}}'
build:docker:
summary: Builds for Linux using Docker (for non-Linux hosts or when no C compiler available)
internal: true
deps:
- task: common:build:frontend
vars:
OBFUSCATED:
ref: .OBFUSCATED
- task: common:generate:icons
- task: generate:dotdesktop
preconditions:
- sh: docker info > /dev/null 2>&1
msg: "Docker is required for cross-compilation to Linux. Please install Docker."
- sh: docker image inspect {{.CROSS_IMAGE}} > /dev/null 2>&1
msg: |
Docker image '{{.CROSS_IMAGE}}' not found.
Build it first: wails3 task setup:docker
cmds:
- docker run --rm -v "{{.ROOT_DIR}}:/app" {{.DOCKER_MOUNTS}} -e APP_NAME="{{.APP_NAME}}" {{if .EXTRA_TAGS}}-e EXTRA_TAGS="{{.EXTRA_TAGS}}"{{end}} {{if eq .OBFUSCATED "true"}}-e OBFUSCATED=true{{end}} {{if .GARBLE_ARGS}}-e GARBLE_ARGS="{{.GARBLE_ARGS}}"{{end}} "{{.CROSS_IMAGE}}" linux {{.DOCKER_ARCH}}
- cmd: docker run --rm -v "{{.ROOT_DIR}}:/app" alpine chown -R $(id -u):$(id -g) /app/bin
platforms: [linux, darwin]
- mkdir -p {{.BIN_DIR}}
- mv "bin/{{.APP_NAME}}-linux-{{.DOCKER_ARCH}}" "{{.OUTPUT}}"
vars:
DOCKER_ARCH: '{{.ARCH | default "amd64"}}'
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
# Generate Docker volume mounts: Go module cache + go.mod replace directives
# Uses wails3 tool docker-mounts for cross-platform compatibility (Windows/Linux/macOS)
DOCKER_MOUNTS:
sh: 'wails3 tool docker-mounts'
package:
summary: Packages the application for Linux
deps:
- task: build
cmds:
- task: create:appimage
- task: create:deb
- task: create:rpm
- task: create:aur
create:appimage:
summary: Creates an AppImage
dir: build/linux/appimage
deps:
- task: build
- task: generate:dotdesktop
cmds:
- cp "{{.APP_BINARY}}" "{{.APP_NAME}}"
- cp ../../appicon.png "{{.APP_NAME}}.png"
- wails3 generate appimage -binary "{{.APP_NAME}}" -icon {{.ICON}} -desktopfile {{.DESKTOP_FILE}} -outputdir {{.OUTPUT_DIR}} -builddir {{.ROOT_DIR}}/build/linux/appimage/build
vars:
APP_NAME: '{{.APP_NAME}}'
APP_BINARY: '../../../bin/{{.APP_NAME}}'
ICON: '{{.APP_NAME}}.png'
DESKTOP_FILE: '../{{.APP_NAME}}.desktop'
OUTPUT_DIR: '../../../bin'
create:deb:
summary: Creates a deb package
deps:
- task: build
cmds:
- task: generate:dotdesktop
- task: generate:deb
create:rpm:
summary: Creates a rpm package
deps:
- task: build
cmds:
- task: generate:dotdesktop
- task: generate:rpm
create:aur:
summary: Creates a arch linux packager package
deps:
- task: build
cmds:
- task: generate:dotdesktop
- task: generate:aur
generate:deb:
summary: Creates a deb package
cmds:
- wails3 tool package -name "{{.APP_NAME}}" -format deb -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin
generate:rpm:
summary: Creates a rpm package
cmds:
- wails3 tool package -name "{{.APP_NAME}}" -format rpm -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin
generate:aur:
summary: Creates a arch linux packager package
cmds:
- wails3 tool package -name "{{.APP_NAME}}" -format archlinux -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin
generate:dotdesktop:
summary: Generates a `.desktop` file
dir: build
cmds:
- mkdir -p {{.ROOT_DIR}}/build/linux/appimage
- wails3 generate .desktop -name "{{.APP_NAME}}" -exec "{{.EXEC}}" -icon "{{.ICON}}" -outputfile "{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop" -categories "{{.CATEGORIES}}"
vars:
APP_NAME: '{{.APP_NAME}}'
EXEC: '{{.APP_NAME}}'
ICON: '{{.APP_NAME}}'
CATEGORIES: 'Development;'
OUTPUTFILE: '{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop'
run:
cmds:
- '{{.BIN_DIR}}/{{.APP_NAME}}'
sign:deb:
summary: Signs the DEB package
desc: |
Signs the .deb package with a PGP key.
Set PGP_KEY in the vars section to override the key configured globally via
`wails3 setup` (~/.config/wails/defaults.yaml).
Password is retrieved from system keychain (run: wails3 setup signing)
deps:
- task: create:deb
cmds:
# PGP_KEY is optional: if unset, `wails3 tool sign` falls back to the key
# configured globally via `wails3 setup`.
- wails3 tool sign --input "{{.BIN_DIR}}/{{.APP_NAME}}*.deb" {{if .PGP_KEY}}--pgp-key "{{.PGP_KEY}}"{{end}} {{if .SIGN_ROLE}}--role "{{.SIGN_ROLE}}"{{end}}
sign:rpm:
summary: Signs the RPM package
desc: |
Signs the .rpm package with a PGP key.
Set PGP_KEY in the vars section to override the key configured globally via
`wails3 setup` (~/.config/wails/defaults.yaml).
Password is retrieved from system keychain (run: wails3 setup signing)
deps:
- task: create:rpm
cmds:
- wails3 tool sign --input "{{.BIN_DIR}}/{{.APP_NAME}}*.rpm" {{if .PGP_KEY}}--pgp-key "{{.PGP_KEY}}"{{end}}
sign:packages:
summary: Signs all Linux packages (DEB and RPM)
desc: |
Signs both .deb and .rpm packages with a PGP key.
Set PGP_KEY in the vars section to override the key configured globally via
`wails3 setup` (~/.config/wails/defaults.yaml).
Password is retrieved from system keychain (run: wails3 setup signing)
cmds:
- task: sign:deb
- task: sign:rpm
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Copyright (c) 2018-Present Lea Anthony
# SPDX-License-Identifier: MIT
# Fail script on any error
set -euxo pipefail
# Define variables
APP_DIR="${APP_NAME}.AppDir"
# Create AppDir structure
mkdir -p "${APP_DIR}/usr/bin"
cp -r "${APP_BINARY}" "${APP_DIR}/usr/bin/"
cp "${ICON_PATH}" "${APP_DIR}/"
cp "${DESKTOP_FILE}" "${APP_DIR}/"
if [[ $(uname -m) == *x86_64* ]]; then
# Download linuxdeploy and make it executable
wget -q -4 -N https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
# Run linuxdeploy to bundle the application
./linuxdeploy-x86_64.AppImage --appdir "${APP_DIR}" --output appimage
else
# Download linuxdeploy and make it executable (arm64)
wget -q -4 -N https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-aarch64.AppImage
chmod +x linuxdeploy-aarch64.AppImage
# Run linuxdeploy to bundle the application (arm64)
./linuxdeploy-aarch64.AppImage --appdir "${APP_DIR}" --output appimage
fi
# Rename the generated AppImage
mv "${APP_NAME}*.AppImage" "${APP_NAME}.AppImage"
+13
View File
@@ -0,0 +1,13 @@
[Desktop Entry]
Version=1.0
Name=NPS Client
Comment=NPS 客户端
# The Exec line includes %u to pass the URL to the application
Exec=/usr/local/bin/npc-gui %u
Terminal=false
Type=Application
Icon=npc-gui
Categories=Utility;
StartupWMClass=npc-gui
@@ -0,0 +1,80 @@
# Feel free to remove those if you don't want/need to use them.
# Make sure to check the documentation at https://nfpm.goreleaser.com
#
# The lines below are called `modelines`. See `:help modeline`
name: "npc-gui"
arch: ${GOARCH}
platform: "linux"
version: "0.26.38"
section: "default"
priority: "extra"
maintainer: ${GIT_COMMITTER_NAME} <${GIT_COMMITTER_EMAIL}>
description: "NPS 客户端"
vendor: "NPS"
homepage: "https://wails.io"
license: "MIT"
release: "1"
contents:
- src: "./bin/npc-gui"
dst: "/usr/local/bin/npc-gui"
- src: "./build/appicon.png"
dst: "/usr/share/icons/hicolor/128x128/apps/npc-gui.png"
- src: "./build/linux/npc-gui.desktop"
dst: "/usr/share/applications/npc-gui.desktop"
# Default dependencies for the GTK4 + WebKitGTK 6.0 stack (Ubuntu 24.04+ / Debian 13+)
depends:
- libgtk-4-1
- libwebkitgtk-6.0-4
# Distribution-specific overrides for different package formats
overrides:
# RPM packages for Fedora / RHEL / AlmaLinux / Rocky Linux
rpm:
depends:
- gtk4
- webkitgtk6.0
# Arch Linux packages
archlinux:
depends:
- gtk4
- webkitgtk-6.0
# scripts section to ensure desktop database is updated after install
scripts:
postinstall: "./build/linux/nfpm/scripts/postinstall.sh"
# You can also add preremove, postremove if needed
# preremove: "./build/linux/nfpm/scripts/preremove.sh"
# postremove: "./build/linux/nfpm/scripts/postremove.sh"
# If you build your app with -tags gtk3 (legacy WebKit2GTK 4.1 stack — supported through v3.0.x, removed in v3.1),
# replace the depends/overrides above with these:
#
# depends:
# - libgtk-3-0
# - libwebkit2gtk-4.1-0
# overrides:
# rpm:
# depends:
# - gtk3
# - webkit2gtk4.1
# archlinux:
# depends:
# - gtk3
# - webkit2gtk-4.1
#
# replaces:
# - foobar
# provides:
# - bar
# recommends:
# - whatever
# suggests:
# - something-else
# conflicts:
# - not-foo
# - not-bar
# changelog: "changelog.yaml"
@@ -0,0 +1,21 @@
#!/bin/sh
# Update desktop database for .desktop file changes
# This makes the application appear in application menus and registers its capabilities.
if command -v update-desktop-database >/dev/null 2>&1; then
echo "Updating desktop database..."
update-desktop-database -q /usr/share/applications
else
echo "Warning: update-desktop-database command not found. Desktop file may not be immediately recognized." >&2
fi
# Update MIME database for custom URL schemes (x-scheme-handler)
# This ensures the system knows how to handle your custom protocols.
if command -v update-mime-database >/dev/null 2>&1; then
echo "Updating MIME database..."
update-mime-database -n /usr/share/mime
else
echo "Warning: update-mime-database command not found. Custom URL schemes may not be immediately recognized." >&2
fi
exit 0
@@ -0,0 +1 @@
#!/bin/bash
@@ -0,0 +1 @@
#!/bin/bash
@@ -0,0 +1 @@
#!/bin/bash
+195
View File
@@ -0,0 +1,195 @@
version: '3'
includes:
common: ../Taskfile.yml
vars:
# Signing configuration - edit these values for your project
# SIGN_CERTIFICATE: "path/to/certificate.pfx"
# SIGN_THUMBPRINT: "certificate-thumbprint" # Alternative to SIGN_CERTIFICATE
# TIMESTAMP_SERVER: "http://timestamp.digicert.com"
#
# Password is stored securely in system keychain. Run: wails3 setup signing
# Docker image for cross-compilation with CGO (used when CGO_ENABLED=1 on non-Windows)
CROSS_IMAGE: wails-cross
tasks:
build:
summary: Builds the application for Windows
cmds:
# Auto-detect CGO: if CGO_ENABLED=1, use Docker; otherwise use native Go cross-compile
- task: '{{if and (ne OS "windows") (eq .CGO_ENABLED "1")}}build:docker{{else}}build:native{{end}}'
vars:
ARCH: '{{.ARCH}}'
DEV: '{{.DEV}}'
EXTRA_TAGS: '{{.EXTRA_TAGS}}'
OBFUSCATED: '{{.OBFUSCATED}}'
GARBLE_ARGS: '{{.GARBLE_ARGS}}'
vars:
# Default to CGO_ENABLED=0 if not explicitly set
CGO_ENABLED: '{{.CGO_ENABLED | default "0"}}'
build:native:
summary: Builds the application using native Go cross-compilation
internal: true
deps:
- task: common:go:mod:tidy
- task: common:build:frontend
vars:
BUILD_FLAGS:
ref: .BUILD_FLAGS
OBFUSCATED:
ref: .OBFUSCATED
DEV:
ref: .DEV
- task: common:generate:icons
preconditions:
- sh: '{{if eq .OBFUSCATED "true"}}command -v garble >/dev/null 2>&1{{else}}true{{end}}'
msg: "garble is required for obfuscated builds. Install it with: go install mvdan.cc/garble@v0.16.0 (requires Go 1.24+). See https://github.com/burrowers/garble/releases for version/toolchain compatibility."
cmds:
- task: generate:syso
vars:
ARCH: '{{.ARCH}}'
- '{{if eq .OBFUSCATED "true"}}garble {{.GARBLE_ARGS}} build{{else}}go build{{end}} {{.BUILD_FLAGS}} -o "{{.BIN_DIR}}/{{.APP_NAME}}.exe"'
- cmd: powershell Remove-item *.syso
platforms: [windows]
- cmd: rm -f *.syso
platforms: [linux, darwin]
vars:
BUILD_FLAGS: '{{if eq .DEV "true"}}{{if or .EXTRA_TAGS (eq .OBFUSCATED "true")}}-tags {{if eq .OBFUSCATED "true"}}wails_obfuscated{{if .EXTRA_TAGS}},{{end}}{{end}}{{.EXTRA_TAGS}} {{end}}-buildvcs=false -gcflags=all="-l"{{else}}-tags production{{if eq .OBFUSCATED "true"}},wails_obfuscated{{end}}{{if .EXTRA_TAGS}},{{.EXTRA_TAGS}}{{end}} -trimpath -buildvcs=false -ldflags="-w -s -H windowsgui"{{end}}'
env:
GOOS: windows
CGO_ENABLED: '{{.CGO_ENABLED | default "0"}}'
GOARCH: '{{.ARCH | default ARCH}}'
build:docker:
summary: Cross-compiles for Windows using Docker with Zig (for CGO builds on non-Windows)
internal: true
deps:
- task: common:build:frontend
vars:
OBFUSCATED:
ref: .OBFUSCATED
- task: common:generate:icons
preconditions:
- sh: docker info > /dev/null 2>&1
msg: "Docker is required for CGO cross-compilation. Please install Docker."
- sh: docker image inspect {{.CROSS_IMAGE}} > /dev/null 2>&1
msg: |
Docker image '{{.CROSS_IMAGE}}' not found.
Build it first: wails3 task setup:docker
cmds:
- task: generate:syso
vars:
ARCH: '{{.ARCH}}'
- docker run --rm -v "{{.ROOT_DIR}}:/app" {{.DOCKER_MOUNTS}} -e APP_NAME="{{.APP_NAME}}" {{if .EXTRA_TAGS}}-e EXTRA_TAGS="{{.EXTRA_TAGS}}"{{end}} {{if eq .OBFUSCATED "true"}}-e OBFUSCATED=true{{end}} {{if .GARBLE_ARGS}}-e GARBLE_ARGS="{{.GARBLE_ARGS}}"{{end}} {{.CROSS_IMAGE}} windows {{.DOCKER_ARCH}}
- cmd: docker run --rm -v "{{.ROOT_DIR}}:/app" alpine chown -R $(id -u):$(id -g) /app/bin
platforms: [linux, darwin]
- rm -f *.syso
vars:
DOCKER_ARCH: '{{.ARCH | default "amd64"}}'
# Generate Docker volume mounts: Go module cache + go.mod replace directives
# Uses wails3 tool docker-mounts for cross-platform compatibility (Windows/Linux/macOS)
DOCKER_MOUNTS:
sh: 'wails3 tool docker-mounts'
package:
summary: Packages the application
cmds:
- task: '{{if eq (.FORMAT | default "nsis") "msix"}}create:msix:package{{else}}create:nsis:installer{{end}}'
vars:
INSTALL_SCOPE: '{{.INSTALL_SCOPE | default "machine"}}'
vars:
FORMAT: '{{.FORMAT | default "nsis"}}'
INSTALL_SCOPE: '{{.INSTALL_SCOPE | default "machine"}}'
generate:syso:
summary: Generates Windows `.syso` file
dir: build
cmds:
- wails3 generate syso -arch {{.ARCH}} -icon windows/icon.ico -manifest windows/wails.exe.manifest -info windows/info.json -out ../wails_windows_{{.ARCH}}.syso
vars:
ARCH: '{{.ARCH | default ARCH}}'
create:nsis:installer:
summary: Creates an NSIS installer
dir: build/windows/nsis
deps:
- task: build
preconditions:
- sh: '[ "{{.INSTALL_SCOPE}}" = "user" ] || [ "{{.INSTALL_SCOPE}}" = "machine" ]'
msg: "INSTALL_SCOPE must be 'user' or 'machine', got '{{.INSTALL_SCOPE}}'"
cmds:
# Create the Microsoft WebView2 bootstrapper if it doesn't exist
- wails3 generate webview2bootstrapper -dir "{{.ROOT_DIR}}/build/windows/nsis"
- |
{{if eq OS "windows"}}
makensis {{if eq .INSTALL_SCOPE "user"}}-DWAILS_INSTALL_SCOPE=user -DREQUEST_EXECUTION_LEVEL=user {{end}}-DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}\{{.BIN_DIR}}\{{.APP_NAME}}.exe" project.nsi
{{else}}
makensis {{if eq .INSTALL_SCOPE "user"}}-DWAILS_INSTALL_SCOPE=user -DREQUEST_EXECUTION_LEVEL=user {{end}}-DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}/{{.BIN_DIR}}/{{.APP_NAME}}.exe" project.nsi
{{end}}
vars:
ARCH: '{{.ARCH | default ARCH}}'
ARG_FLAG: '{{if eq .ARCH "amd64"}}AMD64{{else}}ARM64{{end}}'
INSTALL_SCOPE: '{{.INSTALL_SCOPE | default "machine"}}'
create:msix:package:
summary: Creates an MSIX package
deps:
- task: build
cmds:
- |-
wails3 tool msix \
--config "{{.ROOT_DIR}}/wails.json" \
--name "{{.APP_NAME}}" \
--executable "{{.ROOT_DIR}}/{{.BIN_DIR}}/{{.APP_NAME}}.exe" \
--arch "{{.ARCH}}" \
--out "{{.ROOT_DIR}}/{{.BIN_DIR}}/{{.APP_NAME}}-{{.ARCH}}.msix" \
{{if .CERT_PATH}}--cert "{{.CERT_PATH}}"{{end}} \
{{if .PUBLISHER}}--publisher "{{.PUBLISHER}}"{{end}} \
{{if .USE_MSIX_TOOL}}--use-msix-tool{{else}}--use-makeappx{{end}}
vars:
ARCH: '{{.ARCH | default ARCH}}'
CERT_PATH: '{{.CERT_PATH | default ""}}'
PUBLISHER: '{{.PUBLISHER | default ""}}'
USE_MSIX_TOOL: '{{.USE_MSIX_TOOL | default "false"}}'
install:msix:tools:
summary: Installs tools required for MSIX packaging
cmds:
- wails3 tool msix-install-tools
run:
cmds:
- '{{.BIN_DIR}}/{{.APP_NAME}}.exe'
sign:
summary: Signs the Windows executable
desc: |
Signs the .exe with an Authenticode certificate.
Set SIGN_CERTIFICATE or SIGN_THUMBPRINT to override the certificate
configured globally via `wails3 setup` (~/.config/wails/defaults.yaml).
Password is retrieved from system keychain (run: wails3 setup signing)
deps:
- task: build
cmds:
# Certificate vars are optional: if unset, `wails3 tool sign` falls back to
# the certificate configured globally via `wails3 setup`.
- wails3 tool sign --input "{{.BIN_DIR}}/{{.APP_NAME}}.exe" {{if .SIGN_CERTIFICATE}}--certificate "{{.SIGN_CERTIFICATE}}"{{end}} {{if .SIGN_THUMBPRINT}}--thumbprint "{{.SIGN_THUMBPRINT}}"{{end}} {{if .TIMESTAMP_SERVER}}--timestamp "{{.TIMESTAMP_SERVER}}"{{end}}
sign:installer:
summary: Signs the NSIS installer
desc: |
Creates and signs the NSIS installer.
Set SIGN_CERTIFICATE or SIGN_THUMBPRINT to override the certificate
configured globally via `wails3 setup` (~/.config/wails/defaults.yaml).
Password is retrieved from system keychain (run: wails3 setup signing)
deps:
- task: create:nsis:installer
vars:
INSTALL_SCOPE: '{{.INSTALL_SCOPE | default "machine"}}'
vars:
INSTALL_SCOPE: '{{.INSTALL_SCOPE | default "machine"}}'
cmds:
- wails3 tool sign --input "build/windows/nsis/{{.APP_NAME}}-installer.exe" {{if .SIGN_CERTIFICATE}}--certificate "{{.SIGN_CERTIFICATE}}"{{end}} {{if .SIGN_THUMBPRINT}}--thumbprint "{{.SIGN_THUMBPRINT}}"{{end}} {{if .TIMESTAMP_SERVER}}--timestamp "{{.TIMESTAMP_SERVER}}"{{end}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

+15
View File
@@ -0,0 +1,15 @@
{
"fixed": {
"file_version": "0.26.38"
},
"info": {
"0000": {
"ProductVersion": "0.26.38",
"CompanyName": "NPS",
"FileDescription": "NPS 客户端",
"LegalCopyright": "Copyright © 2026 NPS",
"ProductName": "NPS Client",
"Comments": "NPS 客户端"
}
}
}
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
IgnorableNamespaces="uap3">
<Identity
Name="com.nps.client"
Publisher="CN=NPS"
Version="0.26.38.0"
ProcessorArchitecture="x64" />
<Properties>
<DisplayName>NPS Client</DisplayName>
<PublisherDisplayName>NPS</PublisherDisplayName>
<Description>NPS 客户端</Description>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>
<Resources>
<Resource Language="en-us" />
</Resources>
<Applications>
<Application Id="com.nps.client" Executable="npc-gui" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
DisplayName="NPS Client"
Description="NPS 客户端"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<desktop:Extension Category="windows.fullTrustProcess" Executable="npc-gui" />
</Extensions>
</Application>
</Applications>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<MsixPackagingToolTemplate
xmlns="http://schemas.microsoft.com/msix/packaging/msixpackagingtool/template/2022">
<Settings
AllowTelemetry="false"
ApplyACLsToPackageFiles="true"
GenerateCommandLineFile="true"
AllowPromptForPassword="false">
</Settings>
<Installer
Path="npc-gui"
Arguments=""
InstallLocation="C:\Program Files\NPS\NPS Client">
</Installer>
<PackageInformation
PackageName="NPS Client"
PackageDisplayName="NPS Client"
PublisherName="CN=NPS"
PublisherDisplayName="NPS"
Version="0.26.38.0"
PackageDescription="NPS 客户端">
<Capabilities>
<Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application
Id="com.nps.client"
Description="NPS 客户端"
DisplayName="NPS Client"
ExecutableName="npc-gui"
EntryPoint="Windows.FullTrustApplication">
</Application>
</Applications>
<Resources>
<Resource Language="en-us" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>
<Properties>
<Framework>false</Framework>
<DisplayName>NPS Client</DisplayName>
<PublisherDisplayName>NPS</PublisherDisplayName>
<Description>NPS 客户端</Description>
<Logo>Assets\AppIcon.png</Logo>
</Properties>
</PackageInformation>
<SaveLocation PackagePath="npc-gui.msix" />
<PackageIntegrity>
<CertificatePath></CertificatePath>
</PackageIntegrity>
</MsixPackagingToolTemplate>
@@ -0,0 +1,119 @@
Unicode true
####
## Please note: Template replacements don't work in this file. They are provided with default defines like
## mentioned underneath.
## If the keyword is not defined, "wails_tools.nsh" will populate them.
## If they are defined here, "wails_tools.nsh" will not touch them. This allows you to use this project.nsi manually
## from outside of Wails for debugging and development of the installer.
##
## For development first make a wails nsis build to populate the "wails_tools.nsh":
## > wails build --target windows/amd64 --nsis
## Then you can call makensis on this file with specifying the path to your binary:
## For a AMD64 only installer:
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe
## For a ARM64 only installer:
## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe
## For a installer with both architectures:
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe
####
## The following information is taken from the wails_tools.nsh file, but they can be overwritten here.
####
## !define INFO_PROJECTNAME "my-project" # Default "npc-gui"
## !define INFO_COMPANYNAME "My Company" # Default "NPS"
## !define INFO_PRODUCTNAME "My Product Name" # Default "NPS Client"
## !define INFO_PRODUCTVERSION "1.0.0" # Default "0.26.38"
## !define INFO_COPYRIGHT "(c) Now, My Company" # Default "Copyright © 2026 NPS"
###
## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe"
## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
####
## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html
## !define WAILS_INSTALL_SCOPE "user" # Default "machine" - set to "user" for per-user install ($LOCALAPPDATA) without UAC prompt
####
## Include the wails tools
####
!include "wails_tools.nsh"
# The version information for this two must consist of 4 parts
VIProductVersion "${INFO_PRODUCTVERSION}.0"
VIFileVersion "${INFO_PRODUCTVERSION}.0"
VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}"
VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer"
VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}"
VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}"
VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}"
VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}"
# Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware
ManifestDPIAware true
!include "MUI.nsh"
!define MUI_ICON "..\icon.ico"
!define MUI_UNICON "..\icon.ico"
# !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314
!define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps
!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
# !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer
!insertmacro MUI_PAGE_DIRECTORY # In which folder install page.
!insertmacro MUI_PAGE_INSTFILES # Installing page.
!insertmacro MUI_PAGE_FINISH # Finished installation page.
!insertmacro MUI_UNPAGE_INSTFILES # Uninstalling page
!insertmacro MUI_LANGUAGE "English" # Set the Language of the installer
## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1
#!uninstfinalize 'signtool --file "%1"'
#!finalize 'signtool --file "%1"'
Name "${INFO_PRODUCTNAME}"
OutFile "..\..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
!if "${WAILS_INSTALL_SCOPE}" == "user"
InstallDir "$LOCALAPPDATA\Programs\${INFO_PRODUCTNAME}"
!else
InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}"
!endif
ShowInstDetails show # This will always show the installation details.
Function .onInit
!insertmacro wails.checkArchitecture
FunctionEnd
Section
!insertmacro wails.setShellContext
!insertmacro wails.webview2runtime
SetOutPath $INSTDIR
!insertmacro wails.files
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
!insertmacro wails.associateFiles
!insertmacro wails.associateCustomProtocols
!insertmacro wails.writeUninstaller
SectionEnd
Section "uninstall"
!insertmacro wails.setShellContext
RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath
RMDir /r $INSTDIR
Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk"
Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk"
!insertmacro wails.unassociateFiles
!insertmacro wails.unassociateCustomProtocols
!insertmacro wails.deleteUninstaller
SectionEnd
@@ -0,0 +1,261 @@
# DO NOT EDIT - Generated automatically by `wails build`
!include "x64.nsh"
!include "WinVer.nsh"
!include "FileFunc.nsh"
!ifndef INFO_PROJECTNAME
!define INFO_PROJECTNAME "npc-gui"
!endif
!ifndef INFO_COMPANYNAME
!define INFO_COMPANYNAME "NPS"
!endif
!ifndef INFO_PRODUCTNAME
!define INFO_PRODUCTNAME "NPS Client"
!endif
!ifndef INFO_PRODUCTVERSION
!define INFO_PRODUCTVERSION "0.26.38"
!endif
!ifndef INFO_COPYRIGHT
!define INFO_COPYRIGHT "Copyright © 2026 NPS"
!endif
!ifndef PRODUCT_EXECUTABLE
!define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe"
!endif
!ifndef UNINST_KEY_NAME
!define UNINST_KEY_NAME "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
!endif
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINST_KEY_NAME}"
!ifndef WAILS_INSTALL_SCOPE
!define WAILS_INSTALL_SCOPE "machine"
!endif
!ifndef REQUEST_EXECUTION_LEVEL
!if "${WAILS_INSTALL_SCOPE}" == "user"
!define REQUEST_EXECUTION_LEVEL "user"
!else
!define REQUEST_EXECUTION_LEVEL "admin"
!endif
!endif
RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}"
!ifdef ARG_WAILS_AMD64_BINARY
!define SUPPORTS_AMD64
!endif
!ifdef ARG_WAILS_ARM64_BINARY
!define SUPPORTS_ARM64
!endif
!ifdef SUPPORTS_AMD64
!ifdef SUPPORTS_ARM64
!define ARCH "amd64_arm64"
!else
!define ARCH "amd64"
!endif
!else
!ifdef SUPPORTS_ARM64
!define ARCH "arm64"
!else
!error "Wails: Undefined ARCH, please provide at least one of ARG_WAILS_AMD64_BINARY or ARG_WAILS_ARM64_BINARY"
!endif
!endif
!macro wails.checkArchitecture
!ifndef WAILS_WIN10_REQUIRED
!define WAILS_WIN10_REQUIRED "This product is only supported on Windows 10 (Server 2016) and later."
!endif
!ifndef WAILS_ARCHITECTURE_NOT_SUPPORTED
!define WAILS_ARCHITECTURE_NOT_SUPPORTED "This product can't be installed on the current Windows architecture. Supports: ${ARCH}"
!endif
${If} ${AtLeastWin10}
!ifdef SUPPORTS_AMD64
${if} ${IsNativeAMD64}
Goto ok
${EndIf}
!endif
!ifdef SUPPORTS_ARM64
${if} ${IsNativeARM64}
Goto ok
${EndIf}
!endif
IfSilent silentArch notSilentArch
silentArch:
SetErrorLevel 65
Abort
notSilentArch:
MessageBox MB_OK "${WAILS_ARCHITECTURE_NOT_SUPPORTED}"
Quit
${else}
IfSilent silentWin notSilentWin
silentWin:
SetErrorLevel 64
Abort
notSilentWin:
MessageBox MB_OK "${WAILS_WIN10_REQUIRED}"
Quit
${EndIf}
ok:
!macroend
!macro wails.files
!ifdef SUPPORTS_AMD64
${if} ${IsNativeAMD64}
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_AMD64_BINARY}"
${EndIf}
!endif
!ifdef SUPPORTS_ARM64
${if} ${IsNativeARM64}
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_ARM64_BINARY}"
${EndIf}
!endif
!macroend
!macro wails.writeUninstaller
WriteUninstaller "$INSTDIR\uninstall.exe"
SetRegView 64
!if "${WAILS_INSTALL_SCOPE}" == "user"
WriteRegStr HKCU "${UNINST_KEY}" "Publisher" "${INFO_COMPANYNAME}"
WriteRegStr HKCU "${UNINST_KEY}" "DisplayName" "${INFO_PRODUCTNAME}"
WriteRegStr HKCU "${UNINST_KEY}" "DisplayVersion" "${INFO_PRODUCTVERSION}"
WriteRegStr HKCU "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXECUTABLE}"
WriteRegStr HKCU "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKCU "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKCU "${UNINST_KEY}" "EstimatedSize" "$0"
!else
WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "${INFO_COMPANYNAME}"
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${INFO_PRODUCTNAME}"
WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${INFO_PRODUCTVERSION}"
WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXECUTABLE}"
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0"
!endif
!macroend
!macro wails.deleteUninstaller
Delete "$INSTDIR\uninstall.exe"
SetRegView 64
!if "${WAILS_INSTALL_SCOPE}" == "user"
DeleteRegKey HKCU "${UNINST_KEY}"
!else
DeleteRegKey HKLM "${UNINST_KEY}"
!endif
!macroend
!macro wails.setShellContext
${If} ${REQUEST_EXECUTION_LEVEL} == "admin"
SetShellVarContext all
${else}
SetShellVarContext current
${EndIf}
!macroend
# Install webview2 by launching the bootstrapper
# See https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment
!macro wails.webview2runtime
!ifndef WAILS_INSTALL_WEBVIEW_DETAILPRINT
!define WAILS_INSTALL_WEBVIEW_DETAILPRINT "Installing: WebView2 Runtime"
!endif
SetRegView 64
# If the admin key exists and is not empty then webview2 is already installed
ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
${If} $0 != ""
Goto ok
${EndIf}
${If} ${REQUEST_EXECUTION_LEVEL} == "user"
# If the installer is run in user level, check the user specific key exists and is not empty then webview2 is already installed
ReadRegStr $0 HKCU "Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
${If} $0 != ""
Goto ok
${EndIf}
${EndIf}
SetDetailsPrint both
DetailPrint "${WAILS_INSTALL_WEBVIEW_DETAILPRINT}"
SetDetailsPrint listonly
InitPluginsDir
CreateDirectory "$pluginsdir\webview2bootstrapper"
SetOutPath "$pluginsdir\webview2bootstrapper"
File "MicrosoftEdgeWebview2Setup.exe"
ExecWait '"$pluginsdir\webview2bootstrapper\MicrosoftEdgeWebview2Setup.exe" /silent /install'
SetDetailsPrint both
ok:
!macroend
# Copy of APP_ASSOCIATE and APP_UNASSOCIATE macros from here https://gist.github.com/nikku/281d0ef126dbc215dd58bfd5b3a5cd5b
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
; Backup the previously associated file class
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" ""
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0"
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}"
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}`
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}`
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open"
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}`
!macroend
!macro APP_UNASSOCIATE EXT FILECLASS
; Backup the previously associated file class
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup`
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0"
DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}`
!macroend
!macro wails.associateFiles
; Create file associations
!macroend
!macro wails.unassociateFiles
; Delete app associations
!macroend
!macro CUSTOM_PROTOCOL_ASSOCIATE PROTOCOL DESCRIPTION ICON COMMAND
DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}"
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "" "${DESCRIPTION}"
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "URL Protocol" ""
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\DefaultIcon" "" "${ICON}"
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell" "" ""
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open" "" ""
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open\command" "" "${COMMAND}"
!macroend
!macro CUSTOM_PROTOCOL_UNASSOCIATE PROTOCOL
DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}"
!macroend
!macro wails.associateCustomProtocols
; Create custom protocols associations
!macroend
!macro wails.unassociateCustomProtocols
; Delete app custom protocol associations
!macroend
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity type="win32" name="com.nps.client" version="0.26.38" processorArchitecture="*"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
</asmv3:windowsSettings>
</asmv3:application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
@@ -0,0 +1,9 @@
//@ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "@wailsio/runtime";
Object.freeze($Create.Events);
@@ -0,0 +1,2 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
@@ -0,0 +1,173 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as $models from "./models.js";
/**
* @param {string} arg
* @returns {$CancellablePromise<void>}
*/
export function AddShortcut(arg) {
return $Call.ByID(1551262862, arg);
}
/**
* @param {string} s
* @returns {$CancellablePromise<void>}
*/
export function AddShortcutFromBase64(s) {
return $Call.ByID(1504335541, s);
}
/**
* CheckForUpdate 检查是否有新版本可用(检测升级)
* @returns {$CancellablePromise<$models.UpdateInfo | null>}
*/
export function CheckForUpdate() {
return $Call.ByID(2347956003).then(/** @type {($result: any) => any} */(($result) => {
return $$createType1($result);
}));
}
/**
* ClearConnectionLogs 清空指定客户端的连接日志(内存缓冲与日志文件)
* @param {string} clientId
* @returns {$CancellablePromise<void>}
*/
export function ClearConnectionLogs(clientId) {
return $Call.ByID(390310005, clientId);
}
/**
* DownloadAndInstallUpdate 下载最新版本并热替换当前可执行文件
* @returns {$CancellablePromise<void>}
*/
export function DownloadAndInstallUpdate() {
return $Call.ByID(2440793480);
}
/**
* GetAppVersion 返回来自 lib/version 的版本号
* @returns {$CancellablePromise<string>}
*/
export function GetAppVersion() {
return $Call.ByID(1780012486);
}
/**
* @returns {$CancellablePromise<{ [_ in string]?: string }>}
*/
export function GetClientStates() {
return $Call.ByID(4274000306).then(/** @type {($result: any) => any} */(($result) => {
return $$createType2($result);
}));
}
/**
* GetConnectionLogs 获取指定客户端的连接日志(直接读内存缓冲,无需解析文件)
* @param {string} clientId
* @returns {$CancellablePromise<$models.ConnectionLog[]>}
*/
export function GetConnectionLogs(clientId) {
return $Call.ByID(1455453564, clientId).then(/** @type {($result: any) => any} */(($result) => {
return $$createType4($result);
}));
}
/**
* GetDefaultLogDir 获取默认日志目录路径
* @returns {$CancellablePromise<string>}
*/
export function GetDefaultLogDir() {
return $Call.ByID(2287653297);
}
/**
* 以下为对 settings 与 clientStates 的访问方法(供前端调用)
* @returns {$CancellablePromise<$models.GuiSettings>}
*/
export function GetGuiSettings() {
return $Call.ByID(3468339871).then(/** @type {($result: any) => any} */(($result) => {
return $$createType5($result);
}));
}
/**
* @returns {$CancellablePromise<$models.ShortClient[]>}
*/
export function GetShortcuts() {
return $Call.ByID(737927018).then(/** @type {($result: any) => any} */(($result) => {
return $$createType7($result);
}));
}
/**
* @param {string} name
* @param {string} addr
* @param {string} key
* @returns {$CancellablePromise<void>}
*/
export function RemoveShortcut(name, addr, key) {
return $Call.ByID(658180051, name, addr, key);
}
/**
* RestartApp 重启当前程序(更新完成后调用)
* @returns {$CancellablePromise<void>}
*/
export function RestartApp() {
return $Call.ByID(4246341431);
}
/**
* @param {{ [_ in string]?: string }} m
* @returns {$CancellablePromise<void>}
*/
export function SaveClientStates(m) {
return $Call.ByID(2752835897, m);
}
/**
* @param {$models.GuiSettings} s
* @returns {$CancellablePromise<void>}
*/
export function SaveGuiSettings(s) {
return $Call.ByID(979570966, s);
}
/**
* SelectDirectory 打开目录选择对话框
* @returns {$CancellablePromise<string>}
*/
export function SelectDirectory() {
return $Call.ByID(1735672136);
}
/**
* @param {string} name
* @param {string} addr
* @param {string} key
* @param {boolean} tls
* @param {boolean} runningState
* @returns {$CancellablePromise<void>}
*/
export function ToggleClient(name, addr, key, tls, runningState) {
return $Call.ByID(1335627254, name, addr, key, tls, runningState);
}
// Private type creation functions
const $$createType0 = $models.UpdateInfo.createFrom;
const $$createType1 = $Create.Nullable($$createType0);
const $$createType2 = $Create.Map($Create.Any, $Create.Any);
const $$createType3 = $models.ConnectionLog.createFrom;
const $$createType4 = $Create.Array($$createType3);
const $$createType5 = $models.GuiSettings.createFrom;
const $$createType6 = $models.ShortClient.createFrom;
const $$createType7 = $Create.Array($$createType6);
@@ -0,0 +1,15 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as App from "./app.js";
export {
App
};
export {
ConnectionLog,
GuiSettings,
ShortClient,
UpdateInfo
} from "./models.js";
@@ -0,0 +1,262 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "@wailsio/runtime";
/**
* ConnectionLog 连接日志项
*/
export class ConnectionLog {
/**
* Creates a new ConnectionLog instance.
* @param {Partial<ConnectionLog>} [$$source = {}] - The source object to create the ConnectionLog.
*/
constructor($$source = {}) {
if (!("timestamp" in $$source)) {
/**
* @member
* @type {string}
*/
this["timestamp"] = "";
}
if (!("message" in $$source)) {
/**
* @member
* @type {string}
*/
this["message"] = "";
}
if (!("type" in $$source)) {
/**
* "info", "error", "warning", "success"
* @member
* @type {string}
*/
this["type"] = "";
}
if (!("clientId" in $$source)) {
/**
* @member
* @type {string}
*/
this["clientId"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new ConnectionLog instance from a string or object.
* @param {any} [$$source = {}]
* @returns {ConnectionLog}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new ConnectionLog(/** @type {Partial<ConnectionLog>} */($$parsedSource));
}
}
/**
* 持久化文件结构(向后兼容旧的仅数组格式)
*/
export class GuiSettings {
/**
* Creates a new GuiSettings instance.
* @param {Partial<GuiSettings>} [$$source = {}] - The source object to create the GuiSettings.
*/
constructor($$source = {}) {
if (!("startupEnabled" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["startupEnabled"] = false;
}
if (!("rememberClientState" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["rememberClientState"] = false;
}
if (!("logDir" in $$source)) {
/**
* @member
* @type {string}
*/
this["logDir"] = "";
}
if (!("themeMode" in $$source)) {
/**
* "auto", "light", "dark"
* @member
* @type {string}
*/
this["themeMode"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new GuiSettings instance from a string or object.
* @param {any} [$$source = {}]
* @returns {GuiSettings}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new GuiSettings(/** @type {Partial<GuiSettings>} */($$parsedSource));
}
}
/**
* ShortClient 与前端结构对应
*/
export class ShortClient {
/**
* Creates a new ShortClient instance.
* @param {Partial<ShortClient>} [$$source = {}] - The source object to create the ShortClient.
*/
constructor($$source = {}) {
if (!("name" in $$source)) {
/**
* @member
* @type {string}
*/
this["name"] = "";
}
if (!("addr" in $$source)) {
/**
* @member
* @type {string}
*/
this["addr"] = "";
}
if (!("key" in $$source)) {
/**
* @member
* @type {string}
*/
this["key"] = "";
}
if (!("tls" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["tls"] = false;
}
if (!("running" in $$source)) {
/**
* 兼容旧版本,实际用Status
* @member
* @type {boolean}
*/
this["running"] = false;
}
if (!("error" in $$source)) {
/**
* 连接错误信息
* @member
* @type {string}
*/
this["error"] = "";
}
if (!("status" in $$source)) {
/**
* 连接状态: "stopped", "connecting", "connected"
* @member
* @type {string}
*/
this["status"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new ShortClient instance from a string or object.
* @param {any} [$$source = {}]
* @returns {ShortClient}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new ShortClient(/** @type {Partial<ShortClient>} */($$parsedSource));
}
}
/**
* UpdateInfo 版本检查结果,供前端展示
*/
export class UpdateInfo {
/**
* Creates a new UpdateInfo instance.
* @param {Partial<UpdateInfo>} [$$source = {}] - The source object to create the UpdateInfo.
*/
constructor($$source = {}) {
if (!("currentVersion" in $$source)) {
/**
* @member
* @type {string}
*/
this["currentVersion"] = "";
}
if (!("latestVersion" in $$source)) {
/**
* @member
* @type {string}
*/
this["latestVersion"] = "";
}
if (!("updateAvailable" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["updateAvailable"] = false;
}
if (!("releaseNotes" in $$source)) {
/**
* @member
* @type {string}
*/
this["releaseNotes"] = "";
}
if (!("publishedAt" in $$source)) {
/**
* @member
* @type {string}
*/
this["publishedAt"] = "";
}
if (!("downloadUrl" in $$source)) {
/**
* @member
* @type {string}
*/
this["downloadUrl"] = "";
}
if (!("assetName" in $$source)) {
/**
* @member
* @type {string}
*/
this["assetName"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new UpdateInfo instance from a string or object.
* @param {any} [$$source = {}]
* @returns {UpdateInfo}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new UpdateInfo(/** @type {Partial<UpdateInfo>} */($$parsedSource));
}
}
+2
View File
@@ -6,10 +6,12 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"build:dev": "vite build --minify false --mode development",
"preview": "vite preview",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},
"dependencies": {
"@wailsio/runtime": "^3.0.0-beta.12",
"vue": "^3.3.4"
},
"devDependencies": {
File diff suppressed because it is too large Load Diff
+8 -9
View File
@@ -4,15 +4,14 @@ import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
// 必须绑定 IPv4 回环地址:Wails 应用通过 127.0.0.1 代理请求 dev server,
// vite 默认只监听 ::1(IPv6)会导致 502
host: '127.0.0.1',
port: Number(process.env.WAILS_VITE_PORT) || 34115,
strictPort: true
},
build: {
outDir: 'dist',
rollupOptions: {
external: ['/wails/go/main/App.js'],
output: {
globals: {
'/wails/go/main/App.js': 'window'
}
}
}
outDir: 'dist'
}
})
-31
View File
@@ -1,31 +0,0 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {main} from '../models';
export function AddShortcut(arg1:string):Promise<void>;
export function AddShortcutFromBase64(arg1:string):Promise<void>;
export function ClearConnectionLogs(arg1:string):Promise<void>;
export function GetAppVersion():Promise<string>;
export function GetClientStates():Promise<Record<string, string>>;
export function GetConnectionLogs(arg1:string):Promise<Array<main.ConnectionLog>>;
export function GetDefaultLogDir():Promise<string>;
export function GetGuiSettings():Promise<main.GuiSettings>;
export function GetShortcuts():Promise<Array<main.ShortClient>>;
export function RemoveShortcut(arg1:string,arg2:string,arg3:string):Promise<void>;
export function SaveClientStates(arg1:Record<string, string>):Promise<void>;
export function SaveGuiSettings(arg1:main.GuiSettings):Promise<void>;
export function SelectDirectory():Promise<string>;
export function ToggleClient(arg1:string,arg2:string,arg3:string,arg4:boolean,arg5:boolean):Promise<void>;
@@ -1,59 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function AddShortcut(arg1) {
return window['go']['main']['App']['AddShortcut'](arg1);
}
export function AddShortcutFromBase64(arg1) {
return window['go']['main']['App']['AddShortcutFromBase64'](arg1);
}
export function ClearConnectionLogs(arg1) {
return window['go']['main']['App']['ClearConnectionLogs'](arg1);
}
export function GetAppVersion() {
return window['go']['main']['App']['GetAppVersion']();
}
export function GetClientStates() {
return window['go']['main']['App']['GetClientStates']();
}
export function GetConnectionLogs(arg1) {
return window['go']['main']['App']['GetConnectionLogs'](arg1);
}
export function GetDefaultLogDir() {
return window['go']['main']['App']['GetDefaultLogDir']();
}
export function GetGuiSettings() {
return window['go']['main']['App']['GetGuiSettings']();
}
export function GetShortcuts() {
return window['go']['main']['App']['GetShortcuts']();
}
export function RemoveShortcut(arg1, arg2, arg3) {
return window['go']['main']['App']['RemoveShortcut'](arg1, arg2, arg3);
}
export function SaveClientStates(arg1) {
return window['go']['main']['App']['SaveClientStates'](arg1);
}
export function SaveGuiSettings(arg1) {
return window['go']['main']['App']['SaveGuiSettings'](arg1);
}
export function SelectDirectory() {
return window['go']['main']['App']['SelectDirectory']();
}
export function ToggleClient(arg1, arg2, arg3, arg4, arg5) {
return window['go']['main']['App']['ToggleClient'](arg1, arg2, arg3, arg4, arg5);
}
@@ -1,65 +0,0 @@
export namespace main {
export class ConnectionLog {
timestamp: string;
message: string;
type: string;
clientId: string;
static createFrom(source: any = {}) {
return new ConnectionLog(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.timestamp = source["timestamp"];
this.message = source["message"];
this.type = source["type"];
this.clientId = source["clientId"];
}
}
export class GuiSettings {
startupEnabled: boolean;
rememberClientState: boolean;
logDir: string;
themeMode: string;
static createFrom(source: any = {}) {
return new GuiSettings(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.startupEnabled = source["startupEnabled"];
this.rememberClientState = source["rememberClientState"];
this.logDir = source["logDir"];
this.themeMode = source["themeMode"];
}
}
export class ShortClient {
name: string;
addr: string;
key: string;
tls: boolean;
running: boolean;
error: string;
status: string;
static createFrom(source: any = {}) {
return new ShortClient(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.addr = source["addr"];
this.key = source["key"];
this.tls = source["tls"];
this.running = source["running"];
this.error = source["error"];
this.status = source["status"];
}
}
}
@@ -1,24 +0,0 @@
{
"name": "@wailsapp/runtime",
"version": "2.0.0",
"description": "Wails Javascript runtime library",
"main": "runtime.js",
"types": "runtime.d.ts",
"scripts": {
},
"repository": {
"type": "git",
"url": "git+https://github.com/wailsapp/wails.git"
},
"keywords": [
"Wails",
"Javascript",
"Go"
],
"author": "Lea Anthony <lea.anthony@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/wailsapp/wails/issues"
},
"homepage": "https://github.com/wailsapp/wails#readme"
}
-249
View File
@@ -1,249 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export interface Position {
x: number;
y: number;
}
export interface Size {
w: number;
h: number;
}
export interface Screen {
isCurrent: boolean;
isPrimary: boolean;
width : number
height : number
}
// Environment information such as platform, buildtype, ...
export interface EnvironmentInfo {
buildType: string;
platform: string;
arch: string;
}
// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
// emits the given event. Optional data may be passed with the event.
// This will trigger any event listeners.
export function EventsEmit(eventName: string, ...data: any): void;
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
// sets up a listener for the given event name, but will only trigger a given number times.
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
// sets up a listener for the given event name, but will only trigger once.
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
// unregisters the listener for the given event name.
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;
// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
// logs the given message at the `trace` log level.
export function LogTrace(message: string): void;
// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
// logs the given message at the `debug` log level.
export function LogDebug(message: string): void;
// [LogError](https://wails.io/docs/reference/runtime/log#logerror)
// logs the given message at the `error` log level.
export function LogError(message: string): void;
// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
// logs the given message at the `fatal` log level.
// The application will quit after calling this method.
export function LogFatal(message: string): void;
// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
// logs the given message at the `info` log level.
export function LogInfo(message: string): void;
// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
// logs the given message at the `warning` log level.
export function LogWarning(message: string): void;
// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
// Forces a reload by the main application as well as connected browsers.
export function WindowReload(): void;
// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
// Reloads the application frontend.
export function WindowReloadApp(): void;
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
// Sets the window AlwaysOnTop or not on top.
export function WindowSetAlwaysOnTop(b: boolean): void;
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
// *Windows only*
// Sets window theme to system default (dark/light).
export function WindowSetSystemDefaultTheme(): void;
// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
// *Windows only*
// Sets window to light theme.
export function WindowSetLightTheme(): void;
// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
// *Windows only*
// Sets window to dark theme.
export function WindowSetDarkTheme(): void;
// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
// Centers the window on the monitor the window is currently on.
export function WindowCenter(): void;
// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
// Sets the text in the window title bar.
export function WindowSetTitle(title: string): void;
// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
// Makes the window full screen.
export function WindowFullscreen(): void;
// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
// Restores the previous window dimensions and position prior to full screen.
export function WindowUnfullscreen(): void;
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
export function WindowIsFullscreen(): Promise<boolean>;
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
// Sets the width and height of the window.
export function WindowSetSize(width: number, height: number): void;
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
// Gets the width and height of the window.
export function WindowGetSize(): Promise<Size>;
// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
// Setting a size of 0,0 will disable this constraint.
export function WindowSetMaxSize(width: number, height: number): void;
// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
// Setting a size of 0,0 will disable this constraint.
export function WindowSetMinSize(width: number, height: number): void;
// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
// Sets the window position relative to the monitor the window is currently on.
export function WindowSetPosition(x: number, y: number): void;
// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
// Gets the window position relative to the monitor the window is currently on.
export function WindowGetPosition(): Promise<Position>;
// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
// Hides the window.
export function WindowHide(): void;
// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
// Shows the window, if it is currently hidden.
export function WindowShow(): void;
// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
// Maximises the window to fill the screen.
export function WindowMaximise(): void;
// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
// Toggles between Maximised and UnMaximised.
export function WindowToggleMaximise(): void;
// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
// Restores the window to the dimensions and position prior to maximising.
export function WindowUnmaximise(): void;
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
// Returns the state of the window, i.e. whether the window is maximised or not.
export function WindowIsMaximised(): Promise<boolean>;
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
// Minimises the window.
export function WindowMinimise(): void;
// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
// Restores the window to the dimensions and position prior to minimising.
export function WindowUnminimise(): void;
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
// Returns the state of the window, i.e. whether the window is minimised or not.
export function WindowIsMinimised(): Promise<boolean>;
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
// Returns the state of the window, i.e. whether the window is normal or not.
export function WindowIsNormal(): Promise<boolean>;
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
export function ScreenGetAll(): Promise<Screen[]>;
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
// Opens the given URL in the system browser.
export function BrowserOpenURL(url: string): void;
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
// Returns information about the environment
export function Environment(): Promise<EnvironmentInfo>;
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
// Quits the application.
export function Quit(): void;
// [Hide](https://wails.io/docs/reference/runtime/intro#hide)
// Hides the application.
export function Hide(): void;
// [Show](https://wails.io/docs/reference/runtime/intro#show)
// Shows the application.
export function Show(): void;
// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
// Returns the current text stored on clipboard
export function ClipboardGetText(): Promise<string>;
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
// Sets a text on the clipboard
export function ClipboardSetText(text: string): Promise<boolean>;
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
// OnFileDropOff removes the drag and drop listeners and handlers.
export function OnFileDropOff() :void
// Check if the file path resolver is available
export function CanResolveFilePaths(): boolean;
// Resolves file paths for an array of files
export function ResolveFilePaths(files: File[]): void
@@ -1,242 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
export function LogPrint(message) {
window.runtime.LogPrint(message);
}
export function LogTrace(message) {
window.runtime.LogTrace(message);
}
export function LogDebug(message) {
window.runtime.LogDebug(message);
}
export function LogInfo(message) {
window.runtime.LogInfo(message);
}
export function LogWarning(message) {
window.runtime.LogWarning(message);
}
export function LogError(message) {
window.runtime.LogError(message);
}
export function LogFatal(message) {
window.runtime.LogFatal(message);
}
export function EventsOnMultiple(eventName, callback, maxCallbacks) {
return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
}
export function EventsOn(eventName, callback) {
return EventsOnMultiple(eventName, callback, -1);
}
export function EventsOff(eventName, ...additionalEventNames) {
return window.runtime.EventsOff(eventName, ...additionalEventNames);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
return EventsOnMultiple(eventName, callback, 1);
}
export function EventsEmit(eventName) {
let args = [eventName].slice.call(arguments);
return window.runtime.EventsEmit.apply(null, args);
}
export function WindowReload() {
window.runtime.WindowReload();
}
export function WindowReloadApp() {
window.runtime.WindowReloadApp();
}
export function WindowSetAlwaysOnTop(b) {
window.runtime.WindowSetAlwaysOnTop(b);
}
export function WindowSetSystemDefaultTheme() {
window.runtime.WindowSetSystemDefaultTheme();
}
export function WindowSetLightTheme() {
window.runtime.WindowSetLightTheme();
}
export function WindowSetDarkTheme() {
window.runtime.WindowSetDarkTheme();
}
export function WindowCenter() {
window.runtime.WindowCenter();
}
export function WindowSetTitle(title) {
window.runtime.WindowSetTitle(title);
}
export function WindowFullscreen() {
window.runtime.WindowFullscreen();
}
export function WindowUnfullscreen() {
window.runtime.WindowUnfullscreen();
}
export function WindowIsFullscreen() {
return window.runtime.WindowIsFullscreen();
}
export function WindowGetSize() {
return window.runtime.WindowGetSize();
}
export function WindowSetSize(width, height) {
window.runtime.WindowSetSize(width, height);
}
export function WindowSetMaxSize(width, height) {
window.runtime.WindowSetMaxSize(width, height);
}
export function WindowSetMinSize(width, height) {
window.runtime.WindowSetMinSize(width, height);
}
export function WindowSetPosition(x, y) {
window.runtime.WindowSetPosition(x, y);
}
export function WindowGetPosition() {
return window.runtime.WindowGetPosition();
}
export function WindowHide() {
window.runtime.WindowHide();
}
export function WindowShow() {
window.runtime.WindowShow();
}
export function WindowMaximise() {
window.runtime.WindowMaximise();
}
export function WindowToggleMaximise() {
window.runtime.WindowToggleMaximise();
}
export function WindowUnmaximise() {
window.runtime.WindowUnmaximise();
}
export function WindowIsMaximised() {
return window.runtime.WindowIsMaximised();
}
export function WindowMinimise() {
window.runtime.WindowMinimise();
}
export function WindowUnminimise() {
window.runtime.WindowUnminimise();
}
export function WindowSetBackgroundColour(R, G, B, A) {
window.runtime.WindowSetBackgroundColour(R, G, B, A);
}
export function ScreenGetAll() {
return window.runtime.ScreenGetAll();
}
export function WindowIsMinimised() {
return window.runtime.WindowIsMinimised();
}
export function WindowIsNormal() {
return window.runtime.WindowIsNormal();
}
export function BrowserOpenURL(url) {
window.runtime.BrowserOpenURL(url);
}
export function Environment() {
return window.runtime.Environment();
}
export function Quit() {
window.runtime.Quit();
}
export function Hide() {
window.runtime.Hide();
}
export function Show() {
window.runtime.Show();
}
export function ClipboardGetText() {
return window.runtime.ClipboardGetText();
}
export function ClipboardSetText(text) {
return window.runtime.ClipboardSetText(text);
}
/**
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
*
* @export
* @callback OnFileDropCallback
* @param {number} x - x coordinate of the drop
* @param {number} y - y coordinate of the drop
* @param {string[]} paths - A list of file paths.
*/
/**
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
*
* @export
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
*/
export function OnFileDrop(callback, useDropTarget) {
return window.runtime.OnFileDrop(callback, useDropTarget);
}
/**
* OnFileDropOff removes the drag and drop listeners and handlers.
*/
export function OnFileDropOff() {
return window.runtime.OnFileDropOff();
}
export function CanResolveFilePaths() {
return window.runtime.CanResolveFilePaths();
}
export function ResolveFilePaths(files) {
return window.runtime.ResolveFilePaths(files);
}
+106 -100
View File
@@ -2,30 +2,30 @@
# yarn lockfile v1
"@babel/helper-string-parser@^7.27.1":
version "7.27.1"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687"
integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==
"@babel/helper-string-parser@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz#7f0871d99824d23137d60f86fcf6130fd5a1b51f"
integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==
"@babel/helper-validator-identifier@^7.28.5":
version "7.28.5"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4"
integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==
"@babel/helper-validator-identifier@^7.29.7":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2"
integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==
"@babel/parser@^7.28.5":
version "7.28.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.5.tgz#0b0225ee90362f030efd644e8034c99468893b08"
integrity sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==
"@babel/parser@^7.29.8":
version "7.29.8"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.8.tgz#9653716a2f10c677b98fbc63d4bfb000c302cf17"
integrity sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==
dependencies:
"@babel/types" "^7.28.5"
"@babel/types" "^7.29.8"
"@babel/types@^7.28.5":
version "7.28.5"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.5.tgz#10fc405f60897c35f07e85493c932c7b5ca0592b"
integrity sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==
"@babel/types@^7.29.8":
version "7.29.8"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.8.tgz#1229eef31d85156d70fa3f4cd859376d0eaf6863"
integrity sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==
dependencies:
"@babel/helper-string-parser" "^7.27.1"
"@babel/helper-validator-identifier" "^7.28.5"
"@babel/helper-string-parser" "^7.29.7"
"@babel/helper-validator-identifier" "^7.29.7"
"@esbuild/android-arm64@0.18.20":
version "0.18.20"
@@ -147,95 +147,101 @@
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-4.6.2.tgz#057d2ded94c4e71b94e9814f92dcd9306317aa46"
integrity sha512-kqf7SGFoG+80aZG6Pf+gsZIVvGSCKE98JbiWqcCV9cThtg91Jav0yvYFC9Zb+jKetNGF6ZKeoaxgZfND21fWKw==
"@vue/compiler-core@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.5.26.tgz#1a91ea90980528bedff7b1c292690bfb30612485"
integrity sha512-vXyI5GMfuoBCnv5ucIT7jhHKl55Y477yxP6fc4eUswjP8FG3FFVFd41eNDArR+Uk3QKn2Z85NavjaxLxOC19/w==
"@vue/compiler-core@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.5.41.tgz#82a4012d8b420f5a62c1658a72d16f7d1edf11aa"
integrity sha512-q0Xtv/F9w2YO/7htQhtiL+Ev2WCJbe5N2hc+XfgyKkEKqWpSxknmT8QOuGdEKNdjPq0c3F7rNpFkTo3Kfrm7pg==
dependencies:
"@babel/parser" "^7.28.5"
"@vue/shared" "3.5.26"
entities "^7.0.0"
"@babel/parser" "^7.29.8"
"@vue/shared" "3.5.41"
entities "^7.0.1"
estree-walker "^2.0.2"
source-map-js "^1.2.1"
"@vue/compiler-dom@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.5.26.tgz#66c36b6ed8bdf43236d7188ea332bc9d078eb286"
integrity sha512-y1Tcd3eXs834QjswshSilCBnKGeQjQXB6PqFn/1nxcQw4pmG42G8lwz+FZPAZAby6gZeHSt/8LMPfZ4Rb+Bd/A==
"@vue/compiler-dom@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.5.41.tgz#1029f75de09c665a0a92c6156463754192acb361"
integrity sha512-oKacVfNglLvGjnS6BXOlGL7EyG2h8X03pqXCjzotRZUaXGjbrTJUnVAQjrCqUnS+lyu31nwQjZY/d817GmCnfw==
dependencies:
"@vue/compiler-core" "3.5.26"
"@vue/shared" "3.5.26"
"@vue/compiler-core" "3.5.41"
"@vue/shared" "3.5.41"
"@vue/compiler-sfc@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.5.26.tgz#fb1c6c4bf9a9e22bb169e039e19437cb6995917a"
integrity sha512-egp69qDTSEZcf4bGOSsprUr4xI73wfrY5oRs6GSgXFTiHrWj4Y3X5Ydtip9QMqiCMCPVwLglB9GBxXtTadJ3mA==
"@vue/compiler-sfc@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.5.41.tgz#f9c7c2170ad6ee4bf35c178b5df026485d8a63db"
integrity sha512-XJhip7R2wy6vX3knCxdZN4KracFaZUef58s1KYewqluedHIJaPIVfXoYT7MF1F8nCvv6k8bWWxDC8opMkg1VTQ==
dependencies:
"@babel/parser" "^7.28.5"
"@vue/compiler-core" "3.5.26"
"@vue/compiler-dom" "3.5.26"
"@vue/compiler-ssr" "3.5.26"
"@vue/shared" "3.5.26"
"@babel/parser" "^7.29.8"
"@vue/compiler-core" "3.5.41"
"@vue/compiler-dom" "3.5.41"
"@vue/compiler-ssr" "3.5.41"
"@vue/shared" "3.5.41"
estree-walker "^2.0.2"
magic-string "^0.30.21"
postcss "^8.5.6"
postcss "^8.5.19"
source-map-js "^1.2.1"
"@vue/compiler-ssr@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.5.26.tgz#f6e94bccbb5339180779036ddfb614f998a197ea"
integrity sha512-lZT9/Y0nSIRUPVvapFJEVDbEXruZh2IYHMk2zTtEgJSlP5gVOqeWXH54xDKAaFS4rTnDeDBQUYDtxKyoW9FwDw==
"@vue/compiler-ssr@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.5.41.tgz#8e5f9f6a8d21b802fce7373807dd935ed4541083"
integrity sha512-U3v5OejKEGqOI0Wy0+Sz7hGuIFZHA4LSXzrNM3IMIeDyJEBBfTpX26n3SDgToRpP2bLc9FfI2j/kSgcJ8Emq5A==
dependencies:
"@vue/compiler-dom" "3.5.26"
"@vue/shared" "3.5.26"
"@vue/compiler-dom" "3.5.41"
"@vue/shared" "3.5.41"
"@vue/reactivity@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.5.26.tgz#59a1edf566dc80133c1c26c93711c877e8602c48"
integrity sha512-9EnYB1/DIiUYYnzlnUBgwU32NNvLp/nhxLXeWRhHUEeWNTn1ECxX8aGO7RTXeX6PPcxe3LLuNBFoJbV4QZ+CFQ==
"@vue/reactivity@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.5.41.tgz#83be61b88b198f21c157d3aa6dcb843a25a11872"
integrity sha512-rznsqKM0np0x18EjzF8x88MpEhdNsffbvFbckLL5+oUKz1BxAImEmO7J1ArRYSyo6aQaVoBDp7jEkT91OOxydA==
dependencies:
"@vue/shared" "3.5.26"
"@vue/shared" "3.5.41"
"@vue/runtime-core@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.5.26.tgz#3f2c040bcf8018c03a1ab5adb0d788c13c986f0e"
integrity sha512-xJWM9KH1kd201w5DvMDOwDHYhrdPTrAatn56oB/LRG4plEQeZRQLw0Bpwih9KYoqmzaxF0OKSn6swzYi84e1/Q==
"@vue/runtime-core@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.5.41.tgz#a3e023c9f21809c81f24813dacb7ffa18a2e4161"
integrity sha512-Vcry58hiAKwGen9Z1jUZE0feFsNArPCMOImYI8el48A9Idf6DuQYD0U05zZIF2Iad1hGhPSvcbBbAOhNr55fhg==
dependencies:
"@vue/reactivity" "3.5.26"
"@vue/shared" "3.5.26"
"@vue/reactivity" "3.5.41"
"@vue/shared" "3.5.41"
"@vue/runtime-dom@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.5.26.tgz#5954848614883948ecc1f631a67b32cc32f81936"
integrity sha512-XLLd/+4sPC2ZkN/6+V4O4gjJu6kSDbHAChvsyWgm1oGbdSO3efvGYnm25yCjtFm/K7rrSDvSfPDgN1pHgS4VNQ==
"@vue/runtime-dom@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.5.41.tgz#428f7a0420402385fae17d413d25169f98f64205"
integrity sha512-3vVBahVBS9+U6cmXBLyb8nE6/yYo4J/CGI9eVFs3KiMc0YHuudwKyShTD65jtJy/L9PUUxNAFu4cj4LiJ0UFbw==
dependencies:
"@vue/reactivity" "3.5.26"
"@vue/runtime-core" "3.5.26"
"@vue/shared" "3.5.26"
"@vue/reactivity" "3.5.41"
"@vue/runtime-core" "3.5.41"
"@vue/shared" "3.5.41"
csstype "^3.2.3"
"@vue/server-renderer@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.5.26.tgz#269055497fcc75b3984063f866f17c748b565ef4"
integrity sha512-TYKLXmrwWKSodyVuO1WAubucd+1XlLg4set0YoV+Hu8Lo79mp/YMwWV5mC5FgtsDxX3qo1ONrxFaTP1OQgy1uA==
"@vue/server-renderer@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.5.41.tgz#035a38c79182f154495238ea83acba24266ac200"
integrity sha512-n6hx/pNFfbD6SuyeuMVkvqox8bwf/ET9JlA/kAz/imw8sw++wkqKe2mHX5KutjPpbKE4Z56yTHszoOjGMI9igQ==
dependencies:
"@vue/compiler-ssr" "3.5.26"
"@vue/shared" "3.5.26"
"@vue/compiler-ssr" "3.5.41"
"@vue/runtime-dom" "3.5.41"
"@vue/shared" "3.5.41"
"@vue/shared@3.5.26":
version "3.5.26"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.5.26.tgz#1e02ef2d64aced818cd31d81ce5175711dc90a9f"
integrity sha512-7Z6/y3uFI5PRoKeorTOSXKcDj0MSasfNNltcslbFrPpcw6aXRUALq4IfJlaTRspiWIUOEZbrpM+iQGmCOiWe4A==
"@vue/shared@3.5.41":
version "3.5.41"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.5.41.tgz#ac476497f74495f7525087270849841756555cf2"
integrity sha512-IOnwSCma8j+9xJT6b8H0dEYidC80NsYmNMlZxRsukYcSoGaDBohog5hDxzeUXdFeGWFA++vWvxqOmrr96VlqMA==
"@wailsio/runtime@^3.0.0-beta.12":
version "3.0.0-beta.12"
resolved "https://registry.yarnpkg.com/@wailsio/runtime/-/runtime-3.0.0-beta.12.tgz#0fb8347441271fae40f59641fd9f66b56561b5bc"
integrity sha512-2B456rspX5rDXYhNjRqXNDOPkRXjletGJ4R3beF2FGs7K67MTovLy9acXHYb8nolzL96kygyJ622RIjB45oumg==
csstype@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.2.3.tgz#ec48c0f3e993e50648c86da559e2610995cf989a"
integrity sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==
entities@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/entities/-/entities-7.0.0.tgz#2ae4e443f3f17d152d3f5b0f79b932c1e59deb7a"
integrity sha512-FDWG5cmEYf2Z00IkYRhbFrwIwvdFKH07uV8dvNy0omp/Qb1xcyCWp2UDtcwJF4QZZvk0sLudP6/hAu42TaqVhQ==
entities@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/entities/-/entities-7.0.1.tgz#26e8a88889db63417dcb9a1e79a3f1bc92b5976b"
integrity sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==
esbuild@^0.18.10:
version "0.18.20"
@@ -282,29 +288,29 @@ magic-string@^0.30.21:
dependencies:
"@jridgewell/sourcemap-codec" "^1.5.5"
nanoid@^3.3.11:
version "3.3.11"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b"
integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==
nanoid@^3.3.17:
version "3.3.18"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.18.tgz#f66a2de1199ffde0fcf21c8a5f13106b1c081913"
integrity sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==
picocolors@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
postcss@^8.4.27, postcss@^8.5.6:
version "8.5.6"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c"
integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==
postcss@^8.4.27, postcss@^8.5.19:
version "8.5.26"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.26.tgz#6e75135780c7e10df3433bf2266c552d35c8c620"
integrity sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==
dependencies:
nanoid "^3.3.11"
nanoid "^3.3.17"
picocolors "^1.1.1"
source-map-js "^1.2.1"
rollup@^3.27.1:
version "3.29.5"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.5.tgz#8a2e477a758b520fb78daf04bca4c522c1da8a54"
integrity sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==
version "3.30.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.30.0.tgz#3fa506fee2c5ba9d540a38da87067376cd55966d"
integrity sha512-kQvGasUgN+AlWGliFn2POSajRQEsULVYFGTvOZmK06d7vCD+YhZztt70kGk3qaeAXeWYL5eO7zx+rAubBc55eA==
optionalDependencies:
fsevents "~2.3.2"
@@ -325,12 +331,12 @@ vite@^4.3.9:
fsevents "~2.3.2"
vue@^3.3.4:
version "3.5.26"
resolved "https://registry.yarnpkg.com/vue/-/vue-3.5.26.tgz#03a0b17311e0e593d34b9358fa249b85e3a6d9fb"
integrity sha512-SJ/NTccVyAoNUJmkM9KUqPcYlY+u8OVL1X5EW9RIs3ch5H2uERxyyIUI4MRxVCSOiEcupX9xNGde1tL9ZKpimA==
version "3.5.41"
resolved "https://registry.yarnpkg.com/vue/-/vue-3.5.41.tgz#8864bddfe59ce128a28c9bad219cd9248916af73"
integrity sha512-2laE0p+aK+/AOPG/XL/WepOs/GlK755LJ1XECi9kDUrz1FKNw8rb2Xzlw9JS1rqEV55nb0ttsKxVlTCcd+R5cg==
dependencies:
"@vue/compiler-dom" "3.5.26"
"@vue/compiler-sfc" "3.5.26"
"@vue/runtime-dom" "3.5.26"
"@vue/server-renderer" "3.5.26"
"@vue/shared" "3.5.26"
"@vue/compiler-dom" "3.5.41"
"@vue/compiler-sfc" "3.5.41"
"@vue/runtime-dom" "3.5.41"
"@vue/server-renderer" "3.5.41"
"@vue/shared" "3.5.41"
+17 -32
View File
@@ -1,15 +1,12 @@
module npc-gui
go 1.24.0
toolchain go1.24.9
go 1.25.0
require (
ehang.io/nps v0.0.0-00010101000000-000000000000
github.com/astaxie/beego v1.12.3
github.com/energye/systray v1.0.2
github.com/wailsapp/wails/v2 v2.11.0
golang.org/x/sys v0.30.0
github.com/wailsapp/wails/v3 v3.0.0-beta.12
golang.org/x/sys v0.46.0
)
// 使用本地路径替代依赖
@@ -19,50 +16,38 @@ replace (
)
require (
github.com/bep/debounce v1.2.1 // indirect
github.com/adrg/xdg v0.5.3 // indirect
github.com/coder/websocket v1.8.14 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/godbus/dbus/v5 v5.2.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
github.com/klauspost/cpuid/v2 v2.0.6 // indirect
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/klauspost/reedsolomon v1.9.12 // indirect
github.com/labstack/echo/v4 v4.13.3 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
github.com/leaanthony/gosod v1.0.4 // indirect
github.com/leaanthony/slicer v1.6.0 // indirect
github.com/leaanthony/u v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/panjf2000/ants/v2 v2.4.2 // indirect
github.com/pires/go-proxyproto v0.8.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/samber/lo v1.49.1 // indirect
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
github.com/shirou/gopsutil/v3 v3.23.10 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/shoenig/go-m1cpu v0.2.2 // indirect
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c // indirect
github.com/tjfoc/gmsm v1.4.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tkrajina/go-reflector v0.5.8 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.22 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
github.com/xtaci/kcp-go v5.4.20+incompatible // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/text v0.22.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/crypto v0.53.0 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/text v0.39.0 // indirect
golang.org/x/time v0.14.0 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
+37 -73
View File
@@ -2,19 +2,22 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/OwnLocal/goes v1.0.0/go.mod h1:8rIFjBGTue3lCU0wplczcUgt9Gxgrkkrw7etMIcn8TM=
github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78=
github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
github.com/couchbase/go-couchbase v0.0.0-20181122212707-3e9b6e1258bb/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
github.com/couchbase/gomemcached v0.0.0-20181122193126-5125a94a666c/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -22,21 +25,20 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/energye/systray v1.0.2 h1:63R4prQkANtpM2CIA4UrDCuwZFt+FiygG77JYCsNmXc=
github.com/energye/systray v1.0.2/go.mod h1:sp7Q/q/I4/w5ebvpSuJVep71s9Bg7L9ZVp69gBASehM=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/exfly/beego v1.12.0-export-init h1:VQNYKdXhAwZGUaFmQv8Aj921O3rQJZRIF8xeGrhsjrI=
github.com/exfly/beego v1.12.0-export-init/go.mod h1:fysx+LZNZKnvh4GED/xND7jWtjCR6HzydR2Hh2Im57o=
github.com/go-json-experiment/json v0.0.0-20251027170946-4849db3c2f7e h1:Lf/gRkoycfOBPa42vU2bbgPurFong6zXeFtPoxholzU=
github.com/go-json-experiment/json v0.0.0-20251027170946-4849db3c2f7e/go.mod h1:uNVvRXArCGbZ508SxYYTC5v1JWoz2voff5pm25jU1Ok=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
@@ -59,44 +61,29 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 h1:njuLRcjAuMKr7kI3D85AXWkw6/+v9PwtV6M6o11sWHQ=
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/klauspost/cpuid/v2 v2.0.2/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.6 h1:dQ5ueTiftKxp0gyjKSx5+8BtPWkyQbd95m8Gys/RarI=
github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/klauspost/reedsolomon v1.9.12 h1:EyOucRmcrLH+2hqKGdoA5SM8pwPKR6BJsf3r6zpYOA0=
github.com/klauspost/reedsolomon v1.9.12/go.mod h1:nLvuzNvy1ZDNQW30IuMc2ZWCbiqrJgdLoUS2X8HAUVg=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
github.com/leaanthony/go-ansi-parser v1.6.1/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
github.com/leaanthony/gosod v1.0.4 h1:YLAbVyd591MRffDgxUOU1NwLhT9T1/YiwjKZpkNFeaI=
github.com/leaanthony/gosod v1.0.4/go.mod h1:GKuIL0zzPj3O1SdWQOdgURSuhkF+Urizzxh26t9f1cw=
github.com/leaanthony/slicer v1.6.0 h1:1RFP5uiPJvT93TAHi+ipd3NACobkW53yUiBqZheE/Js=
github.com/leaanthony/slicer v1.6.0/go.mod h1:o/Iz29g7LN0GqH3aMjWAe90381nyZlDNquK+mtH2Fj8=
github.com/leaanthony/u v1.1.1 h1:TUFjwDGlNX+WuwVEzDqQwC2lOv0P4uhTQw7CMFdiK7M=
github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
@@ -107,8 +94,6 @@ github.com/panjf2000/ants/v2 v2.4.2/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OI
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pires/go-proxyproto v0.8.0 h1:5unRmEAPbHXHuLjDg01CxJWf91cw3lKHc/0xzKpXEe0=
github.com/pires/go-proxyproto v0.8.0/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -117,19 +102,16 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/shirou/gopsutil/v3 v3.23.10 h1:/N42opWlYzegYaVkWejXWJpbzKv2JDy3mrgGzKsh9hM=
github.com/shirou/gopsutil/v3 v3.23.10/go.mod h1:JIE26kpucQi+innVlAUnIEOSBhBUkirr5b44yr55+WE=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/go-m1cpu v0.2.2 h1:4nc55oVv7nygGnfI9bhLCLzUEs4794y0Bkqx4q2zy7Y=
github.com/shoenig/go-m1cpu v0.2.2/go.mod h1:KkDOw6m3ZJQAPHbrzkZki4hnx+pDRR1Lo+ldA56wD5w=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
github.com/shoenig/test v1.7.0 h1:eWcHtTXa6QLnBvm0jgEabMRN/uJ4DMV3M8xUGgRkZmk=
github.com/shoenig/test v1.7.0/go.mod h1:UxJ6u/x2v/TNs/LoLxBNJRV9DiwBBKYxXSyczsBHFoI=
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
@@ -141,46 +123,35 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b h1:fj5tQ8acgNUr6O8LEplsxDhUIe2573iLkJc+PqnzZTI=
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c h1:coVla7zpsycc+kA9NXpcvv2E4I7+ii6L5hZO2S6C3kw=
github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c/go.mod h1:qc66Pna1RiIsPa7O4Egxxs9OqkuxDX55zznh9K07Tzg=
github.com/tjfoc/gmsm v1.4.0 h1:8nbaiZG+iVdh+fXVw0DZoZZa7a4TGm3Qab+xdrdzj8s=
github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/tkrajina/go-reflector v0.5.8 h1:yPADHrwmUbMq4RGEyaOUpz2H90sRsETNVpjzo3DLVQQ=
github.com/tkrajina/go-reflector v0.5.8/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/wailsapp/go-webview2 v1.0.22 h1:YT61F5lj+GGaat5OB96Aa3b4QA+mybD0Ggq6NZijQ58=
github.com/wailsapp/go-webview2 v1.0.22/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wailsapp/wails/v2 v2.11.0 h1:seLacV8pqupq32IjS4Y7V8ucab0WZwtK6VvUVxSBtqQ=
github.com/wailsapp/wails/v2 v2.11.0/go.mod h1:jrf0ZaM6+GBc1wRmXsM8cIvzlg0karYin3erahI4+0k=
github.com/wailsapp/wails/v3 v3.0.0-beta.12 h1:Vema2kFgJvkwPovQ8GMBBrkZNm5cKVR4bYzSCMgU+PU=
github.com/wailsapp/wails/v3 v3.0.0-beta.12/go.mod h1:zKZYhB3WjrN5LhJWbnOAVMN0Xf8qTozbw2nf5micKl4=
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
github.com/xtaci/kcp-go v5.4.20+incompatible h1:TN1uey3Raw0sTz0Fg8GkfM0uH3YwzhnZWQ1bABv5xAg=
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae h1:J0GxkO96kL4WF+AIT3M4mfUVinOCPgf2uUWYFUzN0sM=
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto=
golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@@ -192,9 +163,8 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o=
golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -203,26 +173,20 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus=
golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM=
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+310
View File
@@ -0,0 +1,310 @@
package main
import (
"bufio"
"encoding/json"
"fmt"
"io"
"log/slog"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/astaxie/beego/logs"
)
const (
// logBufferCap 每个客户端内存中最多保留的日志条数
logBufferCap = 3000
// logFileMaxSize 单个日志文件超过该大小后轮转(5MB)
logFileMaxSize = 5 << 20
// logFileMaxBackups 轮转时最多保留的历史文件个数(.1 .2 .3)
logFileMaxBackups = 3
)
// initAppLogger 初始化 GUI 自身的日志系统。
// - 全局 beego logger 仍切到 store,避免客户端库的全局日志刷屏控制台(保持原有行为)
// - 应用自身日志使用 slog(JSON),同时写入 logs/npc-gui.log 与控制台
func initAppLogger() {
_ = logs.SetLogger("store")
logs.SetLevel(logs.LevelDebug)
var w io.Writer = os.Stderr
if fw, err := newRotatingFileWriter(filepath.Join(getLogsPath(), "npc-gui.log")); err == nil {
w = io.MultiWriter(fw, os.Stderr)
}
logger := slog.New(slog.NewJSONHandler(w, &slog.HandlerOptions{Level: slog.LevelDebug}))
slog.SetDefault(logger)
}
// rotatingFileWriter 带大小轮转的日志文件写入器(线程安全)。
// 写入超过 maxSize 时把当前文件顺延为 .1 .2 ...,保留 maxBackups 份历史。
type rotatingFileWriter struct {
mu sync.Mutex
path string
maxSize int64
maxBackups int
file *os.File
size int64
}
func newRotatingFileWriter(path string) (*rotatingFileWriter, error) {
w := &rotatingFileWriter{path: path, maxSize: logFileMaxSize, maxBackups: logFileMaxBackups}
if err := w.open(); err != nil {
return nil, err
}
return w, nil
}
func (w *rotatingFileWriter) open() error {
f, err := os.OpenFile(w.path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644)
if err != nil {
return err
}
st, err := f.Stat()
if err != nil {
_ = f.Close()
return err
}
w.file = f
w.size = st.Size()
return nil
}
func (w *rotatingFileWriter) Write(p []byte) (int, error) {
w.mu.Lock()
defer w.mu.Unlock()
if w.file == nil {
if err := w.open(); err != nil {
return 0, err
}
}
if w.size > 0 && w.size+int64(len(p)) > w.maxSize {
w.rotateLocked()
}
n, err := w.file.Write(p)
w.size += int64(n)
return n, err
}
func (w *rotatingFileWriter) rotateLocked() {
_ = w.file.Close()
w.file = nil
for i := w.maxBackups - 1; i >= 1; i-- {
src := fmt.Sprintf("%s.%d", w.path, i)
if _, err := os.Stat(src); err == nil {
_ = os.Remove(fmt.Sprintf("%s.%d", w.path, i+1))
_ = os.Rename(src, fmt.Sprintf("%s.%d", w.path, i+1))
}
}
_ = os.Remove(w.path + ".1")
_ = os.Rename(w.path, w.path+".1")
w.size = 0
_ = w.open()
}
// truncate 清空当前文件内容
func (w *rotatingFileWriter) truncate() error {
w.mu.Lock()
defer w.mu.Unlock()
if w.file != nil {
_ = w.file.Close()
w.file = nil
}
f, err := os.Create(w.path)
if err != nil {
return err
}
w.file = f
w.size = 0
return nil
}
func (w *rotatingFileWriter) Close() error {
w.mu.Lock()
defer w.mu.Unlock()
if w.file != nil {
err := w.file.Close()
w.file = nil
return err
}
return nil
}
// ringBuffer 固定容量的环形日志缓冲
type ringBuffer struct {
buf []ConnectionLog
start int
count int
}
func newRingBuffer(cap int) *ringBuffer {
return &ringBuffer{buf: make([]ConnectionLog, cap)}
}
func (r *ringBuffer) add(e ConnectionLog) {
if r.count == len(r.buf) {
r.buf[r.start] = e
r.start = (r.start + 1) % len(r.buf)
} else {
r.buf[(r.start+r.count)%len(r.buf)] = e
r.count++
}
}
func (r *ringBuffer) all() []ConnectionLog {
out := make([]ConnectionLog, 0, r.count)
for i := 0; i < r.count; i++ {
out = append(out, r.buf[(r.start+i)%len(r.buf)])
}
return out
}
func (r *ringBuffer) reset() {
r.start = 0
r.count = 0
}
// clientLogStore 单个客户端的日志存储:内存环形缓冲 + JSON Lines 文件持久化。
// UI 直接读取内存缓冲,不再解析日志文件文本。
type clientLogStore struct {
mu sync.Mutex
clientId string
ring *ringBuffer
file *rotatingFileWriter
}
func newClientLogStore(clientId string) *clientLogStore {
s := &clientLogStore{
clientId: clientId,
ring: newRingBuffer(logBufferCap),
}
if fw, err := newRotatingFileWriter(getClientLogFilePath(clientId)); err == nil {
s.file = fw
s.loadHistoryLocked()
}
return s
}
// loadHistoryLocked 启动时把已有日志文件尾部的 JSON 行载入内存缓冲(跨重启保留历史)。
func (s *clientLogStore) loadHistoryLocked() {
data, err := os.ReadFile(s.file.path)
if err != nil {
return
}
sc := bufio.NewScanner(strings.NewReader(string(data)))
sc.Buffer(make([]byte, 1024*1024), 1024*1024)
var lines []string
for sc.Scan() {
line := strings.TrimSpace(sc.Text())
if line == "" {
continue
}
lines = append(lines, line)
}
if len(lines) > logBufferCap {
lines = lines[len(lines)-logBufferCap:]
}
for _, line := range lines {
var e ConnectionLog
if json.Unmarshal([]byte(line), &e) == nil && e.Message != "" {
s.ring.add(e)
}
}
}
// log 写入一条日志:先入内存缓冲,再持久化到 JSON Lines 文件。
func (s *clientLogStore) log(level, format string, v ...interface{}) {
msg := fmt.Sprintf(format, v...)
logType := level
if level == "info" && isSuccessMessage(msg) {
logType = "success"
}
e := ConnectionLog{
Timestamp: time.Now().Format("2006-01-02 15:04:05"),
Message: msg,
Type: logType,
ClientId: s.clientId,
}
s.mu.Lock()
defer s.mu.Unlock()
s.ring.add(e)
if s.file != nil {
if line, err := json.Marshal(e); err == nil {
_, _ = s.file.Write(append(line, '\n'))
}
}
}
func (s *clientLogStore) snapshot() []ConnectionLog {
s.mu.Lock()
defer s.mu.Unlock()
return s.ring.all()
}
func (s *clientLogStore) clear() error {
s.mu.Lock()
defer s.mu.Unlock()
s.ring.reset()
if s.file != nil {
return s.file.truncate()
}
return nil
}
func (s *clientLogStore) close() {
s.mu.Lock()
defer s.mu.Unlock()
if s.file != nil {
_ = s.file.Close()
s.file = nil
}
}
var (
logStoresMu sync.Mutex
logStores = make(map[string]*clientLogStore)
)
// getClientLogStore 获取客户端的日志存储(懒创建,未启动也能查看历史日志)
func getClientLogStore(clientId string) *clientLogStore {
logStoresMu.Lock()
defer logStoresMu.Unlock()
if s, ok := logStores[clientId]; ok {
return s
}
s := newClientLogStore(clientId)
logStores[clientId] = s
return s
}
// closeAllLogStores 应用退出时关闭所有日志文件
func closeAllLogStores() {
logStoresMu.Lock()
defer logStoresMu.Unlock()
for id, s := range logStores {
s.close()
delete(logStores, id)
}
}
// trpcLogger 把 client.Logger 桥接到 clientLogStore,供 TRPClient 使用。
// Trace 级别与原先 beego(LevelDebug) 行为一致,不落盘。
type trpcLogger struct {
store *clientLogStore
}
func (l *trpcLogger) Info(format string, v ...interface{}) { l.store.log("info", format, v...) }
func (l *trpcLogger) Error(format string, v ...interface{}) { l.store.log("error", format, v...) }
func (l *trpcLogger) Warn(format string, v ...interface{}) { l.store.log("warning", format, v...) }
func (l *trpcLogger) Trace(format string, v ...interface{}) {}
// isSuccessMessage 判断是否为“成功”类日志(用于 UI 高亮)
func isSuccessMessage(msg string) bool {
lower := strings.ToLower(msg)
return strings.Contains(msg, "成功") ||
strings.Contains(lower, "success") ||
strings.Contains(lower, "connected")
}
+120
View File
@@ -0,0 +1,120 @@
package main
import (
"os"
"path/filepath"
"testing"
)
func TestRingBuffer(t *testing.T) {
r := newRingBuffer(3)
r.add(ConnectionLog{Message: "1"})
r.add(ConnectionLog{Message: "2"})
r.add(ConnectionLog{Message: "3"})
r.add(ConnectionLog{Message: "4"})
all := r.all()
if len(all) != 3 || all[0].Message != "2" || all[2].Message != "4" {
t.Fatalf("unexpected ring buffer contents: %v", all)
}
r.reset()
if len(r.all()) != 0 {
t.Fatal("reset failed")
}
}
func TestRotatingFileWriterRotation(t *testing.T) {
path := filepath.Join(t.TempDir(), "test.log")
w, err := newRotatingFileWriter(path)
if err != nil {
t.Fatal(err)
}
defer w.Close()
w.maxSize = 10
w.maxBackups = 2
for i := 0; i < 20; i++ {
if _, err := w.Write([]byte("0123456789\n")); err != nil {
t.Fatal(err)
}
}
if _, err := os.Stat(path + ".1"); err != nil {
t.Fatal("missing .1 backup:", err)
}
if _, err := os.Stat(path + ".2"); err != nil {
t.Fatal("missing .2 backup:", err)
}
if err := w.truncate(); err != nil {
t.Fatal(err)
}
if st, err := os.Stat(path); err != nil || st.Size() != 0 {
t.Fatal("truncate failed")
}
}
func TestClientLogStore(t *testing.T) {
path := filepath.Join(t.TempDir(), "client.log")
fw, err := newRotatingFileWriter(path)
if err != nil {
t.Fatal(err)
}
store := &clientLogStore{clientId: "test", ring: newRingBuffer(logBufferCap), file: fw}
defer fw.Close()
store.log("info", "hello %s", "world")
store.log("error", "boom")
store.log("info", "连接成功")
snap := store.snapshot()
if len(snap) != 3 {
t.Fatalf("expected 3 logs, got %d", len(snap))
}
if snap[0].Type != "info" || snap[0].Message != "hello world" {
t.Fatalf("bad entry: %+v", snap[0])
}
if snap[1].Type != "error" {
t.Fatalf("bad type: %+v", snap[1])
}
if snap[2].Type != "success" {
t.Fatalf("expected success type, got %+v", snap[2])
}
// 从文件恢复历史
fw2, err := newRotatingFileWriter(path)
if err != nil {
t.Fatal(err)
}
store2 := &clientLogStore{clientId: "test", ring: newRingBuffer(logBufferCap), file: fw2}
defer fw2.Close()
store2.loadHistoryLocked()
snap2 := store2.snapshot()
if len(snap2) != 3 {
t.Fatalf("expected 3 logs after reload, got %d", len(snap2))
}
if snap2[0].Message != "hello world" || snap2[2].Type != "success" {
t.Fatalf("bad reloaded entries: %+v", snap2)
}
// 清空
if err := store.clear(); err != nil {
t.Fatal(err)
}
if len(store.snapshot()) != 0 {
t.Fatal("clear failed")
}
if st, err := os.Stat(path); err != nil || st.Size() != 0 {
t.Fatal("file not truncated after clear")
}
}
func TestIsSuccessMessage(t *testing.T) {
cases := map[string]bool{
"客户端连接成功": true,
"Successful connection with server": true,
"connection failed": false,
"启动 NPC 客户端": false,
}
for msg, want := range cases {
if got := isSuccessMessage(msg); got != want {
t.Fatalf("isSuccessMessage(%q) = %v, want %v", msg, got, want)
}
}
}
+37 -44
View File
@@ -1,65 +1,58 @@
package main
import (
"context"
"embed"
"io/fs"
"log"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/windows"
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
)
//go:embed all:frontend/dist
var embeddedFiles embed.FS
var assets embed.FS
//go:embed build/appicon.png
var trayIcon []byte
//go:embed build/appicon.ico
var trayIconICO []byte
func main() {
app := NewApp()
// Asset server expects the FS root to contain index.html — create a sub FS
assets, err := fs.Sub(embeddedFiles, "frontend/dist")
if err != nil {
panic(err)
}
runErr := wails.Run(&options.App{
Title: "NPS 客户端",
Width: 1000,
Height: 600,
MinWidth: 1000,
MinHeight: 600,
AssetServer: &assetserver.Options{
Assets: assets,
app := application.New(application.Options{
Name: "NPS 客户端",
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
OnShutdown: app.shutdown,
OnBeforeClose: func(ctx context.Context) bool {
if isQuitting() {
return false
}
wailsRuntime.Hide(ctx)
return true
Windows: application.WindowsOptions{
DisableQuitOnLastWindowClosed: true,
},
Bind: []interface{}{
app,
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: false,
},
Windows: &windows.Options{
WebviewIsTransparent: false,
WindowIsTranslucent: false,
Linux: application.LinuxOptions{
DisableQuitOnLastWindowClosed: true,
},
})
if runErr != nil {
panic(runErr)
window := app.Window.NewWithOptions(application.WebviewWindowOptions{
Name: "main",
Title: "NPS 客户端",
Width: 1000,
Height: 600,
MinWidth: 1000,
MinHeight: 600,
BackgroundColour: application.NewRGB(27, 38, 54),
})
// 点击关闭按钮时隐藏窗口而不是退出(托盘应用常驻)
window.RegisterHook(events.Common.WindowClosing, func(event *application.WindowEvent) {
if isQuitting() {
return
}
event.Cancel()
window.Hide()
})
app.RegisterService(application.NewService(NewApp(app, window)))
if runErr := app.Run(); runErr != nil {
log.Fatal(runErr)
}
}
+4 -5
View File
@@ -4,10 +4,9 @@ package main
import (
"fmt"
"log/slog"
"os"
"path/filepath"
"github.com/astaxie/beego/logs"
)
const (
@@ -66,7 +65,7 @@ func enableStartupImpl() error {
return fmt.Errorf("写入 plist 文件失败: %v", err)
}
logs.Info("成功添加开机启动项: %s -> %s", appName, plistPath)
slog.Info("成功添加开机启动项", "app", appName, "path", plistPath)
return nil
}
@@ -80,13 +79,13 @@ func disableStartupImpl() error {
// 删除 plist 文件
if err := os.Remove(plistPath); err != nil {
if os.IsNotExist(err) {
logs.Info("开机启动项不存在,无需删除")
slog.Info("开机启动项不存在,无需删除")
return nil
}
return fmt.Errorf("删除 plist 文件失败: %v", err)
}
logs.Info("成功删除开机启动项: %s", plistPath)
slog.Info("成功删除开机启动项", "path", plistPath)
return nil
}
+4 -5
View File
@@ -4,10 +4,9 @@ package main
import (
"fmt"
"log/slog"
"os"
"path/filepath"
"github.com/astaxie/beego/logs"
)
const (
@@ -65,7 +64,7 @@ func enableStartupImpl() error {
return fmt.Errorf("写入 desktop 文件失败: %v", err)
}
logs.Info("成功添加开机启动项: %s -> %s", appName, desktopPath)
slog.Info("成功添加开机启动项", "app", appName, "path", desktopPath)
return nil
}
@@ -79,13 +78,13 @@ func disableStartupImpl() error {
// 删除 .desktop 文件
if err := os.Remove(desktopPath); err != nil {
if os.IsNotExist(err) {
logs.Info("开机启动项不存在,无需删除")
slog.Info("开机启动项不存在,无需删除")
return nil
}
return fmt.Errorf("删除 desktop 文件失败: %v", err)
}
logs.Info("成功删除开机启动项: %s", desktopPath)
slog.Info("成功删除开机启动项", "path", desktopPath)
return nil
}
+4 -4
View File
@@ -4,8 +4,8 @@ package main
import (
"fmt"
"log/slog"
"github.com/astaxie/beego/logs"
"golang.org/x/sys/windows/registry"
)
@@ -32,7 +32,7 @@ func enableStartupImpl() error {
return fmt.Errorf("设置注册表值失败: %v", err)
}
logs.Info("成功添加开机启动项: %s -> %s", appName, exePath)
slog.Info("成功添加开机启动项", "app", appName, "path", exePath)
return nil
}
@@ -50,13 +50,13 @@ func disableStartupImpl() error {
if err != nil {
// 如果键不存在,不算错误
if err == registry.ErrNotExist {
logs.Info("开机启动项不存在,无需删除")
slog.Info("开机启动项不存在,无需删除")
return nil
}
return fmt.Errorf("删除注册表值失败: %v", err)
}
logs.Info("成功删除开机启动项: %s", appName)
slog.Info("成功删除开机启动项", "app", appName)
return nil
}
+35 -110
View File
@@ -1,120 +1,45 @@
//go:build !darwin
package main
import (
_ "image/png"
"log"
"os"
"runtime"
"sync"
"time"
"github.com/energye/systray"
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
"github.com/wailsapp/wails/v3/pkg/application"
)
// QuitTray 退出托盘程序
func QuitTray() {
systray.Quit()
}
// startTray 初始化系统托盘
// startTray 初始化系统托盘(使用 Wails v3 内置托盘,三平台统一)
func (a *App) startTray() {
// 锁定 OS 线程,确保 Windows 消息循环稳定运行
runtime.LockOSThread()
defer runtime.UnlockOSThread()
tray := a.app.SystemTray.New()
log.Println("systray: start")
// 使用 PNG 图标(wails3 各平台均支持)
if len(trayIcon) > 0 {
tray.SetIcon(trayIcon)
}
tray.SetTooltip("NPS 客户端")
// 使用 sync.WaitGroup 确保资源正确释放
var wg sync.WaitGroup
wg.Add(1)
systray.Run(
func() {
// onReady 回调 - 在主线程执行
log.Println("systray: onReady start")
defer wg.Done()
// 增加短暂延迟确保系统托盘完全初始化
time.Sleep(200 * time.Millisecond)
// 设置托盘图标 - 增加错误处理
var iconSet bool
if runtime.GOOS == "windows" {
if len(trayIconICO) > 0 {
log.Println("systray: using embedded ICO icon")
systray.SetIcon(trayIconICO)
iconSet = true
}
} else {
log.Println("systray: using PNG icon for non-windows")
if len(trayIcon) > 0 {
systray.SetIcon(trayIcon)
iconSet = true
}
}
if !iconSet {
log.Println("systray: no icon provided, using default")
}
systray.SetTitle("NPS 客户端")
systray.SetTooltip("NPS 客户端")
// 创建菜单项 - 确保在主线程创建
showItem := systray.AddMenuItem("显示", "点击显示")
quitItem := systray.AddMenuItem("退出", "点击退出")
log.Println("systray: menu items added")
systray.SetOnClick(func(menu systray.IMenu) {
_ = menu
log.Println("[Tray] Left click")
if a.ctx != nil && !isQuitting() {
wailsRuntime.EventsEmit(a.ctx, "tray-show")
go func() {
wailsRuntime.Show(a.ctx)
}()
}
})
showItem.Click(func() {
log.Println("[Menu] Show item clicked")
if a.ctx != nil && !isQuitting() {
// 确保在主线程执行 UI 操作
wailsRuntime.EventsEmit(a.ctx, "tray-show")
// 直接调用 Show 可能跨线程,改用异步调用
go func() {
wailsRuntime.Show(a.ctx)
}()
}
})
quitItem.Click(func() {
log.Println("[Menu] Quit item clicked")
if !isQuitting() {
setQuitting()
// 先关闭菜单
systray.Quit()
// 退出应用
if a.ctx != nil {
wailsRuntime.Quit(a.ctx)
} else {
os.Exit(0)
}
}
})
},
func() {
// onExit 回调
log.Println("systray: onExit")
menu := a.app.NewMenu()
menu.Add("显示").OnClick(func(_ *application.Context) {
a.showMainWindow()
})
menu.Add("退出").OnClick(func(_ *application.Context) {
if !isQuitting() {
setQuitting()
wg.Wait()
log.Println("systray: exited cleanly")
},
)
a.app.Quit()
}
})
tray.SetMenu(menu)
// 左键单击托盘图标也显示主窗口
tray.OnClick(func() {
a.showMainWindow()
})
a.tray = tray
}
// showMainWindow 显示主窗口
func (a *App) showMainWindow() {
if isQuitting() || a.window == nil {
return
}
a.app.Event.Emit("tray-show")
a.window.Show()
a.window.Focus()
}
-13
View File
@@ -1,13 +0,0 @@
//go:build darwin
package main
import "log"
// QuitTray no-op on macOS to avoid AppDelegate conflict with systray.
func QuitTray() {}
// startTray on macOS: disable systray to avoid duplicate AppDelegate symbols.
func (a *App) startTray() {
log.Println("tray: disabled on darwin (systray AppDelegate conflict)")
}
+323
View File
@@ -0,0 +1,323 @@
package main
import (
"archive/zip"
"encoding/json"
"errors"
"fmt"
"io"
"log/slog"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
"ehang.io/nps/lib/version"
)
const (
updateRepo = "yisier/nps"
updateAPIURL = "https://api.github.com/repos/" + updateRepo + "/releases/latest"
updateDownBase = "https://github.com/" + updateRepo + "/releases/download"
)
// UpdateInfo 版本检查结果,供前端展示
type UpdateInfo struct {
CurrentVersion string `json:"currentVersion"`
LatestVersion string `json:"latestVersion"`
UpdateAvailable bool `json:"updateAvailable"`
ReleaseNotes string `json:"releaseNotes"`
PublishedAt string `json:"publishedAt"`
DownloadURL string `json:"downloadUrl"`
AssetName string `json:"assetName"`
}
type ghAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
}
type ghRelease struct {
TagName string `json:"tag_name"`
Body string `json:"body"`
PublishedAt string `json:"published_at"`
Assets []ghAsset `json:"assets"`
}
// guiAssetName 当前平台对应的 GUI 发布包文件名
func guiAssetName() string {
return fmt.Sprintf("npc-gui-%s-%s.zip", runtime.GOOS, runtime.GOARCH)
}
// compareVersion 比较两个版本号(忽略前导 v)。a<b 返回 -1,a>b 返回 1,相等返回 0
func compareVersion(a, b string) int {
ai, _ := strconv.Atoi(strings.ReplaceAll(strings.TrimPrefix(strings.TrimSpace(a), "v"), ".", ""))
bi, _ := strconv.Atoi(strings.ReplaceAll(strings.TrimPrefix(strings.TrimSpace(b), "v"), ".", ""))
switch {
case ai < bi:
return -1
case ai > bi:
return 1
}
return 0
}
// fetchLatestRelease 拉取 GitHub 最新 release 信息
func fetchLatestRelease() (*ghRelease, error) {
client := &http.Client{Timeout: 15 * time.Second}
req, err := http.NewRequest(http.MethodGet, updateAPIURL, nil)
if err != nil {
return nil, err
}
req.Header.Set("Accept", "application/vnd.github+json")
req.Header.Set("User-Agent", "npc-gui-updater")
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("获取版本信息失败: HTTP %d", resp.StatusCode)
}
rl := new(ghRelease)
if err := json.NewDecoder(resp.Body).Decode(rl); err != nil {
return nil, err
}
if rl.TagName == "" {
return nil, errors.New("无法解析最新版本号")
}
return rl, nil
}
func findAsset(rl *ghRelease, name string) (*ghAsset, error) {
for i := range rl.Assets {
if rl.Assets[i].Name == name {
return &rl.Assets[i], nil
}
}
return nil, fmt.Errorf("发布资源中未找到 %s,当前平台暂不支持自动更新", name)
}
// CheckForUpdate 检查是否有新版本可用(检测升级)
func (a *App) CheckForUpdate() (*UpdateInfo, error) {
rl, err := fetchLatestRelease()
if err != nil {
return nil, err
}
latest := strings.TrimPrefix(rl.TagName, "v")
current := version.VERSION
assetName := guiAssetName()
downloadURL := ""
if asset, err := findAsset(rl, assetName); err == nil {
downloadURL = asset.BrowserDownloadURL
}
return &UpdateInfo{
CurrentVersion: current,
LatestVersion: latest,
UpdateAvailable: compareVersion(current, latest) < 0,
ReleaseNotes: rl.Body,
PublishedAt: rl.PublishedAt,
DownloadURL: downloadURL,
AssetName: assetName,
}, nil
}
// DownloadAndInstallUpdate 下载最新版本并热替换当前可执行文件
func (a *App) DownloadAndInstallUpdate() error {
rl, err := fetchLatestRelease()
if err != nil {
return err
}
latest := strings.TrimPrefix(rl.TagName, "v")
if compareVersion(version.VERSION, latest) >= 0 {
return fmt.Errorf("当前已是最新版本 %s,无需更新", version.VERSION)
}
assetName := guiAssetName()
asset, err := findAsset(rl, assetName)
if err != nil {
return err
}
slog.Info("开始下载更新包", "url", asset.BrowserDownloadURL)
exePath, err := getExecutablePath()
if err != nil {
return fmt.Errorf("获取当前程序路径失败: %w", err)
}
tempDir := filepath.Join(os.TempDir(), "npc-gui-update")
_ = os.RemoveAll(tempDir)
if err := os.MkdirAll(tempDir, 0o755); err != nil {
return err
}
zipPath := filepath.Join(tempDir, assetName)
if err := downloadFile(asset.BrowserDownloadURL, zipPath); err != nil {
return err
}
if err := replaceFromZip(zipPath, exePath, tempDir); err != nil {
return err
}
slog.Info("更新完成,请重启程序生效")
return nil
}
// RestartApp 重启当前程序(更新完成后调用)
func (a *App) RestartApp() error {
exePath, err := getExecutablePath()
if err != nil {
return fmt.Errorf("获取当前程序路径失败: %w", err)
}
cmd := exec.Command(exePath)
if err := cmd.Start(); err != nil {
return fmt.Errorf("启动新版本失败: %w", err)
}
// 延迟退出当前进程,确保新进程已启动
go func() {
time.Sleep(800 * time.Millisecond)
if a.app != nil {
a.app.Quit()
}
}()
return nil
}
func downloadFile(url, dest string) error {
client := &http.Client{Timeout: 10 * time.Minute}
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return err
}
req.Header.Set("User-Agent", "npc-gui-updater")
resp, err := client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("下载更新包失败: HTTP %d", resp.StatusCode)
}
out, err := os.Create(dest)
if err != nil {
return err
}
defer out.Close()
_, err = io.Copy(out, resp.Body)
return err
}
// replaceFromZip 从 zip 更新包中取出可执行文件并热替换正在运行的程序
func replaceFromZip(zipPath, exePath, tempDir string) error {
zr, err := zip.OpenReader(zipPath)
if err != nil {
return fmt.Errorf("打开更新包失败: %w", err)
}
defer zr.Close()
exeBase := filepath.Base(exePath)
var found *zip.File
for _, f := range zr.File {
name := filepath.Base(f.Name)
if strings.EqualFold(name, exeBase) || strings.EqualFold(name, "npc-gui") || strings.EqualFold(name, "npc-gui.exe") {
found = f
break
}
}
if found == nil {
return fmt.Errorf("更新包中未找到可执行文件 %s", exeBase)
}
rc, err := found.Open()
if err != nil {
return err
}
defer rc.Close()
newBin := filepath.Join(tempDir, "npc-gui"+guiExeExt())
out, err := os.Create(newBin)
if err != nil {
return err
}
if _, err := io.Copy(out, rc); err != nil {
out.Close()
return err
}
out.Close()
chmodExecutable(newBin, 0o755)
return replaceExecutableFile(newBin, exePath)
}
func guiExeExt() string {
if runtime.GOOS == "windows" {
return ".exe"
}
return ""
}
// replaceExecutableFile 用新文件替换正在运行的可执行文件。
// Windows 下运行中的 exe 不能直接覆盖,先改名备份再替换。
func replaceExecutableFile(srcBin, destBin string) error {
if srcFi, err := os.Stat(srcBin); err == nil {
if dstFi, err := os.Stat(destBin); err == nil {
if os.SameFile(srcFi, dstFi) {
return nil
}
}
}
if err := os.MkdirAll(filepath.Dir(destBin), 0o755); err != nil {
return err
}
// 将当前程序改名为 .old 备份(Windows 上运行中的文件允许改名)
if _, err := os.Stat(destBin); err == nil {
bak := destBin + ".old"
_ = os.Remove(bak)
if err := os.Rename(destBin, bak); err != nil {
return fmt.Errorf("无法备份当前程序 %s: %w", destBin, err)
}
}
// 同文件系统 rename 原子替换;跨卷回退为拷贝
if err := os.Rename(srcBin, destBin); err != nil {
if _, copyErr := copyFileForUpdate(srcBin, destBin); copyErr != nil {
// 尽力恢复旧程序
bak := destBin + ".old"
if _, statErr := os.Stat(bak); statErr == nil {
_ = os.Rename(bak, destBin)
}
return fmt.Errorf("替换可执行文件失败: %w", copyErr)
}
_ = os.Remove(srcBin)
}
return nil
}
func copyFileForUpdate(src, dest string) (int64, error) {
srcF, err := os.Open(src)
if err != nil {
return 0, err
}
defer srcF.Close()
dstF, err := os.Create(dest)
if err != nil {
return 0, err
}
defer dstF.Close()
return io.Copy(dstF, srcF)
}
func chmodExecutable(path string, mode os.FileMode) {
if runtime.GOOS != "windows" {
_ = os.Chmod(path, mode)
}
}
-32
View File
@@ -1,32 +0,0 @@
{
"name": "NPS 客户端",
"outputtype": "desktop",
"frontend": {
"dir": "frontend",
"packageManager": "yarn",
"install": "yarn install",
"build": "yarn run build",
"dev": "yarn run dev",
"dev:serverUrl": "http://localhost:34115"
},
"author": {
"name": "NPS"
},
"info": {
"productName": "NPS Client",
"productVersion": "0.26.33",
"companyName": "NPS",
"copyright": "Copyright © 2026 NPS"
},
"build": {
"nsis": {
"oneShotInstaller": true,
"allowToChangeInstallationDirectory": true,
"icon": "build/windows/icon.ico"
},
"windows": {
"icon": "build/windows/icon.ico"
},
"buildTags": "npcgui"
}
}
+2
View File
@@ -213,6 +213,8 @@ func run() {
common.InitPProfFromArg(*pprofAddr)
//p2p or secret command
if *password != "" {
client.SetTlsEnable(*tlsEnable)
logs.Info("the version of client is %s, the core version of client is %s,tls enable is %t", version.VERSION, version.GetVersion(), client.GetTlsEnable())
commonConfig := new(config.CommonConfig)
commonConfig.Server = *serverAddr
commonConfig.VKey = *verifyKey
+20 -4
View File
@@ -26,7 +26,6 @@ import (
"ehang.io/nps/lib/common"
"ehang.io/nps/lib/crypt"
"ehang.io/nps/web"
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
@@ -52,6 +51,7 @@ func main() {
return
}
if *serverCmd {
_ = logs.SetLogger(logs.AdapterConsole, `{"level":7,"color":true}`)
printSlogan()
inputCmd()
return
@@ -270,7 +270,15 @@ func inputCmd() {
_ = service.Control(s, "uninstall")
binPath := install.InstallNpsToCurrentDir()
beego.LoadAppConfig("ini", filepath.Join(common.GetAppPath(), "conf", "nps.conf"))
// Ensure conf exists (same as normal startup), then load it for display.
// Previously LoadAppConfig error was ignored and web_port could be empty,
// printing "127.0.0.1:" with no port. See #317.
confDir := filepath.Join(common.GetAppPath(), "conf")
initConfig(confDir)
if err := beego.LoadAppConfig("ini", filepath.Join(confDir, "nps.conf")); err != nil {
fmt.Println("加载配置文件失败:", err)
break
}
logPath := filepath.Join(common.GetAppPath(), "nps.log")
if common.IsWindows() {
@@ -303,7 +311,16 @@ func inputCmd() {
if err != nil {
fmt.Println("启动NPS服务失败", err)
} else {
fmt.Println("NPS服务已启动,管理面板访问地址:127.0.0.1:" + beego.AppConfig.String("web_port"))
webPort := beego.AppConfig.String("web_port")
if webPort == "" {
fmt.Println("NPS服务已启动(未配置 web_port,管理面板已关闭)")
} else {
scheme := "http"
if beego.AppConfig.DefaultBool("web_open_ssl", false) {
scheme = "https"
}
fmt.Println("NPS服务已启动,管理面板访问地址:" + scheme + "://127.0.0.1:" + webPort)
}
}
break
@@ -472,7 +489,6 @@ func initConfig(confDir string) {
logs.Info("auth_key:", authKey)
logs.Info("auth_crypt_key:", authCryptKey)
}
web.ExtractWebFiles(common.GetRunPath())
}
const defaultNpsConf = `http_proxy_ip=0.0.0.0
+3
View File
@@ -0,0 +1,3 @@
{"Cnf":{"U":"","P":"","Compress":false,"Crypt":false},"Id":2,"VerifyKey":"e9cba3f8a9","Addr":"127.0.0.1","LocalAddr":"172.16.10.6","Remark":"测试2","Status":true,"IsConnect":false,"RateLimit":0,"Flow":{"ExportFlow":1446223,"InletFlow":1446223,"FlowLimit":0},"Rate":{"NowRate":0},"NoStore":false,"NoDisplay":false,"MaxConn":0,"NowConn":0,"WebUserName":"","WebPassword":"","ConfigConnAllow":true,"MaxTunnelNum":0,"Version":"0.26.38","BlackIpList":[],"CreateTime":"2026-08-24 11:20:39","LastOnlineTime":"2026-08-24 17:48:47","IpWhite":false,"IpWhitePass":"","IpWhiteList":[],"ExpireTime":""}
*#*{"Cnf":{"U":"","P":"","Compress":false,"Crypt":false},"Id":4,"VerifyKey":"b6873d7af1","Addr":"127.0.0.1","LocalAddr":"172.16.10.6","Remark":"测试1","Status":true,"IsConnect":false,"RateLimit":0,"Flow":{"ExportFlow":0,"InletFlow":0,"FlowLimit":0},"Rate":{"NowRate":0},"NoStore":false,"NoDisplay":false,"MaxConn":0,"NowConn":0,"WebUserName":"","WebPassword":"","ConfigConnAllow":true,"MaxTunnelNum":0,"Version":"0.26.38","BlackIpList":[],"CreateTime":"2026-08-24 13:40:26","LastOnlineTime":"2026-08-24 17:48:47","IpWhite":false,"IpWhitePass":"","IpWhiteList":[],"ExpireTime":""}
*#*
+2
View File
@@ -0,0 +1,2 @@
{"Id":1,"Host":"wmstest22.hn1.pp2pdf.com","HeaderChange":"","HostChange":"","Location":"/","Remark":"","Scheme":"https","CertFilePath":"","KeyFilePath":"","NoStore":false,"IsClose":false,"AutoHttps":false,"Flow":{"ExportFlow":1446223,"InletFlow":1446223,"FlowLimit":0},"Client":{"Cnf":{"U":"","P":"","Compress":false,"Crypt":false},"Id":2,"VerifyKey":"e9cba3f8a9","Addr":"127.0.0.1","LocalAddr":"172.16.10.6","Remark":"测试2","Status":true,"IsConnect":false,"RateLimit":0,"Flow":{"ExportFlow":1446223,"InletFlow":1446223,"FlowLimit":0},"Rate":{"NowRate":0},"NoStore":false,"NoDisplay":false,"MaxConn":0,"NowConn":0,"WebUserName":"","WebPassword":"","ConfigConnAllow":true,"MaxTunnelNum":0,"Version":"0.26.38","BlackIpList":[],"CreateTime":"2026-08-24 11:20:39","LastOnlineTime":"2026-08-24 17:48:47","IpWhite":false,"IpWhitePass":"","IpWhiteList":[],"ExpireTime":""},"Target":{"TargetStr":"127.0.0.1:8443","TargetArr":["127.0.0.1:8443"],"LocalProxy":false}}
*#*
+3
View File
@@ -0,0 +1,3 @@
@echo off
cd /d D:\yisi\github\nps\docs
yarn docs:dev > vuepress-dev.log 2> vuepress-dev.err.log
+15
View File
@@ -0,0 +1,15 @@
import { defineClientConfig } from 'vuepress/client'
import { watch } from 'vue'
import { usePageData, useRoute } from 'vuepress/client'
export default defineClientConfig({
setup() {
const page = usePageData()
const route = useRoute()
// eslint-disable-next-line no-console
watch(() => route.path, () => {
// eslint-disable-next-line no-console
console.log('[debug] route:', route.path, 'headers:', JSON.stringify(page.value.headers))
}, { immediate: true })
},
})
+143
View File
@@ -0,0 +1,143 @@
import type { SidebarConfig } from 'vuepress'
import { defineUserConfig } from 'vuepress'
import { viteBundler } from '@vuepress/bundler-vite'
import { defaultTheme } from '@vuepress/theme-default'
import { prismjsPlugin } from '@vuepress/plugin-prismjs'
import { searchPlugin } from '@vuepress/plugin-search'
const serverSidebar: SidebarConfig = [
{ text: '服务端', children: [
{ text: '使用说明', link: '/server/nps_use.html' },
{ text: '配置文件', link: '/server/server_config.html' },
{ text: '增强功能', link: '/server/nps_extend.html' },
]},
]
const clientSidebar: SidebarConfig = [
{ text: '客户端', children: [
{ text: '使用说明', link: '/client/use.html' },
{ text: '增强功能', link: '/client/npc_extend.html' },
{ text: 'SDK', link: '/client/npc_sdk.html' },
]},
]
const extendSidebar: SidebarConfig = [
{ text: '扩展', children: [
{ text: '更多功能', link: '/extend/feature.html' },
{ text: '配置示例', link: '/extend/example.html' },
{ text: 'API接入方式', link: '/extend/api.html' },
{ text: 'API 清单', link: '/extend/webapi.html' },
]},
]
export default defineUserConfig({
base: '/nps/',
bundler: viteBundler(),
lang: 'zh-CN',
title: 'NPS',
description: 'NPS 内网穿透文档 — 服务端、客户端、Web API、增强功能、更新日志',
head: [
['link', { rel: 'icon', href: '/logo.svg' }],
['meta', { name: 'theme-color', content: '#4f46e5' }],
],
plugins: [
prismjsPlugin({
lineNumbers: true,
}),
searchPlugin({}),
],
theme: defaultTheme({
logo: '/logo.svg',
repo: 'yisier/nps',
repoLabel: 'GitHub',
docsRepo: 'https://github.com/yisier/nps',
docsBranch: 'master',
docsDir: 'docs',
editLink: true,
editLinkText: '在 GitHub 上编辑此页',
lastUpdated: true,
lastUpdatedText: '最后更新',
contributors: false,
navbar: [
{ text: '首页', link: '/' },
{ text: '快速上手', link: '/install/' },
{
text: '服务端',
children: [
{ text: '使用说明', link: '/server/nps_use.html' },
{ text: '配置文件', link: '/server/server_config.html' },
{ text: '增强功能', link: '/server/nps_extend.html' },
],
},
{
text: '客户端',
children: [
{ text: '使用说明', link: '/client/use.html' },
{ text: '增强功能', link: '/client/npc_extend.html' },
{ text: 'SDK', link: '/client/npc_sdk.html' },
],
},
{
text: '扩展',
children: [
{ text: '更多功能', link: '/extend/feature.html' },
{ text: '配置示例', link: '/extend/example.html' },
{ text: 'API接入方式', link: '/extend/api.html' },
{ text: 'API 清单', link: '/extend/webapi.html' },
],
},
{ text: '更新日志', link: '/changelog/' },
],
sidebar: {
'/install/': [
{ text: '快速上手', link: '/install/' },
],
'/server/introduction.html': serverSidebar,
'/server/nps_use.html': serverSidebar,
'/server/server_config.html': serverSidebar,
'/server/nps_extend.html': serverSidebar,
'/client/use.html': clientSidebar,
'/client/npc_extend.html': clientSidebar,
'/client/npc_sdk.html': clientSidebar,
'/extend/feature.html': extendSidebar,
'/extend/example.html': extendSidebar,
'/extend/api.html': extendSidebar,
'/extend/webapi.html': extendSidebar,
'/': [
{ text: '首页', link: '/' },
{ text: '快速上手', link: '/install/' },
{
text: '服务端',
children: [
{ text: '使用说明', link: '/server/nps_use.html' },
{ text: '配置文件', link: '/server/server_config.html' },
{ text: '增强功能', link: '/server/nps_extend.html' },
],
},
{
text: '客户端',
children: [
{ text: '使用说明', link: '/client/use.html' },
{ text: '增强功能', link: '/client/npc_extend.html' },
{ text: 'SDK', link: '/client/npc_sdk.html' },
],
},
{
text: '扩展',
children: [
{ text: '功能', link: '/extend/feature.html' },
{ text: '配置示例', link: '/extend/example.html' },
{ text: 'API接入方式', link: '/extend/api.html' },
{ text: 'Web API 详细', link: '/extend/webapi.html' },
],
},
{ text: '更新日志', link: '/changelog/' },
],
},
sidebarDepth: 2,
}),
})

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 276 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Before

Width:  |  Height:  |  Size: 712 KiB

After

Width:  |  Height:  |  Size: 712 KiB

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Before

Width:  |  Height:  |  Size: 690 KiB

After

Width:  |  Height:  |  Size: 690 KiB

Some files were not shown because too many files have changed in this diff Show More