OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Creates a directory with with the unpacked contents of the remoting webapp. | 6 """Creates a directory with with the unpacked contents of the remoting webapp. |
7 | 7 |
8 The directory will contain a copy-of or a link-to to all remoting webapp | 8 The directory will contain a copy-of or a link-to to all remoting webapp |
9 resources. This includes HTML/JS and any plugin binaries. The script also | 9 resources. This includes HTML/JS and any plugin binaries. The script also |
10 massages resulting files appropriately with host plugin data. Finally, | 10 massages resulting files appropriately with host plugin data. Finally, |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 oauth2RedirectPath = '/talkgadget/oauth/chrome-remote-desktop' | 235 oauth2RedirectPath = '/talkgadget/oauth/chrome-remote-desktop' |
236 oauth2RedirectBaseUrlJs = oauth2RedirectHostJs + oauth2RedirectPath | 236 oauth2RedirectBaseUrlJs = oauth2RedirectHostJs + oauth2RedirectPath |
237 oauth2RedirectBaseUrlJson = oauth2RedirectHostJson + oauth2RedirectPath | 237 oauth2RedirectBaseUrlJson = oauth2RedirectHostJson + oauth2RedirectPath |
238 if buildtype == 'Official': | 238 if buildtype == 'Official': |
239 oauth2RedirectUrlJs = ("'" + oauth2RedirectBaseUrlJs + | 239 oauth2RedirectUrlJs = ("'" + oauth2RedirectBaseUrlJs + |
240 "/rel/' + chrome.i18n.getMessage('@@extension_id')") | 240 "/rel/' + chrome.i18n.getMessage('@@extension_id')") |
241 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/rel/*' | 241 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/rel/*' |
242 else: | 242 else: |
243 oauth2RedirectUrlJs = "'" + oauth2RedirectBaseUrlJs + "/dev'" | 243 oauth2RedirectUrlJs = "'" + oauth2RedirectBaseUrlJs + "/dev'" |
244 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/dev*' | 244 oauth2RedirectUrlJson = oauth2RedirectBaseUrlJson + '/dev*' |
| 245 thirdPartyAuthUrlJs = "'" + oauth2RedirectBaseUrlJs + "/thirdpartyauth'" |
| 246 thirdPartyAuthUrlJson = oauth2RedirectBaseUrlJson + '/thirdpartyauth*' |
245 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 247 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
246 "'TALK_GADGET_URL'", "'" + talkGadgetBaseUrl + "'") | 248 "'TALK_GADGET_URL'", "'" + talkGadgetBaseUrl + "'") |
247 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 249 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
248 "'OAUTH2_REDIRECT_URL'", oauth2RedirectUrlJs) | 250 "'OAUTH2_REDIRECT_URL'", oauth2RedirectUrlJs) |
249 findAndReplace(os.path.join(destination, 'manifest.json'), | 251 findAndReplace(os.path.join(destination, 'manifest.json'), |
250 'TALK_GADGET_HOST', talkGadgetHostJson) | 252 'TALK_GADGET_HOST', talkGadgetHostJson) |
251 findAndReplace(os.path.join(destination, 'manifest.json'), | 253 findAndReplace(os.path.join(destination, 'manifest.json'), |
252 'OAUTH2_REDIRECT_URL', oauth2RedirectUrlJson) | 254 'OAUTH2_REDIRECT_URL', oauth2RedirectUrlJson) |
253 | 255 |
254 # Configure xmpp server and directory bot settings in the plugin. | 256 # Configure xmpp server and directory bot settings in the plugin. |
255 xmppServerAddress = os.environ.get( | 257 xmppServerAddress = os.environ.get( |
256 'XMPP_SERVER_ADDRESS', 'talk.google.com:5222') | 258 'XMPP_SERVER_ADDRESS', 'talk.google.com:5222') |
257 xmppServerUseTls = os.environ.get('XMPP_SERVER_USE_TLS', 'true') | 259 xmppServerUseTls = os.environ.get('XMPP_SERVER_USE_TLS', 'true') |
258 directoryBotJid = os.environ.get( | 260 directoryBotJid = os.environ.get( |
259 'DIRECTORY_BOT_JID', 'remoting@bot.talk.google.com') | 261 'DIRECTORY_BOT_JID', 'remoting@bot.talk.google.com') |
260 | 262 |
261 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 263 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
262 "'XMPP_SERVER_ADDRESS'", "'" + xmppServerAddress + "'") | 264 "'XMPP_SERVER_ADDRESS'", "'" + xmppServerAddress + "'") |
263 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 265 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
264 "Boolean('XMPP_SERVER_USE_TLS')", xmppServerUseTls) | 266 "Boolean('XMPP_SERVER_USE_TLS')", xmppServerUseTls) |
265 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 267 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
266 "'DIRECTORY_BOT_JID'", "'" + directoryBotJid + "'") | 268 "'DIRECTORY_BOT_JID'", "'" + directoryBotJid + "'") |
| 269 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
| 270 "'THIRD_PARTY_AUTH_REDIRECT_URL'", |
| 271 thirdPartyAuthUrlJs) |
| 272 findAndReplace(os.path.join(destination, 'manifest.json'), |
| 273 "THIRD_PARTY_AUTH_REDIRECT_URL", |
| 274 thirdPartyAuthUrlJson) |
267 | 275 |
268 # Set the correct API keys. | 276 # Set the correct API keys. |
269 # For overriding the client ID/secret via env vars, see google_api_keys.py. | 277 # For overriding the client ID/secret via env vars, see google_api_keys.py. |
270 apiClientId = google_api_keys.GetClientID('REMOTING') | 278 apiClientId = google_api_keys.GetClientID('REMOTING') |
271 apiClientSecret = google_api_keys.GetClientSecret('REMOTING') | 279 apiClientSecret = google_api_keys.GetClientSecret('REMOTING') |
272 | 280 |
273 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 281 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
274 "'API_CLIENT_ID'", | 282 "'API_CLIENT_ID'", |
275 "'" + apiClientId + "'") | 283 "'" + apiClientId + "'") |
276 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 284 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
(...skipping 27 matching lines...) Expand all Loading... |
304 patches.append(arg) | 312 patches.append(arg) |
305 else: | 313 else: |
306 files.append(arg) | 314 files.append(arg) |
307 | 315 |
308 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], | 316 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], |
309 sys.argv[5], sys.argv[6], files, locales, patches) | 317 sys.argv[5], sys.argv[6], files, locales, patches) |
310 | 318 |
311 | 319 |
312 if __name__ == '__main__': | 320 if __name__ == '__main__': |
313 sys.exit(main()) | 321 sys.exit(main()) |
OLD | NEW |