Custom login page themes


Recommended Posts

  • 1 month later...
  • 1 month later...
  • 2 weeks later...

Suddenly, login themes stopped working. Might this be related to some broken links? I seem to be able to access the .css on my browser (ie https://theme-park.dev/css/addons/unraid/login-page/retro-terminal/green.css) and I get the .css without problems. Same with the imported url https://theme-park.dev/css/addons/unraid/login-page/retro-terminal/retro-terminal-base.css

 

But when I run the script, I get the default login screen (yes, I hace DISABLE_THEME="false" in the script).

 

What I can't understand is that the theme login screen was working flawlessly for months, and suddenly it works no more. It's related to some problem on my server? (running v6.9.2)

Link to comment
4 minutes ago, Carpe_Diem said:

Suddenly, login themes stopped working. Might this be related to some broken links? I seem to be able to access the .css on my browser (ie https://theme-park.dev/css/addons/unraid/login-page/retro-terminal/green.css) and I get the .css without problems. Same with the imported url https://theme-park.dev/css/addons/unraid/login-page/retro-terminal/retro-terminal-base.css

 

But when I run the script, I get the default login screen (yes, I hace DISABLE_THEME="false" in the script).

 

What I can't understand is that the theme login screen was working flawlessly for months, and suddenly it works no more. It's related to some problem on my server? (running v6.9.2)

 

This was the reason: https://github.com/GilbN/theme.park/releases/tag/1.6.9

 

You can fix it with using the latest version of the script: https://github.com/GilbN/theme.park/blob/master/css/addons/unraid/login-page/custom_login.sh

  • Thanks 1
Link to comment
5 hours ago, GilbN said:

That solved the problem. Thanks!

 

I have now realized that there are community themes inspired on infinity gems, i need to try them! 😍

  • Like 1
Link to comment
  • 1 month later...

Should this still be working? I'm on 6.10.0-rc2, however after the theme didn't seem to apply, I went digging and noticed something interesting about the login page itself.

 

/usr/local/emhttp/login.php:

<?php
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";

// add translations
extract(parse_plugin_cfg('dynamix',true));

$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";

$var = parse_ini_file('state/var.ini');
$error = '';

if ($_SERVER['REQUEST_URI'] == '/logout') {
    // User Logout
    if (isset($_COOKIE[session_name()])) {
        session_start();
        unset($_SESSION['unraid_login']);
        unset($_SESSION['unraid_user']);
        // delete session file
        session_destroy();
        // delete the session cookie
        $params = session_get_cookie_params();
        setcookie(session_name(), '', 0, '/', $params['domain'], $params['secure'], isset($params['httponly']));
        syslog(LOG_INFO, "Successfull logout user {$_SERVER['USER']} from {$_SERVER['REMOTE_ADDR']}");
    }
    $error = _('Successfully logged out');
}

$result = exec( "/usr/bin/passwd --status root");
if (($result === false) || (substr($result, 0, 6) !== "root P"))
  include "$docroot/webGui/include/.set-password.php";
else
  include "$docroot/webGui/include/.login.php";
?>

 

See how at the bottom it it's including ".login.php"? Well, it turns out that this is the file that actually includes all the HTML/CSS/JS, however I'm not sure when this change was made, especially considering others are on the same Unraid version, yet for some reason it's working for them.

 

In the meantime I'll see if I can just substitute the paths for the new/different login page, as I would assume the structure/styling of the login page hasn't changed much, if at all.

Link to comment

UPDATE: It worked!

 

Here's the revised script, where I simply replaced all the hardcoded paths to login.php with an environment variable, then pointed said environment variable to the new/appropriate login page path.

 

#!/bin/bash

TYPE="retro-terminal"
THEME="green.css"
DOMAIN="theme-park.dev" #if you update the domain after the script has been run, You must disable and re enable JS or the whole theme.  
ADD_JS="true"
JS="custom_text_header.js"
DISABLE_THEME="false"
#LOGIN_PAGE="/usr/local/emhttp/login.php"
LOGIN_PAGE="/usr/local/emhttp/webGui/include/.login.php"

echo -e "Variables set:\\n\
THEME         = ${THEME}\\n\
DOMAIN        = ${DOMAIN}\\n\
ADD_JS        = ${ADD_JS}\\n\
JS            = ${JS}\\n\
DISABLE_THEME = ${DISABLE_THEME}\\n"

# Restore login.php
if [ ${DISABLE_THEME} = "true" ]; then
  echo "Restoring backup of login.php" 
  cp -p ${LOGIN_PAGE}.backup ${LOGIN_PAGE}
  exit 0
fi

# Backup login page if needed.
if [ ! -f ${LOGIN_PAGE}.backup ]; then
  echo "Creating backup of login.php" 
  cp -p ${LOGIN_PAGE} ${LOGIN_PAGE}.backup
fi

# Use correct domain style
case ${DOMAIN} in
  *"github.io"*)
  echo "Switching to github.io URL style"
    DOMAIN="${DOMAIN}\/theme.park"
    ;;
esac

# Adding stylesheets
if ! grep -q ${DOMAIN} ${LOGIN_PAGE}; then
  echo "Adding stylesheet"
  sed -i -e "\@<style>@i\    <link rel='stylesheet' href='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/${THEME}'>" ${LOGIN_PAGE}
  echo 'Stylesheet set to' ${THEME}
fi

# Adding/Removing javascript
if [ ${ADD_JS} = "true" ]; then
  if ! grep -q ${JS} ${LOGIN_PAGE}; then
    if grep -q "<script type='text/javascript' src='https://${DOMAIN}/css/addons/unraid/login-page/" ${LOGIN_PAGE}; then
      echo "Replacing Javascript"
      sed -i "/<script type='text\/javascript' src='https:\/\/${DOMAIN}\/css\/addons\/unraid\/login-page/c <script type='text/javascript' src='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/js/${JS}'></script>" ${LOGIN_PAGE}
    else
      echo "Adding javascript"
      sed -i -e "\@</body>@i\    <script type='text/javascript' src='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/js/${JS}'></script>" ${LOGIN_PAGE}
    fi
  fi
else
  if grep -q ${JS} ${LOGIN_PAGE}; then
    echo "Removing javascript.."
    sed -i "/<script type='text\/javascript' src='https:\/\/${DOMAIN}\/css\/addons\/unraid\/login-page/d" ${LOGIN_PAGE}
  fi
fi

# Changing stylesheet
if ! grep -q ${TYPE}"/"${THEME} ${LOGIN_PAGE}; then
  echo "Changing existing custom stylesheet.." 
  sed -i "/<link rel='stylesheet' href='https:\/\/${DOMAIN}\/css\/addons\/unraid\/login-page/c <link rel='stylesheet' href='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/${THEME}'>" ${LOGIN_PAGE}
  echo 'Stylesheet set to' ${THEME}
fi
  • Like 1
Link to comment
  • 1 month later...
2 hours ago, jawattus said:

Thanks @GilbN and @Didstopia. I use a fork of the script and before I only needed to change de domain to thyselblaso.github.io. But this doesn't work anymore. Do I need to change other things in the script to let this work?

When you run the script does it say "Switching to github.io URL style"?

Link to comment
13 minutes ago, GilbN said:

When you run the script does it say "Switching to github.io URL style"?

 

No it only say this when I start the script in the background:

Script location: /tmp/user.scripts/tmpScripts/Custom_unraid_loginscreen/script
Now starting the script in the background


This is my script:

#!/bin/bash
TYPE="retro-terminal"
THEME="white.css"
DOMAIN="thijselblaso.github.io" # If you update the domain after the script has been run, You must disable and re enable JS or the whole theme.  
ADD_JS="false"
JS="custom_text_header.js"
DISABLE_THEME="false"

echo -e "Variables set:\\n\
THEME         = ${THEME}\\n\
DOMAIN        = ${DOMAIN}\\n\
ADD_JS        = ${ADD_JS}\\n\
JS            = ${JS}\\n\
DISABLE_THEME = ${DISABLE_THEME}\\n"

IFS='"'
set $(cat /etc/unraid-version)
UNRAID_VERSION="$2"
IFS=$' \t\n'
LOGIN_PAGE="/usr/local/emhttp/login.php"
# Changing file path to login.php if version >= 6.10
if [[ "${UNRAID_VERSION}" =~ ^6.10.* ]]; then
echo "Unraid version: ${UNRAID_VERSION}, changing path to login page"
LOGIN_PAGE="/usr/local/emhttp/webGui/include/.login.php"
fi

# Restore login.php
if [ ${DISABLE_THEME} = "true" ]; then
  echo "Restoring backup of login.php" 
  cp -p ${LOGIN_PAGE}.backup ${LOGIN_PAGE}
  exit 0
fi

# Backup login page if needed.
if [ ! -f ${LOGIN_PAGE}.backup ]; then
  echo "Creating backup of login.php" 
  cp -p ${LOGIN_PAGE} ${LOGIN_PAGE}.backup
fi

# Use correct domain style
case ${DOMAIN} in
  *"github.io"*)
  echo "Switching to github.io URL style"
    DOMAIN="${DOMAIN}\/theme.park"
    ;;
