From cf1cc24e33ec0410f79be808c52507844ac4e18e Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Fri, 21 Apr 2023 12:26:50 +0200 Subject: [PATCH 1/8] [Web] Fix temporary email aliases sorting --- data/web/js/build/013-mailcow.js | 10 ++++++++++ data/web/js/site/debug.js | 10 ---------- data/web/js/site/user.js | 25 +++++++++++++++++++------ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/data/web/js/build/013-mailcow.js b/data/web/js/build/013-mailcow.js index e060a2d0..e659915b 100644 --- a/data/web/js/build/013-mailcow.js +++ b/data/web/js/build/013-mailcow.js @@ -1,3 +1,13 @@ +const LOCALE = undefined; +const DATETIME_FORMAT = { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit" +}; + $(document).ready(function() { // mailcow alert box generator window.mailcow_alert_box = function(message, type) { diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js index 55b6660b..4e4c5692 100644 --- a/data/web/js/site/debug.js +++ b/data/web/js/site/debug.js @@ -1,13 +1,3 @@ -const LOCALE = undefined; -const DATETIME_FORMAT = { - year: "numeric", - month: "2-digit", - day: "2-digit", - hour: "2-digit", - minute: "2-digit", - second: "2-digit" -}; - $(document).ready(function() { // Parse seconds ago to date // Get "now" timestamp diff --git a/data/web/js/site/user.js b/data/web/js/site/user.js index b2139829..2227e0b0 100644 --- a/data/web/js/site/user.js +++ b/data/web/js/site/user.js @@ -127,6 +127,20 @@ jQuery(function($){ } } + + function createSortableDate(td, cellData, date_string = false) { + if (date_string) + var date = new Date(cellData); + else + var date = new Date(cellData ? cellData * 1000 : 0); + + var timestamp = date.getTime(); + $(td).attr({ + "data-order": timestamp, + "data-sort": timestamp + }); + $(td).html(date.toLocaleDateString(LOCALE, DATETIME_FORMAT)); + } function draw_tla_table() { // just recalc width if instance already exists if ($.fn.DataTable.isDataTable('#tla_table') ) { @@ -144,6 +158,7 @@ jQuery(function($){ "tr" + "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", language: lang_datatables, + order: [[4, 'desc']], ajax: { type: "GET", url: "/api/v1/get/time_limited_aliases", @@ -191,18 +206,16 @@ jQuery(function($){ title: lang.alias_valid_until, data: 'validity', defaultContent: '', - render: function (data, type) { - var date = new Date(data ? data * 1000 : 0); - return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"}); + createdCell: function(td, cellData) { + createSortableDate(td, cellData) } }, { title: lang.created_on, data: 'created', defaultContent: '', - render: function (data, type) { - var date = new Date(data.replace(/-/g, "/")); - return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"}); + createdCell: function(td, cellData) { + createSortableDate(td, cellData, true) } }, { From 6e79c486404e423425097d4506b956265f23eb7d Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Fri, 21 Apr 2023 16:15:16 +0200 Subject: [PATCH 2/8] [Dockerapi] Fix typo in dockerapi sieve print --- data/Dockerfiles/dockerapi/dockerapi.py | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/Dockerfiles/dockerapi/dockerapi.py b/data/Dockerfiles/dockerapi/dockerapi.py index 1ab651b5..dc894549 100644 --- a/data/Dockerfiles/dockerapi/dockerapi.py +++ b/data/Dockerfiles/dockerapi/dockerapi.py @@ -370,7 +370,7 @@ class DockerUtils: return exec_run_handler('utf8_text_only', sieve_return) # api call: container_post - post_action: exec - cmd: sieve - task: print def container_post__exec__sieve__print(self, container_id, request_json): - if 'username' in request.json and 'script_name' in request_json: + if 'username' in request_json and 'script_name' in request_json: for container in self.docker_client.containers.list(filters={"id": container_id}): cmd = ["/bin/bash", "-c", "/usr/bin/doveadm sieve get -u '" + request_json['username'].replace("'", "'\\''") + "' '" + request_json['script_name'].replace("'", "'\\''") + "'"] sieve_return = container.exec_run(cmd) diff --git a/docker-compose.yml b/docker-compose.yml index 23bd308f..2585cda4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -510,7 +510,7 @@ services: - watchdog dockerapi-mailcow: - image: mailcow/dockerapi:2.03 + image: mailcow/dockerapi:2.04 security_opt: - label=disable restart: always From c2bcc4e086a20097f2956522877d09ab219c3dce Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Fri, 21 Apr 2023 17:03:40 +0200 Subject: [PATCH 3/8] [Web] hide user tabs if acl is missing --- data/web/templates/user.twig | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/data/web/templates/user.twig b/data/web/templates/user.twig index 22cc00d0..5536abe4 100644 --- a/data/web/templates/user.twig +++ b/data/web/templates/user.twig @@ -12,11 +12,21 @@
  • + {% if acl.spam_alias == 1 %} + {% endif %} + {% if acl.spam_score == 1 %} + {% endif %} + {% if acl.syncjobs == 1 %} + {% endif %} + {% if acl.app_passwds == 1 %} + {% endif %} + {% if acl.pushover == 1 %} + {% endif %}
    @@ -25,11 +35,11 @@ {% include 'user/tab-user-auth.twig' %} {% include 'user/tab-user-details.twig' %} {% include 'user/tab-user-settings.twig' %} - {% include 'user/SpamAliases.twig' %} - {% include 'user/Spamfilter.twig' %} - {% include 'user/Syncjobs.twig' %} - {% include 'user/AppPasswds.twig' %} - {% include 'user/Pushover.twig' %} + {% if acl.spam_alias == 1 %}{% include 'user/SpamAliases.twig' %}{% endif %} + {% if acl.spam_score == 1 %}{% include 'user/Spamfilter.twig' %}{% endif %} + {% if acl.syncjobs == 1 %}{% include 'user/Syncjobs.twig' %}{% endif %} + {% if acl.app_passwds == 1 %}{% include 'user/AppPasswds.twig' %}{% endif %} + {% if acl.pushover == 1 %}{% include 'user/Pushover.twig' %}{% endif %}
    From f3322c05772c8192160628c6e7a5e6477e87f7e6 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 21 Apr 2023 19:43:20 +0200 Subject: [PATCH 4/8] Add IP Connect Inc --- data/conf/rspamd/custom/bad_asn.map | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/conf/rspamd/custom/bad_asn.map b/data/conf/rspamd/custom/bad_asn.map index 1858c55f..a8d49cf3 100644 --- a/data/conf/rspamd/custom/bad_asn.map +++ b/data/conf/rspamd/custom/bad_asn.map @@ -27,4 +27,5 @@ #197518 2 #Rackmarkt SL, Spain #197695 2 #Domain names registrar REG.RU Ltd, Russia #198068 2 #P.A.G.M. OU, Estonia -#201942 5 #Soltia Consulting SL, Spain \ No newline at end of file +#201942 5 #Soltia Consulting SL, Spain +#213373 4 #IP Connect Inc \ No newline at end of file From 0372a2150d438ad71c1acc853db2a8556486ee82 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Fri, 21 Apr 2023 20:14:43 +0200 Subject: [PATCH 5/8] [Web] fix rspamd table on sm devices --- data/web/js/site/debug.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js index 55b6660b..542ba185 100644 --- a/data/web/js/site/debug.js +++ b/data/web/js/site/debug.js @@ -829,13 +829,10 @@ jQuery(function($){ url: '/api/v1/get/rspamd/actions', async: true, success: function(data){ - console.log(data); - var total = 0; $(data).map(function(){total += this[1];}); var labels = $.makeArray($(data).map(function(){return this[0] + ' ' + Math.round(this[1]/total * 100) + '%';})); var values = $.makeArray($(data).map(function(){return this[1];})); - console.log(values); var graphdata = { labels: labels, @@ -951,12 +948,15 @@ jQuery(function($){ title: 'Score', data: 'score', defaultContent: '', + class: 'text-nowrap', createdCell: function(td, cellData) { $(td).attr({ "data-order": cellData.sortBy, "data-sort": cellData.sortBy }); - $(td).html(cellData.value); + }, + render: function (data) { + return data.value; } }, { From fd203abd473d15c6b0d178ba4711b4a12c1a0fb3 Mon Sep 17 00:00:00 2001 From: goodygh Date: Tue, 25 Apr 2023 22:11:04 +0200 Subject: [PATCH 6/8] Fix typo in mobileconfig redirect --- data/web/inc/triggers.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/web/inc/triggers.inc.php b/data/web/inc/triggers.inc.php index fde1507f..c40453a2 100644 --- a/data/web/inc/triggers.inc.php +++ b/data/web/inc/triggers.inc.php @@ -63,7 +63,7 @@ if (isset($_POST["login_user"]) && isset($_POST["pass_user"])) { unset($_SESSION['index_query_string']); if (in_array('mobileconfig', $http_parameters)) { if (in_array('only_email', $http_parameters)) { - header("Location: /mobileconfig.php?email_only"); + header("Location: /mobileconfig.php?only_email"); die(); } header("Location: /mobileconfig.php"); From fe4a418af45fd7e82df7facfb9cdfb71efd17fb3 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Thu, 27 Apr 2023 10:45:11 +0200 Subject: [PATCH 7/8] [Web] fix rspamd table scan_time on sm devices --- data/web/js/site/debug.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/web/js/site/debug.js b/data/web/js/site/debug.js index 542ba185..0b42e2c7 100644 --- a/data/web/js/site/debug.js +++ b/data/web/js/site/debug.js @@ -979,7 +979,9 @@ jQuery(function($){ "data-order": cellData.sortBy, "data-sort": cellData.sortBy }); - $(td).html(cellData.value); + }, + render: function (data) { + return data.value; } }, { From aabcd1053969e7bd3601c0dd7e7aa3e5b333cb97 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Wed, 3 May 2023 09:59:49 +0200 Subject: [PATCH 8/8] [Web] fix bcc localdest selectpicker --- data/web/js/site/mailbox.js | 56 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index d7fca848..3ddeea94 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -1458,30 +1458,37 @@ jQuery(function($){ } function draw_bcc_table() { $.get("/api/v1/get/bcc-destination-options", function(data){ + var optgroup = ""; // Domains - var optgroup = ""; - $.each(data.domains, function(index, domain){ - optgroup += ""; - }); - optgroup += ""; - $('#bcc-local-dest').append(optgroup); - // Alias domains - var optgroup = ""; - $.each(data.alias_domains, function(index, alias_domain){ - optgroup += ""; - }); - optgroup += "" - $('#bcc-local-dest').append(optgroup); - // Mailboxes and aliases - $.each(data.mailboxes, function(mailbox, aliases){ - var optgroup = ""; - $.each(aliases, function(index, alias){ - optgroup += ""; + if (data.domains && data.domains.length > 0) { + optgroup = ""; + $.each(data.domains, function(index, domain){ + optgroup += ""; }); optgroup += ""; $('#bcc-local-dest').append(optgroup); - }); - // Finish + } + // Alias domains + if (data.alias_domains && data.alias_domains.length > 0) { + optgroup = ""; + $.each(data.alias_domains, function(index, alias_domain){ + optgroup += ""; + }); + optgroup += "" + $('#bcc-local-dest').append(optgroup); + } + // Mailboxes and aliases + if (data.mailboxes && Object.keys(data.mailboxes).length > 0) { + $.each(data.mailboxes, function(mailbox, aliases){ + optgroup = ""; + $.each(aliases, function(index, alias){ + optgroup += ""; + }); + optgroup += ""; + $('#bcc-local-dest').append(optgroup); + }); + } + // Recreate picker $('#bcc-local-dest').selectpicker('refresh'); }); @@ -2326,16 +2333,19 @@ jQuery(function($){ // detect element visibility changes function onVisible(element, callback) { $(document).ready(function() { - element_object = document.querySelector(element); + let element_object = document.querySelector(element); if (element_object === null) return; - new IntersectionObserver((entries, observer) => { + let observer = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if(entry.intersectionRatio > 0) { callback(element_object); + observer.unobserve(element_object); } }); - }).observe(element_object); + }) + + observer.observe(element_object); }); }