tamga-vdesktop 1.2.1 → 1.2.3
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/cli.js +67 -37
- package/dist/server.js +40 -20
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -612,43 +612,59 @@ function installPlaywrightBrowserSync(opts) {
|
|
|
612
612
|
const shouldWithDeps = Boolean(
|
|
613
613
|
opts?.withDeps && process.platform === "linux" && typeof process.getuid === "function" && process.getuid() === 0
|
|
614
614
|
);
|
|
615
|
-
const
|
|
616
|
-
if (shouldWithDeps) args.push("--with-deps");
|
|
617
|
-
if (opts?.quiet) args.push("--no-progress");
|
|
615
|
+
const hosts = process.env.PLAYWRIGHT_DOWNLOAD_HOST ? [process.env.PLAYWRIGHT_DOWNLOAD_HOST] : ["", "https://cdn.npmmirror.com/binaries/playwright"];
|
|
618
616
|
if (!opts?.quiet) {
|
|
619
617
|
console.log("[TamgaVDesktop] Yerle\u015Fik Playwright Chromium taray\u0131c\u0131s\u0131 kuruluyor...");
|
|
620
618
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
619
|
+
for (let i = 0; i < hosts.length; i++) {
|
|
620
|
+
const host = hosts[i];
|
|
621
|
+
const args = [cliPath, "install", "chromium-headless-shell"];
|
|
622
|
+
if (i === 0 && shouldWithDeps) args.push("--with-deps");
|
|
623
|
+
if (opts?.quiet) args.push("--no-progress");
|
|
624
|
+
const env = {
|
|
624
625
|
...process.env,
|
|
625
626
|
PLAYWRIGHT_SKIP_BROWSER_GC: "1"
|
|
627
|
+
};
|
|
628
|
+
if (host) env.PLAYWRIGHT_DOWNLOAD_HOST = host;
|
|
629
|
+
const res = spawnSync(process.execPath, args, {
|
|
630
|
+
stdio: opts?.quiet ? "ignore" : "inherit",
|
|
631
|
+
env
|
|
632
|
+
});
|
|
633
|
+
if (res.status === 0 && findPlaywrightManagedBrowser()) {
|
|
634
|
+
return true;
|
|
635
|
+
}
|
|
636
|
+
const fallbackArgs = [cliPath, "install", "--only-shell", "chromium"];
|
|
637
|
+
if (i === 0 && shouldWithDeps) fallbackArgs.push("--with-deps");
|
|
638
|
+
if (opts?.quiet) fallbackArgs.push("--no-progress");
|
|
639
|
+
const res2 = spawnSync(process.execPath, fallbackArgs, {
|
|
640
|
+
stdio: opts?.quiet ? "ignore" : "inherit",
|
|
641
|
+
env
|
|
642
|
+
});
|
|
643
|
+
if (res2.status === 0 && findPlaywrightManagedBrowser()) {
|
|
644
|
+
return true;
|
|
626
645
|
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
return true;
|
|
630
|
-
}
|
|
631
|
-
const fallbackArgs = [cliPath, "install", "--only-shell", "chromium"];
|
|
632
|
-
if (shouldWithDeps) fallbackArgs.push("--with-deps");
|
|
633
|
-
if (opts?.quiet) fallbackArgs.push("--no-progress");
|
|
634
|
-
const res2 = spawnSync(process.execPath, fallbackArgs, {
|
|
635
|
-
stdio: opts?.quiet ? "ignore" : "inherit"
|
|
636
|
-
});
|
|
637
|
-
return res2.status === 0 && Boolean(findPlaywrightManagedBrowser());
|
|
646
|
+
}
|
|
647
|
+
return Boolean(findPlaywrightManagedBrowser());
|
|
638
648
|
}
|
|
639
649
|
async function installPlaywrightBrowserAsync() {
|
|
640
650
|
if (findPlaywrightManagedBrowser()) return;
|
|
641
651
|
const cliPath = resolvePlaywrightCliPath();
|
|
642
652
|
if (!cliPath) return;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
)
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
653
|
+
const hosts = process.env.PLAYWRIGHT_DOWNLOAD_HOST ? [process.env.PLAYWRIGHT_DOWNLOAD_HOST] : ["", "https://cdn.npmmirror.com/binaries/playwright"];
|
|
654
|
+
for (const host of hosts) {
|
|
655
|
+
if (findPlaywrightManagedBrowser()) return;
|
|
656
|
+
const env = { ...process.env, PLAYWRIGHT_SKIP_BROWSER_GC: "1" };
|
|
657
|
+
if (host) env.PLAYWRIGHT_DOWNLOAD_HOST = host;
|
|
658
|
+
await new Promise((resolve) => {
|
|
659
|
+
const child = spawn2(
|
|
660
|
+
process.execPath,
|
|
661
|
+
[cliPath, "install", "chromium-headless-shell", "--no-progress"],
|
|
662
|
+
{ stdio: "ignore", env }
|
|
663
|
+
);
|
|
664
|
+
child.on("exit", () => resolve());
|
|
665
|
+
child.on("error", () => resolve());
|
|
666
|
+
});
|
|
667
|
+
}
|
|
652
668
|
}
|
|
653
669
|
function normalizeUserUrl(rawInput) {
|
|
654
670
|
const trimmed = rawInput.trim();
|
|
@@ -1171,6 +1187,15 @@ var ChromiumDesktopSession = class {
|
|
|
1171
1187
|
cdp.on("Page.screencastFrame", (payload) => {
|
|
1172
1188
|
cdp.send("Page.screencastFrameAck", { sessionId: payload.sessionId }).catch(() => {
|
|
1173
1189
|
});
|
|
1190
|
+
const now = Date.now();
|
|
1191
|
+
if (payload.data === tab.lastScreencastData) {
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
if (now < (tab.suppressSettleUntil || 0) && (tab.lastUserInputAt || 0) <= (tab.lastPngAt || 0)) {
|
|
1195
|
+
tab.lastScreencastData = payload.data;
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
tab.lastScreencastData = payload.data;
|
|
1174
1199
|
const jpegBuf = Buffer.from(payload.data, "base64");
|
|
1175
1200
|
const packet = Buffer.allocUnsafe(1 + jpegBuf.length);
|
|
1176
1201
|
packet[0] = PACKET_VIDEO_JPEG;
|
|
@@ -1179,15 +1204,13 @@ var ChromiumDesktopSession = class {
|
|
|
1179
1204
|
this.recordFrameTick();
|
|
1180
1205
|
if (this.activeTabId === tab.id && tab.mode === "web") {
|
|
1181
1206
|
this.broadcastBinary(packet);
|
|
1182
|
-
if (
|
|
1183
|
-
|
|
1184
|
-
tab.
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
}, 220);
|
|
1190
|
-
}
|
|
1207
|
+
if (tab.settleTimer) clearTimeout(tab.settleTimer);
|
|
1208
|
+
tab.settleTimer = setTimeout(() => {
|
|
1209
|
+
if (this.activeTabId === tab.id && tab.mode === "web") {
|
|
1210
|
+
this.captureImmediateFrame(tab).catch(() => {
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
}, 220);
|
|
1191
1214
|
}
|
|
1192
1215
|
});
|
|
1193
1216
|
const syncPageMeta = async () => {
|
|
@@ -1304,8 +1327,10 @@ var ChromiumDesktopSession = class {
|
|
|
1304
1327
|
async captureImmediateFrame(tab) {
|
|
1305
1328
|
if (!tab.page || tab.page.isClosed() || tab.mode !== "web") return;
|
|
1306
1329
|
try {
|
|
1307
|
-
tab.suppressSettleUntil = Date.now() +
|
|
1330
|
+
tab.suppressSettleUntil = Date.now() + 900;
|
|
1308
1331
|
const pngBuf = await tab.page.screenshot({ type: "png" });
|
|
1332
|
+
tab.lastPngAt = Date.now();
|
|
1333
|
+
tab.suppressSettleUntil = tab.lastPngAt + 550;
|
|
1309
1334
|
const packet = Buffer.allocUnsafe(1 + pngBuf.length);
|
|
1310
1335
|
packet[0] = PACKET_VIDEO_JPEG;
|
|
1311
1336
|
pngBuf.copy(packet, 1);
|
|
@@ -1326,6 +1351,8 @@ var ChromiumDesktopSession = class {
|
|
|
1326
1351
|
tab.mode = parsed.mode;
|
|
1327
1352
|
tab.filePath = parsed.filePath;
|
|
1328
1353
|
tab.url = parsed.url;
|
|
1354
|
+
tab.lastScreencastData = void 0;
|
|
1355
|
+
tab.suppressSettleUntil = 0;
|
|
1329
1356
|
if (parsed.mode === "newtab") {
|
|
1330
1357
|
await this.stopScreencast(tab);
|
|
1331
1358
|
tab.title = "Yeni Sekme";
|
|
@@ -1430,6 +1457,8 @@ var ChromiumDesktopSession = class {
|
|
|
1430
1457
|
const active = this.activeTabId ? this.tabs.get(this.activeTabId) : void 0;
|
|
1431
1458
|
if (active?.mode === "web" && active.page && !active.page.isClosed()) {
|
|
1432
1459
|
try {
|
|
1460
|
+
active.lastScreencastData = void 0;
|
|
1461
|
+
active.suppressSettleUntil = 0;
|
|
1433
1462
|
await this.stopScreencast(active);
|
|
1434
1463
|
await this.applyTabMetrics(active);
|
|
1435
1464
|
await this.startScreencast(active);
|
|
@@ -1443,6 +1472,7 @@ var ChromiumDesktopSession = class {
|
|
|
1443
1472
|
if (!tabId) return;
|
|
1444
1473
|
const tab = this.tabs.get(tabId);
|
|
1445
1474
|
if (!tab || tab.mode !== "web" || !tab.page || !tab.cdp || tab.page.isClosed()) return;
|
|
1475
|
+
tab.lastUserInputAt = Date.now();
|
|
1446
1476
|
const kind = payload.kind;
|
|
1447
1477
|
if (kind === "mouse") {
|
|
1448
1478
|
const eventType = payload.eventType;
|
|
@@ -3755,7 +3785,7 @@ var VSCodeServerManager = class {
|
|
|
3755
3785
|
};
|
|
3756
3786
|
|
|
3757
3787
|
// server/index.ts
|
|
3758
|
-
var TAMGA_VERSION = "1.2.
|
|
3788
|
+
var TAMGA_VERSION = "1.2.3";
|
|
3759
3789
|
var MIME_MAP = {
|
|
3760
3790
|
html: "text/html; charset=utf-8",
|
|
3761
3791
|
htm: "text/html; charset=utf-8",
|
package/dist/server.js
CHANGED
|
@@ -883,15 +883,21 @@ async function installPlaywrightBrowserAsync() {
|
|
|
883
883
|
if (findPlaywrightManagedBrowser()) return;
|
|
884
884
|
const cliPath = resolvePlaywrightCliPath();
|
|
885
885
|
if (!cliPath) return;
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
)
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
886
|
+
const hosts = process.env.PLAYWRIGHT_DOWNLOAD_HOST ? [process.env.PLAYWRIGHT_DOWNLOAD_HOST] : ["", "https://cdn.npmmirror.com/binaries/playwright"];
|
|
887
|
+
for (const host of hosts) {
|
|
888
|
+
if (findPlaywrightManagedBrowser()) return;
|
|
889
|
+
const env = { ...process.env, PLAYWRIGHT_SKIP_BROWSER_GC: "1" };
|
|
890
|
+
if (host) env.PLAYWRIGHT_DOWNLOAD_HOST = host;
|
|
891
|
+
await new Promise((resolve) => {
|
|
892
|
+
const child = spawn(
|
|
893
|
+
process.execPath,
|
|
894
|
+
[cliPath, "install", "chromium-headless-shell", "--no-progress"],
|
|
895
|
+
{ stdio: "ignore", env }
|
|
896
|
+
);
|
|
897
|
+
child.on("exit", () => resolve());
|
|
898
|
+
child.on("error", () => resolve());
|
|
899
|
+
});
|
|
900
|
+
}
|
|
895
901
|
}
|
|
896
902
|
function normalizeUserUrl(rawInput) {
|
|
897
903
|
const trimmed = rawInput.trim();
|
|
@@ -1414,6 +1420,15 @@ var ChromiumDesktopSession = class {
|
|
|
1414
1420
|
cdp.on("Page.screencastFrame", (payload) => {
|
|
1415
1421
|
cdp.send("Page.screencastFrameAck", { sessionId: payload.sessionId }).catch(() => {
|
|
1416
1422
|
});
|
|
1423
|
+
const now = Date.now();
|
|
1424
|
+
if (payload.data === tab.lastScreencastData) {
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
if (now < (tab.suppressSettleUntil || 0) && (tab.lastUserInputAt || 0) <= (tab.lastPngAt || 0)) {
|
|
1428
|
+
tab.lastScreencastData = payload.data;
|
|
1429
|
+
return;
|
|
1430
|
+
}
|
|
1431
|
+
tab.lastScreencastData = payload.data;
|
|
1417
1432
|
const jpegBuf = Buffer.from(payload.data, "base64");
|
|
1418
1433
|
const packet = Buffer.allocUnsafe(1 + jpegBuf.length);
|
|
1419
1434
|
packet[0] = PACKET_VIDEO_JPEG;
|
|
@@ -1422,15 +1437,13 @@ var ChromiumDesktopSession = class {
|
|
|
1422
1437
|
this.recordFrameTick();
|
|
1423
1438
|
if (this.activeTabId === tab.id && tab.mode === "web") {
|
|
1424
1439
|
this.broadcastBinary(packet);
|
|
1425
|
-
if (
|
|
1426
|
-
|
|
1427
|
-
tab.
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
}, 220);
|
|
1433
|
-
}
|
|
1440
|
+
if (tab.settleTimer) clearTimeout(tab.settleTimer);
|
|
1441
|
+
tab.settleTimer = setTimeout(() => {
|
|
1442
|
+
if (this.activeTabId === tab.id && tab.mode === "web") {
|
|
1443
|
+
this.captureImmediateFrame(tab).catch(() => {
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
}, 220);
|
|
1434
1447
|
}
|
|
1435
1448
|
});
|
|
1436
1449
|
const syncPageMeta = async () => {
|
|
@@ -1547,8 +1560,10 @@ var ChromiumDesktopSession = class {
|
|
|
1547
1560
|
async captureImmediateFrame(tab) {
|
|
1548
1561
|
if (!tab.page || tab.page.isClosed() || tab.mode !== "web") return;
|
|
1549
1562
|
try {
|
|
1550
|
-
tab.suppressSettleUntil = Date.now() +
|
|
1563
|
+
tab.suppressSettleUntil = Date.now() + 900;
|
|
1551
1564
|
const pngBuf = await tab.page.screenshot({ type: "png" });
|
|
1565
|
+
tab.lastPngAt = Date.now();
|
|
1566
|
+
tab.suppressSettleUntil = tab.lastPngAt + 550;
|
|
1552
1567
|
const packet = Buffer.allocUnsafe(1 + pngBuf.length);
|
|
1553
1568
|
packet[0] = PACKET_VIDEO_JPEG;
|
|
1554
1569
|
pngBuf.copy(packet, 1);
|
|
@@ -1569,6 +1584,8 @@ var ChromiumDesktopSession = class {
|
|
|
1569
1584
|
tab.mode = parsed.mode;
|
|
1570
1585
|
tab.filePath = parsed.filePath;
|
|
1571
1586
|
tab.url = parsed.url;
|
|
1587
|
+
tab.lastScreencastData = void 0;
|
|
1588
|
+
tab.suppressSettleUntil = 0;
|
|
1572
1589
|
if (parsed.mode === "newtab") {
|
|
1573
1590
|
await this.stopScreencast(tab);
|
|
1574
1591
|
tab.title = "Yeni Sekme";
|
|
@@ -1673,6 +1690,8 @@ var ChromiumDesktopSession = class {
|
|
|
1673
1690
|
const active = this.activeTabId ? this.tabs.get(this.activeTabId) : void 0;
|
|
1674
1691
|
if (active?.mode === "web" && active.page && !active.page.isClosed()) {
|
|
1675
1692
|
try {
|
|
1693
|
+
active.lastScreencastData = void 0;
|
|
1694
|
+
active.suppressSettleUntil = 0;
|
|
1676
1695
|
await this.stopScreencast(active);
|
|
1677
1696
|
await this.applyTabMetrics(active);
|
|
1678
1697
|
await this.startScreencast(active);
|
|
@@ -1686,6 +1705,7 @@ var ChromiumDesktopSession = class {
|
|
|
1686
1705
|
if (!tabId) return;
|
|
1687
1706
|
const tab = this.tabs.get(tabId);
|
|
1688
1707
|
if (!tab || tab.mode !== "web" || !tab.page || !tab.cdp || tab.page.isClosed()) return;
|
|
1708
|
+
tab.lastUserInputAt = Date.now();
|
|
1689
1709
|
const kind = payload.kind;
|
|
1690
1710
|
if (kind === "mouse") {
|
|
1691
1711
|
const eventType = payload.eventType;
|
|
@@ -3708,7 +3728,7 @@ var VSCodeServerManager = class {
|
|
|
3708
3728
|
};
|
|
3709
3729
|
|
|
3710
3730
|
// server/index.ts
|
|
3711
|
-
var TAMGA_VERSION = "1.2.
|
|
3731
|
+
var TAMGA_VERSION = "1.2.3";
|
|
3712
3732
|
var MIME_MAP = {
|
|
3713
3733
|
html: "text/html; charset=utf-8",
|
|
3714
3734
|
htm: "text/html; charset=utf-8",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamga-vdesktop",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "TamgaVDesktop — Self-hostable Linux Virtual Desktop OS platform with native web shell, real Linux terminal, built-in HiDPI Playwright Chromium browser, and seamless native Linux GUI apps.",
|