From 58b622a19607bb73512c3d397c10e92be83605d8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 8 May 2020 13:04:38 +1200 Subject: [PATCH] Change server send correct files for new web-remote --- openlp/core/api/main.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/openlp/core/api/main.py b/openlp/core/api/main.py index 1855988a5..9d9a71a70 100644 --- a/openlp/core/api/main.py +++ b/openlp/core/api/main.py @@ -19,17 +19,23 @@ # along with this program. If not, see . # ########################################################################## +import os + from flask import Blueprint, send_from_directory from openlp.core.common.applocation import AppLocation main_views = Blueprint('main', __name__) -@main_views.route('/') -def index(): - return send_from_directory(str(AppLocation.get_section_data_path('remotes')), 'index.html') - - +@main_views.route('/', defaults={'path': ''}) @main_views.route('/') +def index(path): + if os.path.isfile(AppLocation.get_section_data_path('remotes') / path): + return send_from_directory(str(AppLocation.get_section_data_path('remotes')), path) + else: + return send_from_directory(str(AppLocation.get_section_data_path('remotes')), 'index.html') + + +@main_views.route('/assets/') def assets(path): - return send_from_directory(str(AppLocation.get_section_data_path('remotes')), path) + return send_from_directory(str(AppLocation.get_section_data_path('remotes') / 'assets'), path)