From 78de1535577bd6bbfc2316db29d396728cc91bfc Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Wed, 3 Jun 2020 12:17:29 +0100 Subject: [PATCH] Added separate public & private jellyfin address option --- README.md | 7 +++++-- data/config-default.ini | 7 +++++-- jellyfin_accounts/web.py | 2 +- jf-accounts | 15 +++++++++------ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9a80a91..7604e0a 100644 --- a/README.md +++ b/README.md @@ -93,8 +93,11 @@ For detailed descriptions of each setting, see [setup](https://github.com/hrfee/ ; It is reccommended to create a limited admin account for this program. username = username password = password -; Server will also be used in the invite form, so make sure it's publicly accessible. -server = https://jellyf.in:443 +; Jellyfin server address. Can be public, or local for security purposes. +server = http://jellyfin.local:8096 +; Publicly accessible Jellyfin address, used on invite form. +; Leave blank to use the same address as above. +public_server = https://jellyf.in:443 client = jf-accounts version = 0.1 device = jf-accounts diff --git a/data/config-default.ini b/data/config-default.ini index 2650138..d32be37 100644 --- a/data/config-default.ini +++ b/data/config-default.ini @@ -2,8 +2,11 @@ ; It is reccommended to create a limited admin account for this program. username = username password = password -; Server will also be used in the invite form, so make sure it's publicly accessible. -server = https://jellyf.in:443 +; Jellyfin server address. Can be public, or local for security purposes. +server = http://jellyfin.local:8096 +; Publicly accessible Jellyfin address, used on invite form. +; Leave blank to use the same address as above. +public_server = https://jellyf.in:443 client = jf-accounts version = 0.1 device = jf-accounts diff --git a/jellyfin_accounts/web.py b/jellyfin_accounts/web.py index 44dced6..2ab8188 100644 --- a/jellyfin_accounts/web.py +++ b/jellyfin_accounts/web.py @@ -60,7 +60,7 @@ def inviteProxy(path): contactMessage=config['ui']['contact_message'], helpMessage=config['ui']['help_message'], successMessage=config['ui']['success_message'], - jfLink=config['jellyfin']['server'], + jfLink=config['jellyfin']['public_server'], validate=config.getboolean( 'password_validation', 'enabled'), diff --git a/jf-accounts b/jf-accounts index 179b42e..687a5cb 100755 --- a/jf-accounts +++ b/jf-accounts @@ -102,7 +102,7 @@ def default_css(): css = {} css = default_css() -if 'custom_css' in config['files']: +if 'custom_css' in config['files']: if config['files']['custom_css'] != '': try: shutil.copy(config['files']['custom_css'], @@ -113,8 +113,8 @@ if 'custom_css' in config['files']: css['crossorigin'] = '' except FileNotFoundError: log.error(f'Custom CSS {config["files"]["custom_css"]} not found, using default.') - - + + if ('email_html' not in config['password_resets'] or config['password_resets']['email_html'] == ''): log.debug('Using default password reset email HTML template') @@ -134,6 +134,9 @@ if ('email_text' not in config['invite_emails'] or log.debug('Using default invite email plaintext template') config['invite_emails']['email_text'] = str(local_dir / 'invite-email.txt') +if ('public_server' not in config['jellyfin'] or + config['jellyfin']['public_server'] == ''): + config['jellyfin']['public_server'] = config['jellyfin']['server'] if args.get_policy: import json @@ -163,13 +166,13 @@ else: def signal_handler(sig, frame): print('Quitting...') sys.exit(0) - + signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) app = Flask(__name__, root_path=str(local_dir)) app.config['DEBUG'] = config.getboolean('ui', 'debug') app.config['SECRET_KEY'] = secrets.token_urlsafe(16) - + if __name__ == '__main__': from waitress import serve if first_run: @@ -180,7 +183,7 @@ else: serve(app, host=host, port=port) - else: + else: import jellyfin_accounts.web_api import jellyfin_accounts.web host = config['ui']['host']