tamga-vdesktop 1.2.2 → 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.
Files changed (3) hide show
  1. package/dist/cli.js +25 -11
  2. package/dist/server.js +25 -11
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1187,6 +1187,15 @@ var ChromiumDesktopSession = class {
1187
1187
  cdp.on("Page.screencastFrame", (payload) => {
1188
1188
  cdp.send("Page.screencastFrameAck", { sessionId: payload.sessionId }).catch(() => {
1189
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;
1190
1199
  const jpegBuf = Buffer.from(payload.data, "base64");
1191
1200
  const packet = Buffer.allocUnsafe(1 + jpegBuf.length);
1192
1201
  packet[0] = PACKET_VIDEO_JPEG;
@@ -1195,15 +1204,13 @@ var ChromiumDesktopSession = class {
1195
1204
  this.recordFrameTick();
1196
1205
  if (this.activeTabId === tab.id && tab.mode === "web") {
1197
1206
  this.broadcastBinary(packet);
1198
- if (Date.now() > (tab.suppressSettleUntil || 0)) {
1199
- if (tab.settleTimer) clearTimeout(tab.settleTimer);
1200
- tab.settleTimer = setTimeout(() => {
1201
- if (this.activeTabId === tab.id && tab.mode === "web") {
1202
- this.captureImmediateFrame(tab).catch(() => {
1203
- });
1204
- }
1205
- }, 220);
1206
- }
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);
1207
1214
  }
1208
1215
  });
1209
1216
  const syncPageMeta = async () => {
@@ -1320,8 +1327,10 @@ var ChromiumDesktopSession = class {
1320
1327
  async captureImmediateFrame(tab) {
1321
1328
  if (!tab.page || tab.page.isClosed() || tab.mode !== "web") return;
1322
1329
  try {
1323
- tab.suppressSettleUntil = Date.now() + 380;
1330
+ tab.suppressSettleUntil = Date.now() + 900;
1324
1331
  const pngBuf = await tab.page.screenshot({ type: "png" });
1332
+ tab.lastPngAt = Date.now();
1333
+ tab.suppressSettleUntil = tab.lastPngAt + 550;
1325
1334
  const packet = Buffer.allocUnsafe(1 + pngBuf.length);
1326
1335
  packet[0] = PACKET_VIDEO_JPEG;
1327
1336
  pngBuf.copy(packet, 1);
@@ -1342,6 +1351,8 @@ var ChromiumDesktopSession = class {
1342
1351
  tab.mode = parsed.mode;
1343
1352
  tab.filePath = parsed.filePath;
1344
1353
  tab.url = parsed.url;
1354
+ tab.lastScreencastData = void 0;
1355
+ tab.suppressSettleUntil = 0;
1345
1356
  if (parsed.mode === "newtab") {
1346
1357
  await this.stopScreencast(tab);
1347
1358
  tab.title = "Yeni Sekme";
@@ -1446,6 +1457,8 @@ var ChromiumDesktopSession = class {
1446
1457
  const active = this.activeTabId ? this.tabs.get(this.activeTabId) : void 0;
1447
1458
  if (active?.mode === "web" && active.page && !active.page.isClosed()) {
1448
1459
  try {
1460
+ active.lastScreencastData = void 0;
1461
+ active.suppressSettleUntil = 0;
1449
1462
  await this.stopScreencast(active);
1450
1463
  await this.applyTabMetrics(active);
1451
1464
  await this.startScreencast(active);
@@ -1459,6 +1472,7 @@ var ChromiumDesktopSession = class {
1459
1472
  if (!tabId) return;
1460
1473
  const tab = this.tabs.get(tabId);
1461
1474
  if (!tab || tab.mode !== "web" || !tab.page || !tab.cdp || tab.page.isClosed()) return;
1475
+ tab.lastUserInputAt = Date.now();
1462
1476
  const kind = payload.kind;
1463
1477
  if (kind === "mouse") {
1464
1478
  const eventType = payload.eventType;
@@ -3771,7 +3785,7 @@ var VSCodeServerManager = class {
3771
3785
  };
3772
3786
 
3773
3787
  // server/index.ts
3774
- var TAMGA_VERSION = "1.2.2";
3788
+ var TAMGA_VERSION = "1.2.3";
3775
3789
  var MIME_MAP = {
3776
3790
  html: "text/html; charset=utf-8",
3777
3791
  htm: "text/html; charset=utf-8",
package/dist/server.js CHANGED
@@ -1420,6 +1420,15 @@ var ChromiumDesktopSession = class {
1420
1420
  cdp.on("Page.screencastFrame", (payload) => {
1421
1421
  cdp.send("Page.screencastFrameAck", { sessionId: payload.sessionId }).catch(() => {
1422
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;
1423
1432
  const jpegBuf = Buffer.from(payload.data, "base64");
1424
1433
  const packet = Buffer.allocUnsafe(1 + jpegBuf.length);
1425
1434
  packet[0] = PACKET_VIDEO_JPEG;
@@ -1428,15 +1437,13 @@ var ChromiumDesktopSession = class {
1428
1437
  this.recordFrameTick();
1429
1438
  if (this.activeTabId === tab.id && tab.mode === "web") {
1430
1439
  this.broadcastBinary(packet);
1431
- if (Date.now() > (tab.suppressSettleUntil || 0)) {
1432
- if (tab.settleTimer) clearTimeout(tab.settleTimer);
1433
- tab.settleTimer = setTimeout(() => {
1434
- if (this.activeTabId === tab.id && tab.mode === "web") {
1435
- this.captureImmediateFrame(tab).catch(() => {
1436
- });
1437
- }
1438
- }, 220);
1439
- }
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);
1440
1447
  }
1441
1448
  });
1442
1449
  const syncPageMeta = async () => {
@@ -1553,8 +1560,10 @@ var ChromiumDesktopSession = class {
1553
1560
  async captureImmediateFrame(tab) {
1554
1561
  if (!tab.page || tab.page.isClosed() || tab.mode !== "web") return;
1555
1562
  try {
1556
- tab.suppressSettleUntil = Date.now() + 380;
1563
+ tab.suppressSettleUntil = Date.now() + 900;
1557
1564
  const pngBuf = await tab.page.screenshot({ type: "png" });
1565
+ tab.lastPngAt = Date.now();
1566
+ tab.suppressSettleUntil = tab.lastPngAt + 550;
1558
1567
  const packet = Buffer.allocUnsafe(1 + pngBuf.length);
1559
1568
  packet[0] = PACKET_VIDEO_JPEG;
1560
1569
  pngBuf.copy(packet, 1);
@@ -1575,6 +1584,8 @@ var ChromiumDesktopSession = class {
1575
1584
  tab.mode = parsed.mode;
1576
1585
  tab.filePath = parsed.filePath;
1577
1586
  tab.url = parsed.url;
1587
+ tab.lastScreencastData = void 0;
1588
+ tab.suppressSettleUntil = 0;
1578
1589
  if (parsed.mode === "newtab") {
1579
1590
  await this.stopScreencast(tab);
1580
1591
  tab.title = "Yeni Sekme";
@@ -1679,6 +1690,8 @@ var ChromiumDesktopSession = class {
1679
1690
  const active = this.activeTabId ? this.tabs.get(this.activeTabId) : void 0;
1680
1691
  if (active?.mode === "web" && active.page && !active.page.isClosed()) {
1681
1692
  try {
1693
+ active.lastScreencastData = void 0;
1694
+ active.suppressSettleUntil = 0;
1682
1695
  await this.stopScreencast(active);
1683
1696
  await this.applyTabMetrics(active);
1684
1697
  await this.startScreencast(active);
@@ -1692,6 +1705,7 @@ var ChromiumDesktopSession = class {
1692
1705
  if (!tabId) return;
1693
1706
  const tab = this.tabs.get(tabId);
1694
1707
  if (!tab || tab.mode !== "web" || !tab.page || !tab.cdp || tab.page.isClosed()) return;
1708
+ tab.lastUserInputAt = Date.now();
1695
1709
  const kind = payload.kind;
1696
1710
  if (kind === "mouse") {
1697
1711
  const eventType = payload.eventType;
@@ -3714,7 +3728,7 @@ var VSCodeServerManager = class {
3714
3728
  };
3715
3729
 
3716
3730
  // server/index.ts
3717
- var TAMGA_VERSION = "1.2.2";
3731
+ var TAMGA_VERSION = "1.2.3";
3718
3732
  var MIME_MAP = {
3719
3733
  html: "text/html; charset=utf-8",
3720
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.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.",