adding application root back in loop again, as the HTML and PDF views break when using an URL prefix.....
This commit is contained in:
parent
db7bb5bfce
commit
21b2522a65
2 changed files with 17 additions and 2 deletions
18
octomode.py
18
octomode.py
|
|
@ -128,12 +128,26 @@ def stylesheet(name):
|
||||||
|
|
||||||
@APP.route('/<name>/html/')
|
@APP.route('/<name>/html/')
|
||||||
def html(name):
|
def html(name):
|
||||||
url = f"/{ name }/preview.html"
|
# only here we need application root to make all the URLs work.....
|
||||||
|
if APP.config['APPLICATION_ROOT'] == '/':
|
||||||
|
app_root = ''
|
||||||
|
elif APP.config['APPLICATION_ROOT'].endswith('/'):
|
||||||
|
app_root = APP.config['APPLICATION_ROOT'][:-1]
|
||||||
|
else:
|
||||||
|
app_root = APP.config['APPLICATION_ROOT']
|
||||||
|
url = f"{ app_root }/{ name }/preview.html"
|
||||||
return render_template('iframe.html', url=url, name=name.strip(), pad_url=APP.config['PAD_URL'])
|
return render_template('iframe.html', url=url, name=name.strip(), pad_url=APP.config['PAD_URL'])
|
||||||
|
|
||||||
@APP.route('/<name>/pdf/')
|
@APP.route('/<name>/pdf/')
|
||||||
def pdf(name):
|
def pdf(name):
|
||||||
url = f"/{name}/pagedjs.html"
|
# only here we need application root to make all the URLs work.....
|
||||||
|
if APP.config['APPLICATION_ROOT'] == '/':
|
||||||
|
app_root = ''
|
||||||
|
elif APP.config['APPLICATION_ROOT'].endswith('/'):
|
||||||
|
app_root = APP.config['APPLICATION_ROOT'][:-1]
|
||||||
|
else:
|
||||||
|
app_root = APP.config['APPLICATION_ROOT']
|
||||||
|
url = f"{ app_root }/{name}/pagedjs.html"
|
||||||
return render_template('pdf.html', url=url, name=name.strip(), pad_url=APP.config['PAD_URL'])
|
return render_template('pdf.html', url=url, name=name.strip(), pad_url=APP.config['PAD_URL'])
|
||||||
|
|
||||||
# //////////////////
|
# //////////////////
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ from dotenv import load_dotenv
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# Bind them to Python variables
|
# Bind them to Python variables
|
||||||
|
APPLICATION_ROOT = os.environ.get('OCTOMODE_APPLICATION_ROOT', '/')
|
||||||
PORTNUMBER = int(os.environ.get('OCTOMODE_PORTNUMBER', 5001))
|
PORTNUMBER = int(os.environ.get('OCTOMODE_PORTNUMBER', 5001))
|
||||||
PAD_URL = os.environ.get('OCTOMODE_PAD_URL', 'https://pad.vvvvvvaria.org')
|
PAD_URL = os.environ.get('OCTOMODE_PAD_URL', 'https://pad.vvvvvvaria.org')
|
||||||
PAD_API_URL = os.environ.get('OCTOMODE_PAD_API_URL', 'https://pad.vvvvvvaria.org/api/1.2.15')
|
PAD_API_URL = os.environ.get('OCTOMODE_PAD_API_URL', 'https://pad.vvvvvvaria.org/api/1.2.15')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue