@rubytech/create-maxy 1.0.760 → 1.0.762
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/package.json +1 -1
- package/payload/platform/plugins/docs/references/platform.md +1 -1
- package/payload/server/chunk-43JK6WNK.js +3057 -0
- package/payload/server/chunk-QXAUMZXQ.js +9512 -0
- package/payload/server/client-pool-SGPHSYLK.js +28 -0
- package/payload/server/maxy-edge.js +2 -2
- package/payload/server/public/assets/{Checkbox-C24nM41g.js → Checkbox-BRLBdX7n.js} +1 -1
- package/payload/server/public/assets/admin-7vGwd7wu.js +352 -0
- package/payload/server/public/assets/{arc-CRqJUbyK.js → arc-BMhgytDB.js} +1 -1
- package/payload/server/public/assets/architecture-YZFGNWBL-S9-oeq_x.js +1 -0
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-DtICG195.js → architectureDiagram-Q4EWVU46-BePoi8XC.js} +1 -1
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-nw1V7I38.js → blockDiagram-DXYQGD6D-BkiwLTtq.js} +1 -1
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-C1eEC43O.js → c4Diagram-AHTNJAMY-bpjPj2Ln.js} +1 -1
- package/payload/server/public/assets/channel-D3U0_a1j.js +1 -0
- package/payload/server/public/assets/{chunk-2KRD3SAO-Bybqj-wj.js → chunk-2KRD3SAO-ZcHg_orY.js} +1 -1
- package/payload/server/public/assets/{chunk-336JU56O-Dszn2qEY.js → chunk-336JU56O-BpATJiGl.js} +2 -2
- package/payload/server/public/assets/chunk-426QAEUC-Wz6Bpsil.js +1 -0
- package/payload/server/public/assets/{chunk-4BX2VUAB-DrKtrnWH.js → chunk-4BX2VUAB-zJekz2NU.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-CBFzVYqS.js → chunk-4TB4RGXK-CLXL19Wd.js} +1 -1
- package/payload/server/public/assets/{chunk-55IACEB6-BNsOFSNf.js → chunk-55IACEB6-CzqB8aoU.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-CXZykYh_.js → chunk-5FUZZQ4R-BoTfWHuW.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-CLNppenz.js → chunk-5PVQY5BW-RhIfPCRB.js} +1 -1
- package/payload/server/public/assets/{chunk-67CJDMHE-DFyE0-n0.js → chunk-67CJDMHE-mM1sFmlz.js} +1 -1
- package/payload/server/public/assets/{chunk-7N4EOEYR-BIKZD1_4.js → chunk-7N4EOEYR-GUck0jv1.js} +1 -1
- package/payload/server/public/assets/{chunk-AA7GKIK3-D4_g24le.js → chunk-AA7GKIK3-BYhfUc1V.js} +1 -1
- package/payload/server/public/assets/{chunk-BSJP7CBP-Cd9H-V61.js → chunk-BSJP7CBP-CTsYuARh.js} +1 -1
- package/payload/server/public/assets/{chunk-CIAEETIT-CAU9PIQi.js → chunk-CIAEETIT-CGsGmUze.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-CR1JfOwe.js → chunk-EDXVE4YY-utELKGQK.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-CuXW3Isg.js → chunk-ENJZ2VHE-CNHjq5xK.js} +1 -1
- package/payload/server/public/assets/{chunk-FMBD7UC4-BwGAtkIr.js → chunk-FMBD7UC4-DaRrfk3s.js} +1 -1
- package/payload/server/public/assets/{chunk-FOC6F5B3-Cn0552qP.js → chunk-FOC6F5B3-BaeLcJVt.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-DEZT2XyQ.js → chunk-ICPOFSXX-Di63NBur.js} +2 -2
- package/payload/server/public/assets/{chunk-K5T4RW27-KwBFTzJ9.js → chunk-K5T4RW27-CTTOezMH.js} +1 -1
- package/payload/server/public/assets/{chunk-KGLVRYIC-1-3y582Z.js → chunk-KGLVRYIC-DCkohKP2.js} +1 -1
- package/payload/server/public/assets/{chunk-LIHQZDEY-DXIBsDHL.js → chunk-LIHQZDEY-osQO30uB.js} +1 -1
- package/payload/server/public/assets/{chunk-ORNJ4GCN-CRbOike7.js → chunk-ORNJ4GCN-DoLajOOe.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-CVT9itnY.js → chunk-OYMX7WX6-BSPzqyxs.js} +1 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-BAQp1OEl.js +1 -0
- package/payload/server/public/assets/{chunk-U2HBQHQK-BLgNHWFf.js → chunk-U2HBQHQK-BZnA7c4T.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-DHYLiYqc.js → chunk-X2U36JSP-DpQ2OA_c.js} +1 -1
- package/payload/server/public/assets/{chunk-XPW4576I-DBdiQ3Zy.js → chunk-XPW4576I-BccP1mlQ.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-DXaosB5Z.js → chunk-YZCP3GAM-BAkNXu0G.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-B5dCmOpH.js → chunk-ZZ45TVLE-DBSm41oP.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-6EGGLDD_.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-DfAV4tgE.js +1 -0
- package/payload/server/public/assets/clone-BoV8noAi.js +1 -0
- package/payload/server/public/assets/{cose-bilkent-S5V4N54A-DaHtPQvk.js → cose-bilkent-S5V4N54A-Boeb8aWs.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-CAL9V_HR.js → dagre-KV5264BT-BkvWofSp.js} +1 -1
- package/payload/server/public/assets/{dagre-N8C5Xujx.js → dagre-nvPNAunb.js} +1 -1
- package/payload/server/public/assets/data-DVeGdjv2.js +1 -0
- package/payload/server/public/assets/{diagram-5BDNPKRD-pzBSPqlM.js → diagram-5BDNPKRD-CMEgyt4E.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-DStdLqos.js → diagram-G4DWMVQ6-ChorrAF0.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-D-SfeX-6.js → diagram-MMDJMWI5-D_iD27po.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-Cdr1DQ84.js → diagram-TYMM5635-8qXI1ioG.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-CIg1dDZT.js → erDiagram-SMLLAGMA-BFjtKDSB.js} +1 -1
- package/payload/server/public/assets/{flatten-CpKIi5d2.js → flatten-ya0TqRLc.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-CJtU1T6d.js → flowDiagram-DWJPFMVM-Bpd7IL9l.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-R4fuRAT1.js → ganttDiagram-T4ZO3ILL-CwOozU85.js} +1 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-BOC4CldZ.js +1 -0
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-sifugSGn.js → gitGraphDiagram-UUTBAWPF-CcPILiC9.js} +1 -1
- package/payload/server/public/assets/graph-BHcUKzXh.js +1 -0
- package/payload/server/public/assets/{graphlib-DrlxPM8j.js → graphlib-B_mcXEVr.js} +1 -1
- package/payload/server/public/assets/info-OMHHGYJF-BSCPTUIx.js +1 -0
- package/payload/server/public/assets/infoDiagram-42DDH7IO-T2sn--WJ.js +2 -0
- package/payload/server/public/assets/{isEmpty-C3Vxk1It.js → isEmpty-h-wRi_o9.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-CYUJOA2c.js → ishikawaDiagram-UXIWVN3A-DOP9-Q8H.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-UltrLajs.js → journeyDiagram-VCZTEJTY-DGATg0WC.js} +1 -1
- package/payload/server/public/assets/{jsx-runtime-CW8OiWT9.css → jsx-runtime-BRkYVd7p.css} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-BBaThtP3.js → kanban-definition-6JOO6SKY-C5PigmKg.js} +1 -1
- package/payload/server/public/assets/{line-BhOwLD_o.js → line-DlKKhwkO.js} +1 -1
- package/payload/server/public/assets/{linear-D76hoLvZ.js → linear-DD4JiB1l.js} +1 -1
- package/payload/server/public/assets/{mermaid-parser.core-D8n5xV7A.js → mermaid-parser.core-C8xGCa9p.js} +2 -2
- package/payload/server/public/assets/{mermaid.core-C3TZA9fX.js → mermaid.core-CCUSwZB_.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-Bv1kghvk.js → mindmap-definition-QFDTVHPH-75k-IVhC.js} +1 -1
- package/payload/server/public/assets/{ordinal-BLrOss5K.js → ordinal-Dwxksj1B.js} +1 -1
- package/payload/server/public/assets/packet-4T2RLAQJ-pBa_ZhNI.js +1 -0
- package/payload/server/public/assets/page-DxH_Opxt.js +50 -0
- package/payload/server/public/assets/page-v5z5MBB6.js +1 -0
- package/payload/server/public/assets/pie-ZZUOXDRM-BzYOyiMb.js +1 -0
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-BSYldcKa.js → pieDiagram-DEJITSTG-DN5RsDwZ.js} +1 -1
- package/payload/server/public/assets/{public-C_mAXOnw.js → public-CQ_WMUng.js} +1 -1
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-lCDshgz1.js → quadrantDiagram-34T5L4WZ-Sd9x6pNe.js} +1 -1
- package/payload/server/public/assets/radar-PYXPWWZC-CTVOaAq6.js +1 -0
- package/payload/server/public/assets/{reduce-C5tBOlxC.js → reduce-BUuWaDl2.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-C7j42RrO.js → requirementDiagram-MS252O5E-BDgifYzj.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-plPbHhuF.js → sankeyDiagram-XADWPNL6-BX9VULNJ.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-D3Y8MXiX.js → sequenceDiagram-FGHM5R23-z3vMxhgE.js} +1 -1
- package/payload/server/public/assets/share-2-Cc99o2of.js +1 -0
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-D4BdhMPy.js → stateDiagram-FHFEXIEX-DlP0hBxF.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DSddQStC.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-Lh9jrYCl.js → timeline-definition-GMOUNBTQ-DwQbhKCo.js} +1 -1
- package/payload/server/public/assets/treeView-SZITEDCU-OTnF4Qzw.js +1 -0
- package/payload/server/public/assets/treemap-W4RFUUIX-DlIRmHFb.js +1 -0
- package/payload/server/public/assets/{useVoiceRecorder-CAf6yMpK.js → useVoiceRecorder-C2CyyNiy.js} +3 -3
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-Cx0v19iv.js → vennDiagram-DHZGUBPP-WTqmZWWa.js} +1 -1
- package/payload/server/public/assets/wardley-RL74JXVD-DwMXAC4U.js +1 -0
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-BYewCTre.js → wardleyDiagram-NUSXRM2D-BUY50x5T.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-CkfIdbJu.js → xychartDiagram-5P7HB3ND-Btdq-fDj.js} +1 -1
- package/payload/server/public/data.html +5 -6
- package/payload/server/public/graph.html +6 -7
- package/payload/server/public/index.html +9 -9
- package/payload/server/public/public.html +6 -6
- package/payload/server/server.js +224 -94
- package/payload/server/public/assets/admin-DHg5a2u2.js +0 -352
- package/payload/server/public/assets/architecture-YZFGNWBL-CXIHKKCa.js +0 -1
- package/payload/server/public/assets/channel-CA7njeKl.js +0 -1
- package/payload/server/public/assets/chunk-426QAEUC-tWQOa3-I.js +0 -1
- package/payload/server/public/assets/chunk-QZHKN3VN-BwkFBCAY.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-CUZ9BU_6.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-BGYsCDux.js +0 -1
- package/payload/server/public/assets/clone-BjouONkW.js +0 -1
- package/payload/server/public/assets/data-Bfj5UBbk.js +0 -1
- package/payload/server/public/assets/file-CLa5WeSl.js +0 -1
- package/payload/server/public/assets/gitGraph-7Q5UKJZL-tvzbaNdg.js +0 -1
- package/payload/server/public/assets/graph-B6YWFq_S.js +0 -50
- package/payload/server/public/assets/house-BSa2PlqY.js +0 -1
- package/payload/server/public/assets/info-OMHHGYJF-ByeBaFw5.js +0 -1
- package/payload/server/public/assets/infoDiagram-42DDH7IO-CjgCxerY.js +0 -2
- package/payload/server/public/assets/packet-4T2RLAQJ-Csybj5RO.js +0 -1
- package/payload/server/public/assets/pie-ZZUOXDRM-Iw1du1Bn.js +0 -1
- package/payload/server/public/assets/radar-PYXPWWZC-rEet4TBV.js +0 -1
- package/payload/server/public/assets/share-2-Sy-qhrFk.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DhKxVkX3.js +0 -1
- package/payload/server/public/assets/treeView-SZITEDCU-PaLYyjtc.js +0 -1
- package/payload/server/public/assets/treemap-W4RFUUIX-CEhGYFbO.js +0 -1
- package/payload/server/public/assets/wardley-RL74JXVD-xtJ4_o4d.js +0 -1
- package/payload/server/public/assets/x-BMWxX7y6.js +0 -1
- /package/payload/server/public/assets/{_baseFor-WfS9pKAn.js → _baseFor-Dn4GSmI6.js} +0 -0
- /package/payload/server/public/assets/{array-HeX70jSN.js → array-DJN9YAVf.js} +0 -0
- /package/payload/server/public/assets/{cytoscape.esm-CDZo0kst.js → cytoscape.esm-BcJTl1re.js} +0 -0
- /package/payload/server/public/assets/{defaultLocale-GJwWH1Jr.js → defaultLocale-B4F_XsBB.js} +0 -0
- /package/payload/server/public/assets/{dist-BKbAaes5.js → dist-CrzV1W3-.js} +0 -0
- /package/payload/server/public/assets/{init-BPLPMQ3Y.js → init-DX0Y1qU4.js} +0 -0
- /package/payload/server/public/assets/{jsx-runtime-CFleUYzT.js → jsx-runtime-B4QFltsm.js} +0 -0
- /package/payload/server/public/assets/{katex-CKZ-HWMQ.js → katex-CjHJ1D7d.js} +0 -0
- /package/payload/server/public/assets/{path-YdFzr2W6.js → path-7vUsG-o2.js} +0 -0
- /package/payload/server/public/assets/{preload-helper-BEFjQwLd.js → preload-helper-qlgyTAkD.js} +0 -0
- /package/payload/server/public/assets/{rough.esm-HAx67Hnb.js → rough.esm-NLRoWnq-.js} +0 -0
- /package/payload/server/public/assets/{src-BvrHnOMG.js → src-Bo15iQ7w.js} +0 -0
package/payload/server/server.js
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
vncLog,
|
|
48
48
|
waitForExit,
|
|
49
49
|
writeChromiumWrapper
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-QXAUMZXQ.js";
|
|
51
51
|
import {
|
|
52
52
|
ACCOUNTS_DIR,
|
|
53
53
|
GREETING_DIRECTIVE,
|
|
@@ -77,6 +77,7 @@ import {
|
|
|
77
77
|
getGroupSlugForSession,
|
|
78
78
|
getMessagesSince,
|
|
79
79
|
getRecentMessages,
|
|
80
|
+
getRoleForSession,
|
|
80
81
|
getSession,
|
|
81
82
|
getSessionMessages,
|
|
82
83
|
getUserIdForSession,
|
|
@@ -106,7 +107,7 @@ import {
|
|
|
106
107
|
validateSession,
|
|
107
108
|
verifyAndGetConversationUpdatedAt,
|
|
108
109
|
verifyConversationOwnership
|
|
109
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-43JK6WNK.js";
|
|
110
111
|
|
|
111
112
|
// ../lib/graph-trash/dist/index.js
|
|
112
113
|
var require_dist = __commonJS({
|
|
@@ -606,7 +607,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
606
607
|
|
|
607
608
|
// server/index.ts
|
|
608
609
|
import { readFileSync as readFileSync16, existsSync as existsSync19, watchFile } from "fs";
|
|
609
|
-
import { resolve as
|
|
610
|
+
import { resolve as resolve21, join as join10, basename as basename7 } from "path";
|
|
610
611
|
import { homedir as homedir2 } from "os";
|
|
611
612
|
|
|
612
613
|
// app/lib/agent-slug-pattern.ts
|
|
@@ -2691,7 +2692,7 @@ var credsSaveQueue = Promise.resolve();
|
|
|
2691
2692
|
async function drainCredsSaveQueue(timeoutMs = 5e3) {
|
|
2692
2693
|
console.error(`${TAG3} draining credential save queue\u2026`);
|
|
2693
2694
|
const timer2 = new Promise(
|
|
2694
|
-
(
|
|
2695
|
+
(resolve22) => setTimeout(() => resolve22("timeout"), timeoutMs)
|
|
2695
2696
|
);
|
|
2696
2697
|
const result = await Promise.race([
|
|
2697
2698
|
credsSaveQueue.then(() => "drained"),
|
|
@@ -2819,11 +2820,11 @@ async function createWaSocket(opts) {
|
|
|
2819
2820
|
return sock;
|
|
2820
2821
|
}
|
|
2821
2822
|
async function waitForConnection(sock) {
|
|
2822
|
-
return new Promise((
|
|
2823
|
+
return new Promise((resolve22, reject) => {
|
|
2823
2824
|
const handler = (update) => {
|
|
2824
2825
|
if (update.connection === "open") {
|
|
2825
2826
|
sock.ev.off("connection.update", handler);
|
|
2826
|
-
|
|
2827
|
+
resolve22();
|
|
2827
2828
|
}
|
|
2828
2829
|
if (update.connection === "close") {
|
|
2829
2830
|
sock.ev.off("connection.update", handler);
|
|
@@ -2937,14 +2938,14 @@ ${inspected}`;
|
|
|
2937
2938
|
return inspect2(err, INSPECT_OPTS2);
|
|
2938
2939
|
}
|
|
2939
2940
|
function withTimeout(label, promise, timeoutMs) {
|
|
2940
|
-
return new Promise((
|
|
2941
|
+
return new Promise((resolve22, reject) => {
|
|
2941
2942
|
const timer2 = setTimeout(() => {
|
|
2942
2943
|
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
2943
2944
|
}, timeoutMs);
|
|
2944
2945
|
promise.then(
|
|
2945
2946
|
(value) => {
|
|
2946
2947
|
clearTimeout(timer2);
|
|
2947
|
-
|
|
2948
|
+
resolve22(value);
|
|
2948
2949
|
},
|
|
2949
2950
|
(err) => {
|
|
2950
2951
|
clearTimeout(timer2);
|
|
@@ -4158,11 +4159,11 @@ async function connectWithReconnect(conn) {
|
|
|
4158
4159
|
console.error(
|
|
4159
4160
|
`${TAG11} reconnecting account=${conn.accountId} in ${delay}ms (attempt ${decision.nextAttempts}/${maxAttempts})`
|
|
4160
4161
|
);
|
|
4161
|
-
await new Promise((
|
|
4162
|
-
const timer2 = setTimeout(
|
|
4162
|
+
await new Promise((resolve22) => {
|
|
4163
|
+
const timer2 = setTimeout(resolve22, delay);
|
|
4163
4164
|
conn.abortController.signal.addEventListener("abort", () => {
|
|
4164
4165
|
clearTimeout(timer2);
|
|
4165
|
-
|
|
4166
|
+
resolve22();
|
|
4166
4167
|
}, { once: true });
|
|
4167
4168
|
});
|
|
4168
4169
|
}
|
|
@@ -4170,16 +4171,16 @@ async function connectWithReconnect(conn) {
|
|
|
4170
4171
|
}
|
|
4171
4172
|
}
|
|
4172
4173
|
function waitForDisconnectEvent(conn) {
|
|
4173
|
-
return new Promise((
|
|
4174
|
+
return new Promise((resolve22) => {
|
|
4174
4175
|
if (!conn.sock) {
|
|
4175
|
-
|
|
4176
|
+
resolve22();
|
|
4176
4177
|
return;
|
|
4177
4178
|
}
|
|
4178
4179
|
const sock = conn.sock;
|
|
4179
4180
|
const handler = (update) => {
|
|
4180
4181
|
if (update.connection === "close") {
|
|
4181
4182
|
sock.ev.off("connection.update", handler);
|
|
4182
|
-
|
|
4183
|
+
resolve22();
|
|
4183
4184
|
}
|
|
4184
4185
|
};
|
|
4185
4186
|
sock.ev.on("connection.update", handler);
|
|
@@ -4396,8 +4397,8 @@ async function handleInboundMessage(conn, msg) {
|
|
|
4396
4397
|
const conversationKey = isGroup ? remoteJid : senderPhone;
|
|
4397
4398
|
const debounceKey = `${conn.accountId}:${conversationKey}:${senderPhone}`;
|
|
4398
4399
|
let resolvePending;
|
|
4399
|
-
const sttPending = new Promise((
|
|
4400
|
-
resolvePending =
|
|
4400
|
+
const sttPending = new Promise((resolve22) => {
|
|
4401
|
+
resolvePending = resolve22;
|
|
4401
4402
|
});
|
|
4402
4403
|
if (conn.debouncer) conn.debouncer.registerPending(debounceKey, sttPending);
|
|
4403
4404
|
try {
|
|
@@ -4510,20 +4511,20 @@ async function probeApiKey() {
|
|
|
4510
4511
|
return result.status;
|
|
4511
4512
|
}
|
|
4512
4513
|
function checkPort(port2, timeoutMs = 500) {
|
|
4513
|
-
return new Promise((
|
|
4514
|
+
return new Promise((resolve22) => {
|
|
4514
4515
|
const socket = createConnection(port2, "127.0.0.1");
|
|
4515
4516
|
socket.setTimeout(timeoutMs);
|
|
4516
4517
|
socket.once("connect", () => {
|
|
4517
4518
|
socket.destroy();
|
|
4518
|
-
|
|
4519
|
+
resolve22(true);
|
|
4519
4520
|
});
|
|
4520
4521
|
socket.once("error", () => {
|
|
4521
4522
|
socket.destroy();
|
|
4522
|
-
|
|
4523
|
+
resolve22(false);
|
|
4523
4524
|
});
|
|
4524
4525
|
socket.once("timeout", () => {
|
|
4525
4526
|
socket.destroy();
|
|
4526
|
-
|
|
4527
|
+
resolve22(false);
|
|
4527
4528
|
});
|
|
4528
4529
|
});
|
|
4529
4530
|
}
|
|
@@ -5042,6 +5043,14 @@ function detectMimeType(filePath) {
|
|
|
5042
5043
|
const ext = extname(filePath).toLowerCase();
|
|
5043
5044
|
return MIME_BY_EXT[ext] ?? "application/octet-stream";
|
|
5044
5045
|
}
|
|
5046
|
+
function validateFilePathInAccount(filePath, accountDir) {
|
|
5047
|
+
const resolved = realpathSync(filePath);
|
|
5048
|
+
const accountResolved = realpathSync(accountDir);
|
|
5049
|
+
if (!resolved.startsWith(accountResolved + "/")) {
|
|
5050
|
+
throw new Error(`File path is outside the account directory`);
|
|
5051
|
+
}
|
|
5052
|
+
return resolved;
|
|
5053
|
+
}
|
|
5045
5054
|
async function storeGeneratedFile(accountId, filePath) {
|
|
5046
5055
|
const fileStat = await stat2(filePath);
|
|
5047
5056
|
if (fileStat.size > MAX_FILE_SIZE_BYTES) {
|
|
@@ -6725,8 +6734,8 @@ async function startLogin(opts) {
|
|
|
6725
6734
|
resetActiveLogin(accountId);
|
|
6726
6735
|
let resolveQr = null;
|
|
6727
6736
|
let rejectQr = null;
|
|
6728
|
-
const qrPromise = new Promise((
|
|
6729
|
-
resolveQr =
|
|
6737
|
+
const qrPromise = new Promise((resolve22, reject) => {
|
|
6738
|
+
resolveQr = resolve22;
|
|
6730
6739
|
rejectQr = reject;
|
|
6731
6740
|
});
|
|
6732
6741
|
const qrTimer = setTimeout(
|
|
@@ -7705,11 +7714,11 @@ function readUsersFile2() {
|
|
|
7705
7714
|
if (!raw) return [];
|
|
7706
7715
|
return JSON.parse(raw);
|
|
7707
7716
|
}
|
|
7708
|
-
async function createAdminSession(accountId, thinkingView, userId, userName) {
|
|
7717
|
+
async function createAdminSession(accountId, thinkingView, userId, userName, role) {
|
|
7709
7718
|
const account = resolveAccount();
|
|
7710
7719
|
const effectiveThinkingView = thinkingView ?? account?.config.thinkingView ?? "default";
|
|
7711
7720
|
const sessionKey = crypto.randomUUID();
|
|
7712
|
-
registerSession(sessionKey, "admin", accountId, void 0, userId, userName);
|
|
7721
|
+
registerSession(sessionKey, "admin", accountId, void 0, userId, userName, role);
|
|
7713
7722
|
let onboardingComplete = true;
|
|
7714
7723
|
try {
|
|
7715
7724
|
const step = await loadOnboardingStep(accountId);
|
|
@@ -7724,11 +7733,13 @@ async function createAdminSession(accountId, thinkingView, userId, userName) {
|
|
|
7724
7733
|
} catch {
|
|
7725
7734
|
}
|
|
7726
7735
|
console.log(`[session] ${(/* @__PURE__ */ new Date()).toISOString()} admin session created: userId=${userId ?? "\u2013"} userName=${userName ?? "\u2013"} accountId=${accountId} conversationId=deferred sessionKey=${sessionKey.slice(0, 8)}`);
|
|
7736
|
+
console.log(`[admin-session] role=${role ?? "null"} sessionKey=${sessionKey.slice(0, 8)} phase=create`);
|
|
7727
7737
|
return {
|
|
7728
7738
|
session_key: sessionKey,
|
|
7729
7739
|
agent_id: "admin",
|
|
7730
7740
|
userId,
|
|
7731
7741
|
userName,
|
|
7742
|
+
role: role ?? null,
|
|
7732
7743
|
thinkingView: effectiveThinkingView,
|
|
7733
7744
|
onboardingComplete,
|
|
7734
7745
|
businessName,
|
|
@@ -7760,11 +7771,14 @@ app10.get("/", async (c) => {
|
|
|
7760
7771
|
businessName = branding?.name || void 0;
|
|
7761
7772
|
} catch {
|
|
7762
7773
|
}
|
|
7774
|
+
const role = getRoleForSession(sessionKey);
|
|
7775
|
+
console.log(`[admin-session] role=${role ?? "null"} sessionKey=${sessionKey.slice(0, 8)} phase=restore`);
|
|
7763
7776
|
return c.json({
|
|
7764
7777
|
session_key: sessionKey,
|
|
7765
7778
|
agent_id: "admin",
|
|
7766
7779
|
userId: getUserIdForSession(sessionKey),
|
|
7767
7780
|
userName: getUserNameForSession(sessionKey),
|
|
7781
|
+
role: role ?? null,
|
|
7768
7782
|
thinkingView,
|
|
7769
7783
|
onboardingComplete,
|
|
7770
7784
|
businessName,
|
|
@@ -7821,7 +7835,7 @@ app10.post("/", async (c) => {
|
|
|
7821
7835
|
console.log(`[session] account selection invalid: userId=${userId} requested=${body.accountId}`);
|
|
7822
7836
|
return c.json({ error: "Invalid account selection." }, 403);
|
|
7823
7837
|
}
|
|
7824
|
-
const payload = await createAdminSession(selected.accountId, selected.config.thinkingView, userId, userName);
|
|
7838
|
+
const payload = await createAdminSession(selected.accountId, selected.config.thinkingView, userId, userName, selected.role);
|
|
7825
7839
|
return c.json(payload);
|
|
7826
7840
|
});
|
|
7827
7841
|
var session_default2 = app10;
|
|
@@ -8118,7 +8132,7 @@ var app11 = new Hono();
|
|
|
8118
8132
|
app11.post("/cancel", requireAdminSession, async (c) => {
|
|
8119
8133
|
const session_key = c.var.sessionKey;
|
|
8120
8134
|
try {
|
|
8121
|
-
const { interruptClient: interruptClient2 } = await import("./client-pool-
|
|
8135
|
+
const { interruptClient: interruptClient2 } = await import("./client-pool-SGPHSYLK.js");
|
|
8122
8136
|
await interruptClient2(session_key);
|
|
8123
8137
|
return c.json({ ok: true });
|
|
8124
8138
|
} catch (err) {
|
|
@@ -11563,30 +11577,146 @@ app30.get("/", requireAdminSession, async (c) => {
|
|
|
11563
11577
|
});
|
|
11564
11578
|
var adherence_default = app30;
|
|
11565
11579
|
|
|
11566
|
-
// server/routes/admin/
|
|
11580
|
+
// server/routes/admin/sidebar-projects.ts
|
|
11581
|
+
import neo4j3 from "neo4j-driver";
|
|
11582
|
+
var LIMIT = 50;
|
|
11567
11583
|
var app31 = new Hono();
|
|
11568
|
-
app31.
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11584
|
+
app31.get("/", requireAdminSession, async (c) => {
|
|
11585
|
+
const sessionKey = c.var.sessionKey;
|
|
11586
|
+
const accountId = getAccountIdForSession(sessionKey);
|
|
11587
|
+
if (!accountId) {
|
|
11588
|
+
return c.json({ error: "Account not found for session" }, 401);
|
|
11589
|
+
}
|
|
11590
|
+
const start = Date.now();
|
|
11591
|
+
const session = getSession();
|
|
11592
|
+
try {
|
|
11593
|
+
const result = await session.run(
|
|
11594
|
+
`MATCH (p:Project { accountId: $accountId })
|
|
11595
|
+
WHERE NOT p:Trashed
|
|
11596
|
+
RETURN p.taskId AS id, p.name AS name, p.updatedAt AS updatedAt
|
|
11597
|
+
ORDER BY p.updatedAt DESC
|
|
11598
|
+
LIMIT $limit`,
|
|
11599
|
+
{ accountId, limit: neo4j3.int(LIMIT) }
|
|
11600
|
+
);
|
|
11601
|
+
const projects = result.records.map((r) => ({
|
|
11602
|
+
id: r.get("id"),
|
|
11603
|
+
name: r.get("name") ?? "",
|
|
11604
|
+
updatedAt: r.get("updatedAt") ?? ""
|
|
11605
|
+
}));
|
|
11606
|
+
const ms = Date.now() - start;
|
|
11607
|
+
console.log(`[admin/sidebar-projects] account=${accountId} count=${projects.length} ms=${ms}`);
|
|
11608
|
+
return c.json({ projects });
|
|
11609
|
+
} catch (err) {
|
|
11610
|
+
const ms = Date.now() - start;
|
|
11611
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
11612
|
+
console.error(`[admin/sidebar-projects] account=${accountId} error="${message}" ms=${ms}`);
|
|
11613
|
+
return c.json({ error: "Failed to load projects" }, 500);
|
|
11614
|
+
} finally {
|
|
11615
|
+
await session.close();
|
|
11616
|
+
}
|
|
11617
|
+
});
|
|
11618
|
+
var sidebar_projects_default = app31;
|
|
11619
|
+
|
|
11620
|
+
// server/routes/admin/sidebar-artefacts.ts
|
|
11621
|
+
import neo4j4 from "neo4j-driver";
|
|
11622
|
+
import { readFile as readFile5, readdir as readdir3 } from "fs/promises";
|
|
11623
|
+
import { resolve as resolve20 } from "path";
|
|
11624
|
+
var LIMIT2 = 50;
|
|
11625
|
+
var TEXT_MIME_PREFIXES = ["text/", "application/json", "application/markdown"];
|
|
11626
|
+
var app32 = new Hono();
|
|
11627
|
+
app32.get("/", requireAdminSession, async (c) => {
|
|
11628
|
+
const sessionKey = c.var.sessionKey;
|
|
11629
|
+
const accountId = getAccountIdForSession(sessionKey);
|
|
11630
|
+
if (!accountId) {
|
|
11631
|
+
return c.json({ error: "Account not found for session" }, 401);
|
|
11632
|
+
}
|
|
11633
|
+
const start = Date.now();
|
|
11634
|
+
const session = getSession();
|
|
11635
|
+
let metas = [];
|
|
11636
|
+
try {
|
|
11637
|
+
const result = await session.run(
|
|
11638
|
+
`MATCH (d:KnowledgeDocument { accountId: $accountId })
|
|
11639
|
+
WHERE d.deletedAt IS NULL AND NOT d:Trashed
|
|
11640
|
+
RETURN d.attachmentId AS id, d.name AS name, d.updatedAt AS updatedAt,
|
|
11641
|
+
d.attachmentId AS attachmentId, d.encodingFormat AS mimeType
|
|
11642
|
+
ORDER BY d.updatedAt DESC
|
|
11643
|
+
LIMIT $limit`,
|
|
11644
|
+
{ accountId, limit: neo4j4.int(LIMIT2) }
|
|
11645
|
+
);
|
|
11646
|
+
metas = result.records.map((r) => ({
|
|
11647
|
+
id: r.get("id"),
|
|
11648
|
+
name: r.get("name") ?? "",
|
|
11649
|
+
updatedAt: r.get("updatedAt") ?? "",
|
|
11650
|
+
attachmentId: r.get("attachmentId"),
|
|
11651
|
+
mimeType: r.get("mimeType") ?? ""
|
|
11652
|
+
}));
|
|
11653
|
+
} catch (err) {
|
|
11654
|
+
const ms2 = Date.now() - start;
|
|
11655
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
11656
|
+
console.error(`[admin/sidebar-artefacts] account=${accountId} error="${message}" ms=${ms2}`);
|
|
11657
|
+
await session.close();
|
|
11658
|
+
return c.json({ error: "Failed to load artefacts" }, 500);
|
|
11659
|
+
} finally {
|
|
11660
|
+
await session.close();
|
|
11661
|
+
}
|
|
11662
|
+
const artefacts = await Promise.all(metas.map(async (m) => {
|
|
11663
|
+
const content = await readArtefactContent(accountId, m.attachmentId, m.mimeType);
|
|
11664
|
+
return { id: m.id, name: m.name, updatedAt: m.updatedAt, content };
|
|
11665
|
+
}));
|
|
11666
|
+
const ms = Date.now() - start;
|
|
11667
|
+
console.log(`[admin/sidebar-artefacts] account=${accountId} count=${artefacts.length} ms=${ms}`);
|
|
11668
|
+
return c.json({ artefacts });
|
|
11669
|
+
});
|
|
11670
|
+
async function readArtefactContent(accountId, attachmentId, mimeType) {
|
|
11671
|
+
if (!attachmentId) return "";
|
|
11672
|
+
const isText = TEXT_MIME_PREFIXES.some((p) => mimeType.startsWith(p));
|
|
11673
|
+
if (!isText) return "";
|
|
11674
|
+
const accountDir = resolve20(ATTACHMENTS_ROOT, accountId);
|
|
11675
|
+
const dir = resolve20(accountDir, attachmentId);
|
|
11676
|
+
try {
|
|
11677
|
+
validateFilePathInAccount(dir, accountDir);
|
|
11678
|
+
} catch {
|
|
11679
|
+
return "";
|
|
11680
|
+
}
|
|
11681
|
+
try {
|
|
11682
|
+
const entries = await readdir3(dir);
|
|
11683
|
+
const dataFile = entries.find((f) => !f.endsWith(".meta.json"));
|
|
11684
|
+
if (!dataFile) return "";
|
|
11685
|
+
return await readFile5(resolve20(dir, dataFile), "utf-8");
|
|
11686
|
+
} catch (err) {
|
|
11687
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
11688
|
+
console.error(`[admin/sidebar-artefacts] read-failed attachmentId=${attachmentId.slice(0, 8)} error="${message}"`);
|
|
11689
|
+
return "";
|
|
11690
|
+
}
|
|
11691
|
+
}
|
|
11692
|
+
var sidebar_artefacts_default = app32;
|
|
11693
|
+
|
|
11694
|
+
// server/routes/admin/index.ts
|
|
11695
|
+
var app33 = new Hono();
|
|
11696
|
+
app33.route("/session", session_default2);
|
|
11697
|
+
app33.route("/chat", chat_default2);
|
|
11698
|
+
app33.route("/compact", compact_default);
|
|
11699
|
+
app33.route("/logs", logs_default);
|
|
11700
|
+
app33.route("/claude-info", claude_info_default);
|
|
11701
|
+
app33.route("/attachment", attachment_default);
|
|
11702
|
+
app33.route("/agents", agents_default);
|
|
11703
|
+
app33.route("/sessions", sessions_default);
|
|
11704
|
+
app33.route("/browser", browser_default);
|
|
11705
|
+
app33.route("/device-browser", device_browser_default);
|
|
11706
|
+
app33.route("/events", events_default);
|
|
11707
|
+
app33.route("/cloudflare", cloudflare_default);
|
|
11708
|
+
app33.route("/files", files_default);
|
|
11709
|
+
app33.route("/graph-search", graph_search_default);
|
|
11710
|
+
app33.route("/graph-subgraph", graph_subgraph_default);
|
|
11711
|
+
app33.route("/graph-delete", graph_delete_default);
|
|
11712
|
+
app33.route("/graph-restore", graph_restore_default);
|
|
11713
|
+
app33.route("/graph-labels-in-graph", graph_labels_in_graph_default);
|
|
11714
|
+
app33.route("/graph-default-view", graph_default_view_default);
|
|
11715
|
+
app33.route("/file-attach", file_attach_default);
|
|
11716
|
+
app33.route("/adherence", adherence_default);
|
|
11717
|
+
app33.route("/sidebar-projects", sidebar_projects_default);
|
|
11718
|
+
app33.route("/sidebar-artefacts", sidebar_artefacts_default);
|
|
11719
|
+
var admin_default = app33;
|
|
11590
11720
|
|
|
11591
11721
|
// app/lib/graph-health.ts
|
|
11592
11722
|
var HOUR_MS = 60 * 60 * 1e3;
|
|
@@ -11740,9 +11870,9 @@ watchFile(ALIAS_DOMAINS_PATH2, { interval: 2e3 }, () => {
|
|
|
11740
11870
|
function isPublicHost(host) {
|
|
11741
11871
|
return host.startsWith("public.") || aliasDomains.has(host);
|
|
11742
11872
|
}
|
|
11743
|
-
var
|
|
11744
|
-
|
|
11745
|
-
|
|
11873
|
+
var app34 = new Hono();
|
|
11874
|
+
app34.use("*", clientIpMiddleware);
|
|
11875
|
+
app34.use("*", async (c, next) => {
|
|
11746
11876
|
await next();
|
|
11747
11877
|
c.header("X-Content-Type-Options", "nosniff");
|
|
11748
11878
|
c.header("Referrer-Policy", "strict-origin-when-cross-origin");
|
|
@@ -11765,7 +11895,7 @@ var PUBLIC_ALLOWED_PREFIXES = [
|
|
|
11765
11895
|
"/g/"
|
|
11766
11896
|
];
|
|
11767
11897
|
var PUBLIC_ALLOWED_EXACT = ["/favicon.ico"];
|
|
11768
|
-
|
|
11898
|
+
app34.use("*", async (c, next) => {
|
|
11769
11899
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
11770
11900
|
if (!isPublicHost(host)) {
|
|
11771
11901
|
await next();
|
|
@@ -11805,7 +11935,7 @@ function resolveRemoteAuthOpts() {
|
|
|
11805
11935
|
return brandLoginOpts;
|
|
11806
11936
|
}
|
|
11807
11937
|
var MAX_LOGIN_BODY = 8 * 1024;
|
|
11808
|
-
|
|
11938
|
+
app34.post("/__remote-auth/login", async (c) => {
|
|
11809
11939
|
const client = clientFrom(c);
|
|
11810
11940
|
const clientIp = client.ip || "unknown";
|
|
11811
11941
|
if (!requestIsTlsTerminated(c)) {
|
|
@@ -11849,7 +11979,7 @@ app32.post("/__remote-auth/login", async (c) => {
|
|
|
11849
11979
|
}
|
|
11850
11980
|
});
|
|
11851
11981
|
});
|
|
11852
|
-
|
|
11982
|
+
app34.get("/__remote-auth/logout", (c) => {
|
|
11853
11983
|
return new Response(null, {
|
|
11854
11984
|
status: 302,
|
|
11855
11985
|
headers: {
|
|
@@ -11859,7 +11989,7 @@ app32.get("/__remote-auth/logout", (c) => {
|
|
|
11859
11989
|
}
|
|
11860
11990
|
});
|
|
11861
11991
|
});
|
|
11862
|
-
|
|
11992
|
+
app34.post("/__remote-auth/change-password", async (c) => {
|
|
11863
11993
|
const client = clientFrom(c);
|
|
11864
11994
|
const clientIp = client.ip || "unknown";
|
|
11865
11995
|
const rateLimited = checkRateLimit(client);
|
|
@@ -11909,13 +12039,13 @@ app32.post("/__remote-auth/change-password", async (c) => {
|
|
|
11909
12039
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "change", changeError: "Failed to save password", redirect }), 200);
|
|
11910
12040
|
}
|
|
11911
12041
|
});
|
|
11912
|
-
|
|
12042
|
+
app34.get("/__remote-auth/setup", (c) => {
|
|
11913
12043
|
if (isRemoteAuthConfigured()) {
|
|
11914
12044
|
return c.redirect("/");
|
|
11915
12045
|
}
|
|
11916
12046
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup" }), 200);
|
|
11917
12047
|
});
|
|
11918
|
-
|
|
12048
|
+
app34.post("/__remote-auth/set-initial-password", async (c) => {
|
|
11919
12049
|
if (isRemoteAuthConfigured()) {
|
|
11920
12050
|
return c.redirect("/");
|
|
11921
12051
|
}
|
|
@@ -11951,10 +12081,10 @@ app32.post("/__remote-auth/set-initial-password", async (c) => {
|
|
|
11951
12081
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), mode: "setup", setupError: "Failed to save password. Please try again." }), 200);
|
|
11952
12082
|
}
|
|
11953
12083
|
});
|
|
11954
|
-
|
|
12084
|
+
app34.get("/api/remote-auth/status", (c) => {
|
|
11955
12085
|
return c.json({ configured: isRemoteAuthConfigured() });
|
|
11956
12086
|
});
|
|
11957
|
-
|
|
12087
|
+
app34.post("/api/remote-auth/set-password", async (c) => {
|
|
11958
12088
|
let body;
|
|
11959
12089
|
try {
|
|
11960
12090
|
body = await c.req.json();
|
|
@@ -11984,9 +12114,9 @@ app32.post("/api/remote-auth/set-password", async (c) => {
|
|
|
11984
12114
|
return c.json({ error: "Failed to save password" }, 500);
|
|
11985
12115
|
}
|
|
11986
12116
|
});
|
|
11987
|
-
|
|
12117
|
+
app34.route("/api/_client-error", client_error_default);
|
|
11988
12118
|
console.log("[client-error-route] mounted");
|
|
11989
|
-
|
|
12119
|
+
app34.use("*", async (c, next) => {
|
|
11990
12120
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
11991
12121
|
const path2 = c.req.path;
|
|
11992
12122
|
if (path2 === "/favicon.ico" || path2.startsWith("/assets/") || path2.startsWith("/brand/")) {
|
|
@@ -12019,15 +12149,15 @@ app32.use("*", async (c, next) => {
|
|
|
12019
12149
|
console.error(`[remote-auth] login required ip=${clientIp} path=${path2} ${disambig}`);
|
|
12020
12150
|
return c.html(renderLoginPage({ ...resolveRemoteAuthOpts(), redirect: path2 }), 200);
|
|
12021
12151
|
});
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12152
|
+
app34.route("/api/health", health_default);
|
|
12153
|
+
app34.route("/api/session", session_default);
|
|
12154
|
+
app34.route("/api/chat", chat_default);
|
|
12155
|
+
app34.route("/api/group", group_default);
|
|
12156
|
+
app34.route("/api/access", access_default);
|
|
12157
|
+
app34.route("/api/telegram", telegram_default);
|
|
12158
|
+
app34.route("/api/whatsapp", whatsapp_default);
|
|
12159
|
+
app34.route("/api/onboarding", onboarding_default);
|
|
12160
|
+
app34.route("/api/admin", admin_default);
|
|
12031
12161
|
var SAFE_SLUG_RE = /^[a-z][a-z0-9-]{2,49}$/;
|
|
12032
12162
|
var SAFE_FILENAME_RE = /^[a-z0-9_][a-z0-9_.-]{0,99}$/i;
|
|
12033
12163
|
var IMAGE_MIME = {
|
|
@@ -12039,7 +12169,7 @@ var IMAGE_MIME = {
|
|
|
12039
12169
|
".svg": "image/svg+xml",
|
|
12040
12170
|
".ico": "image/x-icon"
|
|
12041
12171
|
};
|
|
12042
|
-
|
|
12172
|
+
app34.get("/agent-assets/:slug/:filename", (c) => {
|
|
12043
12173
|
const slug = c.req.param("slug");
|
|
12044
12174
|
const filename = c.req.param("filename");
|
|
12045
12175
|
if (!SAFE_SLUG_RE.test(slug)) {
|
|
@@ -12055,8 +12185,8 @@ app32.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
12055
12185
|
console.error(`[agent-assets] no-account slug=${slug} file=${filename}`);
|
|
12056
12186
|
return c.text("Not found", 404);
|
|
12057
12187
|
}
|
|
12058
|
-
const filePath =
|
|
12059
|
-
const expectedDir =
|
|
12188
|
+
const filePath = resolve21(account.accountDir, "agents", slug, "assets", filename);
|
|
12189
|
+
const expectedDir = resolve21(account.accountDir, "agents", slug, "assets");
|
|
12060
12190
|
if (!filePath.startsWith(expectedDir + "/")) {
|
|
12061
12191
|
console.error(`[agent-assets] path-traversal-rejected slug=${slug} file=${filename}`);
|
|
12062
12192
|
return c.text("Forbidden", 403);
|
|
@@ -12074,7 +12204,7 @@ app32.get("/agent-assets/:slug/:filename", (c) => {
|
|
|
12074
12204
|
"Cache-Control": "public, max-age=3600"
|
|
12075
12205
|
});
|
|
12076
12206
|
});
|
|
12077
|
-
|
|
12207
|
+
app34.get("/generated/:filename", (c) => {
|
|
12078
12208
|
const filename = c.req.param("filename");
|
|
12079
12209
|
if (!SAFE_FILENAME_RE.test(filename) || filename.includes("..")) {
|
|
12080
12210
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
@@ -12085,8 +12215,8 @@ app32.get("/generated/:filename", (c) => {
|
|
|
12085
12215
|
console.error(`[generated] serve file=${filename} status=404`);
|
|
12086
12216
|
return c.text("Not found", 404);
|
|
12087
12217
|
}
|
|
12088
|
-
const filePath =
|
|
12089
|
-
const expectedDir =
|
|
12218
|
+
const filePath = resolve21(account.accountDir, "generated", filename);
|
|
12219
|
+
const expectedDir = resolve21(account.accountDir, "generated");
|
|
12090
12220
|
if (!filePath.startsWith(expectedDir + "/")) {
|
|
12091
12221
|
console.error(`[generated] serve file=${filename} status=403`);
|
|
12092
12222
|
return c.text("Forbidden", 403);
|
|
@@ -12169,7 +12299,7 @@ var clientErrorReporterScript = `<script>
|
|
|
12169
12299
|
function cachedHtml(file) {
|
|
12170
12300
|
let html = htmlCache.get(file);
|
|
12171
12301
|
if (!html) {
|
|
12172
|
-
html = readFileSync16(
|
|
12302
|
+
html = readFileSync16(resolve21(process.cwd(), "public", file), "utf-8");
|
|
12173
12303
|
const productNameEsc = escapeHtml(BRAND.productName);
|
|
12174
12304
|
html = html.replace(/<title>([^<]*)<\/title>/, (_match, inner) => `<title>${escapeHtml(inner).replace(/Maxy/g, productNameEsc)}</title>`);
|
|
12175
12305
|
html = html.replace('href="/favicon.ico"', `href="${escapeHtml(brandFaviconPath)}"`);
|
|
@@ -12240,7 +12370,7 @@ function brandedPublicHtml(agentSlug) {
|
|
|
12240
12370
|
function escapeHtml(s) {
|
|
12241
12371
|
return s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
12242
12372
|
}
|
|
12243
|
-
|
|
12373
|
+
app34.get("/", (c) => {
|
|
12244
12374
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
12245
12375
|
if (isPublicHost(host)) {
|
|
12246
12376
|
const defaultSlug = resolveDefaultSlug();
|
|
@@ -12248,12 +12378,12 @@ app32.get("/", (c) => {
|
|
|
12248
12378
|
}
|
|
12249
12379
|
return c.html(cachedHtml("index.html"));
|
|
12250
12380
|
});
|
|
12251
|
-
|
|
12381
|
+
app34.get("/public", (c) => {
|
|
12252
12382
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
12253
12383
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
12254
12384
|
return c.html(cachedHtml("public.html"));
|
|
12255
12385
|
});
|
|
12256
|
-
|
|
12386
|
+
app34.get("/chat", (c) => {
|
|
12257
12387
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
12258
12388
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
12259
12389
|
return c.html(cachedHtml("public.html"));
|
|
@@ -12272,12 +12402,12 @@ async function logViewerFetch(c, next) {
|
|
|
12272
12402
|
duration_ms: Date.now() - start
|
|
12273
12403
|
});
|
|
12274
12404
|
}
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12405
|
+
app34.use("/vnc-viewer.html", logViewerFetch);
|
|
12406
|
+
app34.use("/vnc-popout.html", logViewerFetch);
|
|
12407
|
+
app34.get("/vnc-popout.html", (c) => {
|
|
12278
12408
|
let html = htmlCache.get("vnc-popout.html");
|
|
12279
12409
|
if (!html) {
|
|
12280
|
-
html = readFileSync16(
|
|
12410
|
+
html = readFileSync16(resolve21(process.cwd(), "public", "vnc-popout.html"), "utf-8");
|
|
12281
12411
|
const name = escapeHtml(BRAND.productName);
|
|
12282
12412
|
html = html.replace("<title>Browser \u2014 Maxy</title>", `<title>${name}</title>`);
|
|
12283
12413
|
html = html.replace("</head>", ` ${brandScript}
|
|
@@ -12287,7 +12417,7 @@ app32.get("/vnc-popout.html", (c) => {
|
|
|
12287
12417
|
}
|
|
12288
12418
|
return c.html(html);
|
|
12289
12419
|
});
|
|
12290
|
-
|
|
12420
|
+
app34.post("/api/vnc/client-event", async (c) => {
|
|
12291
12421
|
let body;
|
|
12292
12422
|
try {
|
|
12293
12423
|
body = await c.req.json();
|
|
@@ -12308,20 +12438,20 @@ app32.post("/api/vnc/client-event", async (c) => {
|
|
|
12308
12438
|
});
|
|
12309
12439
|
return c.json({ ok: true });
|
|
12310
12440
|
});
|
|
12311
|
-
|
|
12441
|
+
app34.get("/g/:slug", (c) => {
|
|
12312
12442
|
return c.html(brandedPublicHtml());
|
|
12313
12443
|
});
|
|
12314
|
-
|
|
12444
|
+
app34.get("/graph", (c) => {
|
|
12315
12445
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
12316
12446
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
12317
12447
|
return c.html(cachedHtml("graph.html"));
|
|
12318
12448
|
});
|
|
12319
|
-
|
|
12449
|
+
app34.get("/data", (c) => {
|
|
12320
12450
|
const host = (c.req.header("host") ?? "").split(":")[0];
|
|
12321
12451
|
if (isPublicHost(host)) return c.text("Not found", 404);
|
|
12322
12452
|
return c.html(cachedHtml("data.html"));
|
|
12323
12453
|
});
|
|
12324
|
-
|
|
12454
|
+
app34.get("/:slug", async (c, next) => {
|
|
12325
12455
|
const slug = c.req.param("slug");
|
|
12326
12456
|
if (AGENT_SLUG_PATTERN.test(`/${slug}`)) {
|
|
12327
12457
|
const branding = loadBrandingCache(slug);
|
|
@@ -12330,10 +12460,10 @@ app32.get("/:slug", async (c, next) => {
|
|
|
12330
12460
|
}
|
|
12331
12461
|
await next();
|
|
12332
12462
|
});
|
|
12333
|
-
|
|
12463
|
+
app34.use("/*", serveStatic({ root: "./public" }));
|
|
12334
12464
|
var port = parseInt(process.env.MAXY_UI_INTERNAL_PORT ?? process.env.PORT ?? "19199", 10);
|
|
12335
12465
|
var hostname = process.env.HOSTNAME ?? "127.0.0.1";
|
|
12336
|
-
var httpServer = serve({ fetch:
|
|
12466
|
+
var httpServer = serve({ fetch: app34.fetch, port, hostname });
|
|
12337
12467
|
console.log(`${BRAND.productName} listening on http://${hostname}:${port}`);
|
|
12338
12468
|
var SUBAPP_MANIFEST = [
|
|
12339
12469
|
{ prefix: "/api/health", file: "server/routes/health.ts", subapp: health_default },
|
|
@@ -12353,7 +12483,7 @@ for (const m of SUBAPP_MANIFEST) {
|
|
|
12353
12483
|
}
|
|
12354
12484
|
try {
|
|
12355
12485
|
const registered = [];
|
|
12356
|
-
for (const r of
|
|
12486
|
+
for (const r of app34.routes ?? []) {
|
|
12357
12487
|
if (typeof r.path !== "string" || r.path.includes(":") || r.path.includes("*")) continue;
|
|
12358
12488
|
if (AGENT_SLUG_PATTERN.test(r.path)) {
|
|
12359
12489
|
registered.push({ method: (r.method ?? "ALL").toUpperCase(), path: r.path });
|
|
@@ -12420,7 +12550,7 @@ if (bootAccountConfig?.whatsapp) {
|
|
|
12420
12550
|
}
|
|
12421
12551
|
init({
|
|
12422
12552
|
configDir: configDirForWhatsApp,
|
|
12423
|
-
platformRoot:
|
|
12553
|
+
platformRoot: resolve21(process.env.MAXY_PLATFORM_ROOT ?? join10(__dirname, "..")),
|
|
12424
12554
|
accountConfig: bootAccountConfig,
|
|
12425
12555
|
onMessage: async (msg) => {
|
|
12426
12556
|
try {
|