6 Commits

Author SHA1 Message Date
Flik
1890cad8d9 feat(theme): 添加主题切换功能并优化UI样式
Some checks failed
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-frontend (push) Has been cancelled
- 集成主题切换功能,支持浅色、深色和自动模式
- 添加SunnyOutline、MoonOutline、ContrastOutline图标用于主题选择
- 创建主题下拉菜单组件,允许用户切换不同主题模式
- 重构CSS样式使用CSS变量替代硬编码颜色值
- 优化导航栏、用户菜单、客户端卡片等组件的视觉效果
- 调整头部高度从60px到56px,修改品牌文字样式
- 更新按钮、下拉菜单、模态框等交互元素的样式
- 在客户端视图中添加心跳指示器显示连接状态
- 实现客户端页面数据自动轮询刷新功能
- 优化版本号显示逻辑,确保始终以v开头显示
- 修复更新检查按钮只在有可用更新时才显示的问题
2026-01-22 22:43:19 +08:00
Flik
11572f132c feat(theme): 添加主题切换功能并优化UI样式
Some checks failed
Build Multi-Platform Binaries / build-frontend (push) Failing after 16s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Has been skipped
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Has been skipped
- 集成主题切换功能,支持浅色、深色和自动模式
- 添加SunnyOutline、MoonOutline、ContrastOutline图标用于主题选择
- 创建主题下拉菜单组件,允许用户切换不同主题模式
- 重构CSS样式使用CSS变量替代硬编码颜色值
- 优化导航栏、用户菜单、客户端卡片等组件的视觉效果
- 调整头部高度从60px到56px,修改品牌文字样式
- 更新按钮、下拉菜单、模态框等交互元素的样式
- 在客户端视图中添加心跳指示器显示连接状态
- 实现客户端页面数据自动轮询刷新功能
- 优化版本号显示逻辑,确保始终以v开头显示
- 修复更新检查按钮只在有可用更新时才显示的问题
2026-01-22 22:37:42 +08:00
Flik
9f13b0d4e9 feat(app): 添加服务端和客户端更新功能以及系统状态监控
Some checks failed
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Has been cancelled
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Has been cancelled
Build Multi-Platform Binaries / build-frontend (push) Has been cancelled
- 在App.vue中新增服务端更新模态框和相关功能
- 添加applyServerUpdate API调用和更新确认对话框
- 实现客户端版本信息显示和更新检测功能
- 添加系统状态监控包括CPU、内存和磁盘使用情况
- 新增getClientSystemStats API接口获取客户端系统统计信息
- 更新go.mod和go.sum文件添加必要的依赖包
- 优化UI界面样式和交互体验
2026-01-22 21:32:03 +08:00
Flik
7cddb7b3e7 refactor(app): 移除 naive-ui 依赖并优化配置结构
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 31s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m30s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m39s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m19s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m43s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m18s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m38s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m50s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 2m6s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m18s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m57s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m25s
- 从 App.vue 中移除 naive-ui 组件及其主题配置
- 从组件声明中移除 NIcon 和 NTag 组件引用
- 将 JSPluginConfig 从 ServerConfig 中分离
- 在 ServerSettings 中整合 PluginStore 配置
- 更新配置 DTO 结构以支持 PluginStore 配置
- 移除 JS 插件加载和签名验证相关代码
- 从 main.ts 中移除 naive-ui 的引入和使用
- 从 package.json 中移除 naive-ui 和相关自动导入插件依赖
- 在设置页面添加插件商店 URL 配置字段
- 更新 StoreHandler 中插件商店 URL 的获取方式
- 移除 Vite 配置中的自动导入和组件解析插件
2026-01-22 20:37:11 +08:00
Flik
d1058f9e89 feat(app): 添加流量统计功能和服务器配置管理
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 38s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m47s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m48s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m29s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m53s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m14s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m40s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m36s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 1m51s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m17s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m50s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m18s
- 在WebServer中添加TrafficStore存储接口
- 将Web配置从根级别移动到Server.Web子结构下
- 移除Web配置中的BindAddr字段并调整默认值逻辑
- 在前端HomeView中替换模拟流量数据显示真实统计数据
- 添加流量统计API接口(/traffic/stats和/traffic/hourly)
- 实现SQLite数据库流量统计表创建和CRUD操作
- 在Relay包中添加带流量统计的数据转发功能
- 在设置页面添加服务器配置编辑和保存功能
- 创建流量统计处理器和相关数据模型定义
2026-01-22 19:53:40 +08:00
Flik
06dfcfaff3 feat(nav): 更新导航菜单结构并添加客户端管理功能
All checks were successful
Build Multi-Platform Binaries / build-frontend (push) Successful in 39s
Build Multi-Platform Binaries / build-binaries (amd64, linux, client, true) (push) Successful in 1m25s
Build Multi-Platform Binaries / build-binaries (amd64, darwin, server, false) (push) Successful in 1m31s
Build Multi-Platform Binaries / build-binaries (amd64, windows, client, true) (push) Successful in 1m24s
Build Multi-Platform Binaries / build-binaries (amd64, linux, server, true) (push) Successful in 1m52s
Build Multi-Platform Binaries / build-binaries (amd64, windows, server, true) (push) Successful in 1m38s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, client, true) (push) Successful in 1m13s
Build Multi-Platform Binaries / build-binaries (arm64, darwin, server, false) (push) Successful in 1m44s
Build Multi-Platform Binaries / build-binaries (arm, 7, linux, server, true) (push) Successful in 2m2s
Build Multi-Platform Binaries / build-binaries (arm64, linux, client, true) (push) Successful in 1m14s
Build Multi-Platform Binaries / build-binaries (arm64, linux, server, true) (push) Successful in 1m39s
Build Multi-Platform Binaries / build-binaries (arm64, windows, server, false) (push) Successful in 1m19s
- 将插件页面替换为客户端管理页面
- 添加客户端管理视图组件,支持查看客户端列表和状态
- 集成服务器更新检查功能,在页脚显示版本和更新状态
- 添加桌面、服务器、勾选和箭头图标用于界面展示
- 实现客户端统计卡片显示在线和离线状态
- 优化路由配置,移除插件相关路由并添加客户端路由
- 更新DTO结构,分离OS和Arch字段替代平台字段
2026-01-22 19:10:20 +08:00
46 changed files with 2589 additions and 2462 deletions

View File

