Add prism!

pull/111/head
MattIPv4 2020-05-07 20:46:52 +01:00
parent 8ee4a8eb88
commit 8d9ffc6e39
7 changed files with 120 additions and 20 deletions

51
package-lock.json generated
View File

@ -1859,6 +1859,17 @@
"integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
"dev": true "dev": true
}, },
"clipboard": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz",
"integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==",
"optional": true,
"requires": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"cliui": { "cliui": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
@ -2608,6 +2619,12 @@
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
}, },
"delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
"optional": true
},
"depd": { "depd": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
@ -4165,6 +4182,15 @@
} }
} }
}, },
"good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
"optional": true,
"requires": {
"delegate": "^3.1.2"
}
},
"graceful-fs": { "graceful-fs": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
@ -6407,6 +6433,14 @@
"pretty-checkbox": "^3.0.3" "pretty-checkbox": "^3.0.3"
} }
}, },
"prismjs": {
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.20.0.tgz",
"integrity": "sha512-AEDjSrVNkynnw6A+B1DsFkd6AVdTnp+/WoUixFRULlCLZVRZlVQMVWio/16jv7G1FscUxQxOQhWwApgbnxr6kQ==",
"requires": {
"clipboard": "^2.0.0"
}
},
"private": { "private": {
"version": "0.1.8", "version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
@ -7427,6 +7461,12 @@
"xmlchars": "^2.1.1" "xmlchars": "^2.1.1"
} }
}, },
"select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=",
"optional": true
},
"semver": { "semver": {
"version": "5.7.1", "version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
@ -8071,6 +8111,12 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
}, },
"tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
"optional": true
},
"tiny-inflate": { "tiny-inflate": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz", "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
@ -8564,6 +8610,11 @@
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz",
"integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==" "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog=="
}, },
"vue-prism-component": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/vue-prism-component/-/vue-prism-component-1.2.0.tgz",
"integrity": "sha512-0N9CNuQu+36CJpdsZHrhdq7d18oBvjVMjawyKdIr8xuzFWLfdxECZQYbFaYoopPBg3SvkEEMtkhYqdgTQl5Y+A=="
},
"vue-select": { "vue-select": {
"version": "3.10.3", "version": "3.10.3",
"resolved": "https://registry.npmjs.org/vue-select/-/vue-select-3.10.3.tgz", "resolved": "https://registry.npmjs.org/vue-select/-/vue-select-3.10.3.tgz",

View File

@ -40,9 +40,11 @@
"do-vue": "git+https://github.com/do-community/do-vue.git", "do-vue": "git+https://github.com/do-community/do-vue.git",
"parcel-bundler": "^1.12.4", "parcel-bundler": "^1.12.4",
"pretty-checkbox-vue": "^1.1.9", "pretty-checkbox-vue": "^1.1.9",
"prismjs": "^1.20.0",
"qs": "^6.9.4", "qs": "^6.9.4",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-hot-reload-api": "^2.3.3", "vue-hot-reload-api": "^2.3.3",
"vue-prism-component": "^1.2.0",
"vue-select": "^3.10.3", "vue-select": "^3.10.3",
"vuex": "^3.3.0" "vuex": "^3.3.0"
}, },

View File

@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
@import url("https://assets.digitalocean.com/prism/prism.css");
$header: #0071fe; $header: #0071fe;
$highlight: #f2c94c; $highlight: #f2c94c;
@import "~do-bulma/src/style"; @import "~do-bulma/src/style";
@ -379,4 +381,32 @@ $highlight: #f2c94c;
margin: 1rem 0; margin: 1rem 0;
} }
} }
pre {
&[class*="language-"] {
padding: .5rem 1rem;
code {
&[class*="language-"] {
.token {
font-weight: normal;
// Fix Bulma interfering with Prism
&.number,
&.tag {
background: transparent;
border-radius: initial;
color: inherit;
display: initial;
font-size: inherit;
margin: initial;
padding: initial;
text-align: initial;
vertical-align: initial;
}
}
}
}
}
}
} }

View File

