Sfoglia il codice sorgente

Fixed NgxConfigEditor v-model and auto-cert issues

0xJacky 2 anni fa
parent
commit
7849ef76bc

+ 16 - 4
frontend/src/components/CodeEditor/CodeEditor.vue

@@ -2,20 +2,32 @@
 import {VAceEditor} from 'vue3-ace-editor'
 import 'ace-builds/src-noconflict/mode-nginx'
 import 'ace-builds/src-noconflict/theme-monokai'
+import {computed} from 'vue'
 
-const {content, defaultHeight} = defineProps<{
-    content?: string
+const props = defineProps<{
+    content: string
     defaultHeight?: string
 }>()
+
+const emit = defineEmits(['update:content'])
+
+const value = computed({
+    get() {
+        return props.content
+    },
+    set(value) {
+        emit('update:content', value)
+    }
+})
 </script>
 
 <template>
     <v-ace-editor
-        v-model:value="content"
+        v-model:value="value"
         lang="nginx"
         theme="monokai"
         :style="{
-            minHeight: defaultHeight || '100vh'
+            minHeight: props.defaultHeight || '100vh'
         }"/>
 </template>
 

+ 30 - 29
frontend/src/language/en/app.po

@@ -43,7 +43,7 @@ msgid "Advance Mode"
 msgstr "Advance Mode"
 
 #: src/components/StdDataDisplay/StdTable.vue:39
-#: src/views/domain/DomainList.vue:20
+#: src/views/domain/DomainList.vue:27
 #, fuzzy
 msgid "Are you sure you want to delete ?"
 msgstr "Are you sure you want to remove this directive?"
@@ -52,15 +52,15 @@ msgstr "Are you sure you want to remove this directive?"
 msgid "Are you sure you want to remove this directive?"
 msgstr "Are you sure you want to remove this directive?"
 
-#: src/views/domain/cert/IssueCert.vue:84
+#: src/views/domain/cert/IssueCert.vue:77
 msgid "Auto-renewal disabled for %{name}"
 msgstr "Auto-renewal disabled for %{name}"
 
-#: src/views/domain/cert/IssueCert.vue:78
+#: src/views/domain/cert/IssueCert.vue:71
 msgid "Auto-renewal enabled for %{name}"
 msgstr "Auto-renewal enabled for %{name}"
 
-#: src/views/domain/DomainEdit.vue:159
+#: src/views/domain/DomainEdit.vue:157
 msgid "Back"
 msgstr "Back"
 
@@ -147,7 +147,7 @@ msgid "Database (Optional, default: database)"
 msgstr "Database (Optional, default: database)"
 
 #: src/components/StdDataDisplay/StdTable.vue:216
-#: src/views/domain/DomainList.vue:104
+#: src/views/domain/DomainList.vue:111
 msgid "Delete"
 msgstr ""
 
@@ -171,16 +171,16 @@ msgstr "Directive"
 msgid "Directives"
 msgstr "Directives"
 
-#: src/views/domain/cert/IssueCert.vue:86
+#: src/views/domain/cert/IssueCert.vue:79
 msgid "Disable auto-renewal failed for %{name}"
 msgstr "Disable auto-renewal failed for %{name}"
 
-#: src/views/domain/DomainEdit.vue:10 src/views/domain/DomainList.vue:27
+#: src/views/domain/DomainEdit.vue:10 src/views/domain/DomainList.vue:17
 #: src/views/domain/DomainList.vue:29
 msgid "Disabled"
 msgstr "Disabled"
 
-#: src/views/domain/DomainEdit.vue:103 src/views/domain/DomainList.vue:64
+#: src/views/domain/DomainEdit.vue:101 src/views/domain/DomainList.vue:64
 msgid "Disabled successfully"
 msgstr "Disabled successfully"
 
@@ -208,7 +208,7 @@ msgstr "Edit Site"
 msgid "Email (*)"
 msgstr "Email (*)"
 
-#: src/views/domain/cert/IssueCert.vue:80
+#: src/views/domain/cert/IssueCert.vue:73
 msgid "Enable auto-renewal failed for %{name}"
 msgstr "Enable auto-renewal failed for %{name}"
 
@@ -221,12 +221,12 @@ msgid "Enable TLS"
 msgstr "Enable TLS"
 
 #: src/views/domain/DomainEdit.vue:33 src/views/domain/DomainEdit.vue:7
-#: src/views/domain/DomainList.vue:16 src/views/domain/DomainList.vue:18
-#: src/views/domain/DomainList.vue:26 src/views/domain/DomainList.vue:30
+#: src/views/domain/DomainList.vue:12 src/views/domain/DomainList.vue:20
+#: src/views/domain/DomainList.vue:26
 msgid "Enabled"
 msgstr "Enabled"
 
-#: src/views/domain/DomainAdd.vue:46 src/views/domain/DomainEdit.vue:94
+#: src/views/domain/DomainAdd.vue:46 src/views/domain/DomainEdit.vue:92
 #: src/views/domain/DomainList.vue:54
 msgid "Enabled successfully"
 msgstr "Enabled successfully"
@@ -239,11 +239,11 @@ msgstr "Encrypt website with Let's Encrypt"
 msgid "Expiration Date: %{date}"
 msgstr "Expiration Date: %{date}"
 
-#: src/views/domain/DomainEdit.vue:106 src/views/domain/DomainList.vue:68
+#: src/views/domain/DomainEdit.vue:104 src/views/domain/DomainList.vue:68
 msgid "Failed to disable %{msg}"
 msgstr "Failed to disable %{msg}"
 
-#: src/views/domain/DomainEdit.vue:97 src/views/domain/DomainList.vue:58
+#: src/views/domain/DomainEdit.vue:95 src/views/domain/DomainList.vue:58
 msgid "Failed to enable %{msg}"
 msgstr "Failed to enable %{msg}"
 
@@ -255,6 +255,10 @@ msgstr "File Not Found"
 msgid "Finished"
 msgstr "Finished"
 
+#: src/views/domain/cert/IssueCert.vue:85
+msgid "Getting the certificate, please wait..."
+msgstr "Getting the certificate, please wait..."
+
 #: src/routes/index.ts:19
 msgid "Home"
 msgstr "Home"
@@ -284,7 +288,7 @@ msgstr "Load Averages:"
 msgid "Location"
 msgstr "Location"
 
-#: src/views/domain/ngx_conf/LocationEditor.vue:40
+#: src/views/domain/ngx_conf/LocationEditor.vue:36
 msgid "Locations"
 msgstr "Locations"
 
@@ -300,7 +304,7 @@ msgstr "Login successful"
 msgid "Logout successful"
 msgstr "Logout successful"
 
-#: src/views/domain/cert/IssueCert.vue:148
+#: src/views/domain/cert/IssueCert.vue:172
 msgid ""
 "Make sure you have configured a reverse proxy for .well-known directory to "
 "HTTPChallengePort (default: 9180) before getting the certificate."
