diff --git a/index.html b/index.html
index f5e43d7..12dc572 100644
--- a/index.html
+++ b/index.html
@@ -59,6 +59,7 @@
+
diff --git a/resources/js/ajax.js b/resources/js/ajax.js
index 99c19b1..53618fa 100644
--- a/resources/js/ajax.js
+++ b/resources/js/ajax.js
@@ -14,6 +14,8 @@ if(typeof(EventSource) !== "undefined") {
function getDir(query) {
var formUlPth = document.getElementById("DIRPATHUL");
+ var mergeType = document.getElementById("MergeType");
+ var passwd = undefined;
var path = "";
var cookies = "";
var dirCookie = "";
@@ -46,19 +48,27 @@ function getDir(query) {
}
// Create path from array of items
- for (pathNode of pathNodes) {
- path += pathNode;
+ for (pathNode of pathNodes) { path += pathNode; }
+
+ try {
+ passwd = document.getElementById("PASSWD").value;
+ } catch (e) {
+ passwd = "";
}
- formUlPth.value = path; // Setup upload path for form
+ // Setup upload path for form and make a cookie for persistence during browser session....
+ formUlPth.value = path;
path = "dirQuery=" + encodeURIComponent(path);
+ document.cookie = path + "; expires=Sun, 31 Dec 2034 12:00:00 UTC";
+ path +="&mergeType=" + mergeType.checked
+ + "Here&passwd=" + passwd;
+
process(path);
}
// Get dir info...
function process(path) {
- var mergeType = document.getElementById("MergeType");
- var xhttp = new XMLHttpRequest(); // Create the xhttp object
+ var xhttp = new XMLHttpRequest(); // Create the xhttp object
// This is actually run after open and send are done
xhttp.onreadystatechange = function() {
@@ -76,8 +86,5 @@ function process(path) {
xhttp.open("POST", "resources/php/getDirList.php", true); // Open the connection
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.overrideMimeType('application/xml'); // Force return to be XML
- xhttp.send(path + "&mergeType=" + mergeType.checked + "Here"); // Start the process
-
- // Use a cookie for persistence during browser session....
- document.cookie = path + "; expires=Sun, 31 Dec 2034 12:00:00 UTC";
+ xhttp.send(path); // Start the process
}
diff --git a/resources/js/passwordFieldInsert.js b/resources/js/passwordFieldInsert.js
new file mode 100644
index 0000000..5ba436a
--- /dev/null
+++ b/resources/js/passwordFieldInsert.js
@@ -0,0 +1,26 @@
+function createPassField(returnData) {
+ var msg = returnData.getElementsByTagName('MESSAGE')[0].innerHTML;
+ console.log("No PATH_HEAD tag in XML. Checking for error MESSAGE tag.");
+ console.log("Message: " + msg);
+
+ insertArea.innerHTML = "";
+ var passField = document.createElement("INPUT");
+ var submitBttn = document.createElement("BUTTON");
+ passField.id = "PASSWD";
+ passField.type = "password";
+ passField.placeholder = "Password...";
+ submitBttn.innerHTML = "Submit";
+
+ passField.onkeyup = (eve) => {
+ if (eve.key == "Enter") {
+ getDir("./");
+ }
+ };
+
+ submitBttn.onclick = () => {
+ getDir("./");
+ };
+
+ insertArea.appendChild(passField);
+ insertArea.appendChild(submitBttn);
+}
diff --git a/resources/js/xmlParser.js b/resources/js/xmlParser.js
index 6c12954..3b77af5 100644
--- a/resources/js/xmlParser.js
+++ b/resources/js/xmlParser.js
@@ -1,7 +1,13 @@
const insertArea = document.getElementById('dynDiv');
async function updateHTMLDirList(returnData) {
- var dirPath = returnData.getElementsByTagName('PATH_HEAD')[0].innerHTML;
+ try {
+ var dirPath = returnData.getElementsByTagName('PATH_HEAD')[0].innerHTML;
+ } catch (e) {
+ createPassField(returnData);
+ return;
+ }
+
var dirs = returnData.getElementsByTagName('DIR');
var videos = returnData.getElementsByTagName('VID_FILE');
var images = returnData.getElementsByTagName('IMG_FILE');
diff --git a/resources/php/config.php b/resources/php/config.php
index e72e5c7..8d45570 100644
--- a/resources/php/config.php
+++ b/resources/php/config.php
@@ -1,12 +1,14 @@
diff --git a/resources/php/filesystemActions.php b/resources/php/filesystemActions.php
index 605f700..b088366 100644
--- a/resources/php/filesystemActions.php
+++ b/resources/php/filesystemActions.php
@@ -102,7 +102,7 @@ function openFile($FILE) {
$EXTNSN = strtolower(pathinfo($FILE, PATHINFO_EXTENSION));
if (preg_match('(mkv|avi|flv|mov|m4v|mpg|wmv|mpeg|mp4|webm)', $EXTNSN) === 1) {
- shell_exec($MEDIAPLAYER . $MPLAYER_WH . "\"" . $FILE . "\" > /dev/null &");
+ shell_exec($MEDIAPLAYER . "\"" . $FILE . "\" > /dev/null &");
} else if (preg_match('(png|jpg|jpeg|gif)', $EXTNSN) === 1) {
shell_exec($IMGVIEWER . ' "' . $FILE . '" > /dev/null &');
} else if (preg_match('(psf|mp3|ogg|flac)', $EXTNSN) === 1) {
diff --git a/resources/php/getDirList.php b/resources/php/getDirList.php
index a7ee461..4136c92 100644
--- a/resources/php/getDirList.php
+++ b/resources/php/getDirList.php
@@ -3,16 +3,24 @@
session_start();
// Start of retrieving dir data
-function startListing($NEWPATH, $MERGESEASSONS) {
+function startListing($NEWPATH, $MERGESEASSONS, $PASSWD) {
if (is_dir($NEWPATH)) {
- $GeneratedXML = "