2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Gets the chromoting host info from an input arg and then
7 tries to find the authentication info in the .chromotingAuthToken file
8 so that the host authentication arguments can be automatically set.
16 auth_filepath
= os
.path
.join(os
.path
.expanduser('~'), '.chromotingAuthToken')
17 script_path
= os
.path
.dirname(__file__
)
19 if platform
.system() == "Windows":
20 # TODO(garykac): Make this work on Windows.
21 print 'Not yet supported on Windows.'
23 elif platform
.system() == "Darwin": # Darwin == MacOSX
24 client_path
= '../../xcodebuild/Debug/chromoting_simple_client'
26 client_path
= '../../out/Debug/chromoting_x11_client'
28 client_path
= os
.path
.join(script_path
, client_path
)
30 # Read username and auth token from token file.
31 auth
= open(auth_filepath
)
32 authinfo
= auth
.readlines()
34 username
= authinfo
[0].rstrip()
35 authtoken
= authinfo
[1].rstrip()
37 # Request final 8 characters of Host JID from user.
38 # This assumes that the host is published under the same username as the
39 # client attempting to connect.
40 print 'Host JID:', username
+ '/chromoting',
41 hostjid_suffix
= raw_input()
42 hostjid
= username
+ '/chromoting' + hostjid_suffix
.upper()
45 command
.append(client_path
)
46 command
.append('--host_jid ' + hostjid
)
47 command
.append('--jid ' + username
)
48 command
.append('--token ' + authtoken
)
51 os
.system(' '.join(command
))
55 if __name__
== '__main__':