diff --git a/plugin/plugins/dynamix.unraid.net.plg b/plugin/plugins/dynamix.unraid.net.plg index c3051aff3..ea0f89a59 100755 --- a/plugin/plugins/dynamix.unraid.net.plg +++ b/plugin/plugins/dynamix.unraid.net.plg @@ -311,6 +311,7 @@ if [ -e /etc/rc.d/rc.unraid-api ]; then # restore stock files FILE=/usr/local/emhttp/plugins/dynamix/DisplaySettings.page && [[ -f "$FILE-" ]] && mv -f "$FILE-" "$FILE" FILE=/usr/local/emhttp/plugins/dynamix/Registration.page && [[ -f "$FILE-" ]] && mv -f "$FILE-" "$FILE" + FILE=/usr/local/emhttp/plugins/dynamix/include/.login.php && [[ -f "$FILE-" ]] && mv -f "$FILE-" "$FILE" FILE=/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php && [[ -f "$FILE-" ]] && mv -f "$FILE-" "$FILE" FILE=/usr/local/emhttp/plugins/dynamix/include/UpdateDNS.php && [[ -f "$FILE-" ]] && mv -f "$FILE-" "$FILE" FILE=/usr/local/emhttp/plugins/dynamix/include/Wrappers.php && [[ -f "$FILE-" ]] && mv -f "$FILE-" "$FILE" @@ -728,6 +729,17 @@ if [[ "${CHANGED}" == "yes" ]]; then fi fi +# Fix long standing bug in login script +FILE=/usr/local/emhttp/plugins/dynamix/include/.login.php +if test -f "${FILE}" && grep -q 'if (file_exists($file)) {' "${FILE}" &>/dev/null; then + cp "$FILE" "$FILE-" + # Find this text: if (file_exists($file)) { + OLD='if \(file_exists\(\$file\)\) \{' + # Replace with: if (file_exists($file) && filesize($file) > 0) { + NEW='if \(file_exists\(\$file\) \&\& filesize\(\$file\) > 0\) \{' + sed -Ei "s#${OLD}#${NEW}#" "${FILE}" +fi + # Prevent web component file downgrade if the webgui version is newer than the plugin version # Function to extract "ts" value from JSON file extract_ts() {