myagent-ai 1.17.2 → 1.17.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/core/vnc_manager.py +26 -0
- package/package.json +1 -1
package/core/vnc_manager.py
CHANGED
|
@@ -551,6 +551,24 @@ class VNCManager:
|
|
|
551
551
|
async def _start_x11vnc(self) -> bool:
|
|
552
552
|
"""启动 x11vnc VNC 服务器"""
|
|
553
553
|
try:
|
|
554
|
+
# [v1.17.2] 处理 x11vnc 0.9.17+ 的 shm-helper 兼容问题
|
|
555
|
+
# 新版 x11vnc 编译时默认启用 shm-helper,但运行时需要绝对路径
|
|
556
|
+
# 查找 shm-helper 绝对路径
|
|
557
|
+
shm_helper = None
|
|
558
|
+
shm_candidates = [
|
|
559
|
+
"/usr/lib/x11vnc/shm-helper",
|
|
560
|
+
"/usr/lib/x11vnc0.9/shm-helper",
|
|
561
|
+
"/usr/libexec/x11vnc/shm-helper",
|
|
562
|
+
"/usr/local/lib/x11vnc/shm-helper",
|
|
563
|
+
]
|
|
564
|
+
for _path in shm_candidates:
|
|
565
|
+
if os.path.isfile(_path):
|
|
566
|
+
shm_helper = _path
|
|
567
|
+
break
|
|
568
|
+
if not shm_helper:
|
|
569
|
+
import shutil as _shutil
|
|
570
|
+
shm_helper = _shutil.which("x11vnc-shm-helper") or _shutil.which("shm-helper")
|
|
571
|
+
|
|
554
572
|
cmd = [
|
|
555
573
|
"x11vnc",
|
|
556
574
|
"-display", self.display,
|
|
@@ -569,6 +587,14 @@ class VNCManager:
|
|
|
569
587
|
"-scale", "2/3", # 缩小 2/3(降低带宽)
|
|
570
588
|
]
|
|
571
589
|
|
|
590
|
+
# 处理 shm-helper: 找到就传绝对路径,找不到就用 -no-shm 禁用
|
|
591
|
+
if shm_helper:
|
|
592
|
+
cmd.extend(["-shm-helper", shm_helper])
|
|
593
|
+
logger.info(f"x11vnc shm-helper: {shm_helper}")
|
|
594
|
+
else:
|
|
595
|
+
cmd.append("-no-shm")
|
|
596
|
+
logger.info("x11vnc 未找到 shm-helper,使用 -no-shm 禁用 SHM")
|
|
597
|
+
|
|
572
598
|
env = {**os.environ, "DISPLAY": self.display}
|
|
573
599
|
|
|
574
600
|
logger.info(f"启动 x11vnc: {' '.join(cmd)}")
|