diff --git a/README.md b/README.md index c4966e8..1b9a55d 100644 --- a/README.md +++ b/README.md @@ -60,4 +60,5 @@ Field | Description URL | URL for your Jellyfin server (e.g. http://localhost:8096) API_KEY | API key for Jellyfin - can be created in `Dashboard > API Keys` ACCOUNT_TIME | Amount of time, in hours, accounts should exist before being deleted -SIMPLE_PASSWORDS | `true/false` : Whether or not to have simple dictionary word passwords for temporary accounts \ No newline at end of file +SIMPLE_PASSWORDS | `true/false` : Whether or not to have simple dictionary word passwords for temporary accounts +PUBLIC_URL | Public URL for your Jellyfin server. Used in the account creation message \ No newline at end of file diff --git a/code/cogs/newaccount.py b/code/cogs/newaccount.py index 54d53b6..8e17cda 100644 --- a/code/cogs/newaccount.py +++ b/code/cogs/newaccount.py @@ -5,7 +5,7 @@ import sqlite3 from utils.jellyfin_create import create_jellyfin_account from utils.config import ( - JELLYFIN_URL, + JELLYFIN_PUBLIC_URL, JELLYFIN_ENABLED, ACCOUNT_TIME, ) @@ -63,8 +63,8 @@ class NewAccount(commands.Cog): title="Jellyfin Account Information", description=( # fmt: off - "Here is your temporary account information.\n\n" - f"**Server URL:** `{JELLYFIN_URL}`\n" + "Here is your temporary account information.\n\n", + f"**Server URL:** `[{JELLYFIN_PUBLIC_URL}]({JELLYFIN_PUBLIC_URL})`\n" f"**Username:** `{response[0]}`\n" f"**Password:** `{response[1]}`\n\n" "Your account will be automatically deleted in" diff --git a/code/utils/config.py b/code/utils/config.py index c6d107e..1e7fdc6 100644 --- a/code/utils/config.py +++ b/code/utils/config.py @@ -44,6 +44,7 @@ JELLYFIN_URL = None JELLYFIN_HEADERS = None ACCOUNT_TIME = None SIMPLE_PASSWORDS = False +JELLYFIN_PUBLIC_URL = None schema = { "type": "object", @@ -89,8 +90,16 @@ schema = { "url": {"type": "string"}, "api_key": {"type": "string"}, "account_time": {"type": "integer"}, + "simple_passwords": {"type": "boolean"}, + "public_url": {"type": "string"}, }, - "required": ["url", "api_key", "account_time"], + "required": [ + "url", + "api_key", + "account_time", + "simple_passwords", + "public_url", + ], }, }, "required": ["bot_info", "radarr", "sonarr"], @@ -175,7 +184,7 @@ def validate_config(contents) -> None: Args: contents (str): The contents of the config file """ - global BOT_TOKEN, RADARR_HOST_URL, RADARR_ENABLED, RADARR_HEADERS, RADARR_ROOT_FOLDER_PATH, RADARR_QUALITY_PROFILE_ID, SONARR_ENABLED, SONARR_HOST_URL, SONARR_HEADERS, SONARR_ROOT_FOLDER_PATH, SONARR_QUALITY_PROFILE_ID, JELLYFIN_ENABLED, JELLYFIN_URL, JELLYFIN_HEADERS, ACCOUNT_TIME, SIMPLE_PASSWORDS + global BOT_TOKEN, RADARR_HOST_URL, RADARR_ENABLED, RADARR_HEADERS, RADARR_ROOT_FOLDER_PATH, RADARR_QUALITY_PROFILE_ID, SONARR_ENABLED, SONARR_HOST_URL, SONARR_HEADERS, SONARR_ROOT_FOLDER_PATH, SONARR_QUALITY_PROFILE_ID, JELLYFIN_ENABLED, JELLYFIN_URL, JELLYFIN_HEADERS, ACCOUNT_TIME, SIMPLE_PASSWORDS, JELLYFIN_PUBLIC_URL config = yaml.safe_load(contents) @@ -224,6 +233,7 @@ def validate_config(contents) -> None: } ACCOUNT_TIME = config["jellyfin"]["account_time"] SIMPLE_PASSWORDS = config["jellyfin"] + JELLYFIN_PUBLIC_URL = config["jellyfin"]["public_url"] JELLYFIN_ENABLED = True