@ -5,8 +5,7 @@
<p> <p>
Comment out SSL related directives in the configuration: Comment out SSL related directives in the configuration:
<br /> <br />
<code class="slim">sed -i -r 's/(listen .*443)/\1;#/g; <Prism language="bash" :code="`sed -i -r 's/(listen .*443)/\\1;#/g; s/(ssl_(certificate|certificate_key|trusted_certificate) )/#;#\\1/g' ${sitesAvailable}`"></Prism>
s/(ssl_(certificate|certificate_key|trusted_certificate) )/#;#\1/g' {{ sitesAvailable }}</code>
</p> </p>
</li> </li>
@ -14,17 +13,15 @@
<p> <p>
Reload your NGINX server: Reload your NGINX server:
<br /> <br />
<code class="slim">sudo nginx -t && sudo systemctl reload nginx</code> <Prism language="bash" code="sudo nginx -t && sudo systemctl reload nginx"></Prism>
</p> </p>
</li> </li>
<li> <li>
<p> <p>
Obtain SSL certificates from Let's Encrypt using Certbot: Obtain SSL certificates from Let's Encrypt using Certbot:
<template v-for="cmd in certbotCmds">
<br /> <br />
<code class="slim">{{ cmd }}</code> <Prism language="bash" :code="certbotCmds"></Prism>
</template>
</p> </p>
</li> </li>
@ -32,7 +29,7 @@
<p> <p>
Uncomment SSL related directives in the configuration: Uncomment SSL related directives in the configuration:
<br /> <br />
<code class="slim">sed -i -r 's/#?;#//g' {{ sitesAvailable }}</code> <Prism language="bash" :code="`sed -i -r 's/#?;#//g' ${sitesAvailable}`"></Prism>
</p> </p>
</li> </li>
@ -40,7 +37,7 @@
<p> <p>
Reload your NGINX server: Reload your NGINX server:
<br /> <br />
<code class="slim">sudo nginx -t && sudo systemctl reload nginx</code> <Prism language="bash" code="sudo nginx -t && sudo systemctl reload nginx"></Prism>
</p> </p>
</li> </li>
@ -48,9 +45,9 @@
<p> <p>
Configure Certbot to reload NGINX when it successfully renews certificates: Configure Certbot to reload NGINX when it successfully renews certificates:
<br /> <br />
<code class="slim">echo -e '#!/bin/bash\nnginx -t && systemctl reload nginx' | sudo tee /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh</code> <Prism language="bash" code="echo -e '#!/bin/bash\nnginx -t && systemctl reload nginx' | sudo tee /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh"></Prism>
<br /> <br />
<code class="slim">sudo chmod a+x /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh</code> <Prism language="bash" code="sudo chmod a+x /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh"></Prism>
</p> </p>
</li> </li>
</ol> </ol>
@ -70,12 +67,17 @@
</template> </template>
<script> <script>
import Prism from 'vue-prism-component';
import 'prismjs/components/prism-bash';
import i18n from '../../i18n'; import i18n from '../../i18n';
export default { export default {
name: 'SetupCertbot', name: 'SetupCertbot',
display: 'Certbot', display: 'Certbot',
key: 'certbot', key: 'certbot',
components: {
Prism,
},
props: { props: {
data: Object, data: Object,
}, },
@ -121,7 +123,7 @@
`-w ${this.letsEncryptDir}`, `-w ${this.letsEncryptDir}`,
'-n --agree-tos --force-renewal', '-n --agree-tos --force-renewal',
].filter(x => x !== null).join(' ') ].filter(x => x !== null).join(' ')
)); )).join('\n');
}, },
}, },
}; };

View File