esac

# Adding stylesheets
if ! grep -q ${DOMAIN} ${LOGIN_PAGE}; then
  echo "Adding stylesheet"
  sed -i -e "\@<style>@i\    <link rel='stylesheet' href='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/${THEME}'>" ${LOGIN_PAGE}
  echo 'Stylesheet set to' ${THEME}
fi

# Adding/Removing javascript
if [ ${ADD_JS} = "true" ]; then
  if ! grep -q ${JS} ${LOGIN_PAGE}; then
    if grep -q "<script type='text/javascript' src='https://${DOMAIN}/css/addons/unraid/login-page/" ${LOGIN_PAGE}; then
      echo "Replacing Javascript"
      sed -i "/<script type='text\/javascript' src='https:\/\/${DOMAIN}\/css\/addons\/unraid\/login-page/c <script type='text/javascript' src='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/js/${JS}'></script>" ${LOGIN_PAGE}
    else
      echo "Adding javascript"
      sed -i -e "\@</body>@i\    <script type='text/javascript' src='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/js/${JS}'></script>" ${LOGIN_PAGE}
    fi
  fi
else
  if grep -q ${JS} ${LOGIN_PAGE}; then
    echo "Removing javascript.."
    sed -i "/<script type='text\/javascript' src='https:\/\/${DOMAIN}\/css\/addons\/unraid\/login-page/d" ${LOGIN_PAGE}
  fi
