This commit is contained in:
2020-06-21 20:21:33 +01:00
parent b943bd1f27
commit 079dff8d9f
5 changed files with 31 additions and 39 deletions

View File

@@ -3,18 +3,10 @@ from configparser import RawConfigParser
from jellyfin_accounts.jf_api import Jellyfin
from jellyfin_accounts import config, config_path, app, first_run
from jellyfin_accounts import web_log as log
from jellyfin_accounts.web_api import resp
import os
if first_run:
def resp(success=True, code=500):
if success:
r = jsonify({'success': True})
r.status_code = 200
else:
r = jsonify({'success': False})
r.status_code = code
return r
def tempJF(server):
return Jellyfin(server,
config['jellyfin']['client'],
@@ -30,7 +22,6 @@ if first_run:
def setup():
return render_template('setup.html')
@app.route('/<path:path>')
def static_proxy(path):
if 'html' not in path:
@@ -38,7 +29,6 @@ if first_run:
else:
return render_template('404.html'), 404
@app.route('/modifyConfig', methods=['POST'])
def modifyConfig():
log.info('Config modification requested')
@@ -59,10 +49,10 @@ if first_run:
with open(config_path, 'w') as config_file:
temp_config.write(config_file)
log.debug('Config written')
# ugly exit, sorry
os._exit(1)
return resp()
@app.route('/testJF', methods=['GET', 'POST'])
def testJF():
data = request.get_json()