@@ -367,7 +371,7 @@ msgid "Next"
 msgstr "Next"
 
 #: src/components/StdDataDisplay/StdTable.vue:37
-#: src/views/domain/DomainList.vue:18
+#: src/views/domain/DomainList.vue:25
 #: src/views/domain/ngx_conf/directive/DirectiveEditor.vue:17
 msgid "No"
 msgstr "No"
@@ -380,7 +384,7 @@ msgstr "Not Found"
 msgid "Not Valid Before: %{date}"
 msgstr "Not Valid Before: %{date}"
 
-#: src/views/domain/cert/IssueCert.vue:140
+#: src/views/domain/cert/IssueCert.vue:164
 msgid ""
 "Note: The server_name in the current configuration must be the domain name "
 "you need to get the certificate."
@@ -390,7 +394,7 @@ msgstr ""
 
 #: src/components/StdDataDisplay/StdCurd.vue:27
 #: src/components/StdDataDisplay/StdTable.vue:38
-#: src/views/domain/DomainList.vue:19
+#: src/views/domain/DomainList.vue:26
 msgid "OK"
 msgstr ""
 
@@ -443,7 +447,7 @@ msgstr "Receive"
 msgid "Reset"
 msgstr ""
 
-#: src/views/config/ConfigEdit.vue:52 src/views/domain/DomainEdit.vue:162
+#: src/views/config/ConfigEdit.vue:52 src/views/domain/DomainEdit.vue:160
 msgid "Save"
 msgstr "Save"
 
@@ -477,7 +481,7 @@ msgstr "Send"
 #: src/components/StdDataDisplay/StdTable.vue:94
 #: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44
 #: src/views/domain/DomainEdit.vue:56 src/views/domain/DomainEdit.vue:65
-#: src/views/domain/DomainEdit.vue:85 src/views/domain/DomainList.vue:78
+#: src/views/domain/DomainEdit.vue:83 src/views/domain/DomainList.vue:78
 #: src/views/other/Install.vue:71 src/views/other/Login.vue:49
 msgid "Server error"
 msgstr "Server error"
@@ -486,16 +490,16 @@ msgstr "Server error"
 msgid "Server Info"
 msgstr "Server Info"
 
-#: src/views/domain/cert/IssueCert.vue:32
+#: src/views/domain/cert/IssueCert.vue:28
 msgid "server_name not found in directives"
 msgstr "server_name not found in directives"
 
-#: src/views/domain/cert/IssueCert.vue:131 src/views/domain/DomainAdd.vue:112
+#: src/views/domain/cert/IssueCert.vue:155 src/views/domain/DomainAdd.vue:112
 msgid "server_name parameter is required"
 msgstr "server_name parameter is required"
 
-#: src/views/domain/cert/IssueCert.vue:134
-#: src/views/domain/cert/IssueCert.vue:38
+#: src/views/domain/cert/IssueCert.vue:158
+#: src/views/domain/cert/IssueCert.vue:34
 msgid "server_name parameters more than one"
 msgstr "server_name parameters more than one"
 
@@ -532,7 +536,7 @@ msgstr "Enabled"
 msgid "Terminal"
 msgstr "Terminal"
 
-#: src/views/domain/cert/IssueCert.vue:144
+#: src/views/domain/cert/IssueCert.vue:168
 msgid ""
 "The certificate for the domain will be checked every hour, and will be "
 "renewed if it has been more than 1 month since it was last issued."
@@ -582,8 +586,5 @@ msgstr "License"
 #~ msgid "404 Not Found"
 #~ msgstr "404 Not Found"
 
-#~ msgid "Getting the certificate, please wait..."
-#~ msgstr "Getting the certificate, please wait..."
-
 #~ msgid "Invalid E-mail!"
 #~ msgstr "Invalid E-mail!"

+ 30 - 27
frontend/src/language/messages.pot

@@ -38,7 +38,7 @@ msgid "Advance Mode"
 msgstr ""
 
 #: src/components/StdDataDisplay/StdTable.vue:39
-#: src/views/domain/DomainList.vue:20
+#: src/views/domain/DomainList.vue:27
 msgid "Are you sure you want to delete ?"
 msgstr ""
 
@@ -46,15 +46,15 @@ msgstr ""
 msgid "Are you sure you want to remove this directive?"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:84
+#: src/views/domain/cert/IssueCert.vue:77
 msgid "Auto-renewal disabled for %{name}"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:78
+#: src/views/domain/cert/IssueCert.vue:71
 msgid "Auto-renewal enabled for %{name}"
 msgstr ""
 
-#: src/views/domain/DomainEdit.vue:159
+#: src/views/domain/DomainEdit.vue:157
 msgid "Back"
 msgstr ""
 
@@ -140,7 +140,7 @@ msgid "Database (Optional, default: database)"
 msgstr ""
 
 #: src/components/StdDataDisplay/StdTable.vue:216
-#: src/views/domain/DomainList.vue:104
+#: src/views/domain/DomainList.vue:111
 msgid "Delete"
 msgstr ""
 
@@ -165,17 +165,17 @@ msgstr ""
 msgid "Directives"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:86
+#: src/views/domain/cert/IssueCert.vue:79
 msgid "Disable auto-renewal failed for %{name}"
 msgstr ""
 
 #: src/views/domain/DomainEdit.vue:10
-#: src/views/domain/DomainList.vue:27
+#: src/views/domain/DomainList.vue:17
 #: src/views/domain/DomainList.vue:29
 msgid "Disabled"
 msgstr ""
 
-#: src/views/domain/DomainEdit.vue:103
+#: src/views/domain/DomainEdit.vue:101
 #: src/views/domain/DomainList.vue:64
 msgid "Disabled successfully"
 msgstr ""
@@ -205,7 +205,7 @@ msgstr ""
 msgid "Email (*)"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:80
+#: src/views/domain/cert/IssueCert.vue:73
 msgid "Enable auto-renewal failed for %{name}"
 msgstr ""
 
@@ -219,15 +219,14 @@ msgstr ""
 
 #: src/views/domain/DomainEdit.vue:33
 #: src/views/domain/DomainEdit.vue:7
-#: src/views/domain/DomainList.vue:16
-#: src/views/domain/DomainList.vue:18
+#: src/views/domain/DomainList.vue:12
+#: src/views/domain/DomainList.vue:20
 #: src/views/domain/DomainList.vue:26
-#: src/views/domain/DomainList.vue:30
 msgid "Enabled"
 msgstr ""
 
 #: src/views/domain/DomainAdd.vue:46
-#: src/views/domain/DomainEdit.vue:94
+#: src/views/domain/DomainEdit.vue:92
 #: src/views/domain/DomainList.vue:54
 msgid "Enabled successfully"
 msgstr ""
@@ -240,12 +239,12 @@ msgstr ""
 msgid "Expiration Date: %{date}"
 msgstr ""
 
-#: src/views/domain/DomainEdit.vue:106
+#: src/views/domain/DomainEdit.vue:104
 #: src/views/domain/DomainList.vue:68
 msgid "Failed to disable %{msg}"
 msgstr ""
 
-#: src/views/domain/DomainEdit.vue:97
+#: src/views/domain/DomainEdit.vue:95
 #: src/views/domain/DomainList.vue:58
 msgid "Failed to enable %{msg}"
 msgstr ""
@@ -259,6 +258,10 @@ msgstr ""
 msgid "Finished"
 msgstr ""
 
+#: src/views/domain/cert/IssueCert.vue:85
+msgid "Getting the certificate, please wait..."
+msgstr ""
+
 #: src/routes/index.ts:19
 msgid "Home"
 msgstr ""
@@ -288,7 +291,7 @@ msgstr ""
 msgid "Location"
 msgstr ""
 
-#: src/views/domain/ngx_conf/LocationEditor.vue:40
+#: src/views/domain/ngx_conf/LocationEditor.vue:36
 msgid "Locations"
 msgstr ""
 
@@ -305,7 +308,7 @@ msgstr ""
 msgid "Logout successful"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:148
+#: src/views/domain/cert/IssueCert.vue:172
 msgid "Make sure you have configured a reverse proxy for .well-known directory to HTTPChallengePort (default: 9180) before getting the certificate."
 msgstr ""
 
@@ -370,7 +373,7 @@ msgid "Next"
 msgstr ""
 
 #: src/components/StdDataDisplay/StdTable.vue:37
-#: src/views/domain/DomainList.vue:18
+#: src/views/domain/DomainList.vue:25
 #: src/views/domain/ngx_conf/directive/DirectiveEditor.vue:17
 msgid "No"
 msgstr ""
@@ -384,13 +387,13 @@ msgstr ""
 msgid "Not Valid Before: %{date}"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:140
+#: src/views/domain/cert/IssueCert.vue:164
 msgid "Note: The server_name in the current configuration must be the domain name you need to get the certificate."
 msgstr ""
 
 #: src/components/StdDataDisplay/StdCurd.vue:27
 #: src/components/StdDataDisplay/StdTable.vue:38
-#: src/views/domain/DomainList.vue:19
+#: src/views/domain/DomainList.vue:26
 msgid "OK"
 msgstr ""
 
@@ -448,7 +451,7 @@ msgid "Reset"
 msgstr ""
 
 #: src/views/config/ConfigEdit.vue:52
-#: src/views/domain/DomainEdit.vue:162
+#: src/views/domain/DomainEdit.vue:160
 msgid "Save"
 msgstr ""
 
@@ -486,7 +489,7 @@ msgstr ""
 #: src/views/domain/DomainEdit.vue:44
 #: src/views/domain/DomainEdit.vue:56
 #: src/views/domain/DomainEdit.vue:65
-#: src/views/domain/DomainEdit.vue:85
+#: src/views/domain/DomainEdit.vue:83
 #: src/views/domain/DomainList.vue:78
 #: src/views/other/Install.vue:71
 #: src/views/other/Login.vue:49
@@ -497,17 +500,17 @@ msgstr ""
 msgid "Server Info"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:32
+#: src/views/domain/cert/IssueCert.vue:28
 msgid "server_name not found in directives"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:131
+#: src/views/domain/cert/IssueCert.vue:155
 #: src/views/domain/DomainAdd.vue:112
 msgid "server_name parameter is required"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:134
-#: src/views/domain/cert/IssueCert.vue:38
+#: src/views/domain/cert/IssueCert.vue:158
+#: src/views/domain/cert/IssueCert.vue:34
 msgid "server_name parameters more than one"
 msgstr ""
 
@@ -544,7 +547,7 @@ msgstr ""
 msgid "Terminal"
 msgstr ""
 
-#: src/views/domain/cert/IssueCert.vue:144
+#: src/views/domain/cert/IssueCert.vue:168
 msgid "The certificate for the domain will be checked every hour, and will be renewed if it has been more than 1 month since it was last issued."
 msgstr ""
 

File diff suppressed because it is too large
+ 0 - 0
frontend/src/language/translations.json


+ 30 - 29
frontend/src/language/zh_CN/app.po

@@ -46,7 +46,7 @@ msgid "Advance Mode"
 msgstr "高级模式"
 
 #: src/components/StdDataDisplay/StdTable.vue:39
-#: src/views/domain/DomainList.vue:20
+#: src/views/domain/DomainList.vue:27
 msgid "Are you sure you want to delete ?"
 msgstr "您确定要删除吗?"
 
@@ -54,15 +54,15 @@ msgstr "您确定要删除吗?"
 msgid "Are you sure you want to remove this directive?"
 msgstr "您确定要删除这条指令?"
 
-#: src/views/domain/cert/IssueCert.vue:84
+#: src/views/domain/cert/IssueCert.vue:77
 msgid "Auto-renewal disabled for %{name}"
 msgstr "成功关闭 %{name} 自动续签"
 
-#: src/views/domain/cert/IssueCert.vue:78
+#: src/views/domain/cert/IssueCert.vue:71
 msgid "Auto-renewal enabled for %{name}"
 msgstr "成功启用 %{name} 自动续签"
 
-#: src/views/domain/DomainEdit.vue:159
+#: src/views/domain/DomainEdit.vue:157
 msgid "Back"
 msgstr "返回"
 
@@ -148,7 +148,7 @@ msgid "Database (Optional, default: database)"
 msgstr "数据库 (可选,默认: database)"
 
 #: src/components/StdDataDisplay/StdTable.vue:216
-#: src/views/domain/DomainList.vue:104
+#: src/views/domain/DomainList.vue:111
 msgid "Delete"
 msgstr "删除"
 
@@ -172,16 +172,16 @@ msgstr "指令"
 msgid "Directives"
 msgstr "指令"
 
-#: src/views/domain/cert/IssueCert.vue:86
+#: src/views/domain/cert/IssueCert.vue:79
 msgid "Disable auto-renewal failed for %{name}"
 msgstr "关闭 %{name} 自动续签失败"
 
-#: src/views/domain/DomainEdit.vue:10 src/views/domain/DomainList.vue:27
+#: src/views/domain/DomainEdit.vue:10 src/views/domain/DomainList.vue:17
 #: src/views/domain/DomainList.vue:29
 msgid "Disabled"
 msgstr "禁用"
 
-#: src/views/domain/DomainEdit.vue:103 src/views/domain/DomainList.vue:64
+#: src/views/domain/DomainEdit.vue:101 src/views/domain/DomainList.vue:64
 msgid "Disabled successfully"
 msgstr "禁用成功"
 
@@ -209,7 +209,7 @@ msgstr "编辑站点"
 msgid "Email (*)"
 msgstr "邮箱 (*)"
 
-#: src/views/domain/cert/IssueCert.vue:80
+#: src/views/domain/cert/IssueCert.vue:73
 msgid "Enable auto-renewal failed for %{name}"
 msgstr "启用 %{name} 自动续签失败"
 
@@ -222,12 +222,12 @@ msgid "Enable TLS"
 msgstr "启用 TLS"
 
 #: src/views/domain/DomainEdit.vue:33 src/views/domain/DomainEdit.vue:7
-#: src/views/domain/DomainList.vue:16 src/views/domain/DomainList.vue:18
-#: src/views/domain/DomainList.vue:26 src/views/domain/DomainList.vue:30
+#: src/views/domain/DomainList.vue:12 src/views/domain/DomainList.vue:20
+#: src/views/domain/DomainList.vue:26
 msgid "Enabled"
 msgstr "启用"
 
-#: src/views/domain/DomainAdd.vue:46 src/views/domain/DomainEdit.vue:94
+#: src/views/domain/DomainAdd.vue:46 src/views/domain/DomainEdit.vue:92
 #: src/views/domain/DomainList.vue:54
 msgid "Enabled successfully"
 msgstr "启用成功"
@@ -240,11 +240,11 @@ msgstr "用 Let's Encrypt 对网站进行加密"
 msgid "Expiration Date: %{date}"
 msgstr "过期时间: %{date}"
 
-#: src/views/domain/DomainEdit.vue:106 src/views/domain/DomainList.vue:68
+#: src/views/domain/DomainEdit.vue:104 src/views/domain/DomainList.vue:68
 msgid "Failed to disable %{msg}"
 msgstr "禁用失败 %{msg}"
 
-#: src/views/domain/DomainEdit.vue:97 src/views/domain/DomainList.vue:58
+#: src/views/domain/DomainEdit.vue:95 src/views/domain/DomainList.vue:58
 msgid "Failed to enable %{msg}"
 msgstr "启用失败 %{msg}"
 
@@ -256,6 +256,10 @@ msgstr "未找到文件"
 msgid "Finished"
 msgstr "完成"
 
+#: src/views/domain/cert/IssueCert.vue:85
+msgid "Getting the certificate, please wait..."
+msgstr "正在获取证书,请稍等..."
+
 #: src/routes/index.ts:19
 msgid "Home"
 msgstr "首页"
@@ -284,7 +288,7 @@ msgstr "系统负载:"
 msgid "Location"
 msgstr "Location"
 
-#: src/views/domain/ngx_conf/LocationEditor.vue:40
+#: src/views/domain/ngx_conf/LocationEditor.vue:36
 msgid "Locations"
 msgstr "Locations"
 
@@ -300,7 +304,7 @@ msgstr "登录成功"
 msgid "Logout successful"
 msgstr "登出成功"
 
-#: src/views/domain/cert/IssueCert.vue:148
+#: src/views/domain/cert/IssueCert.vue:172
 msgid ""
 "Make sure you have configured a reverse proxy for .well-known directory to "
 "HTTPChallengePort (default: 9180) before getting the certificate."
@@ -366,7 +370,7 @@ msgid "Next"
 msgstr "下一步"
 
 #: src/components/StdDataDisplay/StdTable.vue:37
-#: src/views/domain/DomainList.vue:18
+#: src/views/domain/DomainList.vue:25
 #: src/views/domain/ngx_conf/directive/DirectiveEditor.vue:17
 msgid "No"
 msgstr "取消"
@@ -379,7 +383,7 @@ msgstr "找不到页面"
 msgid "Not Valid Before: %{date}"
 msgstr "此前无效: %{date}"
 
-#: src/views/domain/cert/IssueCert.vue:140
+#: src/views/domain/cert/IssueCert.vue:164
 msgid ""
 "Note: The server_name in the current configuration must be the domain name "
 "you need to get the certificate."
@@ -387,7 +391,7 @@ msgstr "注意:当前配置中的 server_name 必须为需要申请证书的
 
 #: src/components/StdDataDisplay/StdCurd.vue:27
 #: src/components/StdDataDisplay/StdTable.vue:38
-#: src/views/domain/DomainList.vue:19
+#: src/views/domain/DomainList.vue:26
 msgid "OK"
 msgstr "确定"
 
@@ -440,7 +444,7 @@ msgstr "下载"
 msgid "Reset"
 msgstr "重置"
 
-#: src/views/config/ConfigEdit.vue:52 src/views/domain/DomainEdit.vue:162
+#: src/views/config/ConfigEdit.vue:52 src/views/domain/DomainEdit.vue:160
 msgid "Save"
 msgstr "保存"
 
@@ -473,7 +477,7 @@ msgstr "上传"
 #: src/components/StdDataDisplay/StdTable.vue:94
 #: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44
 #: src/views/domain/DomainEdit.vue:56 src/views/domain/DomainEdit.vue:65
-#: src/views/domain/DomainEdit.vue:85 src/views/domain/DomainList.vue:78
+#: src/views/domain/DomainEdit.vue:83 src/views/domain/DomainList.vue:78
 #: src/views/other/Install.vue:71 src/views/other/Login.vue:49
 msgid "Server error"
 msgstr "服务器错误"
@@ -482,16 +486,16 @@ msgstr "服务器错误"
 msgid "Server Info"
 msgstr "服务器信息"
 
-#: src/views/domain/cert/IssueCert.vue:32
+#: src/views/domain/cert/IssueCert.vue:28
 msgid "server_name not found in directives"
 msgstr "未在指令集合中找到 server_name"
 
-#: src/views/domain/cert/IssueCert.vue:131 src/views/domain/DomainAdd.vue:112
+#: src/views/domain/cert/IssueCert.vue:155 src/views/domain/DomainAdd.vue:112
 msgid "server_name parameter is required"
 msgstr "必须为 server_name 指令指明参数"
 
-#: src/views/domain/cert/IssueCert.vue:134
-#: src/views/domain/cert/IssueCert.vue:38
+#: src/views/domain/cert/IssueCert.vue:158
+#: src/views/domain/cert/IssueCert.vue:34
 msgid "server_name parameters more than one"
 msgstr "server_name 指令包含多个参数"
 
@@ -527,7 +531,7 @@ msgstr "列表"
 msgid "Terminal"
 msgstr "终端"
 
-#: src/views/domain/cert/IssueCert.vue:144
+#: src/views/domain/cert/IssueCert.vue:168
 msgid ""
 "The certificate for the domain will be checked every hour, and will be "
 "renewed if it has been more than 1 month since it was last issued."
@@ -576,9 +580,6 @@ msgstr "开源许可"
 #~ msgid "404 Not Found"
 #~ msgstr "404 未找到页面"
 
-#~ msgid "Getting the certificate, please wait..."
-#~ msgstr "正在获取证书,请稍等..."
-
 #~ msgid "Invalid E-mail!"
 #~ msgstr "无效的邮箱!"
 

+ 30 - 29
frontend/src/language/zh_TW/app.po

@@ -47,7 +47,7 @@ msgid "Advance Mode"
 msgstr "高階模式"
 
 #: src/components/StdDataDisplay/StdTable.vue:39
-#: src/views/domain/DomainList.vue:20
+#: src/views/domain/DomainList.vue:27
 #, fuzzy
 msgid "Are you sure you want to delete ?"
 msgstr "您确定要删除?"
@@ -56,15 +56,15 @@ msgstr "您确定要删除?"
 msgid "Are you sure you want to remove this directive?"
 msgstr "您確定要刪除這條指令?"
 
-#: src/views/domain/cert/IssueCert.vue:84
+#: src/views/domain/cert/IssueCert.vue:77
 msgid "Auto-renewal disabled for %{name}"
 msgstr "已關閉 %{name} 自動續簽"
 
-#: src/views/domain/cert/IssueCert.vue:78
+#: src/views/domain/cert/IssueCert.vue:71
 msgid "Auto-renewal enabled for %{name}"
 msgstr "已啟用 %{name} 自動續簽"
 
-#: src/views/domain/DomainEdit.vue:159
+#: src/views/domain/DomainEdit.vue:157
 msgid "Back"
 msgstr "返回"
 
@@ -151,7 +151,7 @@ msgid "Database (Optional, default: database)"
 msgstr "資料庫 (可選,預設: database)"
 
 #: src/components/StdDataDisplay/StdTable.vue:216
-#: src/views/domain/DomainList.vue:104
+#: src/views/domain/DomainList.vue:111
 msgid "Delete"
 msgstr ""
 
@@ -176,16 +176,16 @@ msgstr "指令"
 msgid "Directives"
 msgstr "指令"
 
-#: src/views/domain/cert/IssueCert.vue:86
+#: src/views/domain/cert/IssueCert.vue:79
 msgid "Disable auto-renewal failed for %{name}"
 msgstr "關閉 %{name} 自動續簽失敗"
 
-#: src/views/domain/DomainEdit.vue:10 src/views/domain/DomainList.vue:27
+#: src/views/domain/DomainEdit.vue:10 src/views/domain/DomainList.vue:17
 #: src/views/domain/DomainList.vue:29
 msgid "Disabled"
 msgstr "禁用"
 
-#: src/views/domain/DomainEdit.vue:103 src/views/domain/DomainList.vue:64
+#: src/views/domain/DomainEdit.vue:101 src/views/domain/DomainList.vue:64
 msgid "Disabled successfully"
 msgstr "禁用成功"
 
@@ -213,7 +213,7 @@ msgstr "編輯站點"
 msgid "Email (*)"
 msgstr "郵箱 (*)"
 
-#: src/views/domain/cert/IssueCert.vue:80
+#: src/views/domain/cert/IssueCert.vue:73
 msgid "Enable auto-renewal failed for %{name}"
 msgstr "啟用 %{name} 自動續簽失敗"
 
@@ -226,12 +226,12 @@ msgid "Enable TLS"
 msgstr "啟用 TLS"
 
 #: src/views/domain/DomainEdit.vue:33 src/views/domain/DomainEdit.vue:7
-#: src/views/domain/DomainList.vue:16 src/views/domain/DomainList.vue:18
-#: src/views/domain/DomainList.vue:26 src/views/domain/DomainList.vue:30
+#: src/views/domain/DomainList.vue:12 src/views/domain/DomainList.vue:20
+#: src/views/domain/DomainList.vue:26
 msgid "Enabled"
 msgstr "啟用"
 
-#: src/views/domain/DomainAdd.vue:46 src/views/domain/DomainEdit.vue:94
+#: src/views/domain/DomainAdd.vue:46 src/views/domain/DomainEdit.vue:92
 #: src/views/domain/DomainList.vue:54
 msgid "Enabled successfully"
 msgstr "啟用成功"
@@ -244,11 +244,11 @@ msgstr "用 Let's Encrypt 對網站進行加密"
 msgid "Expiration Date: %{date}"
 msgstr "過期時間: %{date}"
 
-#: src/views/domain/DomainEdit.vue:106 src/views/domain/DomainList.vue:68
+#: src/views/domain/DomainEdit.vue:104 src/views/domain/DomainList.vue:68
 msgid "Failed to disable %{msg}"
 msgstr "禁用失敗 %{msg}"
 
-#: src/views/domain/DomainEdit.vue:97 src/views/domain/DomainList.vue:58
+#: src/views/domain/DomainEdit.vue:95 src/views/domain/DomainList.vue:58
 msgid "Failed to enable %{msg}"
 msgstr "啟用失敗 %{msg}"
 
@@ -260,6 +260,10 @@ msgstr "未找到檔案"
 msgid "Finished"
 msgstr "完成"
 
+#: src/views/domain/cert/IssueCert.vue:85
+msgid "Getting the certificate, please wait..."
+msgstr "正在獲取憑證,請稍等..."
+
 #: src/routes/index.ts:19
 msgid "Home"
 msgstr "首頁"
@@ -289,7 +293,7 @@ msgstr "系統負載:"
 msgid "Location"
 msgstr "Location"
 
-#: src/views/domain/ngx_conf/LocationEditor.vue:40
+#: src/views/domain/ngx_conf/LocationEditor.vue:36
 msgid "Locations"
 msgstr "Locations"
 
@@ -305,7 +309,7 @@ msgstr "登入成功"
 msgid "Logout successful"
 msgstr "登出成功"
 
-#: src/views/domain/cert/IssueCert.vue:148
+#: src/views/domain/cert/IssueCert.vue:172
 #, fuzzy
 msgid ""
 "Make sure you have configured a reverse proxy for .well-known directory to "
@@ -373,7 +377,7 @@ msgid "Next"
 msgstr "下一步"
 
 #: src/components/StdDataDisplay/StdTable.vue:37
-#: src/views/domain/DomainList.vue:18
+#: src/views/domain/DomainList.vue:25
 #: src/views/domain/ngx_conf/directive/DirectiveEditor.vue:17
 msgid "No"
 msgstr "取消"
@@ -386,7 +390,7 @@ msgstr "找不到頁面"
 msgid "Not Valid Before: %{date}"
 msgstr "此前無效: %{date}"
 
-#: src/views/domain/cert/IssueCert.vue:140
+#: src/views/domain/cert/IssueCert.vue:164
 #, fuzzy
 msgid ""
 "Note: The server_name in the current configuration must be the domain name "
@@ -395,7 +399,7 @@ msgstr "注意:當前配置中的 server_name 必須為需要申請憑證的
 
 #: src/components/StdDataDisplay/StdCurd.vue:27
 #: src/components/StdDataDisplay/StdTable.vue:38
-#: src/views/domain/DomainList.vue:19
+#: src/views/domain/DomainList.vue:26
 msgid "OK"
 msgstr "確定"
 
@@ -448,7 +452,7 @@ msgstr "下載"
 msgid "Reset"
 msgstr ""
 
-#: src/views/config/ConfigEdit.vue:52 src/views/domain/DomainEdit.vue:162
+#: src/views/config/ConfigEdit.vue:52 src/views/domain/DomainEdit.vue:160
 msgid "Save"
 msgstr "儲存"
 
