Commit e08629e3 authored by Roman Shishkin's avatar Roman Shishkin

Эндпоинты для отладки без авторизации

parent e775af9a
import os
from flask import Flask, session
from flask_uploads import configure_uploads
from .views import api
from .views import root
......@@ -47,6 +48,6 @@ def create_app():
@app.route('/uploads/<path:path>')
def uploads(path):
return send_from_directory('uploads', path)
return send_from_directory('../uploads', path)
return app
......@@ -18,6 +18,7 @@
<body>
<div class="container-fluid" ng-controller="AdminController">
{{sess}}
<!--Меню-->
<div class="row">
<ul class="nav nav-tabs menu-space-bottom">
......
......@@ -12,23 +12,39 @@ def init(app):
return render_template('error.html')
if viewer_type == '4':
return redirect(url_for('admin', _scheme='https', _external=True))
return redirect(url_for('admin', _scheme='https', _external=True, id=viewer_id, key=auth_key))
elif viewer_type == '3':
return redirect(url_for('editor', _scheme='https', _external=True))
return redirect(url_for('admin', _scheme='editor', _external=True, id=viewer_id, key=auth_key))
else:
return redirect(url_for('submit', _scheme='https', _external=True))
@app.route('/submit')
def submit():
# TODO(spark): check auth and session
return render_template('submit.html')
@app.route('/admin')
def admin():
# TODO(spark): check auth and session
return render_template('admin.html')
@app.route('/editor')
def editor():
# TODO(spark): check auth and session
return render_template('editor.html')
return redirect(url_for('admin', _scheme='submit', _external=True, id=viewer_id, key=auth_key))
@app.route('/submit/<int:id>/<string:key>')
def submit(id, key):
if check_user(app.config['APP_ID'], id, app.config['APP_SECRET'], key) is False:
return render_template('error.html')
return render_template('submit.html', id=id)
@app.route('/admin/<int:id>/<string:key>')
def admin(id, key):
if check_user(app.config['APP_ID'], id, app.config['APP_SECRET'], key) is False:
return render_template('error.html')
return render_template('admin.html', id=id)
@app.route('/editor/<int:id>/<string:key>')
def editor(id, key):
if check_user(app.config['APP_ID'], id, app.config['APP_SECRET'], key) is False:
return render_template('error.html')
return render_template('editor.html', id=id)
if app.config['DEBUG']:
@app.route('/submit')
def submit_dev():
return render_template('submit.html', id=1)
@app.route('/admin')
def admin_dev():
return render_template('admin.html', id=1)
@app.route('/editor')
def editor_dev():
return render_template('editor.html', id=1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment