@kevisual/cli 0.0.55 → 0.0.56
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/assistant-server.js +256 -164
- package/dist/assistant.js +71 -37
- package/dist/envision.mjs +167 -143
- package/package.json +8 -7
package/dist/assistant-server.js
CHANGED
|
@@ -14207,7 +14207,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14207
14207
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
14208
14208
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
14209
14209
|
|
|
14210
|
-
class
|
|
14210
|
+
class WebSocket extends EventEmitter {
|
|
14211
14211
|
constructor(address, protocols, options) {
|
|
14212
14212
|
super();
|
|
14213
14213
|
this._binaryType = BINARY_TYPES[0];
|
|
@@ -14220,7 +14220,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14220
14220
|
this._extensions = {};
|
|
14221
14221
|
this._paused = false;
|
|
14222
14222
|
this._protocol = "";
|
|
14223
|
-
this._readyState =
|
|
14223
|
+
this._readyState = WebSocket.CONNECTING;
|
|
14224
14224
|
this._receiver = null;
|
|
14225
14225
|
this._sender = null;
|
|
14226
14226
|
this._socket = null;
|
|
@@ -14319,12 +14319,12 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14319
14319
|
socket.on("data", socketOnData);
|
|
14320
14320
|
socket.on("end", socketOnEnd);
|
|
14321
14321
|
socket.on("error", socketOnError);
|
|
14322
|
-
this._readyState =
|
|
14322
|
+
this._readyState = WebSocket.OPEN;
|
|
14323
14323
|
this.emit("open");
|
|
14324
14324
|
}
|
|
14325
14325
|
emitClose() {
|
|
14326
14326
|
if (!this._socket) {
|
|
14327
|
-
this._readyState =
|
|
14327
|
+
this._readyState = WebSocket.CLOSED;
|
|
14328
14328
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
14329
14329
|
return;
|
|
14330
14330
|
}
|
|
@@ -14332,24 +14332,24 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14332
14332
|
this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
14333
14333
|
}
|
|
14334
14334
|
this._receiver.removeAllListeners();
|
|
14335
|
-
this._readyState =
|
|
14335
|
+
this._readyState = WebSocket.CLOSED;
|
|
14336
14336
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
14337
14337
|
}
|
|
14338
14338
|
close(code, data) {
|
|
14339
|
-
if (this.readyState ===
|
|
14339
|
+
if (this.readyState === WebSocket.CLOSED)
|
|
14340
14340
|
return;
|
|
14341
|
-
if (this.readyState ===
|
|
14341
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
14342
14342
|
const msg = "WebSocket was closed before the connection was established";
|
|
14343
14343
|
abortHandshake(this, this._req, msg);
|
|
14344
14344
|
return;
|
|
14345
14345
|
}
|
|
14346
|
-
if (this.readyState ===
|
|
14346
|
+
if (this.readyState === WebSocket.CLOSING) {
|
|
14347
14347
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) {
|
|
14348
14348
|
this._socket.end();
|
|
14349
14349
|
}
|
|
14350
14350
|
return;
|
|
14351
14351
|
}
|
|
14352
|
-
this._readyState =
|
|
14352
|
+
this._readyState = WebSocket.CLOSING;
|
|
14353
14353
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
14354
14354
|
if (err)
|
|
14355
14355
|
return;
|
|
@@ -14361,14 +14361,14 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14361
14361
|
setCloseTimer(this);
|
|
14362
14362
|
}
|
|
14363
14363
|
pause() {
|
|
14364
|
-
if (this.readyState ===
|
|
14364
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
14365
14365
|
return;
|
|
14366
14366
|
}
|
|
14367
14367
|
this._paused = true;
|
|
14368
14368
|
this._socket.pause();
|
|
14369
14369
|
}
|
|
14370
14370
|
ping(data, mask, cb) {
|
|
14371
|
-
if (this.readyState ===
|
|
14371
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
14372
14372
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
14373
14373
|
}
|
|
14374
14374
|
if (typeof data === "function") {
|
|
@@ -14380,7 +14380,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14380
14380
|
}
|
|
14381
14381
|
if (typeof data === "number")
|
|
14382
14382
|
data = data.toString();
|
|
14383
|
-
if (this.readyState !==
|
|
14383
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
14384
14384
|
sendAfterClose(this, data, cb);
|
|
14385
14385
|
return;
|
|
14386
14386
|
}
|
|
@@ -14389,7 +14389,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14389
14389
|
this._sender.ping(data || EMPTY_BUFFER, mask, cb);
|
|
14390
14390
|
}
|
|
14391
14391
|
pong(data, mask, cb) {
|
|
14392
|
-
if (this.readyState ===
|
|
14392
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
14393
14393
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
14394
14394
|
}
|
|
14395
14395
|
if (typeof data === "function") {
|
|
@@ -14401,7 +14401,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14401
14401
|
}
|
|
14402
14402
|
if (typeof data === "number")
|
|
14403
14403
|
data = data.toString();
|
|
14404
|
-
if (this.readyState !==
|
|
14404
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
14405
14405
|
sendAfterClose(this, data, cb);
|
|
14406
14406
|
return;
|
|
14407
14407
|
}
|
|
@@ -14410,7 +14410,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14410
14410
|
this._sender.pong(data || EMPTY_BUFFER, mask, cb);
|
|
14411
14411
|
}
|
|
14412
14412
|
resume() {
|
|
14413
|
-
if (this.readyState ===
|
|
14413
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
14414
14414
|
return;
|
|
14415
14415
|
}
|
|
14416
14416
|
this._paused = false;
|
|
@@ -14418,7 +14418,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14418
14418
|
this._socket.resume();
|
|
14419
14419
|
}
|
|
14420
14420
|
send(data, options, cb) {
|
|
14421
|
-
if (this.readyState ===
|
|
14421
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
14422
14422
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
14423
14423
|
}
|
|
14424
14424
|
if (typeof options === "function") {
|
|
@@ -14427,7 +14427,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14427
14427
|
}
|
|
14428
14428
|
if (typeof data === "number")
|
|
14429
14429
|
data = data.toString();
|
|
14430
|
-
if (this.readyState !==
|
|
14430
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
14431
14431
|
sendAfterClose(this, data, cb);
|
|
14432
14432
|
return;
|
|
14433
14433
|
}
|
|
@@ -14444,48 +14444,48 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14444
14444
|
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
14445
14445
|
}
|
|
14446
14446
|
terminate() {
|
|
14447
|
-
if (this.readyState ===
|
|
14447
|
+
if (this.readyState === WebSocket.CLOSED)
|
|
14448
14448
|
return;
|
|
14449
|
-
if (this.readyState ===
|
|
14449
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
14450
14450
|
const msg = "WebSocket was closed before the connection was established";
|
|
14451
14451
|
abortHandshake(this, this._req, msg);
|
|
14452
14452
|
return;
|
|
14453
14453
|
}
|
|
14454
14454
|
if (this._socket) {
|
|
14455
|
-
this._readyState =
|
|
14455
|
+
this._readyState = WebSocket.CLOSING;
|
|
14456
14456
|
this._socket.destroy();
|
|
14457
14457
|
}
|
|
14458
14458
|
}
|
|
14459
14459
|
}
|
|
14460
|
-
Object.defineProperty(
|
|
14460
|
+
Object.defineProperty(WebSocket, "CONNECTING", {
|
|
14461
14461
|
enumerable: true,
|
|
14462
14462
|
value: readyStates.indexOf("CONNECTING")
|
|
14463
14463
|
});
|
|
14464
|
-
Object.defineProperty(
|
|
14464
|
+
Object.defineProperty(WebSocket.prototype, "CONNECTING", {
|
|
14465
14465
|
enumerable: true,
|
|
14466
14466
|
value: readyStates.indexOf("CONNECTING")
|
|
14467
14467
|
});
|
|
14468
|
-
Object.defineProperty(
|
|
14468
|
+
Object.defineProperty(WebSocket, "OPEN", {
|
|
14469
14469
|
enumerable: true,
|
|
14470
14470
|
value: readyStates.indexOf("OPEN")
|
|
14471
14471
|
});
|
|
14472
|
-
Object.defineProperty(
|
|
14472
|
+
Object.defineProperty(WebSocket.prototype, "OPEN", {
|
|
14473
14473
|
enumerable: true,
|
|
14474
14474
|
value: readyStates.indexOf("OPEN")
|
|
14475
14475
|
});
|
|
14476
|
-
Object.defineProperty(
|
|
14476
|
+
Object.defineProperty(WebSocket, "CLOSING", {
|
|
14477
14477
|
enumerable: true,
|
|
14478
14478
|
value: readyStates.indexOf("CLOSING")
|
|
14479
14479
|
});
|
|
14480
|
-
Object.defineProperty(
|
|
14480
|
+
Object.defineProperty(WebSocket.prototype, "CLOSING", {
|
|
14481
14481
|
enumerable: true,
|
|
14482
14482
|
value: readyStates.indexOf("CLOSING")
|
|
14483
14483
|
});
|
|
14484
|
-
Object.defineProperty(
|
|
14484
|
+
Object.defineProperty(WebSocket, "CLOSED", {
|
|
14485
14485
|
enumerable: true,
|
|
14486
14486
|
value: readyStates.indexOf("CLOSED")
|
|
14487
14487
|
});
|
|
14488
|
-
Object.defineProperty(
|
|
14488
|
+
Object.defineProperty(WebSocket.prototype, "CLOSED", {
|
|
14489
14489
|
enumerable: true,
|
|
14490
14490
|
value: readyStates.indexOf("CLOSED")
|
|
14491
14491
|
});
|
|
@@ -14498,10 +14498,10 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14498
14498
|
"readyState",
|
|
14499
14499
|
"url"
|
|
14500
14500
|
].forEach((property) => {
|
|
14501
|
-
Object.defineProperty(
|
|
14501
|
+
Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
|
|
14502
14502
|
});
|
|
14503
14503
|
["open", "error", "close", "message"].forEach((method) => {
|
|
14504
|
-
Object.defineProperty(
|
|
14504
|
+
Object.defineProperty(WebSocket.prototype, `on${method}`, {
|
|
14505
14505
|
enumerable: true,
|
|
14506
14506
|
get() {
|
|
14507
14507
|
for (const listener of this.listeners(method)) {
|
|
@@ -14525,9 +14525,9 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14525
14525
|
}
|
|
14526
14526
|
});
|
|
14527
14527
|
});
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
module.exports =
|
|
14528
|
+
WebSocket.prototype.addEventListener = addEventListener;
|
|
14529
|
+
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
14530
|
+
module.exports = WebSocket;
|
|
14531
14531
|
function initAsClient(websocket2, address, protocols, options) {
|
|
14532
14532
|
const opts = {
|
|
14533
14533
|
allowSynchronousEvents: true,
|
|
@@ -14680,9 +14680,9 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14680
14680
|
emitErrorAndClose(websocket2, err);
|
|
14681
14681
|
});
|
|
14682
14682
|
req.on("response", (res) => {
|
|
14683
|
-
const
|
|
14683
|
+
const location = res.headers.location;
|
|
14684
14684
|
const statusCode = res.statusCode;
|
|
14685
|
-
if (
|
|
14685
|
+
if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
|
|
14686
14686
|
if (++websocket2._redirects > opts.maxRedirects) {
|
|
14687
14687
|
abortHandshake(websocket2, req, "Maximum redirects exceeded");
|
|
14688
14688
|
return;
|
|
@@ -14690,9 +14690,9 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14690
14690
|
req.abort();
|
|
14691
14691
|
let addr;
|
|
14692
14692
|
try {
|
|
14693
|
-
addr = new URL2(
|
|
14693
|
+
addr = new URL2(location, address);
|
|
14694
14694
|
} catch (e) {
|
|
14695
|
-
const err = new SyntaxError(`Invalid URL: ${
|
|
14695
|
+
const err = new SyntaxError(`Invalid URL: ${location}`);
|
|
14696
14696
|
emitErrorAndClose(websocket2, err);
|
|
14697
14697
|
return;
|
|
14698
14698
|
}
|
|
@@ -14703,7 +14703,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14703
14703
|
});
|
|
14704
14704
|
req.on("upgrade", (res, socket, head) => {
|
|
14705
14705
|
websocket2.emit("upgrade", res);
|
|
14706
|
-
if (websocket2.readyState !==
|
|
14706
|
+
if (websocket2.readyState !== WebSocket.CONNECTING)
|
|
14707
14707
|
return;
|
|
14708
14708
|
req = websocket2._req = null;
|
|
14709
14709
|
const upgrade = res.headers.upgrade;
|
|
@@ -14777,7 +14777,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14777
14777
|
}
|
|
14778
14778
|
}
|
|
14779
14779
|
function emitErrorAndClose(websocket2, err) {
|
|
14780
|
-
websocket2._readyState =
|
|
14780
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
14781
14781
|
websocket2._errorEmitted = true;
|
|
14782
14782
|
websocket2.emit("error", err);
|
|
14783
14783
|
websocket2.emitClose();
|
|
@@ -14794,7 +14794,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14794
14794
|
return tls.connect(options);
|
|
14795
14795
|
}
|
|
14796
14796
|
function abortHandshake(websocket2, stream2, message) {
|
|
14797
|
-
websocket2._readyState =
|
|
14797
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
14798
14798
|
const err = new Error(message);
|
|
14799
14799
|
Error.captureStackTrace(err, abortHandshake);
|
|
14800
14800
|
if (stream2.setHeader) {
|
|
@@ -14874,10 +14874,10 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14874
14874
|
}
|
|
14875
14875
|
function senderOnError(err) {
|
|
14876
14876
|
const websocket2 = this[kWebSocket];
|
|
14877
|
-
if (websocket2.readyState ===
|
|
14877
|
+
if (websocket2.readyState === WebSocket.CLOSED)
|
|
14878
14878
|
return;
|
|
14879
|
-
if (websocket2.readyState ===
|
|
14880
|
-
websocket2._readyState =
|
|
14879
|
+
if (websocket2.readyState === WebSocket.OPEN) {
|
|
14880
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
14881
14881
|
setCloseTimer(websocket2);
|
|
14882
14882
|
}
|
|
14883
14883
|
this._socket.end();
|
|
@@ -14894,7 +14894,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14894
14894
|
this.removeListener("close", socketOnClose);
|
|
14895
14895
|
this.removeListener("data", socketOnData);
|
|
14896
14896
|
this.removeListener("end", socketOnEnd);
|
|
14897
|
-
websocket2._readyState =
|
|
14897
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
14898
14898
|
let chunk;
|
|
14899
14899
|
if (!this._readableState.endEmitted && !websocket2._closeFrameReceived && !websocket2._receiver._writableState.errorEmitted && (chunk = websocket2._socket.read()) !== null) {
|
|
14900
14900
|
websocket2._receiver.write(chunk);
|
|
@@ -14916,7 +14916,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14916
14916
|
}
|
|
14917
14917
|
function socketOnEnd() {
|
|
14918
14918
|
const websocket2 = this[kWebSocket];
|
|
14919
|
-
websocket2._readyState =
|
|
14919
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
14920
14920
|
websocket2._receiver.end();
|
|
14921
14921
|
this.end();
|
|
14922
14922
|
}
|
|
@@ -14925,7 +14925,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14925
14925
|
this.removeListener("error", socketOnError);
|
|
14926
14926
|
this.on("error", NOOP);
|
|
14927
14927
|
if (websocket2) {
|
|
14928
|
-
websocket2._readyState =
|
|
14928
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
14929
14929
|
this.destroy();
|
|
14930
14930
|
}
|
|
14931
14931
|
}
|
|
@@ -14933,7 +14933,7 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
14933
14933
|
|
|
14934
14934
|
// node_modules/.pnpm/@kevisual+ws@8.0.0/node_modules/@kevisual/ws/lib/stream.js
|
|
14935
14935
|
var require_stream = __commonJS((exports, module) => {
|
|
14936
|
-
var
|
|
14936
|
+
var WebSocket = require_websocket();
|
|
14937
14937
|
var { Duplex } = __require("stream");
|
|
14938
14938
|
function emitClose(stream2) {
|
|
14939
14939
|
stream2.emit("close");
|
|
@@ -15088,7 +15088,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
15088
15088
|
var extension2 = require_extension();
|
|
15089
15089
|
var PerMessageDeflate = require_permessage_deflate();
|
|
15090
15090
|
var subprotocol2 = require_subprotocol();
|
|
15091
|
-
var
|
|
15091
|
+
var WebSocket = require_websocket();
|
|
15092
15092
|
var { GUID, kWebSocket } = require_constants();
|
|
15093
15093
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
15094
15094
|
var RUNNING = 0;
|
|
@@ -15113,7 +15113,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
15113
15113
|
host: null,
|
|
15114
15114
|
path: null,
|
|
15115
15115
|
port: null,
|
|
15116
|
-
WebSocket
|
|
15116
|
+
WebSocket,
|
|
15117
15117
|
...options
|
|
15118
15118
|
};
|
|
15119
15119
|
if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) {
|
|
@@ -49810,7 +49810,7 @@ function requireWebsocket() {
|
|
|
49810
49810
|
const readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
49811
49811
|
const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
49812
49812
|
|
|
49813
|
-
class
|
|
49813
|
+
class WebSocket extends EventEmitter {
|
|
49814
49814
|
constructor(address, protocols, options) {
|
|
49815
49815
|
super();
|
|
49816
49816
|
this._binaryType = BINARY_TYPES[0];
|
|
@@ -49823,7 +49823,7 @@ function requireWebsocket() {
|
|
|
49823
49823
|
this._extensions = {};
|
|
49824
49824
|
this._paused = false;
|
|
49825
49825
|
this._protocol = "";
|
|
49826
|
-
this._readyState =
|
|
49826
|
+
this._readyState = WebSocket.CONNECTING;
|
|
49827
49827
|
this._receiver = null;
|
|
49828
49828
|
this._sender = null;
|
|
49829
49829
|
this._socket = null;
|
|
@@ -49922,12 +49922,12 @@ function requireWebsocket() {
|
|
|
49922
49922
|
socket.on("data", socketOnData);
|
|
49923
49923
|
socket.on("end", socketOnEnd);
|
|
49924
49924
|
socket.on("error", socketOnError);
|
|
49925
|
-
this._readyState =
|
|
49925
|
+
this._readyState = WebSocket.OPEN;
|
|
49926
49926
|
this.emit("open");
|
|
49927
49927
|
}
|
|
49928
49928
|
emitClose() {
|
|
49929
49929
|
if (!this._socket) {
|
|
49930
|
-
this._readyState =
|
|
49930
|
+
this._readyState = WebSocket.CLOSED;
|
|
49931
49931
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
49932
49932
|
return;
|
|
49933
49933
|
}
|
|
@@ -49935,24 +49935,24 @@ function requireWebsocket() {
|
|
|
49935
49935
|
this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
49936
49936
|
}
|
|
49937
49937
|
this._receiver.removeAllListeners();
|
|
49938
|
-
this._readyState =
|
|
49938
|
+
this._readyState = WebSocket.CLOSED;
|
|
49939
49939
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
49940
49940
|
}
|
|
49941
49941
|
close(code, data) {
|
|
49942
|
-
if (this.readyState ===
|
|
49942
|
+
if (this.readyState === WebSocket.CLOSED)
|
|
49943
49943
|
return;
|
|
49944
|
-
if (this.readyState ===
|
|
49944
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
49945
49945
|
const msg = "WebSocket was closed before the connection was established";
|
|
49946
49946
|
abortHandshake(this, this._req, msg);
|
|
49947
49947
|
return;
|
|
49948
49948
|
}
|
|
49949
|
-
if (this.readyState ===
|
|
49949
|
+
if (this.readyState === WebSocket.CLOSING) {
|
|
49950
49950
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) {
|
|
49951
49951
|
this._socket.end();
|
|
49952
49952
|
}
|
|
49953
49953
|
return;
|
|
49954
49954
|
}
|
|
49955
|
-
this._readyState =
|
|
49955
|
+
this._readyState = WebSocket.CLOSING;
|
|
49956
49956
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
49957
49957
|
if (err)
|
|
49958
49958
|
return;
|
|
@@ -49964,14 +49964,14 @@ function requireWebsocket() {
|
|
|
49964
49964
|
setCloseTimer(this);
|
|
49965
49965
|
}
|
|
49966
49966
|
pause() {
|
|
49967
|
-
if (this.readyState ===
|
|
49967
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
49968
49968
|
return;
|
|
49969
49969
|
}
|
|
49970
49970
|
this._paused = true;
|
|
49971
49971
|
this._socket.pause();
|
|
49972
49972
|
}
|
|
49973
49973
|
ping(data, mask, cb) {
|
|
49974
|
-
if (this.readyState ===
|
|
49974
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
49975
49975
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
49976
49976
|
}
|
|
49977
49977
|
if (typeof data === "function") {
|
|
@@ -49983,7 +49983,7 @@ function requireWebsocket() {
|
|
|
49983
49983
|
}
|
|
49984
49984
|
if (typeof data === "number")
|
|
49985
49985
|
data = data.toString();
|
|
49986
|
-
if (this.readyState !==
|
|
49986
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
49987
49987
|
sendAfterClose(this, data, cb);
|
|
49988
49988
|
return;
|
|
49989
49989
|
}
|
|
@@ -49992,7 +49992,7 @@ function requireWebsocket() {
|
|
|
49992
49992
|
this._sender.ping(data || EMPTY_BUFFER, mask, cb);
|
|
49993
49993
|
}
|
|
49994
49994
|
pong(data, mask, cb) {
|
|
49995
|
-
if (this.readyState ===
|
|
49995
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
49996
49996
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
49997
49997
|
}
|
|
49998
49998
|
if (typeof data === "function") {
|
|
@@ -50004,7 +50004,7 @@ function requireWebsocket() {
|
|
|
50004
50004
|
}
|
|
50005
50005
|
if (typeof data === "number")
|
|
50006
50006
|
data = data.toString();
|
|
50007
|
-
if (this.readyState !==
|
|
50007
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
50008
50008
|
sendAfterClose(this, data, cb);
|
|
50009
50009
|
return;
|
|
50010
50010
|
}
|
|
@@ -50013,7 +50013,7 @@ function requireWebsocket() {
|
|
|
50013
50013
|
this._sender.pong(data || EMPTY_BUFFER, mask, cb);
|
|
50014
50014
|
}
|
|
50015
50015
|
resume() {
|
|
50016
|
-
if (this.readyState ===
|
|
50016
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
50017
50017
|
return;
|
|
50018
50018
|
}
|
|
50019
50019
|
this._paused = false;
|
|
@@ -50021,7 +50021,7 @@ function requireWebsocket() {
|
|
|
50021
50021
|
this._socket.resume();
|
|
50022
50022
|
}
|
|
50023
50023
|
send(data, options, cb) {
|
|
50024
|
-
if (this.readyState ===
|
|
50024
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
50025
50025
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
50026
50026
|
}
|
|
50027
50027
|
if (typeof options === "function") {
|
|
@@ -50030,7 +50030,7 @@ function requireWebsocket() {
|
|
|
50030
50030
|
}
|
|
50031
50031
|
if (typeof data === "number")
|
|
50032
50032
|
data = data.toString();
|
|
50033
|
-
if (this.readyState !==
|
|
50033
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
50034
50034
|
sendAfterClose(this, data, cb);
|
|
50035
50035
|
return;
|
|
50036
50036
|
}
|
|
@@ -50047,48 +50047,48 @@ function requireWebsocket() {
|
|
|
50047
50047
|
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
50048
50048
|
}
|
|
50049
50049
|
terminate() {
|
|
50050
|
-
if (this.readyState ===
|
|
50050
|
+
if (this.readyState === WebSocket.CLOSED)
|
|
50051
50051
|
return;
|
|
50052
|
-
if (this.readyState ===
|
|
50052
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
50053
50053
|
const msg = "WebSocket was closed before the connection was established";
|
|
50054
50054
|
abortHandshake(this, this._req, msg);
|
|
50055
50055
|
return;
|
|
50056
50056
|
}
|
|
50057
50057
|
if (this._socket) {
|
|
50058
|
-
this._readyState =
|
|
50058
|
+
this._readyState = WebSocket.CLOSING;
|
|
50059
50059
|
this._socket.destroy();
|
|
50060
50060
|
}
|
|
50061
50061
|
}
|
|
50062
50062
|
}
|
|
50063
|
-
Object.defineProperty(
|
|
50063
|
+
Object.defineProperty(WebSocket, "CONNECTING", {
|
|
50064
50064
|
enumerable: true,
|
|
50065
50065
|
value: readyStates.indexOf("CONNECTING")
|
|
50066
50066
|
});
|
|
50067
|
-
Object.defineProperty(
|
|
50067
|
+
Object.defineProperty(WebSocket.prototype, "CONNECTING", {
|
|
50068
50068
|
enumerable: true,
|
|
50069
50069
|
value: readyStates.indexOf("CONNECTING")
|
|
50070
50070
|
});
|
|
50071
|
-
Object.defineProperty(
|
|
50071
|
+
Object.defineProperty(WebSocket, "OPEN", {
|
|
50072
50072
|
enumerable: true,
|
|
50073
50073
|
value: readyStates.indexOf("OPEN")
|
|
50074
50074
|
});
|
|
50075
|
-
Object.defineProperty(
|
|
50075
|
+
Object.defineProperty(WebSocket.prototype, "OPEN", {
|
|
50076
50076
|
enumerable: true,
|
|
50077
50077
|
value: readyStates.indexOf("OPEN")
|
|
50078
50078
|
});
|
|
50079
|
-
Object.defineProperty(
|
|
50079
|
+
Object.defineProperty(WebSocket, "CLOSING", {
|
|
50080
50080
|
enumerable: true,
|
|
50081
50081
|
value: readyStates.indexOf("CLOSING")
|
|
50082
50082
|
});
|
|
50083
|
-
Object.defineProperty(
|
|
50083
|
+
Object.defineProperty(WebSocket.prototype, "CLOSING", {
|
|
50084
50084
|
enumerable: true,
|
|
50085
50085
|
value: readyStates.indexOf("CLOSING")
|
|
50086
50086
|
});
|
|
50087
|
-
Object.defineProperty(
|
|
50087
|
+
Object.defineProperty(WebSocket, "CLOSED", {
|
|
50088
50088
|
enumerable: true,
|
|
50089
50089
|
value: readyStates.indexOf("CLOSED")
|
|
50090
50090
|
});
|
|
50091
|
-
Object.defineProperty(
|
|
50091
|
+
Object.defineProperty(WebSocket.prototype, "CLOSED", {
|
|
50092
50092
|
enumerable: true,
|
|
50093
50093
|
value: readyStates.indexOf("CLOSED")
|
|
50094
50094
|
});
|
|
@@ -50101,10 +50101,10 @@ function requireWebsocket() {
|
|
|
50101
50101
|
"readyState",
|
|
50102
50102
|
"url"
|
|
50103
50103
|
].forEach((property) => {
|
|
50104
|
-
Object.defineProperty(
|
|
50104
|
+
Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
|
|
50105
50105
|
});
|
|
50106
50106
|
["open", "error", "close", "message"].forEach((method) => {
|
|
50107
|
-
Object.defineProperty(
|
|
50107
|
+
Object.defineProperty(WebSocket.prototype, `on${method}`, {
|
|
50108
50108
|
enumerable: true,
|
|
50109
50109
|
get() {
|
|
50110
50110
|
for (const listener of this.listeners(method)) {
|
|
@@ -50128,9 +50128,9 @@ function requireWebsocket() {
|
|
|
50128
50128
|
}
|
|
50129
50129
|
});
|
|
50130
50130
|
});
|
|
50131
|
-
|
|
50132
|
-
|
|
50133
|
-
websocket =
|
|
50131
|
+
WebSocket.prototype.addEventListener = addEventListener;
|
|
50132
|
+
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
50133
|
+
websocket = WebSocket;
|
|
50134
50134
|
function initAsClient(websocket2, address, protocols, options) {
|
|
50135
50135
|
const opts = {
|
|
50136
50136
|
allowSynchronousEvents: true,
|
|
@@ -50283,9 +50283,9 @@ function requireWebsocket() {
|
|
|
50283
50283
|
emitErrorAndClose(websocket2, err);
|
|
50284
50284
|
});
|
|
50285
50285
|
req.on("response", (res) => {
|
|
50286
|
-
const
|
|
50286
|
+
const location = res.headers.location;
|
|
50287
50287
|
const statusCode = res.statusCode;
|
|
50288
|
-
if (
|
|
50288
|
+
if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
|
|
50289
50289
|
if (++websocket2._redirects > opts.maxRedirects) {
|
|
50290
50290
|
abortHandshake(websocket2, req, "Maximum redirects exceeded");
|
|
50291
50291
|
return;
|
|
@@ -50293,9 +50293,9 @@ function requireWebsocket() {
|
|
|
50293
50293
|
req.abort();
|
|
50294
50294
|
let addr;
|
|
50295
50295
|
try {
|
|
50296
|
-
addr = new URL2(
|
|
50296
|
+
addr = new URL2(location, address);
|
|
50297
50297
|
} catch (e) {
|
|
50298
|
-
const err = new SyntaxError(`Invalid URL: ${
|
|
50298
|
+
const err = new SyntaxError(`Invalid URL: ${location}`);
|
|
50299
50299
|
emitErrorAndClose(websocket2, err);
|
|
50300
50300
|
return;
|
|
50301
50301
|
}
|
|
@@ -50306,7 +50306,7 @@ function requireWebsocket() {
|
|
|
50306
50306
|
});
|
|
50307
50307
|
req.on("upgrade", (res, socket, head) => {
|
|
50308
50308
|
websocket2.emit("upgrade", res);
|
|
50309
|
-
if (websocket2.readyState !==
|
|
50309
|
+
if (websocket2.readyState !== WebSocket.CONNECTING)
|
|
50310
50310
|
return;
|
|
50311
50311
|
req = websocket2._req = null;
|
|
50312
50312
|
const upgrade = res.headers.upgrade;
|
|
@@ -50380,7 +50380,7 @@ function requireWebsocket() {
|
|
|
50380
50380
|
}
|
|
50381
50381
|
}
|
|
50382
50382
|
function emitErrorAndClose(websocket2, err) {
|
|
50383
|
-
websocket2._readyState =
|
|
50383
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
50384
50384
|
websocket2._errorEmitted = true;
|
|
50385
50385
|
websocket2.emit("error", err);
|
|
50386
50386
|
websocket2.emitClose();
|
|
@@ -50397,7 +50397,7 @@ function requireWebsocket() {
|
|
|
50397
50397
|
return tls.connect(options);
|
|
50398
50398
|
}
|
|
50399
50399
|
function abortHandshake(websocket2, stream, message) {
|
|
50400
|
-
websocket2._readyState =
|
|
50400
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
50401
50401
|
const err = new Error(message);
|
|
50402
50402
|
Error.captureStackTrace(err, abortHandshake);
|
|
50403
50403
|
if (stream.setHeader) {
|
|
@@ -50477,10 +50477,10 @@ function requireWebsocket() {
|
|
|
50477
50477
|
}
|
|
50478
50478
|
function senderOnError(err) {
|
|
50479
50479
|
const websocket2 = this[kWebSocket];
|
|
50480
|
-
if (websocket2.readyState ===
|
|
50480
|
+
if (websocket2.readyState === WebSocket.CLOSED)
|
|
50481
50481
|
return;
|
|
50482
|
-
if (websocket2.readyState ===
|
|
50483
|
-
websocket2._readyState =
|
|
50482
|
+
if (websocket2.readyState === WebSocket.OPEN) {
|
|
50483
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
50484
50484
|
setCloseTimer(websocket2);
|
|
50485
50485
|
}
|
|
50486
50486
|
this._socket.end();
|
|
@@ -50497,7 +50497,7 @@ function requireWebsocket() {
|
|
|
50497
50497
|
this.removeListener("close", socketOnClose);
|
|
50498
50498
|
this.removeListener("data", socketOnData);
|
|
50499
50499
|
this.removeListener("end", socketOnEnd);
|
|
50500
|
-
websocket2._readyState =
|
|
50500
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
50501
50501
|
let chunk;
|
|
50502
50502
|
if (!this._readableState.endEmitted && !websocket2._closeFrameReceived && !websocket2._receiver._writableState.errorEmitted && (chunk = websocket2._socket.read()) !== null) {
|
|
50503
50503
|
websocket2._receiver.write(chunk);
|
|
@@ -50519,7 +50519,7 @@ function requireWebsocket() {
|
|
|
50519
50519
|
}
|
|
50520
50520
|
function socketOnEnd() {
|
|
50521
50521
|
const websocket2 = this[kWebSocket];
|
|
50522
|
-
websocket2._readyState =
|
|
50522
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
50523
50523
|
websocket2._receiver.end();
|
|
50524
50524
|
this.end();
|
|
50525
50525
|
}
|
|
@@ -50528,7 +50528,7 @@ function requireWebsocket() {
|
|
|
50528
50528
|
this.removeListener("error", socketOnError);
|
|
50529
50529
|
this.on("error", NOOP);
|
|
50530
50530
|
if (websocket2) {
|
|
50531
|
-
websocket2._readyState =
|
|
50531
|
+
websocket2._readyState = WebSocket.CLOSING;
|
|
50532
50532
|
this.destroy();
|
|
50533
50533
|
}
|
|
50534
50534
|
}
|
|
@@ -50707,7 +50707,7 @@ function requireWebsocketServer() {
|
|
|
50707
50707
|
const extension2 = requireExtension();
|
|
50708
50708
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
50709
50709
|
const subprotocol2 = requireSubprotocol();
|
|
50710
|
-
const
|
|
50710
|
+
const WebSocket = requireWebsocket();
|
|
50711
50711
|
const { GUID, kWebSocket } = requireConstants();
|
|
50712
50712
|
const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
50713
50713
|
const RUNNING = 0;
|
|
@@ -50732,7 +50732,7 @@ function requireWebsocketServer() {
|
|
|
50732
50732
|
host: null,
|
|
50733
50733
|
path: null,
|
|
50734
50734
|
port: null,
|
|
50735
|
-
WebSocket
|
|
50735
|
+
WebSocket,
|
|
50736
50736
|
...options
|
|
50737
50737
|
};
|
|
50738
50738
|
if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) {
|
|
@@ -52399,16 +52399,16 @@ function requireUtil() {
|
|
|
52399
52399
|
var _clearItems = function(api, id) {
|
|
52400
52400
|
_setStorageObject(api, id, null);
|
|
52401
52401
|
};
|
|
52402
|
-
var _callStorageFunction = function(func, args,
|
|
52402
|
+
var _callStorageFunction = function(func, args, location) {
|
|
52403
52403
|
var rval = null;
|
|
52404
|
-
if (typeof
|
|
52405
|
-
|
|
52404
|
+
if (typeof location === "undefined") {
|
|
52405
|
+
location = ["web", "flash"];
|
|
52406
52406
|
}
|
|
52407
52407
|
var type;
|
|
52408
52408
|
var done = false;
|
|
52409
52409
|
var exception = null;
|
|
52410
|
-
for (var idx in
|
|
52411
|
-
type =
|
|
52410
|
+
for (var idx in location) {
|
|
52411
|
+
type = location[idx];
|
|
52412
52412
|
try {
|
|
52413
52413
|
if (type === "flash" || type === "both") {
|
|
52414
52414
|
if (args[0] === null) {
|
|
@@ -52434,17 +52434,17 @@ function requireUtil() {
|
|
|
52434
52434
|
}
|
|
52435
52435
|
return rval;
|
|
52436
52436
|
};
|
|
52437
|
-
util$12.setItem = function(api, id, key, data,
|
|
52438
|
-
_callStorageFunction(_setItem, arguments,
|
|
52437
|
+
util$12.setItem = function(api, id, key, data, location) {
|
|
52438
|
+
_callStorageFunction(_setItem, arguments, location);
|
|
52439
52439
|
};
|
|
52440
|
-
util$12.getItem = function(api, id, key,
|
|
52441
|
-
return _callStorageFunction(_getItem, arguments,
|
|
52440
|
+
util$12.getItem = function(api, id, key, location) {
|
|
52441
|
+
return _callStorageFunction(_getItem, arguments, location);
|
|
52442
52442
|
};
|
|
52443
|
-
util$12.removeItem = function(api, id, key,
|
|
52444
|
-
_callStorageFunction(_removeItem, arguments,
|
|
52443
|
+
util$12.removeItem = function(api, id, key, location) {
|
|
52444
|
+
_callStorageFunction(_removeItem, arguments, location);
|
|
52445
52445
|
};
|
|
52446
|
-
util$12.clearItems = function(api, id,
|
|
52447
|
-
_callStorageFunction(_clearItems, arguments,
|
|
52446
|
+
util$12.clearItems = function(api, id, location) {
|
|
52447
|
+
_callStorageFunction(_clearItems, arguments, location);
|
|
52448
52448
|
};
|
|
52449
52449
|
util$12.isEmpty = function(obj) {
|
|
52450
52450
|
for (var prop in obj) {
|
|
@@ -68445,6 +68445,30 @@ class HttpsPem {
|
|
|
68445
68445
|
cert;
|
|
68446
68446
|
constructor(assistantConfig) {
|
|
68447
68447
|
this.assistantConfig = assistantConfig;
|
|
68448
|
+
this.#initKeyCert();
|
|
68449
|
+
}
|
|
68450
|
+
#initKeyCert() {
|
|
68451
|
+
this.assistantConfig.checkMounted();
|
|
68452
|
+
const config = this.assistantConfig.getConfig();
|
|
68453
|
+
if (config.https) {
|
|
68454
|
+
const httpsType = config.https?.type || "https";
|
|
68455
|
+
if (httpsType !== "https") {
|
|
68456
|
+
console.log(chalk2.yellow("当前配置文件 https.type 不是 https, 不使用证书"));
|
|
68457
|
+
return;
|
|
68458
|
+
}
|
|
68459
|
+
if (config.https.keyPath) {
|
|
68460
|
+
const keyPath = config.https.keyPath;
|
|
68461
|
+
const certPath = config.https.certPath;
|
|
68462
|
+
if (checkFileExists(keyPath) && checkFileExists(certPath)) {
|
|
68463
|
+
this.key = fs2.readFileSync(keyPath, "utf-8");
|
|
68464
|
+
this.cert = fs2.readFileSync(certPath, "utf-8");
|
|
68465
|
+
console.log(chalk2.green("使用配置文件 https.keyPath 和 https.certPath 的证书"), keyPath, certPath);
|
|
68466
|
+
return;
|
|
68467
|
+
} else {
|
|
68468
|
+
console.log(chalk2.red("证书路径不存在,请检查配置文件 https.keyPath 和 https.certPath 是否正确"));
|
|
68469
|
+
}
|
|
68470
|
+
}
|
|
68471
|
+
}
|
|
68448
68472
|
const { key, cert } = this.getCert();
|
|
68449
68473
|
this.key = key;
|
|
68450
68474
|
this.cert = cert;
|
|
@@ -69125,7 +69149,7 @@ var wsProxy = (server, config) => {
|
|
|
69125
69149
|
wssApp.upgrade(request, socket, head);
|
|
69126
69150
|
});
|
|
69127
69151
|
};
|
|
69128
|
-
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
69152
|
+
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.21_supports-color@10.0.0/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
69129
69153
|
var exports_manager = {};
|
|
69130
69154
|
__export(exports_manager, {
|
|
69131
69155
|
onAppShowInfo: () => onAppShowInfo,
|
|
@@ -69202,7 +69226,7 @@ var getConfigFile = (opts) => {
|
|
|
69202
69226
|
return "";
|
|
69203
69227
|
};
|
|
69204
69228
|
|
|
69205
|
-
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
69229
|
+
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.21_supports-color@10.0.0/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
69206
69230
|
import path6 from "node:path";
|
|
69207
69231
|
import fs6 from "node:fs";
|
|
69208
69232
|
import { fork } from "node:child_process";
|
|
@@ -70175,8 +70199,6 @@ var existDenpend = [
|
|
|
70175
70199
|
"ioredis",
|
|
70176
70200
|
"socket.io",
|
|
70177
70201
|
"minio",
|
|
70178
|
-
"pino",
|
|
70179
|
-
"pino-pretty",
|
|
70180
70202
|
"@msgpack/msgpack"
|
|
70181
70203
|
];
|
|
70182
70204
|
var AppType = /* @__PURE__ */ ((AppType2) => {
|
|
@@ -70267,10 +70289,15 @@ class Manager {
|
|
|
70267
70289
|
pm2Connect: this.#pm2Connect
|
|
70268
70290
|
});
|
|
70269
70291
|
const pm2Options = app.pm2Options || {};
|
|
70292
|
+
if (app?.engine) {
|
|
70293
|
+
pm2Options.interpreter = pm2Options.interpreter || app?.engine;
|
|
70294
|
+
}
|
|
70270
70295
|
if (!pm2Options.cwd) {
|
|
70271
70296
|
pm2Options.cwd = path6.join(app.path, "../..");
|
|
70272
70297
|
}
|
|
70273
70298
|
await pm2Manager.start(pm2Options);
|
|
70299
|
+
} else {
|
|
70300
|
+
console.error("app type not support", app.type);
|
|
70274
70301
|
}
|
|
70275
70302
|
console.log(`load ${app.type} success`, app.key);
|
|
70276
70303
|
return true;
|
|
@@ -70559,7 +70586,7 @@ var clearMicroApp = (link) => {
|
|
|
70559
70586
|
console.error(`Failed to unload module ${link}:`, error);
|
|
70560
70587
|
}
|
|
70561
70588
|
};
|
|
70562
|
-
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
70589
|
+
// node_modules/.pnpm/@kevisual+local-app-manager@0.1.21_supports-color@10.0.0/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
|
|
70563
70590
|
import pm22 from "pm2";
|
|
70564
70591
|
import { promisify as promisify2 } from "node:util";
|
|
70565
70592
|
var disconnect = promisify2(pm22.disconnect).bind(pm22);
|
|
@@ -70751,6 +70778,13 @@ class AssistantInit extends AssistantConfig {
|
|
|
70751
70778
|
}
|
|
70752
70779
|
};
|
|
70753
70780
|
}
|
|
70781
|
+
getHttps() {
|
|
70782
|
+
const https3 = this.getConfig()?.https || {};
|
|
70783
|
+
return {
|
|
70784
|
+
https: https3,
|
|
70785
|
+
protocol: https3?.type === "http" ? "http" : "https"
|
|
70786
|
+
};
|
|
70787
|
+
}
|
|
70754
70788
|
}
|
|
70755
70789
|
|
|
70756
70790
|
// node_modules/.pnpm/@kevisual+load@0.0.6/node_modules/@kevisual/load/dist/load.js
|
|
@@ -71254,12 +71288,30 @@ var useContextKey = (key, init) => {
|
|
|
71254
71288
|
var manualParse = parseHomeArg(configDir);
|
|
71255
71289
|
var _configDir = manualParse.configDir;
|
|
71256
71290
|
var configDir2 = AssistantInit.detectConfigDir(_configDir);
|
|
71291
|
+
var isInit = manualParse?.options?.help ? false : true;
|
|
71257
71292
|
var assistantConfig2 = new AssistantInit({
|
|
71258
71293
|
path: configDir2,
|
|
71259
|
-
init:
|
|
71294
|
+
init: isInit
|
|
71260
71295
|
});
|
|
71261
71296
|
var httpsPem = new HttpsPem(assistantConfig2);
|
|
71297
|
+
var runtime = useContextKey("runtime", () => {
|
|
71298
|
+
return {
|
|
71299
|
+
type: "client"
|
|
71300
|
+
};
|
|
71301
|
+
});
|
|
71262
71302
|
var app = useContextKey("app", () => {
|
|
71303
|
+
const init = isInit;
|
|
71304
|
+
if (init) {
|
|
71305
|
+
const config2 = assistantConfig2.getConfig();
|
|
71306
|
+
if (config2?.https?.type !== "https") {
|
|
71307
|
+
return new App({
|
|
71308
|
+
serverOptions: {
|
|
71309
|
+
path: "/client/router",
|
|
71310
|
+
httpType: "http"
|
|
71311
|
+
}
|
|
71312
|
+
});
|
|
71313
|
+
}
|
|
71314
|
+
}
|
|
71263
71315
|
return new App({
|
|
71264
71316
|
serverOptions: {
|
|
71265
71317
|
path: "/client/router",
|
|
@@ -71460,7 +71512,7 @@ var proxyWs = () => {
|
|
|
71460
71512
|
});
|
|
71461
71513
|
};
|
|
71462
71514
|
|
|
71463
|
-
// node_modules/.pnpm/@kevisual+query@0.0.20_@kevisual+ws@8.0.0/node_modules/@kevisual/query/dist/query
|
|
71515
|
+
// node_modules/.pnpm/@kevisual+query@0.0.20_@kevisual+ws@8.0.0/node_modules/@kevisual/query/dist/query.js
|
|
71464
71516
|
var adapter = async (opts, overloadOpts) => {
|
|
71465
71517
|
const controller = new AbortController;
|
|
71466
71518
|
const signal = controller.signal;
|
|
@@ -71631,11 +71683,34 @@ class Query {
|
|
|
71631
71683
|
}
|
|
71632
71684
|
}
|
|
71633
71685
|
|
|
71686
|
+
// src/module/reload-server.ts
|
|
71687
|
+
import pm23 from "pm2";
|
|
71688
|
+
async function reload2() {
|
|
71689
|
+
return new Promise((resolve, reject) => {
|
|
71690
|
+
pm23.connect((err) => {
|
|
71691
|
+
if (err) {
|
|
71692
|
+
logger.error("PM2 connection error:", err);
|
|
71693
|
+
return reject(err);
|
|
71694
|
+
}
|
|
71695
|
+
pm23.reload("assistant-server", (err2) => {
|
|
71696
|
+
if (err2) {
|
|
71697
|
+
logger.error("PM2 reload error:", err2);
|
|
71698
|
+
pm23.disconnect();
|
|
71699
|
+
return reject(err2);
|
|
71700
|
+
}
|
|
71701
|
+
logger.info("PM2 server reloaded successfully");
|
|
71702
|
+
pm23.disconnect();
|
|
71703
|
+
resolve();
|
|
71704
|
+
});
|
|
71705
|
+
});
|
|
71706
|
+
});
|
|
71707
|
+
}
|
|
71708
|
+
|
|
71634
71709
|
// src/routes/config/index.ts
|
|
71635
71710
|
app.route({
|
|
71636
71711
|
path: "config",
|
|
71637
71712
|
description: "获取配置",
|
|
71638
|
-
middleware: ["auth"]
|
|
71713
|
+
middleware: ["admin-auth"]
|
|
71639
71714
|
}).define(async (ctx) => {
|
|
71640
71715
|
ctx.body = assistantConfig2.getCacheAssistantConfig();
|
|
71641
71716
|
}).addTo(app);
|
|
@@ -71643,24 +71718,25 @@ app.route({
|
|
|
71643
71718
|
path: "config",
|
|
71644
71719
|
key: "set",
|
|
71645
71720
|
description: "设置配置",
|
|
71646
|
-
middleware: ["auth"]
|
|
71721
|
+
middleware: ["admin-auth"]
|
|
71647
71722
|
}).define(async (ctx) => {
|
|
71648
71723
|
const { data } = ctx.query;
|
|
71649
71724
|
ctx.body = assistantConfig2.setConfig(data);
|
|
71725
|
+
reload2();
|
|
71650
71726
|
}).addTo(app);
|
|
71651
71727
|
|
|
71652
71728
|
// src/services/app/index.ts
|
|
71653
71729
|
import path10 from "path";
|
|
71654
71730
|
import fs10 from "fs";
|
|
71655
71731
|
|
|
71656
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
71732
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/key.js
|
|
71657
71733
|
var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
|
|
71658
71734
|
var isDownKey = (key) => key.name === "down" || key.name === "j" || key.ctrl && key.name === "n";
|
|
71659
71735
|
var isSpaceKey = (key) => key.name === "space";
|
|
71660
71736
|
var isBackspaceKey = (key) => key.name === "backspace";
|
|
71661
71737
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
71662
71738
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
71663
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
71739
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/errors.js
|
|
71664
71740
|
class AbortPromptError extends Error {
|
|
71665
71741
|
name = "AbortPromptError";
|
|
71666
71742
|
message = "Prompt was aborted";
|
|
@@ -71686,10 +71762,10 @@ class HookError extends Error {
|
|
|
71686
71762
|
class ValidationError extends Error {
|
|
71687
71763
|
name = "ValidationError";
|
|
71688
71764
|
}
|
|
71689
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
71765
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-state.js
|
|
71690
71766
|
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
71691
71767
|
|
|
71692
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
71768
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js
|
|
71693
71769
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
71694
71770
|
var hookStorage = new AsyncLocalStorage;
|
|
71695
71771
|
function createStore(rl) {
|
|
@@ -71794,7 +71870,7 @@ var effectScheduler = {
|
|
|
71794
71870
|
}
|
|
71795
71871
|
};
|
|
71796
71872
|
|
|
71797
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
71873
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-state.js
|
|
71798
71874
|
function useState(defaultValue) {
|
|
71799
71875
|
return withPointer((pointer) => {
|
|
71800
71876
|
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
@@ -71812,7 +71888,7 @@ function useState(defaultValue) {
|
|
|
71812
71888
|
});
|
|
71813
71889
|
}
|
|
71814
71890
|
|
|
71815
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
71891
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-effect.js
|
|
71816
71892
|
function useEffect(cb, depArray) {
|
|
71817
71893
|
withPointer((pointer) => {
|
|
71818
71894
|
const oldDeps = pointer.get();
|
|
@@ -71824,7 +71900,7 @@ function useEffect(cb, depArray) {
|
|
|
71824
71900
|
});
|
|
71825
71901
|
}
|
|
71826
71902
|
|
|
71827
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
71903
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/theme.js
|
|
71828
71904
|
var import_yoctocolors_cjs = __toESM(require_yoctocolors_cjs(), 1);
|
|
71829
71905
|
|
|
71830
71906
|
// node_modules/.pnpm/@inquirer+figures@1.0.12/node_modules/@inquirer/figures/dist/esm/index.js
|
|
@@ -72113,7 +72189,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
72113
72189
|
var esm_default = figures;
|
|
72114
72190
|
var replacements = Object.entries(specialMainSymbols);
|
|
72115
72191
|
|
|
72116
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72192
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/theme.js
|
|
72117
72193
|
var defaultTheme = {
|
|
72118
72194
|
prefix: {
|
|
72119
72195
|
idle: import_yoctocolors_cjs.default.blue("?"),
|
|
@@ -72134,7 +72210,7 @@ var defaultTheme = {
|
|
|
72134
72210
|
}
|
|
72135
72211
|
};
|
|
72136
72212
|
|
|
72137
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72213
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/make-theme.js
|
|
72138
72214
|
function isPlainObject2(value) {
|
|
72139
72215
|
if (typeof value !== "object" || value === null)
|
|
72140
72216
|
return false;
|
|
@@ -72162,7 +72238,7 @@ function makeTheme(...themes) {
|
|
|
72162
72238
|
return deepMerge(...themesToMerge);
|
|
72163
72239
|
}
|
|
72164
72240
|
|
|
72165
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72241
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
|
|
72166
72242
|
function usePrefix({ status = "idle", theme }) {
|
|
72167
72243
|
const [showLoader, setShowLoader] = useState(false);
|
|
72168
72244
|
const [tick, setTick] = useState(0);
|
|
@@ -72192,7 +72268,7 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
72192
72268
|
const iconName = status === "loading" ? "idle" : status;
|
|
72193
72269
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
72194
72270
|
}
|
|
72195
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72271
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
|
|
72196
72272
|
function useMemo(fn, dependencies) {
|
|
72197
72273
|
return withPointer((pointer) => {
|
|
72198
72274
|
const prev = pointer.get();
|
|
@@ -72204,11 +72280,11 @@ function useMemo(fn, dependencies) {
|
|
|
72204
72280
|
return prev.value;
|
|
72205
72281
|
});
|
|
72206
72282
|
}
|
|
72207
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72283
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
|
|
72208
72284
|
function useRef(val) {
|
|
72209
72285
|
return useState({ current: val })[0];
|
|
72210
72286
|
}
|
|
72211
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72287
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
|
|
72212
72288
|
function useKeypress(userHandler) {
|
|
72213
72289
|
const signal = useRef(userHandler);
|
|
72214
72290
|
signal.current = userHandler;
|
|
@@ -72226,7 +72302,7 @@ function useKeypress(userHandler) {
|
|
|
72226
72302
|
};
|
|
72227
72303
|
}, []);
|
|
72228
72304
|
}
|
|
72229
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72305
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/utils.js
|
|
72230
72306
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
72231
72307
|
var import_wrap_ansi = __toESM(require_wrap_ansi(), 1);
|
|
72232
72308
|
function breakLines(content, width) {
|
|
@@ -72239,7 +72315,7 @@ function readlineWidth() {
|
|
|
72239
72315
|
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
72240
72316
|
}
|
|
72241
72317
|
|
|
72242
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72318
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
|
|
72243
72319
|
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
72244
72320
|
const state = useRef({
|
|
72245
72321
|
lastPointer: active,
|
|
@@ -72305,7 +72381,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
72305
72381
|
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
72306
72382
|
`);
|
|
72307
72383
|
}
|
|
72308
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72384
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
|
72309
72385
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
72310
72386
|
import * as readline2 from "node:readline";
|
|
72311
72387
|
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
@@ -72518,7 +72594,7 @@ var {
|
|
|
72518
72594
|
unload
|
|
72519
72595
|
} = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback);
|
|
72520
72596
|
|
|
72521
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72597
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
|
|
72522
72598
|
var import_ansi_escapes = __toESM(require_ansi_escapes(), 1);
|
|
72523
72599
|
import { stripVTControlCharacters } from "node:util";
|
|
72524
72600
|
var height = (content) => content.split(`
|
|
@@ -72588,7 +72664,7 @@ class ScreenManager {
|
|
|
72588
72664
|
}
|
|
72589
72665
|
}
|
|
72590
72666
|
|
|
72591
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72667
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js
|
|
72592
72668
|
class PromisePolyfill extends Promise {
|
|
72593
72669
|
static withResolver() {
|
|
72594
72670
|
let resolve;
|
|
@@ -72601,7 +72677,7 @@ class PromisePolyfill extends Promise {
|
|
|
72601
72677
|
}
|
|
72602
72678
|
}
|
|
72603
72679
|
|
|
72604
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72680
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
|
72605
72681
|
function getCallSites() {
|
|
72606
72682
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
72607
72683
|
let result = [];
|
|
@@ -72687,7 +72763,7 @@ function createPrompt(view) {
|
|
|
72687
72763
|
};
|
|
72688
72764
|
return prompt;
|
|
72689
72765
|
}
|
|
72690
|
-
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.
|
|
72766
|
+
// node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/Separator.js
|
|
72691
72767
|
var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
|
72692
72768
|
class Separator {
|
|
72693
72769
|
separator = import_yoctocolors_cjs2.default.dim(Array.from({ length: 15 }).join(esm_default.line));
|
|
@@ -72701,7 +72777,7 @@ class Separator {
|
|
|
72701
72777
|
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
72702
72778
|
}
|
|
72703
72779
|
}
|
|
72704
|
-
// node_modules/.pnpm/@inquirer+checkbox@4.1.8_@types+node@22.15.
|
|
72780
|
+
// node_modules/.pnpm/@inquirer+checkbox@4.1.8_@types+node@22.15.29/node_modules/@inquirer/checkbox/dist/esm/index.js
|
|
72705
72781
|
var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
|
|
72706
72782
|
var import_ansi_escapes2 = __toESM(require_ansi_escapes(), 1);
|
|
72707
72783
|
var checkboxTheme = {
|
|
@@ -72875,7 +72951,7 @@ ${theme.style.error(errorMsg)}`;
|
|
|
72875
72951
|
return `${prefix} ${message}${helpTipTop}
|
|
72876
72952
|
${page}${helpTipBottom}${choiceDescription}${error}${import_ansi_escapes2.default.cursorHide}`;
|
|
72877
72953
|
});
|
|
72878
|
-
// node_modules/.pnpm/@inquirer+editor@4.2.13_@types+node@22.15.
|
|
72954
|
+
// node_modules/.pnpm/@inquirer+editor@4.2.13_@types+node@22.15.29/node_modules/@inquirer/editor/dist/esm/index.js
|
|
72879
72955
|
var import_external_editor = __toESM(require_main2(), 1);
|
|
72880
72956
|
var editorTheme = {
|
|
72881
72957
|
validationFailureMode: "keep"
|
|
@@ -72943,7 +73019,7 @@ var esm_default3 = createPrompt((config2, done) => {
|
|
|
72943
73019
|
}
|
|
72944
73020
|
return [[prefix, message, helpTip].filter(Boolean).join(" "), error];
|
|
72945
73021
|
});
|
|
72946
|
-
// node_modules/.pnpm/@inquirer+confirm@5.1.12_@types+node@22.15.
|
|
73022
|
+
// node_modules/.pnpm/@inquirer+confirm@5.1.12_@types+node@22.15.29/node_modules/@inquirer/confirm/dist/esm/index.js
|
|
72947
73023
|
function getBooleanValue(value, defaultValue) {
|
|
72948
73024
|
let answer = defaultValue !== false;
|
|
72949
73025
|
if (/^(y|yes)/i.test(value))
|
|
@@ -72986,7 +73062,7 @@ var esm_default4 = createPrompt((config2, done) => {
|
|
|
72986
73062
|
const message = theme.style.message(config2.message, status);
|
|
72987
73063
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
72988
73064
|
});
|
|
72989
|
-
// node_modules/.pnpm/@inquirer+input@4.1.12_@types+node@22.15.
|
|
73065
|
+
// node_modules/.pnpm/@inquirer+input@4.1.12_@types+node@22.15.29/node_modules/@inquirer/input/dist/esm/index.js
|
|
72990
73066
|
var inputTheme = {
|
|
72991
73067
|
validationFailureMode: "keep"
|
|
72992
73068
|
};
|
|
@@ -73051,7 +73127,7 @@ var esm_default5 = createPrompt((config2, done) => {
|
|
|
73051
73127
|
error
|
|
73052
73128
|
];
|
|
73053
73129
|
});
|
|
73054
|
-
// node_modules/.pnpm/@inquirer+number@3.0.15_@types+node@22.15.
|
|
73130
|
+
// node_modules/.pnpm/@inquirer+number@3.0.15_@types+node@22.15.29/node_modules/@inquirer/number/dist/esm/index.js
|
|
73055
73131
|
function isStepOf(value, step, min) {
|
|
73056
73132
|
const valuePow = value * Math.pow(10, 6);
|
|
73057
73133
|
const stepPow = step * Math.pow(10, 6);
|
|
@@ -73131,7 +73207,7 @@ var esm_default6 = createPrompt((config2, done) => {
|
|
|
73131
73207
|
error
|
|
73132
73208
|
];
|
|
73133
73209
|
});
|
|
73134
|
-
// node_modules/.pnpm/@inquirer+expand@4.0.15_@types+node@22.15.
|
|
73210
|
+
// node_modules/.pnpm/@inquirer+expand@4.0.15_@types+node@22.15.29/node_modules/@inquirer/expand/dist/esm/index.js
|
|
73135
73211
|
var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
|
|
73136
73212
|
function normalizeChoices2(choices) {
|
|
73137
73213
|
return choices.map((choice) => {
|
|
@@ -73228,7 +73304,7 @@ var esm_default7 = createPrompt((config2, done) => {
|
|
|
73228
73304
|
`)
|
|
73229
73305
|
];
|
|
73230
73306
|
});
|
|
73231
|
-
// node_modules/.pnpm/@inquirer+rawlist@4.1.3_@types+node@22.15.
|
|
73307
|
+
// node_modules/.pnpm/@inquirer+rawlist@4.1.3_@types+node@22.15.29/node_modules/@inquirer/rawlist/dist/esm/index.js
|
|
73232
73308
|
var import_yoctocolors_cjs5 = __toESM(require_yoctocolors_cjs(), 1);
|
|
73233
73309
|
var numberRegex = /\d+/;
|
|
73234
73310
|
function isSelectableChoice(choice) {
|
|
@@ -73340,7 +73416,7 @@ var esm_default8 = createPrompt((config2, done) => {
|
|
|
73340
73416
|
`)
|
|
73341
73417
|
];
|
|
73342
73418
|
});
|
|
73343
|
-
// node_modules/.pnpm/@inquirer+password@4.0.15_@types+node@22.15.
|
|
73419
|
+
// node_modules/.pnpm/@inquirer+password@4.0.15_@types+node@22.15.29/node_modules/@inquirer/password/dist/esm/index.js
|
|
73344
73420
|
var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
|
|
73345
73421
|
var esm_default9 = createPrompt((config2, done) => {
|
|
73346
73422
|
const { validate = () => true } = config2;
|
|
@@ -73389,7 +73465,7 @@ var esm_default9 = createPrompt((config2, done) => {
|
|
|
73389
73465
|
}
|
|
73390
73466
|
return [[prefix, message, config2.mask ? formattedValue : helpTip].join(" "), error];
|
|
73391
73467
|
});
|
|
73392
|
-
// node_modules/.pnpm/@inquirer+search@3.0.15_@types+node@22.15.
|
|
73468
|
+
// node_modules/.pnpm/@inquirer+search@3.0.15_@types+node@22.15.29/node_modules/@inquirer/search/dist/esm/index.js
|
|
73393
73469
|
var import_yoctocolors_cjs6 = __toESM(require_yoctocolors_cjs(), 1);
|
|
73394
73470
|
var searchTheme = {
|
|
73395
73471
|
icon: { cursor: esm_default.pointer },
|
|
@@ -73554,7 +73630,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
|
|
|
73554
73630
|
`${error ?? page}${helpTip}${choiceDescription}`
|
|
73555
73631
|
];
|
|
73556
73632
|
});
|
|
73557
|
-
// node_modules/.pnpm/@inquirer+select@4.2.3_@types+node@22.15.
|
|
73633
|
+
// node_modules/.pnpm/@inquirer+select@4.2.3_@types+node@22.15.29/node_modules/@inquirer/select/dist/esm/index.js
|
|
73558
73634
|
var import_yoctocolors_cjs7 = __toESM(require_yoctocolors_cjs(), 1);
|
|
73559
73635
|
var import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
|
|
73560
73636
|
var selectTheme = {
|
|
@@ -73700,7 +73776,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
|
|
|
73700
73776
|
return `${[prefix, message, helpTipTop].filter(Boolean).join(" ")}
|
|
73701
73777
|
${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes4.default.cursorHide}`;
|
|
73702
73778
|
});
|
|
73703
|
-
// node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.
|
|
73779
|
+
// node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.29/node_modules/inquirer/dist/esm/ui/prompt.js
|
|
73704
73780
|
var import_rxjs = __toESM(require_cjs(), 1);
|
|
73705
73781
|
var import_run_async = __toESM(require_run_async(), 1);
|
|
73706
73782
|
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
@@ -73912,7 +73988,7 @@ class PromptsRunner {
|
|
|
73912
73988
|
};
|
|
73913
73989
|
}
|
|
73914
73990
|
|
|
73915
|
-
// node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.
|
|
73991
|
+
// node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.29/node_modules/inquirer/dist/esm/index.js
|
|
73916
73992
|
var builtInPrompts = {
|
|
73917
73993
|
input: esm_default5,
|
|
73918
73994
|
select: esm_default11,
|
|
@@ -76992,13 +77068,13 @@ var require_lib22 = __commonJS2((exports, module) => {
|
|
|
76992
77068
|
clearTimeout(reqTimeout);
|
|
76993
77069
|
const headers = createHeadersLenient(res.headers);
|
|
76994
77070
|
if (fetch2.isRedirect(res.statusCode)) {
|
|
76995
|
-
const
|
|
77071
|
+
const location = headers.get("Location");
|
|
76996
77072
|
let locationURL = null;
|
|
76997
77073
|
try {
|
|
76998
|
-
locationURL =
|
|
77074
|
+
locationURL = location === null ? null : new URL$1(location, request.url).toString();
|
|
76999
77075
|
} catch (err) {
|
|
77000
77076
|
if (request.redirect !== "manual") {
|
|
77001
|
-
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${
|
|
77077
|
+
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, "invalid-redirect"));
|
|
77002
77078
|
finalize();
|
|
77003
77079
|
return;
|
|
77004
77080
|
}
|
|
@@ -87620,28 +87696,24 @@ app2.route({
|
|
|
87620
87696
|
|
|
87621
87697
|
// src/routes/index.ts
|
|
87622
87698
|
import os3 from "node:os";
|
|
87623
|
-
|
|
87624
|
-
path: "auth",
|
|
87625
|
-
id: "auth"
|
|
87626
|
-
}).define(async (ctx) => {
|
|
87699
|
+
var checkAuth = async (ctx, isAdmin = false) => {
|
|
87627
87700
|
const config2 = assistantConfig2.getConfig();
|
|
87628
87701
|
const { auth } = config2;
|
|
87629
87702
|
const host = config2.pageApi || config2.registry || "https://kevisual.cn";
|
|
87630
87703
|
const url2 = new URL("/api/router", host);
|
|
87631
|
-
const token = ctx.token;
|
|
87704
|
+
const token = ctx.query.token;
|
|
87632
87705
|
if (auth && auth.type !== "public") {
|
|
87633
87706
|
if (!token) {
|
|
87634
|
-
return ctx.throw(
|
|
87707
|
+
return ctx.throw(401, "not login");
|
|
87635
87708
|
}
|
|
87636
87709
|
url2.searchParams.set("token", token);
|
|
87637
|
-
const query = new Query({
|
|
87710
|
+
const query = new Query({ url: url2.toString() });
|
|
87638
87711
|
const res = await query.post({
|
|
87639
87712
|
path: "user",
|
|
87640
87713
|
key: "me"
|
|
87641
87714
|
});
|
|
87642
|
-
console.log("res", res);
|
|
87643
87715
|
if (res.code !== 200) {
|
|
87644
|
-
return ctx.throw(
|
|
87716
|
+
return ctx.throw(401, "not login");
|
|
87645
87717
|
}
|
|
87646
87718
|
const tokenUser = res.data || {};
|
|
87647
87719
|
ctx.state = {
|
|
@@ -87649,7 +87721,26 @@ app.route({
|
|
|
87649
87721
|
tokenUser
|
|
87650
87722
|
};
|
|
87651
87723
|
const { username } = tokenUser;
|
|
87724
|
+
if (isAdmin) {
|
|
87725
|
+
if (auth.username && auth.username !== username) {
|
|
87726
|
+
return ctx.throw(403, "not admin user");
|
|
87727
|
+
}
|
|
87728
|
+
}
|
|
87652
87729
|
}
|
|
87730
|
+
};
|
|
87731
|
+
app.route({
|
|
87732
|
+
path: "auth",
|
|
87733
|
+
id: "auth",
|
|
87734
|
+
isDebug: true,
|
|
87735
|
+
description: "获取当前登录用户信息"
|
|
87736
|
+
}).define(async (ctx) => {
|
|
87737
|
+
await checkAuth(ctx);
|
|
87738
|
+
}).addTo(app);
|
|
87739
|
+
app.route({
|
|
87740
|
+
path: "admin-auth",
|
|
87741
|
+
id: "admin-auth"
|
|
87742
|
+
}).define(async (ctx) => {
|
|
87743
|
+
await checkAuth(ctx, true);
|
|
87653
87744
|
}).addTo(app);
|
|
87654
87745
|
app.route({
|
|
87655
87746
|
path: "client",
|
|
@@ -87857,7 +87948,8 @@ var runServer = async (port, listenPath = "127.0.0.1") => {
|
|
|
87857
87948
|
});
|
|
87858
87949
|
} else {
|
|
87859
87950
|
app.listen(_port, listenPath, () => {
|
|
87860
|
-
|
|
87951
|
+
const protocol = assistantConfig2.getHttps().protocol;
|
|
87952
|
+
console.log(`Server is running on ${protocol}://${listenPath}:${_port}`);
|
|
87861
87953
|
});
|
|
87862
87954
|
}
|
|
87863
87955
|
app.server.on(proxyRoute);
|