@telepath-computer/television 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/assets/index-CJHYp4Ch.js +397 -0
- package/dist/browser/index.html +1 -1
- package/dist/cli.cjs +563 -396
- package/dist/electron.cjs +529 -362
- package/package.json +4 -3
- package/dist/browser/assets/index-CTgK-awk.js +0 -398
package/dist/electron.cjs
CHANGED
|
@@ -14078,11 +14078,11 @@ var require_mime_types = __commonJS({
|
|
|
14078
14078
|
}
|
|
14079
14079
|
return exts[0];
|
|
14080
14080
|
}
|
|
14081
|
-
function lookup(
|
|
14082
|
-
if (!
|
|
14081
|
+
function lookup(path6) {
|
|
14082
|
+
if (!path6 || typeof path6 !== "string") {
|
|
14083
14083
|
return false;
|
|
14084
14084
|
}
|
|
14085
|
-
var extension3 = extname("x." +
|
|
14085
|
+
var extension3 = extname("x." + path6).toLowerCase().substr(1);
|
|
14086
14086
|
if (!extension3) {
|
|
14087
14087
|
return false;
|
|
14088
14088
|
}
|
|
@@ -18445,7 +18445,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18445
18445
|
"node_modules/path-to-regexp/index.js"(exports2, module2) {
|
|
18446
18446
|
module2.exports = pathToRegexp;
|
|
18447
18447
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
18448
|
-
function pathToRegexp(
|
|
18448
|
+
function pathToRegexp(path6, keys, options) {
|
|
18449
18449
|
options = options || {};
|
|
18450
18450
|
keys = keys || [];
|
|
18451
18451
|
var strict = options.strict;
|
|
@@ -18459,8 +18459,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
18459
18459
|
var pos = 0;
|
|
18460
18460
|
var backtrack = "";
|
|
18461
18461
|
var m2;
|
|
18462
|
-
if (
|
|
18463
|
-
while (m2 = MATCHING_GROUP_REGEXP.exec(
|
|
18462
|
+
if (path6 instanceof RegExp) {
|
|
18463
|
+
while (m2 = MATCHING_GROUP_REGEXP.exec(path6.source)) {
|
|
18464
18464
|
if (m2[0][0] === "\\") continue;
|
|
18465
18465
|
keys.push({
|
|
18466
18466
|
name: m2[1] || name++,
|
|
@@ -18468,18 +18468,18 @@ var require_path_to_regexp = __commonJS({
|
|
|
18468
18468
|
offset: m2.index
|
|
18469
18469
|
});
|
|
18470
18470
|
}
|
|
18471
|
-
return
|
|
18471
|
+
return path6;
|
|
18472
18472
|
}
|
|
18473
|
-
if (Array.isArray(
|
|
18474
|
-
|
|
18473
|
+
if (Array.isArray(path6)) {
|
|
18474
|
+
path6 = path6.map(function(value) {
|
|
18475
18475
|
return pathToRegexp(value, keys, options).source;
|
|
18476
18476
|
});
|
|
18477
|
-
return new RegExp(
|
|
18477
|
+
return new RegExp(path6.join("|"), flags);
|
|
18478
18478
|
}
|
|
18479
|
-
if (typeof
|
|
18479
|
+
if (typeof path6 !== "string") {
|
|
18480
18480
|
throw new TypeError("path must be a string, array of strings, or regular expression");
|
|
18481
18481
|
}
|
|
18482
|
-
|
|
18482
|
+
path6 = path6.replace(
|
|
18483
18483
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
18484
18484
|
function(match, slash, format, key, capture, star, optional2, offset) {
|
|
18485
18485
|
if (match[0] === "\\") {
|
|
@@ -18496,7 +18496,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18496
18496
|
if (slash || format) {
|
|
18497
18497
|
backtrack = "";
|
|
18498
18498
|
} else {
|
|
18499
|
-
backtrack +=
|
|
18499
|
+
backtrack += path6.slice(pos, offset);
|
|
18500
18500
|
}
|
|
18501
18501
|
pos = offset + match.length;
|
|
18502
18502
|
if (match === "*") {
|
|
@@ -18526,7 +18526,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
18526
18526
|
return result;
|
|
18527
18527
|
}
|
|
18528
18528
|
);
|
|
18529
|
-
while (m2 = MATCHING_GROUP_REGEXP.exec(
|
|
18529
|
+
while (m2 = MATCHING_GROUP_REGEXP.exec(path6)) {
|
|
18530
18530
|
if (m2[0][0] === "\\") continue;
|
|
18531
18531
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m2.index) {
|
|
18532
18532
|
keys.splice(keysOffset + i, 0, {
|
|
@@ -18538,13 +18538,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
18538
18538
|
}
|
|
18539
18539
|
i++;
|
|
18540
18540
|
}
|
|
18541
|
-
|
|
18541
|
+
path6 += strict ? "" : path6[path6.length - 1] === "/" ? "?" : "/?";
|
|
18542
18542
|
if (end) {
|
|
18543
|
-
|
|
18544
|
-
} else if (
|
|
18545
|
-
|
|
18543
|
+
path6 += "$";
|
|
18544
|
+
} else if (path6[path6.length - 1] !== "/") {
|
|
18545
|
+
path6 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
18546
18546
|
}
|
|
18547
|
-
return new RegExp("^" +
|
|
18547
|
+
return new RegExp("^" + path6, flags);
|
|
18548
18548
|
}
|
|
18549
18549
|
}
|
|
18550
18550
|
});
|
|
@@ -18557,19 +18557,19 @@ var require_layer = __commonJS({
|
|
|
18557
18557
|
var debug = require_src3()("express:router:layer");
|
|
18558
18558
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
18559
18559
|
module2.exports = Layer;
|
|
18560
|
-
function Layer(
|
|
18560
|
+
function Layer(path6, options, fn) {
|
|
18561
18561
|
if (!(this instanceof Layer)) {
|
|
18562
|
-
return new Layer(
|
|
18562
|
+
return new Layer(path6, options, fn);
|
|
18563
18563
|
}
|
|
18564
|
-
debug("new %o",
|
|
18564
|
+
debug("new %o", path6);
|
|
18565
18565
|
var opts = options || {};
|
|
18566
18566
|
this.handle = fn;
|
|
18567
18567
|
this.name = fn.name || "<anonymous>";
|
|
18568
18568
|
this.params = void 0;
|
|
18569
18569
|
this.path = void 0;
|
|
18570
|
-
this.regexp = pathRegexp(
|
|
18571
|
-
this.regexp.fast_star =
|
|
18572
|
-
this.regexp.fast_slash =
|
|
18570
|
+
this.regexp = pathRegexp(path6, this.keys = [], opts);
|
|
18571
|
+
this.regexp.fast_star = path6 === "*";
|
|
18572
|
+
this.regexp.fast_slash = path6 === "/" && opts.end === false;
|
|
18573
18573
|
}
|
|
18574
18574
|
Layer.prototype.handle_error = function handle_error(error2, req, res, next) {
|
|
18575
18575
|
var fn = this.handle;
|
|
@@ -18593,20 +18593,20 @@ var require_layer = __commonJS({
|
|
|
18593
18593
|
next(err);
|
|
18594
18594
|
}
|
|
18595
18595
|
};
|
|
18596
|
-
Layer.prototype.match = function match(
|
|
18596
|
+
Layer.prototype.match = function match(path6) {
|
|
18597
18597
|
var match2;
|
|
18598
|
-
if (
|
|
18598
|
+
if (path6 != null) {
|
|
18599
18599
|
if (this.regexp.fast_slash) {
|
|
18600
18600
|
this.params = {};
|
|
18601
18601
|
this.path = "";
|
|
18602
18602
|
return true;
|
|
18603
18603
|
}
|
|
18604
18604
|
if (this.regexp.fast_star) {
|
|
18605
|
-
this.params = { "0": decode_param(
|
|
18606
|
-
this.path =
|
|
18605
|
+
this.params = { "0": decode_param(path6) };
|
|
18606
|
+
this.path = path6;
|
|
18607
18607
|
return true;
|
|
18608
18608
|
}
|
|
18609
|
-
match2 = this.regexp.exec(
|
|
18609
|
+
match2 = this.regexp.exec(path6);
|
|
18610
18610
|
}
|
|
18611
18611
|
if (!match2) {
|
|
18612
18612
|
this.params = void 0;
|
|
@@ -18699,10 +18699,10 @@ var require_route = __commonJS({
|
|
|
18699
18699
|
var slice = Array.prototype.slice;
|
|
18700
18700
|
var toString = Object.prototype.toString;
|
|
18701
18701
|
module2.exports = Route;
|
|
18702
|
-
function Route(
|
|
18703
|
-
this.path =
|
|
18702
|
+
function Route(path6) {
|
|
18703
|
+
this.path = path6;
|
|
18704
18704
|
this.stack = [];
|
|
18705
|
-
debug("new %o",
|
|
18705
|
+
debug("new %o", path6);
|
|
18706
18706
|
this.methods = {};
|
|
18707
18707
|
}
|
|
18708
18708
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -18914,8 +18914,8 @@ var require_router = __commonJS({
|
|
|
18914
18914
|
if (++sync > 100) {
|
|
18915
18915
|
return setImmediate(next, err);
|
|
18916
18916
|
}
|
|
18917
|
-
var
|
|
18918
|
-
if (
|
|
18917
|
+
var path6 = getPathname(req);
|
|
18918
|
+
if (path6 == null) {
|
|
18919
18919
|
return done(layerError);
|
|
18920
18920
|
}
|
|
18921
18921
|
var layer;
|
|
@@ -18923,7 +18923,7 @@ var require_router = __commonJS({
|
|
|
18923
18923
|
var route;
|
|
18924
18924
|
while (match !== true && idx < stack.length) {
|
|
18925
18925
|
layer = stack[idx++];
|
|
18926
|
-
match = matchLayer(layer,
|
|
18926
|
+
match = matchLayer(layer, path6);
|
|
18927
18927
|
route = layer.route;
|
|
18928
18928
|
if (typeof match !== "boolean") {
|
|
18929
18929
|
layerError = layerError || match;
|
|
@@ -18961,18 +18961,18 @@ var require_router = __commonJS({
|
|
|
18961
18961
|
} else if (route) {
|
|
18962
18962
|
layer.handle_request(req, res, next);
|
|
18963
18963
|
} else {
|
|
18964
|
-
trim_prefix(layer, layerError, layerPath,
|
|
18964
|
+
trim_prefix(layer, layerError, layerPath, path6);
|
|
18965
18965
|
}
|
|
18966
18966
|
sync = 0;
|
|
18967
18967
|
});
|
|
18968
18968
|
}
|
|
18969
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
18969
|
+
function trim_prefix(layer, layerError, layerPath, path6) {
|
|
18970
18970
|
if (layerPath.length !== 0) {
|
|
18971
|
-
if (layerPath !==
|
|
18971
|
+
if (layerPath !== path6.slice(0, layerPath.length)) {
|
|
18972
18972
|
next(layerError);
|
|
18973
18973
|
return;
|
|
18974
18974
|
}
|
|
18975
|
-
var c =
|
|
18975
|
+
var c = path6[layerPath.length];
|
|
18976
18976
|
if (c && c !== "/" && c !== ".") return next(layerError);
|
|
18977
18977
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
18978
18978
|
removed = layerPath;
|
|
@@ -19050,7 +19050,7 @@ var require_router = __commonJS({
|
|
|
19050
19050
|
};
|
|
19051
19051
|
proto.use = function use(fn) {
|
|
19052
19052
|
var offset = 0;
|
|
19053
|
-
var
|
|
19053
|
+
var path6 = "/";
|
|
19054
19054
|
if (typeof fn !== "function") {
|
|
19055
19055
|
var arg = fn;
|
|
19056
19056
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -19058,7 +19058,7 @@ var require_router = __commonJS({
|
|
|
19058
19058
|
}
|
|
19059
19059
|
if (typeof arg !== "function") {
|
|
19060
19060
|
offset = 1;
|
|
19061
|
-
|
|
19061
|
+
path6 = fn;
|
|
19062
19062
|
}
|
|
19063
19063
|
}
|
|
19064
19064
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -19070,8 +19070,8 @@ var require_router = __commonJS({
|
|
|
19070
19070
|
if (typeof fn !== "function") {
|
|
19071
19071
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
19072
19072
|
}
|
|
19073
|
-
debug("use %o %s",
|
|
19074
|
-
var layer = new Layer(
|
|
19073
|
+
debug("use %o %s", path6, fn.name || "<anonymous>");
|
|
19074
|
+
var layer = new Layer(path6, {
|
|
19075
19075
|
sensitive: this.caseSensitive,
|
|
19076
19076
|
strict: false,
|
|
19077
19077
|
end: false
|
|
@@ -19081,9 +19081,9 @@ var require_router = __commonJS({
|
|
|
19081
19081
|
}
|
|
19082
19082
|
return this;
|
|
19083
19083
|
};
|
|
19084
|
-
proto.route = function route(
|
|
19085
|
-
var route2 = new Route(
|
|
19086
|
-
var layer = new Layer(
|
|
19084
|
+
proto.route = function route(path6) {
|
|
19085
|
+
var route2 = new Route(path6);
|
|
19086
|
+
var layer = new Layer(path6, {
|
|
19087
19087
|
sensitive: this.caseSensitive,
|
|
19088
19088
|
strict: this.strict,
|
|
19089
19089
|
end: true
|
|
@@ -19093,8 +19093,8 @@ var require_router = __commonJS({
|
|
|
19093
19093
|
return route2;
|
|
19094
19094
|
};
|
|
19095
19095
|
methods.concat("all").forEach(function(method) {
|
|
19096
|
-
proto[method] = function(
|
|
19097
|
-
var route = this.route(
|
|
19096
|
+
proto[method] = function(path6) {
|
|
19097
|
+
var route = this.route(path6);
|
|
19098
19098
|
route[method].apply(route, slice.call(arguments, 1));
|
|
19099
19099
|
return this;
|
|
19100
19100
|
};
|
|
@@ -19130,9 +19130,9 @@ var require_router = __commonJS({
|
|
|
19130
19130
|
}
|
|
19131
19131
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
19132
19132
|
}
|
|
19133
|
-
function matchLayer(layer,
|
|
19133
|
+
function matchLayer(layer, path6) {
|
|
19134
19134
|
try {
|
|
19135
|
-
return layer.match(
|
|
19135
|
+
return layer.match(path6);
|
|
19136
19136
|
} catch (err) {
|
|
19137
19137
|
return err;
|
|
19138
19138
|
}
|
|
@@ -19250,13 +19250,13 @@ var require_view = __commonJS({
|
|
|
19250
19250
|
"node_modules/express/lib/view.js"(exports2, module2) {
|
|
19251
19251
|
"use strict";
|
|
19252
19252
|
var debug = require_src3()("express:view");
|
|
19253
|
-
var
|
|
19253
|
+
var path6 = require("path");
|
|
19254
19254
|
var fs = require("fs");
|
|
19255
|
-
var dirname =
|
|
19256
|
-
var basename =
|
|
19257
|
-
var extname =
|
|
19258
|
-
var join =
|
|
19259
|
-
var resolve =
|
|
19255
|
+
var dirname = path6.dirname;
|
|
19256
|
+
var basename = path6.basename;
|
|
19257
|
+
var extname = path6.extname;
|
|
19258
|
+
var join = path6.join;
|
|
19259
|
+
var resolve = path6.resolve;
|
|
19260
19260
|
module2.exports = View;
|
|
19261
19261
|
function View(name, options) {
|
|
19262
19262
|
var opts = options || {};
|
|
@@ -19285,17 +19285,17 @@ var require_view = __commonJS({
|
|
|
19285
19285
|
this.path = this.lookup(fileName);
|
|
19286
19286
|
}
|
|
19287
19287
|
View.prototype.lookup = function lookup(name) {
|
|
19288
|
-
var
|
|
19288
|
+
var path7;
|
|
19289
19289
|
var roots = [].concat(this.root);
|
|
19290
19290
|
debug('lookup "%s"', name);
|
|
19291
|
-
for (var i = 0; i < roots.length && !
|
|
19291
|
+
for (var i = 0; i < roots.length && !path7; i++) {
|
|
19292
19292
|
var root = roots[i];
|
|
19293
19293
|
var loc = resolve(root, name);
|
|
19294
19294
|
var dir = dirname(loc);
|
|
19295
19295
|
var file2 = basename(loc);
|
|
19296
|
-
|
|
19296
|
+
path7 = this.resolve(dir, file2);
|
|
19297
19297
|
}
|
|
19298
|
-
return
|
|
19298
|
+
return path7;
|
|
19299
19299
|
};
|
|
19300
19300
|
View.prototype.render = function render(options, callback) {
|
|
19301
19301
|
debug('render "%s"', this.path);
|
|
@@ -19303,21 +19303,21 @@ var require_view = __commonJS({
|
|
|
19303
19303
|
};
|
|
19304
19304
|
View.prototype.resolve = function resolve2(dir, file2) {
|
|
19305
19305
|
var ext = this.ext;
|
|
19306
|
-
var
|
|
19307
|
-
var stat = tryStat(
|
|
19306
|
+
var path7 = join(dir, file2);
|
|
19307
|
+
var stat = tryStat(path7);
|
|
19308
19308
|
if (stat && stat.isFile()) {
|
|
19309
|
-
return
|
|
19309
|
+
return path7;
|
|
19310
19310
|
}
|
|
19311
|
-
|
|
19312
|
-
stat = tryStat(
|
|
19311
|
+
path7 = join(dir, basename(file2, ext), "index" + ext);
|
|
19312
|
+
stat = tryStat(path7);
|
|
19313
19313
|
if (stat && stat.isFile()) {
|
|
19314
|
-
return
|
|
19314
|
+
return path7;
|
|
19315
19315
|
}
|
|
19316
19316
|
};
|
|
19317
|
-
function tryStat(
|
|
19318
|
-
debug('stat "%s"',
|
|
19317
|
+
function tryStat(path7) {
|
|
19318
|
+
debug('stat "%s"', path7);
|
|
19319
19319
|
try {
|
|
19320
|
-
return fs.statSync(
|
|
19320
|
+
return fs.statSync(path7);
|
|
19321
19321
|
} catch (e) {
|
|
19322
19322
|
return void 0;
|
|
19323
19323
|
}
|
|
@@ -20095,7 +20095,7 @@ var require_types = __commonJS({
|
|
|
20095
20095
|
// node_modules/mime/mime.js
|
|
20096
20096
|
var require_mime = __commonJS({
|
|
20097
20097
|
"node_modules/mime/mime.js"(exports2, module2) {
|
|
20098
|
-
var
|
|
20098
|
+
var path6 = require("path");
|
|
20099
20099
|
var fs = require("fs");
|
|
20100
20100
|
function Mime() {
|
|
20101
20101
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
@@ -20125,8 +20125,8 @@ var require_mime = __commonJS({
|
|
|
20125
20125
|
this.define(map2);
|
|
20126
20126
|
this._loading = null;
|
|
20127
20127
|
};
|
|
20128
|
-
Mime.prototype.lookup = function(
|
|
20129
|
-
var ext =
|
|
20128
|
+
Mime.prototype.lookup = function(path7, fallback) {
|
|
20129
|
+
var ext = path7.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
20130
20130
|
return this.types[ext] || fallback || this.default_type;
|
|
20131
20131
|
};
|
|
20132
20132
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -20360,28 +20360,28 @@ var require_send = __commonJS({
|
|
|
20360
20360
|
var ms = require_ms5();
|
|
20361
20361
|
var onFinished = require_on_finished();
|
|
20362
20362
|
var parseRange = require_range_parser();
|
|
20363
|
-
var
|
|
20363
|
+
var path6 = require("path");
|
|
20364
20364
|
var statuses = require_statuses();
|
|
20365
20365
|
var Stream = require("stream");
|
|
20366
20366
|
var util2 = require("util");
|
|
20367
|
-
var extname =
|
|
20368
|
-
var join =
|
|
20369
|
-
var normalize =
|
|
20370
|
-
var resolve =
|
|
20371
|
-
var sep =
|
|
20367
|
+
var extname = path6.extname;
|
|
20368
|
+
var join = path6.join;
|
|
20369
|
+
var normalize = path6.normalize;
|
|
20370
|
+
var resolve = path6.resolve;
|
|
20371
|
+
var sep = path6.sep;
|
|
20372
20372
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
20373
20373
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
20374
20374
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
20375
20375
|
module2.exports = send;
|
|
20376
20376
|
module2.exports.mime = mime;
|
|
20377
|
-
function send(req,
|
|
20378
|
-
return new SendStream(req,
|
|
20377
|
+
function send(req, path7, options) {
|
|
20378
|
+
return new SendStream(req, path7, options);
|
|
20379
20379
|
}
|
|
20380
|
-
function SendStream(req,
|
|
20380
|
+
function SendStream(req, path7, options) {
|
|
20381
20381
|
Stream.call(this);
|
|
20382
20382
|
var opts = options || {};
|
|
20383
20383
|
this.options = opts;
|
|
20384
|
-
this.path =
|
|
20384
|
+
this.path = path7;
|
|
20385
20385
|
this.req = req;
|
|
20386
20386
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
20387
20387
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -20427,8 +20427,8 @@ var require_send = __commonJS({
|
|
|
20427
20427
|
this._index = index2;
|
|
20428
20428
|
return this;
|
|
20429
20429
|
}, "send.index: pass index as option");
|
|
20430
|
-
SendStream.prototype.root = function root(
|
|
20431
|
-
this._root = resolve(String(
|
|
20430
|
+
SendStream.prototype.root = function root(path7) {
|
|
20431
|
+
this._root = resolve(String(path7));
|
|
20432
20432
|
debug("root %s", this._root);
|
|
20433
20433
|
return this;
|
|
20434
20434
|
};
|
|
@@ -20541,10 +20541,10 @@ var require_send = __commonJS({
|
|
|
20541
20541
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
20542
20542
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
20543
20543
|
};
|
|
20544
|
-
SendStream.prototype.redirect = function redirect(
|
|
20544
|
+
SendStream.prototype.redirect = function redirect(path7) {
|
|
20545
20545
|
var res = this.res;
|
|
20546
20546
|
if (hasListeners(this, "directory")) {
|
|
20547
|
-
this.emit("directory", res,
|
|
20547
|
+
this.emit("directory", res, path7);
|
|
20548
20548
|
return;
|
|
20549
20549
|
}
|
|
20550
20550
|
if (this.hasTrailingSlash()) {
|
|
@@ -20564,42 +20564,42 @@ var require_send = __commonJS({
|
|
|
20564
20564
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
20565
20565
|
var root = this._root;
|
|
20566
20566
|
this.res = res;
|
|
20567
|
-
var
|
|
20568
|
-
if (
|
|
20567
|
+
var path7 = decode3(this.path);
|
|
20568
|
+
if (path7 === -1) {
|
|
20569
20569
|
this.error(400);
|
|
20570
20570
|
return res;
|
|
20571
20571
|
}
|
|
20572
|
-
if (~
|
|
20572
|
+
if (~path7.indexOf("\0")) {
|
|
20573
20573
|
this.error(400);
|
|
20574
20574
|
return res;
|
|
20575
20575
|
}
|
|
20576
20576
|
var parts;
|
|
20577
20577
|
if (root !== null) {
|
|
20578
|
-
if (
|
|
20579
|
-
|
|
20578
|
+
if (path7) {
|
|
20579
|
+
path7 = normalize("." + sep + path7);
|
|
20580
20580
|
}
|
|
20581
|
-
if (UP_PATH_REGEXP.test(
|
|
20582
|
-
debug('malicious path "%s"',
|
|
20581
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
20582
|
+
debug('malicious path "%s"', path7);
|
|
20583
20583
|
this.error(403);
|
|
20584
20584
|
return res;
|
|
20585
20585
|
}
|
|
20586
|
-
parts =
|
|
20587
|
-
|
|
20586
|
+
parts = path7.split(sep);
|
|
20587
|
+
path7 = normalize(join(root, path7));
|
|
20588
20588
|
} else {
|
|
20589
|
-
if (UP_PATH_REGEXP.test(
|
|
20590
|
-
debug('malicious path "%s"',
|
|
20589
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
20590
|
+
debug('malicious path "%s"', path7);
|
|
20591
20591
|
this.error(403);
|
|
20592
20592
|
return res;
|
|
20593
20593
|
}
|
|
20594
|
-
parts = normalize(
|
|
20595
|
-
|
|
20594
|
+
parts = normalize(path7).split(sep);
|
|
20595
|
+
path7 = resolve(path7);
|
|
20596
20596
|
}
|
|
20597
20597
|
if (containsDotFile(parts)) {
|
|
20598
20598
|
var access = this._dotfiles;
|
|
20599
20599
|
if (access === void 0) {
|
|
20600
20600
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
20601
20601
|
}
|
|
20602
|
-
debug('%s dotfile "%s"', access,
|
|
20602
|
+
debug('%s dotfile "%s"', access, path7);
|
|
20603
20603
|
switch (access) {
|
|
20604
20604
|
case "allow":
|
|
20605
20605
|
break;
|
|
@@ -20613,13 +20613,13 @@ var require_send = __commonJS({
|
|
|
20613
20613
|
}
|
|
20614
20614
|
}
|
|
20615
20615
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
20616
|
-
this.sendIndex(
|
|
20616
|
+
this.sendIndex(path7);
|
|
20617
20617
|
return res;
|
|
20618
20618
|
}
|
|
20619
|
-
this.sendFile(
|
|
20619
|
+
this.sendFile(path7);
|
|
20620
20620
|
return res;
|
|
20621
20621
|
};
|
|
20622
|
-
SendStream.prototype.send = function send2(
|
|
20622
|
+
SendStream.prototype.send = function send2(path7, stat) {
|
|
20623
20623
|
var len = stat.size;
|
|
20624
20624
|
var options = this.options;
|
|
20625
20625
|
var opts = {};
|
|
@@ -20631,9 +20631,9 @@ var require_send = __commonJS({
|
|
|
20631
20631
|
this.headersAlreadySent();
|
|
20632
20632
|
return;
|
|
20633
20633
|
}
|
|
20634
|
-
debug('pipe "%s"',
|
|
20635
|
-
this.setHeader(
|
|
20636
|
-
this.type(
|
|
20634
|
+
debug('pipe "%s"', path7);
|
|
20635
|
+
this.setHeader(path7, stat);
|
|
20636
|
+
this.type(path7);
|
|
20637
20637
|
if (this.isConditionalGET()) {
|
|
20638
20638
|
if (this.isPreconditionFailure()) {
|
|
20639
20639
|
this.error(412);
|
|
@@ -20682,26 +20682,26 @@ var require_send = __commonJS({
|
|
|
20682
20682
|
res.end();
|
|
20683
20683
|
return;
|
|
20684
20684
|
}
|
|
20685
|
-
this.stream(
|
|
20685
|
+
this.stream(path7, opts);
|
|
20686
20686
|
};
|
|
20687
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
20687
|
+
SendStream.prototype.sendFile = function sendFile(path7) {
|
|
20688
20688
|
var i = 0;
|
|
20689
20689
|
var self2 = this;
|
|
20690
|
-
debug('stat "%s"',
|
|
20691
|
-
fs.stat(
|
|
20692
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
20690
|
+
debug('stat "%s"', path7);
|
|
20691
|
+
fs.stat(path7, function onstat(err, stat) {
|
|
20692
|
+
if (err && err.code === "ENOENT" && !extname(path7) && path7[path7.length - 1] !== sep) {
|
|
20693
20693
|
return next(err);
|
|
20694
20694
|
}
|
|
20695
20695
|
if (err) return self2.onStatError(err);
|
|
20696
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
20697
|
-
self2.emit("file",
|
|
20698
|
-
self2.send(
|
|
20696
|
+
if (stat.isDirectory()) return self2.redirect(path7);
|
|
20697
|
+
self2.emit("file", path7, stat);
|
|
20698
|
+
self2.send(path7, stat);
|
|
20699
20699
|
});
|
|
20700
20700
|
function next(err) {
|
|
20701
20701
|
if (self2._extensions.length <= i) {
|
|
20702
20702
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
20703
20703
|
}
|
|
20704
|
-
var p =
|
|
20704
|
+
var p = path7 + "." + self2._extensions[i++];
|
|
20705
20705
|
debug('stat "%s"', p);
|
|
20706
20706
|
fs.stat(p, function(err2, stat) {
|
|
20707
20707
|
if (err2) return next(err2);
|
|
@@ -20711,7 +20711,7 @@ var require_send = __commonJS({
|
|
|
20711
20711
|
});
|
|
20712
20712
|
}
|
|
20713
20713
|
};
|
|
20714
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
20714
|
+
SendStream.prototype.sendIndex = function sendIndex(path7) {
|
|
20715
20715
|
var i = -1;
|
|
20716
20716
|
var self2 = this;
|
|
20717
20717
|
function next(err) {
|
|
@@ -20719,7 +20719,7 @@ var require_send = __commonJS({
|
|
|
20719
20719
|
if (err) return self2.onStatError(err);
|
|
20720
20720
|
return self2.error(404);
|
|
20721
20721
|
}
|
|
20722
|
-
var p = join(
|
|
20722
|
+
var p = join(path7, self2._index[i]);
|
|
20723
20723
|
debug('stat "%s"', p);
|
|
20724
20724
|
fs.stat(p, function(err2, stat) {
|
|
20725
20725
|
if (err2) return next(err2);
|
|
@@ -20730,10 +20730,10 @@ var require_send = __commonJS({
|
|
|
20730
20730
|
}
|
|
20731
20731
|
next();
|
|
20732
20732
|
};
|
|
20733
|
-
SendStream.prototype.stream = function stream(
|
|
20733
|
+
SendStream.prototype.stream = function stream(path7, options) {
|
|
20734
20734
|
var self2 = this;
|
|
20735
20735
|
var res = this.res;
|
|
20736
|
-
var stream2 = fs.createReadStream(
|
|
20736
|
+
var stream2 = fs.createReadStream(path7, options);
|
|
20737
20737
|
this.emit("stream", stream2);
|
|
20738
20738
|
stream2.pipe(res);
|
|
20739
20739
|
function cleanup() {
|
|
@@ -20748,10 +20748,10 @@ var require_send = __commonJS({
|
|
|
20748
20748
|
self2.emit("end");
|
|
20749
20749
|
});
|
|
20750
20750
|
};
|
|
20751
|
-
SendStream.prototype.type = function type(
|
|
20751
|
+
SendStream.prototype.type = function type(path7) {
|
|
20752
20752
|
var res = this.res;
|
|
20753
20753
|
if (res.getHeader("Content-Type")) return;
|
|
20754
|
-
var type2 = mime.lookup(
|
|
20754
|
+
var type2 = mime.lookup(path7);
|
|
20755
20755
|
if (!type2) {
|
|
20756
20756
|
debug("no content-type");
|
|
20757
20757
|
return;
|
|
@@ -20760,9 +20760,9 @@ var require_send = __commonJS({
|
|
|
20760
20760
|
debug("content-type %s", type2);
|
|
20761
20761
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
20762
20762
|
};
|
|
20763
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
20763
|
+
SendStream.prototype.setHeader = function setHeader(path7, stat) {
|
|
20764
20764
|
var res = this.res;
|
|
20765
|
-
this.emit("headers", res,
|
|
20765
|
+
this.emit("headers", res, path7, stat);
|
|
20766
20766
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
20767
20767
|
debug("accept ranges");
|
|
20768
20768
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -20821,9 +20821,9 @@ var require_send = __commonJS({
|
|
|
20821
20821
|
}
|
|
20822
20822
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
20823
20823
|
}
|
|
20824
|
-
function decode3(
|
|
20824
|
+
function decode3(path7) {
|
|
20825
20825
|
try {
|
|
20826
|
-
return decodeURIComponent(
|
|
20826
|
+
return decodeURIComponent(path7);
|
|
20827
20827
|
} catch (err) {
|
|
20828
20828
|
return -1;
|
|
20829
20829
|
}
|
|
@@ -21732,10 +21732,10 @@ var require_utils2 = __commonJS({
|
|
|
21732
21732
|
var querystring = require("querystring");
|
|
21733
21733
|
exports2.etag = createETagGenerator({ weak: false });
|
|
21734
21734
|
exports2.wetag = createETagGenerator({ weak: true });
|
|
21735
|
-
exports2.isAbsolute = function(
|
|
21736
|
-
if ("/" ===
|
|
21737
|
-
if (":" ===
|
|
21738
|
-
if ("\\\\" ===
|
|
21735
|
+
exports2.isAbsolute = function(path6) {
|
|
21736
|
+
if ("/" === path6[0]) return true;
|
|
21737
|
+
if (":" === path6[1] && ("\\" === path6[2] || "/" === path6[2])) return true;
|
|
21738
|
+
if ("\\\\" === path6.substring(0, 2)) return true;
|
|
21739
21739
|
};
|
|
21740
21740
|
exports2.flatten = deprecate.function(
|
|
21741
21741
|
flatten,
|
|
@@ -21946,7 +21946,7 @@ var require_application = __commonJS({
|
|
|
21946
21946
|
};
|
|
21947
21947
|
app2.use = function use(fn) {
|
|
21948
21948
|
var offset = 0;
|
|
21949
|
-
var
|
|
21949
|
+
var path6 = "/";
|
|
21950
21950
|
if (typeof fn !== "function") {
|
|
21951
21951
|
var arg = fn;
|
|
21952
21952
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -21954,7 +21954,7 @@ var require_application = __commonJS({
|
|
|
21954
21954
|
}
|
|
21955
21955
|
if (typeof arg !== "function") {
|
|
21956
21956
|
offset = 1;
|
|
21957
|
-
|
|
21957
|
+
path6 = fn;
|
|
21958
21958
|
}
|
|
21959
21959
|
}
|
|
21960
21960
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -21965,12 +21965,12 @@ var require_application = __commonJS({
|
|
|
21965
21965
|
var router = this._router;
|
|
21966
21966
|
fns.forEach(function(fn2) {
|
|
21967
21967
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
21968
|
-
return router.use(
|
|
21968
|
+
return router.use(path6, fn2);
|
|
21969
21969
|
}
|
|
21970
|
-
debug(".use app under %s",
|
|
21971
|
-
fn2.mountpath =
|
|
21970
|
+
debug(".use app under %s", path6);
|
|
21971
|
+
fn2.mountpath = path6;
|
|
21972
21972
|
fn2.parent = this;
|
|
21973
|
-
router.use(
|
|
21973
|
+
router.use(path6, function mounted_app(req, res, next) {
|
|
21974
21974
|
var orig = req.app;
|
|
21975
21975
|
fn2.handle(req, res, function(err) {
|
|
21976
21976
|
setPrototypeOf(req, orig.request);
|
|
@@ -21982,9 +21982,9 @@ var require_application = __commonJS({
|
|
|
21982
21982
|
}, this);
|
|
21983
21983
|
return this;
|
|
21984
21984
|
};
|
|
21985
|
-
app2.route = function route(
|
|
21985
|
+
app2.route = function route(path6) {
|
|
21986
21986
|
this.lazyrouter();
|
|
21987
|
-
return this._router.route(
|
|
21987
|
+
return this._router.route(path6);
|
|
21988
21988
|
};
|
|
21989
21989
|
app2.engine = function engine(ext, fn) {
|
|
21990
21990
|
if (typeof fn !== "function") {
|
|
@@ -22035,7 +22035,7 @@ var require_application = __commonJS({
|
|
|
22035
22035
|
}
|
|
22036
22036
|
return this;
|
|
22037
22037
|
};
|
|
22038
|
-
app2.path = function
|
|
22038
|
+
app2.path = function path6() {
|
|
22039
22039
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
22040
22040
|
};
|
|
22041
22041
|
app2.enabled = function enabled(setting) {
|
|
@@ -22051,19 +22051,19 @@ var require_application = __commonJS({
|
|
|
22051
22051
|
return this.set(setting, false);
|
|
22052
22052
|
};
|
|
22053
22053
|
methods.forEach(function(method) {
|
|
22054
|
-
app2[method] = function(
|
|
22054
|
+
app2[method] = function(path6) {
|
|
22055
22055
|
if (method === "get" && arguments.length === 1) {
|
|
22056
|
-
return this.set(
|
|
22056
|
+
return this.set(path6);
|
|
22057
22057
|
}
|
|
22058
22058
|
this.lazyrouter();
|
|
22059
|
-
var route = this._router.route(
|
|
22059
|
+
var route = this._router.route(path6);
|
|
22060
22060
|
route[method].apply(route, slice.call(arguments, 1));
|
|
22061
22061
|
return this;
|
|
22062
22062
|
};
|
|
22063
22063
|
});
|
|
22064
|
-
app2.all = function all(
|
|
22064
|
+
app2.all = function all(path6) {
|
|
22065
22065
|
this.lazyrouter();
|
|
22066
|
-
var route = this._router.route(
|
|
22066
|
+
var route = this._router.route(path6);
|
|
22067
22067
|
var args = slice.call(arguments, 1);
|
|
22068
22068
|
for (var i = 0; i < methods.length; i++) {
|
|
22069
22069
|
route[methods[i]].apply(route, args);
|
|
@@ -22822,7 +22822,7 @@ var require_request = __commonJS({
|
|
|
22822
22822
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
22823
22823
|
return subdomains2.slice(offset);
|
|
22824
22824
|
});
|
|
22825
|
-
defineGetter(req, "path", function
|
|
22825
|
+
defineGetter(req, "path", function path6() {
|
|
22826
22826
|
return parse3(this).pathname;
|
|
22827
22827
|
});
|
|
22828
22828
|
defineGetter(req, "hostname", function hostname3() {
|
|
@@ -23144,7 +23144,7 @@ var require_response = __commonJS({
|
|
|
23144
23144
|
var http2 = require("http");
|
|
23145
23145
|
var isAbsolute = require_utils2().isAbsolute;
|
|
23146
23146
|
var onFinished = require_on_finished();
|
|
23147
|
-
var
|
|
23147
|
+
var path6 = require("path");
|
|
23148
23148
|
var statuses = require_statuses();
|
|
23149
23149
|
var merge2 = require_utils_merge();
|
|
23150
23150
|
var sign = require_cookie_signature().sign;
|
|
@@ -23153,9 +23153,9 @@ var require_response = __commonJS({
|
|
|
23153
23153
|
var setCharset = require_utils2().setCharset;
|
|
23154
23154
|
var cookie = require_cookie();
|
|
23155
23155
|
var send = require_send();
|
|
23156
|
-
var extname =
|
|
23156
|
+
var extname = path6.extname;
|
|
23157
23157
|
var mime = send.mime;
|
|
23158
|
-
var resolve =
|
|
23158
|
+
var resolve = path6.resolve;
|
|
23159
23159
|
var vary = require_vary();
|
|
23160
23160
|
var res = Object.create(http2.ServerResponse.prototype);
|
|
23161
23161
|
module2.exports = res;
|
|
@@ -23332,26 +23332,26 @@ var require_response = __commonJS({
|
|
|
23332
23332
|
this.type("txt");
|
|
23333
23333
|
return this.send(body);
|
|
23334
23334
|
};
|
|
23335
|
-
res.sendFile = function sendFile(
|
|
23335
|
+
res.sendFile = function sendFile(path7, options, callback) {
|
|
23336
23336
|
var done = callback;
|
|
23337
23337
|
var req = this.req;
|
|
23338
23338
|
var res2 = this;
|
|
23339
23339
|
var next = req.next;
|
|
23340
23340
|
var opts = options || {};
|
|
23341
|
-
if (!
|
|
23341
|
+
if (!path7) {
|
|
23342
23342
|
throw new TypeError("path argument is required to res.sendFile");
|
|
23343
23343
|
}
|
|
23344
|
-
if (typeof
|
|
23344
|
+
if (typeof path7 !== "string") {
|
|
23345
23345
|
throw new TypeError("path must be a string to res.sendFile");
|
|
23346
23346
|
}
|
|
23347
23347
|
if (typeof options === "function") {
|
|
23348
23348
|
done = options;
|
|
23349
23349
|
opts = {};
|
|
23350
23350
|
}
|
|
23351
|
-
if (!opts.root && !isAbsolute(
|
|
23351
|
+
if (!opts.root && !isAbsolute(path7)) {
|
|
23352
23352
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
23353
23353
|
}
|
|
23354
|
-
var pathname = encodeURI(
|
|
23354
|
+
var pathname = encodeURI(path7);
|
|
23355
23355
|
var file2 = send(req, pathname, opts);
|
|
23356
23356
|
sendfile(res2, file2, opts, function(err) {
|
|
23357
23357
|
if (done) return done(err);
|
|
@@ -23361,7 +23361,7 @@ var require_response = __commonJS({
|
|
|
23361
23361
|
}
|
|
23362
23362
|
});
|
|
23363
23363
|
};
|
|
23364
|
-
res.sendfile = function(
|
|
23364
|
+
res.sendfile = function(path7, options, callback) {
|
|
23365
23365
|
var done = callback;
|
|
23366
23366
|
var req = this.req;
|
|
23367
23367
|
var res2 = this;
|
|
@@ -23371,7 +23371,7 @@ var require_response = __commonJS({
|
|
|
23371
23371
|
done = options;
|
|
23372
23372
|
opts = {};
|
|
23373
23373
|
}
|
|
23374
|
-
var file2 = send(req,
|
|
23374
|
+
var file2 = send(req, path7, opts);
|
|
23375
23375
|
sendfile(res2, file2, opts, function(err) {
|
|
23376
23376
|
if (done) return done(err);
|
|
23377
23377
|
if (err && err.code === "EISDIR") return next();
|
|
@@ -23384,7 +23384,7 @@ var require_response = __commonJS({
|
|
|
23384
23384
|
res.sendfile,
|
|
23385
23385
|
"res.sendfile: Use res.sendFile instead"
|
|
23386
23386
|
);
|
|
23387
|
-
res.download = function download(
|
|
23387
|
+
res.download = function download(path7, filename, options, callback) {
|
|
23388
23388
|
var done = callback;
|
|
23389
23389
|
var name = filename;
|
|
23390
23390
|
var opts = options || null;
|
|
@@ -23401,7 +23401,7 @@ var require_response = __commonJS({
|
|
|
23401
23401
|
opts = filename;
|
|
23402
23402
|
}
|
|
23403
23403
|
var headers = {
|
|
23404
|
-
"Content-Disposition": contentDisposition(name ||
|
|
23404
|
+
"Content-Disposition": contentDisposition(name || path7)
|
|
23405
23405
|
};
|
|
23406
23406
|
if (opts && opts.headers) {
|
|
23407
23407
|
var keys = Object.keys(opts.headers);
|
|
@@ -23414,7 +23414,7 @@ var require_response = __commonJS({
|
|
|
23414
23414
|
}
|
|
23415
23415
|
opts = Object.create(opts);
|
|
23416
23416
|
opts.headers = headers;
|
|
23417
|
-
var fullPath = !opts.root ? resolve(
|
|
23417
|
+
var fullPath = !opts.root ? resolve(path7) : path7;
|
|
23418
23418
|
return this.sendFile(fullPath, opts, done);
|
|
23419
23419
|
};
|
|
23420
23420
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -23715,11 +23715,11 @@ var require_serve_static = __commonJS({
|
|
|
23715
23715
|
}
|
|
23716
23716
|
var forwardError = !fallthrough;
|
|
23717
23717
|
var originalUrl = parseUrl.original(req);
|
|
23718
|
-
var
|
|
23719
|
-
if (
|
|
23720
|
-
|
|
23718
|
+
var path6 = parseUrl(req).pathname;
|
|
23719
|
+
if (path6 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
23720
|
+
path6 = "";
|
|
23721
23721
|
}
|
|
23722
|
-
var stream = send(req,
|
|
23722
|
+
var stream = send(req, path6, opts);
|
|
23723
23723
|
stream.on("directory", onDirectory);
|
|
23724
23724
|
if (setHeaders) {
|
|
23725
23725
|
stream.on("headers", setHeaders);
|
|
@@ -41575,11 +41575,11 @@ var require_mime_types2 = __commonJS({
|
|
|
41575
41575
|
}
|
|
41576
41576
|
return exts[0];
|
|
41577
41577
|
}
|
|
41578
|
-
function lookup(
|
|
41579
|
-
if (!
|
|
41578
|
+
function lookup(path6) {
|
|
41579
|
+
if (!path6 || typeof path6 !== "string") {
|
|
41580
41580
|
return false;
|
|
41581
41581
|
}
|
|
41582
|
-
var extension3 = extname("x." +
|
|
41582
|
+
var extension3 = extname("x." + path6).toLowerCase().slice(1);
|
|
41583
41583
|
if (!extension3) {
|
|
41584
41584
|
return false;
|
|
41585
41585
|
}
|
|
@@ -42393,13 +42393,13 @@ var require_view2 = __commonJS({
|
|
|
42393
42393
|
"node_modules/@telepath-computer/tool-router/node_modules/express/lib/view.js"(exports2, module2) {
|
|
42394
42394
|
"use strict";
|
|
42395
42395
|
var debug = require_src5()("express:view");
|
|
42396
|
-
var
|
|
42396
|
+
var path6 = require("node:path");
|
|
42397
42397
|
var fs = require("node:fs");
|
|
42398
|
-
var dirname =
|
|
42399
|
-
var basename =
|
|
42400
|
-
var extname =
|
|
42401
|
-
var join =
|
|
42402
|
-
var resolve =
|
|
42398
|
+
var dirname = path6.dirname;
|
|
42399
|
+
var basename = path6.basename;
|
|
42400
|
+
var extname = path6.extname;
|
|
42401
|
+
var join = path6.join;
|
|
42402
|
+
var resolve = path6.resolve;
|
|
42403
42403
|
module2.exports = View;
|
|
42404
42404
|
function View(name, options) {
|
|
42405
42405
|
var opts = options || {};
|
|
@@ -42428,17 +42428,17 @@ var require_view2 = __commonJS({
|
|
|
42428
42428
|
this.path = this.lookup(fileName);
|
|
42429
42429
|
}
|
|
42430
42430
|
View.prototype.lookup = function lookup(name) {
|
|
42431
|
-
var
|
|
42431
|
+
var path7;
|
|
42432
42432
|
var roots = [].concat(this.root);
|
|
42433
42433
|
debug('lookup "%s"', name);
|
|
42434
|
-
for (var i = 0; i < roots.length && !
|
|
42434
|
+
for (var i = 0; i < roots.length && !path7; i++) {
|
|
42435
42435
|
var root = roots[i];
|
|
42436
42436
|
var loc = resolve(root, name);
|
|
42437
42437
|
var dir = dirname(loc);
|
|
42438
42438
|
var file2 = basename(loc);
|
|
42439
|
-
|
|
42439
|
+
path7 = this.resolve(dir, file2);
|
|
42440
42440
|
}
|
|
42441
|
-
return
|
|
42441
|
+
return path7;
|
|
42442
42442
|
};
|
|
42443
42443
|
View.prototype.render = function render(options, callback) {
|
|
42444
42444
|
var sync = true;
|
|
@@ -42460,21 +42460,21 @@ var require_view2 = __commonJS({
|
|
|
42460
42460
|
};
|
|
42461
42461
|
View.prototype.resolve = function resolve2(dir, file2) {
|
|
42462
42462
|
var ext = this.ext;
|
|
42463
|
-
var
|
|
42464
|
-
var stat = tryStat(
|
|
42463
|
+
var path7 = join(dir, file2);
|
|
42464
|
+
var stat = tryStat(path7);
|
|
42465
42465
|
if (stat && stat.isFile()) {
|
|
42466
|
-
return
|
|
42466
|
+
return path7;
|
|
42467
42467
|
}
|
|
42468
|
-
|
|
42469
|
-
stat = tryStat(
|
|
42468
|
+
path7 = join(dir, basename(file2, ext), "index" + ext);
|
|
42469
|
+
stat = tryStat(path7);
|
|
42470
42470
|
if (stat && stat.isFile()) {
|
|
42471
|
-
return
|
|
42471
|
+
return path7;
|
|
42472
42472
|
}
|
|
42473
42473
|
};
|
|
42474
|
-
function tryStat(
|
|
42475
|
-
debug('stat "%s"',
|
|
42474
|
+
function tryStat(path7) {
|
|
42475
|
+
debug('stat "%s"', path7);
|
|
42476
42476
|
try {
|
|
42477
|
-
return fs.statSync(
|
|
42477
|
+
return fs.statSync(path7);
|
|
42478
42478
|
} catch (e) {
|
|
42479
42479
|
return void 0;
|
|
42480
42480
|
}
|
|
@@ -42790,15 +42790,15 @@ var require_dist = __commonJS({
|
|
|
42790
42790
|
if (token.type === endType)
|
|
42791
42791
|
break;
|
|
42792
42792
|
if (token.type === "char" || token.type === "escape") {
|
|
42793
|
-
let
|
|
42793
|
+
let path6 = token.value;
|
|
42794
42794
|
let cur = tokens[pos];
|
|
42795
42795
|
while (cur.type === "char" || cur.type === "escape") {
|
|
42796
|
-
|
|
42796
|
+
path6 += cur.value;
|
|
42797
42797
|
cur = tokens[++pos];
|
|
42798
42798
|
}
|
|
42799
42799
|
output.push({
|
|
42800
42800
|
type: "text",
|
|
42801
|
-
value: encodePath(
|
|
42801
|
+
value: encodePath(path6)
|
|
42802
42802
|
});
|
|
42803
42803
|
continue;
|
|
42804
42804
|
}
|
|
@@ -42822,16 +42822,16 @@ var require_dist = __commonJS({
|
|
|
42822
42822
|
}
|
|
42823
42823
|
return new TokenData(consumeUntil("end"), str);
|
|
42824
42824
|
}
|
|
42825
|
-
function compile(
|
|
42825
|
+
function compile(path6, options = {}) {
|
|
42826
42826
|
const { encode: encode3 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
42827
|
-
const data = typeof
|
|
42827
|
+
const data = typeof path6 === "object" ? path6 : parse3(path6, options);
|
|
42828
42828
|
const fn = tokensToFunction(data.tokens, delimiter, encode3);
|
|
42829
|
-
return function
|
|
42830
|
-
const [
|
|
42829
|
+
return function path7(params = {}) {
|
|
42830
|
+
const [path8, ...missing] = fn(params);
|
|
42831
42831
|
if (missing.length) {
|
|
42832
42832
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
42833
42833
|
}
|
|
42834
|
-
return
|
|
42834
|
+
return path8;
|
|
42835
42835
|
};
|
|
42836
42836
|
}
|
|
42837
42837
|
function tokensToFunction(tokens, delimiter, encode3) {
|
|
@@ -42887,9 +42887,9 @@ var require_dist = __commonJS({
|
|
|
42887
42887
|
return [encodeValue(value)];
|
|
42888
42888
|
};
|
|
42889
42889
|
}
|
|
42890
|
-
function match(
|
|
42890
|
+
function match(path6, options = {}) {
|
|
42891
42891
|
const { decode: decode3 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
42892
|
-
const { regexp, keys } = pathToRegexp(
|
|
42892
|
+
const { regexp, keys } = pathToRegexp(path6, options);
|
|
42893
42893
|
const decoders = keys.map((key) => {
|
|
42894
42894
|
if (decode3 === false)
|
|
42895
42895
|
return NOOP_VALUE;
|
|
@@ -42901,7 +42901,7 @@ var require_dist = __commonJS({
|
|
|
42901
42901
|
const m2 = regexp.exec(input);
|
|
42902
42902
|
if (!m2)
|
|
42903
42903
|
return false;
|
|
42904
|
-
const
|
|
42904
|
+
const path7 = m2[0];
|
|
42905
42905
|
const params = /* @__PURE__ */ Object.create(null);
|
|
42906
42906
|
for (let i = 1; i < m2.length; i++) {
|
|
42907
42907
|
if (m2[i] === void 0)
|
|
@@ -42910,22 +42910,22 @@ var require_dist = __commonJS({
|
|
|
42910
42910
|
const decoder = decoders[i - 1];
|
|
42911
42911
|
params[key.name] = decoder(m2[i]);
|
|
42912
42912
|
}
|
|
42913
|
-
return { path:
|
|
42913
|
+
return { path: path7, params };
|
|
42914
42914
|
};
|
|
42915
42915
|
}
|
|
42916
|
-
function pathToRegexp(
|
|
42916
|
+
function pathToRegexp(path6, options = {}) {
|
|
42917
42917
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
42918
42918
|
const keys = [];
|
|
42919
42919
|
const sources = [];
|
|
42920
|
-
const paths = [
|
|
42920
|
+
const paths = [path6];
|
|
42921
42921
|
let combinations = 0;
|
|
42922
42922
|
while (paths.length) {
|
|
42923
|
-
const
|
|
42924
|
-
if (Array.isArray(
|
|
42925
|
-
paths.push(...
|
|
42923
|
+
const path7 = paths.shift();
|
|
42924
|
+
if (Array.isArray(path7)) {
|
|
42925
|
+
paths.push(...path7);
|
|
42926
42926
|
continue;
|
|
42927
42927
|
}
|
|
42928
|
-
const data = typeof
|
|
42928
|
+
const data = typeof path7 === "object" ? path7 : parse3(path7, options);
|
|
42929
42929
|
flatten(data.tokens, 0, [], (tokens) => {
|
|
42930
42930
|
if (combinations++ >= 256) {
|
|
42931
42931
|
throw new PathError("Too many path combinations", data.originalPath);
|
|
@@ -43070,18 +43070,18 @@ var require_layer2 = __commonJS({
|
|
|
43070
43070
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
43071
43071
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
43072
43072
|
module2.exports = Layer;
|
|
43073
|
-
function Layer(
|
|
43073
|
+
function Layer(path6, options, fn) {
|
|
43074
43074
|
if (!(this instanceof Layer)) {
|
|
43075
|
-
return new Layer(
|
|
43075
|
+
return new Layer(path6, options, fn);
|
|
43076
43076
|
}
|
|
43077
|
-
debug("new %o",
|
|
43077
|
+
debug("new %o", path6);
|
|
43078
43078
|
const opts = options || {};
|
|
43079
43079
|
this.handle = fn;
|
|
43080
43080
|
this.keys = [];
|
|
43081
43081
|
this.name = fn.name || "<anonymous>";
|
|
43082
43082
|
this.params = void 0;
|
|
43083
43083
|
this.path = void 0;
|
|
43084
|
-
this.slash =
|
|
43084
|
+
this.slash = path6 === "/" && opts.end === false;
|
|
43085
43085
|
function matcher(_path) {
|
|
43086
43086
|
if (_path instanceof RegExp) {
|
|
43087
43087
|
const keys = [];
|
|
@@ -43120,7 +43120,7 @@ var require_layer2 = __commonJS({
|
|
|
43120
43120
|
decode: decodeParam
|
|
43121
43121
|
});
|
|
43122
43122
|
}
|
|
43123
|
-
this.matchers = Array.isArray(
|
|
43123
|
+
this.matchers = Array.isArray(path6) ? path6.map(matcher) : [matcher(path6)];
|
|
43124
43124
|
}
|
|
43125
43125
|
Layer.prototype.handleError = function handleError(error2, req, res, next) {
|
|
43126
43126
|
const fn = this.handle;
|
|
@@ -43160,9 +43160,9 @@ var require_layer2 = __commonJS({
|
|
|
43160
43160
|
next(err);
|
|
43161
43161
|
}
|
|
43162
43162
|
};
|
|
43163
|
-
Layer.prototype.match = function match(
|
|
43163
|
+
Layer.prototype.match = function match(path6) {
|
|
43164
43164
|
let match2;
|
|
43165
|
-
if (
|
|
43165
|
+
if (path6 != null) {
|
|
43166
43166
|
if (this.slash) {
|
|
43167
43167
|
this.params = {};
|
|
43168
43168
|
this.path = "";
|
|
@@ -43170,7 +43170,7 @@ var require_layer2 = __commonJS({
|
|
|
43170
43170
|
}
|
|
43171
43171
|
let i = 0;
|
|
43172
43172
|
while (!match2 && i < this.matchers.length) {
|
|
43173
|
-
match2 = this.matchers[i](
|
|
43173
|
+
match2 = this.matchers[i](path6);
|
|
43174
43174
|
i++;
|
|
43175
43175
|
}
|
|
43176
43176
|
}
|
|
@@ -43198,13 +43198,13 @@ var require_layer2 = __commonJS({
|
|
|
43198
43198
|
throw err;
|
|
43199
43199
|
}
|
|
43200
43200
|
}
|
|
43201
|
-
function loosen(
|
|
43202
|
-
if (
|
|
43203
|
-
return
|
|
43201
|
+
function loosen(path6) {
|
|
43202
|
+
if (path6 instanceof RegExp || path6 === "/") {
|
|
43203
|
+
return path6;
|
|
43204
43204
|
}
|
|
43205
|
-
return Array.isArray(
|
|
43205
|
+
return Array.isArray(path6) ? path6.map(function(p) {
|
|
43206
43206
|
return loosen(p);
|
|
43207
|
-
}) : String(
|
|
43207
|
+
}) : String(path6).replace(TRAILING_SLASH_REGEXP, "");
|
|
43208
43208
|
}
|
|
43209
43209
|
}
|
|
43210
43210
|
});
|
|
@@ -43220,9 +43220,9 @@ var require_route2 = __commonJS({
|
|
|
43220
43220
|
var flatten = Array.prototype.flat;
|
|
43221
43221
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
43222
43222
|
module2.exports = Route;
|
|
43223
|
-
function Route(
|
|
43224
|
-
debug("new %o",
|
|
43225
|
-
this.path =
|
|
43223
|
+
function Route(path6) {
|
|
43224
|
+
debug("new %o", path6);
|
|
43225
|
+
this.path = path6;
|
|
43226
43226
|
this.stack = [];
|
|
43227
43227
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
43228
43228
|
}
|
|
@@ -43430,8 +43430,8 @@ var require_router2 = __commonJS({
|
|
|
43430
43430
|
if (++sync > 100) {
|
|
43431
43431
|
return setImmediate(next, err);
|
|
43432
43432
|
}
|
|
43433
|
-
const
|
|
43434
|
-
if (
|
|
43433
|
+
const path6 = getPathname(req);
|
|
43434
|
+
if (path6 == null) {
|
|
43435
43435
|
return done(layerError);
|
|
43436
43436
|
}
|
|
43437
43437
|
let layer;
|
|
@@ -43439,7 +43439,7 @@ var require_router2 = __commonJS({
|
|
|
43439
43439
|
let route;
|
|
43440
43440
|
while (match !== true && idx < stack.length) {
|
|
43441
43441
|
layer = stack[idx++];
|
|
43442
|
-
match = matchLayer(layer,
|
|
43442
|
+
match = matchLayer(layer, path6);
|
|
43443
43443
|
route = layer.route;
|
|
43444
43444
|
if (typeof match !== "boolean") {
|
|
43445
43445
|
layerError = layerError || match;
|
|
@@ -43477,18 +43477,18 @@ var require_router2 = __commonJS({
|
|
|
43477
43477
|
} else if (route) {
|
|
43478
43478
|
layer.handleRequest(req, res, next);
|
|
43479
43479
|
} else {
|
|
43480
|
-
trimPrefix(layer, layerError, layerPath,
|
|
43480
|
+
trimPrefix(layer, layerError, layerPath, path6);
|
|
43481
43481
|
}
|
|
43482
43482
|
sync = 0;
|
|
43483
43483
|
});
|
|
43484
43484
|
}
|
|
43485
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
43485
|
+
function trimPrefix(layer, layerError, layerPath, path6) {
|
|
43486
43486
|
if (layerPath.length !== 0) {
|
|
43487
|
-
if (layerPath !==
|
|
43487
|
+
if (layerPath !== path6.substring(0, layerPath.length)) {
|
|
43488
43488
|
next(layerError);
|
|
43489
43489
|
return;
|
|
43490
43490
|
}
|
|
43491
|
-
const c =
|
|
43491
|
+
const c = path6[layerPath.length];
|
|
43492
43492
|
if (c && c !== "/") {
|
|
43493
43493
|
next(layerError);
|
|
43494
43494
|
return;
|
|
@@ -43512,7 +43512,7 @@ var require_router2 = __commonJS({
|
|
|
43512
43512
|
};
|
|
43513
43513
|
Router2.prototype.use = function use(handler) {
|
|
43514
43514
|
let offset = 0;
|
|
43515
|
-
let
|
|
43515
|
+
let path6 = "/";
|
|
43516
43516
|
if (typeof handler !== "function") {
|
|
43517
43517
|
let arg = handler;
|
|
43518
43518
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -43520,7 +43520,7 @@ var require_router2 = __commonJS({
|
|
|
43520
43520
|
}
|
|
43521
43521
|
if (typeof arg !== "function") {
|
|
43522
43522
|
offset = 1;
|
|
43523
|
-
|
|
43523
|
+
path6 = handler;
|
|
43524
43524
|
}
|
|
43525
43525
|
}
|
|
43526
43526
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -43532,8 +43532,8 @@ var require_router2 = __commonJS({
|
|
|
43532
43532
|
if (typeof fn !== "function") {
|
|
43533
43533
|
throw new TypeError("argument handler must be a function");
|
|
43534
43534
|
}
|
|
43535
|
-
debug("use %o %s",
|
|
43536
|
-
const layer = new Layer(
|
|
43535
|
+
debug("use %o %s", path6, fn.name || "<anonymous>");
|
|
43536
|
+
const layer = new Layer(path6, {
|
|
43537
43537
|
sensitive: this.caseSensitive,
|
|
43538
43538
|
strict: false,
|
|
43539
43539
|
end: false
|
|
@@ -43543,9 +43543,9 @@ var require_router2 = __commonJS({
|
|
|
43543
43543
|
}
|
|
43544
43544
|
return this;
|
|
43545
43545
|
};
|
|
43546
|
-
Router2.prototype.route = function route(
|
|
43547
|
-
const route2 = new Route(
|
|
43548
|
-
const layer = new Layer(
|
|
43546
|
+
Router2.prototype.route = function route(path6) {
|
|
43547
|
+
const route2 = new Route(path6);
|
|
43548
|
+
const layer = new Layer(path6, {
|
|
43549
43549
|
sensitive: this.caseSensitive,
|
|
43550
43550
|
strict: this.strict,
|
|
43551
43551
|
end: true
|
|
@@ -43558,8 +43558,8 @@ var require_router2 = __commonJS({
|
|
|
43558
43558
|
return route2;
|
|
43559
43559
|
};
|
|
43560
43560
|
methods.concat("all").forEach(function(method) {
|
|
43561
|
-
Router2.prototype[method] = function(
|
|
43562
|
-
const route = this.route(
|
|
43561
|
+
Router2.prototype[method] = function(path6) {
|
|
43562
|
+
const route = this.route(path6);
|
|
43563
43563
|
route[method].apply(route, slice.call(arguments, 1));
|
|
43564
43564
|
return this;
|
|
43565
43565
|
};
|
|
@@ -43588,9 +43588,9 @@ var require_router2 = __commonJS({
|
|
|
43588
43588
|
const fqdnIndex = url2.substring(0, pathLength).indexOf("://");
|
|
43589
43589
|
return fqdnIndex !== -1 ? url2.substring(0, url2.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
43590
43590
|
}
|
|
43591
|
-
function matchLayer(layer,
|
|
43591
|
+
function matchLayer(layer, path6) {
|
|
43592
43592
|
try {
|
|
43593
|
-
return layer.match(
|
|
43593
|
+
return layer.match(path6);
|
|
43594
43594
|
} catch (err) {
|
|
43595
43595
|
return err;
|
|
43596
43596
|
}
|
|
@@ -43818,7 +43818,7 @@ var require_application2 = __commonJS({
|
|
|
43818
43818
|
};
|
|
43819
43819
|
app2.use = function use(fn) {
|
|
43820
43820
|
var offset = 0;
|
|
43821
|
-
var
|
|
43821
|
+
var path6 = "/";
|
|
43822
43822
|
if (typeof fn !== "function") {
|
|
43823
43823
|
var arg = fn;
|
|
43824
43824
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -43826,7 +43826,7 @@ var require_application2 = __commonJS({
|
|
|
43826
43826
|
}
|
|
43827
43827
|
if (typeof arg !== "function") {
|
|
43828
43828
|
offset = 1;
|
|
43829
|
-
|
|
43829
|
+
path6 = fn;
|
|
43830
43830
|
}
|
|
43831
43831
|
}
|
|
43832
43832
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -43836,12 +43836,12 @@ var require_application2 = __commonJS({
|
|
|
43836
43836
|
var router = this.router;
|
|
43837
43837
|
fns.forEach(function(fn2) {
|
|
43838
43838
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
43839
|
-
return router.use(
|
|
43839
|
+
return router.use(path6, fn2);
|
|
43840
43840
|
}
|
|
43841
|
-
debug(".use app under %s",
|
|
43842
|
-
fn2.mountpath =
|
|
43841
|
+
debug(".use app under %s", path6);
|
|
43842
|
+
fn2.mountpath = path6;
|
|
43843
43843
|
fn2.parent = this;
|
|
43844
|
-
router.use(
|
|
43844
|
+
router.use(path6, function mounted_app(req, res, next) {
|
|
43845
43845
|
var orig = req.app;
|
|
43846
43846
|
fn2.handle(req, res, function(err) {
|
|
43847
43847
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -43853,8 +43853,8 @@ var require_application2 = __commonJS({
|
|
|
43853
43853
|
}, this);
|
|
43854
43854
|
return this;
|
|
43855
43855
|
};
|
|
43856
|
-
app2.route = function route(
|
|
43857
|
-
return this.router.route(
|
|
43856
|
+
app2.route = function route(path6) {
|
|
43857
|
+
return this.router.route(path6);
|
|
43858
43858
|
};
|
|
43859
43859
|
app2.engine = function engine(ext, fn) {
|
|
43860
43860
|
if (typeof fn !== "function") {
|
|
@@ -43897,7 +43897,7 @@ var require_application2 = __commonJS({
|
|
|
43897
43897
|
}
|
|
43898
43898
|
return this;
|
|
43899
43899
|
};
|
|
43900
|
-
app2.path = function
|
|
43900
|
+
app2.path = function path6() {
|
|
43901
43901
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
43902
43902
|
};
|
|
43903
43903
|
app2.enabled = function enabled(setting) {
|
|
@@ -43913,17 +43913,17 @@ var require_application2 = __commonJS({
|
|
|
43913
43913
|
return this.set(setting, false);
|
|
43914
43914
|
};
|
|
43915
43915
|
methods.forEach(function(method) {
|
|
43916
|
-
app2[method] = function(
|
|
43916
|
+
app2[method] = function(path6) {
|
|
43917
43917
|
if (method === "get" && arguments.length === 1) {
|
|
43918
|
-
return this.set(
|
|
43918
|
+
return this.set(path6);
|
|
43919
43919
|
}
|
|
43920
|
-
var route = this.route(
|
|
43920
|
+
var route = this.route(path6);
|
|
43921
43921
|
route[method].apply(route, slice.call(arguments, 1));
|
|
43922
43922
|
return this;
|
|
43923
43923
|
};
|
|
43924
43924
|
});
|
|
43925
|
-
app2.all = function all(
|
|
43926
|
-
var route = this.route(
|
|
43925
|
+
app2.all = function all(path6) {
|
|
43926
|
+
var route = this.route(path6);
|
|
43927
43927
|
var args = slice.call(arguments, 1);
|
|
43928
43928
|
for (var i = 0; i < methods.length; i++) {
|
|
43929
43929
|
route[methods[i]].apply(route, args);
|
|
@@ -44752,7 +44752,7 @@ var require_request2 = __commonJS({
|
|
|
44752
44752
|
var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
|
|
44753
44753
|
return subdomains2.slice(offset);
|
|
44754
44754
|
});
|
|
44755
|
-
defineGetter(req, "path", function
|
|
44755
|
+
defineGetter(req, "path", function path6() {
|
|
44756
44756
|
return parse3(this).pathname;
|
|
44757
44757
|
});
|
|
44758
44758
|
defineGetter(req, "host", function host() {
|
|
@@ -44998,27 +44998,27 @@ var require_send2 = __commonJS({
|
|
|
44998
44998
|
var ms = require_ms5();
|
|
44999
44999
|
var onFinished = require_on_finished();
|
|
45000
45000
|
var parseRange = require_range_parser();
|
|
45001
|
-
var
|
|
45001
|
+
var path6 = require("path");
|
|
45002
45002
|
var statuses = require_statuses();
|
|
45003
45003
|
var Stream = require("stream");
|
|
45004
45004
|
var util2 = require("util");
|
|
45005
|
-
var extname =
|
|
45006
|
-
var join =
|
|
45007
|
-
var normalize =
|
|
45008
|
-
var resolve =
|
|
45009
|
-
var sep =
|
|
45005
|
+
var extname = path6.extname;
|
|
45006
|
+
var join = path6.join;
|
|
45007
|
+
var normalize = path6.normalize;
|
|
45008
|
+
var resolve = path6.resolve;
|
|
45009
|
+
var sep = path6.sep;
|
|
45010
45010
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
45011
45011
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
45012
45012
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
45013
45013
|
module2.exports = send;
|
|
45014
|
-
function send(req,
|
|
45015
|
-
return new SendStream(req,
|
|
45014
|
+
function send(req, path7, options) {
|
|
45015
|
+
return new SendStream(req, path7, options);
|
|
45016
45016
|
}
|
|
45017
|
-
function SendStream(req,
|
|
45017
|
+
function SendStream(req, path7, options) {
|
|
45018
45018
|
Stream.call(this);
|
|
45019
45019
|
var opts = options || {};
|
|
45020
45020
|
this.options = opts;
|
|
45021
|
-
this.path =
|
|
45021
|
+
this.path = path7;
|
|
45022
45022
|
this.req = req;
|
|
45023
45023
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
45024
45024
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -45132,10 +45132,10 @@ var require_send2 = __commonJS({
|
|
|
45132
45132
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
45133
45133
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
45134
45134
|
};
|
|
45135
|
-
SendStream.prototype.redirect = function redirect(
|
|
45135
|
+
SendStream.prototype.redirect = function redirect(path7) {
|
|
45136
45136
|
var res = this.res;
|
|
45137
45137
|
if (hasListeners(this, "directory")) {
|
|
45138
|
-
this.emit("directory", res,
|
|
45138
|
+
this.emit("directory", res, path7);
|
|
45139
45139
|
return;
|
|
45140
45140
|
}
|
|
45141
45141
|
if (this.hasTrailingSlash()) {
|
|
@@ -45155,38 +45155,38 @@ var require_send2 = __commonJS({
|
|
|
45155
45155
|
SendStream.prototype.pipe = function pipe2(res) {
|
|
45156
45156
|
var root = this._root;
|
|
45157
45157
|
this.res = res;
|
|
45158
|
-
var
|
|
45159
|
-
if (
|
|
45158
|
+
var path7 = decode3(this.path);
|
|
45159
|
+
if (path7 === -1) {
|
|
45160
45160
|
this.error(400);
|
|
45161
45161
|
return res;
|
|
45162
45162
|
}
|
|
45163
|
-
if (~
|
|
45163
|
+
if (~path7.indexOf("\0")) {
|
|
45164
45164
|
this.error(400);
|
|
45165
45165
|
return res;
|
|
45166
45166
|
}
|
|
45167
45167
|
var parts;
|
|
45168
45168
|
if (root !== null) {
|
|
45169
|
-
if (
|
|
45170
|
-
|
|
45169
|
+
if (path7) {
|
|
45170
|
+
path7 = normalize("." + sep + path7);
|
|
45171
45171
|
}
|
|
45172
|
-
if (UP_PATH_REGEXP.test(
|
|
45173
|
-
debug('malicious path "%s"',
|
|
45172
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
45173
|
+
debug('malicious path "%s"', path7);
|
|
45174
45174
|
this.error(403);
|
|
45175
45175
|
return res;
|
|
45176
45176
|
}
|
|
45177
|
-
parts =
|
|
45178
|
-
|
|
45177
|
+
parts = path7.split(sep);
|
|
45178
|
+
path7 = normalize(join(root, path7));
|
|
45179
45179
|
} else {
|
|
45180
|
-
if (UP_PATH_REGEXP.test(
|
|
45181
|
-
debug('malicious path "%s"',
|
|
45180
|
+
if (UP_PATH_REGEXP.test(path7)) {
|
|
45181
|
+
debug('malicious path "%s"', path7);
|
|
45182
45182
|
this.error(403);
|
|
45183
45183
|
return res;
|
|
45184
45184
|
}
|
|
45185
|
-
parts = normalize(
|
|
45186
|
-
|
|
45185
|
+
parts = normalize(path7).split(sep);
|
|
45186
|
+
path7 = resolve(path7);
|
|
45187
45187
|
}
|
|
45188
45188
|
if (containsDotFile(parts)) {
|
|
45189
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
45189
|
+
debug('%s dotfile "%s"', this._dotfiles, path7);
|
|
45190
45190
|
switch (this._dotfiles) {
|
|
45191
45191
|
case "allow":
|
|
45192
45192
|
break;
|
|
@@ -45200,13 +45200,13 @@ var require_send2 = __commonJS({
|
|
|
45200
45200
|
}
|
|
45201
45201
|
}
|
|
45202
45202
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
45203
|
-
this.sendIndex(
|
|
45203
|
+
this.sendIndex(path7);
|
|
45204
45204
|
return res;
|
|
45205
45205
|
}
|
|
45206
|
-
this.sendFile(
|
|
45206
|
+
this.sendFile(path7);
|
|
45207
45207
|
return res;
|
|
45208
45208
|
};
|
|
45209
|
-
SendStream.prototype.send = function send2(
|
|
45209
|
+
SendStream.prototype.send = function send2(path7, stat) {
|
|
45210
45210
|
var len = stat.size;
|
|
45211
45211
|
var options = this.options;
|
|
45212
45212
|
var opts = {};
|
|
@@ -45218,9 +45218,9 @@ var require_send2 = __commonJS({
|
|
|
45218
45218
|
this.headersAlreadySent();
|
|
45219
45219
|
return;
|
|
45220
45220
|
}
|
|
45221
|
-
debug('pipe "%s"',
|
|
45222
|
-
this.setHeader(
|
|
45223
|
-
this.type(
|
|
45221
|
+
debug('pipe "%s"', path7);
|
|
45222
|
+
this.setHeader(path7, stat);
|
|
45223
|
+
this.type(path7);
|
|
45224
45224
|
if (this.isConditionalGET()) {
|
|
45225
45225
|
if (this.isPreconditionFailure()) {
|
|
45226
45226
|
this.error(412);
|
|
@@ -45269,28 +45269,28 @@ var require_send2 = __commonJS({
|
|
|
45269
45269
|
res.end();
|
|
45270
45270
|
return;
|
|
45271
45271
|
}
|
|
45272
|
-
this.stream(
|
|
45272
|
+
this.stream(path7, opts);
|
|
45273
45273
|
};
|
|
45274
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
45274
|
+
SendStream.prototype.sendFile = function sendFile(path7) {
|
|
45275
45275
|
var i = 0;
|
|
45276
45276
|
var self2 = this;
|
|
45277
|
-
debug('stat "%s"',
|
|
45278
|
-
fs.stat(
|
|
45279
|
-
var pathEndsWithSep =
|
|
45280
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
45277
|
+
debug('stat "%s"', path7);
|
|
45278
|
+
fs.stat(path7, function onstat(err, stat) {
|
|
45279
|
+
var pathEndsWithSep = path7[path7.length - 1] === sep;
|
|
45280
|
+
if (err && err.code === "ENOENT" && !extname(path7) && !pathEndsWithSep) {
|
|
45281
45281
|
return next(err);
|
|
45282
45282
|
}
|
|
45283
45283
|
if (err) return self2.onStatError(err);
|
|
45284
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
45284
|
+
if (stat.isDirectory()) return self2.redirect(path7);
|
|
45285
45285
|
if (pathEndsWithSep) return self2.error(404);
|
|
45286
|
-
self2.emit("file",
|
|
45287
|
-
self2.send(
|
|
45286
|
+
self2.emit("file", path7, stat);
|
|
45287
|
+
self2.send(path7, stat);
|
|
45288
45288
|
});
|
|
45289
45289
|
function next(err) {
|
|
45290
45290
|
if (self2._extensions.length <= i) {
|
|
45291
45291
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
45292
45292
|
}
|
|
45293
|
-
var p =
|
|
45293
|
+
var p = path7 + "." + self2._extensions[i++];
|
|
45294
45294
|
debug('stat "%s"', p);
|
|
45295
45295
|
fs.stat(p, function(err2, stat) {
|
|
45296
45296
|
if (err2) return next(err2);
|
|
@@ -45300,7 +45300,7 @@ var require_send2 = __commonJS({
|
|
|
45300
45300
|
});
|
|
45301
45301
|
}
|
|
45302
45302
|
};
|
|
45303
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
45303
|
+
SendStream.prototype.sendIndex = function sendIndex(path7) {
|
|
45304
45304
|
var i = -1;
|
|
45305
45305
|
var self2 = this;
|
|
45306
45306
|
function next(err) {
|
|
@@ -45308,7 +45308,7 @@ var require_send2 = __commonJS({
|
|
|
45308
45308
|
if (err) return self2.onStatError(err);
|
|
45309
45309
|
return self2.error(404);
|
|
45310
45310
|
}
|
|
45311
|
-
var p = join(
|
|
45311
|
+
var p = join(path7, self2._index[i]);
|
|
45312
45312
|
debug('stat "%s"', p);
|
|
45313
45313
|
fs.stat(p, function(err2, stat) {
|
|
45314
45314
|
if (err2) return next(err2);
|
|
@@ -45319,10 +45319,10 @@ var require_send2 = __commonJS({
|
|
|
45319
45319
|
}
|
|
45320
45320
|
next();
|
|
45321
45321
|
};
|
|
45322
|
-
SendStream.prototype.stream = function stream(
|
|
45322
|
+
SendStream.prototype.stream = function stream(path7, options) {
|
|
45323
45323
|
var self2 = this;
|
|
45324
45324
|
var res = this.res;
|
|
45325
|
-
var stream2 = fs.createReadStream(
|
|
45325
|
+
var stream2 = fs.createReadStream(path7, options);
|
|
45326
45326
|
this.emit("stream", stream2);
|
|
45327
45327
|
stream2.pipe(res);
|
|
45328
45328
|
function cleanup() {
|
|
@@ -45337,17 +45337,17 @@ var require_send2 = __commonJS({
|
|
|
45337
45337
|
self2.emit("end");
|
|
45338
45338
|
});
|
|
45339
45339
|
};
|
|
45340
|
-
SendStream.prototype.type = function type(
|
|
45340
|
+
SendStream.prototype.type = function type(path7) {
|
|
45341
45341
|
var res = this.res;
|
|
45342
45342
|
if (res.getHeader("Content-Type")) return;
|
|
45343
|
-
var ext = extname(
|
|
45343
|
+
var ext = extname(path7);
|
|
45344
45344
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
45345
45345
|
debug("content-type %s", type2);
|
|
45346
45346
|
res.setHeader("Content-Type", type2);
|
|
45347
45347
|
};
|
|
45348
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
45348
|
+
SendStream.prototype.setHeader = function setHeader(path7, stat) {
|
|
45349
45349
|
var res = this.res;
|
|
45350
|
-
this.emit("headers", res,
|
|
45350
|
+
this.emit("headers", res, path7, stat);
|
|
45351
45351
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
45352
45352
|
debug("accept ranges");
|
|
45353
45353
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -45405,9 +45405,9 @@ var require_send2 = __commonJS({
|
|
|
45405
45405
|
}
|
|
45406
45406
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
45407
45407
|
}
|
|
45408
|
-
function decode3(
|
|
45408
|
+
function decode3(path7) {
|
|
45409
45409
|
try {
|
|
45410
|
-
return decodeURIComponent(
|
|
45410
|
+
return decodeURIComponent(path7);
|
|
45411
45411
|
} catch (err) {
|
|
45412
45412
|
return -1;
|
|
45413
45413
|
}
|
|
@@ -45478,7 +45478,7 @@ var require_response2 = __commonJS({
|
|
|
45478
45478
|
var http2 = require("node:http");
|
|
45479
45479
|
var onFinished = require_on_finished();
|
|
45480
45480
|
var mime = require_mime_types2();
|
|
45481
|
-
var
|
|
45481
|
+
var path6 = require("node:path");
|
|
45482
45482
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
45483
45483
|
var statuses = require_statuses();
|
|
45484
45484
|
var sign = require_cookie_signature2().sign;
|
|
@@ -45487,8 +45487,8 @@ var require_response2 = __commonJS({
|
|
|
45487
45487
|
var setCharset = require_utils4().setCharset;
|
|
45488
45488
|
var cookie = require_cookie();
|
|
45489
45489
|
var send = require_send2();
|
|
45490
|
-
var extname =
|
|
45491
|
-
var resolve =
|
|
45490
|
+
var extname = path6.extname;
|
|
45491
|
+
var resolve = path6.resolve;
|
|
45492
45492
|
var vary = require_vary();
|
|
45493
45493
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
45494
45494
|
var res = Object.create(http2.ServerResponse.prototype);
|
|
@@ -45634,26 +45634,26 @@ var require_response2 = __commonJS({
|
|
|
45634
45634
|
this.type("txt");
|
|
45635
45635
|
return this.send(body);
|
|
45636
45636
|
};
|
|
45637
|
-
res.sendFile = function sendFile(
|
|
45637
|
+
res.sendFile = function sendFile(path7, options, callback) {
|
|
45638
45638
|
var done = callback;
|
|
45639
45639
|
var req = this.req;
|
|
45640
45640
|
var res2 = this;
|
|
45641
45641
|
var next = req.next;
|
|
45642
45642
|
var opts = options || {};
|
|
45643
|
-
if (!
|
|
45643
|
+
if (!path7) {
|
|
45644
45644
|
throw new TypeError("path argument is required to res.sendFile");
|
|
45645
45645
|
}
|
|
45646
|
-
if (typeof
|
|
45646
|
+
if (typeof path7 !== "string") {
|
|
45647
45647
|
throw new TypeError("path must be a string to res.sendFile");
|
|
45648
45648
|
}
|
|
45649
45649
|
if (typeof options === "function") {
|
|
45650
45650
|
done = options;
|
|
45651
45651
|
opts = {};
|
|
45652
45652
|
}
|
|
45653
|
-
if (!opts.root && !pathIsAbsolute(
|
|
45653
|
+
if (!opts.root && !pathIsAbsolute(path7)) {
|
|
45654
45654
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
45655
45655
|
}
|
|
45656
|
-
var pathname = encodeURI(
|
|
45656
|
+
var pathname = encodeURI(path7);
|
|
45657
45657
|
opts.etag = this.app.enabled("etag");
|
|
45658
45658
|
var file2 = send(req, pathname, opts);
|
|
45659
45659
|
sendfile(res2, file2, opts, function(err) {
|
|
@@ -45664,7 +45664,7 @@ var require_response2 = __commonJS({
|
|
|
45664
45664
|
}
|
|
45665
45665
|
});
|
|
45666
45666
|
};
|
|
45667
|
-
res.download = function download(
|
|
45667
|
+
res.download = function download(path7, filename, options, callback) {
|
|
45668
45668
|
var done = callback;
|
|
45669
45669
|
var name = filename;
|
|
45670
45670
|
var opts = options || null;
|
|
@@ -45681,7 +45681,7 @@ var require_response2 = __commonJS({
|
|
|
45681
45681
|
opts = filename;
|
|
45682
45682
|
}
|
|
45683
45683
|
var headers = {
|
|
45684
|
-
"Content-Disposition": contentDisposition(name ||
|
|
45684
|
+
"Content-Disposition": contentDisposition(name || path7)
|
|
45685
45685
|
};
|
|
45686
45686
|
if (opts && opts.headers) {
|
|
45687
45687
|
var keys = Object.keys(opts.headers);
|
|
@@ -45694,7 +45694,7 @@ var require_response2 = __commonJS({
|
|
|
45694
45694
|
}
|
|
45695
45695
|
opts = Object.create(opts);
|
|
45696
45696
|
opts.headers = headers;
|
|
45697
|
-
var fullPath = !opts.root ? resolve(
|
|
45697
|
+
var fullPath = !opts.root ? resolve(path7) : path7;
|
|
45698
45698
|
return this.sendFile(fullPath, opts, done);
|
|
45699
45699
|
};
|
|
45700
45700
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -45977,11 +45977,11 @@ var require_serve_static2 = __commonJS({
|
|
|
45977
45977
|
}
|
|
45978
45978
|
var forwardError = !fallthrough;
|
|
45979
45979
|
var originalUrl = parseUrl.original(req);
|
|
45980
|
-
var
|
|
45981
|
-
if (
|
|
45982
|
-
|
|
45980
|
+
var path6 = parseUrl(req).pathname;
|
|
45981
|
+
if (path6 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
45982
|
+
path6 = "";
|
|
45983
45983
|
}
|
|
45984
|
-
var stream = send(req,
|
|
45984
|
+
var stream = send(req, path6, opts);
|
|
45985
45985
|
stream.on("directory", onDirectory);
|
|
45986
45986
|
if (setHeaders) {
|
|
45987
45987
|
stream.on("headers", setHeaders);
|
|
@@ -49281,8 +49281,8 @@ var require_utils5 = __commonJS({
|
|
|
49281
49281
|
}
|
|
49282
49282
|
return ind;
|
|
49283
49283
|
}
|
|
49284
|
-
function removeDotSegments(
|
|
49285
|
-
let input =
|
|
49284
|
+
function removeDotSegments(path6) {
|
|
49285
|
+
let input = path6;
|
|
49286
49286
|
const output = [];
|
|
49287
49287
|
let nextSlash = -1;
|
|
49288
49288
|
let len = 0;
|
|
@@ -49481,8 +49481,8 @@ var require_schemes = __commonJS({
|
|
|
49481
49481
|
wsComponent.secure = void 0;
|
|
49482
49482
|
}
|
|
49483
49483
|
if (wsComponent.resourceName) {
|
|
49484
|
-
const [
|
|
49485
|
-
wsComponent.path =
|
|
49484
|
+
const [path6, query] = wsComponent.resourceName.split("?");
|
|
49485
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
|
|
49486
49486
|
wsComponent.query = query;
|
|
49487
49487
|
wsComponent.resourceName = void 0;
|
|
49488
49488
|
}
|
|
@@ -56481,7 +56481,7 @@ __export(index_exports, {
|
|
|
56481
56481
|
});
|
|
56482
56482
|
module.exports = __toCommonJS(index_exports);
|
|
56483
56483
|
var import_electron = require("electron");
|
|
56484
|
-
var
|
|
56484
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
56485
56485
|
|
|
56486
56486
|
// src/config.ts
|
|
56487
56487
|
var import_node_os = __toESM(require("node:os"), 1);
|
|
@@ -56882,8 +56882,8 @@ function getErrorMap() {
|
|
|
56882
56882
|
|
|
56883
56883
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
56884
56884
|
var makeIssue = (params) => {
|
|
56885
|
-
const { data, path:
|
|
56886
|
-
const fullPath = [...
|
|
56885
|
+
const { data, path: path6, errorMaps, issueData } = params;
|
|
56886
|
+
const fullPath = [...path6, ...issueData.path || []];
|
|
56887
56887
|
const fullIssue = {
|
|
56888
56888
|
...issueData,
|
|
56889
56889
|
path: fullPath
|
|
@@ -56998,11 +56998,11 @@ var errorUtil;
|
|
|
56998
56998
|
|
|
56999
56999
|
// node_modules/zod/v3/types.js
|
|
57000
57000
|
var ParseInputLazyPath = class {
|
|
57001
|
-
constructor(parent, value,
|
|
57001
|
+
constructor(parent, value, path6, key) {
|
|
57002
57002
|
this._cachedPath = [];
|
|
57003
57003
|
this.parent = parent;
|
|
57004
57004
|
this.data = value;
|
|
57005
|
-
this._path =
|
|
57005
|
+
this._path = path6;
|
|
57006
57006
|
this._key = key;
|
|
57007
57007
|
}
|
|
57008
57008
|
get path() {
|
|
@@ -60648,10 +60648,10 @@ function mergeDefs(...defs) {
|
|
|
60648
60648
|
function cloneDef(schema) {
|
|
60649
60649
|
return mergeDefs(schema._zod.def);
|
|
60650
60650
|
}
|
|
60651
|
-
function getElementAtPath(obj,
|
|
60652
|
-
if (!
|
|
60651
|
+
function getElementAtPath(obj, path6) {
|
|
60652
|
+
if (!path6)
|
|
60653
60653
|
return obj;
|
|
60654
|
-
return
|
|
60654
|
+
return path6.reduce((acc, key) => acc?.[key], obj);
|
|
60655
60655
|
}
|
|
60656
60656
|
function promiseAllObject(promisesObj) {
|
|
60657
60657
|
const keys = Object.keys(promisesObj);
|
|
@@ -61034,11 +61034,11 @@ function aborted(x2, startIndex = 0) {
|
|
|
61034
61034
|
}
|
|
61035
61035
|
return false;
|
|
61036
61036
|
}
|
|
61037
|
-
function prefixIssues(
|
|
61037
|
+
function prefixIssues(path6, issues) {
|
|
61038
61038
|
return issues.map((iss) => {
|
|
61039
61039
|
var _a2;
|
|
61040
61040
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
61041
|
-
iss.path.unshift(
|
|
61041
|
+
iss.path.unshift(path6);
|
|
61042
61042
|
return iss;
|
|
61043
61043
|
});
|
|
61044
61044
|
}
|
|
@@ -71850,6 +71850,162 @@ var import_subprotocol = __toESM(require_subprotocol(), 1);
|
|
|
71850
71850
|
var import_websocket = __toESM(require_websocket(), 1);
|
|
71851
71851
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
71852
71852
|
|
|
71853
|
+
// src/server/acp-bridge.ts
|
|
71854
|
+
var import_node_child_process = require("node:child_process");
|
|
71855
|
+
var import_promises = require("node:fs/promises");
|
|
71856
|
+
var import_node_os2 = require("node:os");
|
|
71857
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
71858
|
+
var ACP_COMMAND = "openclaw";
|
|
71859
|
+
var ACP_ARGS = ["acp"];
|
|
71860
|
+
var ACP_STUB_CWD = import_node_path2.default.join((0, import_node_os2.homedir)(), ".television", "acp");
|
|
71861
|
+
var ACPBridge = class {
|
|
71862
|
+
child = null;
|
|
71863
|
+
status = "exited";
|
|
71864
|
+
error = null;
|
|
71865
|
+
stdoutBuffer = "";
|
|
71866
|
+
stderrBuffer = "";
|
|
71867
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
71868
|
+
send;
|
|
71869
|
+
constructor(send) {
|
|
71870
|
+
this.send = send;
|
|
71871
|
+
}
|
|
71872
|
+
handleClientMessage(socket, message) {
|
|
71873
|
+
switch (message.type) {
|
|
71874
|
+
case "acp-bridge-connect":
|
|
71875
|
+
this.subscribers.add(socket);
|
|
71876
|
+
this.ensureStarted();
|
|
71877
|
+
this.sendStatus(socket);
|
|
71878
|
+
return;
|
|
71879
|
+
case "acp-bridge-message":
|
|
71880
|
+
if (!this.child || this.status !== "ready") {
|
|
71881
|
+
this.sendStatus(socket);
|
|
71882
|
+
return;
|
|
71883
|
+
}
|
|
71884
|
+
this.child.stdin.write(`${JSON.stringify(message.message)}
|
|
71885
|
+
`);
|
|
71886
|
+
return;
|
|
71887
|
+
}
|
|
71888
|
+
}
|
|
71889
|
+
detachSocket(socket) {
|
|
71890
|
+
this.subscribers.delete(socket);
|
|
71891
|
+
}
|
|
71892
|
+
async stop() {
|
|
71893
|
+
this.subscribers.clear();
|
|
71894
|
+
if (!this.child) {
|
|
71895
|
+
return;
|
|
71896
|
+
}
|
|
71897
|
+
const child = this.child;
|
|
71898
|
+
this.child = null;
|
|
71899
|
+
this.status = "exited";
|
|
71900
|
+
await new Promise((resolve) => {
|
|
71901
|
+
const timeout = setTimeout(() => {
|
|
71902
|
+
child.kill("SIGKILL");
|
|
71903
|
+
}, 5e3);
|
|
71904
|
+
child.once("exit", () => {
|
|
71905
|
+
clearTimeout(timeout);
|
|
71906
|
+
resolve();
|
|
71907
|
+
});
|
|
71908
|
+
child.kill();
|
|
71909
|
+
});
|
|
71910
|
+
}
|
|
71911
|
+
async ensureStarted() {
|
|
71912
|
+
if (this.child || this.status === "launching") {
|
|
71913
|
+
return;
|
|
71914
|
+
}
|
|
71915
|
+
this.status = "launching";
|
|
71916
|
+
this.error = null;
|
|
71917
|
+
this.broadcastStatus();
|
|
71918
|
+
await (0, import_promises.mkdir)(ACP_STUB_CWD, { recursive: true });
|
|
71919
|
+
const child = (0, import_node_child_process.spawn)(ACP_COMMAND, ACP_ARGS, {
|
|
71920
|
+
cwd: ACP_STUB_CWD,
|
|
71921
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
71922
|
+
});
|
|
71923
|
+
this.child = child;
|
|
71924
|
+
child.once("spawn", () => {
|
|
71925
|
+
this.status = "ready";
|
|
71926
|
+
this.error = null;
|
|
71927
|
+
this.broadcastStatus();
|
|
71928
|
+
});
|
|
71929
|
+
child.once("error", (error2) => {
|
|
71930
|
+
this.child = null;
|
|
71931
|
+
this.status = "error";
|
|
71932
|
+
this.error = error2.message;
|
|
71933
|
+
this.broadcastStatus();
|
|
71934
|
+
});
|
|
71935
|
+
child.once("exit", () => {
|
|
71936
|
+
this.child = null;
|
|
71937
|
+
this.status = "exited";
|
|
71938
|
+
this.error = this.stderrBuffer.trim() || this.error;
|
|
71939
|
+
this.broadcastStatus();
|
|
71940
|
+
});
|
|
71941
|
+
child.stdout.on("data", (chunk) => {
|
|
71942
|
+
this.stdoutBuffer += chunk.toString();
|
|
71943
|
+
this.flushStdoutBuffer();
|
|
71944
|
+
});
|
|
71945
|
+
child.stderr.on("data", (chunk) => {
|
|
71946
|
+
this.stderrBuffer += chunk.toString();
|
|
71947
|
+
this.error = this.stderrBuffer.trim() || this.error;
|
|
71948
|
+
});
|
|
71949
|
+
}
|
|
71950
|
+
flushStdoutBuffer() {
|
|
71951
|
+
while (true) {
|
|
71952
|
+
const newlineIndex = this.stdoutBuffer.indexOf("\n");
|
|
71953
|
+
if (newlineIndex === -1) {
|
|
71954
|
+
return;
|
|
71955
|
+
}
|
|
71956
|
+
const line = this.stdoutBuffer.slice(0, newlineIndex).trim();
|
|
71957
|
+
this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
|
|
71958
|
+
if (!line) {
|
|
71959
|
+
continue;
|
|
71960
|
+
}
|
|
71961
|
+
try {
|
|
71962
|
+
const message = JSON.parse(line);
|
|
71963
|
+
this.broadcast({ type: "acp-bridge-message", message });
|
|
71964
|
+
} catch (error2) {
|
|
71965
|
+
this.status = "error";
|
|
71966
|
+
this.error = error2 instanceof Error ? error2.message : String(error2);
|
|
71967
|
+
this.broadcastStatus();
|
|
71968
|
+
}
|
|
71969
|
+
}
|
|
71970
|
+
}
|
|
71971
|
+
sendStatus(socket) {
|
|
71972
|
+
const message = {
|
|
71973
|
+
type: "acp-bridge-status",
|
|
71974
|
+
status: this.status,
|
|
71975
|
+
...this.error ? { error: this.error } : {}
|
|
71976
|
+
};
|
|
71977
|
+
this.send(socket, message);
|
|
71978
|
+
}
|
|
71979
|
+
broadcastStatus() {
|
|
71980
|
+
this.broadcast({
|
|
71981
|
+
type: "acp-bridge-status",
|
|
71982
|
+
status: this.status,
|
|
71983
|
+
...this.error ? { error: this.error } : {}
|
|
71984
|
+
});
|
|
71985
|
+
}
|
|
71986
|
+
broadcast(message) {
|
|
71987
|
+
for (const socket of this.subscribers) {
|
|
71988
|
+
this.send(socket, message);
|
|
71989
|
+
}
|
|
71990
|
+
}
|
|
71991
|
+
};
|
|
71992
|
+
|
|
71993
|
+
// src/acp-bridge-types.ts
|
|
71994
|
+
function isACPBridgeClientMessage(value) {
|
|
71995
|
+
if (typeof value !== "object" || value === null || !("type" in value)) {
|
|
71996
|
+
return false;
|
|
71997
|
+
}
|
|
71998
|
+
const message = value;
|
|
71999
|
+
switch (message.type) {
|
|
72000
|
+
case "acp-bridge-connect":
|
|
72001
|
+
return true;
|
|
72002
|
+
case "acp-bridge-message":
|
|
72003
|
+
return "message" in message;
|
|
72004
|
+
default:
|
|
72005
|
+
return false;
|
|
72006
|
+
}
|
|
72007
|
+
}
|
|
72008
|
+
|
|
71853
72009
|
// src/server/tools.ts
|
|
71854
72010
|
function listWorkspaceChoices(workspaces) {
|
|
71855
72011
|
return workspaces.map((workspace) => `${workspace.name} (${workspace.id})`).join(", ");
|
|
@@ -72031,7 +72187,7 @@ function createTools(store) {
|
|
|
72031
72187
|
|
|
72032
72188
|
// src/server/artifact-renderer.ts
|
|
72033
72189
|
var import_node_fs = require("node:fs");
|
|
72034
|
-
var
|
|
72190
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
72035
72191
|
|
|
72036
72192
|
// node_modules/marked/lib/marked.esm.js
|
|
72037
72193
|
function M() {
|
|
@@ -73381,12 +73537,12 @@ function wrapArtifactHTML(input) {
|
|
|
73381
73537
|
var cachedBundle = null;
|
|
73382
73538
|
function findRuntimeDir(staticDir) {
|
|
73383
73539
|
const candidates = [
|
|
73384
|
-
staticDir ?
|
|
73385
|
-
|
|
73386
|
-
|
|
73540
|
+
staticDir ? import_node_path3.default.resolve(staticDir, "..", "artifact-runtime") : null,
|
|
73541
|
+
import_node_path3.default.resolve(process.cwd(), "dist", "artifact-runtime"),
|
|
73542
|
+
import_node_path3.default.resolve(process.cwd(), "src", "artifact-runtime")
|
|
73387
73543
|
].filter((candidate) => typeof candidate === "string");
|
|
73388
73544
|
for (const candidate of candidates) {
|
|
73389
|
-
if ((0, import_node_fs.existsSync)(
|
|
73545
|
+
if ((0, import_node_fs.existsSync)(import_node_path3.default.join(candidate, "style.css")) && (0, import_node_fs.existsSync)(import_node_path3.default.join(candidate, "index.js")) || (0, import_node_fs.existsSync)(import_node_path3.default.join(candidate, "base.css")) && (0, import_node_fs.existsSync)(import_node_path3.default.join(candidate, "runtime.js"))) {
|
|
73390
73546
|
return candidate;
|
|
73391
73547
|
}
|
|
73392
73548
|
}
|
|
@@ -73397,8 +73553,8 @@ function loadRuntimeFiles(staticDir) {
|
|
|
73397
73553
|
return cachedBundle;
|
|
73398
73554
|
}
|
|
73399
73555
|
const runtimeDir = findRuntimeDir(staticDir);
|
|
73400
|
-
const cssPath = (0, import_node_fs.existsSync)(
|
|
73401
|
-
const jsPath = (0, import_node_fs.existsSync)(
|
|
73556
|
+
const cssPath = (0, import_node_fs.existsSync)(import_node_path3.default.join(runtimeDir, "style.css")) ? import_node_path3.default.join(runtimeDir, "style.css") : import_node_path3.default.join(runtimeDir, "base.css");
|
|
73557
|
+
const jsPath = (0, import_node_fs.existsSync)(import_node_path3.default.join(runtimeDir, "index.js")) ? import_node_path3.default.join(runtimeDir, "index.js") : import_node_path3.default.join(runtimeDir, "runtime.js");
|
|
73402
73558
|
const bundle = {
|
|
73403
73559
|
css: (0, import_node_fs.readFileSync)(cssPath, "utf8"),
|
|
73404
73560
|
js: (0, import_node_fs.readFileSync)(jsPath, "utf8")
|
|
@@ -73423,6 +73579,7 @@ var Server2 = class {
|
|
|
73423
73579
|
httpServer;
|
|
73424
73580
|
wsServer;
|
|
73425
73581
|
store;
|
|
73582
|
+
acpBridge;
|
|
73426
73583
|
host;
|
|
73427
73584
|
port;
|
|
73428
73585
|
publicServer;
|
|
@@ -73434,6 +73591,7 @@ var Server2 = class {
|
|
|
73434
73591
|
this.port = options.port ?? DEFAULT_SERVER_PORT;
|
|
73435
73592
|
this.publicServer = options.public ?? false;
|
|
73436
73593
|
this.baseURL = buildServerURL(this.host ?? DEFAULT_SERVER_HOST, this.port);
|
|
73594
|
+
this.acpBridge = new ACPBridge((socket, message) => this.send(socket, message));
|
|
73437
73595
|
this.app = (0, import_express2.default)();
|
|
73438
73596
|
this.httpServer = import_node_http.default.createServer(this.app);
|
|
73439
73597
|
this.wsServer = new import_websocket_server.default({ server: this.httpServer, path: "/ws" });
|
|
@@ -73478,6 +73636,9 @@ var Server2 = class {
|
|
|
73478
73636
|
socket.on("message", (data) => {
|
|
73479
73637
|
this.handleClientMessage(socket, data.toString());
|
|
73480
73638
|
});
|
|
73639
|
+
socket.on("close", () => {
|
|
73640
|
+
this.acpBridge.detachSocket(socket);
|
|
73641
|
+
});
|
|
73481
73642
|
});
|
|
73482
73643
|
this.store.addEventListener("store-change", (event) => {
|
|
73483
73644
|
this.broadcast(event.message);
|
|
@@ -73512,21 +73673,23 @@ var Server2 = class {
|
|
|
73512
73673
|
for (const socket of this.wsServer.clients) {
|
|
73513
73674
|
socket.terminate();
|
|
73514
73675
|
}
|
|
73515
|
-
this.
|
|
73516
|
-
|
|
73517
|
-
|
|
73518
|
-
|
|
73519
|
-
}
|
|
73520
|
-
this.httpServer.closeAllConnections?.();
|
|
73521
|
-
this.httpServer.closeIdleConnections?.();
|
|
73522
|
-
this.httpServer.close((httpError) => {
|
|
73523
|
-
if (httpError) {
|
|
73524
|
-
reject(httpError);
|
|
73676
|
+
void this.acpBridge.stop().then(() => {
|
|
73677
|
+
this.wsServer.close((wsError) => {
|
|
73678
|
+
if (wsError) {
|
|
73679
|
+
reject(wsError);
|
|
73525
73680
|
return;
|
|
73526
73681
|
}
|
|
73527
|
-
|
|
73682
|
+
this.httpServer.closeAllConnections?.();
|
|
73683
|
+
this.httpServer.closeIdleConnections?.();
|
|
73684
|
+
this.httpServer.close((httpError) => {
|
|
73685
|
+
if (httpError) {
|
|
73686
|
+
reject(httpError);
|
|
73687
|
+
return;
|
|
73688
|
+
}
|
|
73689
|
+
resolve();
|
|
73690
|
+
});
|
|
73528
73691
|
});
|
|
73529
|
-
});
|
|
73692
|
+
}).catch(reject);
|
|
73530
73693
|
});
|
|
73531
73694
|
}
|
|
73532
73695
|
handleClientMessage(socket, rawMessage) {
|
|
@@ -73537,6 +73700,10 @@ var Server2 = class {
|
|
|
73537
73700
|
this.send(socket, { type: "error", message: "Invalid message" });
|
|
73538
73701
|
return;
|
|
73539
73702
|
}
|
|
73703
|
+
if (isACPBridgeClientMessage(message)) {
|
|
73704
|
+
this.acpBridge.handleClientMessage(socket, message);
|
|
73705
|
+
return;
|
|
73706
|
+
}
|
|
73540
73707
|
if (!isClientMessage(message)) {
|
|
73541
73708
|
this.send(socket, { type: "error", message: "Unknown message type" });
|
|
73542
73709
|
return;
|
|
@@ -73738,7 +73905,7 @@ var StoreChangeEvent = defineEvent();
|
|
|
73738
73905
|
// src/server/server-store.ts
|
|
73739
73906
|
var import_node_crypto2 = require("node:crypto");
|
|
73740
73907
|
var import_node_fs2 = require("node:fs");
|
|
73741
|
-
var
|
|
73908
|
+
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
73742
73909
|
|
|
73743
73910
|
// src/constants.ts
|
|
73744
73911
|
var LAYOUT_FULL_WIDTH_UNITS = 4;
|
|
@@ -74309,7 +74476,7 @@ var ServerStore = class extends EventTarget {
|
|
|
74309
74476
|
}
|
|
74310
74477
|
load() {
|
|
74311
74478
|
for (const file2 of this.readEntityFiles(this.workspacesDir)) {
|
|
74312
|
-
const filePath =
|
|
74479
|
+
const filePath = import_node_path4.default.join(this.workspacesDir, file2);
|
|
74313
74480
|
const raw = this.readJsonFile(filePath);
|
|
74314
74481
|
if (!raw || typeof raw !== "object") continue;
|
|
74315
74482
|
const renamedLegacyFields = migrateWorkspaceJson(raw);
|
|
@@ -74323,7 +74490,7 @@ var ServerStore = class extends EventTarget {
|
|
|
74323
74490
|
}
|
|
74324
74491
|
for (const file2 of this.readEntityFiles(this.artifactsDir)) {
|
|
74325
74492
|
const artifact = this.readJsonFile(
|
|
74326
|
-
|
|
74493
|
+
import_node_path4.default.join(this.artifactsDir, file2)
|
|
74327
74494
|
);
|
|
74328
74495
|
if (!artifact) continue;
|
|
74329
74496
|
this.artifacts.set(artifact.id, artifact);
|
|
@@ -74364,32 +74531,32 @@ var ServerStore = class extends EventTarget {
|
|
|
74364
74531
|
}
|
|
74365
74532
|
persistWorkspace(workspace) {
|
|
74366
74533
|
(0, import_node_fs2.writeFileSync)(
|
|
74367
|
-
|
|
74534
|
+
import_node_path4.default.join(this.workspacesDir, `${workspace.id}.json`),
|
|
74368
74535
|
JSON.stringify(workspace, null, JSON_INDENT_SPACES)
|
|
74369
74536
|
);
|
|
74370
74537
|
}
|
|
74371
74538
|
persistArtifact(artifact) {
|
|
74372
74539
|
(0, import_node_fs2.writeFileSync)(
|
|
74373
|
-
|
|
74540
|
+
import_node_path4.default.join(this.artifactsDir, `${artifact.id}.json`),
|
|
74374
74541
|
JSON.stringify(artifact, null, JSON_INDENT_SPACES)
|
|
74375
74542
|
);
|
|
74376
74543
|
}
|
|
74377
74544
|
deleteArtifactFile(artifactID) {
|
|
74378
|
-
(0, import_node_fs2.rmSync)(
|
|
74545
|
+
(0, import_node_fs2.rmSync)(import_node_path4.default.join(this.artifactsDir, `${artifactID}.json`), { force: true });
|
|
74379
74546
|
}
|
|
74380
74547
|
deleteWorkspaceFile(workspaceID) {
|
|
74381
|
-
(0, import_node_fs2.rmSync)(
|
|
74548
|
+
(0, import_node_fs2.rmSync)(import_node_path4.default.join(this.workspacesDir, `${workspaceID}.json`), {
|
|
74382
74549
|
force: true
|
|
74383
74550
|
});
|
|
74384
74551
|
}
|
|
74385
74552
|
get workspacesDir() {
|
|
74386
|
-
return
|
|
74553
|
+
return import_node_path4.default.join(this.dataDir, "workspaces");
|
|
74387
74554
|
}
|
|
74388
74555
|
get artifactsDir() {
|
|
74389
|
-
return
|
|
74556
|
+
return import_node_path4.default.join(this.dataDir, "artifacts");
|
|
74390
74557
|
}
|
|
74391
74558
|
get tokenPath() {
|
|
74392
|
-
return
|
|
74559
|
+
return import_node_path4.default.join(this.dataDir, "token");
|
|
74393
74560
|
}
|
|
74394
74561
|
};
|
|
74395
74562
|
|
|
@@ -74432,7 +74599,7 @@ var App = class {
|
|
|
74432
74599
|
rendererURL.searchParams.set(SERVER_URL_QUERY_PARAM, serverBaseURL);
|
|
74433
74600
|
await window2.loadURL(rendererURL.toString());
|
|
74434
74601
|
} else {
|
|
74435
|
-
await window2.loadFile(
|
|
74602
|
+
await window2.loadFile(import_node_path5.default.resolve("dist/browser/index.html"), {
|
|
74436
74603
|
query: {
|
|
74437
74604
|
[MODE_QUERY_PARAM]: ELECTRON_MODE,
|
|
74438
74605
|
[SERVER_URL_QUERY_PARAM]: serverBaseURL
|