@@ -482,7 +486,7 @@ msgstr "上傳"
 #: src/components/StdDataDisplay/StdTable.vue:94
 #: src/views/config/ConfigEdit.vue:22 src/views/domain/DomainEdit.vue:44
 #: src/views/domain/DomainEdit.vue:56 src/views/domain/DomainEdit.vue:65
-#: src/views/domain/DomainEdit.vue:85 src/views/domain/DomainList.vue:78
+#: src/views/domain/DomainEdit.vue:83 src/views/domain/DomainList.vue:78
 #: src/views/other/Install.vue:71 src/views/other/Login.vue:49
 msgid "Server error"
 msgstr "伺服器錯誤"
@@ -491,16 +495,16 @@ msgstr "伺服器錯誤"
 msgid "Server Info"
 msgstr "伺服器資訊"
 
-#: src/views/domain/cert/IssueCert.vue:32
+#: src/views/domain/cert/IssueCert.vue:28
 msgid "server_name not found in directives"
 msgstr "未在指令集合中找到 server_name"
 
-#: src/views/domain/cert/IssueCert.vue:131 src/views/domain/DomainAdd.vue:112
+#: src/views/domain/cert/IssueCert.vue:155 src/views/domain/DomainAdd.vue:112
 msgid "server_name parameter is required"
 msgstr "必須為 server_name 指令指明參數"
 
-#: src/views/domain/cert/IssueCert.vue:134
-#: src/views/domain/cert/IssueCert.vue:38
+#: src/views/domain/cert/IssueCert.vue:158
+#: src/views/domain/cert/IssueCert.vue:34
 msgid "server_name parameters more than one"
 msgstr "server_name 指令包含多個參數"
 
@@ -537,7 +541,7 @@ msgstr "啟用"
 msgid "Terminal"
 msgstr "終端"
 
-#: src/views/domain/cert/IssueCert.vue:144
+#: src/views/domain/cert/IssueCert.vue:168
 #, fuzzy
 msgid ""
 "The certificate for the domain will be checked every hour, and will be "
@@ -588,9 +592,6 @@ msgstr "開源軟體授權條款"
 #~ msgid "404 Not Found"
 #~ msgstr "404 未找到頁面"
 
-#~ msgid "Getting the certificate, please wait..."
-#~ msgstr "正在獲取憑證,請稍等..."
-
 #~ msgid "Invalid E-mail!"
 #~ msgstr "無效的郵箱!"
 

+ 9 - 3
frontend/src/lib/websocket/index.ts

@@ -3,14 +3,20 @@ import {useUserStore} from '@/pinia'
 import {storeToRefs} from 'pinia'
 
 
