2020-03-09 18:35:02 +00:00
|
|
|
# Python imports
|
|
|
|
|
|
|
|
# Lib imports
|
2023-03-12 03:10:29 +00:00
|
|
|
from flask import request
|
|
|
|
from flask import render_template
|
2020-10-31 01:32:26 +00:00
|
|
|
from flask_login import current_user
|
|
|
|
|
2023-03-12 03:10:29 +00:00
|
|
|
# Application imports
|
|
|
|
# Get from __init__
|
|
|
|
from core import app
|
|
|
|
from core import oidc
|
|
|
|
from core import db
|
2019-12-22 19:09:36 +00:00
|
|
|
|
2019-11-01 22:54:25 +00:00
|
|
|
|
|
|
|
@app.route('/', methods=['GET', 'POST'])
|
2020-03-14 06:15:31 +00:00
|
|
|
def home():
|
2019-11-01 22:54:25 +00:00
|
|
|
if request.method == 'GET':
|
2020-11-05 18:50:45 +00:00
|
|
|
return render_template('pages/index.html')
|
2020-01-12 19:32:47 +00:00
|
|
|
|
|
|
|
return render_template('error.html',
|
|
|
|
title='Error!',
|
|
|
|
message='Must use GET request type...')
|
2020-03-14 04:55:07 +00:00
|
|
|
|
2023-09-09 23:18:43 +00:00
|
|
|
# NOTE: Yeah, not exactly 'logged' but mostly used with the terminal anyway.
|
|
|
|
@app.route('/log-client-exception', methods=['GET', 'POST'])
|
|
|
|
def ui_failure_exception_tracker():
|
|
|
|
if request.method == 'POST':
|
|
|
|
DATA = str(request.values['exception_data']).strip()
|
|
|
|
print(f"\n\n{DATA}")
|
|
|
|
return json_message.create("success", "UI Exception logged...")
|
|
|
|
|
|
|
|
return json_message.create("danger", "Must use POST request type...")
|
|
|
|
|
2020-03-14 04:55:07 +00:00
|
|
|
|
|
|
|
@app.route('/about', methods=['GET', 'POST'])
|
|
|
|
def about():
|
|
|
|
if request.method == 'GET':
|
2020-11-05 18:50:45 +00:00
|
|
|
return render_template('pages/about.html')
|
2020-03-14 04:55:07 +00:00
|
|
|
|
2020-10-31 01:32:26 +00:00
|
|
|
return render_template('error.html', title = 'Error!',
|
|
|
|
message = 'Must use GET request type...')
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/protected-zone', methods=['GET', 'POST'])
|
|
|
|
def protected_zone():
|
|
|
|
if request.method == 'GET':
|
|
|
|
msg = "Log in to see the secret!"
|
|
|
|
if current_user.is_authenticated or oidc.user_loggedin:
|
|
|
|
msg = "There is no secret! It was all a lie!"
|
|
|
|
|
2020-11-05 18:50:45 +00:00
|
|
|
return render_template('pages/protected.html', secret = msg)
|
2020-10-31 01:32:26 +00:00
|
|
|
|
|
|
|
return render_template('error.html', title = 'Error!',
|
|
|
|
message = 'Must use GET request type...')
|