@ -17,7 +17,7 @@
<p> <p>
Check that you have <b>unzip</b> installed, or install it, on your server by running this command: Check that you have <b>unzip</b> installed, or install it, on your server by running this command:
<br /> <br />
<code class="slim">(unzip -v >/dev/null 2>&1 && echo 'unzip already installed') || sudo apt-get install unzip</code> <Prism language="bash" code="(unzip -v >/dev/null 2>&1 && echo 'unzip already installed') || sudo apt-get install unzip"></Prism>
</p> </p>
</li> </li>
@ -25,7 +25,7 @@
<p> <p>
Navigate to your NGINX <b>configuration directory</b> on your server: Navigate to your NGINX <b>configuration directory</b> on your server:
<br /> <br />
<code class="slim">cd {{ $parent.nginxDir }}</code> <Prism language="bash" :code="`cd ${$parent.nginxDir}`"></Prism>
</p> </p>
</li> </li>
@ -33,7 +33,7 @@
<p> <p>
Create a <b>backup</b> of your current NGINX configuration: Create a <b>backup</b> of your current NGINX configuration:
<br /> <br />
<code class="slim">tar -czvf nginx_$(date +'%F_%H-%M-%S').tar.gz nginx.conf sites-available/ sites-enabled/ nginxconfig.io/</code> <Prism language="bash" code="tar -czvf nginx_$(date +'%F_%H-%M-%S').tar.gz nginx.conf sites-available/ sites-enabled/ nginxconfig.io/"></Prism>
</p> </p>
</li> </li>
@ -41,7 +41,7 @@
<p> <p>
<b>Unzip</b> the new compressed configuration archive: <b>Unzip</b> the new compressed configuration archive:
<br /> <br />
<code class="slim">unzip -o {{ $parent.zipName }}</code> <Prism language="bash" :code="`unzip -o ${$parent.nginxDir}`"></Prism>
</p> </p>
</li> </li>
</ol> </ol>
@ -49,12 +49,17 @@
</template> </template>
<script> <script>
import Prism from 'vue-prism-component';
import 'prismjs/components/prism-bash';
import i18n from '../../i18n'; import i18n from '../../i18n';
export default { export default {
name: 'SetupDownload', name: 'SetupDownload',
display: 'Download', display: 'Download',
key: 'download', key: 'download',
components: {
Prism,
},
props: { props: {
data: Object, data: Object,
}, },

View File

@ -6,18 +6,23 @@
<p> <p>
Reload NGINX to load in your new configuration: Reload NGINX to load in your new configuration:
<br /> <br />
<code class="slim">sudo nginx -t && sudo systemctl reload nginx</code> <Prism language="bash" code="sudo nginx -t && sudo systemctl reload nginx"></Prism>
</p> </p>
</div> </div>
</template> </template>
<script> <script>
import Prism from 'vue-prism-component';
import 'prismjs/components/prism-bash';
import i18n from '../../i18n'; import i18n from '../../i18n';
export default { export default {
name: 'SetupGoLive', name: 'SetupGoLive',
display: 'Go live!', display: 'Go live!',
key: 'goLive', key: 'goLive',
components: {
Prism,
},
props: { props: {
data: Object, data: Object,
}, },

View File

@ -5,7 +5,7 @@
<p> <p>
Generate <b>Diffie-Hellman keys</b> by running this command on your server: Generate <b>Diffie-Hellman keys</b> by running this command on your server:
<br /> <br />
<code class="slim">openssl dhparam -out {{ nginxDir }}/dhparam.pem {{ diffieHellmanValue }}</code> <Prism language="bash" :code="`openssl dhparam -out ${nginxDir}/dhparam.pem ${diffieHellmanValue}`"></Prism>
</p> </p>
</li> </li>
@ -13,9 +13,9 @@
<p> <p>
Create a common <b>ACME-challenge</b> directory (for <b>Let's Encrypt</b>): Create a common <b>ACME-challenge</b> directory (for <b>Let's Encrypt</b>):
<br /> <br />
<code class="slim">mkdir -p {{ letsEncryptDir }}</code> <Prism language="bash" :code="`mkdir -p ${letsEncryptDir}`"></Prism>
<br /> <br />
<code class="slim">chown {{ nginxUser }} {{ letsEncryptDir }}</code> <Prism language="bash" :code="`chown ${nginxUser} ${letsEncryptDir}`"></Prism>
</p> </p>
</li> </li>
</ol> </ol>
@ -35,12 +35,17 @@
</template> </template>
<script> <script>
import Prism from 'vue-prism-component';
import 'prismjs/components/prism-bash';
import i18n from '../../i18n'; import i18n from '../../i18n';
export default { export default {
name: 'SetupSSL', name: 'SetupSSL',
display: 'SSL init', display: 'SSL init',
key: 'ssl', key: 'ssl',
components: {
Prism,
},
props: { props: {
data: Object, data: Object,
}, },