Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,6 +102,15 @@ async def _start_session_browser(disp: str) -> "subprocess.Popen | None":
|
|
| 102 |
|
| 103 |
def _spawn():
|
| 104 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
return subprocess.Popen(
|
| 106 |
[BROWSER, "--new-window", "--no-remote", "about:blank"],
|
| 107 |
env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
|
@@ -1100,6 +1109,20 @@ async def handle_action(ws: WebSocket, msg: dict):
|
|
| 1100 |
if esr_check.returncode != 0:
|
| 1101 |
fixed_cmd = app_cmd.replace("firefox-esr", BROWSER)
|
| 1102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1103 |
subprocess.Popen(fixed_cmd, shell=True,
|
| 1104 |
env={**os.environ, "DISPLAY": DISPLAY_OF()},
|
| 1105 |
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
|
| 102 |
|
| 103 |
def _spawn():
|
| 104 |
try:
|
| 105 |
+
# ุญุฐู ู
ููุงุช ููู Firefox ุงูู
ุชุจููุฉ ุฃููุงู (ุญุชู ูู ูู ุฌูุณุฉ ุนูู display ู
ููุตูุ
|
| 106 |
+
# ุงูู profile ุนูู ุงููุฑุต ูุฏ ูููู ู
ุดุชุฑููุงู ููุญู
ู ูููุงู ู
ู ุฌูุณุฉ ุณุงุจูุฉ ูู
ุชูุบูู ูุธููุงู)
|
| 107 |
+
try:
|
| 108 |
+
subprocess.run(
|
| 109 |
+
"rm -f ~/.mozilla/firefox/*/lock ~/.mozilla/firefox/*/.parentlock 2>/dev/null",
|
| 110 |
+
shell=True, executable="/bin/bash", timeout=3, capture_output=True
|
| 111 |
+
)
|
| 112 |
+
except Exception:
|
| 113 |
+
pass
|
| 114 |
return subprocess.Popen(
|
| 115 |
[BROWSER, "--new-window", "--no-remote", "about:blank"],
|
| 116 |
env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
|
|
|
| 1109 |
if esr_check.returncode != 0:
|
| 1110 |
fixed_cmd = app_cmd.replace("firefox-esr", BROWSER)
|
| 1111 |
|
| 1112 |
+
# โโ ุญู
ุงูุฉ ุฅุถุงููุฉ: ุญุฐู ู
ููุงุช ููู Firefox ุงูู
ุชุจููุฉ ูุจู ูุชุญ ูุงูุฐุฉ ุฌุฏูุฏุฉ โโ
|
| 1113 |
+
# ูู
ูุน ุธููุฑ "Firefox is already running, but is not responding" ุญุชู ูู
|
| 1114 |
+
# ูุณู ุงูุฐูุงุก ุชุถู
ูู ูุฐุง ุงูุชูุธูู ูู ุฃู
ุฑู ุงูุฎุงุต.
|
| 1115 |
+
if any(b in fixed_cmd for b in ("firefox", "Firefox")):
|
| 1116 |
+
def _clean_lock():
|
| 1117 |
+
try:
|
| 1118 |
+
subprocess.run(
|
| 1119 |
+
"rm -f ~/.mozilla/firefox/*/lock ~/.mozilla/firefox/*/.parentlock 2>/dev/null",
|
| 1120 |
+
shell=True, executable="/bin/bash", timeout=3, capture_output=True
|
| 1121 |
+
)
|
| 1122 |
+
except Exception:
|
| 1123 |
+
pass
|
| 1124 |
+
await asyncio.to_thread(_clean_lock)
|
| 1125 |
+
|
| 1126 |
subprocess.Popen(fixed_cmd, shell=True,
|
| 1127 |
env={**os.environ, "DISPLAY": DISPLAY_OF()},
|
| 1128 |
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|