From c9ee8455e01f7a8446b277e3e918ef73e5fd5815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A4=D0=B8=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Thu, 7 Apr 2022 18:33:09 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A-122672:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D0=B8=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D0=B3=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B2=20onion,=20server=20=D0=B8=20https=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/domain_sections/onion.vue | 2 ++ .../templates/domain_sections/server.vue | 17 ++++++++++++----- .../templates/global_sections/https.vue | 3 ++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/nginxconfig/templates/domain_sections/onion.vue b/src/nginxconfig/templates/domain_sections/onion.vue index 1058c9d..050c974 100644 --- a/src/nginxconfig/templates/domain_sections/onion.vue +++ b/src/nginxconfig/templates/domain_sections/onion.vue @@ -102,6 +102,8 @@ THE SOFTWARE. watch: { '$props.data.onionLocation': { handler(data) { + data.computed = data.computed.replace(//, '>'); // Drop http(s):// data.computed = data.computed.replace(/^https?:\/\//, ''); }, diff --git a/src/nginxconfig/templates/domain_sections/server.vue b/src/nginxconfig/templates/domain_sections/server.vue index 563cb75..289c149 100644 --- a/src/nginxconfig/templates/domain_sections/server.vue +++ b/src/nginxconfig/templates/domain_sections/server.vue @@ -208,7 +208,9 @@ THE SOFTWARE. watch: { '$props.data.domain': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); + data.computed = data.computed.replace(//, '>'); + // Ignore www. if given, enable WWW subdomain if (data.computed.startsWith('www.')) { data.computed = data.computed.slice(4); @@ -244,7 +246,9 @@ THE SOFTWARE. // Ensure there is a default path '$props.data.path': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); + data.computed = data.computed.replace(//, '>'); + if (!data.computed.trim()) { data.computed = `/var/www/${this.$props.data.domain.computed}`; } @@ -253,19 +257,22 @@ THE SOFTWARE. }, '$props.data.documentRoot': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); + data.computed = data.computed.replace(//, '>'); }, deep: true, }, '$props.data.listenIpv4': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); + data.computed = data.computed.replace(//, '>'); }, deep: true, }, '$props.data.listenIpv6': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); + data.computed = data.computed.replace(//, '>'); }, deep: true, }, diff --git a/src/nginxconfig/templates/global_sections/https.vue b/src/nginxconfig/templates/global_sections/https.vue index 74cc4af..a1b92e2 100644 --- a/src/nginxconfig/templates/global_sections/https.vue +++ b/src/nginxconfig/templates/global_sections/https.vue @@ -374,7 +374,8 @@ THE SOFTWARE. }, '$props.data.letsEncryptCertRoot': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); + data.computed = data.computed.replace(//, '>'); }, deep: true, },