From 7b1fd2aaee291a7b5459241698db917ea5374003 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: Mon, 11 Apr 2022 14:18:28 +0400 Subject: [PATCH] Add screening tag --- .../generators/conf/security.conf.js | 4 ++-- .../templates/domain_sections/server.vue | 20 ----------------- .../templates/global_sections/https.vue | 6 ----- src/nginxconfig/templates/prism/nginx.vue | 22 ++++++++++++++++++- 4 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/nginxconfig/generators/conf/security.conf.js b/src/nginxconfig/generators/conf/security.conf.js index f82d1d8..b65d587 100644 --- a/src/nginxconfig/generators/conf/security.conf.js +++ b/src/nginxconfig/generators/conf/security.conf.js @@ -56,10 +56,10 @@ export default (domains, global) => { config.push(['location /security.txt', { return: '301 /.well-known/security.txt', }]); - + // Custom security.txt path config.push(['location = /.well-known/security.txt', { - alias: `${global.security.securityTxtPath.value}`, + alias: `${global.security.securityTxtPath.computed}`, }]); } diff --git a/src/nginxconfig/templates/domain_sections/server.vue b/src/nginxconfig/templates/domain_sections/server.vue index 563cb75..b9762e2 100644 --- a/src/nginxconfig/templates/domain_sections/server.vue +++ b/src/nginxconfig/templates/domain_sections/server.vue @@ -208,7 +208,6 @@ THE SOFTWARE. watch: { '$props.data.domain': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); // Ignore www. if given, enable WWW subdomain if (data.computed.startsWith('www.')) { data.computed = data.computed.slice(4); @@ -244,31 +243,12 @@ THE SOFTWARE. // Ensure there is a default path '$props.data.path': { handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); if (!data.computed.trim()) { data.computed = `/var/www/${this.$props.data.domain.computed}`; } }, deep: true, }, - '$props.data.documentRoot': { - handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); - }, - deep: true, - }, - '$props.data.listenIpv4': { - handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); - }, - deep: true, - }, - '$props.data.listenIpv6': { - handler(data) { - 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..e66fa58 100644 --- a/src/nginxconfig/templates/global_sections/https.vue +++ b/src/nginxconfig/templates/global_sections/https.vue @@ -372,12 +372,6 @@ THE SOFTWARE. }, deep: true, }, - '$props.data.letsEncryptCertRoot': { - handler(data) { - data.computed = data.computed.replace(/<.+>/, ''); - }, - deep: true, - }, }, }; diff --git a/src/nginxconfig/templates/prism/nginx.vue b/src/nginxconfig/templates/prism/nginx.vue index 590ab89..eb2921e 100644 --- a/src/nginxconfig/templates/prism/nginx.vue +++ b/src/nginxconfig/templates/prism/nginx.vue @@ -27,7 +27,7 @@ THE SOFTWARE. @@ -39,6 +39,26 @@ THE SOFTWARE. conf: String, half: Boolean, }, + data() { + return { + htmlEntityConf: '', + }; + }, + computed: { + showConf() { + return this.htmlEntityConf || this.conf; + }, + }, + watch: { + conf: { + handler( value ) { + if( ( /<|>/gm ).test( value ) ) { + this.htmlEntityConf = value.replaceAll(//g, '>'); + } + }, + immediate: true, + }, + }, mounted() { console.info(`Highlighting ${this.$props.name}...`); window.Prism.highlightAllUnder(this.$el);