diff --git a/.editorconfig b/.editorconfig index f34e042..36d69a4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,5 +9,3 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true -[*.conf.html] -insert_final_newline = false diff --git a/public/assets/css/app.css b/public/assets/css/app.css index 6b462e2..f0b57d9 100644 --- a/public/assets/css/app.css +++ b/public/assets/css/app.css @@ -102,6 +102,14 @@ main .file .code pre code { overflow-x: visible; } +main .file .code pre code span.include { + white-space: pre-line; +} + +main .file .code pre code span.include ng-include { + white-space: pre; +} + main .file .code pre code ng-include { display: inline-block; } diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 85acc1f..0f33f49 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -127,6 +127,19 @@ // INIT // ////////// $scope.setDataFromHash(); + }) + .directive('ngIncludeTabs', function () { + return { + require: 'ngInclude', + restrict: 'A', + link: { + pre: function preLink(scope, iElement, iAttrs, controller) { + var tabs = parseInt(iAttrs.ngIncludeTabs || 0); + controller.template = controller.template.replace(/^(.*)$/mg, '\t'.repeat(tabs) + '$1').replace(/\s*$/, ''); + console.log(controller); + }, + }, + }; }); })(); diff --git a/public/templates/_general.conf.html b/public/templates/_general.conf.html index 89ba3ae..5fac064 100644 --- a/public/templates/_general.conf.html +++ b/public/templates/_general.conf.html @@ -41,4 +41,4 @@ gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; -gzip_types {{ gzipTypes }};</span> \ No newline at end of file +gzip_types {{ gzipTypes }};</span> diff --git a/public/templates/_letsencrypt.conf.html b/public/templates/_letsencrypt.conf.html index 1487d25..e225aba 100644 --- a/public/templates/_letsencrypt.conf.html +++ b/public/templates/_letsencrypt.conf.html @@ -1,4 +1,4 @@ location ^~ /.well-known/acme-challenge/ { default_type "text/plain"; root /var/www/_letsencrypt; -} \ No newline at end of file +} diff --git a/public/templates/_php.conf.html b/public/templates/_php.conf.html index 8d90ab8..217341c 100644 --- a/public/templates/_php.conf.html +++ b/public/templates/_php.conf.html @@ -4,6 +4,6 @@ index {{ data.index_html ? 'index.html ' : '' }}index.php; # handle .php location ~ \.php$ {<span ng-if="data.file_structure === 'separated'"> include _php_fastcgi.conf; - </span><span ng-if="data.file_structure === 'unified'"> - <ng-include src="'templates/_php_fastcgi.conf.html'" onload="refreshHighlighting()"></ng-include></span> -} \ No newline at end of file + </span><span class="include" ng-if="data.file_structure === 'unified'"> + <ng-include ng-include-tabs="{{ data.file_structure === 'unified' ? 3 : 1 }}" src="'templates/_php_fastcgi.conf.html'" onload="refreshHighlighting()"></ng-include></span> +} diff --git a/public/templates/_php_fastcgi.conf.html b/public/templates/_php_fastcgi.conf.html index 623265f..1a8528c 100644 --- a/public/templates/_php_fastcgi.conf.html +++ b/public/templates/_php_fastcgi.conf.html @@ -20,4 +20,4 @@ fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; # default fastcgi_params -include fastcgi_params; \ No newline at end of file +include fastcgi_params; diff --git a/public/templates/_ssl.conf.html b/public/templates/_ssl.conf.html index 096afe5..2bb0f33 100644 --- a/public/templates/_ssl.conf.html +++ b/public/templates/_ssl.conf.html @@ -21,4 +21,4 @@ ssl_stapling on; ssl_stapling_verify on; resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s; -resolver_timeout 2s; \ No newline at end of file +resolver_timeout 2s; diff --git a/public/templates/_wordpress.conf.html b/public/templates/_wordpress.conf.html index c686f97..94e41b7 100644 --- a/public/templates/_wordpress.conf.html +++ b/public/templates/_wordpress.conf.html @@ -27,4 +27,4 @@ location ~* ^/(?:xmlrpc\.php|wp-config\.php|wp-config-sample\.php|wp-comments-po location = /wp-login.php { limit_req zone=login burst=2 nodelay; include _php_fastcgi.conf; -}</span> \ No newline at end of file +}</span> diff --git a/public/templates/example.com.conf.html b/public/templates/example.com.conf.html index 45297e9..8089def 100644 --- a/public/templates/example.com.conf.html +++ b/public/templates/example.com.conf.html @@ -15,19 +15,19 @@ server { location / { try_files $uri $uri/ {{ data.index_html ? '/index.html' : '' }}{{ data.index_html && data.php !== 'off' && data.index_php ? ' ' : '' }}{{ data.php !== 'off' && data.index_php ? '/index.php?$query_string' : '' }}; }</span> - <span ng-if="data.file_structure === 'separated'"> +<span ng-if="data.file_structure === 'separated'"> include _general.conf;<span ng-if="data.php !== 'off' && data.wordpress"> include _wordpress.conf;</span><span ng-if="data.php !== 'off'"> include _php.conf;</span> include _letsencrypt.conf; - include _ssl.conf;</span><span ng-if="data.file_structure === 'unified'"> - <ng-include src="'templates/_general.conf.html'" onload="refreshHighlighting()"></ng-include><span ng-if="data.php !== 'off' && data.wordpress"> + include _ssl.conf;</span><span class="include" ng-if="data.file_structure === 'unified'"> +<ng-include ng-include-tabs="2" src="'templates/_general.conf.html'" onload="refreshHighlighting()"></ng-include><span ng-if="data.php !== 'off' && data.wordpress"> - <ng-include src="'templates/_wordpress.conf.html'" onload="refreshHighlighting()"></ng-include></span><span ng-if="data.php !== 'off'"> +<ng-include ng-include-tabs="2" src="'templates/_wordpress.conf.html'" onload="refreshHighlighting()"></ng-include></span><span ng-if="data.php !== 'off'"> - <ng-include src="'templates/_php.conf.html'" onload="refreshHighlighting()"></ng-include></span> +<ng-include ng-include-tabs="2" src="'templates/_php.conf.html'" onload="refreshHighlighting()"></ng-include></span> - <ng-include src="'templates/_letsencrypt.conf.html'" onload="refreshHighlighting()"></ng-include> +<ng-include ng-include-tabs="2" src="'templates/_letsencrypt.conf.html'" onload="refreshHighlighting()"></ng-include></span><span ng-if="data.file_structure === 'unified'"> include _ssl.conf;</span> }<span ng-if="data.cdn"> @@ -88,9 +88,9 @@ server { listen [::]:80; server_name {{ data.domain }} *.{{ data.domain }}; - <span ng-if="data.file_structure === 'separated'"> - include _letsencrypt.conf;</span><span ng-if="data.file_structure === 'unified'"> - <ng-include src="'templates/_letsencrypt.conf.html'" onload="refreshHighlighting()"></ng-include></span> +<span ng-if="data.file_structure === 'separated'"> + include _letsencrypt.conf;</span><span class="include" ng-if="data.file_structure === 'unified'"> + <ng-include ng-include-tabs="2" src="'templates/_letsencrypt.conf.html'" onload="refreshHighlighting()"></ng-include></span> return 301 https://{{ !data.non_www ? 'www.' : '' }}{{ data.domain }}$request_uri; }</span><span ng-if="!data.https">server { @@ -105,15 +105,15 @@ server { location / { try_files $uri $uri/ {{ data.index_html ? '/index.html' : '' }}{{ data.index_html && data.php !== 'off' && data.index_php ? ' ' : '' }}{{ data.php !== 'off' && data.index_php ? '/index.php?$query_string' : '' }}; }</span> - <span ng-if="data.file_structure === 'separated'"> +<span ng-if="data.file_structure === 'separated'"> include _general.conf;<span ng-if="data.php !== 'off' && data.wordpress"> include _wordpress.conf;</span><span ng-if="data.php !== 'off'"> - include _php.conf;</span></span><span ng-if="data.file_structure === 'unified'"> - <ng-include src="'templates/_general.conf.html'" onload="refreshHighlighting()"></ng-include><span ng-if="data.php !== 'off' && data.wordpress"> + include _php.conf;</span></span><span class="include" ng-if="data.file_structure === 'unified'"> +<ng-include ng-include-tabs="2" src="'templates/_general.conf.html'" onload="refreshHighlighting()"></ng-include> - <ng-include src="'templates/_wordpress.conf.html'" onload="refreshHighlighting()"></ng-include></span><span ng-if="data.php !== 'off'"> +<ng-include ng-if="data.php !== 'off' && data.wordpress" ng-include-tabs="2" src="'templates/_wordpress.conf.html'" onload="refreshHighlighting()"></ng-include> - <ng-include src="'templates/_php.conf.html'" onload="refreshHighlighting()"></ng-include></span></span> +<ng-include ng-if="data.php !== 'off'" ng-include-tabs="2" src="'templates/_php.conf.html'" onload="refreshHighlighting()"></ng-include></span> }<span ng-if="data.cdn"> # CDN @@ -152,4 +152,4 @@ server { server_name {{ !data.non_www ? data.domain + ' ' : '' }}*.{{ data.domain }}; return 301 http://{{ !data.non_www ? 'www.' : '' }}{{ data.domain }}$request_uri; -}</span> \ No newline at end of file +}</span> diff --git a/public/templates/nginx.conf.html b/public/templates/nginx.conf.html index ce7d641..986237a 100644 --- a/public/templates/nginx.conf.html +++ b/public/templates/nginx.conf.html @@ -37,5 +37,5 @@ http { include /etc/nginx/conf.d/*.conf;<span ng-if="data.file_structure === 'separated'"> include /etc/nginx/sites-enabled/*;</span><span ng-if="data.file_structure === 'unified'"> - <ng-include src="'templates/example.com.conf.html'" onload="refreshHighlighting()"></ng-include></span> -} \ No newline at end of file +<ng-include ng-include-tabs="1" src="'templates/example.com.conf.html'" sonload="refreshHighlighting()"></ng-include></span> +}