10.6.0 compatability, cleanup, removed dep

Automatically fixes '*ProviderId' in user templates for versions of
Jellyfin >= 10.6.0. Removed unnecessary configparser dependency, the one
actually used is part of python. jf_api now has an info attribute.
This commit is contained in:
2020-06-27 15:38:51 +01:00
parent 24045034c8
commit 4809331502
4 changed files with 27 additions and 5 deletions

View File

@@ -66,6 +66,8 @@ if not success:
log.error("Could not authenticate after 3 tries.")
exit()
# Temporary fixes below.
def switchToIds():
try:
@@ -101,6 +103,22 @@ def switchToIds():
# Temporary, switches emails.json over from using Usernames to User IDs.
switchToIds()
from packaging import version
if (
version.parse(jf.info["Version"]) >= version.parse("10.6.0")
and bool(data_store.user_template) is not False
):
log.info("Updating user_template for Jellyfin >= 10.6.0")
data_store.user_template[
"AuthenticationProviderId"
] = "Jellyfin.Server.Implementations.Users.DefaultAuthenticationProvider"
data_store.user_template[
"PasswordResetProviderId"
] = "Jellyfin.Server.Implementations.Users.DefaultPasswordResetProvider"
if config.getboolean("password_validation", "enabled"):
validator = PasswordValidator(
config["password_validation"]["min_length"],