Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
import os
|
2 |
import subprocess
|
3 |
-
import threading
|
4 |
import logging
|
|
|
5 |
|
|
|
6 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', handlers=[logging.StreamHandler()])
|
7 |
|
8 |
def setup_chrome_remote_desktop():
|
9 |
logging.info("Starting Chrome Remote Desktop setup...")
|
10 |
-
|
11 |
-
#
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
logging.info("Chrome Remote Desktop setup complete.")
|
25 |
|
|
|
26 |
crd_thread = threading.Thread(target=setup_chrome_remote_desktop)
|
27 |
crd_thread.start()
|
28 |
|
|
|
29 |
subprocess.run(["tail", "-f", "/dev/null"])
|
30 |
-
|
31 |
-
|
|
|
1 |
import os
|
2 |
import subprocess
|
|
|
3 |
import logging
|
4 |
+
import threading
|
5 |
|
6 |
+
# Set up logging
|
7 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', handlers=[logging.StreamHandler()])
|
8 |
|
9 |
def setup_chrome_remote_desktop():
|
10 |
logging.info("Starting Chrome Remote Desktop setup...")
|
11 |
+
|
12 |
+
# Execute the command with the DISPLAY environment variable set
|
13 |
+
command = [
|
14 |
+
"bash", "-c",
|
15 |
+
'DISPLAY= /opt/google/chrome-remote-desktop/start-host --code="4/0AQlEd8zDHL-M_KotFr2ZooKjDqxs274Zl39q3Ht4J-OSBslWOukrjmKPfXixk99q4Tg9Xw" '
|
16 |
+
'--redirect-url="https://remotedesktop.google.com/_/oauthredirect" '
|
17 |
+
'--name=$(hostname) '
|
18 |
+
'--pin=123456'
|
19 |
+
]
|
20 |
+
|
21 |
+
# Run the command
|
22 |
+
subprocess.run(command, shell=False)
|
23 |
+
|
|
|
24 |
logging.info("Chrome Remote Desktop setup complete.")
|
25 |
|
26 |
+
# Run the Chrome Remote Desktop setup in a separate thread
|
27 |
crd_thread = threading.Thread(target=setup_chrome_remote_desktop)
|
28 |
crd_thread.start()
|
29 |
|
30 |
+
# Keep the container running
|
31 |
subprocess.run(["tail", "-f", "/dev/null"])
|
|
|
|