git subrepo commit (merge) mailcow/src/mailcow-dockerized

subrepo: subdir:   "mailcow/src/mailcow-dockerized"
  merged:   "32243e56"
upstream: origin:   "https://github.com/mailcow/mailcow-dockerized.git"
  branch:   "master"
  commit:   "e2b4b6f6"
git-subrepo: version:  "0.4.3"
  origin:   "???"
  commit:   "???"
Change-Id: I51e2016ef5ab88a8b0bdc08551b18f48ceef0aa5
diff --git a/mailcow/src/mailcow-dockerized/data/web/js/site/debug.js b/mailcow/src/mailcow-dockerized/data/web/js/site/debug.js
index 6b08113..8f2aa66 100644
--- a/mailcow/src/mailcow-dockerized/data/web/js/site/debug.js
+++ b/mailcow/src/mailcow-dockerized/data/web/js/site/debug.js
@@ -78,6 +78,7 @@
         {"name":"time","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"});},"title":lang.time,"style":{"width":"170px"}},

         {"name":"ua","title":"User-Agent","style":{"min-width":"200px"}},

         {"name":"user","title":"Username","style":{"min-width":"200px"}},

+        {"name":"ip","title":"IP","style":{"min-width":"200px"}},

         {"name":"service","title":"Service"},

       ],

       "rows": $.ajax({

@@ -706,9 +707,7 @@
       $.each(data, function (i, item) {

         if (item === null) { return true; }

         item.username = escapeHtml(item.username);

-        if (item.service == "smtp") { item.service = '<div class="label label-default">' + item.service.toUpperCase() + '<i class="bi bi-chevron-compact-right"></i></div>'; }

-        else if (item.service == "imap") { item.service = '<div class="label label-default"><i class="bi bi-chevron-compact-left"></i> ' + item.service.toUpperCase() + '</div>'; }

-        else { item.service = '<div class="label label-default">' + item.service.toUpperCase() + '</div>'; }

+        item.service = '<div class="label label-default">' + item.service.toUpperCase() + '</div>';

     });

     } else if (table == 'general_syslog') {

       $.each(data, function (i, item) {

diff --git a/mailcow/src/mailcow-dockerized/data/web/js/site/index.js b/mailcow/src/mailcow-dockerized/data/web/js/site/index.js
index 02de206..1b3e56a 100644
--- a/mailcow/src/mailcow-dockerized/data/web/js/site/index.js
+++ b/mailcow/src/mailcow-dockerized/data/web/js/site/index.js
@@ -1,4 +1,3 @@
-$(document).ready(function() {

-	$('nav').hide();

-  localStorage.clear();

-});
\ No newline at end of file
+$(document).ready(function() {
+  localStorage.clear();
+});
diff --git a/mailcow/src/mailcow-dockerized/data/web/js/site/mailbox.js b/mailcow/src/mailcow-dockerized/data/web/js/site/mailbox.js
index 5cac48d..745c4f2 100644
--- a/mailcow/src/mailcow-dockerized/data/web/js/site/mailbox.js
+++ b/mailcow/src/mailcow-dockerized/data/web/js/site/mailbox.js
@@ -98,6 +98,38 @@
     auto_fill_quota($('#addSelectDomain').val());
   });
   auto_fill_quota($('#addSelectDomain').val());
+
+  // Read bcc local dests
+  // Using ajax to not be a blocking moo
+  $.get("/api/v1/get/bcc-destination-options", function(data){
+    // Domains
+    var optgroup = "<optgroup label='" + lang.domains + "'>";
+    $.each(data.domains, function(index, domain){
+      optgroup += "<option value='" + domain + "'>" + domain + "</option>"
+    });
+    optgroup += "</optgroup>"
+    $('#bcc-local-dest').append(optgroup);
+    // Alias domains
+    var optgroup = "<optgroup label='" + lang.domain_aliases + "'>";
+    $.each(data.alias_domains, function(index, alias_domain){
+      optgroup += "<option value='" + alias_domain + "'>" + alias_domain + "</option>"
+    });
+    optgroup += "</optgroup>"
+    $('#bcc-local-dest').append(optgroup);
+    // Mailboxes and aliases
+    $.each(data.mailboxes, function(mailbox, aliases){
+      var optgroup = "<optgroup label='" + mailbox + "'>";
+      $.each(aliases, function(index, alias){
+        optgroup += "<option value='" + alias + "'>" + alias + "</option>"
+      });
+      optgroup += "</optgroup>"
+      $('#bcc-local-dest').append(optgroup);
+    });
+    // Finish
+    $('#bcc-local-dest').find('option:selected').remove();
+    $('#bcc-local-dest').selectpicker('refresh');
+  });
+
   $(".goto_checkbox").click(function( event ) {
    $("form[data-id='add_alias'] .goto_checkbox").not(this).prop('checked', false);
     if ($("form[data-id='add_alias'] .goto_checkbox:checked").length > 0) {
@@ -956,6 +988,7 @@
         {"name":"exclude","title":lang.excludes,"breakpoints":"all"},
         {"name":"mins_interval","title":lang.mins_interval,"breakpoints":"all"},
         {"name":"last_run","title":lang.last_run,"breakpoints":"xs sm md"},
+        {"name":"exit_status","filterable": false,"title":lang.syncjob_last_run_result},
         {"name":"log","title":"Log"},
         {"name":"active","filterable": false,"style":{"min-width":"70px","width":"70px"},"title":lang.active,"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},
         {"name":"is_running","filterable": false,"style":{"min-width":"120px","width":"100px"},"title":lang.status},
@@ -992,6 +1025,18 @@
             if (!item.last_run > 0) {
               item.last_run = lang.waiting;
             }
+            if (item.success == null) {
+              item.success = '-';
+              item.exit_status = '';
+            } else {
+              item.success = '<i class="text-' + (item.success == 1 ? 'success' : 'danger') + ' bi bi-' + (item.success == 1 ? 'check-lg' : 'x-lg') + '"></i>';
+            }
+            if (lang['syncjob_'+item.exit_status]) {
+	            item.exit_status = lang['syncjob_'+item.exit_status];
+            } else if (item.success != '-') {
+	            item.exit_status = lang.syncjob_check_log;
+            }
+            item.exit_status = item.success + ' ' + item.exit_status;
           });
         }
       }),
diff --git a/mailcow/src/mailcow-dockerized/data/web/js/site/user.js b/mailcow/src/mailcow-dockerized/data/web/js/site/user.js
index 83aedba..8fd7b47 100644
--- a/mailcow/src/mailcow-dockerized/data/web/js/site/user.js
+++ b/mailcow/src/mailcow-dockerized/data/web/js/site/user.js
@@ -79,7 +79,7 @@
   $('.clear-last-logins').on('click', function () {if (confirm(lang.delete_ays)) {last_logins('reset');}})

   $(".login-history").on('click', function(e) {e.preventDefault(); last_logins('get', $(this).data('days'));$(this).addClass('active').siblings().removeClass('active');});

 

-  function last_logins(action, days = 1) {

+  function last_logins(action, days = 7) {

     if (action == 'get') {

       $('.last-login').html('<i class="bi bi-hourglass"></i>' +  lang.waiting);

       $.ajax({

@@ -101,10 +101,11 @@
             $.each(data.sasl, function (i, item) {

               var datetime = new Date(item.datetime.replace(/-/g, "/"));

               var local_datetime = datetime.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"});

-              item.app_password ? app_password = ' <a href="/edit/app-passwd/' + item.app_password + '">(App)</a>' : app_password = "", item.location ? ip_location = ' <span class="flag-icon flag-icon-' + item.location.toLowerCase() + '"></span>' : ip_location = "";

-              "smtp" == item.service ? service = '<div class="label label-default">' + item.service.toUpperCase() + '<i class="bi bi-chevron-compact-right"></i></div>' : "imap" == item.service ? service = '<div class="label label-default"><i class="bi bi-chevron-compact-left"></i> ' + item.service.toUpperCase() + "</div>" : service = '<div class="label label-default">' + item.service.toUpperCase() + "</div>";

-              item.real_rip.startsWith("Web") ? real_rip = item.real_rip : real_rip = '<a href="https://bgp.he.net/ip/' + item.real_rip + '" target="_blank">' + item.real_rip + "</a>";

-              ip_data = real_rip + ip_location + app_password;

+              var service = '<div class="label label-default">' + item.service.toUpperCase() + '</div>';

+              var app_password = item.app_password ? ' <a href="/edit/app-passwd/' + item.app_password + '"><i class="bi bi-app-indicator"></i> ' + escapeHtml(item.app_password_name || "App") + '</a>' : '';

+              var real_rip = item.real_rip.startsWith("Web") ? item.real_rip : '<a href="https://bgp.he.net/ip/' + item.real_rip + '" target="_blank">' + item.real_rip + "</a>";

+              var ip_location = item.location ? ' <span class="flag-icon flag-icon-' + item.location.toLowerCase() + '"></span>' : '';

+              var ip_data = real_rip + ip_location + app_password;

               $(".last-login").append('<li class="list-group-item">' + local_datetime + " " + service + " " + lang.from + " " + ip_data + "</li>");

             })

             $('.last-login').append('</ul>');

@@ -133,7 +134,7 @@
         {"name":"address","title":lang.alias},

         {"name":"validity","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"});},"title":lang.alias_valid_until,"style":{"width":"170px"}},

         {"sorted": true,"sortValue": function(value){res = new Date(value);return res.getTime();},"direction":"DESC","name":"created","formatter":function date_format(datetime) { var date = new Date(datetime.replace(/-/g, "/")); return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"});},"title":lang.created_on,"style":{"width":"170px"}},

-        {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}

+        {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","min-width":"220px","width":"220px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}

       ],

       "empty": lang.empty,

       "rows": $.ajax({

@@ -176,12 +177,13 @@
       "columns": [

         {"name":"chkbox","title":"","style":{"min-width":"60px","width":"60px","text-align":"center"},"filterable": false,"sortable": false,"type":"html"},

         {"sorted": true,"name":"id","title":"ID","style":{"maxWidth":"60px","width":"60px","text-align":"center"}},

-        {"name":"server_w_port","title":"Server"},

+        {"name":"server_w_port","title":"Server","breakpoints":"xs sm md","style":{"word-break":"break-all"}},

         {"name":"enc1","title":lang.encryption,"breakpoints":"all"},

         {"name":"user1","title":lang.username},

         {"name":"exclude","title":lang.excludes,"breakpoints":"all"},

         {"name":"mins_interval","title":lang.interval + " (min)","breakpoints":"all"},

-        {"name":"last_run","title":lang.last_run,"breakpoints":"all"},

+        {"name":"last_run","title":lang.last_run,"breakpoints":"xs sm md"},

+        {"name":"exit_status","filterable": false,"title":lang.syncjob_last_run_result},

         {"name":"log","title":"Log"},

         {"name":"active","filterable": false,"style":{"maxWidth":"70px","width":"70px"},"title":lang.active,"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},

         {"name":"is_running","filterable": false,"style":{"maxWidth":"120px","width":"100px"},"title":lang.status},

@@ -224,6 +226,18 @@
             if (!item.last_run > 0) {

               item.last_run = lang.waiting;

             }

+            if (item.success == null) {

+              item.success = '-';

+              item.exit_status = '';

+            } else {

+              item.success = '<i class="text-' + (item.success == 1 ? 'success' : 'danger') + ' bi bi-' + (item.success == 1 ? 'check-lg' : 'x-lg') + '"></i>';

+            }

+            if (lang['syncjob_'+item.exit_status]) {

+	            item.exit_status = lang['syncjob_'+item.exit_status];

+            } else if (item.success != '-') {

+	            item.exit_status = lang.syncjob_check_log;

+            }

+            item.exit_status = item.success + ' ' + item.exit_status;

           });

         }

       }),

@@ -245,8 +259,9 @@
         {"name":"chkbox","title":"","style":{"maxWidth":"60px","width":"60px","text-align":"center"},"filterable": false,"sortable": false,"type":"html"},

         {"sorted": true,"name":"id","title":"ID","style":{"maxWidth":"60px","width":"60px","text-align":"center"}},

         {"name":"name","title":lang.app_name},

+        {"name":"protocols","title":lang.allowed_protocols},

         {"name":"active","filterable": false,"style":{"maxWidth":"70px","width":"70px"},"title":lang.active,"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},

-        {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}

+        {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","min-width":"220px","width":"220px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}

       ],

       "empty": lang.empty,

       "rows": $.ajax({

@@ -258,7 +273,15 @@
         },

         success: function (data) {

           $.each(data, function (i, item) {

-            item.name = escapeHtml(item.name);

+            item.name = escapeHtml(item.name)

+            item.protocols = []

+            if (item.imap_access == 1) { item.protocols.push("<code>IMAP</code>"); }

+            if (item.smtp_access == 1) { item.protocols.push("<code>SMTP</code>"); }

+            if (item.eas_access == 1) { item.protocols.push("<code>EAS/ActiveSync</code>"); }

+            if (item.dav_access == 1) { item.protocols.push("<code>DAV</code>"); }

+            if (item.pop3_access == 1) { item.protocols.push("<code>POP3</code>"); }

+            if (item.sieve_access == 1) { item.protocols.push("<code>Sieve</code>"); }

+            item.protocols = item.protocols.join(" ")

             if (acl_data.app_passwds === 1) {

               item.action = '<div class="btn-group footable-actions">' +

                 '<a href="/edit/app-passwd/' + item.id + '" class="btn btn-xs btn-xs-half btn-default"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +