Skip to content

Commit 6b64038

Browse files
committed
fix: site add issues
1 parent f676861 commit 6b64038

File tree

12 files changed

+153
-22
lines changed

12 files changed

+153
-22
lines changed

frontend/docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default defineConfig({
2929
nav: [
3030
{text: 'Home', link: '/'},
3131
{text: 'Guide', link: '/guide/about'},
32-
{text: 'Demo', link: 'https://nginxui.jackyu.cn'}
32+
{text: 'Demo', link: 'https://demo.nginxui.com'}
3333
],
3434

3535
sidebar: sidebar(),

frontend/docs/guide/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ managing your Nginx server.
3838

3939
## Demo
4040

41-
URL:[https://nginxui.jackyu.cn](https://nginxui.jackyu.cn)
41+
URL:[https://demo.nginxui.com](https://demo.nginxui.com)
4242

4343
- Username:admin
4444
- Password:admin

frontend/docs/zh_CN/guide/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Nginx UI 是一个全新的 Nginx 网络管理界面,旨在简化 Nginx 服务
3636

3737
## 在线预览
3838

39-
网址:[https://nginxui.jackyu.cn](https://nginxui.jackyu.cn)
39+
网址:[https://demo.nginxui.com](https://demo.nginxui.com)
4040

4141
- 用户名:admin
4242
- 密码:admin

frontend/src/views/domain/DomainAdd.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import NgxConfigEditor from '@/views/domain/ngx_conf/NgxConfigEditor.vue'
55
import {useGettext} from 'vue3-gettext'
66
import domain from '@/api/domain'
77
import ngx from '@/api/ngx'
8-
import {computed, reactive, ref} from 'vue'
8+
import {computed, provide, reactive, ref} from 'vue'
99
import {message} from 'ant-design-vue'
1010
import {useRouter} from 'vue-router'
1111
@@ -38,13 +38,12 @@ function init() {
3838
}
3939
4040
function save() {
41-
ngx.build_config(ngx_config).then(r => {
41+
return ngx.build_config(ngx_config).then(r => {
4242
domain.save(ngx_config.name, {name: ngx_config.name, content: r.content, overwrite: true}).then(() => {
4343
message.success($gettext('Saved successfully'))
4444
4545
domain.enable(ngx_config.name).then(() => {
4646
message.success($gettext('Enabled successfully'))
47-
current_step.value++
4847
window.scroll({top: 0, left: 0, behavior: 'smooth'})
4948
}).catch(r => {
5049
message.error(r.message ?? $gettext('Enable failed'), 5)
@@ -79,6 +78,13 @@ const has_server_name = computed(() => {
7978
8079
return false
8180
})
81+
82+
provide('save_site_config', save)
83+
84+
async function next() {
85+
await save()
86+
current_step.value++
87+
}
8288
</script>
8389

8490
<template>
@@ -129,7 +135,7 @@ const has_server_name = computed(() => {
129135
<a-space v-if="current_step<2">
130136
<a-button
131137
type="primary"
132-
@click="save"
138+
@click="next"
133139
:disabled="!ngx_config.name||!has_server_name"
134140
>
135141
<translate>Next</translate>

frontend/src/views/domain/cert/IssueCert.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async function onchange() {
4848
</script>
4949

5050
<template>
51-
<obtain-cert ref="obtain_cert" :key="update"/>
51+
<obtain-cert ref="obtain_cert" :key="update" @update:auto_cert="r=>enabled=r"/>
5252
<div class="issue-cert">
5353
<a-form-item :label="$gettext('Encrypt website with Let\'s Encrypt')">
5454
<a-switch

frontend/src/views/domain/cert/components/AutoCertStepOne.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script setup lang="ts">
2-
import {inject, Ref} from 'vue'
2+
import {inject} from 'vue'
33
import {useGettext} from 'vue3-gettext'
44
import DNSChallenge from '@/views/domain/cert/components/DNSChallenge.vue'
55
66
const {$gettext} = useGettext()
7-
const no_server_name: Ref = inject('no_server_name')!
8-
const data: Ref = inject('data')!
7+
const no_server_name = inject('no_server_name')
8+
const data = inject('data')
99
</script>
1010

1111
<template>

frontend/src/views/domain/cert/components/ObtainCert.vue

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import {useGettext} from 'vue3-gettext'
3-
import {computed, inject, nextTick, provide, reactive, Ref, ref} from 'vue'
3+
import {computed, inject, nextTick, provide, reactive, ref} from 'vue'
44
import websocket from '@/lib/websocket'
55
import Modal from 'ant-design-vue/lib/modal'
66
import {message} from 'ant-design-vue'
@@ -10,6 +10,8 @@ import AutoCertStepOne from '@/views/domain/cert/components/AutoCertStepOne.vue'
1010
1111
const {$gettext, interpolate} = useGettext()
1212
13+
const emit = defineEmits(['update:auto_cert'])
14+
1315
const modalVisible = ref(false)
1416
1517
const step = ref(1)
@@ -34,10 +36,10 @@ provide('data', data)
3436
3537
const logContainer = ref(null)
3638
37-
const save_site_config: Function = inject('save_site_config')!
38-
const no_server_name: Ref = inject('no_server_name')!
39+
const save_site_config = inject('save_site_config')!
40+
const no_server_name = inject('no_server_name')!
3941
const props: any = inject('props')!
40-
const issuing_cert: Ref<boolean> = inject('issuing_cert')!
42+
const issuing_cert = inject('issuing_cert')!
4143
4244
async function callback(ssl_certificate: string, ssl_certificate_key: string) {
4345
props.directivesMap['ssl_certificate'][0]['params'] = ssl_certificate
@@ -69,19 +71,22 @@ async function onchange(r: boolean) {
6971
7072
v.locations.push(...r.locations)
7173
})
74+
}).then(async () => {
75+
// if ssl_certificate is empty, do not save, just use the config from last step.
76+
if (props.directivesMap['ssl_certificate']?.[0]) {
77+
await save_site_config()
78+
}
79+
job()
7280
})
73-
// if ssl_certificate is empty, do not save, just use the config from last step.
74-
if (!props.directivesMap['ssl_certificate']?.[0]) {
75-
await save_site_config()
76-
}
77-
job()
7881
} else {
7982
await props.ngx_config.servers.forEach((v: any) => {
8083
v.locations = v.locations.filter((l: any) => l.path !== '/.well-known/acme-challenge')
8184
})
8285
save_site_config()
8386
change_auto_cert(r)
8487
}
88+
89+
emit('update:auto_cert', r)
8590
}
8691
8792
function job() {

frontend/src/views/domain/ngx_conf/NgxConfigEditor.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ function confirm_change_tls(r: boolean) {
3636
okText: $gettext('OK'),
3737
cancelText: $gettext('Cancel'),
3838
async onOk() {
39-
await template.get_block('letsencrypt.conf').then(r => {
39+
await template.get_block('letsencrypt.conf').then(async r => {
4040
const first = props.ngx_config.servers[0]
41-
first.locations = first.locations.filter((l: any) => l.path !== '/.well-known/acme-challenge')
41+
if (!first.locations) {
42+
first.locations = []
43+
} else {
44+
first.locations = first.locations.filter((l: any) => l.path !== '/.well-known/acme-challenge')
45+
}
4246
first.locations.push(...r.locations)
4347
})
4448
await save_site_config()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
server_name test.nginxui.com;
5+
location /.well-known/acme-challenge {
6+
proxy_set_header Host $host;
7+
proxy_set_header X-Real_IP $remote_addr;
8+
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
9+
proxy_pass http://127.0.0.1:5002;
10+
}
11+
}
12+
server {
13+
listen 443 ssl http2;
14+
listen [::]:443 ssl http2;
15+
server_name test.nginxui.com;
16+
ssl_certificate /etc/nginx/ssl/test.nginxui.com/fullchain.cer;
17+
ssl_certificate_key /etc/nginx/ssl/test.nginxui.com/private.key;
18+
location /.well-known/acme-challenge {
19+
proxy_set_header Host $host;
20+
proxy_set_header X-Real_IP $remote_addr;
21+
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
22+
proxy_pass http://127.0.0.1:5002;
23+
}
24+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/nginx/sites-available/test.nginxui.com

0 commit comments

Comments
 (0)