Add public_url field for Jellyfin acc. creation
Some checks are pending
Create and publish a Docker image / build-and-push-image (push) Waiting to run

This commit is contained in:
Parker M. 2025-01-20 21:29:36 -06:00
parent a7a9a32984
commit 87a0bec85d
Signed by: parker
GPG Key ID: 505ED36FC12B5D5E
3 changed files with 17 additions and 6 deletions

View File

@ -60,4 +60,5 @@ Field | Description
URL | URL for your Jellyfin server (e.g. http://localhost:8096) URL | URL for your Jellyfin server (e.g. http://localhost:8096)
API_KEY | API key for Jellyfin - can be created in `Dashboard > API Keys` 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 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 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

View File

@ -5,7 +5,7 @@ import sqlite3
from utils.jellyfin_create import create_jellyfin_account from utils.jellyfin_create import create_jellyfin_account
from utils.config import ( from utils.config import (
JELLYFIN_URL, JELLYFIN_PUBLIC_URL,
JELLYFIN_ENABLED, JELLYFIN_ENABLED,
ACCOUNT_TIME, ACCOUNT_TIME,
) )
@ -63,8 +63,8 @@ class NewAccount(commands.Cog):
title="Jellyfin Account Information", title="Jellyfin Account Information",
description=( description=(
# fmt: off # fmt: off
"Here is your temporary account information.\n\n" "Here is your temporary account information.\n\n",
f"**Server URL:** `{JELLYFIN_URL}`\n" f"**Server URL:** `[{JELLYFIN_PUBLIC_URL}]({JELLYFIN_PUBLIC_URL})`\n"
f"**Username:** `{response[0]}`\n" f"**Username:** `{response[0]}`\n"
f"**Password:** `{response[1]}`\n\n" f"**Password:** `{response[1]}`\n\n"
"Your account will be automatically deleted in" "Your account will be automatically deleted in"

View File

@ -44,6 +44,7 @@ JELLYFIN_URL = None
JELLYFIN_HEADERS = None JELLYFIN_HEADERS = None
ACCOUNT_TIME = None ACCOUNT_TIME = None
SIMPLE_PASSWORDS = False SIMPLE_PASSWORDS = False
JELLYFIN_PUBLIC_URL = None
schema = { schema = {
"type": "object", "type": "object",
@ -89,8 +90,16 @@ schema = {
"url": {"type": "string"}, "url": {"type": "string"},
"api_key": {"type": "string"}, "api_key": {"type": "string"},
"account_time": {"type": "integer"}, "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"], "required": ["bot_info", "radarr", "sonarr"],
@ -175,7 +184,7 @@ def validate_config(contents) -> None:
Args: Args:
contents (str): The contents of the config file 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) config = yaml.safe_load(contents)
@ -224,6 +233,7 @@ def validate_config(contents) -> None:
} }
ACCOUNT_TIME = config["jellyfin"]["account_time"] ACCOUNT_TIME = config["jellyfin"]["account_time"]
SIMPLE_PASSWORDS = config["jellyfin"] SIMPLE_PASSWORDS = config["jellyfin"]
JELLYFIN_PUBLIC_URL = config["jellyfin"]["public_url"]
JELLYFIN_ENABLED = True JELLYFIN_ENABLED = True