Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ TURN_USER = "g08abe68c81a07f098bb5f0914549bb32440e5aad0b216c7fba2b61e76fd62c6"
|
|
| 32 |
TURN_PASS = "aed1a10dd10eba9401ad9d99e5c66036d8a970eab5ba8e6dc9845ab57c771a7d"
|
| 33 |
|
| 34 |
logging.basicConfig(level=logging.WARNING)
|
| 35 |
-
logger = logging.getLogger("WebRTC-
|
| 36 |
|
| 37 |
# Increase worker threads for faster I/O
|
| 38 |
executor = concurrent.futures.ThreadPoolExecutor(max_workers=16)
|
|
@@ -109,7 +109,6 @@ input_manager = InputManager()
|
|
| 109 |
def start_system():
|
| 110 |
# 1. Setup Environment FIRST
|
| 111 |
os.environ["DISPLAY"] = DISPLAY_NUM
|
| 112 |
-
os.environ["KDE_FULL_SESSION"] = "true"
|
| 113 |
|
| 114 |
if not shutil.which("Xvfb"): raise FileNotFoundError("Xvfb missing")
|
| 115 |
|
|
@@ -129,15 +128,31 @@ def start_system():
|
|
| 129 |
# 4. Initialize Resolution
|
| 130 |
set_resolution(DEFAULT_WIDTH, DEFAULT_HEIGHT)
|
| 131 |
|
| 132 |
-
# 5. Start
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
def get_xrandr_output_name():
|
| 143 |
try:
|
|
|
|
| 32 |
TURN_PASS = "aed1a10dd10eba9401ad9d99e5c66036d8a970eab5ba8e6dc9845ab57c771a7d"
|
| 33 |
|
| 34 |
logging.basicConfig(level=logging.WARNING)
|
| 35 |
+
logger = logging.getLogger("WebRTC-Opera")
|
| 36 |
|
| 37 |
# Increase worker threads for faster I/O
|
| 38 |
executor = concurrent.futures.ThreadPoolExecutor(max_workers=16)
|
|
|
|
| 109 |
def start_system():
|
| 110 |
# 1. Setup Environment FIRST
|
| 111 |
os.environ["DISPLAY"] = DISPLAY_NUM
|
|
|
|
| 112 |
|
| 113 |
if not shutil.which("Xvfb"): raise FileNotFoundError("Xvfb missing")
|
| 114 |
|
|
|
|
| 128 |
# 4. Initialize Resolution
|
| 129 |
set_resolution(DEFAULT_WIDTH, DEFAULT_HEIGHT)
|
| 130 |
|
| 131 |
+
# 5. Start Window Manager
|
| 132 |
+
if shutil.which("matchbox-window-manager"):
|
| 133 |
+
subprocess.Popen("matchbox-window-manager -use_titlebar no", shell=True)
|
| 134 |
+
|
| 135 |
+
# 6. Start Browser
|
| 136 |
+
threading.Thread(target=keep_opera_alive, daemon=True).start()
|
| 137 |
+
|
| 138 |
+
def keep_opera_alive():
|
| 139 |
+
# Opera flags are similar to Chromium/Brave
|
| 140 |
+
opera_cmd = (
|
| 141 |
+
"opera "
|
| 142 |
+
"--no-sandbox "
|
| 143 |
+
"--start-maximized "
|
| 144 |
+
"--user-data-dir=/home/user/opera-data "
|
| 145 |
+
"--disable-infobars "
|
| 146 |
+
"--disable-dev-shm-usage "
|
| 147 |
+
"--disable-gpu "
|
| 148 |
+
"--window-position=0,0 "
|
| 149 |
+
f"--window-size={MAX_WIDTH},{MAX_HEIGHT}"
|
| 150 |
+
)
|
| 151 |
+
while True:
|
| 152 |
+
try:
|
| 153 |
+
subprocess.run(opera_cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 154 |
+
time.sleep(1)
|
| 155 |
+
except: time.sleep(2)
|
| 156 |
|
| 157 |
def get_xrandr_output_name():
|
| 158 |
try:
|