Add LDAP
This commit is contained in:
@@ -89,12 +89,7 @@ in {
|
|||||||
sleep 20
|
sleep 20
|
||||||
WIZARD_COMPLETE=$(${pkgs.curl}/bin/curl -sSf "$JELLYFIN_URL/System/Info/Public" 2>/dev/null | \
|
WIZARD_COMPLETE=$(${pkgs.curl}/bin/curl -sSf "$JELLYFIN_URL/System/Info/Public" 2>/dev/null | \
|
||||||
${pkgs.jq}/bin/jq -r '.StartupWizardCompleted // false')
|
${pkgs.jq}/bin/jq -r '.StartupWizardCompleted // false')
|
||||||
if [ "$WIZARD_COMPLETE" = "true" ]; then
|
if [ "$WIZARD_COMPLETE" = "false" ]; then
|
||||||
echo "Jellyfin wizard already completed. Exiting cleanly."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
#USE CONFIGURATION ENDPOINT
|
|
||||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Startup/Configuration" \
|
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Startup/Configuration" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"ServerName":"Flix","UICulture":"en-US","MetadataCountryCode":"US","PreferredMetadataLanguage":"en"}'; then
|
-d '{"ServerName":"Flix","UICulture":"en-US","MetadataCountryCode":"US","PreferredMetadataLanguage":"en"}'; then
|
||||||
@@ -102,7 +97,6 @@ in {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#USE AUTH ENDPOINT
|
|
||||||
SETUP_USER_PAYLOAD=$(${pkgs.jq}/bin/jq -n \
|
SETUP_USER_PAYLOAD=$(${pkgs.jq}/bin/jq -n \
|
||||||
--arg name "$DEFAULT_ADMIN_USERNAME" \
|
--arg name "$DEFAULT_ADMIN_USERNAME" \
|
||||||
--arg pass "$DEFAULT_ADMIN_PASSWORD" \
|
--arg pass "$DEFAULT_ADMIN_PASSWORD" \
|
||||||
@@ -121,7 +115,6 @@ in {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable remote access, disable UPnP auto-mapping
|
|
||||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Startup/RemoteAccess" \
|
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Startup/RemoteAccess" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"EnableRemoteAccess":true,"EnableAutomaticPortMapping":false}'; then
|
-d '{"EnableRemoteAccess":true,"EnableAutomaticPortMapping":false}'; then
|
||||||
@@ -129,13 +122,34 @@ in {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Complete the wizard
|
|
||||||
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''$JELLYFIN_URL/Startup/Complete"; then
|
if ! ${pkgs.curl}/bin/curl -sSf -X POST "''$JELLYFIN_URL/Startup/Complete"; then
|
||||||
echo "ERROR: Failed to complete wizard."
|
echo "ERROR: Failed to complete wizard."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Jellyfin initialization successfully completed!"
|
echo "Jellyfin initialization successfully completed!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
JELLYFIN_TOKEN=$(${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Users/AuthenticateByName" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: MediaBrowser Client=\"Bash Script\", Device=\"Server Terminal\", DeviceId=\"script-12345\", Version=\"1.0.0\"" \
|
||||||
|
-d "{\"Username\": \"$DEFAULT_ADMIN_USERNAME\", \"Pw\": \"$DEFAULT_ADMIN_PASSWORD\"}" \
|
||||||
|
|
||||||
|
| jq -r '.AccessToken')
|
||||||
|
|
||||||
|
# Verify we got a token
|
||||||
|
if [ "$JELLYFIN_TOKEN" = "null" ] || [ -z "$JELLYFIN_TOKEN" ]; then
|
||||||
|
echo "ERROR: Authentication failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! ${pkgs.curl}/bin/curl -sSf -X POST "$JELLYFIN_URL/Packages/Installed/LDAP%20Authentication?assemblyGuid=958aad6637844d2ab89aa7b6fab6e25c" \
|
||||||
|
-H "Authorization: MediaBrowser Token=\"$JELLYFIN_TOKEN\"" \
|
||||||
|
-H "Content-Length: 0"
|
||||||
|
echo "ERROR: LDAP Plugin Setup Failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Completed Setup"
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user