fi

# Changing stylesheet
if ! grep -q ${TYPE}"/"${THEME} ${LOGIN_PAGE}; then
  echo "Changing existing custom stylesheet.." 
  sed -i "/<link rel='stylesheet' href='https:\/\/${DOMAIN}\/css\/addons\/unraid\/login-page/c <link rel='stylesheet' href='https://${DOMAIN}/css/addons/unraid/login-page/${TYPE}/${THEME}'>" ${LOGIN_PAGE}
  echo 'Stylesheet set to' ${THEME}
fi


This is my white.css that I use:

/*_____________________WHITE_THEME______________________*/
/* --body-before:#00ff771a; /* This is the background that creates the crt lines, background uses a transparency of 10% SET TO NONE TO REMOVE CRT EFFECT */
/* --body-after: #00ff7733; /* This is the background that creates the crt lines, background uses a transparency of 20% SET TO NONE TO REMOVE CRT EFFECT */
/* --body-animation: flicker; This is the background that flickers. SET TO NONE TO REMOVE THE FLICKER ANIMATION! */
/* --custom-text-header-animation: textflicker; /* SET TO NONE TO REMOVE THE FLICKER ANIMATION! */

@import url(https://thijselblaso.github.io/theme.park.edit/CSS/addons/unraid/login-page/retro-terminal/retro-terminal-base.css);
:root {
--main-bg-color:black;
--body-before:#70d7f61a;
--body-after: none;
--body-animation: none;
--logo: url(https://i.imgur.com/rLGePdW.png) center no-repeat;
--text-color: #ffffff;
--input-color: #ffffff;
--link-color: #ffffff;
--link-color-hover: #e68a00;
--case-color: #ffffff;
--button-text-color: #ffffff;
--button-text-color-hover: #000;
--button-color: #ffffff;
--button-color-hover: #4caf50;
--selection-color: #e68a00;
--custom-text-header:#ffffff;
--custom-text-header-shadow:#ffffff;
--custom-text-header-animation: none;
--input-font: 'Share Tech Mono', monospace;
--text-font: 'Share Tech Mono', monospace;
--loginbox-background-color: transparent;
--text-shadow: 0 0 8px;
--text-shadow-color: #000000;
--box-shadow: 0 0 15px;
}

 

  • Like 1
Link to comment
2 hours ago, GilbN said:

or change this part to reflect your name change 

 

# Use correct domain style
case ${DOMAIN} in
  *"github.io"*)
  echo "Switching to github.io URL style"
    DOMAIN="${DOMAIN}\/theme.park"
    ;;
esac

Thanks for your help! I changed "DOMAIN="${DOMAIN}\/theme.park" to "DOMAIN="${DOMAIN}\/theme.park.edit"

 

This is what I see when I run the script:

Script location: /tmp/user.scripts/tmpScripts/Custom_unraid_loginscreen/script
Note that closing this window will abort the execution of this script
Variables set:
THEME = white.css
DOMAIN = thijselblaso.github.io
ADD_JS = false
JS = custom_text_header.js
DISABLE_THEME = false

Unraid version: 6.10.0-rc4, changing path to login page
Switching to github.io URL style
Adding stylesheet
Stylesheet set to white.css

 

but the login screen is not changed yet

Link to comment
4 minutes ago, jawattus said:

Thanks for your help! I changed "DOMAIN="${DOMAIN}\/theme.park" to "DOMAIN="${DOMAIN}\/theme.park.edit"

 

This is what I see when I run the script:

Script location: /tmp/user.scripts/tmpScripts/Custom_unraid_loginscreen/script
Note that closing this window will abort the execution of this script
Variables set:
THEME = white.css
DOMAIN = thijselblaso.github.io
ADD_JS = false
JS = custom_text_header.js
DISABLE_THEME = false

Unraid version: 6.10.0-rc4, changing path to login page
Switching to github.io URL style
Adding stylesheet
Stylesheet set to white.css
 

 

but the login screen is not changed yet

check your browser console for any errors

Link to comment
20 minutes ago, GilbN said:

Pretty sure your forked repo is out of date using the script.  You are 440 commits behind. 

okay I will delete the fork and make a new fork and I will not change the name. And I will only change the domain to "DOMAIN = thijselblaso.github.io" in the script. What is the right format for the domain? "DOMAIN = thijselblaso.github.io" is this correct?

Link to comment
22 hours ago, jawattus said:

okay I will delete the fork and make a new fork and I will not change the name. And I will only change the domain to "DOMAIN = thijselblaso.github.io" in the script. What is the right format for the domain? "DOMAIN = thijselblaso.github.io" is this correct?

 

You can just update the repo through github btw. And yeah that works. 

 raw

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.