fix: config template parse issue

This commit is contained in:
0xJacky 2023-01-05 20:47:33 +08:00
parent b16536b1f0
commit b5508b7366
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
17 changed files with 184 additions and 398 deletions

View file

@ -12,17 +12,13 @@ declare module '@vue/runtime-core' {
ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem']
AButton: typeof import('ant-design-vue/es')['Button']
ACard: typeof import('ant-design-vue/es')['Card']
ACol: typeof import('ant-design-vue/es')['Col']
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
ADivider: typeof import('ant-design-vue/es')['Divider']
ADrawer: typeof import('ant-design-vue/es')['Drawer']
AEmpty: typeof import('ant-design-vue/es')['Empty']
AForm: typeof import('ant-design-vue/es')['Form']
AFormItem: typeof import('ant-design-vue/es')['FormItem']
AInput: typeof import('ant-design-vue/es')['Input']
AInputGroup: typeof import('ant-design-vue/es')['InputGroup']
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
ALayout: typeof import('ant-design-vue/es')['Layout']
ALayoutContent: typeof import('ant-design-vue/es')['LayoutContent']
ALayoutFooter: typeof import('ant-design-vue/es')['LayoutFooter']
@ -33,20 +29,13 @@ declare module '@vue/runtime-core' {
AMenu: typeof import('ant-design-vue/es')['Menu']
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
AModal: typeof import('ant-design-vue/es')['Modal']
APagination: typeof import('ant-design-vue/es')['Pagination']
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
AProgress: typeof import('ant-design-vue/es')['Progress']
AResult: typeof import('ant-design-vue/es')['Result']
ARow: typeof import('ant-design-vue/es')['Row']
ASelect: typeof import('ant-design-vue/es')['Select']
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
ASpace: typeof import('ant-design-vue/es')['Space']
AStatistic: typeof import('ant-design-vue/es')['Statistic']
AStep: typeof import('ant-design-vue/es')['Step']
ASteps: typeof import('ant-design-vue/es')['Steps']
ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
ASwitch: typeof import('ant-design-vue/es')['Switch']
ATable: typeof import('ant-design-vue/es')['Table']
ATabPane: typeof import('ant-design-vue/es')['TabPane']
ATabs: typeof import('ant-design-vue/es')['Tabs']
ATag: typeof import('ant-design-vue/es')['Tag']
@ -68,8 +57,5 @@ declare module '@vue/runtime-core' {
StdDataEntryComponentsStdPassword: typeof import('./src/components/StdDataEntry/components/StdPassword.vue')['default']
StdDataEntryComponentsStdSelect: typeof import('./src/components/StdDataEntry/components/StdSelect.vue')['default']
StdDataEntryComponentsStdSelector: typeof import('./src/components/StdDataEntry/components/StdSelector.vue')['default']
StdDataEntryCompontentsStdPassword: typeof import('./src/components/StdDataEntry/compontents/StdPassword.vue')['default']
StdDataEntryCompontentsStdSelect: typeof import('./src/components/StdDataEntry/compontents/StdSelect.vue')['default']
StdDataEntryCompontentsStdSelector: typeof import('./src/components/StdDataEntry/compontents/StdSelector.vue')['default']
}
}

View file

@ -1,51 +0,0 @@
<script setup lang="ts">
import {computed, ref} from 'vue'
const props = defineProps(['value', 'generate', 'placeholder'])
const emit = defineEmits(['update:value'])
const M_value = computed({
get() {
return props.value
},
set(v) {
emit('update:value', v)
}
})
const visibility = ref(false)
function handle_generate() {
visibility.value = true
M_value.value = 'xxxx'
const chars = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ'
const passwordLength = 12
let password = ''
for (let i = 0; i <= passwordLength; i++) {
const randomNumber = Math.floor(Math.random() * chars.length)
password += chars.substring(randomNumber, randomNumber + 1)
}
M_value.value = password
}
</script>
<template>
<a-input-group compact>
<a-input-password
v-if="!visibility"
:class="{compact: generate}"
v-model:value="M_value" :placeholoder="placeholder"/>
<a-input v-else :class="{compact: generate}" v-model:value="M_value" :placeholoder="placeholder"/>
<a-button @click="handle_generate" v-if="generate" type="primary">
<translate>Generate</translate>
</a-button>
</a-input-group>
</template>
<style scoped>
.compact {
width: calc(100% - 91px)
}
</style>

View file

@ -1,45 +0,0 @@
<script setup lang="ts">
import {computed, ref} from 'vue'
import {SelectProps} from 'ant-design-vue'
const props = defineProps(['value', 'mask'])
const emit = defineEmits(['update:value'])
const options = computed(() => {
const _options = ref<SelectProps['options']>([])
for (const [key, value] of Object.entries(props.mask)) {
const v = value as any
_options.value!.push({label: v?.(), value: key})
}
return _options
})
const _value = computed({
get() {
let v
if (typeof props.mask?.[props.value] === 'function') {
v = props.mask[props.value]()
} else if (typeof props.mask?.[props.value] === 'string') {
v = props.mask[props.value]
} else {
v = props.value
}
return v
},
set(v) {
emit('update:value', v)
}
})
</script>
<template>
<a-select v-model:value="_value"
:options="options.value" style="min-width: 180px"/>
</template>
<style lang="less" scoped>
</style>

View file

@ -1,137 +0,0 @@
<script setup lang="ts">
import {onMounted, reactive, ref, watch} from 'vue'
import StdTable from '@/components/StdDataDisplay/StdTable.vue'
import gettext from '@/gettext'
const {$gettext} = gettext
const props = defineProps(['selectedKey', 'value', 'recordValueIndex',
'selectionType', 'api', 'columns', 'data_key',
'disable_search', 'get_params', 'description'])
const emit = defineEmits(['update:selectedKey', 'changeSelect'])
const visible = ref(false)
const M_value = ref('')
onMounted(() => {
init()
})
const selected = ref([])
const record: any = reactive({})
function init() {
if (props.selectedKey && !props.value && props.selectionType === 'radio') {
props.api.get(props.selectedKey).then((r: any) => {
Object.assign(record, r)
M_value.value = r[props.recordValueIndex]
})
}
}
function show() {
visible.value = true
}
function onSelect(_selected: any) {
selected.value = _selected
}
function onSelectedRecord(r: any) {
Object.assign(record, r)
}
function ok() {
visible.value = false
if (props.selectionType == 'radio') {
emit('update:selectedKey', selected.value[0])
} else {
emit('update:selectedKey', selected.value)
}
M_value.value = record[props.recordValueIndex]
emit('changeSelect', record)
}
watch(props, () => {
if (!props?.selectedKey) {
M_value.value = ''
} else if (props.value) {
M_value.value = props.value
} else {
init()
}
})
</script>
<template>
<div class="std-selector-container">
<div class="std-selector" @click="show()">
<a-input v-model="selectedKey" disabled hidden/>
<div class="value">
{{ M_value }}
</div>
<a-modal
:mask="false"
:visible="visible"
:cancel-text="$gettext('Cancel')"
:ok-text="$gettext('OK')"
:title="$gettext('Selector')"
@cancel="visible=false"
@ok="ok()"
:width="800"
destroyOnClose
>
{{ description }}
<std-table
:api="api"
:columns="columns"
:data_key="data_key"
:disable_search="disable_search"
:pithy="true"
:get_params="get_params"
:selectionType="selectionType"
:disable_query_params="true"
@onSelected="onSelect"
@onSelectedRecord="onSelectedRecord"
/>
</a-modal>
</div>
</div>
</template>
<style lang="less" scoped>
.dark .std-selector-container {
background-color: #1e1f20;
border: 1px solid #666666;
color: rgba(255, 255, 255, 0.99);
}
.std-selector-container {
height: 39.9px;
display: flex;
align-items: flex-start;
.std-selector {
box-sizing: border-box;
font-variant: tabular-nums;
list-style: none;
font-feature-settings: 'tnum';
height: 32px;
padding: 4px 11px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
line-height: 1.5;
background-color: #fff;
background-image: none;
border: 1px solid #d9d9d9;
border-radius: 4px;
transition: all 0.3s;
margin: 0 10px 0 0;
cursor: pointer;
min-width: 180px;
.value {
}
}
}
</style>

View file

@ -91,11 +91,11 @@ msgstr ""
msgid "Auto Refresh"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:72
#: src/views/domain/cert/IssueCert.vue:71
msgid "Auto-renewal disabled for %{name}"
msgstr "Auto-renewal disabled for %{name}"
#: src/views/domain/cert/IssueCert.vue:66
#: src/views/domain/cert/IssueCert.vue:65
msgid "Auto-renewal enabled for %{name}"
msgstr "Auto-renewal enabled for %{name}"
@ -134,7 +134,6 @@ msgstr "Build with"
#: src/components/StdDataDisplay/StdBatchEdit.vue:7
#: src/components/StdDataDisplay/StdCurd.vue:27
#: src/components/StdDataEntry/components/StdSelector.vue:11
#: src/components/StdDataEntry/compontents/StdSelector.vue:11
msgid "Cancel"
msgstr "Cancel"
@ -146,7 +145,7 @@ msgstr "Certificate has expired"
msgid "Certificate is valid"
msgstr "Certificate is valid"
#: src/views/cert/Cert.vue:12 src/views/domain/cert/Cert.vue:31
#: src/views/cert/Cert.vue:12 src/views/domain/cert/Cert.vue:35
msgid "Certificate Status"
msgstr "Certificate Status"
@ -155,6 +154,13 @@ msgstr "Certificate Status"
msgid "Certification"
msgstr "Certificate is valid"
#: src/views/domain/cert/ChangeCert.vue:2
#: src/views/domain/cert/ChangeCert.vue:3
#: src/views/domain/cert/ChangeCert.vue:5
#, fuzzy
msgid "Change Certificate"
msgstr "Certificate is valid"
#: src/views/domain/ngx_conf/directive/DirectiveEditorItem.vue:34
#: src/views/domain/ngx_conf/LocationEditor.vue:31
#: src/views/domain/ngx_conf/LocationEditor.vue:47
@ -267,7 +273,7 @@ msgstr "Directive"
msgid "Directives"
msgstr "Directives"
#: src/views/domain/cert/IssueCert.vue:74
#: src/views/domain/cert/IssueCert.vue:73
msgid "Disable auto-renewal failed for %{name}"
msgstr "Disable auto-renewal failed for %{name}"
@ -310,7 +316,7 @@ msgstr "Edit Site"
msgid "Email (*)"
msgstr "Email (*)"
#: src/views/domain/cert/IssueCert.vue:68
#: src/views/domain/cert/IssueCert.vue:67
msgid "Enable auto-renewal failed for %{name}"
msgstr "Enable auto-renewal failed for %{name}"
@ -397,7 +403,6 @@ msgid "Format successfully"
msgstr "Saved successfully"
#: src/components/StdDataEntry/components/StdPassword.vue:42
#: src/components/StdDataEntry/compontents/StdPassword.vue:42
msgid "Generate"
msgstr ""
@ -405,7 +410,7 @@ msgstr ""
msgid "Generating private key for registering account"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:97
#: src/views/domain/cert/IssueCert.vue:96
msgid "Getting the certificate, please wait..."
msgstr "Getting the certificate, please wait..."
@ -478,7 +483,7 @@ msgstr "Login successful"
msgid "Logout successful"
msgstr "Logout successful"
#: src/views/domain/cert/IssueCert.vue:210
#: src/views/domain/cert/IssueCert.vue:211
msgid ""
"Make sure you have configured a reverse proxy for .well-known directory to "
"HTTPChallengePort (default: 9180) before getting the certificate."
@ -578,13 +583,9 @@ msgstr "Not Found"
msgid "Not Valid Before: %{date}"
msgstr "Not Valid Before: %{date}"
#: src/views/domain/cert/IssueCert.vue:202
msgid ""
"Note: The server_name in the current configuration must be the domain name "
"you need to get the certificate."
#: src/views/domain/cert/IssueCert.vue:38
msgid "Note"
msgstr ""
"Note: The server_name in the current configuration must be the domain name "
"you need to get the certificate."
#: src/language/constants.ts:16 src/views/domain/cert/IssueCert.vue:3
msgid "Obtaining certificate"
@ -594,7 +595,6 @@ msgstr ""
#: src/components/StdDataDisplay/StdCurd.vue:28
#: src/components/StdDataDisplay/StdTable.vue:53
#: src/components/StdDataEntry/components/StdSelector.vue:12
#: src/components/StdDataEntry/compontents/StdSelector.vue:12
#: src/views/domain/DomainList.vue:25
msgid "OK"
msgstr ""
@ -719,7 +719,6 @@ msgid "Saved successfully"
msgstr "Saved successfully"
#: src/components/StdDataEntry/components/StdSelector.vue:13
#: src/components/StdDataEntry/compontents/StdSelector.vue:13
msgid "Selector"
msgstr ""
@ -742,11 +741,11 @@ msgstr "Server error"
msgid "Server Info"
msgstr "Server Info"
#: src/views/domain/cert/IssueCert.vue:29
#: src/views/domain/cert/IssueCert.vue:30
msgid "server_name not found in directives"
msgstr "server_name not found in directives"
#: src/views/domain/cert/IssueCert.vue:196 src/views/domain/DomainAdd.vue:111
#: src/views/domain/cert/IssueCert.vue:195 src/views/domain/DomainAdd.vue:111
msgid "server_name parameter is required"
msgstr "server_name parameter is required"
@ -813,7 +812,7 @@ msgstr "Terminal"
msgid "Terminal Start Command"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:206
#: src/views/domain/cert/IssueCert.vue:207
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."
@ -825,6 +824,15 @@ msgstr ""
msgid "The filename cannot contain the following characters: %{c}"
msgstr "The filename cannot contain the following characters: %{c}"
#: src/views/domain/cert/IssueCert.vue:203
#, fuzzy
msgid ""
"The server_name in the current configuration must be the domain name you "
"need to get the certificate."
msgstr ""
"Note: The server_name in the current configuration must be the domain name "
"you need to get the certificate."
#: src/language/constants.ts:6
msgid "The username or password is incorrect"
msgstr ""

View file

@ -87,11 +87,11 @@ msgstr ""
msgid "Auto Refresh"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:72
#: src/views/domain/cert/IssueCert.vue:71
msgid "Auto-renewal disabled for %{name}"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:66
#: src/views/domain/cert/IssueCert.vue:65
msgid "Auto-renewal enabled for %{name}"
msgstr ""
@ -132,7 +132,6 @@ msgstr ""
#: src/components/StdDataDisplay/StdBatchEdit.vue:7
#: src/components/StdDataDisplay/StdCurd.vue:27
#: src/components/StdDataEntry/components/StdSelector.vue:11
#: src/components/StdDataEntry/compontents/StdSelector.vue:11
msgid "Cancel"
msgstr ""
@ -145,7 +144,7 @@ msgid "Certificate is valid"
msgstr ""
#: src/views/cert/Cert.vue:12
#: src/views/domain/cert/Cert.vue:31
#: src/views/domain/cert/Cert.vue:35
msgid "Certificate Status"
msgstr ""
@ -154,6 +153,12 @@ msgstr ""
msgid "Certification"
msgstr ""
#: src/views/domain/cert/ChangeCert.vue:2
#: src/views/domain/cert/ChangeCert.vue:3
#: src/views/domain/cert/ChangeCert.vue:5
msgid "Change Certificate"
msgstr ""
#: src/views/domain/ngx_conf/directive/DirectiveEditorItem.vue:34
#: src/views/domain/ngx_conf/LocationEditor.vue:31
#: src/views/domain/ngx_conf/LocationEditor.vue:47
@ -266,7 +271,7 @@ msgstr ""
msgid "Directives"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:74
#: src/views/domain/cert/IssueCert.vue:73
msgid "Disable auto-renewal failed for %{name}"
msgstr ""
@ -316,7 +321,7 @@ msgstr ""
msgid "Email (*)"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:68
#: src/views/domain/cert/IssueCert.vue:67
msgid "Enable auto-renewal failed for %{name}"
msgstr ""
@ -411,7 +416,6 @@ msgid "Format successfully"
msgstr ""
#: src/components/StdDataEntry/components/StdPassword.vue:42
#: src/components/StdDataEntry/compontents/StdPassword.vue:42
msgid "Generate"
msgstr ""
@ -419,7 +423,7 @@ msgstr ""
msgid "Generating private key for registering account"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:97
#: src/views/domain/cert/IssueCert.vue:96
msgid "Getting the certificate, please wait..."
msgstr ""
@ -492,7 +496,7 @@ msgstr ""
msgid "Logout successful"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:210
#: src/views/domain/cert/IssueCert.vue:211
msgid "Make sure you have configured a reverse proxy for .well-known directory to HTTPChallengePort (default: 9180) before getting the certificate."
msgstr ""
@ -592,8 +596,8 @@ msgstr ""
msgid "Not Valid Before: %{date}"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:202
msgid "Note: The server_name in the current configuration must be the domain name you need to get the certificate."
#: src/views/domain/cert/IssueCert.vue:38
msgid "Note"
msgstr ""
#: src/language/constants.ts:16
@ -605,7 +609,6 @@ msgstr ""
#: src/components/StdDataDisplay/StdCurd.vue:28
#: src/components/StdDataDisplay/StdTable.vue:53
#: src/components/StdDataEntry/components/StdSelector.vue:12
#: src/components/StdDataEntry/compontents/StdSelector.vue:12
#: src/views/domain/DomainList.vue:25
msgid "OK"
msgstr ""
@ -734,7 +737,6 @@ msgid "Saved successfully"
msgstr ""
#: src/components/StdDataEntry/components/StdSelector.vue:13
#: src/components/StdDataEntry/compontents/StdSelector.vue:13
msgid "Selector"
msgstr ""
@ -762,11 +764,11 @@ msgstr ""
msgid "Server Info"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:29
#: src/views/domain/cert/IssueCert.vue:30
msgid "server_name not found in directives"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:196
#: src/views/domain/cert/IssueCert.vue:195
#: src/views/domain/DomainAdd.vue:111
msgid "server_name parameter is required"
msgstr ""
@ -829,7 +831,7 @@ msgstr ""
msgid "Terminal Start Command"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:206
#: src/views/domain/cert/IssueCert.vue:207
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 ""
@ -837,6 +839,10 @@ msgstr ""
msgid "The filename cannot contain the following characters: %{c}"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:203
msgid "The server_name in the current configuration must be the domain name you need to get the certificate."
msgstr ""
#: src/language/constants.ts:6
msgid "The username or password is incorrect"
msgstr ""

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -92,11 +92,11 @@ msgstr "自动更新已启用,请勿修改此证书配置。"
msgid "Auto Refresh"
msgstr "自动刷新"
#: src/views/domain/cert/IssueCert.vue:72
#: src/views/domain/cert/IssueCert.vue:71
msgid "Auto-renewal disabled for %{name}"
msgstr "成功关闭 %{name} 自动续签"
#: src/views/domain/cert/IssueCert.vue:66
#: src/views/domain/cert/IssueCert.vue:65
msgid "Auto-renewal enabled for %{name}"
msgstr "成功启用 %{name} 自动续签"
@ -133,7 +133,6 @@ msgstr "构建基于"
#: src/components/StdDataDisplay/StdBatchEdit.vue:7
#: src/components/StdDataDisplay/StdCurd.vue:27
#: src/components/StdDataEntry/components/StdSelector.vue:11
#: src/components/StdDataEntry/compontents/StdSelector.vue:11
msgid "Cancel"
msgstr "取消"
@ -145,7 +144,7 @@ msgstr "此证书已过期"
msgid "Certificate is valid"
msgstr "此证书有效"
#: src/views/cert/Cert.vue:12 src/views/domain/cert/Cert.vue:31
#: src/views/cert/Cert.vue:12 src/views/domain/cert/Cert.vue:35
msgid "Certificate Status"
msgstr "证书状态"
@ -153,6 +152,12 @@ msgstr "证书状态"
msgid "Certification"
msgstr "证书"
#: src/views/domain/cert/ChangeCert.vue:2
#: src/views/domain/cert/ChangeCert.vue:3
#: src/views/domain/cert/ChangeCert.vue:5
msgid "Change Certificate"
msgstr "更改证书"
#: src/views/domain/ngx_conf/directive/DirectiveEditorItem.vue:34
#: src/views/domain/ngx_conf/LocationEditor.vue:31
#: src/views/domain/ngx_conf/LocationEditor.vue:47
@ -264,7 +269,7 @@ msgstr "指令"
msgid "Directives"
msgstr "指令"
#: src/views/domain/cert/IssueCert.vue:74
#: src/views/domain/cert/IssueCert.vue:73
msgid "Disable auto-renewal failed for %{name}"
msgstr "关闭 %{name} 自动续签失败"
@ -307,7 +312,7 @@ msgstr "编辑站点"
msgid "Email (*)"
msgstr "邮箱 (*)"
#: src/views/domain/cert/IssueCert.vue:68
#: src/views/domain/cert/IssueCert.vue:67
msgid "Enable auto-renewal failed for %{name}"
msgstr "启用 %{name} 自动续签失败"
@ -392,7 +397,6 @@ msgid "Format successfully"
msgstr "保存成功"
#: src/components/StdDataEntry/components/StdPassword.vue:42
#: src/components/StdDataEntry/compontents/StdPassword.vue:42
msgid "Generate"
msgstr "生成"
@ -400,7 +404,7 @@ msgstr "生成"
msgid "Generating private key for registering account"
msgstr "正在生成私钥用于注册账户"
#: src/views/domain/cert/IssueCert.vue:97
#: src/views/domain/cert/IssueCert.vue:96
msgid "Getting the certificate, please wait..."
msgstr "正在获取证书,请稍等..."
@ -471,7 +475,7 @@ msgstr "登录成功"
msgid "Logout successful"
msgstr "登出成功"
#: src/views/domain/cert/IssueCert.vue:210
#: src/views/domain/cert/IssueCert.vue:211
msgid ""
"Make sure you have configured a reverse proxy for .well-known directory to "
"HTTPChallengePort (default: 9180) before getting the certificate."
@ -569,11 +573,9 @@ msgstr "找不到页面"
msgid "Not Valid Before: %{date}"
msgstr "此前无效: %{date}"
#: src/views/domain/cert/IssueCert.vue:202
msgid ""
"Note: The server_name in the current configuration must be the domain name "
"you need to get the certificate."
msgstr "注意:当前配置中的 server_name 必须为需要申请证书的域名。"
#: src/views/domain/cert/IssueCert.vue:38
msgid "Note"
msgstr "注意"
#: src/language/constants.ts:16 src/views/domain/cert/IssueCert.vue:3
msgid "Obtaining certificate"
@ -583,7 +585,6 @@ msgstr "正在获取证书"
#: src/components/StdDataDisplay/StdCurd.vue:28
#: src/components/StdDataDisplay/StdTable.vue:53
#: src/components/StdDataEntry/components/StdSelector.vue:12
#: src/components/StdDataEntry/compontents/StdSelector.vue:12
#: src/views/domain/DomainList.vue:25
msgid "OK"
msgstr "确定"
@ -704,7 +705,6 @@ msgid "Saved successfully"
msgstr "保存成功"
#: src/components/StdDataEntry/components/StdSelector.vue:13
#: src/components/StdDataEntry/compontents/StdSelector.vue:13
msgid "Selector"
msgstr "选择器"
@ -727,11 +727,11 @@ msgstr "服务器错误"
msgid "Server Info"
msgstr "服务器信息"
#: src/views/domain/cert/IssueCert.vue:29
#: src/views/domain/cert/IssueCert.vue:30
msgid "server_name not found in directives"
msgstr "未在指令集合中找到 server_name"
#: src/views/domain/cert/IssueCert.vue:196 src/views/domain/DomainAdd.vue:111
#: src/views/domain/cert/IssueCert.vue:195 src/views/domain/DomainAdd.vue:111
msgid "server_name parameter is required"
msgstr "必须为 server_name 指令指明参数"
@ -792,7 +792,7 @@ msgstr "终端"
msgid "Terminal Start Command"
msgstr "终端启动命令"
#: src/views/domain/cert/IssueCert.vue:206
#: src/views/domain/cert/IssueCert.vue:207
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."
@ -803,6 +803,12 @@ msgstr ""
msgid "The filename cannot contain the following characters: %{c}"
msgstr "文件名不能包含以下字符: %{c}"
#: src/views/domain/cert/IssueCert.vue:203
msgid ""
"The server_name in the current configuration must be the domain name you "
"need to get the certificate."
msgstr "当前配置中的 server_name 必须为需要申请证书的域名。"
#: src/language/constants.ts:6
msgid "The username or password is incorrect"
msgstr "用户名或密码错误"

View file

@ -94,11 +94,11 @@ msgstr ""
msgid "Auto Refresh"
msgstr "自動刷新"
#: src/views/domain/cert/IssueCert.vue:72
#: src/views/domain/cert/IssueCert.vue:71
msgid "Auto-renewal disabled for %{name}"
msgstr "已關閉 %{name} 自動續簽"
#: src/views/domain/cert/IssueCert.vue:66
#: src/views/domain/cert/IssueCert.vue:65
msgid "Auto-renewal enabled for %{name}"
msgstr "已啟用 %{name} 自動續簽"
@ -135,7 +135,6 @@ msgstr "構建基於"
#: src/components/StdDataDisplay/StdBatchEdit.vue:7
#: src/components/StdDataDisplay/StdCurd.vue:27
#: src/components/StdDataEntry/components/StdSelector.vue:11
#: src/components/StdDataEntry/compontents/StdSelector.vue:11
msgid "Cancel"
msgstr "取消"
@ -147,7 +146,7 @@ msgstr "此憑證已過期"
msgid "Certificate is valid"
msgstr "此憑證有效"
#: src/views/cert/Cert.vue:12 src/views/domain/cert/Cert.vue:31
#: src/views/cert/Cert.vue:12 src/views/domain/cert/Cert.vue:35
msgid "Certificate Status"
msgstr "憑證狀態"
@ -156,6 +155,13 @@ msgstr "憑證狀態"
msgid "Certification"
msgstr "此憑證有效"
#: src/views/domain/cert/ChangeCert.vue:2
#: src/views/domain/cert/ChangeCert.vue:3
#: src/views/domain/cert/ChangeCert.vue:5
#, fuzzy
msgid "Change Certificate"
msgstr "正在獲取證書,請稍等..."
#: src/views/domain/ngx_conf/directive/DirectiveEditorItem.vue:34
#: src/views/domain/ngx_conf/LocationEditor.vue:31
#: src/views/domain/ngx_conf/LocationEditor.vue:47
@ -268,7 +274,7 @@ msgstr "指令"
msgid "Directives"
msgstr "指令"
#: src/views/domain/cert/IssueCert.vue:74
#: src/views/domain/cert/IssueCert.vue:73
msgid "Disable auto-renewal failed for %{name}"
msgstr "關閉 %{name} 自動續簽失敗"
@ -311,7 +317,7 @@ msgstr "編輯站點"
msgid "Email (*)"
msgstr "郵箱 (*)"
#: src/views/domain/cert/IssueCert.vue:68
#: src/views/domain/cert/IssueCert.vue:67
msgid "Enable auto-renewal failed for %{name}"
msgstr "啟用 %{name} 自動續簽失敗"
@ -398,7 +404,6 @@ msgid "Format successfully"
msgstr "保存成功"
#: src/components/StdDataEntry/components/StdPassword.vue:42
#: src/components/StdDataEntry/compontents/StdPassword.vue:42
msgid "Generate"
msgstr "生成"
@ -406,7 +411,7 @@ msgstr "生成"
msgid "Generating private key for registering account"
msgstr "生成註冊賬號私鑰"
#: src/views/domain/cert/IssueCert.vue:97
#: src/views/domain/cert/IssueCert.vue:96
msgid "Getting the certificate, please wait..."
msgstr "正在獲取憑證,請稍等..."
@ -479,7 +484,7 @@ msgstr "登入成功"
msgid "Logout successful"
msgstr "登出成功"
#: src/views/domain/cert/IssueCert.vue:210
#: src/views/domain/cert/IssueCert.vue:211
msgid ""
"Make sure you have configured a reverse proxy for .well-known directory to "
"HTTPChallengePort (default: 9180) before getting the certificate."
@ -580,11 +585,9 @@ msgstr "找不到頁面"
msgid "Not Valid Before: %{date}"
msgstr "此前無效: %{date}"
#: src/views/domain/cert/IssueCert.vue:202
msgid ""
"Note: The server_name in the current configuration must be the domain name "
"you need to get the certificate."
msgstr "注意:當前配置中的 server_name 必須為需要申請證書的域名。"
#: src/views/domain/cert/IssueCert.vue:38
msgid "Note"
msgstr ""
#: src/language/constants.ts:16 src/views/domain/cert/IssueCert.vue:3
msgid "Obtaining certificate"
@ -594,7 +597,6 @@ msgstr "正在獲取證書,請稍等..."
#: src/components/StdDataDisplay/StdCurd.vue:28
#: src/components/StdDataDisplay/StdTable.vue:53
#: src/components/StdDataEntry/components/StdSelector.vue:12
#: src/components/StdDataEntry/compontents/StdSelector.vue:12
#: src/views/domain/DomainList.vue:25
msgid "OK"
msgstr "確定"
@ -716,7 +718,6 @@ msgid "Saved successfully"
msgstr "儲存成功"
#: src/components/StdDataEntry/components/StdSelector.vue:13
#: src/components/StdDataEntry/compontents/StdSelector.vue:13
msgid "Selector"
msgstr "選擇器"
@ -739,11 +740,11 @@ msgstr "伺服器錯誤"
msgid "Server Info"
msgstr "伺服器資訊"
#: src/views/domain/cert/IssueCert.vue:29
#: src/views/domain/cert/IssueCert.vue:30
msgid "server_name not found in directives"
msgstr "未在指令集合中找到 server_name"
#: src/views/domain/cert/IssueCert.vue:196 src/views/domain/DomainAdd.vue:111
#: src/views/domain/cert/IssueCert.vue:195 src/views/domain/DomainAdd.vue:111
msgid "server_name parameter is required"
msgstr "必須為 server_name 指令指明參數"
@ -808,7 +809,7 @@ msgstr "終端"
msgid "Terminal Start Command"
msgstr ""
#: src/views/domain/cert/IssueCert.vue:206
#: src/views/domain/cert/IssueCert.vue:207
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."
@ -820,6 +821,13 @@ msgstr ""
msgid "The filename cannot contain the following characters: %{c}"
msgstr "檔名不能包含以下字元: %{c}"
#: src/views/domain/cert/IssueCert.vue:203
#, fuzzy
msgid ""
"The server_name in the current configuration must be the domain name you "
"need to get the certificate."
msgstr "注意:當前配置中的 server_name 必須為需要申請證書的域名。"
#: src/language/constants.ts:6
msgid "The username or password is incorrect"
msgstr "用戶名或密碼不正確"

View file

@ -2,6 +2,10 @@
import CertInfo from '@/views/domain/cert/CertInfo.vue'
import IssueCert from '@/views/domain/cert/IssueCert.vue'
import {computed, ref} from 'vue'
import {useGettext} from 'vue3-gettext'
import ChangeCert from '@/views/domain/cert/ChangeCert.vue'
const {$gettext} = useGettext()
const props = defineProps(['directivesMap', 'current_server_directives', 'enabled', 'cert_info'])
@ -31,6 +35,8 @@ const enabled = computed({
<h2 v-translate>Certificate Status</h2>
<cert-info ref="info" :cert="props.cert_info"/>
<change-cert :directives-map="props.directivesMap"/>
<issue-cert
:current_server_directives="props.current_server_directives"
:directives-map="props.directivesMap"

View file

@ -0,0 +1,31 @@
<script setup lang="ts">
import {useGettext} from 'vue3-gettext'
import {ref} from 'vue'
const {$gettext} = useGettext()
const props = defineProps(['directivesMap'])
const visible = ref(false)
function open() {
visible.value = true
}
</script>
<template>
<div>
<a-button @click="open">{{ $gettext('Change Certificate') }}</a-button>
<a-modal
:title="$gettext('Change Certificate')"
v-model:visible="visible"
:mask="false"
>
</a-modal>
</div>
</template>
<style lang="less" scoped>
</style>

View file

@ -4,6 +4,7 @@ import {computed, h, nextTick, onMounted, ref, VNode, watch} from 'vue'
import {message} from 'ant-design-vue'
import domain from '@/api/domain'
import websocket from '@/lib/websocket'
import Template from '@/views/template/Template.vue'
const {$gettext, interpolate} = useGettext()
@ -56,8 +57,6 @@ function job() {
function callback(ssl_certificate: string, ssl_certificate_key: string) {
props.directivesMap['ssl_certificate'][0]['params'] = ssl_certificate
props.directivesMap['ssl_certificate_key'][0]['params'] = ssl_certificate_key
emit('callback')
}
function change_auto_cert(r: boolean) {
@ -178,7 +177,7 @@ const modalClosable = ref(false)
</div>
</a-modal>
<div>
<div class="issue-cert">
<a-form-item :label="$gettext('Encrypt website with Let\'s Encrypt')">
<a-switch
:loading="issuing_cert"
@ -199,18 +198,22 @@ const modalClosable = ref(false)
</template>
</a-alert>
</a-form-item>
<p v-translate>
Note: The server_name in the current configuration must be the domain name
you need to get the certificate.
</p>
<p v-translate>
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.
</p>
<p v-translate>
Make sure you have configured a reverse proxy for .well-known
directory to HTTPChallengePort (default: 9180) before getting the certificate.
</p>
<a-alert type="info" closable :message="$gettext('Note')">
<template #description>
<p v-translate>
The server_name in the current configuration must be the domain name
you need to get the certificate.
</p>
<p v-translate>
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.
</p>
<p v-translate>
Make sure you have configured a reverse proxy for .well-known
directory to HTTPChallengePort (default: 9180) before getting the certificate.
</p>
</template>
</a-alert>
</div>
</template>
@ -231,6 +234,10 @@ const modalClosable = ref(false)
</style>
<style lang="less" scoped>
.issue-cert {
margin: 15px 0;
}
.switch-wrapper {
position: relative;

View file

@ -118,11 +118,15 @@ func ParseTemplate(path, name string) (c ConfigDetail, err error) {
for _, d := range config.GetDirectives() {
switch d.GetName() {
case nginx.Location:
l := &nginx.NgxLocation{}
l := &nginx.NgxLocation{
Path: strings.Join(d.GetParameters(), " "),
}
l.ParseLocation(d, 0)
c.NgxServer.Locations = append(c.NgxServer.Locations, l)
default:
dir := &nginx.NgxDirective{}
dir := &nginx.NgxDirective{
Directive: d.GetName(),
}
dir.ParseDirective(d, 0)
c.NgxServer.Directives = append(c.NgxServer.Directives, dir)
}

View file

@ -4,23 +4,14 @@
# Description[zh_CN]: Nginx UI 配置模板
# Author: @0xJacky
# Nginx UI Template End
# Nginx UI Custom Start
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name ;
rewrite ^(.*)$ https://$host$1 permanent;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ;
ssl_certificate ;
ssl_certificate_key ;
location / {
# Nginx UI Custom End
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -29,5 +20,4 @@ server {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://127.0.0.1:9000/;
}
}

View file

@ -0,0 +1,12 @@
# Nginx UI Template Start
# Name: WordPress
# Description[en]: WordPress Config Template
# Description[zh_CN]: WordPress 配置模板
# Author: @0xJacky
# Nginx UI Template End
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

View file

@ -1,45 +0,0 @@
# Nginx UI Template Start
# Name: WordPress-PHP8.1
# Description[en]: WordPress PHP 8.1 Config Template
# Description[zh_CN]: WordPress PHP 8.1 配置模板
# Author: @0xJacky
# Nginx UI Template End
server {
listen 80;
listen [::]:80;
server_name ;
rewrite ^(.*)$ https://$host$1 permanent;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ;
ssl_certificate ;
ssl_certificate_key ;
root ;
index index.php;
location ~ [^/]\.php(/|$) {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location /.well-known {
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_pass http://127.0.0.1:{{ HTTP01PORT }};
}
}