Skip to content

Commit

Permalink
Add option to always redirect.
Browse files Browse the repository at this point in the history
  • Loading branch information
am009 committed May 11, 2024
1 parent 8a3493e commit ace49d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/latexdiff_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

DEBUG = (__name__ == '__main__')
TIMEOUT_LIMIT = 600.0
REDIR_ROOT = os.environ.get('REDIR_ROOT', None).lower() in ['true', '1', 'yes', 'y']

from flask import Flask, request, redirect, jsonify, send_from_directory
from flask_cors import CORS, cross_origin
Expand All @@ -24,13 +25,13 @@ def gen_redir():

@app.route('/')
def send_index():
if not os.path.exists('static'):
if REDIR_ROOT or not os.path.exists('static'):
return gen_redir()
return send_from_directory('static', 'index.html')

@app.route('/<path:path>')
def send_web(path):
if not os.path.exists('static'):
if REDIR_ROOT or not os.path.exists('static'):
return gen_redir()
return send_from_directory('static', path)

Expand Down

0 comments on commit ace49d8

Please sign in to comment.