From d56d3ec1dd225035db3094cc789645546bff804b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 20 May 2024 01:13:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=AD=A3=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/requests/file/archive.go | 4 ++-- app/http/requests/file/copy.go | 4 ++-- app/http/requests/file/exist.go | 2 +- app/http/requests/file/move.go | 4 ++-- app/http/requests/file/not_exist.go | 2 +- app/http/requests/file/permission.go | 2 +- app/http/requests/file/save.go | 2 +- app/http/requests/file/search.go | 2 +- app/http/requests/file/un_archive.go | 4 ++-- app/http/requests/file/upload.go | 2 +- app/http/requests/plugins/rsync/create.go | 2 +- app/http/requests/plugins/rsync/update.go | 2 +- app/http/requests/website/add.go | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/http/requests/file/archive.go b/app/http/requests/file/archive.go index 6df568db..93fc60f4 100644 --- a/app/http/requests/file/archive.go +++ b/app/http/requests/file/archive.go @@ -17,8 +17,8 @@ func (r *Archive) Authorize(ctx http.Context) error { func (r *Archive) Rules(ctx http.Context) map[string]string { return map[string]string{ "paths": "array", - "paths.*": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_exists", - "file": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_not_exists", + "paths.*": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, + "file": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_not_exists`, } } diff --git a/app/http/requests/file/copy.go b/app/http/requests/file/copy.go index 667405d4..ccbdb383 100644 --- a/app/http/requests/file/copy.go +++ b/app/http/requests/file/copy.go @@ -16,8 +16,8 @@ func (r *Copy) Authorize(ctx http.Context) error { func (r *Copy) Rules(ctx http.Context) map[string]string { return map[string]string{ - "old": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_exists", - "new": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$", + "old": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, + "new": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, } } diff --git a/app/http/requests/file/exist.go b/app/http/requests/file/exist.go index e6eebe23..189533fd 100644 --- a/app/http/requests/file/exist.go +++ b/app/http/requests/file/exist.go @@ -15,7 +15,7 @@ func (r *Exist) Authorize(ctx http.Context) error { func (r *Exist) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": "regex:^/([a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*)?$|path_exists", + "path": `regex:^/([a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*)?$|path_exists`, } } diff --git a/app/http/requests/file/move.go b/app/http/requests/file/move.go index 18ded61d..99d7b1a9 100644 --- a/app/http/requests/file/move.go +++ b/app/http/requests/file/move.go @@ -16,8 +16,8 @@ func (r *Move) Authorize(ctx http.Context) error { func (r *Move) Rules(ctx http.Context) map[string]string { return map[string]string{ - "source": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_exists", - "target": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$", + "source": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, + "target": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, } } diff --git a/app/http/requests/file/not_exist.go b/app/http/requests/file/not_exist.go index 25349305..f8de36c0 100644 --- a/app/http/requests/file/not_exist.go +++ b/app/http/requests/file/not_exist.go @@ -15,7 +15,7 @@ func (r *NotExist) Authorize(ctx http.Context) error { func (r *NotExist) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_not_exists", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_not_exists`, } } diff --git a/app/http/requests/file/permission.go b/app/http/requests/file/permission.go index ff050c89..a3a3dc1b 100644 --- a/app/http/requests/file/permission.go +++ b/app/http/requests/file/permission.go @@ -18,7 +18,7 @@ func (r *Permission) Authorize(ctx http.Context) error { func (r *Permission) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_exists", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, "mode": "regex:^[0-7]{3}$|uint", "owner": "regex:^[a-zA-Z0-9_-]+$", "group": "regex:^[a-zA-Z0-9_-]+$", diff --git a/app/http/requests/file/save.go b/app/http/requests/file/save.go index a9caa55e..2680f0d7 100644 --- a/app/http/requests/file/save.go +++ b/app/http/requests/file/save.go @@ -16,7 +16,7 @@ func (r *Save) Authorize(ctx http.Context) error { func (r *Save) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_exists", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, "content": "required|string", } } diff --git a/app/http/requests/file/search.go b/app/http/requests/file/search.go index e43a46f2..800630ff 100644 --- a/app/http/requests/file/search.go +++ b/app/http/requests/file/search.go @@ -16,7 +16,7 @@ func (r *Search) Authorize(ctx http.Context) error { func (r *Search) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_exists", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, "keyword": "required|string", } } diff --git a/app/http/requests/file/un_archive.go b/app/http/requests/file/un_archive.go index 22926cda..5c87abe4 100644 --- a/app/http/requests/file/un_archive.go +++ b/app/http/requests/file/un_archive.go @@ -16,8 +16,8 @@ func (r *UnArchive) Authorize(ctx http.Context) error { func (r *UnArchive) Rules(ctx http.Context) map[string]string { return map[string]string{ - "file": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_exists", - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$|path_not_exists", + "file": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_exists`, + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$|path_not_exists`, } } diff --git a/app/http/requests/file/upload.go b/app/http/requests/file/upload.go index d0eca7cd..cfbb53b7 100644 --- a/app/http/requests/file/upload.go +++ b/app/http/requests/file/upload.go @@ -18,7 +18,7 @@ func (r *Upload) Authorize(ctx http.Context) error { func (r *Upload) Rules(ctx http.Context) map[string]string { return map[string]string{ - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, "file": "required", } } diff --git a/app/http/requests/plugins/rsync/create.go b/app/http/requests/plugins/rsync/create.go index 77dd31e7..3fa896c8 100644 --- a/app/http/requests/plugins/rsync/create.go +++ b/app/http/requests/plugins/rsync/create.go @@ -21,7 +21,7 @@ func (r *Create) Authorize(ctx http.Context) error { func (r *Create) Rules(ctx http.Context) map[string]string { return map[string]string{ "name": "required|regex:^[a-zA-Z0-9-_]+$", - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, "comment": "string", "auth_user": "required|regex:^[a-zA-Z0-9-_]+$", "secret": "required|min_len:8", diff --git a/app/http/requests/plugins/rsync/update.go b/app/http/requests/plugins/rsync/update.go index 883835b7..58e62574 100644 --- a/app/http/requests/plugins/rsync/update.go +++ b/app/http/requests/plugins/rsync/update.go @@ -21,7 +21,7 @@ func (r *Update) Authorize(ctx http.Context) error { func (r *Update) Rules(ctx http.Context) map[string]string { return map[string]string{ "name": "required|regex:^[a-zA-Z0-9-_]+$", - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, "comment": "string", "auth_user": "required|regex:^[a-zA-Z0-9-_]+$", "secret": "required|min_len:8", diff --git a/app/http/requests/website/add.go b/app/http/requests/website/add.go index 73977e67..62a5abed 100644 --- a/app/http/requests/website/add.go +++ b/app/http/requests/website/add.go @@ -27,7 +27,7 @@ func (r *Add) Rules(ctx http.Context) map[string]string { "name": "required|regex:^[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)*$|not_exists:websites,name|not_in:phpmyadmin,mysql,panel,ssh", "domains": "required|slice", "ports": "required|slice", - "path": "regex:^/[a-zA-Z0-9_.@#$%- []()]+(/[a-zA-Z0-9_.@#$%- []()]+)*$", + "path": `regex:^/[a-zA-Z0-9_.@#$%\-\s\[\]()]+(/[a-zA-Z0-9_.@#$%\-\s\[\]()]+)*$`, "php": "required", "db": "bool", "db_type": "required_if:db,true|in:0,mysql,postgresql",