a couple of patches for windows, edge, and debugging mode
This commit is contained in:
parent
471c8cc094
commit
6da61b973b
2 changed files with 11 additions and 4 deletions
|
|
@ -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]] || [];
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue