diff --git a/cmd/cli/main.go b/cmd/cli/main.go
index d7fafbfa..d400e5b4 100644
--- a/cmd/cli/main.go
+++ b/cmd/cli/main.go
@@ -18,6 +18,7 @@ package main
import (
"github.com/TheTNB/panel/internal/bootstrap"
+ _ "time/tzdata"
)
func main() {
diff --git a/cmd/web/main.go b/cmd/web/main.go
index e40edec5..181a0de3 100644
--- a/cmd/web/main.go
+++ b/cmd/web/main.go
@@ -16,7 +16,10 @@ along with this program. If not, see .
*/
package main
-import "github.com/TheTNB/panel/internal/bootstrap"
+import (
+ "github.com/TheTNB/panel/internal/bootstrap"
+ _ "time/tzdata"
+)
// @title 耗子面板 API
// @version 2
diff --git a/config/config.example.yml b/config/config.example.yml
index ac0ba2ab..1b3563ae 100644
--- a/config/config.example.yml
+++ b/config/config.example.yml
@@ -1,12 +1,17 @@
+# 警告:未经指导私自修改此配置文件可能导致严重后果
+# Warning: Modifying this configuration file without guidance may cause serious consequences
app:
key: "a-long-string-with-32-characters"
locale: "zh_CN"
+ timezone: "Asia/Shanghai"
+ version: "2.3.0"
+ root: "/www"
http:
- debug: true
+ debug: false
address: ":3000"
entrance: "/"
ssl: false
database:
- debug: true
+ debug: false
diff --git a/go.mod b/go.mod
index 654e25df..ac9b9b52 100644
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@ require (
github.com/go-playground/validator/v10 v10.22.1
github.com/go-rat/chix v1.1.3
github.com/go-rat/gormstore v1.0.6
- github.com/go-rat/sessions v1.0.9
+ github.com/go-rat/sessions v1.0.11
github.com/go-rat/utils v1.0.3
github.com/go-resty/resty/v2 v2.15.3
github.com/go-sql-driver/mysql v1.8.1
diff --git a/go.sum b/go.sum
index 296aa6c9..e5021c03 100644
--- a/go.sum
+++ b/go.sum
@@ -116,8 +116,8 @@ github.com/go-rat/gormstore v1.0.6 h1:YxmaY6n3JoTk6o9RXoZ1+cQ6HQL+ayf/6d8D76ydCA
github.com/go-rat/gormstore v1.0.6/go.mod h1:xG/n+Du8baWf7ptiafiHLWBZWVXrYIPC42CsoEbfr4M=
github.com/go-rat/securecookie v1.0.1 h1:HW0fpKmB+FjJzXTw8ABOwBJ+XrPmRBSZqHhmrv86lBo=
github.com/go-rat/securecookie v1.0.1/go.mod h1:tP/ObWYyjmcpabQ7WTon/i2lBSip/Aolliw2llXuPDU=
-github.com/go-rat/sessions v1.0.9 h1:zysrHceTFqyc0qUWn5giLGdbfr/DYHXvFECDBSyv9Gk=
-github.com/go-rat/sessions v1.0.9/go.mod h1:Ray/GCbuhm4U9xpjFFSCfOTCEn91puEhAXX5creHE9g=
+github.com/go-rat/sessions v1.0.11 h1:2eTUvhEBtymrAtwv71LlGHNylz+Ad2SgY3jg/sSUboA=
+github.com/go-rat/sessions v1.0.11/go.mod h1:Ray/GCbuhm4U9xpjFFSCfOTCEn91puEhAXX5creHE9g=
github.com/go-rat/utils v1.0.3 h1:SqH/O0KYq4SBv8naSAjJA4hC45/d8NLNrTCONfqjbFM=
github.com/go-rat/utils v1.0.3/go.mod h1:4WNPlrF57KmeGZN3HOeBgdBVLJL3xgba4QRP/t6pKrE=
github.com/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8=
diff --git a/internal/bootstrap/conf.go b/internal/bootstrap/conf.go
index b0482475..61db330c 100644
--- a/internal/bootstrap/conf.go
+++ b/internal/bootstrap/conf.go
@@ -2,6 +2,7 @@ package bootstrap
import (
"fmt"
+ "time"
"github.com/golang-module/carbon/v2"
"github.com/knadh/koanf/parsers/yaml"
@@ -22,6 +23,13 @@ func initGlobal() {
panel.Root = panel.Conf.MustString("app.root")
panel.Version = panel.Conf.MustString("app.version")
panel.Locale = panel.Conf.MustString("app.locale")
+
+ // 初始化时区
+ loc, err := time.LoadLocation(panel.Conf.MustString("app.timezone"))
+ if err != nil {
+ panic(fmt.Sprintf("failed to load timezone: %v", err))
+ }
+ time.Local = loc
carbon.SetDefault(carbon.Default{
Layout: carbon.DateTimeLayout,
Timezone: carbon.PRC,
diff --git a/internal/route/http.go b/internal/route/http.go
index e2b1d137..2c6cf8f0 100644
--- a/internal/route/http.go
+++ b/internal/route/http.go
@@ -3,6 +3,7 @@ package route
import (
"io/fs"
"net/http"
+ "strings"
"time"
"github.com/go-chi/chi/v5"
@@ -269,7 +270,7 @@ func Http(r chi.Router) {
r.With(middleware.MustLogin).Mount("/swagger", httpSwagger.Handler())
r.NotFound(func(writer http.ResponseWriter, request *http.Request) {
// /api 开头的返回 404
- if request.URL.Path[:4] == "/api" {
+ if strings.HasPrefix(request.URL.Path, "/api") {
http.NotFound(writer, request)
return
}
diff --git a/web/package.json b/web/package.json
index 678e9db9..f525d425 100644
--- a/web/package.json
+++ b/web/package.json
@@ -30,7 +30,6 @@
"echarts": "^5.5.1",
"install": "^0.13.0",
"lodash-es": "^4.17.21",
- "monaco-editor-nginx": "^2.0.2",
"pinia": "^2.2.2",
"vue": "^3.5.5",
"vue-echarts": "^7.0.3",
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index 617f6ad9..0117e485 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -38,9 +38,6 @@ importers:
lodash-es:
specifier: ^4.17.21
version: 4.17.21
- monaco-editor-nginx:
- specifier: ^2.0.2
- version: 2.0.2(@babel/runtime@7.25.6)(@nginx/reference-lib@1.1.2)(monaco-editor@0.52.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
pinia:
specifier: ^2.2.2
version: 2.2.2(typescript@5.6.2)(vue@3.5.10(typescript@5.6.2))
@@ -173,10 +170,6 @@ packages:
engines: {node: '>=6.0.0'}
hasBin: true
- '@babel/runtime@7.25.6':
- resolution: {integrity: sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==}
- engines: {node: '>=6.9.0'}
-
'@babel/types@7.25.6':
resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==}
engines: {node: '>=6.9.0'}
@@ -572,9 +565,6 @@ packages:
peerDependencies:
monaco-editor: '>= 0.21.0 < 1'
- '@nginx/reference-lib@1.1.2':
- resolution: {integrity: sha512-d8HeRHsIOPfVFOpDOi1XjiGxfYyyRmdPd+a+V9vDpyjBWGHVwSSOwzvuPGJtc4V4KK6ZfYHm15FD1etiKYS6vQ==}
-
'@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -631,46 +621,55 @@ packages:
resolution: {integrity: sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.22.4':
resolution: {integrity: sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==}
cpu: [arm]
os: [linux]
+ libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.22.4':
resolution: {integrity: sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.22.4':
resolution: {integrity: sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@rollup/rollup-linux-powerpc64le-gnu@4.22.4':
resolution: {integrity: sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.22.4':
resolution: {integrity: sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
'@rollup/rollup-linux-s390x-gnu@4.22.4':
resolution: {integrity: sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.22.4':
resolution: {integrity: sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.22.4':
resolution: {integrity: sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@rollup/rollup-win32-arm64-msvc@4.22.4':
resolution: {integrity: sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==}
@@ -1594,9 +1593,6 @@ packages:
resolution: {integrity: sha512-CJ7e7Abb779OTRv3lomfp7Mns/Sy1+U4pcAx5VbjxCZD5ZM/VJaXPpPjNKjtSvWQy/H86E49REXR34dl1JEz9w==}
hasBin: true
- js-tokens@4.0.0:
- resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
-
js-tokens@9.0.0:
resolution: {integrity: sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==}
@@ -1651,10 +1647,6 @@ packages:
lodash@4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
- loose-envify@1.4.0:
- resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
- hasBin: true
-
lower-case@2.0.2:
resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==}
@@ -1702,15 +1694,6 @@ packages:
resolution: {integrity: sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==}
hasBin: true
- monaco-editor-nginx@2.0.2:
- resolution: {integrity: sha512-F/qejb0w0hxIyxbu2JMCe+MhnOV7bxGbUynnyMXk7Cy25Na5fD99u5QqRr7WfRhIn0xcdhBEkJ/jikQsxVnEOA==}
- peerDependencies:
- '@babel/runtime': '>=7.10.0'
- '@nginx/reference-lib': '>=1.1.0'
- monaco-editor: '>=0.22.3'
- react: '>=16.9.0'
- react-dom: '>=16.9.0'
-
monaco-editor@0.52.0:
resolution: {integrity: sha512-OeWhNpABLCeTqubfqLMXGsqf6OmPU6pHM85kF3dhy6kq5hnhuVS1p3VrEW/XhWHc71P2tHyS5JFySD8mgs1crw==}
@@ -1901,15 +1884,6 @@ packages:
queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
- react-dom@18.3.1:
- resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
- peerDependencies:
- react: ^18.3.1
-
- react@18.3.1:
- resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
- engines: {node: '>=0.10.0'}
-
read-package-json-fast@3.0.2:
resolution: {integrity: sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
@@ -1922,9 +1896,6 @@ packages:
resolution: {integrity: sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==}
engines: {node: '>= 14.16.0'}
- regenerator-runtime@0.14.1:
- resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==}
-
relateurl@0.2.7:
resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==}
engines: {node: '>= 0.10'}
@@ -1972,9 +1943,6 @@ packages:
engines: {node: '>=14.0.0'}
hasBin: true
- scheduler@0.23.2:
- resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
-
scule@1.3.0:
resolution: {integrity: sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g==}
@@ -2400,10 +2368,6 @@ snapshots:
dependencies:
'@babel/types': 7.25.6
- '@babel/runtime@7.25.6':
- dependencies:
- regenerator-runtime: 0.14.1
-
'@babel/types@7.25.6':
dependencies:
'@babel/helper-string-parser': 7.24.8
@@ -2668,8 +2632,6 @@ snapshots:
monaco-editor: 0.52.0
state-local: 1.0.7
- '@nginx/reference-lib@1.1.2': {}
-
'@nodelib/fs.scandir@2.1.5':
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -3839,8 +3801,6 @@ snapshots:
jiti@2.0.0: {}
- js-tokens@4.0.0: {}
-
js-tokens@9.0.0: {}
js-yaml@4.1.0:
@@ -3889,10 +3849,6 @@ snapshots:
lodash@4.17.21: {}
- loose-envify@1.4.0:
- dependencies:
- js-tokens: 4.0.0
-
lower-case@2.0.2:
dependencies:
tslib: 2.7.0
@@ -3941,14 +3897,6 @@ snapshots:
dependencies:
commander: 12.1.0
- monaco-editor-nginx@2.0.2(@babel/runtime@7.25.6)(@nginx/reference-lib@1.1.2)(monaco-editor@0.52.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
- dependencies:
- '@babel/runtime': 7.25.6
- '@nginx/reference-lib': 1.1.2
- monaco-editor: 0.52.0
- react: 18.3.1
- react-dom: 18.3.1(react@18.3.1)
-
monaco-editor@0.52.0: {}
mrmime@2.0.0: {}
@@ -4136,16 +4084,6 @@ snapshots:
queue-microtask@1.2.3: {}
- react-dom@18.3.1(react@18.3.1):
- dependencies:
- loose-envify: 1.4.0
- react: 18.3.1
- scheduler: 0.23.2
-
- react@18.3.1:
- dependencies:
- loose-envify: 1.4.0
-
read-package-json-fast@3.0.2:
dependencies:
json-parse-even-better-errors: 3.0.2
@@ -4157,8 +4095,6 @@ snapshots:
readdirp@4.0.1: {}
- regenerator-runtime@0.14.1: {}
-
relateurl@0.2.7: {}
require-directory@2.1.1: {}
@@ -4214,10 +4150,6 @@ snapshots:
immutable: 4.3.7
source-map-js: 1.2.1
- scheduler@0.23.2:
- dependencies:
- loose-envify: 1.4.0
-
scule@1.3.0: {}
seemly@0.3.8: {}
diff --git a/web/src/assets/images/login_banner.png b/web/src/assets/images/login_banner.png
deleted file mode 100644
index cd29ced4..00000000
Binary files a/web/src/assets/images/login_banner.png and /dev/null differ
diff --git a/web/src/components/common/CodeEditor.vue b/web/src/components/common/CodeEditor.vue
index 987a1081..1fa58421 100644
--- a/web/src/components/common/CodeEditor.vue
+++ b/web/src/components/common/CodeEditor.vue
@@ -1,8 +1,5 @@