Fixes #33 Default array if there isn't a downloadExtensions key in the config

This commit is contained in:
A McIlwraith 2025-06-10 16:55:34 -04:00
parent b44b17d830
commit 857680c3b1
2 changed files with 15 additions and 3 deletions

View File

@ -24,7 +24,7 @@
return $result; return $result;
} }
$allowed_types = ["scss", "js"]; $allowed_types = ['js','pug','scss'];
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns"; $patterns = dirname(dirname(__file__)) . "/src/pg/patterns";

View File

@ -1,3 +1,13 @@
include ../_config.pug
if typeof downloadExtensions == "undefined"
- var extensions = `["js", "scss", "hello"]`
else
- var extensions = []
each ext in downloadExtensions
- extensions.push("'" + ext + "'")
- extensions = "[" + extensions + "]"
- -
var php = `<?php var php = `<?php
function recursor($dir, $type) { function recursor($dir, $type) {
@ -25,7 +35,7 @@
return $result; return $result;
} }
$allowed_types = ["scss", "js"]; $allowed_types = {{extensions}};
$patterns = dirname(dirname(__file__)) . "/src/pg/patterns"; $patterns = dirname(dirname(__file__)) . "/src/pg/patterns";
@ -50,5 +60,7 @@
header('Content-type: application/zip'); header('Content-type: application/zip');
header(sprintf('Content-Disposition: attachment; filename="%s.zip"', $type)); header(sprintf('Content-Disposition: attachment; filename="%s.zip"', $type));
echo(file_get_contents($t)); ?>` echo(file_get_contents($t)); ?>`.replace("{{extensions}}", extensions)
| !{php} | !{php}