summaryrefslogtreecommitdiff
path: root/ickweb
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-08-05 16:26:36 +0300
committerLars Wirzenius <liw@liw.fi>2018-08-05 16:26:36 +0300
commitdfbaf09d68d5596aacef487e2d6c1f4f180d114d (patch)
treef0df46795ed66fe0b7d2539445eb87fa55372084 /ickweb
parent67585afaf4cb67877991ad41d5d85096d586cbf6 (diff)
downloadickweb-dfbaf09d68d5596aacef487e2d6c1f4f180d114d.tar.gz
Change: move everything under /web so paths are unique to ickweb
Diffstat (limited to 'ickweb')
-rw-r--r--ickweb/app.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/ickweb/app.py b/ickweb/app.py
index f8e5acf..1f3f09c 100644
--- a/ickweb/app.py
+++ b/ickweb/app.py
@@ -6,12 +6,11 @@ import requests
import yaml
-client_id = 'facade'
-client_secret = 'hunter2'
+client_id = 'ickweb'
COOKIE = 'ickweb-session'
-def create_app(our_url, controller):
+def create_app(our_url, controller, client_secret):
app = bottle.Bottle()
api = API(controller)
@@ -19,7 +18,7 @@ def create_app(our_url, controller):
def favicon():
raise bottle.HTTPError(status=404)
- @app.route('/')
+ @app.route('/web')
def root():
cookie = get_cookie()
if cookie is None:
@@ -33,13 +32,13 @@ def create_app(our_url, controller):
def front_page():
return bottle.template('index', token=api.get_token())
- @app.route('/login')
+ @app.route('/web/login')
def login():
scopes = [
'openid',
'uapi_version_get',
- 'uapi_projects_get',
'uapi_status_get',
+ 'uapi_projects_get',
'uapi_projects_post',
'uapi_projects_id_get',
'uapi_projects_id_put',
@@ -66,7 +65,7 @@ def create_app(our_url, controller):
'scope': ' '.join(scopes),
'client_id': client_id,
'state': 'FIXME',
- 'redirect_uri': '{}/callback'.format(our_url),
+ 'redirect_uri': '{}/web/callback'.format(our_url),
}
url = '{}/auth?{}'.format(controller, urllib.parse.urlencode(params))
headers = {
@@ -75,12 +74,12 @@ def create_app(our_url, controller):
print('/login: redirect to', url)
return bottle.HTTPResponse(status=302, headers=headers)
- @app.route('/projects')
+ @app.route('/web/projects')
def projects():
projects = api.get_projects()
return bottle.template('projects', projects=projects)
- @app.route('/projects/<name>')
+ @app.route('/web/projects/<name:path>')
def show_project(name):
project = api.get_project(name)
params = {
@@ -89,17 +88,17 @@ def create_app(our_url, controller):
}
return bottle.template('project', **params)
- @app.route('/builds')
+ @app.route('/web/builds')
def builds():
builds = api.get_builds()
return bottle.template('builds', builds=builds)
- @app.route('/logs/<buildid:path>')
+ @app.route('/web/logs/<buildid:path>')
def show_log(buildid):
log = api.get_log(buildid)
return bottle.template('log', buildid=buildid, log=log)
- @app.route('/callback')
+ @app.route('/web/callback')
def callback():
print('/callback called')
code = bottle.request.query['code']
@@ -117,7 +116,7 @@ def create_app(our_url, controller):
token = obj['access_token']
print('token:', token)
bottle.response.set_cookie(COOKIE, token)
- bottle.redirect('/')
+ bottle.redirect('/web')
return app