From e3db0398cec66e06672ebfc484ae0e836a503b8b Mon Sep 17 00:00:00 2001 From: yackob03 Date: Sun, 13 Oct 2013 22:06:31 -0400 Subject: [PATCH] Add routes specifically for all angular subroutes so that 404s will start working again. Add a warning in app.js to hopefully ensure that new routes get created when necessary. --- endpoints/web.py | 17 ++++++++++++++++- static/js/app.js | 6 +++++- templates/index.html | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/endpoints/web.py b/endpoints/web.py index d50f15b2c..03449e179 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -35,11 +35,26 @@ def load_user(username): @app.route('/', methods=['GET'], defaults={'path': ''}) -@app.route('/') # Catch all +@app.route('/repository/', methods=['GET']) def index(path): return send_file('templates/index.html') +@app.route('/plans/') +def plans(): + return index('') + + +@app.route('/guide/') +def guide(): + return index('') + + +@app.route('/user/') +def user(): + return index('') + + @app.route('/status', methods=['GET']) def status(): return make_response('Healthy') diff --git a/static/js/app.js b/static/js/app.js index 16710cc3f..6d192848c 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -124,12 +124,16 @@ quayApp = angular.module('quay', ['restangular', 'angularMoment', 'angulartics', $locationProvider.html5Mode(true); + // WARNING WARNING WARNING + // If you add a route here, you must add a corresponding route in thr endpoints/web.py + // index rule to make sure that deep links directly deep into the app continue to work. + // WARNING WARNING WARNING $routeProvider. when('/repository/:namespace/:name', {templateUrl: '/static/partials/view-repo.html', controller: RepoCtrl}). when('/repository/:namespace/:name/tag/:tag', {templateUrl: '/static/partials/view-repo.html', controller: RepoCtrl}). when('/repository/:namespace/:name/admin', {templateUrl: '/static/partials/repo-admin.html', controller:RepoAdminCtrl}). when('/repository/', {title: 'Repositories', templateUrl: '/static/partials/repo-list.html', controller: RepoListCtrl}). - when('/user', {title: 'User Admin', templateUrl: '/static/partials/user-admin.html', controller: UserAdminCtrl}). + when('/user/', {title: 'User Admin', templateUrl: '/static/partials/user-admin.html', controller: UserAdminCtrl}). when('/guide/', {title: 'Getting Started Guide', templateUrl: '/static/partials/guide.html', controller: GuideCtrl}). when('/plans/', {title: 'Plans and Pricing', templateUrl: '/static/partials/plans.html', controller: PlansCtrl}). when('/', {title: 'Hosted Private Docker Registry', templateUrl: '/static/partials/landing.html', controller: LandingCtrl}). diff --git a/templates/index.html b/templates/index.html index 981689e9c..0b48b3ce3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -66,7 +66,7 @@ var isProd = document.location.hostname === 'quay.io'; (function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!== typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g +mixpanel.init(isProd ? "50ff2b2569faa3a51c8f5724922ffb7e" : "38014a0f27e7bdc3ff8cc7cc29c869f9", { track_pageview : false, debug: !isProd }); @@ -112,7 +112,7 @@ mixpanel.init(isProd ? "50ff2b2569faa3a51c8f5724922ffb7e" : "38014a0f27e7bdc3ff8