@@ -13,9 +13,12 @@ import (
// 版本信息(通过 ldflags 注入) // 版本信息(通过 ldflags 注入)
var Version string var Version string
var BuildTime string
var GitCommit string
func init() { func init() {
version.SetVersion(Version) version.SetVersion(Version)
version.SetBuildInfo(GitCommit, BuildTime)
} }
func main() { func main() {

View File

@@ -27,15 +27,17 @@ import (
"github.com/gotunnel/internal/server/tunnel" "github.com/gotunnel/internal/server/tunnel"
"github.com/gotunnel/pkg/crypto" "github.com/gotunnel/pkg/crypto"
"github.com/gotunnel/pkg/plugin" "github.com/gotunnel/pkg/plugin"
"github.com/gotunnel/pkg/plugin/sign"
"github.com/gotunnel/pkg/version" "github.com/gotunnel/pkg/version"
) )
// 版本信息(通过 ldflags 注入) // 版本信息(通过 ldflags 注入)
var Version string var Version string
var BuildTime string
var GitCommit string
func init() { func init() {
version.SetVersion(Version) version.SetVersion(Version)
version.SetBuildInfo(GitCommit, BuildTime)
} }
func main() { func main() {
@@ -83,18 +85,12 @@ func main() {
server.SetPluginRegistry(registry) server.SetPluginRegistry(registry)
server.SetJSPluginStore(clientStore) // 设置 JS 插件存储,用于客户端重连时恢复插件 server.SetJSPluginStore(clientStore) // 设置 JS 插件存储,用于客户端重连时恢复插件
// 加载 JS 插件配置
if len(cfg.JSPlugins) > 0 {
jsPlugins := loadJSPlugins(cfg.JSPlugins)
server.LoadJSPlugins(jsPlugins)
}
// 启动 Web 控制台 // 启动 Web 控制台
if cfg.Web.Enabled { if cfg.Server.Web.Enabled {
// 强制生成 Web 凭据(如果未配置) // 强制生成 Web 凭据(如果未配置)
if config.GenerateWebCredentials(cfg) { if config.GenerateWebCredentials(cfg) {
log.Printf("[Web] Auto-generated credentials - Username: %s, Password: %s", log.Printf("[Web] Auto-generated credentials - Username: %s, Password: %s",
cfg.Web.Username, cfg.Web.Password) cfg.Server.Web.Username, cfg.Server.Web.Password)
log.Printf("[Web] Please save these credentials and update your config file") log.Printf("[Web] Please save these credentials and update your config file")
// 保存配置以持久化凭据 // 保存配置以持久化凭据
if err := config.SaveServerConfig(*configPath, cfg); err != nil { if err := config.SaveServerConfig(*configPath, cfg); err != nil {
@@ -103,11 +99,11 @@ func main() {
} }
ws := app.NewWebServer(clientStore, server, cfg, *configPath, clientStore) ws := app.NewWebServer(clientStore, server, cfg, *configPath, clientStore)
addr := fmt.Sprintf("%s:%d", cfg.Web.BindAddr, cfg.Web.BindPort) addr := fmt.Sprintf("%s:%d", cfg.Server.BindAddr, cfg.Server.Web.BindPort)
go func() { go func() {
// 始终使用 JWT 认证 // 始终使用 JWT 认证
err := ws.RunWithJWT(addr, cfg.Web.Username, cfg.Web.Password, cfg.Server.Token) err := ws.RunWithJWT(addr, cfg.Server.Web.Username, cfg.Server.Web.Password, cfg.Server.Token)
if err != nil { if err != nil {
log.Printf("[Web] Server error: %v", err) log.Printf("[Web] Server error: %v", err)
} }
@@ -128,69 +124,3 @@ func main() {
log.Fatal(server.Run()) log.Fatal(server.Run())
} }
// loadJSPlugins 加载 JS 插件文件
func loadJSPlugins(configs []config.JSPluginConfig) []tunnel.JSPluginEntry {
var plugins []tunnel.JSPluginEntry
for _, cfg := range configs {
source, err := os.ReadFile(cfg.Path)
if err != nil {
log.Printf("[JSPlugin] Failed to load %s: %v", cfg.Path, err)
continue
}
// 加载签名文件
sigPath := cfg.SigPath
if sigPath == "" {
sigPath = cfg.Path + ".sig"
}
signature, err := os.ReadFile(sigPath)
if err != nil {
log.Printf("[JSPlugin] Failed to load signature for %s: %v", cfg.Name, err)
continue
}
// 服务端也验证签名,防止配置文件被篡改
if err := verifyPluginSignature(cfg.Name, string(source), string(signature)); err != nil {
log.Printf("[JSPlugin] Signature verification failed for %s: %v", cfg.Name, err)
continue
}
plugins = append(plugins, tunnel.JSPluginEntry{
Name: cfg.Name,
Source: string(source),
Signature: string(signature),
AutoPush: cfg.AutoPush,
Config: cfg.Config,
AutoStart: cfg.AutoStart,
})
log.Printf("[JSPlugin] Loaded: %s from %s (verified)", cfg.Name, cfg.Path)
}
return plugins
}
// verifyPluginSignature 验证插件签名
func verifyPluginSignature(name, source, signature string) error {
// 解码签名
signed, err := sign.DecodeSignedPlugin(signature)
if err != nil {
return fmt.Errorf("decode signature: %w", err)
}
// 获取公钥
pubKey, err := sign.GetPublicKeyByID(signed.Payload.KeyID)
if err != nil {
return err
}
// 验证插件名称
if signed.Payload.Name != name {
return fmt.Errorf("name mismatch: %s vs %s", signed.Payload.Name, name)
}
// 验证签名
return sign.VerifyPlugin(pubKey, signed, source)
}

38
go.mod
View File

@@ -3,31 +3,35 @@ module github.com/gotunnel
go 1.24.0 go 1.24.0
require ( require (
github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9
github.com/gin-gonic/gin v1.11.0
github.com/go-playground/validator/v10 v10.30.1
github.com/golang-jwt/jwt/v5 v5.3.0 github.com/golang-jwt/jwt/v5 v5.3.0
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/hashicorp/yamux v0.1.1 github.com/hashicorp/yamux v0.1.1
github.com/shirou/gopsutil/v3 v3.24.5
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.1
github.com/swaggo/swag v1.16.6
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.41.0 modernc.org/sqlite v1.41.0
) )
require ( require (
github.com/KyleBanks/depth v1.2.1 // indirect github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.2.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/gopkg v0.1.3 // indirect
github.com/bytedance/sonic v1.14.2 // indirect github.com/bytedance/sonic v1.14.2 // indirect
github.com/bytedance/sonic/loader v0.4.0 // indirect github.com/bytedance/sonic/loader v0.4.0 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect github.com/cloudwego/base64x v0.1.6 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.12 // indirect github.com/gabriel-vasile/mimetype v1.4.12 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect github.com/gin-contrib/sse v1.1.0 // indirect
github.com/gin-gonic/gin v1.11.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.22.4 // indirect github.com/go-openapi/jsonpointer v0.22.4 // indirect
github.com/go-openapi/jsonreference v0.21.4 // indirect github.com/go-openapi/jsonreference v0.21.4 // indirect
github.com/go-openapi/spec v0.22.3 // indirect github.com/go-openapi/spec v0.22.3 // indirect
github.com/go-openapi/swag v0.25.4 // indirect
github.com/go-openapi/swag/conv v0.25.4 // indirect github.com/go-openapi/swag/conv v0.25.4 // indirect
github.com/go-openapi/swag/jsonname v0.25.4 // indirect github.com/go-openapi/swag/jsonname v0.25.4 // indirect
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
@@ -37,37 +41,31 @@ require (
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.30.1 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/goccy/go-json v0.10.5 // indirect github.com/goccy/go-json v0.10.5 // indirect
github.com/goccy/go-yaml v1.19.1 // indirect github.com/goccy/go-yaml v1.19.1 // indirect
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.9.1 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/quic-go/qpack v0.6.0 // indirect github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.58.0 // indirect github.com/quic-go/quic-go v0.58.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/swaggo/files v1.0.1 // indirect github.com/tklauser/numcpus v0.6.1 // indirect
github.com/swaggo/gin-swagger v1.6.1 // indirect
github.com/swaggo/swag v1.16.6 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.1 // indirect github.com/ugorji/go/codec v1.3.1 // indirect
github.com/urfave/cli/v2 v2.27.7 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
go.uber.org/mock v0.6.0 // indirect go.uber.org/mock v0.6.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/arch v0.23.0 // indirect golang.org/x/arch v0.23.0 // indirect
golang.org/x/crypto v0.46.0 // indirect golang.org/x/crypto v0.46.0 // indirect
@@ -79,9 +77,7 @@ require (
golang.org/x/text v0.32.0 // indirect golang.org/x/text v0.32.0 // indirect
golang.org/x/tools v0.40.0 // indirect golang.org/x/tools v0.40.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
modernc.org/libc v1.66.10 // indirect modernc.org/libc v1.66.10 // indirect
modernc.org/mathutil v1.7.1 // indirect modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect modernc.org/memory v1.11.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
) )

118
go.sum
View File

@@ -1,24 +1,18 @@
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/purell v1.2.1 h1:QsZ4TjvwiMpat6gBCBxEQI0rcS9ehtkKtSpiUnd9N28= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
github.com/PuerkitoBio/purell v1.2.1/go.mod h1:ZwHcC/82TOaovDi//J/804umJFFmbOHPngi8iYYv/Eo= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ=
github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA=
github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE= github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE=
github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980= github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980=
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o= github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o=
github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
@@ -26,28 +20,31 @@ github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9 h1:3uSSOd6mVlwcX3k5OYO
github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= github.com/dop251/goja v0.0.0-20251201205617-2bb4c724c0f9/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw= github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls= github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4= github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4=
github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80= github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80=
github.com/go-openapi/jsonreference v0.21.4 h1:24qaE2y9bx/q3uRK/qN+TDwbok1NhbSmGjjySRCHtC8= github.com/go-openapi/jsonreference v0.21.4 h1:24qaE2y9bx/q3uRK/qN+TDwbok1NhbSmGjjySRCHtC8=
github.com/go-openapi/jsonreference v0.21.4/go.mod h1:rIENPTjDbLpzQmQWCj5kKj3ZlmEh+EFVbz3RTUh30/4= github.com/go-openapi/jsonreference v0.21.4/go.mod h1:rIENPTjDbLpzQmQWCj5kKj3ZlmEh+EFVbz3RTUh30/4=
github.com/go-openapi/spec v0.22.3 h1:qRSmj6Smz2rEBxMnLRBMeBWxbbOvuOoElvSvObIgwQc= github.com/go-openapi/spec v0.22.3 h1:qRSmj6Smz2rEBxMnLRBMeBWxbbOvuOoElvSvObIgwQc=
github.com/go-openapi/spec v0.22.3/go.mod h1:iIImLODL2loCh3Vnox8TY2YWYJZjMAKYyLH2Mu8lOZs= github.com/go-openapi/spec v0.22.3/go.mod h1:iIImLODL2loCh3Vnox8TY2YWYJZjMAKYyLH2Mu8lOZs=
github.com/go-openapi/swag v0.25.4 h1:OyUPUFYDPDBMkqyxOTkqDYFnrhuhi9NR6QVUvIochMU= github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
github.com/go-openapi/swag v0.25.4/go.mod h1:zNfJ9WZABGHCFg2RnY0S4IOkAcVTzJ6z2Bi+Q4i6qFQ=
github.com/go-openapi/swag/conv v0.25.4 h1:/Dd7p0LZXczgUcC/Ikm1+YqVzkEeCc9LnOWjfkpkfe4= github.com/go-openapi/swag/conv v0.25.4 h1:/Dd7p0LZXczgUcC/Ikm1+YqVzkEeCc9LnOWjfkpkfe4=
github.com/go-openapi/swag/conv v0.25.4/go.mod h1:3LXfie/lwoAv0NHoEuY1hjoFAYkvlqI/Bn5EQDD3PPU= github.com/go-openapi/swag/conv v0.25.4/go.mod h1:3LXfie/lwoAv0NHoEuY1hjoFAYkvlqI/Bn5EQDD3PPU=
github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI= github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI=
github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag= github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag=
github.com/go-openapi/swag/jsonutils v0.25.4 h1:VSchfbGhD4UTf4vCdR2F4TLBdLwHyUDTd1/q4i+jGZA= github.com/go-openapi/swag/jsonutils v0.25.4 h1:VSchfbGhD4UTf4vCdR2F4TLBdLwHyUDTd1/q4i+jGZA=
github.com/go-openapi/swag/jsonutils v0.25.4/go.mod h1:7OYGXpvVFPn4PpaSdPHJBtF0iGnbEaTk8AvBkoWnaAY= github.com/go-openapi/swag/jsonutils v0.25.4/go.mod h1:7OYGXpvVFPn4PpaSdPHJBtF0iGnbEaTk8AvBkoWnaAY=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4 h1:IACsSvBhiNJwlDix7wq39SS2Fh7lUOCJRmx/4SN4sVo=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4/go.mod h1:Mt0Ost9l3cUzVv4OEZG+WSeoHwjWLnarzMePNDAOBiM=
github.com/go-openapi/swag/loading v0.25.4 h1:jN4MvLj0X6yhCDduRsxDDw1aHe+ZWoLjW+9ZQWIKn2s= github.com/go-openapi/swag/loading v0.25.4 h1:jN4MvLj0X6yhCDduRsxDDw1aHe+ZWoLjW+9ZQWIKn2s=
github.com/go-openapi/swag/loading v0.25.4/go.mod h1:rpUM1ZiyEP9+mNLIQUdMiD7dCETXvkkC30z53i+ftTE= github.com/go-openapi/swag/loading v0.25.4/go.mod h1:rpUM1ZiyEP9+mNLIQUdMiD7dCETXvkkC30z53i+ftTE=
github.com/go-openapi/swag/stringutils v0.25.4 h1:O6dU1Rd8bej4HPA3/CLPciNBBDwZj9HiEpdVsb8B5A8= github.com/go-openapi/swag/stringutils v0.25.4 h1:O6dU1Rd8bej4HPA3/CLPciNBBDwZj9HiEpdVsb8B5A8=
@@ -56,26 +53,29 @@ github.com/go-openapi/swag/typeutils v0.25.4 h1:1/fbZOUN472NTc39zpa+YGHn3jzHWhv4
github.com/go-openapi/swag/typeutils v0.25.4/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE= github.com/go-openapi/swag/typeutils v0.25.4/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE=
github.com/go-openapi/swag/yamlutils v0.25.4 h1:6jdaeSItEUb7ioS9lFoCZ65Cne1/RZtPBZ9A56h92Sw= github.com/go-openapi/swag/yamlutils v0.25.4 h1:6jdaeSItEUb7ioS9lFoCZ65Cne1/RZtPBZ9A56h92Sw=
github.com/go-openapi/swag/yamlutils v0.25.4/go.mod h1:MNzq1ulQu+yd8Kl7wPOut/YHAAU/H6hL91fF+E2RFwc= github.com/go-openapi/swag/yamlutils v0.25.4/go.mod h1:MNzq1ulQu+yd8Kl7wPOut/YHAAU/H6hL91fF+E2RFwc=
github.com/go-openapi/testify/enable/yaml/v2 v2.0.2 h1:0+Y41Pz1NkbTHz8NngxTuAXxEodtNSI1WG1c/m5Akw4=
github.com/go-openapi/testify/enable/yaml/v2 v2.0.2/go.mod h1:kme83333GCtJQHXQ8UKX3IBZu6z8T5Dvy5+CW3NLUUg=
github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w= github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w=
github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM= github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/goccy/go-yaml v1.19.1 h1:3rG3+v8pkhRqoQ/88NYNMHYVGYztCOCIZ7UQhu7H+NE= github.com/goccy/go-yaml v1.19.1 h1:3rG3+v8pkhRqoQ/88NYNMHYVGYztCOCIZ7UQhu7H+NE=
github.com/goccy/go-yaml v1.19.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/goccy/go-yaml v1.19.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
@@ -85,19 +85,20 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= 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/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 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-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -107,21 +108,24 @@ github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdh
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII= github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg=
github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
github.com/quic-go/quic-go v0.58.0 h1:ggY2pvZaVdB9EyojxL1p+5mptkuHyX5MOSv4dgWF4Ug= github.com/quic-go/quic-go v0.58.0 h1:ggY2pvZaVdB9EyojxL1p+5mptkuHyX5MOSv4dgWF4Ug=
github.com/quic-go/quic-go v0.58.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU= github.com/quic-go/quic-go v0.58.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk=
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/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -129,74 +133,63 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 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/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
github.com/swaggo/gin-swagger v1.6.1 h1:Ri06G4gc9N4t4k8hekMigJ9zKTFSlqj/9paAQCQs7cY= github.com/swaggo/gin-swagger v1.6.1 h1:Ri06G4gc9N4t4k8hekMigJ9zKTFSlqj/9paAQCQs7cY=
github.com/swaggo/gin-swagger v1.6.1/go.mod h1:LQ+hJStHakCWRiK/YNYtJOu4mR2FP+pxLnILT/qNiTw= github.com/swaggo/gin-swagger v1.6.1/go.mod h1:LQ+hJStHakCWRiK/YNYtJOu4mR2FP+pxLnILT/qNiTw=
github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI= github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI=
github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg= github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg=
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/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY= github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c=
golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg= golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg=
golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A= golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o=
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI= golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg= golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/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-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -205,28 +198,21 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 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.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA= golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc= golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -258,5 +244,3 @@ modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=

View File

@@ -19,6 +19,8 @@ import (
"github.com/gotunnel/pkg/protocol" "github.com/gotunnel/pkg/protocol"
"github.com/gotunnel/pkg/relay" "github.com/gotunnel/pkg/relay"
"github.com/gotunnel/pkg/update" "github.com/gotunnel/pkg/update"
"github.com/gotunnel/pkg/utils"
"github.com/gotunnel/pkg/version"
"github.com/hashicorp/yamux" "github.com/hashicorp/yamux"
) )
@@ -181,6 +183,7 @@ func (c *Client) connect() error {
Token: c.Token, Token: c.Token,
OS: runtime.GOOS, OS: runtime.GOOS,
Arch: runtime.GOARCH, Arch: runtime.GOARCH,
Version: version.Version,
} }
msg, _ := protocol.NewMessage(protocol.MsgTypeAuth, authReq) msg, _ := protocol.NewMessage(protocol.MsgTypeAuth, authReq)
if err := protocol.WriteMessage(conn, msg); err != nil { if err := protocol.WriteMessage(conn, msg); err != nil {
@@ -286,6 +289,8 @@ func (c *Client) handleStream(stream net.Conn) {
c.handlePluginStatusQuery(stream, msg) c.handlePluginStatusQuery(stream, msg)
case protocol.MsgTypePluginAPIRequest: case protocol.MsgTypePluginAPIRequest:
c.handlePluginAPIRequest(stream, msg) c.handlePluginAPIRequest(stream, msg)
case protocol.MsgTypeSystemStatsRequest:
c.handleSystemStatsRequest(stream, msg)
} }
} }
@@ -1173,3 +1178,27 @@ func (c *Client) sendPluginAPIResponse(stream net.Conn, status int, headers map[
msg, _ := protocol.NewMessage(protocol.MsgTypePluginAPIResponse, resp) msg, _ := protocol.NewMessage(protocol.MsgTypePluginAPIResponse, resp)
protocol.WriteMessage(stream, msg) protocol.WriteMessage(stream, msg)
} }
// handleSystemStatsRequest 处理系统状态请求
func (c *Client) handleSystemStatsRequest(stream net.Conn, msg *protocol.Message) {
defer stream.Close()
stats, err := utils.GetSystemStats()
if err != nil {
log.Printf("[Client] Failed to get system stats: %v", err)
return
}
resp := protocol.SystemStatsResponse{
CPUUsage: stats.CPUUsage,
MemoryTotal: stats.MemoryTotal,
MemoryUsed: stats.MemoryUsed,
MemoryUsage: stats.MemoryUsage,
DiskTotal: stats.DiskTotal,
DiskUsed: stats.DiskUsed,
DiskUsage: stats.DiskUsage,
}
respMsg, _ := protocol.NewMessage(protocol.MsgTypeSystemStatsResponse, resp)
protocol.WriteMessage(stream, respMsg)
}

View File

@@ -21,16 +21,18 @@ type WebServer struct {
Config *config.ServerConfig Config *config.ServerConfig
ConfigPath string ConfigPath string
JSPluginStore db.JSPluginStore JSPluginStore db.JSPluginStore
TrafficStore db.TrafficStore
} }
// NewWebServer 创建Web服务 // NewWebServer 创建Web服务
func NewWebServer(cs db.ClientStore, srv router.ServerInterface, cfg *config.ServerConfig, cfgPath string, jsStore db.JSPluginStore) *WebServer { func NewWebServer(cs db.ClientStore, srv router.ServerInterface, cfg *config.ServerConfig, cfgPath string, store db.Store) *WebServer {
return &WebServer{ return &WebServer{
ClientStore: cs, ClientStore: cs,
Server: srv, Server: srv,
Config: cfg, Config: cfg,
ConfigPath: cfgPath, ConfigPath: cfgPath,
JSPluginStore: jsStore, JSPluginStore: store,
TrafficStore: store,
} }
} }
@@ -109,3 +111,8 @@ func (w *WebServer) SaveConfig() error {
func (w *WebServer) GetJSPluginStore() db.JSPluginStore { func (w *WebServer) GetJSPluginStore() db.JSPluginStore {
return w.JSPluginStore return w.JSPluginStore
} }
// GetTrafficStore 获取流量存储
func (w *WebServer) GetTrafficStore() db.TrafficStore {
return w.TrafficStore
}

View File

@@ -10,20 +10,7 @@ import (
// ServerConfig 服务端配置 // ServerConfig 服务端配置
type ServerConfig struct { type ServerConfig struct {
Server ServerSettings `yaml:"server"` Server ServerSettings `yaml:"server"`
Web WebSettings `yaml:"web"`
PluginStore PluginStoreSettings `yaml:"plugin_store"`
JSPlugins []JSPluginConfig `yaml:"js_plugins,omitempty"`
}
// JSPluginConfig JS 插件配置
type JSPluginConfig struct {
Name string `yaml:"name"`
Path string `yaml:"path"` // JS 文件路径
SigPath string `yaml:"sig_path,omitempty"` // 签名文件路径 (默认为 path + ".sig")
AutoPush []string `yaml:"auto_push,omitempty"` // 自动推送到的客户端 ID 列表
Config map[string]string `yaml:"config,omitempty"` // 插件配置
AutoStart bool `yaml:"auto_start,omitempty"` // 是否自动启动
} }
// PluginStoreSettings 插件仓库设置 // PluginStoreSettings 插件仓库设置
@@ -44,19 +31,20 @@ func (s *PluginStoreSettings) GetPluginStoreURL() string {
// ServerSettings 服务端设置 // ServerSettings 服务端设置
type ServerSettings struct { type ServerSettings struct {
BindAddr string `yaml:"bind_addr"` BindAddr string `yaml:"bind_addr"`
BindPort int `yaml:"bind_port"` BindPort int `yaml:"bind_port"`
Token string `yaml:"token"` Token string `yaml:"token"`
HeartbeatSec int `yaml:"heartbeat_sec"` HeartbeatSec int `yaml:"heartbeat_sec"`
HeartbeatTimeout int `yaml:"heartbeat_timeout"` HeartbeatTimeout int `yaml:"heartbeat_timeout"`
DBPath string `yaml:"db_path"` DBPath string `yaml:"db_path"`
TLSDisabled bool `yaml:"tls_disabled"` // 默认启用 TLS设置为 true 禁用 TLSDisabled bool `yaml:"tls_disabled"`
Web WebSettings `yaml:"web"`
PluginStore PluginStoreSettings `yaml:"plugin_store"`
} }
// WebSettings Web控制台设置 // WebSettings Web控制台设置
type WebSettings struct { type WebSettings struct {
Enabled bool `yaml:"enabled"` Enabled bool `yaml:"enabled"`
BindAddr string `yaml:"bind_addr"`
BindPort int `yaml:"bind_port"` BindPort int `yaml:"bind_port"`
Username string `yaml:"username"` Username string `yaml:"username"`
Password string `yaml:"password"` Password string `yaml:"password"`
@@ -99,12 +87,9 @@ func setDefaults(cfg *ServerConfig) {
} }
// Web 默认启用 // Web 默认启用
if cfg.Web.BindAddr == "" { if cfg.Server.Web.BindPort == 0 {
cfg.Web.BindAddr = "0.0.0.0" cfg.Server.Web.BindPort = 7500
} cfg.Server.Web.Enabled = true
if cfg.Web.BindPort == 0 {
cfg.Web.BindPort = 7500
cfg.Web.Enabled = true
} }
// Token 未配置时自动生成 32 位 // Token 未配置时自动生成 32 位
@@ -126,11 +111,11 @@ func generateToken(length int) string {
// GenerateWebCredentials 生成 Web 控制台凭据 // GenerateWebCredentials 生成 Web 控制台凭据
func GenerateWebCredentials(cfg *ServerConfig) bool { func GenerateWebCredentials(cfg *ServerConfig) bool {
if cfg.Web.Username == "" { if cfg.Server.Web.Username == "" {
cfg.Web.Username = "admin" cfg.Server.Web.Username = "admin"
} }
if cfg.Web.Password == "" { if cfg.Server.Web.Password == "" {
cfg.Web.Password = generateToken(16) cfg.Server.Web.Password = generateToken(16)
return true // 表示生成了新密码 return true // 表示生成了新密码
} }
return false return false

View File

@@ -76,5 +76,21 @@ type JSPluginStore interface {
type Store interface { type Store interface {
ClientStore ClientStore
JSPluginStore JSPluginStore
TrafficStore
Close() error Close() error
} }
// TrafficRecord 流量记录
type TrafficRecord struct {
Timestamp int64 `json:"timestamp"` // Unix 时间戳(小时级别)
Inbound int64 `json:"inbound"` // 入站流量(字节)
Outbound int64 `json:"outbound"` // 出站流量(字节)
}
// TrafficStore 流量存储接口
type TrafficStore interface {
AddTraffic(inbound, outbound int64) error
GetTotalTraffic() (inbound, outbound int64, err error)
Get24HourTraffic() (inbound, outbound int64, err error)
GetHourlyTraffic(hours int) ([]TrafficRecord, error)
}

View File

@@ -4,6 +4,7 @@ import (
"database/sql" "database/sql"
"encoding/json" "encoding/json"
"sync" "sync"
"time"
_ "modernc.org/sqlite" _ "modernc.org/sqlite"
@@ -80,6 +81,33 @@ func (s *SQLiteStore) init() error {
// 迁移:添加 updated_at 列 // 迁移:添加 updated_at 列
s.db.Exec(`ALTER TABLE js_plugins ADD COLUMN updated_at DATETIME DEFAULT CURRENT_TIMESTAMP`) s.db.Exec(`ALTER TABLE js_plugins ADD COLUMN updated_at DATETIME DEFAULT CURRENT_TIMESTAMP`)
// 创建流量统计表
_, err = s.db.Exec(`
CREATE TABLE IF NOT EXISTS traffic_stats (
hour_ts INTEGER PRIMARY KEY,
inbound INTEGER NOT NULL DEFAULT 0,
outbound INTEGER NOT NULL DEFAULT 0
)
`)
if err != nil {
return err
}
// 创建总流量表
_, err = s.db.Exec(`
CREATE TABLE IF NOT EXISTS traffic_total (
id INTEGER PRIMARY KEY CHECK (id = 1),
inbound INTEGER NOT NULL DEFAULT 0,
outbound INTEGER NOT NULL DEFAULT 0
)
`)
if err != nil {
return err
}
// 初始化总流量记录
s.db.Exec(`INSERT OR IGNORE INTO traffic_total (id, inbound, outbound) VALUES (1, 0, 0)`)
return nil return nil
} }
@@ -315,3 +343,82 @@ func (s *SQLiteStore) UpdateJSPluginConfig(name string, config map[string]string
_, err := s.db.Exec(`UPDATE js_plugins SET config = ?, updated_at = CURRENT_TIMESTAMP WHERE name = ?`, string(configJSON), name) _, err := s.db.Exec(`UPDATE js_plugins SET config = ?, updated_at = CURRENT_TIMESTAMP WHERE name = ?`, string(configJSON), name)
return err return err
} }
// ========== 流量统计方法 ==========
// getHourTimestamp 获取当前小时的时间戳
func getHourTimestamp() int64 {
now := time.Now()
return time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location()).Unix()
}
// AddTraffic 添加流量记录
func (s *SQLiteStore) AddTraffic(inbound, outbound int64) error {
s.mu.Lock()
defer s.mu.Unlock()
hourTs := getHourTimestamp()
// 更新小时统计
_, err := s.db.Exec(`
INSERT INTO traffic_stats (hour_ts, inbound, outbound) VALUES (?, ?, ?)
ON CONFLICT(hour_ts) DO UPDATE SET inbound = inbound + ?, outbound = outbound + ?
`, hourTs, inbound, outbound, inbound, outbound)
if err != nil {
return err
}
// 更新总流量
_, err = s.db.Exec(`
UPDATE traffic_total SET inbound = inbound + ?, outbound = outbound + ? WHERE id = 1
`, inbound, outbound)
return err
}
// GetTotalTraffic 获取总流量
func (s *SQLiteStore) GetTotalTraffic() (inbound, outbound int64, err error) {
s.mu.RLock()
defer s.mu.RUnlock()
err = s.db.QueryRow(`SELECT inbound, outbound FROM traffic_total WHERE id = 1`).Scan(&inbound, &outbound)
return
}
// Get24HourTraffic 获取24小时流量
func (s *SQLiteStore) Get24HourTraffic() (inbound, outbound int64, err error) {
s.mu.RLock()
defer s.mu.RUnlock()
cutoff := time.Now().Add(-24 * time.Hour).Unix()
err = s.db.QueryRow(`
SELECT COALESCE(SUM(inbound), 0), COALESCE(SUM(outbound), 0)
FROM traffic_stats WHERE hour_ts >= ?
`, cutoff).Scan(&inbound, &outbound)
return
}
// GetHourlyTraffic 获取每小时流量记录
func (s *SQLiteStore) GetHourlyTraffic(hours int) ([]TrafficRecord, error) {
s.mu.RLock()
defer s.mu.RUnlock()
cutoff := time.Now().Add(-time.Duration(hours) * time.Hour).Unix()
rows, err := s.db.Query(`
SELECT hour_ts, inbound, outbound FROM traffic_stats
WHERE hour_ts >= ? ORDER BY hour_ts ASC
`, cutoff)
if err != nil {
return nil, err
}
defer rows.Close()
var records []TrafficRecord
for rows.Next() {
var r TrafficRecord
if err := rows.Scan(&r.Timestamp, &r.Inbound, &r.Outbound); err != nil {
return nil, err
}
records = append(records, r)
}
return records, nil
}

View File

@@ -32,6 +32,7 @@ type ClientResponse struct {
RemoteAddr string `json:"remote_addr,omitempty" example:"192.168.1.100:54321"` RemoteAddr string `json:"remote_addr,omitempty" example:"192.168.1.100:54321"`
OS string `json:"os,omitempty" example:"linux"` OS string `json:"os,omitempty" example:"linux"`
Arch string `json:"arch,omitempty" example:"amd64"` Arch string `json:"arch,omitempty" example:"amd64"`
Version string `json:"version,omitempty" example:"1.0.0"`
} }
// ClientListItem 客户端列表项 // ClientListItem 客户端列表项

View File

@@ -3,8 +3,9 @@ package dto
// UpdateServerConfigRequest 更新服务器配置请求 // UpdateServerConfigRequest 更新服务器配置请求
// @Description 更新服务器配置 // @Description 更新服务器配置
type UpdateServerConfigRequest struct { type UpdateServerConfigRequest struct {
Server *ServerConfigPart `json:"server"` Server *ServerConfigPart `json:"server"`
Web *WebConfigPart `json:"web"` Web *WebConfigPart `json:"web"`
PluginStore *PluginStoreConfigPart `json:"plugin_store"`
} }
// ServerConfigPart 服务器配置部分 // ServerConfigPart 服务器配置部分
@@ -21,7 +22,6 @@ type ServerConfigPart struct {
// @Description Web 控制台配置 // @Description Web 控制台配置
type WebConfigPart struct { type WebConfigPart struct {
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
BindAddr string `json:"bind_addr" binding:"omitempty"`
BindPort int `json:"bind_port" binding:"omitempty,min=1,max=65535"` BindPort int `json:"bind_port" binding:"omitempty,min=1,max=65535"`
Username string `json:"username" binding:"omitempty,min=3,max=32"` Username string `json:"username" binding:"omitempty,min=3,max=32"`
Password string `json:"password" binding:"omitempty,min=6,max=64"` Password string `json:"password" binding:"omitempty,min=6,max=64"`
@@ -30,8 +30,9 @@ type WebConfigPart struct {
// ServerConfigResponse 服务器配置响应 // ServerConfigResponse 服务器配置响应
// @Description 服务器配置信息 // @Description 服务器配置信息
type ServerConfigResponse struct { type ServerConfigResponse struct {
Server ServerConfigInfo `json:"server"` Server ServerConfigInfo `json:"server"`
Web WebConfigInfo `json:"web"` Web WebConfigInfo `json:"web"`
PluginStore PluginStoreConfigInfo `json:"plugin_store"`
} }
// ServerConfigInfo 服务器配置信息 // ServerConfigInfo 服务器配置信息
@@ -46,8 +47,17 @@ type ServerConfigInfo struct {
// WebConfigInfo Web 配置信息 // WebConfigInfo Web 配置信息
type WebConfigInfo struct { type WebConfigInfo struct {
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
BindAddr string `json:"bind_addr"`
BindPort int `json:"bind_port"` BindPort int `json:"bind_port"`
Username string `json:"username"` Username string `json:"username"`
Password string `json:"password"` // 显示为 **** Password string `json:"password"` // 显示为 ****
} }
// PluginStoreConfigPart 插件商店配置部分
type PluginStoreConfigPart struct {
URL string `json:"url"`
}
// PluginStoreConfigInfo 插件商店配置信息
type PluginStoreConfigInfo struct {
URL string `json:"url"`
}

View File

@@ -39,7 +39,8 @@ type VersionInfo struct {
GitCommit string `json:"git_commit,omitempty"` GitCommit string `json:"git_commit,omitempty"`
BuildTime string `json:"build_time,omitempty"` BuildTime string `json:"build_time,omitempty"`
GoVersion string `json:"go_version,omitempty"` GoVersion string `json:"go_version,omitempty"`
Platform string `json:"platform,omitempty"` OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
} }
// StatusResponse 服务器状态响应 // StatusResponse 服务器状态响应

View File

@@ -115,7 +115,7 @@ func (h *ClientHandler) Get(c *gin.Context) {
return return
} }
online, lastPing, remoteAddr, clientOS, clientArch := h.app.GetServer().GetClientStatus(clientID) online, lastPing, remoteAddr, clientOS, clientArch, clientVersion := h.app.GetServer().GetClientStatus(clientID)
// 复制插件列表 // 复制插件列表
plugins := make([]db.ClientPlugin, len(client.Plugins)) plugins := make([]db.ClientPlugin, len(client.Plugins))
@@ -155,6 +155,7 @@ func (h *ClientHandler) Get(c *gin.Context) {
RemoteAddr: remoteAddr, RemoteAddr: remoteAddr,
OS: clientOS, OS: clientOS,
Arch: clientArch, Arch: clientArch,
Version: clientVersion,
} }
Success(c, resp) Success(c, resp)
@@ -241,7 +242,7 @@ func (h *ClientHandler) Delete(c *gin.Context) {
func (h *ClientHandler) PushConfig(c *gin.Context) { func (h *ClientHandler) PushConfig(c *gin.Context) {
clientID := c.Param("id") clientID := c.Param("id")
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return
@@ -310,7 +311,7 @@ func (h *ClientHandler) Restart(c *gin.Context) {
func (h *ClientHandler) InstallPlugins(c *gin.Context) { func (h *ClientHandler) InstallPlugins(c *gin.Context) {
clientID := c.Param("id") clientID := c.Param("id")
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return
@@ -450,6 +451,17 @@ func (h *ClientHandler) deleteClientPlugin(clientID, pluginID string) error {
return h.app.GetClientStore().UpdateClient(client) return h.app.GetClientStore().UpdateClient(client)
} }
// GetSystemStats 获取客户端系统状态
func (h *ClientHandler) GetSystemStats(c *gin.Context) {
clientID := c.Param("id")
stats, err := h.app.GetServer().GetClientSystemStats(clientID)
if err != nil {
ClientNotOnline(c)
return
}
Success(c, stats)
}
// validateClientID 验证客户端 ID 格式 // validateClientID 验证客户端 ID 格式
func validateClientID(id string) bool { func validateClientID(id string) bool {
if len(id) < 1 || len(id) > 64 { if len(id) < 1 || len(id) > 64 {

View File

@@ -42,12 +42,14 @@ func (h *ConfigHandler) Get(c *gin.Context) {
HeartbeatTimeout: cfg.Server.HeartbeatTimeout, HeartbeatTimeout: cfg.Server.HeartbeatTimeout,
}, },
Web: dto.WebConfigInfo{ Web: dto.WebConfigInfo{
Enabled: cfg.Web.Enabled, Enabled: cfg.Server.Web.Enabled,
BindAddr: cfg.Web.BindAddr, BindPort: cfg.Server.Web.BindPort,
BindPort: cfg.Web.BindPort, Username: cfg.Server.Web.Username,
Username: cfg.Web.Username,
Password: "****", Password: "****",
}, },
PluginStore: dto.PluginStoreConfigInfo{
URL: cfg.Server.PluginStore.URL,
},
} }
Success(c, resp) Success(c, resp)
@@ -93,15 +95,17 @@ func (h *ConfigHandler) Update(c *gin.Context) {
// 更新 Web 配置 // 更新 Web 配置
if req.Web != nil { if req.Web != nil {
cfg.Web.Enabled = req.Web.Enabled cfg.Server.Web.Enabled = req.Web.Enabled
if req.Web.BindAddr != "" {
cfg.Web.BindAddr = req.Web.BindAddr
}
if req.Web.BindPort > 0 { if req.Web.BindPort > 0 {
cfg.Web.BindPort = req.Web.BindPort cfg.Server.Web.BindPort = req.Web.BindPort
} }
cfg.Web.Username = req.Web.Username cfg.Server.Web.Username = req.Web.Username
cfg.Web.Password = req.Web.Password cfg.Server.Web.Password = req.Web.Password
}
// 更新 PluginStore 配置
if req.PluginStore != nil {
cfg.Server.PluginStore.URL = req.PluginStore.URL
} }
if err := h.app.SaveConfig(); err != nil { if err := h.app.SaveConfig(); err != nil {

View File

@@ -14,17 +14,19 @@ type AppInterface interface {
GetConfigPath() string GetConfigPath() string
SaveConfig() error SaveConfig() error
GetJSPluginStore() db.JSPluginStore GetJSPluginStore() db.JSPluginStore
GetTrafficStore() db.TrafficStore
} }
// ServerInterface 服务端接口 // ServerInterface 服务端接口
type ServerInterface interface { type ServerInterface interface {
GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch string) GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch, clientVersion string)
GetAllClientStatus() map[string]struct { GetAllClientStatus() map[string]struct {
Online bool Online bool
LastPing string LastPing string
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
} }
ReloadConfig() error ReloadConfig() error
GetBindAddr() string GetBindAddr() string
@@ -56,6 +58,8 @@ type ServerInterface interface {
IsPortAvailable(port int, excludeClientID string) bool IsPortAvailable(port int, excludeClientID string) bool
// 插件 API 代理 // 插件 API 代理
ProxyPluginAPIRequest(clientID string, req protocol.PluginAPIRequest) (*protocol.PluginAPIResponse, error) ProxyPluginAPIRequest(clientID string, req protocol.PluginAPIRequest) (*protocol.PluginAPIResponse, error)
// 系统状态
GetClientSystemStats(clientID string) (*protocol.SystemStatsResponse, error)
} }
// ConfigField 配置字段 // ConfigField 配置字段

View File

@@ -177,7 +177,7 @@ func (h *JSPluginHandler) PushToClient(c *gin.Context) {
c.ShouldBindJSON(&pushReq) // 忽略错误,允许空请求体 c.ShouldBindJSON(&pushReq) // 忽略错误,允许空请求体
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return

View File

@@ -35,7 +35,7 @@ func (h *LogHandler) StreamLogs(c *gin.Context) {
clientID := c.Param("id") clientID := c.Param("id")
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
c.JSON(400, gin.H{"code": 400, "message": "client not online"}) c.JSON(400, gin.H{"code": 400, "message": "client not online"})
return return

View File

@@ -371,7 +371,7 @@ func (h *PluginHandler) UpdateClientConfig(c *gin.Context) {
} }
// 如果客户端在线,同步配置 // 如果客户端在线,同步配置
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if online { if online {
if err := h.app.GetServer().SyncPluginConfigToClient(clientID, pluginName, req.Config); err != nil { if err := h.app.GetServer().SyncPluginConfigToClient(clientID, pluginName, req.Config); err != nil {
PartialSuccess(c, gin.H{"status": "partial", "port_changed": portChanged}, "config saved but sync failed: "+err.Error()) PartialSuccess(c, gin.H{"status": "partial", "port_changed": portChanged}, "config saved but sync failed: "+err.Error())

View File

@@ -45,7 +45,7 @@ func (h *PluginAPIHandler) ProxyRequest(c *gin.Context) {
} }
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(clientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return

View File

@@ -34,7 +34,7 @@ func NewStoreHandler(app AppInterface) *StoreHandler {
// @Router /api/store/plugins [get] // @Router /api/store/plugins [get]
func (h *StoreHandler) ListPlugins(c *gin.Context) { func (h *StoreHandler) ListPlugins(c *gin.Context) {
cfg := h.app.GetConfig() cfg := h.app.GetConfig()
storeURL := cfg.PluginStore.GetPluginStoreURL() storeURL := cfg.Server.PluginStore.GetPluginStoreURL()
// 从远程 URL 获取插件列表 // 从远程 URL 获取插件列表
client := &http.Client{Timeout: 10 * time.Second} client := &http.Client{Timeout: 10 * time.Second}
@@ -82,7 +82,7 @@ func (h *StoreHandler) Install(c *gin.Context) {
} }
// 检查客户端是否在线 // 检查客户端是否在线
online, _, _, _, _ := h.app.GetServer().GetClientStatus(req.ClientID) online, _, _, _, _, _ := h.app.GetServer().GetClientStatus(req.ClientID)
if !online { if !online {
ClientNotOnline(c) ClientNotOnline(c)
return return

View File

@@ -0,0 +1,76 @@
package handler
import (
"github.com/gin-gonic/gin"
)
// TrafficHandler 流量统计处理器
type TrafficHandler struct {
app AppInterface
}
// NewTrafficHandler 创建流量统计处理器
func NewTrafficHandler(app AppInterface) *TrafficHandler {
return &TrafficHandler{app: app}
}
// GetStats 获取流量统计
// @Summary 获取流量统计
// @Description 获取24小时和总流量统计
// @Tags 流量
// @Produce json
// @Security Bearer
// @Success 200 {object} Response
// @Router /api/traffic/stats [get]
func (h *TrafficHandler) GetStats(c *gin.Context) {
store := h.app.GetTrafficStore()
// 获取24小时流量
in24h, out24h, err := store.Get24HourTraffic()
if err != nil {
InternalError(c, err.Error())
return
}
// 获取总流量
inTotal, outTotal, err := store.GetTotalTraffic()
if err != nil {
InternalError(c, err.Error())
return
}
Success(c, gin.H{
"traffic_24h": gin.H{
"inbound": in24h,
"outbound": out24h,
},
"traffic_total": gin.H{
"inbound": inTotal,
"outbound": outTotal,
},
})
}
// GetHourly 获取每小时流量
// @Summary 获取每小时流量
// @Description 获取最近N小时的流量记录
// @Tags 流量
// @Produce json
// @Security Bearer
// @Param hours query int false "小时数" default(24)
// @Success 200 {object} Response
// @Router /api/traffic/hourly [get]
func (h *TrafficHandler) GetHourly(c *gin.Context) {
hours := 24
store := h.app.GetTrafficStore()
records, err := store.GetHourlyTraffic(hours)
if err != nil {
InternalError(c, err.Error())
return
}
Success(c, gin.H{
"records": records,
})
}

View File

@@ -127,6 +127,7 @@ func getVersionInfo() dto.VersionInfo {
GitCommit: info.GitCommit, GitCommit: info.GitCommit,
BuildTime: info.BuildTime, BuildTime: info.BuildTime,
GoVersion: info.GoVersion, GoVersion: info.GoVersion,
Platform: info.OS + "/" + info.Arch, OS: info.OS,
Arch: info.Arch,
} }
} }

View File

@@ -69,6 +69,7 @@ func (r *GinRouter) SetupRoutes(app handler.AppInterface, jwtAuth *auth.JWTAuth,
api.POST("/client/:id/restart", clientHandler.Restart) api.POST("/client/:id/restart", clientHandler.Restart)
api.POST("/client/:id/install-plugins", clientHandler.InstallPlugins) api.POST("/client/:id/install-plugins", clientHandler.InstallPlugins)
api.POST("/client/:id/plugin/:pluginID/:action", clientHandler.PluginAction) api.POST("/client/:id/plugin/:pluginID/:action", clientHandler.PluginAction)
api.GET("/client/:id/system-stats", clientHandler.GetSystemStats)
// 配置管理 // 配置管理
configHandler := handler.NewConfigHandler(app) configHandler := handler.NewConfigHandler(app)
@@ -110,6 +111,11 @@ func (r *GinRouter) SetupRoutes(app handler.AppInterface, jwtAuth *auth.JWTAuth,
logHandler := handler.NewLogHandler(app) logHandler := handler.NewLogHandler(app)
api.GET("/client/:id/logs", logHandler.StreamLogs) api.GET("/client/:id/logs", logHandler.StreamLogs)
// 流量统计
trafficHandler := handler.NewTrafficHandler(app)
api.GET("/traffic/stats", trafficHandler.GetStats)
api.GET("/traffic/hourly", trafficHandler.GetHourly)
// 插件 API 代理 (通过 Web API 访问客户端插件) // 插件 API 代理 (通过 Web API 访问客户端插件)
pluginAPIHandler := handler.NewPluginAPIHandler(app) pluginAPIHandler := handler.NewPluginAPIHandler(app)
api.Any("/client/:id/plugin-api/:pluginID/*route", pluginAPIHandler.ProxyRequest) api.Any("/client/:id/plugin-api/:pluginID/*route", pluginAPIHandler.ProxyRequest)

View File

@@ -86,6 +86,7 @@ type ClientSession struct {
RemoteAddr string // 客户端 IP 地址 RemoteAddr string // 客户端 IP 地址
OS string // 客户端操作系统 OS string // 客户端操作系统
Arch string // 客户端架构 Arch string // 客户端架构
Version string // 客户端版本
Session *yamux.Session Session *yamux.Session
Rules []protocol.ProxyRule Rules []protocol.ProxyRule
Listeners map[int]net.Listener Listeners map[int]net.Listener
@@ -289,11 +290,11 @@ func (s *Server) handleConnection(conn net.Conn) {
} }
security.LogAuthSuccess(clientIP, clientID) security.LogAuthSuccess(clientIP, clientID)
s.setupClientSession(conn, clientID, authReq.OS, authReq.Arch, rules) s.setupClientSession(conn, clientID, authReq.OS, authReq.Arch, authReq.Version, rules)
} }
// setupClientSession 建立客户端会话 // setupClientSession 建立客户端会话
func (s *Server) setupClientSession(conn net.Conn, clientID, clientOS, clientArch string, rules []protocol.ProxyRule) { func (s *Server) setupClientSession(conn net.Conn, clientID, clientOS, clientArch, clientVersion string, rules []protocol.ProxyRule) {
session, err := yamux.Server(conn, nil) session, err := yamux.Server(conn, nil)
if err != nil { if err != nil {
log.Printf("[Server] Yamux error: %v", err) log.Printf("[Server] Yamux error: %v", err)
@@ -311,6 +312,7 @@ func (s *Server) setupClientSession(conn net.Conn, clientID, clientOS, clientArc
RemoteAddr: remoteAddr, RemoteAddr: remoteAddr,
OS: clientOS, OS: clientOS,
Arch: clientArch, Arch: clientArch,
Version: clientVersion,
Session: session, Session: session,
Rules: rules, Rules: rules,
Listeners: make(map[int]net.Listener), Listeners: make(map[int]net.Listener),
@@ -571,16 +573,16 @@ func (s *Server) sendHeartbeat(cs *ClientSession) bool {
} }
// GetClientStatus 获取客户端状态 // GetClientStatus 获取客户端状态
func (s *Server) GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch string) { func (s *Server) GetClientStatus(clientID string) (online bool, lastPing, remoteAddr, clientOS, clientArch, clientVersion string) {
s.mu.RLock() s.mu.RLock()
defer s.mu.RUnlock() defer s.mu.RUnlock()
if cs, ok := s.clients[clientID]; ok { if cs, ok := s.clients[clientID]; ok {
cs.mu.Lock() cs.mu.Lock()
defer cs.mu.Unlock() defer cs.mu.Unlock()
return true, cs.LastPing.Format(time.RFC3339), cs.RemoteAddr, cs.OS, cs.Arch return true, cs.LastPing.Format(time.RFC3339), cs.RemoteAddr, cs.OS, cs.Arch, cs.Version
} }
return false, "", "", "", "" return false, "", "", "", "", ""
} }
// GetClientPluginStatus 获取客户端插件运行状态 // GetClientPluginStatus 获取客户端插件运行状态
@@ -633,6 +635,7 @@ func (s *Server) GetAllClientStatus() map[string]struct {
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
} { } {
// 先复制客户端引用,避免嵌套锁 // 先复制客户端引用,避免嵌套锁
s.mu.RLock() s.mu.RLock()
@@ -648,6 +651,7 @@ func (s *Server) GetAllClientStatus() map[string]struct {
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
}) })
for _, cs := range clients { for _, cs := range clients {
@@ -658,12 +662,14 @@ func (s *Server) GetAllClientStatus() map[string]struct {
RemoteAddr string RemoteAddr string
OS string OS string
Arch string Arch string
Version string
}{ }{
Online: true, Online: true,
LastPing: cs.LastPing.Format(time.RFC3339), LastPing: cs.LastPing.Format(time.RFC3339),
RemoteAddr: cs.RemoteAddr, RemoteAddr: cs.RemoteAddr,
OS: cs.OS, OS: cs.OS,
Arch: cs.Arch, Arch: cs.Arch,
Version: cs.Version,
} }
cs.mu.Unlock() cs.mu.Unlock()
} }
@@ -1869,3 +1875,46 @@ func (s *Server) StopClientLogStream(sessionID string) {
func boolPtr(b bool) *bool { func boolPtr(b bool) *bool {
return &b return &b
} }
// GetClientSystemStats 获取客户端系统状态
func (s *Server) GetClientSystemStats(clientID string) (*protocol.SystemStatsResponse, error) {
s.mu.RLock()
cs, ok := s.clients[clientID]
s.mu.RUnlock()
if !ok {
return nil, fmt.Errorf("client %s not online", clientID)
}
stream, err := cs.Session.Open()
if err != nil {
return nil, err
}
defer stream.Close()
// 设置超时
stream.SetDeadline(time.Now().Add(10 * time.Second))
// 发送请求
msg, _ := protocol.NewMessage(protocol.MsgTypeSystemStatsRequest, nil)
if err := protocol.WriteMessage(stream, msg); err != nil {
return nil, err
}
// 读取响应
resp, err := protocol.ReadMessage(stream)
if err != nil {
return nil, err
}
if resp.Type != protocol.MsgTypeSystemStatsResponse {
return nil, fmt.Errorf("unexpected response type: %d", resp.Type)
}
var stats protocol.SystemStatsResponse
if err := resp.ParsePayload(&stats); err != nil {
return nil, err
}
return &stats, nil
}

View File

@@ -71,6 +71,10 @@ const (
// 插件 API 路由消息 // 插件 API 路由消息
MsgTypePluginAPIRequest uint8 = 90 // 插件 API 请求 MsgTypePluginAPIRequest uint8 = 90 // 插件 API 请求
MsgTypePluginAPIResponse uint8 = 91 // 插件 API 响应 MsgTypePluginAPIResponse uint8 = 91 // 插件 API 响应
// 系统状态消息
MsgTypeSystemStatsRequest uint8 = 100 // 请求系统状态
MsgTypeSystemStatsResponse uint8 = 101 // 系统状态响应
) )
// Message 基础消息结构 // Message 基础消息结构
@@ -83,8 +87,9 @@ type Message struct {
type AuthRequest struct { type AuthRequest struct {
ClientID string `json:"client_id"` ClientID string `json:"client_id"`
Token string `json:"token"` Token string `json:"token"`
OS string `json:"os,omitempty"` // 客户端操作系统 OS string `json:"os,omitempty"` // 客户端操作系统
Arch string `json:"arch,omitempty"` // 客户端架构 Arch string `json:"arch,omitempty"` // 客户端架构
Version string `json:"version,omitempty"` // 客户端版本
} }
// AuthResponse 认证响应 // AuthResponse 认证响应
@@ -441,3 +446,17 @@ func NewMessage(msgType uint8, data interface{}) (*Message, error) {
func (m *Message) ParsePayload(v interface{}) error { func (m *Message) ParsePayload(v interface{}) error {
return json.Unmarshal(m.Payload, v) return json.Unmarshal(m.Payload, v)
} }
// SystemStatsRequest 系统状态请求
type SystemStatsRequest struct{}
// SystemStatsResponse 系统状态响应
type SystemStatsResponse struct {
CPUUsage float64 `json:"cpu_usage"` // CPU 使用率 (0-100)
MemoryTotal uint64 `json:"memory_total"` // 总内存 (字节)
MemoryUsed uint64 `json:"memory_used"` // 已用内存 (字节)
MemoryUsage float64 `json:"memory_usage"` // 内存使用率 (0-100)
DiskTotal uint64 `json:"disk_total"` // 总磁盘 (字节)
DiskUsed uint64 `json:"disk_used"` // 已用磁盘 (字节)
DiskUsage float64 `json:"disk_usage"` // 磁盘使用率 (0-100)
}

View File

@@ -4,10 +4,17 @@ import (
"io" "io"
"net" "net"
"sync" "sync"
"sync/atomic"
) )
const bufferSize = 32 * 1024 const bufferSize = 32 * 1024
// TrafficStats 流量统计
type TrafficStats struct {
Inbound int64
Outbound int64
}
// Relay 双向数据转发 // Relay 双向数据转发
func Relay(c1, c2 net.Conn) { func Relay(c1, c2 net.Conn) {
var wg sync.WaitGroup var wg sync.WaitGroup
@@ -17,7 +24,6 @@ func Relay(c1, c2 net.Conn) {
defer wg.Done() defer wg.Done()
buf := make([]byte, bufferSize) buf := make([]byte, bufferSize)
_, _ = io.CopyBuffer(dst, src, buf) _, _ = io.CopyBuffer(dst, src, buf)
// 关闭写端,通知对方数据传输完成
if tc, ok := dst.(*net.TCPConn); ok { if tc, ok := dst.(*net.TCPConn); ok {
tc.CloseWrite() tc.CloseWrite()
} }
@@ -27,3 +33,36 @@ func Relay(c1, c2 net.Conn) {
go copyConn(c2, c1) go copyConn(c2, c1)
wg.Wait() wg.Wait()
} }
// RelayWithStats 带流量统计的双向数据转发
func RelayWithStats(c1, c2 net.Conn, onStats func(in, out int64)) {
var wg sync.WaitGroup
var inbound, outbound int64
wg.Add(2)
copyWithCount := func(dst, src net.Conn, counter *int64) {
defer wg.Done()
buf := make([]byte, bufferSize)
for {
n, err := src.Read(buf)
if n > 0 {
atomic.AddInt64(counter, int64(n))
dst.Write(buf[:n])
}
if err != nil {
break
}
}
if tc, ok := dst.(*net.TCPConn); ok {
tc.CloseWrite()
}
}
go copyWithCount(c1, c2, &inbound)
go copyWithCount(c2, c1, &outbound)
wg.Wait()
if onStats != nil {
onStats(inbound, outbound)
}
}

61
pkg/utils/sysinfo.go Normal file
View File

@@ -0,0 +1,61 @@
package utils
import (
"os"
"runtime"
"time"
"github.com/shirou/gopsutil/v3/cpu"
"github.com/shirou/gopsutil/v3/disk"
"github.com/shirou/gopsutil/v3/mem"
)
// SystemStats 系统状态信息
type SystemStats struct {
CPUUsage float64 `json:"cpu_usage"`
MemoryTotal uint64 `json:"memory_total"`
MemoryUsed uint64 `json:"memory_used"`
MemoryUsage float64 `json:"memory_usage"`
DiskTotal uint64 `json:"disk_total"`
DiskUsed uint64 `json:"disk_used"`
DiskUsage float64 `json:"disk_usage"`
}
// GetSystemStats 获取系统状态信息
func GetSystemStats() (*SystemStats, error) {
stats := &SystemStats{}
// CPU 使用率
cpuPercent, err := cpu.Percent(time.Second, false)
if err == nil && len(cpuPercent) > 0 {
stats.CPUUsage = cpuPercent[0]
}
// 内存信息
memInfo, err := mem.VirtualMemory()
if err == nil {
stats.MemoryTotal = memInfo.Total
stats.MemoryUsed = memInfo.Used
stats.MemoryUsage = memInfo.UsedPercent
}
// 磁盘信息 - 获取根目录或当前工作目录所在磁盘
diskPath := "/"
if runtime.GOOS == "windows" {
// Windows 使用当前工作目录所在盘符
if wd, err := os.Getwd(); err == nil && len(wd) >= 2 {
diskPath = wd[:2] + "\\"
} else {
diskPath = "C:\\"
}
}
diskInfo, err := disk.Usage(diskPath)
if err == nil {
stats.DiskTotal = diskInfo.Total
stats.DiskUsed = diskInfo.Used
stats.DiskUsage = diskInfo.UsedPercent
}
return stats, nil
}

View File

@@ -13,6 +13,8 @@ import (
// 版本信息 // 版本信息
var Version = "1.0.0" var Version = "1.0.0"
var GitCommit = ""
var BuildTime = ""
// SetVersion 设置版本号(由 main 包在初始化时调用) // SetVersion 设置版本号(由 main 包在初始化时调用)
func SetVersion(v string) { func SetVersion(v string) {
@@ -21,6 +23,16 @@ func SetVersion(v string) {
} }
} }
// SetBuildInfo 设置构建信息(由 main 包在初始化时调用)
func SetBuildInfo(gitCommit, buildTime string) {
if gitCommit != "" {
GitCommit = gitCommit
}
if buildTime != "" {
BuildTime = buildTime
}
}
// 仓库信息 // 仓库信息
const ( const (
RepoURL = "https://git.92coco.cn/flik/GoTunnel" RepoURL = "https://git.92coco.cn/flik/GoTunnel"
@@ -43,8 +55,8 @@ type Info struct {
func GetInfo() Info { func GetInfo() Info {
return Info{ return Info{
Version: Version, Version: Version,
GitCommit: "", GitCommit: GitCommit,
BuildTime: "", BuildTime: BuildTime,
GoVersion: runtime.Version(), GoVersion: runtime.Version(),
OS: runtime.GOOS, OS: runtime.GOOS,
Arch: runtime.GOARCH, Arch: runtime.GOARCH,

2
web/components.d.ts vendored
View File

@@ -17,8 +17,6 @@ declare module 'vue' {
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default'] HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
InlineLogPanel: typeof import('./src/components/InlineLogPanel.vue')['default'] InlineLogPanel: typeof import('./src/components/InlineLogPanel.vue')['default']
LogViewer: typeof import('./src/components/LogViewer.vue')['default'] LogViewer: typeof import('./src/components/LogViewer.vue')['default']
NIcon: typeof import('naive-ui')['NIcon']
NTag: typeof import('naive-ui')['NTag']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
} }

974
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,6 @@
"dependencies": { "dependencies": {
"@vicons/ionicons5": "^0.13.0", "@vicons/ionicons5": "^0.13.0",
"axios": "^1.13.2", "axios": "^1.13.2",
"naive-ui": "^2.43.2",
"vue": "^3.5.24", "vue": "^3.5.24",
"vue-router": "^4.6.4" "vue-router": "^4.6.4"
}, },
@@ -24,8 +23,6 @@
"postcss": "^8.5.6", "postcss": "^8.5.6",
"tailwindcss": "^4.1.18", "tailwindcss": "^4.1.18",
"typescript": "~5.9.3", "typescript": "~5.9.3",
"unplugin-auto-import": "^20.3.0",
"unplugin-vue-components": "^30.0.0",
"vite": "^7.2.4", "vite": "^7.2.4",
"vue-tsc": "^3.1.4" "vue-tsc": "^3.1.4"
} }

View File

@@ -2,35 +2,41 @@
import { ref, onMounted, computed, watch } from 'vue' import { ref, onMounted, computed, watch } from 'vue'
import { RouterView, useRouter, useRoute } from 'vue-router' import { RouterView, useRouter, useRoute } from 'vue-router'
import { import {
NConfigProvider, NMessageProvider, NDialogProvider, NGlobalStyle, HomeOutline, DesktopOutline, SettingsOutline,
type GlobalThemeOverrides PersonCircleOutline, LogOutOutline, LogoGithub, ServerOutline, CheckmarkCircleOutline, ArrowUpCircleOutline, CloseOutline,
} from 'naive-ui' SunnyOutline, MoonOutline, ContrastOutline
import {
HomeOutline, ExtensionPuzzleOutline, SettingsOutline,
PersonCircleOutline, LogOutOutline, LogoGithub
} from '@vicons/ionicons5' } from '@vicons/ionicons5'
import { getServerStatus, getVersionInfo, removeToken, getToken } from './api' import { getServerStatus, getVersionInfo, checkServerUpdate, applyServerUpdate, removeToken, getToken, type UpdateInfo } from './api'
import { useToast } from './composables/useToast'
import { useConfirm } from './composables/useConfirm'
import { useTheme, type ThemeMode } from './composables/useTheme'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const message = useToast()
const dialog = useConfirm()
const { themeMode, setTheme } = useTheme()
const showThemeMenu = ref(false)
const serverInfo = ref({ bind_addr: '', bind_port: 0 }) const serverInfo = ref({ bind_addr: '', bind_port: 0 })
const clientCount = ref(0) const clientCount = ref(0)
const version = ref('') const version = ref('')
const showUserMenu = ref(false) const showUserMenu = ref(false)
const updateInfo = ref<UpdateInfo | null>(null)
const showUpdateModal = ref(false)
const updatingServer = ref(false)
const isLoginPage = computed(() => route.path === '/login') const isLoginPage = computed(() => route.path === '/login')
const navItems = [ const navItems = [
{ key: 'home', label: '首页', icon: HomeOutline, path: '/' }, { key: 'home', label: '首页', icon: HomeOutline, path: '/' },
{ key: 'plugins', label: '插件', icon: ExtensionPuzzleOutline, path: '/plugins' }, { key: 'clients', label: '客户端', icon: DesktopOutline, path: '/clients' },
{ key: 'settings', label: '设置', icon: SettingsOutline, path: '/settings' } { key: 'settings', label: '设置', icon: SettingsOutline, path: '/settings' }
] ]
const activeNav = computed(() => { const activeNav = computed(() => {
const path = route.path const path = route.path
if (path === '/' || path === '/home') return 'home' if (path === '/' || path === '/home') return 'home'
if (path.startsWith('/client')) return 'home' if (path === '/clients' || path.startsWith('/client/')) return 'clients'
if (path === '/plugins') return 'plugins'
if (path === '/settings') return 'settings' if (path === '/settings') return 'settings'
return 'home' return 'home'
}) })
@@ -56,16 +62,28 @@ const fetchVersion = async () => {
} }
} }
const checkUpdate = async () => {
if (isLoginPage.value || !getToken()) return
try {
const { data } = await checkServerUpdate()
updateInfo.value = data
} catch (e) {
console.error('Failed to check update', e)
}
}
watch(() => route.path, (newPath, oldPath) => { watch(() => route.path, (newPath, oldPath) => {
if (oldPath === '/login' && newPath !== '/login') { if (oldPath === '/login' && newPath !== '/login') {
fetchServerStatus() fetchServerStatus()
fetchVersion() fetchVersion()
checkUpdate()
} }
}) })
onMounted(() => { onMounted(() => {
fetchServerStatus() fetchServerStatus()
fetchVersion() fetchVersion()
checkUpdate()
}) })
const logout = () => { const logout = () => {
@@ -77,81 +95,194 @@ const toggleUserMenu = () => {
showUserMenu.value = !showUserMenu.value showUserMenu.value = !showUserMenu.value
} }
// 紫色渐变主题 const toggleThemeMenu = () => {
const themeOverrides: GlobalThemeOverrides = { showThemeMenu.value = !showThemeMenu.value
common: { }
primaryColor: '#6366f1',
primaryColorHover: '#818cf8', const selectTheme = (mode: ThemeMode) => {
primaryColorPressed: '#4f46e5', setTheme(mode)
}, showThemeMenu.value = false
Layout: { }
headerColor: '#ffffff'
}, const themeIcon = computed(() => {
Tabs: { if (themeMode.value === 'light') return SunnyOutline
tabTextColorActiveLine: '#6366f1', if (themeMode.value === 'dark') return MoonOutline
barColor: '#6366f1' return ContrastOutline
})
const openUpdateModal = () => {
if (updateInfo.value && updateInfo.value.available) {
showUpdateModal.value = true
} }
} }
const formatBytes = (bytes: number): string => {
if (bytes === 0) return '0 B'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
}
const handleApplyServerUpdate = () => {
if (!updateInfo.value?.download_url) {
message.error('没有可用的下载链接')
return
}
dialog.warning({
title: '确认更新服务端',
content: `即将更新服务端到 ${updateInfo.value.latest},更新后服务器将自动重启。确定要继续吗?`,
positiveText: '更新并重启',
negativeText: '取消',
onPositiveClick: async () => {
updatingServer.value = true
try {
await applyServerUpdate(updateInfo.value!.download_url)
message.success('更新已开始,服务器将在几秒后重启')
showUpdateModal.value = false
setTimeout(() => {
window.location.reload()
}, 5000)
} catch (e: any) {
message.error(e.response?.data || '更新失败')
updatingServer.value = false
}
}
})
}
</script> </script>
<template> <template>
<n-config-provider :theme-overrides="themeOverrides"> <div v-if="!isLoginPage" class="app-layout">
<n-global-style /> <!-- Header -->
<n-dialog-provider> <header class="app-header">
<n-message-provider> <div class="header-left">
<div v-if="!isLoginPage" class="app-layout"> <span class="logo">GoTunnel</span>
<!-- Header --> </div>
<header class="app-header"> <nav class="header-nav">
<div class="header-left"> <router-link
<span class="logo">GoTunnel</span> v-for="item in navItems"
</div> :key="item.key"
<nav class="header-nav"> :to="item.path"
<router-link class="nav-item"
v-for="item in navItems" :class="{ active: activeNav === item.key }"
:key="item.key" >
:to="item.path" <component :is="item.icon" class="nav-icon" />
class="nav-item" <span>{{ item.label }}</span>
:class="{ active: activeNav === item.key }" </router-link>
> </nav>
<component :is="item.icon" class="nav-icon" /> <div class="header-right">
<span>{{ item.label }}</span> <!-- Theme Switcher -->
</router-link> <div class="theme-menu" @click="toggleThemeMenu">
</nav> <component :is="themeIcon" class="theme-icon" />
<div class="header-right"> <div v-if="showThemeMenu" class="theme-dropdown" @click.stop>
<div class="user-menu" @click="toggleUserMenu"> <button class="dropdown-item" :class="{ active: themeMode === 'light' }" @click="selectTheme('light')">
<PersonCircleOutline class="user-icon" /> <SunnyOutline class="dropdown-icon" />
<div v-if="showUserMenu" class="user-dropdown" @click.stop> <span>浅色</span>
<button class="dropdown-item" @click="logout"> </button>
<LogOutOutline class="dropdown-icon" /> <button class="dropdown-item" :class="{ active: themeMode === 'dark' }" @click="selectTheme('dark')">
<span>退出登录</span> <MoonOutline class="dropdown-icon" />
</button> <span>深色</span>
</div> </button>
</div> <button class="dropdown-item" :class="{ active: themeMode === 'auto' }" @click="selectTheme('auto')">
</div> <ContrastOutline class="dropdown-icon" />
</header> <span>自动</span>
</button>
<!-- Main Content --> </div>
<main class="main-content">
<RouterView />
</main>
<!-- Footer -->
<footer class="app-footer">
<div class="footer-left">
<span class="brand">GoTunnel</span>
<span v-if="version" class="version">v{{ version }}</span>
</div>
<a href="https://github.com/user/gotunnel" target="_blank" class="footer-link">
<LogoGithub class="footer-icon" />
<span>GitHub</span>
</a>
<span class="copyright">© 2024 Flik. MIT License</span>
</footer>
</div> </div>
<RouterView v-else /> <!-- User Menu -->
</n-message-provider> <div class="user-menu" @click="toggleUserMenu">
</n-dialog-provider> <PersonCircleOutline class="user-icon" />
</n-config-provider> <div v-if="showUserMenu" class="user-dropdown" @click.stop>
<button class="dropdown-item" @click="logout">
<LogOutOutline class="dropdown-icon" />
<span>退出登录</span>
</button>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="main-content">
<RouterView />
</main>
<!-- Footer -->
<footer class="app-footer">
<div class="footer-left">
<span class="brand">GoTunnel</span>
<div v-if="version" class="version-info">
<ServerOutline class="version-icon" />
<span class="version">{{ version.startsWith('v') ? version : 'v' + version }}</span>
<span v-if="updateInfo" class="update-status" :class="{ latest: !updateInfo.available, 'has-update': updateInfo.available }" @click="openUpdateModal">
<template v-if="updateInfo.available">
<ArrowUpCircleOutline class="status-icon" />
<span>新版本 ({{ updateInfo.latest }})</span>
</template>
<template v-else>
<CheckmarkCircleOutline class="status-icon" />
<span>最新版本</span>
</template>
</span>
</div>
</div>
<a href="https://github.com/user/gotunnel" target="_blank" class="footer-link">
<LogoGithub class="footer-icon" />
<span>GitHub</span>
</a>
<span class="copyright">© 2024 Flik. MIT License</span>
</footer>
<!-- Update Modal -->
<div v-if="showUpdateModal" class="modal-overlay" @click.self="showUpdateModal = false">
<div class="update-modal">
<div class="modal-header">
<h3>系统更新</h3>
<button class="close-btn" @click="showUpdateModal = false">
<CloseOutline />
</button>
</div>
<div class="modal-body" v-if="updateInfo">
<div class="update-info-grid">
<div class="info-row">
<span class="info-label">当前版本</span>
<span class="info-value">{{ updateInfo.current }}</span>
</div>
<div class="info-row">
<span class="info-label">最新版本</span>
<span class="info-value highlight">{{ updateInfo.latest }}</span>
</div>
<div v-if="updateInfo.asset_name" class="info-row">
<span class="info-label">文件名</span>
<span class="info-value">{{ updateInfo.asset_name }}</span>
</div>
<div v-if="updateInfo.asset_size" class="info-row">
<span class="info-label">文件大小</span>
<span class="info-value">{{ formatBytes(updateInfo.asset_size) }}</span>
</div>
</div>
<div v-if="updateInfo.release_note" class="release-note">
<span class="note-label">更新日志</span>
<pre>{{ updateInfo.release_note }}</pre>
</div>
</div>
<div class="modal-footer">
<button class="modal-btn" @click="showUpdateModal = false">取消</button>
<button
v-if="updateInfo?.available && updateInfo?.download_url"
class="modal-btn primary"
:disabled="updatingServer"
@click="handleApplyServerUpdate"
>
{{ updatingServer ? '更新中...' : '立即更新' }}
</button>
</div>
</div>
</div>
</div>
<RouterView v-else />
</template> </template>
<style scoped> <style scoped>
@@ -159,16 +290,14 @@ const themeOverrides: GlobalThemeOverrides = {
min-height: 100vh; min-height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #581c87 100%); background: var(--color-bg-primary);
} }
/* Header */ /* Header */
.app-header { .app-header {
height: 60px; height: 56px;
background: rgba(15, 12, 41, 0.9); background: var(--color-bg-secondary);
backdrop-filter: blur(20px); border-bottom: 1px solid var(--color-border);
-webkit-backdrop-filter: blur(20px);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@@ -179,9 +308,10 @@ const themeOverrides: GlobalThemeOverrides = {
} }
.logo { .logo {
font-size: 20px; font-size: 18px;
font-weight: 700; font-weight: 600;
color: white; color: var(--color-text-primary);
letter-spacing: -0.5px;
} }
/* Navigation */ /* Navigation */
@@ -195,21 +325,21 @@ const themeOverrides: GlobalThemeOverrides = {
align-items: center; align-items: center;
gap: 6px; gap: 6px;
padding: 8px 16px; padding: 8px 16px;
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
text-decoration: none; text-decoration: none;
border-radius: 8px; border-radius: 6px;
font-size: 14px; font-size: 14px;
transition: all 0.2s; transition: all 0.15s;
} }
.nav-item:hover { .nav-item:hover {
color: white; color: var(--color-text-primary);
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.06);
} }
.nav-item.active { .nav-item.active {
color: white; color: var(--color-text-primary);
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%); background: var(--color-accent);
} }
.nav-icon { .nav-icon {
@@ -226,25 +356,70 @@ const themeOverrides: GlobalThemeOverrides = {
.user-icon { .user-icon {
width: 28px; width: 28px;
height: 28px; height: 28px;
color: rgba(255, 255, 255, 0.8); color: var(--color-text-secondary);
transition: color 0.2s; transition: color 0.15s;
} }
.user-icon:hover { .user-icon:hover {
color: var(--color-text-primary);
}
/* Theme Menu */
.header-right {
display: flex;
align-items: center;
gap: 12px;
}
.theme-menu {
position: relative;
cursor: pointer;
}
.theme-icon {
width: 24px;
height: 24px;
color: var(--color-text-secondary);
transition: color 0.15s;
}
.theme-icon:hover {
color: var(--color-text-primary);
}
.theme-dropdown {
position: absolute;
top: 100%;
right: 0;
margin-top: 8px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 4px;
min-width: 120px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.dropdown-item.active {
background: var(--color-accent);
color: white; color: white;
} }
.dropdown-item.active:hover {
background: var(--color-accent-hover);
}
.user-dropdown { .user-dropdown {
position: absolute; position: absolute;
top: 100%; top: 100%;
right: 0; right: 0;
margin-top: 8px; margin-top: 8px;
background: rgba(30, 27, 75, 0.95); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px; border-radius: 8px;
padding: 4px; padding: 4px;
min-width: 140px; min-width: 140px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
} }
.dropdown-item { .dropdown-item {
@@ -252,19 +427,18 @@ const themeOverrides: GlobalThemeOverrides = {
align-items: center; align-items: center;
gap: 8px; gap: 8px;
width: 100%; width: 100%;
padding: 8px 12px; padding: 10px 12px;
background: none; background: none;
border: none; border: none;
color: rgba(255, 255, 255, 0.8); color: var(--color-text-primary);
font-size: 13px; font-size: 14px;
cursor: pointer; cursor: pointer;
border-radius: 6px; border-radius: 6px;
transition: all 0.2s; transition: all 0.15s;
} }
.dropdown-item:hover { .dropdown-item:hover {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
color: white;
} }
.dropdown-icon { .dropdown-icon {
@@ -280,10 +454,8 @@ const themeOverrides: GlobalThemeOverrides = {
/* Footer */ /* Footer */
.app-footer { .app-footer {
height: 48px; height: 48px;
background: rgba(15, 12, 41, 0.9); background: var(--color-bg-secondary);
backdrop-filter: blur(20px); border-top: 1px solid var(--color-border);
-webkit-backdrop-filter: blur(20px);
border-top: 1px solid rgba(255, 255, 255, 0.1);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@@ -299,28 +471,70 @@ const themeOverrides: GlobalThemeOverrides = {
.brand { .brand {
font-weight: 600; font-weight: 600;
color: rgba(255, 255, 255, 0.9); color: var(--color-text-primary);
} }
.version { .version {
padding: 2px 8px; padding: 2px 8px;
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
color: rgba(255, 255, 255, 0.7); color: var(--color-text-secondary);
border-radius: 4px; border-radius: 4px;
font-size: 12px; font-size: 12px;
} }
.version-info {
display: flex;
align-items: center;
gap: 6px;
}
.version-icon {
width: 14px;
height: 14px;
color: var(--color-text-secondary);
}
.update-status {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
cursor: pointer;
transition: all 0.15s;
}
.update-status:hover {
opacity: 0.8;
}
.update-status.latest {
color: #00ba7c;
background: rgba(0, 186, 124, 0.1);
}
.update-status.has-update {
color: #f7931a;
background: rgba(247, 147, 26, 0.1);
}
.status-icon {
width: 14px;
height: 14px;
}
.footer-link { .footer-link {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
text-decoration: none; text-decoration: none;
transition: color 0.2s; transition: color 0.15s;
} }
.footer-link:hover { .footer-link:hover {
color: white; color: var(--color-text-primary);
} }
.footer-icon { .footer-icon {
@@ -329,7 +543,7 @@ const themeOverrides: GlobalThemeOverrides = {
} }
.copyright { .copyright {
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
} }
/* Responsive */ /* Responsive */
@@ -347,4 +561,153 @@ const themeOverrides: GlobalThemeOverrides = {
display: none; display: none;
} }
} }
/* Update Modal */
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.update-modal {
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 12px;
width: 90%;
max-width: 480px;
max-height: 80vh;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.modal-header {
padding: 16px 20px;
border-bottom: 1px solid var(--color-border);
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header h3 {
margin: 0;
font-size: 16px;
font-weight: 600;
color: var(--color-text-primary);
}
.close-btn {
background: none;
border: none;
color: var(--color-text-secondary);
cursor: pointer;
padding: 4px;
display: flex;
transition: color 0.15s;
}
.close-btn:hover {
color: var(--color-text-primary);
}
.modal-body {
padding: 20px;
overflow-y: auto;
flex: 1;
}
.update-info-grid {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 16px;
}
.info-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.info-label {
color: var(--color-text-secondary);
font-size: 13px;
}
.info-value {
color: var(--color-text-primary);
font-size: 13px;
font-weight: 500;
}
.info-value.highlight {
color: var(--color-success);
}
.release-note {
margin-top: 16px;
}
.note-label {
display: block;
font-size: 12px;
color: var(--color-text-secondary);
margin-bottom: 8px;
}
.release-note pre {
margin: 0;
white-space: pre-wrap;
font-size: 12px;
color: var(--color-text-secondary);
background: var(--color-bg-elevated);
padding: 12px;
border-radius: 8px;
max-height: 200px;
overflow-y: auto;
}
.modal-footer {
padding: 16px 20px;
border-top: 1px solid var(--color-border);
display: flex;
justify-content: flex-end;
gap: 8px;
}
.modal-btn {
padding: 8px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s;
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
color: var(--color-text-primary);
}
.modal-btn:hover:not(:disabled) {
background: var(--color-border);
}
.modal-btn.primary {
background: var(--color-accent);
border: none;
color: white;
}
.modal-btn.primary:hover:not(:disabled) {
background: var(--color-accent-hover);
}
.modal-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style> </style>

View File

@@ -180,3 +180,66 @@ export const createLogStream = (
return eventSource return eventSource
} }
// 流量统计
export interface TrafficStats {
traffic_24h: { inbound: number; outbound: number }
traffic_total: { inbound: number; outbound: number }
}
export interface TrafficRecord {
timestamp: number
inbound: number
outbound: number
}
export const getTrafficStats = () => get<TrafficStats>('/traffic/stats')
export const getTrafficHourly = () => get<{ records: TrafficRecord[] }>('/traffic/hourly')
// 客户端系统状态
export interface SystemStats {
cpu_usage: number
memory_total: number
memory_used: number
memory_usage: number
disk_total: number
disk_used: number
disk_usage: number
}
export const getClientSystemStats = (clientId: string) => get<SystemStats>(`/client/${clientId}/system-stats`)
// 服务器配置
export interface ServerConfigInfo {
bind_addr: string
bind_port: number
token: string
heartbeat_sec: number
heartbeat_timeout: number
}
export interface WebConfigInfo {
enabled: boolean
bind_port: number
username: string
password: string
}
export interface PluginStoreConfigInfo {
url: string
}
export interface ServerConfigResponse {
server: ServerConfigInfo
web: WebConfigInfo
plugin_store: PluginStoreConfigInfo
}
export interface UpdateServerConfigRequest {
server?: Partial<ServerConfigInfo>
web?: Partial<WebConfigInfo>
plugin_store?: Partial<PluginStoreConfigInfo>
}
export const getServerConfig = () => get<ServerConfigResponse>('/config')
export const updateServerConfig = (config: UpdateServerConfigRequest) => put('/config', config)

View File

@@ -37,8 +37,7 @@ const emit = defineEmits<{
.modal-overlay { .modal-overlay {
position: fixed; position: fixed;
inset: 0; inset: 0;
background: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(4px);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@@ -48,11 +47,9 @@ const emit = defineEmits<{
.modal-container { .modal-container {
width: 100%; width: 100%;
background: rgba(30, 27, 75, 0.95); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border-radius: 12px;
-webkit-backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.12);
overflow: hidden; overflow: hidden;
} }
@@ -61,32 +58,32 @@ const emit = defineEmits<{
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 16px 20px; padding: 16px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 1px solid var(--color-border-light);
} }
.modal-header h3 { .modal-header h3 {
margin: 0; margin: 0;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
color: white; color: var(--color-text-primary);
} }
.close-btn { .close-btn {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
border: none; border: none;
border-radius: 6px; border-radius: 6px;
padding: 6px; padding: 6px;
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.15s;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.close-btn:hover { .close-btn:hover {
background: rgba(239, 68, 68, 0.2); background: rgba(244, 33, 46, 0.15);
color: #fca5a5; color: var(--color-error);
} }
.close-btn svg { .close-btn svg {
@@ -100,7 +97,7 @@ const emit = defineEmits<{
.modal-footer { .modal-footer {
padding: 16px 20px; padding: 16px 20px;
border-top: 1px solid rgba(255, 255, 255, 0.08); border-top: 1px solid var(--color-border-light);
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
gap: 12px; gap: 12px;

View File

@@ -0,0 +1,47 @@
import { ref, watch, onMounted } from 'vue'
export type ThemeMode = 'light' | 'dark' | 'auto'
const STORAGE_KEY = 'gotunnel-theme'
const themeMode = ref<ThemeMode>('auto')
function getSystemTheme(): 'light' | 'dark' {
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
}
function applyTheme(mode: ThemeMode) {
const theme = mode === 'auto' ? getSystemTheme() : mode
document.documentElement.setAttribute('data-theme', theme)
}
export function useTheme() {
onMounted(() => {
const saved = localStorage.getItem(STORAGE_KEY) as ThemeMode | null
if (saved && ['light', 'dark', 'auto'].includes(saved)) {
themeMode.value = saved
}
applyTheme(themeMode.value)
// 监听系统主题变化
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
if (themeMode.value === 'auto') {
applyTheme('auto')
}
})
})
watch(themeMode, (mode) => {
localStorage.setItem(STORAGE_KEY, mode)
applyTheme(mode)
})
const setTheme = (mode: ThemeMode) => {
themeMode.value = mode
}
return {
themeMode,
setTheme
}
}

View File

@@ -1,10 +1,8 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import naive from 'naive-ui'
import './style.css' import './style.css'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
const app = createApp(App) const app = createApp(App)
app.use(router) app.use(router)
app.use(naive)
app.mount('#app') app.mount('#app')

View File

@@ -15,16 +15,16 @@ const router = createRouter({
name: 'home', name: 'home',
component: () => import('../views/HomeView.vue'), component: () => import('../views/HomeView.vue'),
}, },
{
path: '/clients',
name: 'clients',
component: () => import('../views/ClientsView.vue'),
},
{ {
path: '/client/:id', path: '/client/:id',
name: 'client', name: 'client',
component: () => import('../views/ClientView.vue'), component: () => import('../views/ClientView.vue'),
}, },
{
path: '/plugins',
name: 'plugins',
component: () => import('../views/PluginsView.vue'),
},
{ {
path: '/settings', path: '/settings',
name: 'settings', name: 'settings',

View File

@@ -1,5 +1,44 @@
@import "tailwindcss"; @import "tailwindcss";
/* 深色主题(默认) */
:root,
[data-theme="dark"] {
--color-bg-primary: #0f1419;
--color-bg-secondary: #15202b;
--color-bg-tertiary: #1e2732;
--color-bg-elevated: #253341;
--color-border: #38444d;
--color-border-light: #2f3336;
--color-text-primary: #e7e9ea;
--color-text-secondary: #8b98a5;
--color-text-muted: #6e767d;
--color-accent: #1d9bf0;
--color-accent-hover: #1a8cd8;
--color-success: #00ba7c;
--color-warning: #f7931a;
--color-error: #f4212e;
--color-info: #1d9bf0;
}
/* 浅色主题 */
[data-theme="light"] {
--color-bg-primary: #ffffff;
--color-bg-secondary: #f7f9fa;
--color-bg-tertiary: #eff3f4;
--color-bg-elevated: #e7e9ea;
--color-border: #cfd9de;
--color-border-light: #eff3f4;
--color-text-primary: #0f1419;
--color-text-secondary: #536471;
--color-text-muted: #8b98a5;
--color-accent: #1d9bf0;
--color-accent-hover: #1a8cd8;
--color-success: #00ba7c;
--color-warning: #f7931a;
--color-error: #f4212e;
--color-info: #1d9bf0;
}
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
@@ -10,24 +49,21 @@ body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
background: var(--color-bg-primary);
color: var(--color-text-primary);
} }
#app { #app {
min-height: 100vh; min-height: 100vh;
} }
/* Glass morphism utilities */ /* Card utilities */
.glass-card { .glass-card {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border-radius: 12px;
-webkit-backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.18);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
} }
.glass-card-hover:hover { .glass-card-hover:hover {
background: rgba(255, 255, 255, 0.15); background: var(--color-bg-elevated);
box-shadow: 0 12px 48px 0 rgba(31, 38, 135, 0.45);
transform: translateY(-4px);
} }

View File

@@ -76,6 +76,7 @@ export interface ClientDetail {
remote_addr?: string remote_addr?: string
os?: string os?: string
arch?: string arch?: string
version?: string
} }
// 服务器状态 // 服务器状态

View File

@@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted, onUnmounted } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { import {
ArrowBackOutline, CreateOutline, TrashOutline, ArrowBackOutline, CreateOutline, TrashOutline,
PushOutline, AddOutline, StorefrontOutline, DocumentTextOutline, PushOutline, AddOutline, StorefrontOutline, DocumentTextOutline,
ExtensionPuzzleOutline, SettingsOutline, CloudDownloadOutline, RefreshOutline ExtensionPuzzleOutline, SettingsOutline, RefreshOutline
} from '@vicons/ionicons5' } from '@vicons/ionicons5'
import GlassModal from '../components/GlassModal.vue' import GlassModal from '../components/GlassModal.vue'
import GlassTag from '../components/GlassTag.vue' import GlassTag from '../components/GlassTag.vue'
@@ -15,7 +15,7 @@ import {
getClient, updateClient, deleteClient, pushConfigToClient, disconnectClient, restartClient, getClient, updateClient, deleteClient, pushConfigToClient, disconnectClient, restartClient,
getClientPluginConfig, updateClientPluginConfig, getClientPluginConfig, updateClientPluginConfig,
getStorePlugins, installStorePlugin, getRuleSchemas, startClientPlugin, restartClientPlugin, stopClientPlugin, deleteClientPlugin, getStorePlugins, installStorePlugin, getRuleSchemas, startClientPlugin, restartClientPlugin, stopClientPlugin, deleteClientPlugin,
checkClientUpdate, applyClientUpdate, type UpdateInfo checkClientUpdate, applyClientUpdate, getClientSystemStats, type UpdateInfo, type SystemStats
} from '../api' } from '../api'
import type { ProxyRule, ClientPlugin, ConfigField, StorePluginInfo, RuleSchemasMap } from '../types' import type { ProxyRule, ClientPlugin, ConfigField, StorePluginInfo, RuleSchemasMap } from '../types'
import LogViewer from '../components/LogViewer.vue' import LogViewer from '../components/LogViewer.vue'
@@ -37,12 +37,16 @@ const clientPlugins = ref<ClientPlugin[]>([])
const loading = ref(false) const loading = ref(false)
const clientOs = ref('') const clientOs = ref('')
const clientArch = ref('') const clientArch = ref('')
const clientVersion = ref('')
// 客户端更新相关 // 客户端更新相关
const clientUpdate = ref<UpdateInfo | null>(null) const clientUpdate = ref<UpdateInfo | null>(null)
const checkingUpdate = ref(false)
const updatingClient = ref(false) const updatingClient = ref(false)
// 系统状态相关
const systemStats = ref<SystemStats | null>(null)
const loadingStats = ref(false)
// Rule Schemas // Rule Schemas
const pluginRuleSchemas = ref<RuleSchemasMap>({}) const pluginRuleSchemas = ref<RuleSchemasMap>({})
const loadRuleSchemas = async () => { const loadRuleSchemas = async () => {
@@ -103,6 +107,13 @@ const loadClient = async () => {
clientPlugins.value = data.plugins || [] clientPlugins.value = data.plugins || []
clientOs.value = data.os || '' clientOs.value = data.os || ''
clientArch.value = data.arch || '' clientArch.value = data.arch || ''
clientVersion.value = data.version || ''
// 如果客户端在线且有平台信息,自动检测更新
if (data.online && data.os && data.arch) {
autoCheckClientUpdate()
loadSystemStats()
}
} catch (e) { } catch (e) {
message.error('加载客户端信息失败') message.error('加载客户端信息失败')
console.error(e) console.error(e)
@@ -111,32 +122,40 @@ const loadClient = async () => {
} }
} }
// 客户端更新 // 自动检测客户端更新(静默)
const handleCheckClientUpdate = async () => { const autoCheckClientUpdate = async () => {
if (!online.value) {
message.warning('客户端离线,无法检查更新')
return
}
if (!clientOs.value || !clientArch.value) {
message.warning('无法获取客户端平台信息')
return
}
checkingUpdate.value = true
try { try {
const { data } = await checkClientUpdate(clientOs.value, clientArch.value) const { data } = await checkClientUpdate(clientOs.value, clientArch.value)
clientUpdate.value = data clientUpdate.value = data
if (data.download_url) { } catch (e) {
message.success('找到客户端更新: ' + data.latest) console.error('Auto check update failed', e)
} else {
message.info('已是最新版本或未找到对应平台的更新包')
}
} catch (e: any) {
message.error(e.response?.data || '检查更新失败')
} finally {
checkingUpdate.value = false
} }
} }
// 加载系统状态
const loadSystemStats = async () => {
if (!online.value) return
loadingStats.value = true
try {
const { data } = await getClientSystemStats(clientId)
systemStats.value = data
} catch (e) {
console.error('Failed to load system stats', e)
} finally {
loadingStats.value = false
}
}
// 格式化字节大小
const formatBytes = (bytes: number): string => {
if (bytes === 0) return '0 B'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB', 'TB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
}
// 客户端更新
const handleApplyClientUpdate = () => { const handleApplyClientUpdate = () => {
if (!clientUpdate.value?.download_url) { if (!clientUpdate.value?.download_url) {
message.error('没有可用的下载链接') message.error('没有可用的下载链接')
@@ -418,9 +437,22 @@ const handleRestartClient = () => {
} }
// Lifecycle // Lifecycle
const pollTimer = ref<number | null>(null)
onMounted(() => { onMounted(() => {
loadRuleSchemas() loadRuleSchemas()
loadClient() loadClient()
// 启动自动轮询,每 5 秒刷新一次
pollTimer.value = window.setInterval(() => {
loadClient()
}, 5000)
})
onUnmounted(() => {
if (pollTimer.value) {
clearInterval(pollTimer.value)
pollTimer.value = null
}
}) })
// Log Viewer // Log Viewer
@@ -473,11 +505,11 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div class="page-header"> <div class="page-header">
<div class="header-left"> <div class="header-left">
<button class="back-btn" @click="router.push('/')"> <button class="back-btn" @click="router.push('/')">
<n-icon size="20"><ArrowBackOutline /></n-icon> <ArrowBackOutline class="btn-icon-lg" />
</button> </button>
<h1 class="page-title">{{ nickname || clientId }}</h1> <h1 class="page-title">{{ nickname || clientId }}</h1>
<button class="edit-btn" @click="openRenameModal"> <button class="edit-btn" @click="openRenameModal">
<n-icon size="16"><CreateOutline /></n-icon> <CreateOutline class="btn-icon" />
</button> </button>
<span class="status-tag" :class="{ online }"> <span class="status-tag" :class="{ online }">
{{ online ? '在线' : '离线' }} {{ online ? '在线' : '离线' }}
@@ -485,15 +517,15 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
</div> </div>
<div class="header-actions"> <div class="header-actions">
<button v-if="online" class="glass-btn primary" @click="pushConfigToClient(clientId).then(() => message.success('已推送'))"> <button v-if="online" class="glass-btn primary" @click="pushConfigToClient(clientId).then(() => message.success('已推送'))">
<n-icon size="16"><PushOutline /></n-icon> <PushOutline class="btn-icon" />
<span>推送配置</span> <span>推送配置</span>
</button> </button>
<button class="glass-btn" @click="showLogViewer=true"> <button class="glass-btn" @click="showLogViewer=true">
<n-icon size="16"><DocumentTextOutline /></n-icon> <DocumentTextOutline class="btn-icon" />
<span>日志</span> <span>日志</span>
</button> </button>
<button class="glass-btn danger" @click="confirmDelete"> <button class="glass-btn danger" @click="confirmDelete">
<n-icon size="16"><TrashOutline /></n-icon> <TrashOutline class="btn-icon" />
<span>删除</span> <span>删除</span>
</button> </button>
</div> </div>
@@ -507,6 +539,10 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div class="glass-card"> <div class="glass-card">
<div class="card-header"> <div class="card-header">
<h3>客户端状态</h3> <h3>客户端状态</h3>
<!-- Heartbeat indicator -->
<div class="heartbeat-indicator" :class="{ online: online, offline: !online }">
<span class="heartbeat-dot"></span>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="stat-item"> <div class="stat-item">
@@ -517,6 +553,18 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<span class="stat-label">远程 IP</span> <span class="stat-label">远程 IP</span>
<span class="stat-value">{{ remoteAddr || '-' }}</span> <span class="stat-value">{{ remoteAddr || '-' }}</span>
</div> </div>
<div class="stat-item">
<span class="stat-label">客户端版本</span>
<span class="stat-value">
{{ clientVersion || '-' }}
<span v-if="clientUpdate?.available" class="update-badge" @click="handleApplyClientUpdate">
可更新
</span>
<span v-else-if="clientUpdate && !clientUpdate.available" class="latest-badge">
最新版本
</span>
</span>
</div>
<div class="stat-item"> <div class="stat-item">
<span class="stat-label">最后心跳</span> <span class="stat-label">最后心跳</span>
<span class="stat-value">{{ lastPing ? new Date(lastPing).toLocaleTimeString() : '-' }}</span> <span class="stat-value">{{ lastPing ? new Date(lastPing).toLocaleTimeString() : '-' }}</span>
@@ -545,32 +593,51 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
</div> </div>
</div> </div>
<!-- Update Card --> <!-- System Stats Card -->
<div class="glass-card"> <div class="glass-card" v-if="online">
<div class="card-header"> <div class="card-header">
<h3>客户端更新</h3> <h3>系统状态</h3>
<button class="glass-btn tiny" :disabled="!online || checkingUpdate" @click="handleCheckClientUpdate"> <button class="glass-btn tiny" :disabled="loadingStats" @click="loadSystemStats">
<n-icon size="14"><RefreshOutline /></n-icon> <RefreshOutline class="btn-icon-sm" />
检查 刷新
</button> </button>
</div> </div>
<div class="card-body"> <div class="card-body">
<div v-if="clientOs && clientArch" class="platform-info"> <div v-if="!systemStats" class="empty-hint">
平台: {{ clientOs }}/{{ clientArch }} {{ loadingStats ? '加载中...' : '点击刷新获取状态' }}
</div> </div>
<div v-if="!clientUpdate" class="empty-hint">点击检查更新</div>
<template v-else> <template v-else>
<div v-if="clientUpdate.download_url" class="update-available"> <div class="system-stat-item">
<p>发现新版本 {{ clientUpdate.latest }}</p> <span class="system-stat-label">CPU</span>
<button class="glass-btn primary small" :disabled="updatingClient" @click="handleApplyClientUpdate"> <div class="progress-bar">
<n-icon size="14"><CloudDownloadOutline /></n-icon> <div class="progress-fill" :style="{ width: systemStats.cpu_usage + '%' }"></div>
更新 </div>
</button> <span class="system-stat-value">{{ systemStats.cpu_usage.toFixed(1) }}%</span>
</div>
<div class="system-stat-item">
<span class="system-stat-label">内存</span>
<div class="progress-bar">
<div class="progress-fill" :style="{ width: systemStats.memory_usage + '%' }"></div>
</div>
<span class="system-stat-value">{{ systemStats.memory_usage.toFixed(1) }}%</span>
</div>
<div class="system-stat-detail">
{{ formatBytes(systemStats.memory_used) }} / {{ formatBytes(systemStats.memory_total) }}
</div>
<div class="system-stat-item">
<span class="system-stat-label">磁盘</span>
<div class="progress-bar">
<div class="progress-fill" :style="{ width: systemStats.disk_usage + '%' }"></div>
</div>
<span class="system-stat-value">{{ systemStats.disk_usage.toFixed(1) }}%</span>
</div>
<div class="system-stat-detail">
{{ formatBytes(systemStats.disk_used) }} / {{ formatBytes(systemStats.disk_total) }}
</div> </div>
<div v-else class="empty-hint">已是最新版本</div>
</template> </template>
</div> </div>
</div> </div>
</div> </div>
<!-- Right Column --> <!-- Right Column -->
@@ -580,7 +647,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div class="card-header"> <div class="card-header">
<h3>代理规则</h3> <h3>代理规则</h3>
<button class="glass-btn primary small" @click="openCreateRule"> <button class="glass-btn primary small" @click="openCreateRule">
<n-icon size="14"><AddOutline /></n-icon> <AddOutline class="btn-icon-sm" />
添加规则 添加规则
</button> </button>
</div> </div>
@@ -757,7 +824,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<div v-for="plugin in storePlugins" :key="plugin.name" class="store-plugin-card"> <div v-for="plugin in storePlugins" :key="plugin.name" class="store-plugin-card">
<div class="store-plugin-header"> <div class="store-plugin-header">
<span class="store-plugin-name">{{ plugin.name }}</span> <span class="store-plugin-name">{{ plugin.name }}</span>
<n-tag size="small">v{{ plugin.version }}</n-tag> <GlassTag>v{{ plugin.version }}</GlassTag>
</div> </div>
<p class="store-plugin-desc">{{ plugin.description }}</p> <p class="store-plugin-desc">{{ plugin.description }}</p>
<button class="glass-btn primary small full" @click="handleInstallStorePlugin(plugin)"> <button class="glass-btn primary small full" @click="handleInstallStorePlugin(plugin)">
@@ -786,32 +853,15 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
<style scoped> <style scoped>
.client-page { .client-page {
min-height: calc(100vh - 108px); min-height: calc(100vh - 108px);
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #581c87 100%); background: var(--color-bg-primary);
position: relative; position: relative;
overflow: hidden; overflow: hidden;
padding: 32px; padding: 32px;
} }
/* Hide particles */
.particles { .particles {
position: absolute; display: none;
inset: 0;
pointer-events: none;
}
.particle {
position: absolute;
border-radius: 50%;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
animation: float-particle 20s ease-in-out infinite;
}
.particle-1 { width: 250px; height: 250px; top: -80px; right: -50px; }
.particle-2 { width: 180px; height: 180px; bottom: 10%; left: 5%; animation-delay: -7s; }
.particle-3 { width: 120px; height: 120px; top: 50%; right: 15%; animation-delay: -12s; }
@keyframes float-particle {
0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
50% { transform: translate(-20px, -60px) scale(0.95); opacity: 0.4; }
} }
.client-content { .client-content {
@@ -838,26 +888,26 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
} }
.back-btn, .edit-btn { .back-btn, .edit-btn {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-tertiary);
border: none; border: 1px solid var(--color-border);
border-radius: 8px; border-radius: 8px;
padding: 8px; padding: 8px;
color: rgba(255, 255, 255, 0.8); color: var(--color-text-secondary);
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.15s;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.back-btn:hover, .edit-btn:hover { .back-btn:hover, .edit-btn:hover {
background: rgba(255, 255, 255, 0.2); background: var(--color-bg-elevated);
color: white; color: var(--color-text-primary);
} }
.page-title { .page-title {
font-size: 24px; font-size: 24px;
font-weight: 700; font-weight: 700;
color: white; color: var(--color-text-primary);
margin: 0; margin: 0;
} }
@@ -866,13 +916,13 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
border-radius: 20px; border-radius: 20px;
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
background: rgba(239, 68, 68, 0.2); background: rgba(244, 33, 46, 0.15);
color: #fca5a5; color: var(--color-error);
} }
.status-tag.online { .status-tag.online {
background: rgba(52, 211, 153, 0.2); background: rgba(0, 186, 124, 0.15);
color: #34d399; color: var(--color-success);
} }
.header-actions { .header-actions {
@@ -882,21 +932,21 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
/* Glass Button */ /* Glass Button */
.glass-btn { .glass-btn {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-tertiary);
border: 1px solid rgba(255, 255, 255, 0.15); border: 1px solid var(--color-border);
border-radius: 8px; border-radius: 8px;
padding: 8px 16px; padding: 8px 16px;
color: white; color: var(--color-text-primary);
font-size: 13px; font-size: 13px;
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.15s;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
} }
.glass-btn:hover:not(:disabled) { .glass-btn:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.2); background: var(--color-bg-elevated);
} }
.glass-btn:disabled { .glass-btn:disabled {
@@ -905,20 +955,24 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
} }
.glass-btn.primary { .glass-btn.primary {
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%); background: var(--color-accent);
border: none; border: none;
} }
.glass-btn.primary:hover:not(:disabled) {
background: var(--color-accent-hover);
}
.glass-btn.danger { .glass-btn.danger {
background: rgba(239, 68, 68, 0.2); background: rgba(244, 33, 46, 0.15);
border-color: rgba(239, 68, 68, 0.3); border-color: rgba(244, 33, 46, 0.3);
color: #fca5a5; color: var(--color-error);
} }
.glass-btn.warning { .glass-btn.warning {
background: rgba(251, 191, 36, 0.2); background: rgba(247, 147, 26, 0.15);
border-color: rgba(251, 191, 36, 0.3); border-color: rgba(247, 147, 26, 0.3);
color: #fcd34d; color: var(--color-warning);
} }
.glass-btn.small { padding: 6px 12px; font-size: 12px; } .glass-btn.small { padding: 6px 12px; font-size: 12px; }
@@ -944,17 +998,15 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
/* Glass Card */ /* Glass Card */
.glass-card { .glass-card {
background: rgba(255, 255, 255, 0.08); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border-radius: 12px;
-webkit-backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.12);
overflow: hidden; overflow: hidden;
} }
.card-header { .card-header {
padding: 16px 20px; padding: 16px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 1px solid var(--color-border-light);
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
@@ -964,13 +1016,47 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
margin: 0; margin: 0;
font-size: 15px; font-size: 15px;
font-weight: 600; font-weight: 600;
color: white; color: var(--color-text-primary);
}
/* Heartbeat Indicator */
.heartbeat-indicator {
position: relative;
}
.heartbeat-dot {
display: block;
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--color-error);
}
.heartbeat-indicator.online .heartbeat-dot {
background: var(--color-success);
animation: heartbeat-pulse 2s ease-in-out infinite;
}
.heartbeat-indicator.offline .heartbeat-dot {
background: var(--color-error);
animation: none;
}
@keyframes heartbeat-pulse {
0%, 100% {
box-shadow: 0 0 0 0 rgba(0, 186, 124, 0.5);
transform: scale(1);
}
50% {
box-shadow: 0 0 0 6px rgba(0, 186, 124, 0);
transform: scale(1.1);
}
} }
.card-body { padding: 20px; } .card-body { padding: 20px; }
.card-actions { .card-actions {
padding: 16px 20px; padding: 16px 20px;
border-top: 1px solid rgba(255, 255, 255, 0.08); border-top: 1px solid var(--color-border-light);
display: flex; display: flex;
gap: 8px; gap: 8px;
} }
@@ -980,18 +1066,18 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 8px 0; padding: 8px 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.05); border-bottom: 1px solid var(--color-border-light);
} }
.stat-item:last-child { border-bottom: none; } .stat-item:last-child { border-bottom: none; }
.stat-label { .stat-label {
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
font-size: 13px; font-size: 13px;
} }
.stat-value { .stat-value {
color: white; color: var(--color-text-primary);
font-size: 13px; font-size: 13px;
} }
@@ -1000,6 +1086,32 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
font-size: 12px; font-size: 12px;
} }
.update-badge {
display: inline-block;
margin-left: 8px;
padding: 2px 8px;
font-size: 11px;
background: rgba(247, 147, 26, 0.15);
color: var(--color-warning);
border-radius: 10px;
cursor: pointer;
transition: all 0.15s;
}
.update-badge:hover {
background: rgba(247, 147, 26, 0.25);
}
.latest-badge {
display: inline-block;
margin-left: 8px;
padding: 2px 8px;
font-size: 11px;
background: rgba(0, 186, 124, 0.15);
color: var(--color-success);
border-radius: 10px;
}
/* Mini Stats */ /* Mini Stats */
.stats-row { .stats-row {
display: flex; display: flex;
@@ -1014,23 +1126,23 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
display: block; display: block;
font-size: 28px; font-size: 28px;
font-weight: 700; font-weight: 700;
color: white; color: var(--color-text-primary);
} }
.mini-stat-label { .mini-stat-label {
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
} }
/* Update Card */ /* Update Card */
.platform-info { .platform-info {
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
margin-bottom: 8px; margin-bottom: 8px;
} }
.empty-hint { .empty-hint {
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
font-size: 13px; font-size: 13px;
text-align: center; text-align: center;
padding: 16px 0; padding: 16px 0;
@@ -1038,7 +1150,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
.update-available p { .update-available p {
margin: 0 0 8px 0; margin: 0 0 8px 0;
color: #34d399; color: var(--color-success);
font-size: 13px; font-size: 13px;
} }
@@ -1046,7 +1158,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
.empty-state { .empty-state {
text-align: center; text-align: center;
padding: 32px; padding: 32px;
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
} }
.rules-table { .rules-table {
@@ -1062,37 +1174,37 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
} }
.table-header { .table-header {
border-bottom: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 1px solid var(--color-border);
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
} }
.table-row { .table-row {
border-bottom: 1px solid rgba(255, 255, 255, 0.05); border-bottom: 1px solid var(--color-border-light);
color: rgba(255, 255, 255, 0.8); color: var(--color-text-secondary);
font-size: 13px; font-size: 13px;
} }
.rule-name { font-weight: 500; color: white; } .rule-name { font-weight: 500; color: var(--color-text-primary); }
.rule-mapping { font-family: monospace; font-size: 12px; } .rule-mapping { font-family: monospace; font-size: 12px; }
.rule-actions { display: flex; gap: 6px; justify-content: flex-end; } .rule-actions { display: flex; gap: 6px; justify-content: flex-end; }
/* Icon Button */ /* Icon Button */
.icon-btn { .icon-btn {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
border: none; border: none;
border-radius: 6px; border-radius: 6px;
padding: 4px 10px; padding: 4px 10px;
color: rgba(255, 255, 255, 0.8); color: var(--color-text-secondary);
font-size: 12px; font-size: 12px;
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.15s;
} }
.icon-btn:hover:not(:disabled) { .icon-btn:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.2); background: var(--color-border);
color: white; color: var(--color-text-primary);
} }
.icon-btn:disabled { .icon-btn:disabled {
@@ -1101,19 +1213,19 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
} }
.icon-btn.danger { .icon-btn.danger {
color: #fca5a5; color: var(--color-error);
} }
.icon-btn.danger:hover:not(:disabled) { .icon-btn.danger:hover:not(:disabled) {
background: rgba(239, 68, 68, 0.2); background: rgba(244, 33, 46, 0.15);
} }
.icon-btn.success { .icon-btn.success {
color: #34d399; color: var(--color-success);
} }
.icon-btn.success:hover:not(:disabled) { .icon-btn.success:hover:not(:disabled) {
background: rgba(52, 211, 153, 0.2); background: rgba(0, 186, 124, 0.15);
} }
/* Plugins List */ /* Plugins List */
@@ -1124,8 +1236,8 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
} }
.plugin-item { .plugin-item {
background: rgba(255, 255, 255, 0.05); background: var(--color-bg-elevated);
border-radius: 12px; border-radius: 10px;
padding: 16px; padding: 16px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -1140,13 +1252,13 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
.plugin-name { .plugin-name {
font-weight: 600; font-weight: 600;
color: white; color: var(--color-text-primary);
font-size: 14px; font-size: 14px;
} }
.plugin-version { .plugin-version {
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
} }
.plugin-meta { .plugin-meta {
@@ -1154,7 +1266,7 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
align-items: center; align-items: center;
gap: 12px; gap: 12px;
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
} }
.plugin-actions { .plugin-actions {
@@ -1165,10 +1277,10 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
/* Store Plugin Card */ /* Store Plugin Card */
.store-plugin-card { .store-plugin-card {
background: rgba(255, 255, 255, 0.05); background: var(--color-bg-elevated);
border-radius: 12px; border-radius: 10px;
padding: 16px; padding: 16px;
border: 1px solid rgba(255, 255, 255, 0.08); border: 1px solid var(--color-border-light);
} }
.store-plugin-header { .store-plugin-header {
@@ -1180,12 +1292,12 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
.store-plugin-name { .store-plugin-name {
font-weight: 600; font-weight: 600;
color: white; color: var(--color-text-primary);
font-size: 14px; font-size: 14px;
} }
.store-plugin-desc { .store-plugin-desc {
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
font-size: 12px; font-size: 12px;
margin: 0 0 12px 0; margin: 0 0 12px 0;
line-height: 1.5; line-height: 1.5;
@@ -1210,29 +1322,29 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
.form-label { .form-label {
display: block; display: block;
font-size: 13px; font-size: 13px;
color: rgba(255, 255, 255, 0.7); color: var(--color-text-secondary);
margin-bottom: 6px; margin-bottom: 6px;
} }
.form-input { .form-input {
width: 100%; width: 100%;
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
border: 1px solid rgba(255, 255, 255, 0.15); border: 1px solid var(--color-border);
border-radius: 8px; border-radius: 8px;
padding: 10px 12px; padding: 10px 12px;
color: white; color: var(--color-text-primary);
font-size: 14px; font-size: 14px;
outline: none; outline: none;
transition: border-color 0.2s; transition: border-color 0.15s;
box-sizing: border-box; box-sizing: border-box;
} }
.form-input:focus { .form-input:focus {
border-color: rgba(167, 139, 250, 0.5); border-color: var(--color-accent);
} }
.form-input::placeholder { .form-input::placeholder {
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
} }
.form-input:disabled { .form-input:disabled {
@@ -1242,26 +1354,26 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
.form-select { .form-select {
width: 100%; width: 100%;
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
border: 1px solid rgba(255, 255, 255, 0.15); border: 1px solid var(--color-border);
border-radius: 8px; border-radius: 8px;
padding: 10px 12px; padding: 10px 12px;
color: white; color: var(--color-text-primary);
font-size: 14px; font-size: 14px;
outline: none; outline: none;
cursor: pointer; cursor: pointer;
} }
.form-select option { .form-select option {
background: #1e1b4b; background: var(--color-bg-tertiary);
color: white; color: var(--color-text-primary);
} }
.form-toggle { .form-toggle {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
color: rgba(255, 255, 255, 0.7); color: var(--color-text-secondary);
font-size: 13px; font-size: 13px;
cursor: pointer; cursor: pointer;
} }
@@ -1269,13 +1381,13 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
.form-toggle input[type="checkbox"] { .form-toggle input[type="checkbox"] {
width: 18px; width: 18px;
height: 18px; height: 18px;
accent-color: #a78bfa; accent-color: var(--color-accent);
} }
.loading-state { .loading-state {
text-align: center; text-align: center;
padding: 32px; padding: 32px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
} }
/* Dropdown Menu */ /* Dropdown Menu */
@@ -1288,9 +1400,8 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
top: 100%; top: 100%;
right: 0; right: 0;
margin-top: 4px; margin-top: 4px;
background: rgba(30, 27, 75, 0.95); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px; border-radius: 8px;
padding: 4px; padding: 4px;
min-width: 100px; min-width: 100px;
@@ -1303,17 +1414,17 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
padding: 8px 12px; padding: 8px 12px;
background: none; background: none;
border: none; border: none;
color: rgba(255, 255, 255, 0.8); color: var(--color-text-secondary);
font-size: 13px; font-size: 13px;
text-align: left; text-align: left;
cursor: pointer; cursor: pointer;
border-radius: 4px; border-radius: 4px;
transition: all 0.2s; transition: all 0.15s;
} }
.dropdown-menu button:hover:not(:disabled) { .dropdown-menu button:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
color: white; color: var(--color-text-primary);
} }
.dropdown-menu button:disabled { .dropdown-menu button:disabled {
@@ -1322,11 +1433,11 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
} }
.dropdown-menu button.danger { .dropdown-menu button.danger {
color: #fca5a5; color: var(--color-error);
} }
.dropdown-menu button.danger:hover:not(:disabled) { .dropdown-menu button.danger:hover:not(:disabled) {
background: rgba(239, 68, 68, 0.2); background: rgba(244, 33, 46, 0.15);
} }
/* Icon styles */ /* Icon styles */
@@ -1335,14 +1446,69 @@ const handleDeletePlugin = (plugin: ClientPlugin) => {
height: 14px; height: 14px;
} }
.btn-icon-lg {
width: 20px;
height: 20px;
}
.btn-icon-sm {
width: 14px;
height: 14px;
}
.plugin-icon { .plugin-icon {
width: 18px; width: 18px;
height: 18px; height: 18px;
color: #a78bfa; color: var(--color-accent);
} }
.settings-icon { .settings-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
} }
/* System Stats */
.system-stat-item {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 8px;
}
.system-stat-label {
width: 40px;
font-size: 12px;
color: var(--color-text-secondary);
}
.progress-bar {
flex: 1;
height: 8px;
background: var(--color-bg-elevated);
border-radius: 4px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: var(--color-accent);
border-radius: 4px;
transition: width 0.3s ease;
}
.system-stat-value {
width: 50px;
text-align: right;
font-size: 12px;
color: var(--color-text-primary);
font-family: monospace;
}
.system-stat-detail {
font-size: 11px;
color: var(--color-text-muted);
text-align: right;
margin-bottom: 12px;
margin-top: -4px;
}
</style> </style>

View File

@@ -0,0 +1,337 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
import { getClients } from '../api'
import type { ClientStatus } from '../types'
const router = useRouter()
const clients = ref<ClientStatus[]>([])
const loading = ref(true)
const loadClients = async () => {
loading.value = true
try {
const { data } = await getClients()
clients.value = data || []
} catch (e) {
console.error('Failed to load clients', e)
} finally {
loading.value = false
}
}
const onlineClients = computed(() => clients.value.filter(c => c.online).length)
const viewClient = (id: string) => {
router.push(`/client/${id}`)
}
onMounted(loadClients)
</script>
<template>
<div class="clients-page">
<!-- Particles -->
<div class="particles">
<div class="particle particle-1"></div>
<div class="particle particle-2"></div>
<div class="particle particle-3"></div>
</div>
<div class="clients-content">
<!-- Header -->
<div class="page-header">
<h1 class="page-title">客户端管理</h1>
<p class="page-subtitle">管理所有连接的客户端</p>
</div>
<!-- Stats Row -->
<div class="stats-row">
<div class="stat-card">
<span class="stat-value">{{ clients.length }}</span>
<span class="stat-label">总客户端</span>
</div>
<div class="stat-card">
<span class="stat-value online">{{ onlineClients }}</span>
<span class="stat-label">在线</span>
</div>
<div class="stat-card">
<span class="stat-value offline">{{ clients.length - onlineClients }}</span>
<span class="stat-label">离线</span>
</div>
</div>
<!-- Client List -->
<div class="glass-card">
<div class="card-header">
<h3>客户端列表</h3>
<button class="glass-btn small" @click="loadClients">刷新</button>
</div>
<div class="card-body">
<div v-if="loading" class="loading-state">加载中...</div>
<div v-else-if="clients.length === 0" class="empty-state">
<p>暂无客户端连接</p>
<p class="empty-hint">等待客户端连接...</p>
</div>
<div v-else class="clients-grid">
<div
v-for="client in clients"
:key="client.id"
class="client-card"
@click="viewClient(client.id)"
>
<div class="client-header">
<div class="client-status" :class="{ online: client.online }"></div>
<h4 class="client-name">{{ client.nickname || client.id }}</h4>
</div>
<p v-if="client.nickname" class="client-id">{{ client.id }}</p>
<div class="client-info">
<span v-if="client.remote_addr && client.online">{{ client.remote_addr }}</span>
<span>{{ client.rule_count || 0 }} 条规则</span>
</div>
<div class="client-tag" :class="client.online ? 'online' : 'offline'">
{{ client.online ? '在线' : '离线' }}
</div>
<!-- Heartbeat indicator -->
<div class="heartbeat-indicator" :class="{ online: client.online, offline: !client.online }">
<span class="heartbeat-dot"></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.clients-page {
min-height: calc(100vh - 108px);
background: var(--color-bg-primary);
position: relative;
overflow: hidden;
padding: 32px;
}
/* Hide particles */
.particles {
display: none;
}
.clients-content {
position: relative;
z-index: 10;
max-width: 1200px;
margin: 0 auto;
}
.page-header { margin-bottom: 24px; }
.page-title {
font-size: 28px;
font-weight: 700;
color: var(--color-text-primary);
margin: 0 0 8px 0;
}
.page-subtitle {
color: var(--color-text-secondary);
margin: 0;
font-size: 14px;
}
/* Stats */
.stats-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 24px;
}
.stat-card {
background: var(--color-bg-tertiary);
border-radius: 12px;
border: 1px solid var(--color-border);
padding: 20px;
text-align: center;
}
.stat-value {
display: block;
font-size: 32px;
font-weight: 700;
color: var(--color-text-primary);
}
.stat-value.online { color: var(--color-success); }
.stat-value.offline { color: var(--color-text-muted); }
.stat-label {
font-size: 13px;
color: var(--color-text-secondary);
}
/* Glass Card */
.glass-card {
background: var(--color-bg-tertiary);
border-radius: 12px;
border: 1px solid var(--color-border);
}
.card-header {
padding: 16px 20px;
border-bottom: 1px solid var(--color-border-light);
display: flex;
justify-content: space-between;
align-items: center;
}
.card-header h3 {
margin: 0;
font-size: 15px;
font-weight: 600;
color: var(--color-text-primary);
}
.card-body { padding: 20px; }
.loading-state, .empty-state {
text-align: center;
padding: 48px;
color: var(--color-text-muted);
}
.empty-hint {
font-size: 13px;
color: var(--color-text-muted);
margin-top: 8px;
}
/* Clients Grid */
.clients-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}
@media (max-width: 900px) {
.clients-grid { grid-template-columns: repeat(2, 1fr); }
.stats-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
.clients-grid { grid-template-columns: 1fr; }
}
.client-card {
background: var(--color-bg-elevated);
border-radius: 10px;
padding: 16px;
border: 1px solid var(--color-border-light);
cursor: pointer;
transition: all 0.15s;
position: relative;
}
.client-card:hover {
background: var(--color-border);
}
.client-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 8px;
}
.client-status {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--color-text-muted);
}
.client-status.online {
background: var(--color-success);
box-shadow: 0 0 8px rgba(0, 186, 124, 0.6);
}
.client-name {
font-size: 15px;
font-weight: 600;
color: var(--color-text-primary);
margin: 0;
}
.client-id {
font-size: 12px;
color: var(--color-text-muted);
margin: 0 0 8px 0;
font-family: monospace;
}
.client-info {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 13px;
color: var(--color-text-secondary);
margin-bottom: 12px;
}
.client-tag {
display: inline-block;
padding: 4px 10px;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
}
.client-tag.online {
background: rgba(0, 186, 124, 0.15);
color: var(--color-success);
}
.client-tag.offline {
background: var(--color-bg-tertiary);
color: var(--color-text-muted);
}
/* Button */
.glass-btn {
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 8px 16px;
color: var(--color-text-primary);
font-size: 13px;
cursor: pointer;
transition: all 0.15s;
}
.glass-btn:hover { background: var(--color-border); }
.glass-btn.small { padding: 6px 12px; font-size: 12px; }
/* Heartbeat Indicator */
.heartbeat-indicator {
position: absolute;
top: 16px;
right: 16px;
}
.heartbeat-dot {
display: block;
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--color-error);
}
.heartbeat-indicator.online .heartbeat-dot {
background: var(--color-success);
animation: heartbeat-pulse 2s ease-in-out infinite;
}
.heartbeat-indicator.offline .heartbeat-dot {
background: var(--color-error);
animation: none;
}
@keyframes heartbeat-pulse {
0%, 100% {
box-shadow: 0 0 0 0 rgba(0, 186, 124, 0.5);
transform: scale(1);
}
50% {
box-shadow: 0 0 0 6px rgba(0, 186, 124, 0);
transform: scale(1.1);
}
}
</style>

View File

@@ -1,33 +1,63 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed } from 'vue' import { ref, onMounted, computed } from 'vue'
import { getClients } from '../api' import { getClients, getTrafficStats, getTrafficHourly, type TrafficRecord } from '../api'
import type { ClientStatus } from '../types' import type { ClientStatus } from '../types'
const clients = ref<ClientStatus[]>([]) const clients = ref<ClientStatus[]>([])
// Mock data for traffic (API not implemented yet) // 流量统计数据
const trafficStats = ref({ const traffic24h = ref({ inbound: 0, outbound: 0 })
inbound: 0, const trafficTotal = ref({ inbound: 0, outbound: 0 })
outbound: 0, const trafficHistory = ref<TrafficRecord[]>([])
inboundUnit: 'GB',
outboundUnit: 'GB'
})
// Mock 24h traffic data for chart // 格式化字节数
const trafficHistory = ref<Array<{ hour: string; inbound: number; outbound: number }>>([]) const formatBytes = (bytes: number): { value: string; unit: string } => {
if (bytes === 0) return { value: '0', unit: 'B' }
const generateMockTrafficData = () => { const k = 1024
const data = [] const sizes: string[] = ['B', 'KB', 'MB', 'GB', 'TB']
const now = new Date() const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1)
for (let i = 23; i >= 0; i--) { return {
const hour = new Date(now.getTime() - i * 60 * 60 * 1000) value: parseFloat((bytes / Math.pow(k, i)).toFixed(2)).toString(),
data.push({ unit: sizes[i] as string
hour: hour.getHours().toString().padStart(2, '0') + ':00', }
inbound: Math.random() * 100, }
outbound: Math.random() * 80
}) // 加载流量统计
const loadTrafficStats = async () => {
try {
const { data } = await getTrafficStats()
traffic24h.value = data.traffic_24h
trafficTotal.value = data.traffic_total
} catch (e) {
console.error('Failed to load traffic stats', e)
}
}
// 加载每小时流量
const loadTrafficHourly = async () => {
try {
const { data } = await getTrafficHourly()
const records = data.records || []
// 如果没有数据生成从当前时间开始的24小时空数据
if (records.length === 0) {
const now = new Date()
const currentHour = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours())
const emptyRecords: TrafficRecord[] = []
for (let i = 23; i >= 0; i--) {
const ts = new Date(currentHour.getTime() - i * 3600 * 1000)
emptyRecords.push({
timestamp: Math.floor(ts.getTime() / 1000),
inbound: 0,
outbound: 0
})
}
trafficHistory.value = emptyRecords
} else {
trafficHistory.value = records
}
} catch (e) {
console.error('Failed to load hourly traffic', e)
} }
trafficHistory.value = data
} }
const loadClients = async () => { const loadClients = async () => {
@@ -47,6 +77,12 @@ const totalRules = computed(() => {
return clients.value.reduce((sum, c) => sum + (c.rule_count || 0), 0) return clients.value.reduce((sum, c) => sum + (c.rule_count || 0), 0)
}) })
// 格式化后的流量统计
const formatted24hInbound = computed(() => formatBytes(traffic24h.value.inbound))
const formatted24hOutbound = computed(() => formatBytes(traffic24h.value.outbound))
const formattedTotalInbound = computed(() => formatBytes(trafficTotal.value.inbound))
const formattedTotalOutbound = computed(() => formatBytes(trafficTotal.value.outbound))
// Chart helpers // Chart helpers
const maxTraffic = computed(() => { const maxTraffic = computed(() => {
const max = Math.max( const max = Math.max(
@@ -59,9 +95,16 @@ const getBarHeight = (value: number) => {
return (value / maxTraffic.value) * 100 return (value / maxTraffic.value) * 100
} }
// 格式化时间戳为小时
const formatHour = (timestamp: number) => {
const date = new Date(timestamp * 1000)
return date.getHours().toString().padStart(2, '0') + ':00'
}
onMounted(() => { onMounted(() => {
loadClients() loadClients()
generateMockTrafficData() loadTrafficStats()
loadTrafficHourly()
}) })
</script> </script>
@@ -80,8 +123,8 @@ onMounted(() => {
<div class="dashboard-content"> <div class="dashboard-content">
<!-- Header --> <!-- Header -->
<div class="dashboard-header"> <div class="dashboard-header">
<h1 class="text-3xl font-bold text-white mb-2">Dashboard</h1> <h1 class="text-3xl font-bold text-white mb-2">仪表盘</h1>
<p class="text-white/70">Monitor your tunnel connections and traffic</p> <p class="text-white/70">监控隧道连接和流量状态</p>
</div> </div>
<!-- Stats Grid --> <!-- Stats Grid -->
@@ -94,9 +137,11 @@ onMounted(() => {
</svg> </svg>
</div> </div>
<div class="stat-content"> <div class="stat-content">
<span class="stat-label">出站流量</span> <span class="stat-label">24h出站</span>
<span class="stat-value">{{ trafficStats.outbound.toFixed(2) }}</span> <div class="stat-value-row">
<span class="stat-unit">{{ trafficStats.outboundUnit }}</span> <span class="stat-value">{{ formatted24hOutbound.value }}</span>
<span class="stat-unit-inline">{{ formatted24hOutbound.unit }}</span>
</div>
</div> </div>
</div> </div>
@@ -108,9 +153,43 @@ onMounted(() => {
</svg> </svg>
</div> </div>
<div class="stat-content"> <div class="stat-content">
<span class="stat-label">入站流量</span> <span class="stat-label">24h入站</span>
<span class="stat-value">{{ trafficStats.inbound.toFixed(2) }}</span> <div class="stat-value-row">
<span class="stat-unit">{{ trafficStats.inboundUnit }}</span> <span class="stat-value">{{ formatted24hInbound.value }}</span>
<span class="stat-unit-inline">{{ formatted24hInbound.unit }}</span>
</div>
</div>
</div>
<!-- Total Outbound Traffic -->
<div class="stat-card glass-stat">
<div class="stat-icon total-out">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 11l5-5m0 0l5 5m-5-5v12" />
</svg>
</div>
<div class="stat-content">
<span class="stat-label">总出站</span>
<div class="stat-value-row">
<span class="stat-value">{{ formattedTotalOutbound.value }}</span>
<span class="stat-unit-inline">{{ formattedTotalOutbound.unit }}</span>
</div>
</div>
</div>
<!-- Total Inbound Traffic -->
<div class="stat-card glass-stat">
<div class="stat-icon total-in">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 13l-5 5m0 0l-5-5m5 5V6" />
</svg>
</div>
<div class="stat-content">
<span class="stat-label">总入站</span>
<div class="stat-value-row">
<span class="stat-value">{{ formattedTotalInbound.value }}</span>
<span class="stat-unit-inline">{{ formattedTotalInbound.unit }}</span>
</div>
</div> </div>
</div> </div>
@@ -168,13 +247,10 @@ onMounted(() => {
<div class="bar inbound" :style="{ height: getBarHeight(data.inbound) + '%' }"></div> <div class="bar inbound" :style="{ height: getBarHeight(data.inbound) + '%' }"></div>
<div class="bar outbound" :style="{ height: getBarHeight(data.outbound) + '%' }"></div> <div class="bar outbound" :style="{ height: getBarHeight(data.outbound) + '%' }"></div>
</div> </div>
<span class="bar-label">{{ data.hour }}</span> <span class="bar-label">{{ formatHour(data.timestamp) }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="chart-hint">
<span>流量统计功能开发中当前显示模拟数据</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -182,75 +258,18 @@ onMounted(() => {
</template> </template>
<style scoped> <style scoped>
/* Container with gradient background */ /* Container */
.dashboard-container { .dashboard-container {
min-height: calc(100vh - 108px); min-height: calc(100vh - 108px);
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #581c87 100%); background: var(--color-bg-primary);
position: relative; position: relative;
overflow: hidden; overflow: hidden;
padding: 32px; padding: 32px;
} }
/* Floating particles */ /* Hide particles */
.particles { .particles {
position: absolute; display: none;
inset: 0;
pointer-events: none;
overflow: hidden;
}
.particle {
position: absolute;
border-radius: 50%;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
animation: float-particle 20s ease-in-out infinite;
}
.particle-1 {
width: 300px;
height: 300px;
top: -100px;
right: -50px;
animation-delay: 0s;
}
.particle-2 {
width: 200px;
height: 200px;
bottom: 10%;
left: 5%;
animation-delay: -5s;
}
.particle-3 {
width: 150px;
height: 150px;
top: 40%;
right: 20%;
animation-delay: -10s;
}
.particle-4 {
width: 100px;
height: 100px;
top: 20%;
left: 30%;
animation-delay: -15s;
}
.particle-5 {
width: 80px;
height: 80px;
bottom: 30%;
right: 10%;
animation-delay: -8s;
}
@keyframes float-particle {
0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
25% { transform: translate(30px, -40px) scale(1.1); opacity: 0.5; }
50% { transform: translate(-20px, -80px) scale(0.9); opacity: 0.4; }
75% { transform: translate(-40px, -40px) scale(1.05); opacity: 0.35; }
} }
/* Main content */ /* Main content */
@@ -268,7 +287,7 @@ onMounted(() => {
/* Stats Grid */ /* Stats Grid */
.stats-grid { .stats-grid {
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 20px; gap: 20px;
margin-bottom: 32px; margin-bottom: 32px;
} }
@@ -287,31 +306,26 @@ onMounted(() => {
/* Glass stat card */ /* Glass stat card */
.glass-stat { .glass-stat {
background: rgba(255, 255, 255, 0.08); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border-radius: 12px;
-webkit-backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border-radius: 20px; padding: 20px;
border: 1px solid rgba(255, 255, 255, 0.12);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
padding: 24px;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 16px; gap: 16px;
position: relative; position: relative;
transition: all 0.25s ease; transition: all 0.15s;
} }
.glass-stat:hover { .glass-stat:hover {
background: rgba(255, 255, 255, 0.12); background: var(--color-bg-elevated);
transform: translateY(-4px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
} }
/* Stat icon */ /* Stat icon */
.stat-icon { .stat-icon {
width: 48px; width: 44px;
height: 48px; height: 44px;
border-radius: 12px; border-radius: 10px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@@ -319,23 +333,27 @@ onMounted(() => {
} }
.stat-icon.outbound { .stat-icon.outbound {
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%); background: var(--color-accent);
box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
} }
.stat-icon.inbound { .stat-icon.inbound {
background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%); background: #8b5cf6;
box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
} }
.stat-icon.clients { .stat-icon.clients {
background: linear-gradient(135deg, #34d399 0%, #10b981 100%); background: var(--color-success);
box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
} }
.stat-icon.rules { .stat-icon.rules {
background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); background: var(--color-warning);
box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4); }
.stat-icon.total-out {
background: #0284c7;
}
.stat-icon.total-in {
background: #9333ea;
} }
.stat-icon svg { .stat-icon svg {
@@ -347,25 +365,41 @@ onMounted(() => {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 2px;
min-height: 44px;
justify-content: center;
} }
.stat-label { .stat-label {
font-size: 13px; font-size: 13px;
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
font-weight: 500; font-weight: 500;
line-height: 1.2;
} }
.stat-value { .stat-value {
font-size: 32px; font-size: 26px;
font-weight: 700; font-weight: 700;
color: white; color: var(--color-text-primary);
line-height: 1.1; line-height: 1.2;
} }
.stat-unit { .stat-unit {
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
line-height: 1.2;
}
.stat-value-row {
display: flex;
align-items: baseline;
gap: 4px;
}
.stat-unit-inline {
font-size: 14px;
color: var(--color-text-muted);
font-weight: 500;
} }
/* Client count special styling */ /* Client count special styling */
@@ -376,17 +410,17 @@ onMounted(() => {
} }
.client-count .stat-value.online { .client-count .stat-value.online {
color: #34d399; color: var(--color-success);
} }
.client-count .stat-value.total { .client-count .stat-value.total {
font-size: 24px; font-size: 24px;
color: rgba(255, 255, 255, 0.7); color: var(--color-text-secondary);
} }
.stat-separator { .stat-separator {
font-size: 20px; font-size: 20px;
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
} }
/* Stat trend indicator */ /* Stat trend indicator */
@@ -400,8 +434,8 @@ onMounted(() => {
} }
.stat-trend.up { .stat-trend.up {
background: rgba(52, 211, 153, 0.2); background: rgba(0, 186, 124, 0.15);
color: #34d399; color: var(--color-success);
} }
/* Online indicator with pulse */ /* Online indicator with pulse */
@@ -413,20 +447,20 @@ onMounted(() => {
.online-indicator .pulse { .online-indicator .pulse {
display: block; display: block;
width: 12px; width: 10px;
height: 12px; height: 10px;
border-radius: 50%; border-radius: 50%;
background: rgba(255, 255, 255, 0.3); background: var(--color-text-muted);
} }
.online-indicator.active .pulse { .online-indicator.active .pulse {
background: #34d399; background: var(--color-success);
animation: pulse-animation 2s ease-in-out infinite; animation: pulse-animation 2s ease-in-out infinite;
} }
@keyframes pulse-animation { @keyframes pulse-animation {
0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); } 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 186, 124, 0.5); }
50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 50% { box-shadow: 0 0 0 6px rgba(0, 186, 124, 0); }
} }
/* Chart Section */ /* Chart Section */
@@ -442,9 +476,9 @@ onMounted(() => {
} }
.section-title { .section-title {
font-size: 18px; font-size: 16px;
font-weight: 600; font-weight: 600;
color: white; color: var(--color-text-primary);
margin: 0; margin: 0;
} }
@@ -458,7 +492,7 @@ onMounted(() => {
align-items: center; align-items: center;
gap: 6px; gap: 6px;
font-size: 13px; font-size: 13px;
color: rgba(255, 255, 255, 0.7); color: var(--color-text-secondary);
} }
.legend-dot { .legend-dot {
@@ -468,11 +502,11 @@ onMounted(() => {
} }
.legend-item.inbound .legend-dot { .legend-item.inbound .legend-dot {
background: #a78bfa; background: #8b5cf6;
} }
.legend-item.outbound .legend-dot { .legend-item.outbound .legend-dot {
background: #60a5fa; background: var(--color-accent);
} }
/* Chart Card */ /* Chart Card */
@@ -517,34 +551,32 @@ onMounted(() => {
} }
.bar.inbound { .bar.inbound {
background: linear-gradient(180deg, #a78bfa 0%, #8b5cf6 100%); background: #8b5cf6;
} }
.bar.outbound { .bar.outbound {
background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%); background: var(--color-accent);
} }
.bar-label { .bar-label {
font-size: 10px; font-size: 10px;
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
white-space: nowrap; white-space: nowrap;
} }
.chart-hint { .chart-hint {
margin-top: 16px; margin-top: 16px;
padding-top: 16px; padding-top: 16px;
border-top: 1px solid rgba(255, 255, 255, 0.08); border-top: 1px solid var(--color-border);
text-align: center; text-align: center;
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
} }
/* Glass card base */ /* Glass card base */
.glass-card { .glass-card {
background: rgba(255, 255, 255, 0.08); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border-radius: 12px;
-webkit-backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.12);
} }
</style> </style>

View File

@@ -101,77 +101,26 @@ const handleLogin = async () => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #581c87 100%); background: var(--color-bg-primary);
padding: 16px; padding: 16px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
/* Particles */ /* 移除浮动粒子动画 */
.particles { .particles {
position: absolute; display: none;
inset: 0;
pointer-events: none;
overflow: hidden;
}
.particle {
position: absolute;
border-radius: 50%;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
animation: float-particle 20s ease-in-out infinite;
}
.particle-1 {
width: 300px;
height: 300px;
top: -100px;
left: -100px;
animation-delay: 0s;
}
.particle-2 {
width: 200px;
height: 200px;
bottom: -50px;
right: -50px;
animation-delay: -5s;
}
.particle-3 {
width: 150px;
height: 150px;
top: 50%;
right: 10%;
animation-delay: -10s;
}
.particle-4 {
width: 100px;
height: 100px;
bottom: 20%;
left: 10%;
animation-delay: -15s;
}
@keyframes float-particle {
0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
25% { transform: translate(30px, -40px) scale(1.1); opacity: 0.5; }
50% { transform: translate(-20px, -80px) scale(0.9); opacity: 0.4; }
75% { transform: translate(-40px, -40px) scale(1.05); opacity: 0.35; }
} }
/* Login card */ /* Login card */
.login-card { .login-card {
width: 100%; width: 100%;
max-width: 400px; max-width: 380px;
background: rgba(255, 255, 255, 0.08); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border-radius: 16px;
-webkit-backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border-radius: 24px; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0.12); padding: 40px 32px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
padding: 40px;
position: relative; position: relative;
z-index: 10; z-index: 10;
} }
@@ -183,32 +132,31 @@ const handleLogin = async () => {
} }
.logo-icon { .logo-icon {
width: 64px; width: 56px;
height: 64px; height: 56px;
margin: 0 auto 16px; margin: 0 auto 16px;
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%); background: var(--color-accent);
border-radius: 16px; border-radius: 12px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0 4px 16px rgba(96, 165, 250, 0.4);
} }
.logo-icon svg { .logo-icon svg {
color: white; color: white;
width: 32px; width: 28px;
height: 32px; height: 28px;
} }
.logo-text { .logo-text {
font-size: 28px; font-size: 24px;
font-weight: 700; font-weight: 600;
color: white; color: var(--color-text-primary);
margin: 0 0 8px 0; margin: 0 0 8px 0;
} }
.subtitle { .subtitle {
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
margin: 0; margin: 0;
font-size: 14px; font-size: 14px;
} }
@@ -229,31 +177,27 @@ const handleLogin = async () => {
.form-label { .form-label {
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
color: rgba(255, 255, 255, 0.8); color: var(--color-text-primary);
} }
.glass-input { .glass-input {
background: rgba(255, 255, 255, 0.05); background: var(--color-bg-elevated);
backdrop-filter: blur(10px); border: 1px solid var(--color-border);
-webkit-backdrop-filter: blur(10px); border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.1); padding: 12px 14px;
border-radius: 12px; color: var(--color-text-primary);
padding: 14px 16px;
color: white;
font-size: 15px; font-size: 15px;
width: 100%; width: 100%;
transition: all 0.2s ease; transition: all 0.15s;
outline: none; outline: none;
} }
.glass-input:focus { .glass-input:focus {
background: rgba(255, 255, 255, 0.1); border-color: var(--color-accent);
border-color: rgba(255, 255, 255, 0.3);
box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
} }
.glass-input::placeholder { .glass-input::placeholder {
color: rgba(255, 255, 255, 0.4); color: var(--color-text-muted);
} }
.glass-input:disabled { .glass-input:disabled {
@@ -266,11 +210,11 @@ const handleLogin = async () => {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
padding: 12px 16px; padding: 12px 14px;
background: rgba(239, 68, 68, 0.2); background: rgba(244, 33, 46, 0.1);
border: 1px solid rgba(239, 68, 68, 0.3); border: 1px solid rgba(244, 33, 46, 0.3);
border-radius: 12px; border-radius: 8px;
color: #fca5a5; color: var(--color-error);
font-size: 14px; font-size: 14px;
} }
@@ -280,33 +224,27 @@ const handleLogin = async () => {
/* Button */ /* Button */
.glass-button { .glass-button {
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%); background: var(--color-accent);
border: none; border: none;
border-radius: 12px; border-radius: 8px;
padding: 14px 24px; padding: 12px 24px;
color: white; color: white;
font-size: 16px; font-size: 15px;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.15s;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 8px; gap: 8px;
box-shadow: 0 4px 16px rgba(96, 165, 250, 0.4);
} }
.glass-button:hover:not(:disabled) { .glass-button:hover:not(:disabled) {
transform: translateY(-2px); background: var(--color-accent-hover);
box-shadow: 0 6px 24px rgba(96, 165, 250, 0.5);
}
.glass-button:active:not(:disabled) {
transform: translateY(0);
} }
.glass-button:disabled { .glass-button:disabled {
opacity: 0.7; opacity: 0.6;
cursor: not-allowed; cursor: not-allowed;
} }
@@ -329,8 +267,8 @@ const handleLogin = async () => {
text-align: center; text-align: center;
margin-top: 24px; margin-top: 24px;
padding-top: 24px; padding-top: 24px;
border-top: 1px solid rgba(255, 255, 255, 0.1); border-top: 1px solid var(--color-border);
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
font-size: 13px; font-size: 13px;
} }
</style> </style>

View File

@@ -1,762 +0,0 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { ExtensionPuzzleOutline, CodeSlashOutline, SettingsOutline } from '@vicons/ionicons5'
import GlassModal from '../components/GlassModal.vue'
import GlassTag from '../components/GlassTag.vue'
import GlassSwitch from '../components/GlassSwitch.vue'
import { useToast } from '../composables/useToast'
import {
getPlugins, enablePlugin, disablePlugin, getJSPlugins,
pushJSPluginToClient, getClients, updateJSPluginConfig, setJSPluginEnabled
} from '../api'
import type { PluginInfo, JSPlugin, ClientStatus } from '../types'
const message = useToast()
const plugins = ref<PluginInfo[]>([])
const jsPlugins = ref<JSPlugin[]>([])
const clients = ref<ClientStatus[]>([])
const loading = ref(true)
const jsLoading = ref(false)
const activeTab = ref('installed')
const loadPlugins = async () => {
try {
const { data } = await getPlugins()
plugins.value = data || []
} catch (e) {
console.error('Failed to load plugins', e)
} finally {
loading.value = false
}
}
const proxyPlugins = computed(() => plugins.value.filter(p => p.type === 'proxy'))
const appPlugins = computed(() => plugins.value.filter(p => p.type === 'app'))
const togglePlugin = async (plugin: PluginInfo) => {
try {
if (plugin.enabled) {
await disablePlugin(plugin.name)
message.success(`已禁用 ${plugin.name}`)
} else {
await enablePlugin(plugin.name)
message.success(`已启用 ${plugin.name}`)
}
plugin.enabled = !plugin.enabled
} catch (e) {
message.error('操作失败')
}
}
const getTypeLabel = (type: string) => {
const labels: Record<string, string> = { proxy: '协议', app: '应用', service: '服务', tool: '工具' }
return labels[type] || type
}
const handleTabChange = (tab: string) => {
if (tab === 'js' && jsPlugins.value.length === 0) loadJSPlugins()
}
const loadJSPlugins = async () => {
jsLoading.value = true
try {
const { data } = await getJSPlugins()
jsPlugins.value = data || []
} catch (e) {
console.error('Failed to load JS plugins', e)
} finally {
jsLoading.value = false
}
}
const loadClients = async () => {
try {
const { data } = await getClients()
clients.value = data || []
} catch (e) {
console.error('Failed to load clients', e)
}
}
// JS Plugin Push
const showPushModal = ref(false)
const selectedJSPlugin = ref<JSPlugin | null>(null)
const pushClientId = ref('')
const pushRemotePort = ref<number | null>(8080)
const pushing = ref(false)
const openPushModal = (plugin: JSPlugin) => {
selectedJSPlugin.value = plugin
pushClientId.value = ''
pushRemotePort.value = 8080
showPushModal.value = true
}
const handlePushJSPlugin = async () => {
if (!selectedJSPlugin.value || !pushClientId.value) {
message.warning('请选择要推送到的客户端')
return
}
pushing.value = true
try {
await pushJSPluginToClient(selectedJSPlugin.value.name, pushClientId.value, pushRemotePort.value || 0)
message.success(`已推送 ${selectedJSPlugin.value.name}`)
showPushModal.value = false
} catch (e: any) {
message.error(e.response?.data || '推送失败')
} finally {
pushing.value = false
}
}
const onlineClients = computed(() => clients.value.filter(c => c.online))
// JS Plugin Config
const showJSConfigModal = ref(false)
const currentJSPlugin = ref<JSPlugin | null>(null)
const jsConfigItems = ref<Array<{ key: string; value: string }>>([])
const jsConfigSaving = ref(false)
const openJSConfigModal = (plugin: JSPlugin) => {
currentJSPlugin.value = plugin
jsConfigItems.value = Object.entries(plugin.config || {}).map(([key, value]) => ({ key, value }))
if (jsConfigItems.value.length === 0) jsConfigItems.value.push({ key: '', value: '' })
showJSConfigModal.value = true
}
const addJSConfigItem = () => jsConfigItems.value.push({ key: '', value: '' })
const removeJSConfigItem = (index: number) => jsConfigItems.value.splice(index, 1)
const saveJSPluginConfig = async () => {
if (!currentJSPlugin.value) return
jsConfigSaving.value = true
try {
const config: Record<string, string> = {}
for (const item of jsConfigItems.value) {
if (item.key.trim()) config[item.key.trim()] = item.value
}
await updateJSPluginConfig(currentJSPlugin.value.name, config)
const plugin = jsPlugins.value.find(p => p.name === currentJSPlugin.value!.name)
if (plugin) plugin.config = config
message.success('配置已保存')
showJSConfigModal.value = false
} catch (e: any) {
message.error(e.response?.data || '保存失败')
} finally {
jsConfigSaving.value = false
}
}
const toggleJSPlugin = async (plugin: JSPlugin) => {
try {
await setJSPluginEnabled(plugin.name, !plugin.enabled)
plugin.enabled = !plugin.enabled
message.success(plugin.enabled ? `已启用 ${plugin.name}` : `已禁用 ${plugin.name}`)
} catch (e: any) {
message.error(e.response?.data || '操作失败')
}
}
onMounted(() => {
loadPlugins()
loadClients()
})
</script>
<template>
<div class="plugins-page">
<!-- Particles -->
<div class="particles">
<div class="particle particle-1"></div>
<div class="particle particle-2"></div>
<div class="particle particle-3"></div>
</div>
<div class="plugins-content">
<!-- Header -->
<div class="page-header">
<h1 class="page-title">插件管理</h1>
<p class="page-subtitle">管理已安装插件和 JS 插件</p>
</div>
<!-- Stats Row -->
<div class="stats-row">
<div class="stat-card">
<span class="stat-value">{{ plugins.length }}</span>
<span class="stat-label">总插件数</span>
</div>
<div class="stat-card">
<span class="stat-value">{{ proxyPlugins.length }}</span>
<span class="stat-label">协议插件</span>
</div>
<div class="stat-card">
<span class="stat-value">{{ appPlugins.length }}</span>
<span class="stat-label">应用插件</span>
</div>
</div>
<!-- Tabs -->
<div class="glass-card">
<div class="tabs-header">
<button class="tab-btn" :class="{ active: activeTab === 'installed' }" @click="activeTab = 'installed'">
已安装插件
</button>
<button class="tab-btn" :class="{ active: activeTab === 'js' }" @click="activeTab = 'js'; handleTabChange('js')">
JS 插件
</button>
</div>
<!-- Installed Plugins Tab -->
<div v-if="activeTab === 'installed'" class="tab-content">
<div v-if="loading" class="loading-state">加载中...</div>
<div v-else-if="plugins.length === 0" class="empty-state">暂无已安装插件</div>
<div v-else class="plugins-grid">
<div v-for="plugin in plugins" :key="plugin.name" class="plugin-card">
<div class="plugin-header">
<div class="plugin-icon">
<ExtensionPuzzleOutline class="icon-purple" />
</div>
<span class="plugin-name">{{ plugin.name }}</span>
<GlassSwitch :model-value="plugin.enabled" size="small" @update:model-value="togglePlugin(plugin)" />
</div>
<div class="plugin-tags">
<GlassTag>v{{ plugin.version }}</GlassTag>
<GlassTag :type="plugin.type === 'proxy' ? 'info' : 'success'">{{ getTypeLabel(plugin.type) }}</GlassTag>
<GlassTag :type="plugin.source === 'builtin' ? 'default' : 'warning'">
{{ plugin.source === 'builtin' ? '内置' : 'JS' }}
</GlassTag>
</div>
<p class="plugin-desc">{{ plugin.description }}</p>
</div>
</div>
</div>
<!-- JS Plugins Tab -->
<div v-if="activeTab === 'js'" class="tab-content">
<div v-if="jsLoading" class="loading-state">加载中...</div>
<div v-else-if="jsPlugins.length === 0" class="empty-state">暂无 JS 插件</div>
<div v-else class="plugins-grid wide">
<div v-for="plugin in jsPlugins" :key="plugin.name" class="plugin-card js">
<div class="plugin-header">
<div class="plugin-icon js">
<CodeSlashOutline class="icon-yellow" />
</div>
<span class="plugin-name">{{ plugin.name }}</span>
<GlassTag v-if="plugin.version">v{{ plugin.version }}</GlassTag>
<GlassSwitch :model-value="plugin.enabled" size="small" @update:model-value="toggleJSPlugin(plugin)" />
</div>
<div class="plugin-tags">
<GlassTag type="warning">JS</GlassTag>
<GlassTag v-if="plugin.auto_start" type="success">自动启动</GlassTag>
<GlassTag v-if="plugin.signature" type="info">已签名</GlassTag>
</div>
<p class="plugin-desc">{{ plugin.description || '无描述' }}</p>
<p v-if="plugin.author" class="plugin-author">作者: {{ plugin.author }}</p>
<div v-if="Object.keys(plugin.config || {}).length > 0" class="plugin-config-preview">
<span class="config-label">配置:</span>
<div class="config-tags">
<GlassTag v-for="(value, key) in plugin.config" :key="key">
{{ key }}: {{ String(value).length > 10 ? String(value).slice(0, 10) + '...' : value }}
</GlassTag>
</div>
</div>
<div class="plugin-actions">
<button class="glass-btn tiny" @click="openJSConfigModal(plugin)">
<SettingsOutline class="btn-icon" />
配置
</button>
<button v-if="onlineClients.length > 0" class="glass-btn primary tiny" @click="openPushModal(plugin)">
推送到客户端
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- JS Config Modal -->
<GlassModal :show="showJSConfigModal" :title="`${currentJSPlugin?.name || ''} 配置`" @close="showJSConfigModal = false">
<p class="config-hint">编辑插件配置参数</p>
<div v-for="(item, index) in jsConfigItems" :key="index" class="config-row">
<input v-model="item.key" class="form-input config-key" placeholder="参数名" />
<input v-model="item.value" class="form-input config-value" placeholder="参数值" />
<button v-if="jsConfigItems.length > 1" class="icon-btn danger" @click="removeJSConfigItem(index)">删除</button>
</div>
<button class="glass-btn small dashed" @click="addJSConfigItem">添加配置项</button>
<template #footer>
<button class="glass-btn" @click="showJSConfigModal = false">取消</button>
<button class="glass-btn primary" :disabled="jsConfigSaving" @click="saveJSPluginConfig">
{{ jsConfigSaving ? '保存中...' : '保存' }}
</button>
</template>
</GlassModal>
<!-- Push Modal -->
<GlassModal :show="showPushModal" title="推送插件到客户端" width="400px" @close="showPushModal = false">
<div v-if="selectedJSPlugin" class="plugin-info-box">
<p class="plugin-info-name">插件: {{ selectedJSPlugin.name }}</p>
<p class="plugin-info-desc">{{ selectedJSPlugin.description || '无描述' }}</p>
</div>
<div class="form-group">
<label class="form-label">选择客户端</label>
<select v-model="pushClientId" class="form-select">
<option value="" disabled>选择客户端</option>
<option v-for="c in onlineClients" :key="c.id" :value="c.id">{{ c.nickname || c.id }}</option>
</select>
</div>
<div class="form-group">
<label class="form-label">远程端口</label>
<input v-model.number="pushRemotePort" type="number" class="form-input" min="1" max="65535" />
</div>
<template #footer>
<button class="glass-btn" @click="showPushModal = false">取消</button>
<button class="glass-btn primary" :disabled="!pushClientId || pushing" @click="handlePushJSPlugin">
{{ pushing ? '推送中...' : '推送' }}
</button>
</template>
</GlassModal>
</div>
</template>
<style scoped>
.plugins-page {
min-height: calc(100vh - 108px);
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #581c87 100%);
position: relative;
overflow: hidden;
padding: 32px;
}
.particles {
position: absolute;
inset: 0;
pointer-events: none;
}
.particle {
position: absolute;
border-radius: 50%;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
animation: float-particle 20s ease-in-out infinite;
}
.particle-1 { width: 250px; height: 250px; top: -80px; right: -50px; }
.particle-2 { width: 180px; height: 180px; bottom: 10%; left: 5%; animation-delay: -7s; }
.particle-3 { width: 120px; height: 120px; top: 50%; right: 15%; animation-delay: -12s; }
@keyframes float-particle {
0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
50% { transform: translate(-20px, -60px) scale(0.95); opacity: 0.4; }
}
.plugins-content {
position: relative;
z-index: 10;
max-width: 1200px;
margin: 0 auto;
}
.page-header {
margin-bottom: 24px;
}
.page-title {
font-size: 28px;
font-weight: 700;
color: white;
margin: 0 0 8px 0;
}
.page-subtitle {
color: rgba(255, 255, 255, 0.6);
margin: 0;
font-size: 14px;
}
/* Stats Row */
.stats-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 24px;
}
.stat-card {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.12);
padding: 20px;
text-align: center;
}
.stat-value {
display: block;
font-size: 32px;
font-weight: 700;
color: white;
}
.stat-label {
font-size: 13px;
color: rgba(255, 255, 255, 0.6);
}
/* Glass Card */
.glass-card {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.12);
overflow: hidden;
}
/* Tabs */
.tabs-header {
display: flex;
gap: 4px;
padding: 16px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.tab-btn {
background: transparent;
border: none;
padding: 8px 16px;
color: rgba(255, 255, 255, 0.6);
font-size: 14px;
cursor: pointer;
border-radius: 8px;
transition: all 0.2s;
}
.tab-btn:hover {
color: white;
background: rgba(255, 255, 255, 0.1);
}
.tab-btn.active {
color: white;
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
}
.tab-content {
padding: 20px;
}
.loading-state, .empty-state {
text-align: center;
padding: 48px;
color: rgba(255, 255, 255, 0.5);
}
/* Plugins Grid */
.plugins-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}
.plugins-grid.wide {
grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 900px) {
.plugins-grid { grid-template-columns: repeat(2, 1fr); }
.plugins-grid.wide { grid-template-columns: 1fr; }
.stats-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
.plugins-grid { grid-template-columns: 1fr; }
}
/* Plugin Card */
.plugin-card {
background: rgba(255, 255, 255, 0.05);
border-radius: 12px;
padding: 16px;
border: 1px solid rgba(255, 255, 255, 0.08);
}
.plugin-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
}
.plugin-icon {
width: 36px;
height: 36px;
border-radius: 8px;
background: rgba(167, 139, 250, 0.2);
display: flex;
align-items: center;
justify-content: center;
}
.plugin-icon.store {
background: rgba(96, 165, 250, 0.2);
}
.plugin-icon.js {
background: rgba(251, 191, 36, 0.2);
}
.plugin-name {
flex: 1;
font-weight: 600;
color: white;
font-size: 14px;
}
.plugin-tags {
display: flex;
gap: 6px;
flex-wrap: wrap;
margin-bottom: 8px;
}
.plugin-desc {
margin: 0;
color: rgba(255, 255, 255, 0.6);
font-size: 13px;
line-height: 1.5;
}
.plugin-author {
margin: 8px 0 0 0;
color: rgba(255, 255, 255, 0.4);
font-size: 12px;
}
.plugin-config-preview {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.config-label {
display: block;
font-size: 12px;
color: rgba(255, 255, 255, 0.5);
margin-bottom: 6px;
}
.plugin-actions {
display: flex;
gap: 8px;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
/* Glass Button */
.glass-btn {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 6px;
padding: 6px 12px;
color: white;
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 4px;
}
.glass-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
.glass-btn.primary {
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
border: none;
}
.glass-btn.tiny {
padding: 4px 10px;
font-size: 11px;
}
.glass-btn.small {
padding: 6px 12px;
font-size: 12px;
}
.glass-btn.dashed {
border-style: dashed;
}
.glass-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Form Styles */
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
font-size: 13px;
color: rgba(255, 255, 255, 0.7);
margin-bottom: 6px;
}
.form-input {
width: 100%;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 8px;
padding: 10px 12px;
color: white;
font-size: 14px;
outline: none;
transition: border-color 0.2s;
box-sizing: border-box;
}
.form-input:focus {
border-color: rgba(167, 139, 250, 0.5);
}
.form-input::placeholder {
color: rgba(255, 255, 255, 0.4);
}
.form-select {
width: 100%;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 8px;
padding: 10px 12px;
color: white;
font-size: 14px;
outline: none;
cursor: pointer;
}
.form-select option {
background: #1e1b4b;
color: white;
}
.form-toggle {
display: flex;
align-items: center;
gap: 8px;
color: rgba(255, 255, 255, 0.7);
font-size: 13px;
cursor: pointer;
}
.form-toggle input[type="checkbox"] {
width: 18px;
height: 18px;
accent-color: #a78bfa;
}
/* Plugin Info Box */
.plugin-info-box {
background: rgba(255, 255, 255, 0.05);
border-radius: 8px;
padding: 12px;
margin-bottom: 16px;
}
.plugin-info-name {
margin: 0 0 4px 0;
color: white;
font-weight: 500;
}
.plugin-info-desc {
margin: 0;
color: rgba(255, 255, 255, 0.6);
font-size: 13px;
}
/* Config Row */
.config-hint {
margin: 0 0 12px 0;
color: rgba(255, 255, 255, 0.5);
font-size: 13px;
}
.config-row {
display: flex;
gap: 8px;
align-items: center;
margin-bottom: 8px;
}
.config-key {
width: 150px;
flex-shrink: 0;
}
.config-value {
flex: 1;
}
.icon-btn {
background: rgba(255, 255, 255, 0.1);
border: none;
border-radius: 6px;
padding: 6px 10px;
color: rgba(255, 255, 255, 0.7);
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
}
.icon-btn:hover {
background: rgba(255, 255, 255, 0.2);
color: white;
}
.icon-btn.danger {
color: #fca5a5;
}
.icon-btn.danger:hover {
background: rgba(239, 68, 68, 0.2);
}
/* Icon styles */
.icon-purple {
width: 20px;
height: 20px;
color: #a78bfa;
}
.icon-blue {
width: 20px;
height: 20px;
color: #60a5fa;
}
.icon-yellow {
width: 20px;
height: 20px;
color: #fbbf24;
}
.btn-icon {
width: 14px;
height: 14px;
}
.config-tags {
display: flex;
flex-wrap: wrap;
gap: 4px;
}
</style>

View File

@@ -1,22 +1,30 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { CloudDownloadOutline, RefreshOutline, ServerOutline } from '@vicons/ionicons5' import { ServerOutline, SettingsOutline, SaveOutline } from '@vicons/ionicons5'
import GlassTag from '../components/GlassTag.vue'
import { useToast } from '../composables/useToast' import { useToast } from '../composables/useToast'
import { useConfirm } from '../composables/useConfirm'
import { import {
getVersionInfo, checkServerUpdate, applyServerUpdate, getVersionInfo, getServerConfig, updateServerConfig,
type UpdateInfo, type VersionInfo type VersionInfo, type ServerConfigResponse
} from '../api' } from '../api'
const message = useToast() const message = useToast()
const dialog = useConfirm()
const versionInfo = ref<VersionInfo | null>(null) const versionInfo = ref<VersionInfo | null>(null)
const serverUpdate = ref<UpdateInfo | null>(null)
const loading = ref(true) const loading = ref(true)
const checkingServer = ref(false)
const updatingServer = ref(false) // 服务器配置
const serverConfig = ref<ServerConfigResponse | null>(null)
const configLoading = ref(false)
const savingConfig = ref(false)
// 配置表单
const configForm = ref({
heartbeat_sec: 30,
heartbeat_timeout: 90,
web_username: '',
web_password: '',
plugin_store_url: ''
})
const loadVersionInfo = async () => { const loadVersionInfo = async () => {
try { try {
@@ -29,60 +37,58 @@ const loadVersionInfo = async () => {
} }
} }
const handleCheckServerUpdate = async () => { const loadServerConfig = async () => {
checkingServer.value = true configLoading.value = true
try { try {
const { data } = await checkServerUpdate() const { data } = await getServerConfig()
serverUpdate.value = data serverConfig.value = data
if (data.available) { // 填充表单
message.success('发现新版本: ' + data.latest) configForm.value = {
} else { heartbeat_sec: data.server.heartbeat_sec,
message.info('已是最新版本') heartbeat_timeout: data.server.heartbeat_timeout,
web_username: data.web.username,
web_password: '',
plugin_store_url: data.plugin_store.url
} }
} catch (e: any) { } catch (e) {
message.error(e.response?.data || '检查更新失败') console.error('Failed to load server config', e)
} finally { } finally {
checkingServer.value = false configLoading.value = false
} }
} }
const handleApplyServerUpdate = () => { const handleSaveConfig = async () => {
if (!serverUpdate.value?.download_url) { savingConfig.value = true
message.error('没有可用的下载链接') try {
return const updateReq: any = {
} server: {
heartbeat_sec: configForm.value.heartbeat_sec,
dialog.warning({ heartbeat_timeout: configForm.value.heartbeat_timeout
title: '确认更新服务端', },
content: `即将更新服务端到 ${serverUpdate.value.latest},更新后服务器将自动重启。确定要继续吗?`, web: {
positiveText: '更新并重启', username: configForm.value.web_username
negativeText: '取消', },
onPositiveClick: async () => { plugin_store: {
updatingServer.value = true url: configForm.value.plugin_store_url
try {
await applyServerUpdate(serverUpdate.value!.download_url)
message.success('更新已开始,服务器将在几秒后重启')
setTimeout(() => {
window.location.reload()
}, 5000)
} catch (e: any) {
message.error(e.response?.data || '更新失败')
updatingServer.value = false
} }
} }
}) // 只有填写了密码才更新
} if (configForm.value.web_password) {
updateReq.web.password = configForm.value.web_password
const formatBytes = (bytes: number): string => { }
if (bytes === 0) return '0 B' await updateServerConfig(updateReq)
const k = 1024 message.success('配置已保存,部分配置需要重启服务后生效')
const sizes = ['B', 'KB', 'MB', 'GB'] configForm.value.web_password = ''
const i = Math.floor(Math.log(bytes) / Math.log(k)) } catch (e: any) {
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i] message.error(e.response?.data || '保存配置失败')
} finally {
savingConfig.value = false
}
} }
onMounted(() => { onMounted(() => {
loadVersionInfo() loadVersionInfo()
loadServerConfig()
}) })
</script> </script>
@@ -140,47 +146,86 @@ onMounted(() => {
</div> </div>
</div> </div>
<!-- Server Update Card --> <!-- Server Config Card -->
<div class="glass-card"> <div class="glass-card">
<div class="card-header"> <div class="card-header">
<h3>服务端更新</h3> <h3>服务器配置</h3>
<button class="glass-btn small" :disabled="checkingServer" @click="handleCheckServerUpdate"> <SettingsOutline class="header-icon" />
<RefreshOutline class="btn-icon" />
检查更新
</button>
</div> </div>
<div class="card-body"> <div class="card-body">
<div v-if="!serverUpdate" class="empty-state"> <div v-if="configLoading" class="loading-state">加载中...</div>
点击检查更新按钮查看是否有新版本 <div v-else-if="serverConfig" class="config-form">
<div class="form-row">
<div class="form-group">
<label class="form-label">心跳间隔 ()</label>
<input
v-model.number="configForm.heartbeat_sec"
type="number"
class="glass-input"
min="1"
max="300"
/>
</div>
<div class="form-group">
<label class="form-label">心跳超时 ()</label>
<input
v-model.number="configForm.heartbeat_timeout"
type="number"
class="glass-input"
min="1"
max="600"
/>
</div>
</div>
<div class="form-divider"></div>
<div class="form-row">
<div class="form-group">
<label class="form-label">Web 用户名</label>
<input
v-model="configForm.web_username"
type="text"
class="glass-input"
placeholder="admin"
/>
</div>
<div class="form-group">
<label class="form-label">Web 密码</label>
<input
v-model="configForm.web_password"
type="password"
class="glass-input"
placeholder="留空则不修改"
/>
</div>
</div>
<div class="form-divider"></div>
<div class="form-group">
<label class="form-label">插件商店地址</label>
<input
v-model="configForm.plugin_store_url"
type="text"
class="glass-input"
placeholder="https://git.92coco.cn/flik/GoTunnel-Plugins/raw/branch/main/store.json"
/>
<span class="form-hint">插件商店的 API 地址留空使用默认地址</span>
</div>
<div class="form-actions">
<button
class="glass-btn primary"
:disabled="savingConfig"
@click="handleSaveConfig"
>
<SaveOutline class="btn-icon" />
保存配置
</button>
</div>
</div> </div>
<template v-else> <div v-else class="empty-state">无法加载配置信息</div>
<div v-if="serverUpdate.available" class="update-alert success">
发现新版本 {{ serverUpdate.latest }}当前版本 {{ serverUpdate.current }}
</div>
<div v-else class="update-alert info">
当前已是最新版本 {{ serverUpdate.current }}
</div>
<div v-if="serverUpdate.download_url" class="download-info">
下载文件: {{ serverUpdate.asset_name }}
<GlassTag style="margin-left: 8px;">{{ formatBytes(serverUpdate.asset_size) }}</GlassTag>
</div>
<div v-if="serverUpdate.release_note" class="release-note">
<span class="note-label">更新日志:</span>
<pre>{{ serverUpdate.release_note }}</pre>
</div>
<button
v-if="serverUpdate.available && serverUpdate.download_url"
class="glass-btn primary"
:disabled="updatingServer"
@click="handleApplyServerUpdate"
>
<CloudDownloadOutline class="btn-icon" />
下载并更新服务端
</button>
</template>
</div> </div>
</div> </div>
</div> </div>
@@ -190,32 +235,15 @@ onMounted(() => {
<style scoped> <style scoped>
.settings-page { .settings-page {
min-height: calc(100vh - 108px); min-height: calc(100vh - 108px);
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4c1d95 60%, #581c87 100%); background: var(--color-bg-primary);
position: relative; position: relative;
overflow: hidden; overflow: hidden;
padding: 32px; padding: 32px;
} }
/* Hide particles */
.particles { .particles {
position: absolute; display: none;
inset: 0;
pointer-events: none;
}
.particle {
position: absolute;
border-radius: 50%;
background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
animation: float-particle 20s ease-in-out infinite;
}
.particle-1 { width: 250px; height: 250px; top: -80px; right: -50px; }
.particle-2 { width: 180px; height: 180px; bottom: 10%; left: 5%; animation-delay: -7s; }
.particle-3 { width: 120px; height: 120px; top: 50%; right: 15%; animation-delay: -12s; }
@keyframes float-particle {
0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
50% { transform: translate(-20px, -60px) scale(0.95); opacity: 0.4; }
} }
.settings-content { .settings-content {
@@ -232,29 +260,27 @@ onMounted(() => {
.page-title { .page-title {
font-size: 28px; font-size: 28px;
font-weight: 700; font-weight: 700;
color: white; color: var(--color-text-primary);
margin: 0 0 8px 0; margin: 0 0 8px 0;
} }
.page-subtitle { .page-subtitle {
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
margin: 0; margin: 0;
font-size: 14px; font-size: 14px;
} }
/* Glass Card */ /* Glass Card */
.glass-card { .glass-card {
background: rgba(255, 255, 255, 0.08); background: var(--color-bg-tertiary);
backdrop-filter: blur(20px); border-radius: 12px;
-webkit-backdrop-filter: blur(20px); border: 1px solid var(--color-border);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.12);
margin-bottom: 20px; margin-bottom: 20px;
} }
.card-header { .card-header {
padding: 16px 20px; padding: 16px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 1px solid var(--color-border-light);
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
@@ -264,7 +290,7 @@ onMounted(() => {
margin: 0; margin: 0;
font-size: 15px; font-size: 15px;
font-weight: 600; font-weight: 600;
color: white; color: var(--color-text-primary);
} }
.card-body { .card-body {
@@ -290,12 +316,12 @@ onMounted(() => {
.info-label { .info-label {
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
} }
.info-value { .info-value {
font-size: 14px; font-size: 14px;
color: white; color: var(--color-text-primary);
font-weight: 500; font-weight: 500;
} }
@@ -307,7 +333,7 @@ onMounted(() => {
.loading-state, .empty-state { .loading-state, .empty-state {
text-align: center; text-align: center;
padding: 32px; padding: 32px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
} }
/* Update Alert */ /* Update Alert */
@@ -319,20 +345,20 @@ onMounted(() => {
} }
.update-alert.success { .update-alert.success {
background: rgba(52, 211, 153, 0.15); background: rgba(0, 186, 124, 0.15);
border: 1px solid rgba(52, 211, 153, 0.3); border: 1px solid rgba(0, 186, 124, 0.3);
color: #34d399; color: var(--color-success);
} }
.update-alert.info { .update-alert.info {
background: rgba(96, 165, 250, 0.15); background: rgba(29, 155, 240, 0.15);
border: 1px solid rgba(96, 165, 250, 0.3); border: 1px solid rgba(29, 155, 240, 0.3);
color: #60a5fa; color: var(--color-info);
} }
/* Download Info */ /* Download Info */
.download-info { .download-info {
color: rgba(255, 255, 255, 0.6); color: var(--color-text-secondary);
font-size: 13px; font-size: 13px;
margin-bottom: 12px; margin-bottom: 12px;
} }
@@ -345,7 +371,7 @@ onMounted(() => {
.note-label { .note-label {
display: block; display: block;
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
margin-bottom: 6px; margin-bottom: 6px;
} }
@@ -353,8 +379,8 @@ onMounted(() => {
margin: 0; margin: 0;
white-space: pre-wrap; white-space: pre-wrap;
font-size: 12px; font-size: 12px;
color: rgba(255, 255, 255, 0.7); color: var(--color-text-secondary);
background: rgba(0, 0, 0, 0.2); background: var(--color-bg-elevated);
padding: 12px; padding: 12px;
border-radius: 8px; border-radius: 8px;
max-height: 150px; max-height: 150px;
@@ -363,21 +389,21 @@ onMounted(() => {
/* Glass Button */ /* Glass Button */
.glass-btn { .glass-btn {
background: rgba(255, 255, 255, 0.1); background: var(--color-bg-elevated);
border: 1px solid rgba(255, 255, 255, 0.15); border: 1px solid var(--color-border);
border-radius: 8px; border-radius: 8px;
padding: 8px 16px; padding: 8px 16px;
color: white; color: var(--color-text-primary);
font-size: 13px; font-size: 13px;
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.15s;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
} }
.glass-btn:hover:not(:disabled) { .glass-btn:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.2); background: var(--color-border);
} }
.glass-btn:disabled { .glass-btn:disabled {
@@ -391,19 +417,89 @@ onMounted(() => {
} }
.glass-btn.primary { .glass-btn.primary {
background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%); background: var(--color-accent);
border: none; border: none;
} }
.glass-btn.primary:hover:not(:disabled) {
background: var(--color-accent-hover);
}
/* Icon styles */ /* Icon styles */
.header-icon { .header-icon {
width: 20px; width: 20px;
height: 20px; height: 20px;
color: rgba(255, 255, 255, 0.5); color: var(--color-text-muted);
} }
.btn-icon { .btn-icon {
width: 14px; width: 14px;
height: 14px; height: 14px;
} }
/* Config Form */
.config-form {
display: flex;
flex-direction: column;
gap: 16px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 6px;
}
.form-label {
font-size: 13px;
color: var(--color-text-secondary);
font-weight: 500;
}
.form-hint {
font-size: 11px;
color: var(--color-text-muted);
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
@media (max-width: 500px) {
.form-row {
grid-template-columns: 1fr;
}
}
.form-divider {
height: 1px;
background: var(--color-border-light);
margin: 8px 0;
}
.form-actions {
margin-top: 8px;
}
/* Glass Input */
.glass-input {
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 10px 14px;
color: var(--color-text-primary);
font-size: 14px;
outline: none;
transition: all 0.15s;
}
.glass-input:focus {
border-color: var(--color-accent);
}
.glass-input::placeholder {
color: var(--color-text-muted);
}
</style> </style>

View File

@@ -1,24 +1,10 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
vue(), vue()
AutoImport({
imports: [
'vue',
{
'naive-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar']
}
]
}),
Components({
resolvers: [NaiveUiResolver()]
})
], ],
build: { build: {
chunkSizeWarningLimit: 1500, chunkSizeWarningLimit: 1500,