-function ws(url: string): ReconnectingWebSocket {
+function ws(url: string, reconnect: boolean = true): ReconnectingWebSocket | WebSocket {
     const user = useUserStore()
     const {token} = storeToRefs(user)
 
     const protocol = location.protocol === 'https:' ? 'wss://' : 'ws://'
 
-    return new ReconnectingWebSocket(
-        protocol + window.location.host + url + '?token=' + btoa(token.value))
+    const _url = protocol + window.location.host + url + '?token=' + btoa(token.value)
+
+    if (reconnect) {
+        return new ReconnectingWebSocket(_url)
+    }
+
+    return new WebSocket(_url)
+
 }
 
 export default ws

+ 1 - 1
frontend/src/version.json

@@ -1 +1 @@
-{"version":"1.5.0","build_id":24,"total_build":94}
+{"version":"1.5.0","build_id":25,"total_build":95}

+ 1 - 1
frontend/src/views/domain/DomainAdd.vue

@@ -70,7 +70,7 @@ const has_server_name = computed(() => {
     const servers = ngx_config.servers
     for (const server_key in servers) {
         for (const k in servers[server_key].directives) {
-            const v = servers[server_key].directives[k]
+            const v: any = servers[server_key].directives[k]
             if (v.directive === 'server_name' && v.params.trim() !== '') {
                 return true
             }

+ 2 - 3
frontend/src/views/domain/DomainEdit.vue

@@ -51,7 +51,7 @@ function on_mode_change(advance_mode: boolean) {
         build_config()
     } else {
         return ngx.tokenize_config(configText.value).then((r: any) => {
-            Object.assign(ngx_config, r.tokenized)
+            Object.assign(ngx_config, r)
         }).catch((e: any) => {
             message.error(e?.message ?? $gettext('Server error'))
         })
@@ -79,8 +79,6 @@ const save = async () => {
         Object.assign(ngx_config, r.tokenized)
         message.success($gettext('Saved successfully'))
 
-        // TODO this.$refs.ngx_config.update_cert_info()
-
     }).catch((e: any) => {
         message.error(e?.message ?? $gettext('Server error'))
     }).finally(() => {
@@ -147,6 +145,7 @@ function disable() {
                         :ngx_config="ngx_config"
                         v-model:auto_cert="auto_cert"
                         :enabled="enabled"
+                        @callback="save()"
                     />
                 </div>
             </transition>

+ 7 - 7
frontend/src/views/domain/DomainList.vue

@@ -94,6 +94,13 @@ function destroy(site_name: any) {
             :deletable="false"
         >
             <template #actions="{record}">
+                <a-divider type="vertical"/>
+                <a v-if="record.enabled" @click="disable(record.name)">
+                    {{ $gettext('Disabled') }}
+                </a>
+                <a v-else @click="enable(record.name)">
+                    {{ $gettext('Enabled') }}
+                </a>
                 <template v-if="!record.enabled">
                     <a-divider type="vertical"/>
                     <a-popconfirm
@@ -104,13 +111,6 @@ function destroy(site_name: any) {
                         <a v-translate>Delete</a>
                     </a-popconfirm>
                 </template>
-                <a-divider type="vertical"/>
-                <a v-if="record.enabled" @click="disable(record.name)">
-                    {{ $gettext('Disabled') }}
-                </a>
-                <a v-else @click="enable(record.name)">
-                    {{ $gettext('Enabled') }}
-                </a>
             </template>
         </std-table>
     </a-card>

+ 8 - 9
frontend/src/views/domain/cert/Cert.vue

@@ -3,11 +3,9 @@ import CertInfo from '@/views/domain/cert/CertInfo.vue'
 import IssueCert from '@/views/domain/cert/IssueCert.vue'
 import {computed, ref} from 'vue'
 
-const {directivesMap, current_server_directives, enabled} = defineProps<{
-    directivesMap: any
-    current_server_directives: Array<any>
-    enabled: boolean
-}>()
+const props = defineProps(['directivesMap', 'current_server_directives', 'enabled'])
+
+const emit = defineEmits(['callback'])
 
 const info = ref(null)
 
@@ -18,10 +16,11 @@ interface Info {
 function callback() {
     const t: Info | null = info.value
     t!.get()
+    emit('callback')
 }
 
 const name = computed(() => {
-    return directivesMap['server_name'][0].params.trim()
+    return props.directivesMap['server_name'][0].params.trim()
 })
 </script>
 
@@ -29,9 +28,9 @@ const name = computed(() => {
     <div>
         <cert-info ref="info" :domain="name" v-if="name"/>
         <issue-cert
-            :current_server_directives="current_server_directives"
-            :directives-map="directivesMap"
-            v-model:enabled="enabled"
+            :current_server_directives="props.current_server_directives"
+            :directives-map="props.directivesMap"
+            v-model:enabled="props.enabled"
             @callback="callback"
         />
     </div>

+ 47 - 23
frontend/src/views/domain/cert/IssueCert.vue

@@ -1,17 +1,13 @@
 <script setup lang="ts">
-import {issue_cert} from '../methods'
 import {useGettext} from 'vue3-gettext'
 import {computed, nextTick, ref, watch} from 'vue'
 import {message} from 'ant-design-vue'
 import domain from '@/api/domain'
+import websocket from '@/lib/websocket'
 
 const {$gettext, interpolate} = useGettext()
 
-const {directivesMap, current_server_directives, enabled} = defineProps<{
-    directivesMap: any
-    current_server_directives: Array<any>
-    enabled: boolean
-}>()
+const props = defineProps(['directivesMap', 'current_server_directives', 'enabled'])
 
 const emit = defineEmits(['changeEnabled', 'callback', 'update:enabled'])
 
@@ -40,35 +36,32 @@ function job() {
         return
     }
 
-    const server_name = directivesMap['server_name'][0]
+    const server_name = props.directivesMap['server_name'][0]
 
-    if (!directivesMap['ssl_certificate']) {
-        current_server_directives.splice(server_name.idx + 1, 0, {
+    if (!props.directivesMap['ssl_certificate']) {
+        props.current_server_directives.splice(server_name.idx + 1, 0, {
             directive: 'ssl_certificate',
             params: ''
         })
     }
 
     nextTick(() => {
-        if (!directivesMap['ssl_certificate_key']) {
-            const ssl_certificate = directivesMap['ssl_certificate'][0]
-            current_server_directives.splice(ssl_certificate.idx + 1, 0, {
+        if (!props.directivesMap['ssl_certificate_key']) {
+            const ssl_certificate = props.directivesMap['ssl_certificate'][0]
+            props.current_server_directives.splice(ssl_certificate.idx + 1, 0, {
                 directive: 'ssl_certificate_key',
                 params: ''
             })
         }
-    })
-
-    setTimeout(() => {
+    }).then(() => {
         issue_cert(name.value, callback)
-    }, 100)
+    })
 }
 
 function callback(ssl_certificate: string, ssl_certificate_key: string) {
-    directivesMap['ssl_certificate'][0]['params'] = ssl_certificate
-    directivesMap['ssl_certificate_key'][0]['params'] = ssl_certificate_key
+    props.directivesMap['ssl_certificate'][0]['params'] = ssl_certificate
+    props.directivesMap['ssl_certificate_key'][0]['params'] = ssl_certificate_key
 
-    issuing_cert.value = false
     emit('callback')
 }
 
@@ -88,17 +81,48 @@ function change_auto_cert(r: boolean) {
     }
 }
 
+const issue_cert = async (server_name: string, callback: Function) => {
+    message.info($gettext('Getting the certificate, please wait...'), 15)
+
+    const ws = websocket('/api/cert/issue/' + server_name, false)
+
+    ws.onopen = () => {
+        ws.send('go')
+    }
+
+    ws.onmessage = m => {
+        const r = JSON.parse(m.data)
+        switch (r.status) {
+            case 'success':
+                message.success(r.message, 10)
+                break
+            case 'info':
+                message.info(r.message, 10)
+                break
+            case 'error':
+                message.error(r.message, 10)
+                break
+        }
+
+        if (r.status === 'success' && r.ssl_certificate !== undefined && r.ssl_certificate_key !== undefined) {
+            callback(r.ssl_certificate, r.ssl_certificate_key)
+        }
+
+        issuing_cert.value = false
+    }
+}
+
 const server_name_more_than_one = computed(() => {
-    return directivesMap['server_name'] && (directivesMap['server_name'].length > 1 ||
-        directivesMap['server_name'][0].params.trim().indexOf(' ') > 0)
+    return props.directivesMap['server_name'] && (props.directivesMap['server_name'].length > 1 ||
+        props.directivesMap['server_name'][0].params.trim().indexOf(' ') > 0)
 })
 
 const no_server_name = computed(() => {
-    return directivesMap['server_name'].length === 0
+    return props.directivesMap['server_name'].length === 0
 })
 
 const name = computed(() => {
-    return directivesMap['server_name'][0].params.trim()
+    return props.directivesMap['server_name'][0].params.trim()
 })
 
 watch(server_name_more_than_one, () => {

+ 0 - 40
frontend/src/views/domain/methods.ts

@@ -1,40 +0,0 @@
-import gettext from '@/gettext'
-import websocket from '@/lib/websocket'
-import ReconnectingWebSocket from 'reconnecting-websocket'
-import {message} from 'ant-design-vue'
-
-const {$gettext} = gettext
-
-const issue_cert = async (server_name: string, callback: Function) => {
-    // message.info($gettext('Getting the certificate, please wait...'), 15)
-    //
-    // const ws: ReconnectingWebSocket = websocket('/api/cert/issue/' + server_name)
-    //
-    // ws.onopen = () => {
-    //     ws.send('go')
-    // }
-    //
-    // ws.onmessage = m => {
-    //     const r = JSON.parse(m.data)
-    //     switch (r.status) {
-    //         case 'success':
-    //             message.success(r.message, 10)
-    //             break
-    //         case 'info':
-    //             message.info(r.message, 10)
-    //             break
-    //         case 'error':
-    //             message.error(r.message, 10)
-    //             break
-    //     }
-    //
-    //     if (r.status === 'success' && r.ssl_certificate !== undefined && r.ssl_certificate_key !== undefined) {
-    //         callback(r.ssl_certificate, r.ssl_certificate_key)
-    //     }
-    // }
-    setTimeout(() => {
-        callback('a', 'b')
-    }, 10000)
-}
-
-export {issue_cert}

+ 6 - 10
frontend/src/views/domain/ngx_conf/LocationEditor.vue

@@ -5,9 +5,7 @@ import {reactive, ref} from 'vue'
 
 const {$gettext} = useGettext()
 
-const {locations} = defineProps<{
-    locations?: any[]
-}>()
+const props = defineProps(['locations'])
 
 let location = reactive({
     comments: '',
@@ -19,20 +17,18 @@ const adding = ref(false)
 
 function add() {
     adding.value = true
-    location = reactive({
-        comments: '',
-        path: '',
-        content: '',
-    })
+    location.comments = ''
+    location.path = ''
+    location.content = ''
 }
 
 function save() {
     adding.value = false
-    locations?.push(location)
+    props.locations?.push(location)
 }
 
 function remove(index: number) {
-    locations?.splice(index, 1)
+    props.locations?.splice(index, 1)
 }
 </script>
 

+ 6 - 2
frontend/src/views/domain/ngx_conf/NgxConfigEditor.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import DirectiveEditor from '@/views/domain/ngx_conf/directive/DirectiveEditor'
 import LocationEditor from '@/views/domain/ngx_conf/LocationEditor'
-import {computed, ref} from 'vue'
+import {computed, defineEmits, ref} from 'vue'
 import {useRoute} from 'vue-router'
 import {useGettext} from 'vue3-gettext'
 import Cert from '@/views/domain/cert/Cert.vue'
@@ -10,6 +10,8 @@ const {$gettext} = useGettext()
 
 const {ngx_config, auto_cert, enabled} = defineProps(['ngx_config', 'auto_cert', 'enabled'])
 
+const emit = defineEmits(['callback'])
+
 const route = useRoute()
 
 const current_server_index = ref(0)
@@ -134,7 +136,9 @@ const current_support_ssl = computed(() => {
                             v-if="current_support_ssl"
                             :current_server_directives="current_server_directives"
                             :directives-map="directivesMap"
-                            v-model:enabled="auto_cert"/>
+                            v-model:enabled="auto_cert"
+                            @callback="$emit('callback')"
+                        />
                     </template>
 
                     <template v-if="v.comments">

+ 1 - 1
frontend/version.json

@@ -1 +1 @@
-{"version":"1.5.0","build_id":24,"total_build":94}
+{"version":"1.5.0","build_id":25,"total_build":95}

+ 2 - 2
server/tool/cert.go

@@ -36,7 +36,7 @@ type MyUser struct {
 func (u *MyUser) GetEmail() string {
     return u.Email
 }
-func (u MyUser) GetRegistration() *registration.Resource {
+func (u *MyUser) GetRegistration() *registration.Resource {
     return u.Registration
 }
 func (u *MyUser) GetPrivateKey() crypto.PrivateKey {
@@ -123,7 +123,7 @@ func IssueCert(domain string) error {
     if settings.ServerSettings.Demo {
         config.CADirURL = "https://acme-staging-v02.api.letsencrypt.org/directory"
     }
-
+    
     config.Certificate.KeyType = certcrypto.RSA2048
 
     // A client facilitates communication with the CA server.

+ 68 - 63
server/tool/nginx/build_config.go

@@ -1,83 +1,88 @@
 package nginx
 
 import (
-	"bufio"
-	"fmt"
-	"strings"
+    "bufio"
+    "fmt"
+    "strings"
 )
 
 func buildComments(orig string, indent int) (content string) {
-	scanner := bufio.NewScanner(strings.NewReader(orig))
-	for scanner.Scan() {
-		content += strings.Repeat("\t", indent) + "# " + scanner.Text() + "\n"
-	}
-	content = strings.TrimLeft(content, "\n")
-	return
+    scanner := bufio.NewScanner(strings.NewReader(orig))
+    for scanner.Scan() {
+        content += strings.Repeat("\t", indent) + "# " + scanner.Text() + "\n"
+    }
+    content = strings.TrimLeft(content, "\n")
+    return
 }
 
 func (c *NgxConfig) BuildConfig() (content string) {
 
-	// Custom
-	if c.Custom != "" {
-		content += fmtCode(c.Custom)
-		content += "\n\n"
-	}
+    // Custom
+    if c.Custom != "" {
+        content += fmtCode(c.Custom)
+        content += "\n\n"
+    }
 
-	// Upstreams
-	for _, u := range c.Upstreams {
+    // Upstreams
+    for _, u := range c.Upstreams {
 
-		upstream := ""
-		var comments string
-		for _, directive := range u.Directives {
-			if directive.Comments != "" {
-				comments = buildComments(directive.Comments, 1)
-			}
-			upstream += fmt.Sprintf("%s\t%s;\n", comments, directive.Orig())
-		}
-		comments = buildComments(u.Comments, 1)
-		content += fmt.Sprintf("upstream %s {\n%s%s}\n\n", u.Name, comments, upstream)
-	}
+        upstream := ""
+        var comments string
+        for _, directive := range u.Directives {
+            if directive.Comments != "" {
+                comments = buildComments(directive.Comments, 1)
+            }
+            upstream += fmt.Sprintf("%s\t%s;\n", comments, directive.Orig())
+        }
+        comments = buildComments(u.Comments, 1)
+        content += fmt.Sprintf("upstream %s {\n%s%s}\n\n", u.Name, comments, upstream)
+    }
 
-	// Servers
-	for _, s := range c.Servers {
-		server := ""
+    // Servers
+    for _, s := range c.Servers {
+        server := ""
 
-		// directives
-		for _, directive := range s.Directives {
-			var comments string
-			if directive.Comments != "" {
-				comments = buildComments(directive.Comments, 1)
-			}
-			if directive.Directive == If {
-				server += fmt.Sprintf("%s%s\n", comments, fmtCodeWithIndent(directive.Params, 1))
-			} else if directive.Params != "" {
-				server += fmt.Sprintf("%s\t%s;\n", comments, directive.Orig())
-			}
-		}
+        // directives
+        for _, directive := range s.Directives {
+            var comments string
+            if directive.Comments != "" {
+                comments = buildComments(directive.Comments, 1)
+            }
+            if directive.Directive == If {
+                server += fmt.Sprintf("%s%s\n", comments, fmtCodeWithIndent(directive.Params, 1))
+            } else if directive.Params != "" {
+                server += fmt.Sprintf("%s\t%s;\n", comments, directive.Orig())
+            }
+        }
 
-		if len(s.Directives) > 0 {
-			server += "\n"
-		}
+        if len(s.Directives) > 0 {
+            server += "\n"
+        }
 
-		// locations
-		locations := ""
-		for _, location := range s.Locations {
-			locationContent := ""
-			scanner := bufio.NewScanner(strings.NewReader(location.Content))
-			for scanner.Scan() {
-				locationContent += "\t\t" + scanner.Text() + "\n"
-			}
-			var comments string
-			if location.Comments != "" {
-				comments = buildComments(location.Comments, 1)
-			}
-			locations += fmt.Sprintf("%s\tlocation %s {\n%s\t}\n\n", comments, location.Path, locationContent)
-		}
+        // locations
+        locations := ""
+        for _, location := range s.Locations {
+            locationContent := ""
+            scanner := bufio.NewScanner(strings.NewReader(location.Content))
+            for scanner.Scan() {
+                locationContent += "\t\t" + scanner.Text() + "\n"
+            }
+            var comments string
+            if location.Comments != "" {
+                comments = buildComments(location.Comments, 1)
+            }
+            locations += fmt.Sprintf("%s\tlocation %s {\n%s\t}\n\n", comments, location.Path, locationContent)
+        }
 
-		server += locations
+        server += locations
 
-		content += fmt.Sprintf("server {\n%s}\n\n", server)
-	}
+        var comments string
+        if s.Comments != "" {
+            comments = buildComments(s.Comments, 0) + "\n"
+        }
 
-	return
+        content += fmt.Sprintf("%sserver {\n%s}\n\n", comments, server)
+    }
+
+    return
 }

Some files were not shown because too many files changed in this diff