From 30b41f82d6d112fb1b84fc6f97aed5fd3ac51974 Mon Sep 17 00:00:00 2001 From: Pat O'Brien <3484775+poblabs@users.noreply.github.com> Date: Thu, 3 Oct 2019 09:49:26 -0400 Subject: [PATCH 1/5] Update config port option name Using "PORT" failed for me. Using "MAILPORT" which matches the config.ini worked. --- python/mailserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mailserver.py b/python/mailserver.py index 4fad814..0d62489 100644 --- a/python/mailserver.py +++ b/python/mailserver.py @@ -124,7 +124,7 @@ if __name__ == '__main__': else : Config = ConfigParser.ConfigParser() Config.read("../config.ini") - port = int(Config.get("MAILSERVER","PORT")) + port = int(Config.get("MAILSERVER","MAILPORT")) From 53e6c8dba27250cd936a123dce07a6c786160971 Mon Sep 17 00:00:00 2001 From: Pat O'Brien <3484775+poblabs@users.noreply.github.com> Date: Thu, 3 Oct 2019 09:51:54 -0400 Subject: [PATCH 2/5] Reverse sort the list so new items are on top --- web/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/api.php b/web/api.php index d37e95b..bfbb9f2 100644 --- a/web/api.php +++ b/web/api.php @@ -74,7 +74,7 @@ switch($action) } } if(is_array($emaillist)) - ksort($emaillist); + krsort($emaillist); $data = (count($emaillist)?$emaillist:array()); } From 8e362bec245ecb2c8007d59b1843a0c43a6f862f Mon Sep 17 00:00:00 2001 From: Pat O'Brien <3484775+poblabs@users.noreply.github.com> Date: Thu, 3 Oct 2019 09:54:16 -0400 Subject: [PATCH 3/5] Do not add duplicate headers, and clear table for append Instead of appending the API results non-stop, we clear the table first so that it's fresh data loaded into the table. In addition, I added a class to the "To" `tr` and jQuery will look for this class. If it doesn't exist then it'll add that `tr`. Otherwise it won't continue to stack it. Fixes https://github.com/HaschekSolutions/opentrashmail/issues/2 --- web/js/opentrashmail.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/js/opentrashmail.js b/web/js/opentrashmail.js index 4694fdc..542009b 100644 --- a/web/js/opentrashmail.js +++ b/web/js/opentrashmail.js @@ -91,9 +91,14 @@ function updateEmailTable() { clearInterval(timer); admin = true; - $('#tableheader').children(':eq(1)').after('To'); + // Do not add the To header if one with the "to" class already exists + if ( $('#tableheader').children(':eq(2)').hasClass("to") === false ) + { + $('#tableheader').children(':eq(1)').after('To'); + } } + $("#emailtable tr").remove(); // Empty all from the table so we don't stack if(Object.keys(data.emails).length>0) for(em in data.emails) { From ad8deb45bb430162ec3f06081b56d4da12826bc1 Mon Sep 17 00:00:00 2001 From: Pat O'Brien <3484775+poblabs@users.noreply.github.com> Date: Thu, 3 Oct 2019 10:00:01 -0400 Subject: [PATCH 4/5] Do not clearInterval on admin page Keep the admin page using background reloads --- web/js/opentrashmail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/opentrashmail.js b/web/js/opentrashmail.js index 542009b..f528ea5 100644 --- a/web/js/opentrashmail.js +++ b/web/js/opentrashmail.js @@ -89,7 +89,7 @@ function updateEmailTable() var admin=false; if(data.type=="admin") { - clearInterval(timer); + //clearInterval(timer); admin = true; // Do not add the To header if one with the "to" class already exists if ( $('#tableheader').children(':eq(2)').hasClass("to") === false ) From 9f6151766b010f4fe8d6874ca6e6421bc834924f Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 3 Oct 2019 19:19:51 +0200 Subject: [PATCH 5/5] fixed docker start script --- docker/rootfs/start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/rootfs/start.sh b/docker/rootfs/start.sh index 9bfc2fc..d2850c7 100644 --- a/docker/rootfs/start.sh +++ b/docker/rootfs/start.sh @@ -34,7 +34,7 @@ if [ "$ADMIN" != "" ]; then fi echo "[MAILSERVER]" >> /var/www/opentrashmail/config.ini -echo "PORT=25" >> /var/www/opentrashmail/config.ini +echo "MAILPORT=25" >> /var/www/opentrashmail/config.ini cd /var/www/opentrashmail/python @@ -42,4 +42,4 @@ echo ' [+] Starting Mailserver' python mailserver.py #nohup python /var/www/opentrashmail/python/mailserver.py & -#tail -n 1 -f /var/log/nginx/*.log \ No newline at end of file +#tail -n 1 -f /var/log/nginx/*.log