Enable dev and domain independent serving, add favicon
This commit is contained in:
parent
5f296849f5
commit
99fe1e25ce
|
@ -1,7 +1,16 @@
|
||||||
from .app import app
|
from .app import app
|
||||||
|
from flask import send_from_directory
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def get_root():
|
||||||
|
return send_from_directory('../web', 'index.html')
|
||||||
|
|
||||||
|
@app.route('/<path:path>')
|
||||||
|
def get_path(path):
|
||||||
|
return send_from_directory('../web', path)
|
||||||
|
|
||||||
@app.after_request
|
@app.after_request
|
||||||
def add_headers(response):
|
def add_headers(response):
|
||||||
response.headers['Access-Control-Allow-Origin'] = '*'
|
response.headers['Access-Control-Allow-Origin'] = '*'
|
||||||
|
|
|
@ -22,7 +22,7 @@ def startup():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@app.route('/<id>', methods = ['GET'])
|
@app.route('/db/<id>', methods = ['GET'])
|
||||||
def get(id):
|
def get(id):
|
||||||
return data[id] if id in data else ('Error: Not found', 404)
|
return data[id] if id in data else ('Error: Not found', 404)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ def generateNewKey():
|
||||||
|
|
||||||
return id
|
return id
|
||||||
|
|
||||||
@app.route('/', methods = ['POST'])
|
@app.route('/db', methods = ['POST'])
|
||||||
def post():
|
def post():
|
||||||
|
|
||||||
id = generateNewKey()
|
id = generateNewKey()
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
|
@ -31,7 +31,7 @@ function changeView(view) {
|
||||||
|
|
||||||
function showLink() {
|
function showLink() {
|
||||||
|
|
||||||
var link = 'https://quiz.fasttube.de/?id=' + state.id
|
var link = location.href + '?id=' + state.id
|
||||||
|
|
||||||
var linkEl = document.getElementById('shareLink')
|
var linkEl = document.getElementById('shareLink')
|
||||||
linkEl.href = link
|
linkEl.href = link
|
||||||
|
@ -71,7 +71,7 @@ async function shareQuiz() {
|
||||||
console.log(quizData)
|
console.log(quizData)
|
||||||
console.log('Waiting for id')
|
console.log('Waiting for id')
|
||||||
|
|
||||||
var db = 'https://quiz.fasttube.de/db/'
|
var db = location.href + 'db'
|
||||||
|
|
||||||
var response = await fetch(db, {
|
var response = await fetch(db, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -486,7 +486,7 @@ async function fetchQuiz(id) {
|
||||||
|
|
||||||
console.log('Fetching quiz')
|
console.log('Fetching quiz')
|
||||||
|
|
||||||
var url = 'https://quiz.fasttube.de/db/' + id
|
var url = location.href + 'db/' + id
|
||||||
|
|
||||||
var response = await fetch(url)
|
var response = await fetch(url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue