 Chromium Code Reviews
 Chromium Code Reviews Issue 2242543002:
  Make OAuth client id accessible to new ui w/o hardcoding  (Closed) 
  Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
    
  
    Issue 2242543002:
  Make OAuth client id accessible to new ui w/o hardcoding  (Closed) 
  Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master| OLD | NEW | 
|---|---|
| 1 # Copyright 2013 The LUCI Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. | 
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 | 
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 """Main entry point for Swarming service. | 5 """Main entry point for Swarming service. | 
| 6 | 6 | 
| 7 This file contains the URL handlers for all the Swarming service URLs, | 7 This file contains the URL handlers for all the Swarming service URLs, | 
| 8 implemented using the webapp2 framework. | 8 implemented using the webapp2 framework. | 
| 9 """ | 9 """ | 
| 10 | 10 | 
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 735 } | 735 } | 
| 736 if acl.is_admin(): | 736 if acl.is_admin(): | 
| 737 params['mapreduce_jobs'] = [ | 737 params['mapreduce_jobs'] = [ | 
| 738 {'id': job_id, 'name': job_def['job_name']} | 738 {'id': job_id, 'name': job_def['job_name']} | 
| 739 for job_id, job_def in mapreduce_jobs.MAPREDUCE_JOBS.iteritems() | 739 for job_id, job_def in mapreduce_jobs.MAPREDUCE_JOBS.iteritems() | 
| 740 ] | 740 ] | 
| 741 params['xsrf_token'] = self.generate_xsrf_token() | 741 params['xsrf_token'] = self.generate_xsrf_token() | 
| 742 if acl.is_bootstrapper(): | 742 if acl.is_bootstrapper(): | 
| 743 params['bootstrap_token'] = bot_code.generate_bootstrap_token() | 743 params['bootstrap_token'] = bot_code.generate_bootstrap_token() | 
| 744 self.response.write(template.render('swarming/root.html', params)) | 744 self.response.write(template.render('swarming/root.html', params)) | 
| 745 | 745 | 
| 
Vadim Sh.
2016/08/11 20:00:24
nit: one more newline
 
kjlubick
2016/08/11 20:11:34
Done.
 | |
| 746 class UIHandler(auth.AuthenticatingHandler): | |
| 747 @auth.public | |
| 748 def get(self, page): | |
| 749 if not page: | |
| 750 page = "swarming" | |
| 751 | |
| 752 params = { | |
| 753 'client_id': config.settings().ui_client_id, | |
| 754 } | |
| 755 self.response.write(template.render( | |
| 756 'swarming/public_%s_index.html' % page, params)) | |
| 746 | 757 | 
| 747 class WarmupHandler(webapp2.RequestHandler): | 758 class WarmupHandler(webapp2.RequestHandler): | 
| 748 def get(self): | 759 def get(self): | 
| 749 auth.warmup() | 760 auth.warmup() | 
| 750 bot_code.get_swarming_bot_zip(self.request.host_url) | 761 bot_code.get_swarming_bot_zip(self.request.host_url) | 
| 751 utils.get_module_version_list(None, None) | 762 utils.get_module_version_list(None, None) | 
| 752 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' | 763 self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' | 
| 753 self.response.write('ok') | 764 self.response.write('ok') | 
| 754 | 765 | 
| 755 | 766 | 
| 756 class EmailHandler(webapp2.RequestHandler): | 767 class EmailHandler(webapp2.RequestHandler): | 
| 757 """Blackhole any email sent.""" | 768 """Blackhole any email sent.""" | 
| 758 def post(self, to): | 769 def post(self, to): | 
| 759 pass | 770 pass | 
| 760 | 771 | 
| 761 | 772 | 
| 762 def create_application(debug): | 773 def create_application(debug): | 
| 763 template.bootstrap() | 774 template.bootstrap() | 
| 764 utils.set_task_queue_module('default') | 775 utils.set_task_queue_module('default') | 
| 765 | 776 | 
| 766 routes = [ | 777 routes = [ | 
| 767 # Frontend pages. They return HTML. | 778 # Frontend pages. They return HTML. | 
| 768 # Public pages. | 779 # Public pages. | 
| 769 ('/', RootHandler), | 780 ('/', RootHandler), | 
| 770 ('/stats', stats_gviz.StatsSummaryHandler), | 781 ('/stats', stats_gviz.StatsSummaryHandler), | 
| 782 ('/newui/<page:[a-z]*>', UIHandler), | |
| 771 | 783 | 
| 772 # User pages. | 784 # User pages. | 
| 773 ('/user/tasks', TasksHandler), | 785 ('/user/tasks', TasksHandler), | 
| 774 ('/user/task/<task_id:[0-9a-fA-F]+>', TaskHandler), | 786 ('/user/task/<task_id:[0-9a-fA-F]+>', TaskHandler), | 
| 775 ('/user/task/<task_id:[0-9a-fA-F]+>/cancel', TaskCancelHandler), | 787 ('/user/task/<task_id:[0-9a-fA-F]+>/cancel', TaskCancelHandler), | 
| 776 ('/user/task/<task_id:[0-9a-fA-F]+>/retry', TaskRetryHandler), | 788 ('/user/task/<task_id:[0-9a-fA-F]+>/retry', TaskRetryHandler), | 
| 777 | 789 | 
| 778 # Privileged user pages. | 790 # Privileged user pages. | 
| 779 ('/restricted/bots', BotsListHandler), | 791 ('/restricted/bots', BotsListHandler), | 
| 780 ('/restricted/bot/<bot_id:[^/]+>', BotHandler), | 792 ('/restricted/bot/<bot_id:[^/]+>', BotHandler), | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 802 | 814 | 
| 803 # If running on a local dev server, allow bots to connect without prior | 815 # If running on a local dev server, allow bots to connect without prior | 
| 804 # groups configuration. Useful when running smoke test. | 816 # groups configuration. Useful when running smoke test. | 
| 805 if utils.is_local_dev_server(): | 817 if utils.is_local_dev_server(): | 
| 806 acl.bootstrap_dev_server_acls() | 818 acl.bootstrap_dev_server_acls() | 
| 807 | 819 | 
| 808 routes.extend(handlers_backend.get_routes()) | 820 routes.extend(handlers_backend.get_routes()) | 
| 809 routes.extend(handlers_bot.get_routes()) | 821 routes.extend(handlers_bot.get_routes()) | 
| 810 routes.extend(handlers_endpoints.get_routes()) | 822 routes.extend(handlers_endpoints.get_routes()) | 
| 811 return webapp2.WSGIApplication(routes, debug=debug) | 823 return webapp2.WSGIApplication(routes, debug=debug) | 
| OLD | NEW |