From aa1e548ddfeb6aaf1e02d7d2a71fb078ece96fda Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:42:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BD=91=E7=AB=99=E5=8F=8D=E5=90=91?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=A2=9E=E5=8A=A0=E5=8D=8F=E8=AE=AE=E9=80=89?= =?UTF-8?q?=E6=8B=A9=20(#1832)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/utils/files/fileinfo.go | 6 +++-- frontend/src/lang/modules/en.ts | 5 +++- frontend/src/lang/modules/tw.ts | 4 ++- frontend/src/lang/modules/zh.ts | 6 +++-- frontend/src/styles/common.scss | 4 +++ .../config/basic/site-folder/index.vue | 4 +++ .../views/website/website/create/index.vue | 26 ++++++++++++++++--- 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/backend/utils/files/fileinfo.go b/backend/utils/files/fileinfo.go index c892f7747..9a984a0f0 100644 --- a/backend/utils/files/fileinfo.go +++ b/backend/utils/files/fileinfo.go @@ -107,8 +107,10 @@ func (f *FileInfo) search(search string, count int) (files []FileSearchInfo, tot if err = cmd.Start(); err != nil { return } - defer cmd.Wait() - defer cmd.Process.Kill() + defer func() { + _ = cmd.Wait() + _ = cmd.Process.Kill() + }() scanner := bufio.NewScanner(output) for scanner.Scan() { diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 1a5a24f81..fb41b4dd8 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1314,7 +1314,7 @@ const message = { value: 'value', enable: 'Enable', proxyAddress: 'Proxy Address', - proxyHelper: 'Example: http://127.0.0.1:8080', + proxyHelper: 'Example: 127.0.0.1:8080', forceDelete: 'Force Delete', forceDeleteHelper: 'Forced deletion will ignore errors generated during the deletion process and eventually delete metadata', @@ -1471,6 +1471,7 @@ const message = { 'Switching the PHP version will delete the original PHP container (the website code that has been mounted will not be lost), continue? ', changeVersion: 'Switch version', retainConfig: 'Whether to keep php-fpm.conf and php.ini files', + runDirHelper2: 'Please ensure that the secondary running directory is under the index directory', }, php: { short_open_tag: 'Short tag support', @@ -1489,6 +1490,8 @@ const message = { disableFunction: 'Disable function', disableFunctionHelper: 'Enter the function to be disabled, such as exec, please use multiple, split', uploadMaxSize: 'Upload limit', + indexHelper: + 'In order to ensure the normal operation of the PHP website, please place the code in the index directory and avoid renaming', }, nginx: { serverNamesHashBucketSizeHelper: 'The hash table size of the server name', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index bf2024831..a68d5610a 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1257,7 +1257,7 @@ const message = { value: '值', enable: '開啟', proxyAddress: '代理地址', - proxyHelper: '例: http://127.0.0.1:8080', + proxyHelper: '例: 127.0.0.1:8080', forceDelete: '強製刪除', forceDeleteHelper: '強製刪除,會忽略刪除過程中產生的錯誤並最終刪除元數據', deleteAppHelper: '同時刪除關聯應用、數據庫以及應用備份', @@ -1404,6 +1404,7 @@ const message = { changePHPVersionWarn: '切換 PHP 版本會刪除原有的 PHP 容器(不會丟失已經掛載的網站代碼),是否繼續? ', changeVersion: '切換版本', retainConfig: '是否保留 php-fpm.conf 和 php.ini 文件', + runDirHelper2: '請確保二級運行目錄位於 index 目錄下', }, php: { short_open_tag: '短標簽支持', @@ -1422,6 +1423,7 @@ const message = { disableFunction: '禁用函數', disableFunctionHelper: '輸入要禁用的函數,例如exec,多個請用,分割', uploadMaxSize: '上傳限製', + indexHelper: '為保障PHP網站正常運行,請將代碼放置於 index 目錄,並避免重命名', }, nginx: { serverNamesHashBucketSizeHelper: '服務器名字的hash表大小', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index dd6f15b49..81108e29d 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1257,7 +1257,7 @@ const message = { value: '值', enable: '开启', proxyAddress: '代理地址', - proxyHelper: '例: http://127.0.0.1:8080', + proxyHelper: '例: 127.0.0.1:8080', forceDelete: '强制删除', forceDeleteHelper: '强制删除,会忽略删除过程中产生的错误并最终删除元数据', deleteAppHelper: '同时删除关联应用、数据库以及应用备份', @@ -1281,7 +1281,7 @@ const message = { primaryPath: '主目录', folderTitle: '网站主目录主要包含四个文件夹', wafFolder: '防火墙规则', - indexFolder: '网站root目录', + indexFolder: '网站 root 目录(PHP 运行环境 静态网站代码存放目录)', logFolder: '网站日志', sslFolder: '网站证书', enableOrNot: '是否启用', @@ -1404,6 +1404,7 @@ const message = { changePHPVersionWarn: '切换 PHP 版本会删除原有的 PHP 容器(不会丢失已经挂载的网站代码),是否继续?', changeVersion: '切换版本', retainConfig: '是否保留 php-fpm.conf 和 php.ini 文件', + runDirHelper2: '请确保二级运行目录位于 index 目录下', }, php: { short_open_tag: '短标签支持', @@ -1422,6 +1423,7 @@ const message = { disableFunction: '禁用函数', disableFunctionHelper: '输入要禁用的函数,例如exec,多个请用,分割', uploadMaxSize: '上传限制', + indexHelper: '为保障 PHP 网站正常运行,请将代码放置于 index 目录,并避免重命名', }, nginx: { serverNamesHashBucketSizeHelper: '服务器名字的hash表大小', diff --git a/frontend/src/styles/common.scss b/frontend/src/styles/common.scss index 4e2bbb8e0..e7c1923b9 100644 --- a/frontend/src/styles/common.scss +++ b/frontend/src/styles/common.scss @@ -347,3 +347,7 @@ html { .left-button { margin-left: 10px; } + +.pre-select { + width: 85px !important; +} diff --git a/frontend/src/views/website/website/config/basic/site-folder/index.vue b/frontend/src/views/website/website/config/basic/site-folder/index.vue index 97e6c183a..6268c60d4 100644 --- a/frontend/src/views/website/website/config/basic/site-folder/index.vue +++ b/frontend/src/views/website/website/config/basic/site-folder/index.vue @@ -30,6 +30,9 @@ {{ $t('nginx.saveAndReload') }} + + {{ $t('website.runDirHelper2') }} + @@ -49,6 +52,7 @@
diff --git a/frontend/src/views/website/website/create/index.vue b/frontend/src/views/website/website/create/index.vue index 1e928aec5..331355bd3 100644 --- a/frontend/src/views/website/website/create/index.vue +++ b/frontend/src/views/website/website/create/index.vue @@ -223,7 +223,7 @@ @@ -268,8 +268,20 @@
- - + + + + @@ -348,6 +360,8 @@ const website = ref({ IPV6: false, proxyType: 'tcp', port: 9000, + proxyProtocol: 'http://', + proxyAddress: '', }); const rules = ref({ primaryDomain: [Rules.domain], @@ -356,7 +370,7 @@ const rules = ref({ webSiteGroupId: [Rules.requiredSelectBusiness], appInstallId: [Rules.requiredSelectBusiness], appType: [Rules.requiredInput], - proxy: [Rules.requiredInput], + proxyAddress: [Rules.requiredInput], runtimeID: [Rules.requiredSelectBusiness], appinstall: { name: [Rules.appName], @@ -549,6 +563,10 @@ const submit = async (formEl: FormInstance | undefined) => { loading.value = false; preCheckRef.value.acceptParams({ items: res.data }); } else { + if (website.value.type === 'proxy') { + website.value.proxy = website.value.proxyProtocol + website.value.proxyAddress; + console.log(website.value.proxy); + } CreateWebsite(website.value) .then(() => { MsgSuccess(i18n.global.t('commons.msg.createSuccess'));