a couple of patches for windows, edge, and debugging mode

This commit is contained in:
Stewart Allen 2020-03-20 12:03:20 -04:00
commit 6da61b973b
2 changed files with 11 additions and 4 deletions

View file

@ -372,7 +372,7 @@ self.kiri.copyright = exports.COPYRIGHT;
function parseOpt(ov) { function parseOpt(ov) {
var opt = {}, kv, kva; var opt = {}, kv, kva;
// handle kiri legacy and proper url encoding better // handle kiri legacy and proper url encoding better
ov.split(',').map(v => v.split('&')).flat(1).forEach(function(el) { ov.replace(/&/g,',').split(',').forEach(function(el) {
kv = decodeURIComponent(el).split(':'); kv = decodeURIComponent(el).split(':');
if (kv.length === 2) { if (kv.length === 2) {
kva = opt[kv[0]] = opt[kv[0]] || []; kva = opt[kv[0]] = opt[kv[0]] || [];

View file

@ -188,7 +188,10 @@ function concatCode(array) {
if (file.indexOf(".js") < 0) { if (file.indexOf(".js") < 0) {
file = `/js/${file}.js`; file = `/js/${file}.js`;
} }
code.push(`"${file}",`); if (file.indexOf(":\\") > 0) {
file = `/${file}`;
}
code.push(`"${file.replace(/\\/g,'/')}",`);
}); });
code.push([ code.push([
']; function load_next() {', ']; function load_next() {',
@ -447,8 +450,12 @@ function addCorsHeaders(req, res) {
* in debug mode only, serve ANY file path beginning with / that exists * in debug mode only, serve ANY file path beginning with / that exists
*/ */
function handleDebug(req, res, next) { function handleDebug(req, res, next) {
if (debug && lastmod(req.url)) { if (debug) {
return res.end(fs.readFileSync(req.url)); if (lastmod(req.url)) {
return res.end(fs.readFileSync(req.url));
} else if (lastmod(req.url.substring(1))) {
return res.end(fs.readFileSync(req.url.substring(1)));
}
} }
return next(); return next();
} }