6
6
7
7
HERE = os .path .dirname (os .path .abspath (__file__ ))
8
8
9
+
9
10
def _xprahtml5_mappath (path ):
10
11
from getpass import getuser
11
-
12
+
12
13
uri_parms = '?' + '&' .join ([
13
14
'username=' + getuser (),
14
- # 'password=' + _xprahtml5_passwd,
15
- # 'encryption=AES',
16
- # 'key=' + _xprahtml5_aeskey,
17
- # 'sharing=true',
15
+ # 'password=' + _xprahtml5_passwd,
16
+ # 'encryption=AES',
17
+ # 'key=' + _xprahtml5_aeskey,
18
+ # 'sharing=true',
18
19
])
19
20
20
- if path in ('/' , '/index.html' , ):
21
+ if path in ('/' , '/index.html' , ):
21
22
path = '/index.html' + uri_parms
22
23
logger .info ('Xpra URI: ' + path )
23
24
@@ -32,7 +33,6 @@ def setup_xprahtml5():
32
33
from tempfile import gettempdir , mkstemp
33
34
from random import choice
34
35
from string import ascii_letters , digits
35
- from getpass import getuser
36
36
37
37
global _xprahtml5_passwd , _xprahtml5_aeskey
38
38
@@ -55,7 +55,7 @@ def _get_random_alphanumeric_string(length):
55
55
with open (fd_passwd , 'w' ) as f :
56
56
f .write (_xprahtml5_passwd )
57
57
58
- except :
58
+ except Exception :
59
59
logger .error ("Passwd generation in temp file FAILED" )
60
60
raise FileNotFoundError ("Passwd generation in temp file FAILED" )
61
61
@@ -67,31 +67,32 @@ def _get_random_alphanumeric_string(length):
67
67
68
68
with open (fd_aeskey , 'w' ) as f :
69
69
f .write (_xprahtml5_aeskey )
70
- except :
70
+
71
+ except Exception :
71
72
logger .error ("Encryption key generation in temp file FAILED" )
72
73
raise FileNotFoundError ("Encryption key generation in temp file FAILED" )
73
74
74
75
# create command
75
- cmd = [ os .path .join (HERE , 'share/launch_xpra.sh' ),
76
+ cmd = [os .path .join (HERE , 'share/launch_xpra.sh' ),
76
77
'start' ,
77
78
'--html=on' ,
78
79
'--bind-tcp=0.0.0.0:{port}' ,
79
- # '--socket-dir="' + socket_path + '/"', fixme: socket_dir not recognized
80
+ # '--socket-dir="' + socket_path + '/"', fixme: socket_dir not recognized
80
81
'--server-idle-timeout=86400' , # stop server after 24h with no client connection
81
82
'--start=xterm' ,
82
- # '--start-child=xterm', '--exit-with-children',
83
- # '--tcp-auth=file:filename=' + fpath_passwd,
84
- # '--tcp-encryption=AES',
85
- # '--tcp-encryption-keyfile=' + fpath_aeskey,
83
+ # '--start-child=xterm', '--exit-with-children',
84
+ # '--tcp-auth=file:filename=' + fpath_passwd,
85
+ # '--tcp-encryption=AES',
86
+ # '--tcp-encryption-keyfile=' + fpath_aeskey,
86
87
'--clipboard-direction=both' ,
87
88
'--no-bell' ,
88
89
'--no-speaker' ,
89
90
'--no-printing' ,
90
91
'--no-microphone' ,
91
92
'--no-notifications' ,
92
93
'--dpi=96' ,
93
- # '--sharing'
94
- ]
94
+ # '--sharing',
95
+ ]
95
96
logger .info ('Xpra command: ' + ' ' .join (cmd ))
96
97
97
98
return {
@@ -100,7 +101,7 @@ def _get_random_alphanumeric_string(length):
100
101
},
101
102
'command' : cmd ,
102
103
'mappath' : _xprahtml5_mappath ,
103
- 'absolute_url' : False ,
104
+ 'absolute_url' : False ,
104
105
'timeout' : 30 ,
105
106
'new_browser_tab' : True ,
106
107
'launcher_entry' : {
0 commit comments