From 8ee4a8eb8899554879532764bb1e0f9c485aee2d Mon Sep 17 00:00:00 2001 From: MattIPv4 Date: Thu, 7 May 2020 17:31:40 +0100 Subject: [PATCH] Add download & copy buttons --- package-lock.json | 277 ++++++++++++++++++ package.json | 5 +- src/nginxconfig/scss/style.scss | 45 +-- .../templates/global_sections/tools.vue | 15 +- src/nginxconfig/templates/setup.vue | 65 ++-- .../templates/setup_sections/certbot.vue | 2 + .../templates/setup_sections/download.vue | 28 +- 7 files changed, 371 insertions(+), 66 deletions(-) diff --git a/package-lock.json b/package-lock.json index bd90ffa..c0035c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -978,12 +978,112 @@ "physical-cpu-count": "^2.0.0" } }, + "@sentry/apm": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/apm/-/apm-5.15.5.tgz", + "integrity": "sha512-2PyifsiQdvFEQhbL7tQnCKGLOO1JtZeqso3bc6ARJBvKxM77mtyMo/D0C2Uzt9sXCYiALhQ1rbB1aY8iYyglpg==", + "dev": true, + "requires": { + "@sentry/browser": "5.15.5", + "@sentry/hub": "5.15.5", + "@sentry/minimal": "5.15.5", + "@sentry/types": "5.15.5", + "@sentry/utils": "5.15.5", + "tslib": "^1.9.3" + } + }, + "@sentry/browser": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-5.15.5.tgz", + "integrity": "sha512-rqDvjk/EvogfdbZ4TiEpxM/lwpPKmq23z9YKEO4q81+1SwJNua53H60dOk9HpRU8nOJ1g84TMKT2Ov8H7sqDWA==", + "dev": true, + "requires": { + "@sentry/core": "5.15.5", + "@sentry/types": "5.15.5", + "@sentry/utils": "5.15.5", + "tslib": "^1.9.3" + } + }, + "@sentry/core": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.15.5.tgz", + "integrity": "sha512-enxBLv5eibBMqcWyr+vApqeix8uqkfn0iGsD3piKvoMXCgKsrfMwlb/qo9Ox0lKr71qIlZVt+9/A2vZohdgnlg==", + "dev": true, + "requires": { + "@sentry/hub": "5.15.5", + "@sentry/minimal": "5.15.5", + "@sentry/types": "5.15.5", + "@sentry/utils": "5.15.5", + "tslib": "^1.9.3" + } + }, + "@sentry/hub": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.15.5.tgz", + "integrity": "sha512-zX9o49PcNIVMA4BZHe//GkbQ4Jx+nVofqU/Il32/IbwKhcpPlhGX3c1sOVQo4uag3cqd/JuQsk+DML9TKkN0Lw==", + "dev": true, + "requires": { + "@sentry/types": "5.15.5", + "@sentry/utils": "5.15.5", + "tslib": "^1.9.3" + } + }, + "@sentry/minimal": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.15.5.tgz", + "integrity": "sha512-zQkkJ1l9AjmU/Us5IrOTzu7bic4sTPKCatptXvLSTfyKW7N6K9MPIIFeSpZf9o1yM2sRYdK7GV08wS2eCT3JYw==", + "dev": true, + "requires": { + "@sentry/hub": "5.15.5", + "@sentry/types": "5.15.5", + "tslib": "^1.9.3" + } + }, + "@sentry/node": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.15.5.tgz", + "integrity": "sha512-BK0iTOiiIM0UnydLeT/uUBY1o1Sp85aqwaQRMfZbjMCsgXERLNGvzzV68FDH1cyC1nR6dREK3Gs8bxS4S54aLQ==", + "dev": true, + "requires": { + "@sentry/apm": "5.15.5", + "@sentry/core": "5.15.5", + "@sentry/hub": "5.15.5", + "@sentry/types": "5.15.5", + "@sentry/utils": "5.15.5", + "cookie": "^0.3.1", + "https-proxy-agent": "^4.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.15.5.tgz", + "integrity": "sha512-F9A5W7ucgQLJUG4LXw1ZIy4iLevrYZzbeZ7GJ09aMlmXH9PqGThm1t5LSZlVpZvUfQ2rYA8NU6BdKJSt7B5LPw==", + "dev": true + }, + "@sentry/utils": { + "version": "5.15.5", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.15.5.tgz", + "integrity": "sha512-Nl9gl/MGnzSkuKeo3QaefoD/OJrFLB8HmwQ7HUbTXb6E7yyEzNKAQMHXGkwNAjbdYyYbd42iABP6Y5F/h39NtA==", + "dev": true, + "requires": { + "@sentry/types": "5.15.5", + "tslib": "^1.9.3" + } + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, "@types/q": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz", @@ -1054,6 +1154,12 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==" }, + "agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true + }, "ajv": { "version": "6.12.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", @@ -1918,6 +2024,12 @@ } } }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "dev": true + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -4304,6 +4416,16 @@ "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" }, + "https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "requires": { + "agent-base": "5", + "debug": "4" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -4945,6 +5067,12 @@ "type-check": "~0.3.2" } }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -5017,6 +5145,12 @@ "yallist": "^2.1.2" } }, + "lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=", + "dev": true + }, "magic-string": { "version": "0.22.5", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.5.tgz", @@ -5722,6 +5856,12 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -7146,6 +7286,134 @@ } } }, + "sass-lint-auto-fix": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/sass-lint-auto-fix/-/sass-lint-auto-fix-0.21.0.tgz", + "integrity": "sha512-AKkNdCeCuDQOom+j74sWKLyjPVEhT1XOYUwH6CWjz03rh7ioWk9Ey/svZT/U8rgHIK7nLO+hBWOmbXPzIec1Ng==", + "dev": true, + "requires": { + "@sentry/node": "^5.7.0", + "chalk": "^3.0.0", + "commander": "^4.0.1", + "cosmiconfig": "^6.0.0", + "glob": "^7.1.4", + "gonzales-pe-sl": "github:srowhani/gonzales-pe#dev", + "sass-lint": "^1.13.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true + }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "gonzales-pe-sl": { + "version": "github:srowhani/gonzales-pe#3b052416074edc280f7d04bbe40b2e410693c4a3", + "from": "github:srowhani/gonzales-pe#dev", + "dev": true, + "requires": { + "minimist": "1.1.x" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "minimist": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.1.3.tgz", + "integrity": "sha1-O+39kaktOQFvz6ocaB6Pqhoe/ag=", + "dev": true + }, + "parse-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", + "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -8464,6 +8732,15 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, + "yaml": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.9.2.tgz", + "integrity": "sha512-HPT7cGGI0DuRcsO51qC1j9O16Dh1mZ2bnXwsi0jrSpsLz0WxOLSLXfkABVl6bZO629py3CU+OMJtpNHDLB97kg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.9.2" + } + }, "yargs": { "version": "14.2.3", "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", diff --git a/package.json b/package.json index f110fd9..ddcb077 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,11 @@ "dev:prep": "npm run build:template && npm run dev:static", "dev:static": "copyfiles --up 2 ./src/static/{*,**/*} dev", "test": "npm run test:eslint && npm run test:scss", + "test:fix": "npm run test:eslint:fix && npm run test:scss:fix", "test:eslint": "eslint 'src/**/*.{js,vue}'", "test:eslint:fix": "npm run test:eslint -- --fix", - "test:scss": "sass-lint 'src/**/*.scss' --verbose --no-exit --config .sasslintrc" + "test:scss": "sass-lint 'src/**/*.scss' --verbose --no-exit --config .sasslintrc", + "test:scss:fix": "sass-lint-auto-fix 'src/**/*.scss'" }, "repository": { "type": "git", @@ -54,6 +56,7 @@ "posthtml-extend": "^0.3.0", "sass": "^1.26.3", "sass-lint": "^1.13.1", + "sass-lint-auto-fix": "^0.21.0", "vue-template-compiler": "^2.6.11" } } diff --git a/src/nginxconfig/scss/style.scss b/src/nginxconfig/scss/style.scss index 3b9e2e3..36957ee 100644 --- a/src/nginxconfig/scss/style.scss +++ b/src/nginxconfig/scss/style.scss @@ -113,25 +113,6 @@ $highlight: #f2c94c; } } - &.setup { - p { - color: $dark-blue; - overflow-wrap: break-word; - - a { - text-decoration: none; - } - } - - ol { - margin: 0 1rem; - - li { - margin: 0 0 1.5rem; - } - } - } - .container { padding: 0 1.5rem; } @@ -372,4 +353,30 @@ $highlight: #f2c94c; text-align: left; } } + + .setup { + .panel { + + p { + color: $dark-blue; + overflow-wrap: break-word; + + a { + text-decoration: none; + } + } + + ol { + margin: 0 1rem; + + li { + margin: 0 0 1.5rem; + } + } + } + + .buttons { + margin: 1rem 0; + } + } } diff --git a/src/nginxconfig/templates/global_sections/tools.vue b/src/nginxconfig/templates/global_sections/tools.vue index 8e31b0a..796f2e7 100644 --- a/src/nginxconfig/templates/global_sections/tools.vue +++ b/src/nginxconfig/templates/global_sections/tools.vue @@ -18,7 +18,7 @@ -
+
@@ -173,6 +173,19 @@ shareQuery(query) { window.history.replaceState({}, '', `?${query}`); }, + // Disable symlink if modularized structure is disabled + '$props.data.modularizedStructure': { + handler(data) { + if (data.computed) { + this.$props.data.symlinkVhost.enabled = true; + this.$props.data.symlinkVhost.computed = this.$props.data.symlinkVhost.value; + } else { + this.$props.data.symlinkVhost.enabled = false; + this.$props.data.symlinkVhost.computed = false; + } + }, + deep: true, + }, }, methods: { confirm(title, body, callback) { diff --git a/src/nginxconfig/templates/setup.vue b/src/nginxconfig/templates/setup.vue index 21ef182..3042a3f 100644 --- a/src/nginxconfig/templates/setup.vue +++ b/src/nginxconfig/templates/setup.vue @@ -15,30 +15,37 @@ limitations under the License. --> @@ -72,6 +79,13 @@ limitations under the License. if (index >= 0) return tabs[index]; return false; }, + nginxDir() { + return this.$props.data.global.nginx.nginxConfigDirectory.computed.replace(/\/+$/, ''); + }, + zipName() { + const domains = this.$props.data.domains.filter(d => d !== null).map(d => d.server.domain.computed); + return `nginxconfig.io-${domains.join(',')}.zip`; + }, }, methods: { tabClass(tab) { @@ -80,6 +94,13 @@ limitations under the License. if (tabs.indexOf(tab) < tabs.indexOf(this.$data.active)) return 'is-before'; return undefined; }, + downloadZip() { + alert('Imagine I\'m a working download'); + }, + copyZip() { + const command = `echo 'BASE64 HERE' | base64 --decode > ${this.nginxDir}/${this.zipName}`; + alert(`Imagine I'm a working copy to clipboard\n\n${command}`); + }, }, }; diff --git a/src/nginxconfig/templates/setup_sections/certbot.vue b/src/nginxconfig/templates/setup_sections/certbot.vue index f9f86fc..7198a56 100644 --- a/src/nginxconfig/templates/setup_sections/certbot.vue +++ b/src/nginxconfig/templates/setup_sections/certbot.vue @@ -100,6 +100,8 @@ return false; }, sitesAvailable() { + if (!this.$props.data.global.tools.modularizedStructure.computed) return `${this.nginxDir}/nginx.conf`; + const enabledAvailable = this.$props.data.global.tools.symlinkVhost.computed ? 'available' : 'enabled'; return this.$props.data.domains .filter(domain => domain.https.certType.computed === 'letsEncrypt') diff --git a/src/nginxconfig/templates/setup_sections/download.vue b/src/nginxconfig/templates/setup_sections/download.vue index e681d49..cfbcd7a 100644 --- a/src/nginxconfig/templates/setup_sections/download.vue +++ b/src/nginxconfig/templates/setup_sections/download.vue @@ -3,12 +3,12 @@
  1. - Download the generated config: {{ zipName }} + Download the generated config: {{ $parent.zipName }}
    - and upload it to your server's {{ nginxDir }} directory. + and upload it to your server's {{ $parent.nginxDir }} directory.

    - or, Copy a base64 string of the compressed config, paste it in + or, Copy a base64 string of the compressed config, paste it in your server's command line and execute it.

  2. @@ -25,7 +25,7 @@

    Navigate to your NGINX configuration directory on your server:
    - cd {{ nginxDir }} + cd {{ $parent.nginxDir }}

    @@ -41,7 +41,7 @@

    Unzip the new compressed configuration archive:
    - unzip -o {{ zipName }} + unzip -o {{ $parent.zipName }}

@@ -63,23 +63,5 @@ i18n, }; }, - computed: { - nginxDir() { - return this.$props.data.global.nginx.nginxConfigDirectory.computed; - }, - zipName() { - const domains = this.$props.data.domains.filter(d => d !== null).map(d => d.server.domain.computed); - return `nginxconfig.io-${domains.join(',')}.zip`; - }, - }, - methods: { - downloadZip() { - alert('Imagine I\'m a working download'); - }, - copyZip() { - const command = `echo 'BASE64 HERE' | base64 --decode > ${this.nginxDir}${this.zipName}`; - alert(`Imagine I'm a working copy to clipboard\n\n${command}`); - }, - }, };