From 7cb6f400cb49a9dd75219df85f2d35d5bc12f6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MisakaNo=20=E3=81=AE=20=E5=B0=8F=E7=A0=B4=E7=AB=99?= <122191366+Misaka-blog@users.noreply.github.com> Date: Tue, 9 May 2023 10:32:24 +0800 Subject: [PATCH] Show x-ui log on panel (#46) * fix * Bump google.golang.org/grpc from 1.54.0 to 1.55.0 (#40) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.54.0 to 1.55.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.54.0...v1.55.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * add * warp * fix * fix * Bump github.com/shirou/gopsutil/v3 from 3.23.3 to 3.23.4 (#43) Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.3 to 3.23.4. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.23.3...v3.23.4) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix * project info * optimize * Bump gorm.io/gorm from 1.25.0 to 1.25.1 (#45) Bumps [gorm.io/gorm](https://github.com/go-gorm/gorm) from 1.25.0 to 1.25.1. - [Release notes](https://github.com/go-gorm/gorm/releases) - [Commits](https://github.com/go-gorm/gorm/compare/v1.25.0...v1.25.1) --- updated-dependencies: - dependency-name: gorm.io/gorm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Show x-ui log on panel --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- config/version | 2 +- go.mod | 2 +- go.sum | 6 +-- web/assets/js/model/xray.js | 2 +- web/controller/server.go | 11 ++++ web/html/xui/form/protocol/vless.html | 4 +- web/html/xui/index.html | 72 +++++++++++++++++++++++++++ web/service/server.go | 27 +++++++++- 8 files changed, 117 insertions(+), 9 deletions(-) diff --git a/config/version b/config/version index f83e2d4..30d3ee9 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -v0.3.3.7 \ No newline at end of file +v0.3.3.8 \ No newline at end of file diff --git a/go.mod b/go.mod index 89f8ebb..1bcaf90 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/text v0.9.0 google.golang.org/grpc v1.55.0 gorm.io/driver/sqlite v1.5.0 - gorm.io/gorm v1.25.0 + gorm.io/gorm v1.25.1 ) require ( diff --git a/go.sum b/go.sum index 7b8f533..6f8fc67 100644 --- a/go.sum +++ b/go.sum @@ -250,8 +250,8 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/sqlite v1.5.0 h1:zKYbzRCpBrT1bNijRnxLDJWPjVfImGEn0lSnUY5gZ+c= gorm.io/driver/sqlite v1.5.0/go.mod h1:kDMDfntV9u/vuMmz8APHtHF0b4nyBB7sfCieC6G8k8I= gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= -gorm.io/gorm v1.25.0 h1:+KtYtb2roDz14EQe4bla8CbQlmb9dN3VejSai3lprfU= -gorm.io/gorm v1.25.0/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.1 h1:nsSALe5Pr+cM3V1qwwQ7rOkw+6UeLrX5O4v3llhHa64= +gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gvisor.dev/gvisor v0.0.0-20220901235040-6ca97ef2ce1c h1:m5lcgWnL3OElQNVyp3qcncItJ2c0sQlSGjYK2+nJTA4= lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= \ No newline at end of file +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 1536681..c21aa56 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -496,7 +496,7 @@ class TlsStreamSettings extends XrayCommonClass { maxVersion = TLS_VERSION_OPTION.TLS13, cipherSuites = '', allowInsecure = false, - fingerprint = UTLS_FINGERPRINT.UTLS_CHROME, + fingerprint = UTLS_FINGERPRINT.UTLS_RANDOM, certificates = [new TlsStreamSettings.Cert()], alpn = ['']) { super(); this.server = serverName; diff --git a/web/controller/server.go b/web/controller/server.go index febe16c..3cfccdf 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -50,6 +50,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) { g.POST("/stopXrayService", a.stopXrayService) g.POST("/restartXrayService", a.restartXrayService) g.POST("/installXray/:version", a.installXray) + g.POST("/logs/:count", a.getLogs) g.POST("/getGeoipVersion", a.getGeoipVersion) g.POST("/installGeoip/:version", a.installGeoip) g.POST("/getGeositeVersion", a.getGeositeVersion) @@ -124,6 +125,16 @@ func (a *ServerController) installXray(c *gin.Context) { jsonMsg(c, "安装 xray", err) } +func (a *ServerController) getLogs(c *gin.Context) { + count := c.Param("count") + logs, err := a.serverService.GetLogs(count) + if err != nil { + jsonMsg(c, "getLogs", err) + return + } + jsonObj(c, logs, nil) +} + func (a *ServerController) getGeoipVersion(c *gin.Context) { now := time.Now() if now.Sub(a.lastGeoipGetVersionsTime) <= time.Minute { diff --git a/web/html/xui/form/protocol/vless.html b/web/html/xui/form/protocol/vless.html index 8eab2ce..17122cb 100644 --- a/web/html/xui/form/protocol/vless.html +++ b/web/html/xui/form/protocol/vless.html @@ -20,8 +20,8 @@ - - + + [[ key ]] diff --git a/web/html/xui/index.html b/web/html/xui/index.html index ccb55ca..f377ee6 100644 --- a/web/html/xui/index.html +++ b/web/html/xui/index.html @@ -84,6 +84,7 @@ 停止 重启 版本切换 + 查看日志 @@ -169,6 +170,25 @@ + + + x-ui 版本: + {{ .cur_ver }} + GitHub 项目: + sing-web/x-ui + + + + + Telegram 频道: + @sing_web + Telegram 群组: + @sing_web_group + + @@ -183,6 +203,7 @@

点击你想切换的版本

+

点击你想更新的版本

@@ -194,6 +215,7 @@

点击你想更新的版本

+

点击你想更新的版本

@@ -205,6 +227,33 @@

点击你想更新的版本

+ + + + + + 10 + 20 + 50 + 100 + + + + + + + + 下载 x-ui.log + + + + + {{template "js" .}}