Merge pull request #4923 from mailcow/staging

2022-12a
This commit is contained in:
Niklas Meyer 2022-12-26 14:35:37 +01:00 committed by GitHub
commit 516c8ea66c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 1919 additions and 1975 deletions

View File

@ -10,9 +10,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
$_SESSION['return_to'] = $_SERVER['REQUEST_URI']; $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
$tfa_data = get_tfa(); $tfa_data = get_tfa();
$fido2_data = fido2(array("action" => "get_friendly_names")); $fido2_data = fido2(array("action" => "get_friendly_names"));
if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CACHE')) {
$_SESSION['gal'] = json_decode($license_cache, true);
}
$js_minifier->add('/web/js/site/admin.js'); $js_minifier->add('/web/js/site/admin.js');
$js_minifier->add('/web/js/presets/rspamd.js'); $js_minifier->add('/web/js/presets/rspamd.js');
@ -89,7 +86,6 @@ $template_data = [
'tfa_id' => @$_SESSION['tfa_id'], 'tfa_id' => @$_SESSION['tfa_id'],
'fido2_cid' => @$_SESSION['fido2_cid'], 'fido2_cid' => @$_SESSION['fido2_cid'],
'fido2_data' => $fido2_data, 'fido2_data' => $fido2_data,
'gal' => @$_SESSION['gal'],
'api' => [ 'api' => [
'ro' => admin_api('ro', 'get'), 'ro' => admin_api('ro', 'get'),
'rw' => admin_api('rw', 'get'), 'rw' => admin_api('rw', 'get'),

View File

@ -11,6 +11,11 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
$solr_status = (preg_match("/^([yY][eE][sS]|[yY])+$/", $_ENV["SKIP_SOLR"])) ? false : solr_status(); $solr_status = (preg_match("/^([yY][eE][sS]|[yY])+$/", $_ENV["SKIP_SOLR"])) ? false : solr_status();
$clamd_status = (preg_match("/^([yY][eE][sS]|[yY])+$/", $_ENV["SKIP_CLAMD"])) ? false : true; $clamd_status = (preg_match("/^([yY][eE][sS]|[yY])+$/", $_ENV["SKIP_CLAMD"])) ? false : true;
if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CACHE')) {
$_SESSION['gal'] = json_decode($license_cache, true);
}
$js_minifier->add('/web/js/site/debug.js'); $js_minifier->add('/web/js/site/debug.js');
// vmail df // vmail df
@ -54,6 +59,7 @@ $template_data = [
'vmail_df' => $vmail_df, 'vmail_df' => $vmail_df,
'hostname' => $hostname, 'hostname' => $hostname,
'timezone' => $timezone, 'timezone' => $timezone,
'gal' => @$_SESSION['gal'],
'license_guid' => license('guid'), 'license_guid' => license('guid'),
'solr_status' => $solr_status, 'solr_status' => $solr_status,
'solr_uptime' => round($solr_status['status']['dovecot-fts']['uptime'] / 1000 / 60 / 60), 'solr_uptime' => round($solr_status['status']['dovecot-fts']['uptime'] / 1000 / 60 / 60),

View File

@ -234,7 +234,7 @@ if (!isset($_SESSION['mailcow_locale']) && !isset($_COOKIE['mailcow_locale'])) {
// Try suggest match // Try suggest match
// e.g. suggest en-gb when only en-us is provided // e.g. suggest en-gb when only en-us is provided
if (!isset($_COOKIE['mailcow_locale'])) { if (!isset($_SESSION['mailcow_locale'])) {
foreach ($lang2pref as $lang => $q) { foreach ($lang2pref as $lang => $q) {
if (array_key_exists(substr($lang, 0, 2), $AVAILABLE_BASE_LANGUAGES)) { if (array_key_exists(substr($lang, 0, 2), $AVAILABLE_BASE_LANGUAGES)) {
$_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[substr($lang, 0, 2)]; $_SESSION['mailcow_locale'] = $AVAILABLE_BASE_LANGUAGES[substr($lang, 0, 2)];

File diff suppressed because one or more lines are too long

View File

@ -1,70 +0,0 @@
/**
* This plug-in for DataTables represents the ultimate option in extensibility
* for sorting date / time strings correctly. It uses
* [Moment.js](http://momentjs.com) to create automatic type detection and
* sorting plug-ins for DataTables based on a given format. This way, DataTables
* will automatically detect your temporal information and sort it correctly.
*
* For usage instructions, please see the DataTables blog
* post that [introduces it](//datatables.net/blog/2014-12-18).
*
* @name Ultimate Date / Time sorting
* @summary Sort date and time in any format using Moment.js
* @author [Allan Jardine](//datatables.net)
* @depends DataTables 1.10+, Moment.js 1.7+
*
* @example
* $.fn.dataTable.moment( 'HH:mm MMM D, YY' );
* $.fn.dataTable.moment( 'dddd, MMMM Do, YYYY' );
*
* $('#example').DataTable();
*/
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["jquery", "moment", "datatables.net"], factory);
} else {
factory(jQuery, moment);
}
}(function ($, moment) {
function strip (d) {
if ( typeof d === 'string' ) {
// Strip HTML tags and newline characters if possible
d = d.replace(/(<.*?>)|(\r?\n|\r)/g, '');
// Strip out surrounding white space
d = d.trim();
}
return d;
}
$.fn.dataTable.moment = function ( format, locale, reverseEmpties ) {
var types = $.fn.dataTable.ext.type;
// Add type detection
types.detect.unshift( function ( d ) {
d = strip(d);
// Null and empty values are acceptable
if ( d === '' || d === null ) {
return 'moment-'+format;
}
return moment( d, format, locale, true ).isValid() ?
'moment-'+format :
null;
} );
// Add sorting method - use an integer for the sorting
types.order[ 'moment-'+format+'-pre' ] = function ( d ) {
d = strip(d);
return !moment(d, format, locale, true).isValid() ?
(reverseEmpties ? -Infinity : Infinity) :
parseInt( moment( d, format, locale, true ).format( 'x' ), 10 );
};
};
}));

View File

@ -1,354 +1,353 @@
$(document).ready(function() { $(document).ready(function() {
// mailcow alert box generator // mailcow alert box generator
window.mailcow_alert_box = function(message, type) { window.mailcow_alert_box = function(message, type) {
msg = $('<span/>').text(message).text(); msg = $('<span/>').text(message).text();
if (type == 'danger' || type == 'info') { if (type == 'danger' || type == 'info') {
auto_hide = 0; auto_hide = 0;
$('#' + localStorage.getItem("add_modal")).modal('show'); $('#' + localStorage.getItem("add_modal")).modal('show');
localStorage.removeItem("add_modal"); localStorage.removeItem("add_modal");
} else { } else {
auto_hide = 5000; auto_hide = 5000;
} }
$.notify({message: msg},{z_index: 20000, delay: auto_hide, type: type,placement: {from: "bottom",align: "right"},animate: {enter: 'animated fadeInUp',exit: 'animated fadeOutDown'}}); $.notify({message: msg},{z_index: 20000, delay: auto_hide, type: type,placement: {from: "bottom",align: "right"},animate: {enter: 'animated fadeInUp',exit: 'animated fadeOutDown'}});
} }
$(".generate_password").click(function( event ) { $(".generate_password").click(function( event ) {
event.preventDefault(); event.preventDefault();
$('[data-hibp]').trigger('input'); $('[data-hibp]').trigger('input');
if (typeof($(this).closest("form").data('pwgen-length')) == "number") { if (typeof($(this).closest("form").data('pwgen-length')) == "number") {
var random_passwd = GPW.pronounceable($(this).closest("form").data('pwgen-length')) var random_passwd = GPW.pronounceable($(this).closest("form").data('pwgen-length'))
} }
else { else {
var random_passwd = GPW.pronounceable(8) var random_passwd = GPW.pronounceable(8)
} }
$(this).closest("form").find('[data-pwgen-field]').attr('type', 'text'); $(this).closest("form").find('[data-pwgen-field]').attr('type', 'text');
$(this).closest("form").find('[data-pwgen-field]').val(random_passwd); $(this).closest("form").find('[data-pwgen-field]').val(random_passwd);
}); });
function str_rot13(str) { function str_rot13(str) {
return (str + '').replace(/[a-z]/gi, function(s){ return (str + '').replace(/[a-z]/gi, function(s){
return String.fromCharCode(s.charCodeAt(0) + (s.toLowerCase() < 'n' ? 13 : -13)) return String.fromCharCode(s.charCodeAt(0) + (s.toLowerCase() < 'n' ? 13 : -13))
}) })
} }
$(".rot-enc").html(function(){ $(".rot-enc").html(function(){
return str_rot13($(this).html()) return str_rot13($(this).html())
}); });
// https://stackoverflow.com/questions/4399005/implementing-jquerys-shake-effect-with-animate // https://stackoverflow.com/questions/4399005/implementing-jquerys-shake-effect-with-animate
function shake(div,interval,distance,times) { function shake(div,interval,distance,times) {
if(typeof interval === 'undefined') { if(typeof interval === 'undefined') {
interval = 100; interval = 100;
} }
if(typeof distance === 'undefined') { if(typeof distance === 'undefined') {
distance = 10; distance = 10;
} }
if(typeof times === 'undefined') { if(typeof times === 'undefined') {
times = 4; times = 4;
} }
$(div).css('position','relative'); $(div).css('position','relative');
for(var iter=0;iter<(times+1);iter++){ for(var iter=0;iter<(times+1);iter++){
$(div).animate({ left: ((iter%2==0 ? distance : distance*-1))}, interval); $(div).animate({ left: ((iter%2==0 ? distance : distance*-1))}, interval);
} }
$(div).animate({ left: 0},interval); $(div).animate({ left: 0},interval);
} }
// form cache // form cache
$('[data-cached-form="true"]').formcache({key: $(this).data('id')}); $('[data-cached-form="true"]').formcache({key: $(this).data('id')});
// tooltips // tooltips
$(function () { $(function () {
$('[data-bs-toggle="tooltip"]').tooltip() $('[data-bs-toggle="tooltip"]').tooltip()
}); });
// remember last navigation pill // remember last navigation pill
(function () { (function () {
'use strict'; 'use strict';
// remember desktop tabs // remember desktop tabs
$('button[data-bs-toggle="tab"]').on('click', function (e) { $('button[data-bs-toggle="tab"]').on('click', function (e) {
if ($(this).data('dont-remember') == 1) { if ($(this).data('dont-remember') == 1) {
return true; return true;
} }
var id = $(this).parents('[role="tablist"]').attr('id'); var id = $(this).parents('[role="tablist"]').attr('id');
var key = 'lastTag'; var key = 'lastTag';
if (id) { if (id) {
key += ':' + id; key += ':' + id;
} }
var tab_id = $(e.target).attr('data-bs-target').substring(1); var tab_id = $(e.target).attr('data-bs-target').substring(1);
localStorage.setItem(key, tab_id); localStorage.setItem(key, tab_id);
}); });
// remember mobile tabs // remember mobile tabs
$('button[data-bs-target^="#collapse-tab-"]').on('click', function (e) { $('button[data-bs-target^="#collapse-tab-"]').on('click', function (e) {
// only remember tab if its being opened // only remember tab if its being opened
if ($(this).hasClass('collapsed')) return false; if ($(this).hasClass('collapsed')) return false;
var tab_id = $(this).closest('div[role="tabpanel"]').attr('id'); var tab_id = $(this).closest('div[role="tabpanel"]').attr('id');
if ($(this).data('dont-remember') == 1) { if ($(this).data('dont-remember') == 1) {
return true; return true;
} }
var id = $(this).parents('[role="tablist"]').attr('id');; var id = $(this).parents('[role="tablist"]').attr('id');;
var key = 'lastTag'; var key = 'lastTag';
if (id) { if (id) {
key += ':' + id; key += ':' + id;
} }
localStorage.setItem(key, tab_id); localStorage.setItem(key, tab_id);
}); });
// open last tab // open last tab
$('[role="tablist"]').each(function (idx, elem) { $('[role="tablist"]').each(function (idx, elem) {
var id = $(elem).attr('id'); var id = $(elem).attr('id');
var key = 'lastTag'; var key = 'lastTag';
if (id) { if (id) {
key += ':' + id; key += ':' + id;
} }
var lastTab = localStorage.getItem(key); var lastTab = localStorage.getItem(key);
if (lastTab) { if (lastTab) {
$('[data-bs-target="#' + lastTab + '"]').click(); $('[data-bs-target="#' + lastTab + '"]').click();
var tab = $('[id^="' + lastTab + '"]'); var tab = $('[id^="' + lastTab + '"]');
$(tab).find('.card-body.collapse').collapse('show'); $(tab).find('.card-body.collapse').collapse('show');
} }
}); });
})(); })();
// IE fix to hide scrollbars when table body is empty // IE fix to hide scrollbars when table body is empty
$('tbody').filter(function (index) { $('tbody').filter(function (index) {
return $(this).children().length < 1; return $(this).children().length < 1;
}).remove(); }).remove();
// selectpicker // selectpicker
$('select').selectpicker({ $('select').selectpicker({
'styleBase': 'btn btn-xs-lg', 'styleBase': 'btn btn-xs-lg',
'noneSelectedText': lang_footer.nothing_selected 'noneSelectedText': lang_footer.nothing_selected
}); });
// haveibeenpwned and passwd policy // haveibeenpwned and passwd policy
$.ajax({ $.ajax({
url: '/api/v1/get/passwordpolicy/html', url: '/api/v1/get/passwordpolicy/html',
type: 'GET', type: 'GET',
success: function(res) { success: function(res) {
$(".hibp-out").after(res); $(".hibp-out").after(res);
} }
}); });
$('[data-hibp]').after('<p class="small haveibeenpwned"><i class="bi bi-shield-fill-exclamation"></i> ' + lang_footer.hibp_check + '</p><span class="hibp-out"></span>'); $('[data-hibp]').after('<p class="small haveibeenpwned"><i class="bi bi-shield-fill-exclamation"></i> ' + lang_footer.hibp_check + '</p><span class="hibp-out"></span>');
$('[data-hibp]').on('input', function() { $('[data-hibp]').on('input', function() {
out_field = $(this).next('.haveibeenpwned').next('.hibp-out').text('').attr('class', 'hibp-out'); out_field = $(this).next('.haveibeenpwned').next('.hibp-out').text('').attr('class', 'hibp-out');
}); });
$('.haveibeenpwned:not(.task-running)').on('click', function() { $('.haveibeenpwned:not(.task-running)').on('click', function() {
var hibp_field = $(this) var hibp_field = $(this)
$(hibp_field).addClass('task-running'); $(hibp_field).addClass('task-running');
var hibp_result = $(hibp_field).next('.hibp-out') var hibp_result = $(hibp_field).next('.hibp-out')
var password_field = $(this).prev('[data-hibp]') var password_field = $(this).prev('[data-hibp]')
if ($(password_field).val() == '') { if ($(password_field).val() == '') {
shake(password_field); shake(password_field);
} }
else { else {
$(hibp_result).attr('class', 'hibp-out badge fs-5 bg-info'); $(hibp_result).attr('class', 'hibp-out badge fs-5 bg-info');
$(hibp_result).text(lang_footer.loading); $(hibp_result).text(lang_footer.loading);
var password_digest = $.sha1($(password_field).val()) var password_digest = $.sha1($(password_field).val())
var digest_five = password_digest.substring(0, 5).toUpperCase(); var digest_five = password_digest.substring(0, 5).toUpperCase();
var queryURL = "https://api.pwnedpasswords.com/range/" + digest_five; var queryURL = "https://api.pwnedpasswords.com/range/" + digest_five;
var compl_digest = password_digest.substring(5, 41).toUpperCase(); var compl_digest = password_digest.substring(5, 41).toUpperCase();
$.ajax({ $.ajax({
url: queryURL, url: queryURL,
type: 'GET', type: 'GET',
success: function(res) { success: function(res) {
if (res.search(compl_digest) > -1){ if (res.search(compl_digest) > -1){
$(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-danger'); $(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-danger');
$(hibp_result).text(lang_footer.hibp_nok) $(hibp_result).text(lang_footer.hibp_nok)
} else { } else {
$(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-success'); $(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-success');
$(hibp_result).text(lang_footer.hibp_ok) $(hibp_result).text(lang_footer.hibp_ok)
} }
$(hibp_field).removeClass('task-running'); $(hibp_field).removeClass('task-running');
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
$(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-warning'); $(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-warning');
$(hibp_result).text('API error: ' + xhr.responseText) $(hibp_result).text('API error: ' + xhr.responseText)
$(hibp_field).removeClass('task-running'); $(hibp_field).removeClass('task-running');
} }
}); });
} }
}); });
// Disable disallowed inputs // Disable disallowed inputs
$('[data-acl="0"]').each(function(event){ $('[data-acl="0"]').each(function(event){
if ($(this).is("a")) { if ($(this).is("a")) {
$(this).removeAttr("data-bs-toggle"); $(this).removeAttr("data-bs-toggle");
$(this).removeAttr("data-bs-target"); $(this).removeAttr("data-bs-target");
$(this).removeAttr("data-action"); $(this).removeAttr("data-action");
$(this).click(function(event) { $(this).click(function(event) {
event.preventDefault(); event.preventDefault();
}); });
} }
if ($(this).is("select")) { if ($(this).is("select")) {
$(this).selectpicker('destroy'); $(this).selectpicker('destroy');
$(this).replaceWith(function() { $(this).replaceWith(function() {
return '<label class="control-label"><b>' + this.innerText + '</b></label>'; return '<label class="control-label"><b>' + this.innerText + '</b></label>';
}); });
} }
if ($(this).hasClass('btn-group')) { if ($(this).hasClass('btn-group')) {
$(this).find('a').each(function(){ $(this).find('a').each(function(){
$(this).removeClass('dropdown-toggle') $(this).removeClass('dropdown-toggle')
.removeAttr('data-bs-toggle') .removeAttr('data-bs-toggle')
.removeAttr('data-bs-target') .removeAttr('data-bs-target')
.removeAttr('data-action') .removeAttr('data-action')
.removeAttr('id') .removeAttr('id')
.attr("disabled", true); .attr("disabled", true);
$(this).click(function(event) { $(this).click(function(event) {
event.preventDefault(); event.preventDefault();
return; return;
}); });
}); });
$(this).find('button').each(function() { $(this).find('button').each(function() {
$(this).attr("disabled", true); $(this).attr("disabled", true);
}); });
} else if ($(this).hasClass('input-group')) { } else if ($(this).hasClass('input-group')) {
$(this).find('input').each(function() { $(this).find('input').each(function() {
$(this).removeClass('dropdown-toggle') $(this).removeClass('dropdown-toggle')
.removeAttr('data-bs-toggle') .removeAttr('data-bs-toggle')
.attr("disabled", true); .attr("disabled", true);
$(this).click(function(event) { $(this).click(function(event) {
event.preventDefault(); event.preventDefault();
}); });
}); });
$(this).find('button').each(function() { $(this).find('button').each(function() {
$(this).attr("disabled", true); $(this).attr("disabled", true);
}); });
} else if ($(this).hasClass('form-group')) { } else if ($(this).hasClass('form-group')) {
$(this).find('input').each(function() { $(this).find('input').each(function() {
$(this).attr("disabled", true); $(this).attr("disabled", true);
}); });
} else if ($(this).hasClass('btn')) { } else if ($(this).hasClass('btn')) {
$(this).attr("disabled", true); $(this).attr("disabled", true);
} else if ($(this).attr('data-provide') == 'slider') { } else if ($(this).attr('data-provide') == 'slider') {
$(this).attr('disabled', true); $(this).attr('disabled', true);
} else if ($(this).is(':checkbox')) { } else if ($(this).is(':checkbox')) {
$(this).attr("disabled", true); $(this).attr("disabled", true);
} }
$(this).data("toggle", "tooltip"); $(this).data("toggle", "tooltip");
$(this).attr("title", lang_acl.prohibited); $(this).attr("title", lang_acl.prohibited);
$(this).tooltip(); $(this).tooltip();
}); });
// disable submit after submitting form (not API driven buttons) // disable submit after submitting form (not API driven buttons)
$('form').submit(function() { $('form').submit(function() {
if ($('form button[type="submit"]').data('submitted') == '1') { if ($('form button[type="submit"]').data('submitted') == '1') {
return false; return false;
} else { } else {
$(this).find('button[type="submit"]').first().text(lang_footer.loading); $(this).find('button[type="submit"]').first().text(lang_footer.loading);
$('form button[type="submit"]').attr('data-submitted', '1'); $('form button[type="submit"]').attr('data-submitted', '1');
function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); }; function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); };
$(document).on("keydown", disableF5); $(document).on("keydown", disableF5);
} }
}); });
// Textarea line numbers // Textarea line numbers
$(".textarea-code").numberedtextarea({allowTabChar: true}); $(".textarea-code").numberedtextarea({allowTabChar: true});
// trigger container restart // trigger container restart
$('#RestartContainer').on('show.bs.modal', function(e) { $('#RestartContainer').on('show.bs.modal', function(e) {
var container = $(e.relatedTarget).data('container'); var container = $(e.relatedTarget).data('container');
$('#containerName').text(container); $('#containerName').text(container);
$('#triggerRestartContainer').click(function(){ $('#triggerRestartContainer').click(function(){
$(this).prop("disabled",true); $(this).prop("disabled",true);
$(this).html('<div class="spinner-border text-white" role="status"><span class="visually-hidden">Loading...</span></div>'); $(this).html('<div class="spinner-border text-white" role="status"><span class="visually-hidden">Loading...</span></div>');
$('#statusTriggerRestartContainer').html(lang_footer.restarting_container); $('#statusTriggerRestartContainer').html(lang_footer.restarting_container);
$.ajax({ $.ajax({
method: 'get', method: 'get',
url: '/inc/ajax/container_ctrl.php', url: '/inc/ajax/container_ctrl.php',
timeout: docker_timeout, timeout: docker_timeout,
data: { data: {
'service': container, 'service': container,
'action': 'restart' 'action': 'restart'
} }
}) })
.always( function (data, status) { .always( function (data, status) {
$('#statusTriggerRestartContainer').append(data); $('#statusTriggerRestartContainer').append(data);
var htmlResponse = $.parseHTML(data) var htmlResponse = $.parseHTML(data)
if ($(htmlResponse).find('span').hasClass('text-success')) { if ($(htmlResponse).find('span').hasClass('text-success')) {
$('#triggerRestartContainer').html('<i class="bi bi-check-lg"></i> '); $('#triggerRestartContainer').html('<i class="bi bi-check-lg"></i> ');
setTimeout(function(){ setTimeout(function(){
$('#RestartContainer').modal('toggle'); $('#RestartContainer').modal('toggle');
window.location = window.location.href.split("#")[0]; window.location = window.location.href.split("#")[0];
}, 1200); }, 1200);
} else { } else {
$('#triggerRestartContainer').html('<i class="bi bi-slash-lg"></i> '); $('#triggerRestartContainer').html('<i class="bi bi-slash-lg"></i> ');
} }
}) })
}); });
}) })
// Jquery Datatables, enable responsive plugin and date sort plugin // Jquery Datatables, enable responsive plugin
$.extend($.fn.dataTable.defaults, { $.extend($.fn.dataTable.defaults, {
responsive: true responsive: true
}); });
$.fn.dataTable.moment('dd:mm:YYYY');
// tag boxes
// tag boxes $('.tag-box .tag-add').click(function(){
$('.tag-box .tag-add').click(function(){ addTag(this);
addTag(this); });
}); $(".tag-box .tag-input").keydown(function (e) {
$(".tag-box .tag-input").keydown(function (e) { if (e.which == 13){
if (e.which == 13){ e.preventDefault();
e.preventDefault(); addTag(this);
addTag(this); }
} });
});
// Dark Mode Loader
// Dark Mode Loader $('#dark-mode-toggle').click(toggleDarkMode);
$('#dark-mode-toggle').click(toggleDarkMode); if ($('#dark-mode-theme').length) {
if ($('#dark-mode-theme').length) { $('#dark-mode-toggle').prop('checked', true);
$('#dark-mode-toggle').prop('checked', true); if ($('#rspamd_logo').length) $('#rspamd_logo').attr('src', '/img/rspamd_logo_light.png');
if ($('#rspamd_logo').length) $('#rspamd_logo').attr('src', '/img/rspamd_logo_light.png'); if ($('#rspamd_logo_sm').length) $('#rspamd_logo_sm').attr('src', '/img/rspamd_logo_light.png');
if ($('#rspamd_logo_sm').length) $('#rspamd_logo_sm').attr('src', '/img/rspamd_logo_light.png'); }
} function toggleDarkMode(){
function toggleDarkMode(){ if($('#dark-mode-theme').length){
if($('#dark-mode-theme').length){ $('#dark-mode-theme').remove();
$('#dark-mode-theme').remove(); $('#dark-mode-toggle').prop('checked', false);
$('#dark-mode-toggle').prop('checked', false); if ($('#rspamd_logo').length) $('#rspamd_logo').attr('src', '/img/rspamd_logo_dark.png');
if ($('#rspamd_logo').length) $('#rspamd_logo').attr('src', '/img/rspamd_logo_dark.png'); if ($('#rspamd_logo_sm').length) $('#rspamd_logo_sm').attr('src', '/img/rspamd_logo_dark.png');
if ($('#rspamd_logo_sm').length) $('#rspamd_logo_sm').attr('src', '/img/rspamd_logo_dark.png'); localStorage.setItem('theme', 'light');
localStorage.setItem('theme', 'light'); }else{
}else{ $('head').append('<link id="dark-mode-theme" rel="stylesheet" type="text/css" href="/css/themes/mailcow-darkmode.css">');
$('head').append('<link id="dark-mode-theme" rel="stylesheet" type="text/css" href="/css/themes/mailcow-darkmode.css">'); $('#dark-mode-toggle').prop('checked', true);
$('#dark-mode-toggle').prop('checked', true); if ($('#rspamd_logo').length) $('#rspamd_logo').attr('src', '/img/rspamd_logo_light.png');
if ($('#rspamd_logo').length) $('#rspamd_logo').attr('src', '/img/rspamd_logo_light.png'); if ($('#rspamd_logo_sm').length) $('#rspamd_logo_sm').attr('src', '/img/rspamd_logo_light.png');
if ($('#rspamd_logo_sm').length) $('#rspamd_logo_sm').attr('src', '/img/rspamd_logo_light.png'); localStorage.setItem('theme', 'dark');
localStorage.setItem('theme', 'dark'); }
} }
} });
});
// https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
// https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery function escapeHtml(n){var entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"}; return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}
function escapeHtml(n){var entityMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"}; return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})} function unescapeHtml(t){var n={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#x2F;":"/","&#x60;":"`","&#x3D;":"="};return String(t).replace(/&amp;|&lt;|&gt;|&quot;|&#39;|&#x2F|&#x60|&#x3D;/g,function(t){return n[t]})}
function unescapeHtml(t){var n={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#x2F;":"/","&#x60;":"`","&#x3D;":"="};return String(t).replace(/&amp;|&lt;|&gt;|&quot;|&#39;|&#x2F|&#x60|&#x3D;/g,function(t){return n[t]})}
function addTag(tagAddElem, tag = null){
function addTag(tagAddElem, tag = null){ var tagboxElem = $(tagAddElem).parent();
var tagboxElem = $(tagAddElem).parent(); var tagInputElem = $(tagboxElem).find(".tag-input")[0];
var tagInputElem = $(tagboxElem).find(".tag-input")[0]; var tagValuesElem = $(tagboxElem).find(".tag-values")[0];
var tagValuesElem = $(tagboxElem).find(".tag-values")[0];
if (!tag)
if (!tag) tag = $(tagInputElem).val();
tag = $(tagInputElem).val(); if (!tag) return;
if (!tag) return; var value_tags = [];
var value_tags = []; try {
try { value_tags = JSON.parse($(tagValuesElem).val());
value_tags = JSON.parse($(tagValuesElem).val()); } catch {}
} catch {} if (!Array.isArray(value_tags)) value_tags = [];
if (!Array.isArray(value_tags)) value_tags = []; if (value_tags.includes(tag)) return;
if (value_tags.includes(tag)) return;
$('<span class="badge bg-primary tag-badge btn-badge"><i class="bi bi-tag-fill"></i> ' + escapeHtml(tag) + '</span>').insertBefore('.tag-input').click(function(){
$('<span class="badge bg-primary tag-badge btn-badge"><i class="bi bi-tag-fill"></i> ' + escapeHtml(tag) + '</span>').insertBefore('.tag-input').click(function(){ var del_tag = unescapeHtml($(this).text());
var del_tag = unescapeHtml($(this).text()); var del_tags = [];
var del_tags = []; try {
try { del_tags = JSON.parse($(tagValuesElem).val());
del_tags = JSON.parse($(tagValuesElem).val()); } catch {}
} catch {} if (Array.isArray(del_tags)){
if (Array.isArray(del_tags)){ del_tags.splice(del_tags.indexOf(del_tag), 1);
del_tags.splice(del_tags.indexOf(del_tag), 1); $(tagValuesElem).val(JSON.stringify(del_tags));
$(tagValuesElem).val(JSON.stringify(del_tags)); }
} $(this).remove();
$(this).remove(); });
});
value_tags.push(tag);
value_tags.push(tag); $(tagValuesElem).val(JSON.stringify(value_tags));
$(tagValuesElem).val(JSON.stringify(value_tags)); $(tagInputElem).val('');
$(tagInputElem).val(''); }
}

File diff suppressed because it is too large Load Diff

View File

@ -97,7 +97,7 @@ jQuery(function($){
}, },
{ {
title: lang.subj, title: lang.subj,
data: 'sender', data: 'subject',
defaultContent: '' defaultContent: ''
}, },
{ {

View File

@ -488,6 +488,7 @@
"chart_this_server": "Chart (dieser Server)", "chart_this_server": "Chart (dieser Server)",
"containers_info": "Container-Information", "containers_info": "Container-Information",
"container_running": "Läuft", "container_running": "Läuft",
"container_disabled": "Container gestoppt oder deaktiviert",
"container_stopped": "Angehalten", "container_stopped": "Angehalten",
"cores": "Kerne", "cores": "Kerne",
"current_time": "Systemzeit", "current_time": "Systemzeit",

View File

@ -491,6 +491,7 @@
"chart_this_server": "Chart (this server)", "chart_this_server": "Chart (this server)",
"containers_info": "Container information", "containers_info": "Container information",
"container_running": "Running", "container_running": "Running",
"container_disabled": "Container stopped or disabled",
"container_stopped": "Stopped", "container_stopped": "Stopped",
"cores": "Cores", "cores": "Cores",
"current_time": "System Time", "current_time": "System Time",

View File

@ -80,7 +80,9 @@
{% if mailcow_cc_role == 'admin' %} {% if mailcow_cc_role == 'admin' %}
<li><a href="/queue" class="dropdown-item {% if is_uri('queue') %}active{% endif %}">{{ lang.queue.queue_manager }}</a></li> <li><a href="/queue" class="dropdown-item {% if is_uri('queue') %}active{% endif %}">{{ lang.queue.queue_manager }}</a></li>
{% endif %} {% endif %}
{% if mailcow_cc_role == 'admin' %}
<li><a href="#" class="dropdown-item" data-bs-toggle="modal" data-container="sogo-mailcow" data-bs-target="#RestartContainer">{{ lang.header.restart_sogo }}</a></li> <li><a href="#" class="dropdown-item" data-bs-toggle="modal" data-container="sogo-mailcow" data-bs-target="#RestartContainer">{{ lang.header.restart_sogo }}</a></li>
{% endif %}
</ul> </ul>
</li> </li>
{% endif %} {% endif %}

View File

@ -160,8 +160,14 @@
<div class="d-flex p-2 list-group-header"> <div class="d-flex p-2 list-group-header">
<div> <div>
<span class="fw-bold">solr-mailcow</span> <span class="fw-bold">solr-mailcow</span>
{% if containers["solr-mailcow"].State.Running == 1 %}
<span class="d-block d-md-inline">({{ containers["solr-mailcow"].Config.Image }})</span> <span class="d-block d-md-inline">({{ containers["solr-mailcow"].Config.Image }})</span>
{% endif %}
{% if containers["solr-mailcow"].State.Running == 1 %}
<small class="d-block">({{ lang.debug.started_on }} <span class="parse_date">{{ containers["solr-mailcow"].State.StartedAtHR }}</span>)</small> <small class="d-block">({{ lang.debug.started_on }} <span class="parse_date">{{ containers["solr-mailcow"].State.StartedAtHR }}</span>)</small>
{% elseif containers["solr-mailcow"].State.Running != 1 %}
<small class="d-block">{{ lang.debug.container_disabled }}</small>
{% endif %}
{% if containers["solr-mailcow"].State.Running == 1 %} {% if containers["solr-mailcow"].State.Running == 1 %}
<span class="badge fs-7 bg-success loader" style="min-width:100px"> <span class="badge fs-7 bg-success loader" style="min-width:100px">
{{ lang.debug.container_running }} {{ lang.debug.container_running }}
@ -169,19 +175,22 @@
<span class="loader-dot">.</span> <span class="loader-dot">.</span>
<span class="loader-dot">.</span> <span class="loader-dot">.</span>
</span> </span>
{% elseif containers["solr-mailcow"].State %} {% elseif containers["solr-mailcow"].State.Running != 1 %}
<span class="badge fs-7 bg-danger" style="min-width:100px"> <span class="badge fs-7 bg-danger" style="min-width:100px">
{{ lang.debug.container_stopped }} {{ lang.debug.container_stopped }}
<i class="bi-x ms-1"></i> <i class="bi-x ms-1"></i>
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% if containers["solr-mailcow"].State.Running == 1 %}
<div class="mt-auto ms-auto"> <div class="mt-auto ms-auto">
<button class="btn btn-light" type="button" data-bs-toggle="collapse" data-bs-target="#solr-mailcowCollapse" aria-expanded="false" aria-controls="solr-mailcowCollapse"> <button class="btn btn-light" type="button" data-bs-toggle="collapse" data-bs-target="#solr-mailcowCollapse" aria-expanded="false" aria-controls="solr-mailcowCollapse">
<i class="bi bi-caret-down-fill caret"></i> <i class="bi bi-caret-down-fill caret"></i>
</button> </button>
</div> </div>
{% endif %}
</div> </div>
{% if containers["solr-mailcow"].State.Running == 1 %}
<div class="collapse p-0 list-group-details container-details-collapse" id="solr-mailcowCollapse" data-id="{{ containers["solr-mailcow"].Id }}"> <div class="collapse p-0 list-group-details container-details-collapse" id="solr-mailcowCollapse" data-id="{{ containers["solr-mailcow"].Id }}">
<div class="row p-2 pt-4"> <div class="row p-2 pt-4">
<div class="col-sm-3"> <div class="col-sm-3">
@ -238,6 +247,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>

View File

@ -274,7 +274,7 @@
</div> </div>
<div class="col-sm-10"> <div class="col-sm-10">
<p class="text-muted">{{ lang.user.pushover_info|format(mailbox)|raw }}</p> <p class="text-muted">{{ lang.user.pushover_info|format(mailbox)|raw }}</p>
<p class="text-muted">{{ lang.edit.pushover_vars|raw }}: <code>{SUBJECT}</code>, <code>{SENDER}</code>, <code>{SENDER_ADDRESS}</code>, <code>{SENDER_NAME}</code>, <code>{TO_NAME}</code>, <code>{TO_ADDRESS}, <code>{MSG_ID}</code></p> <p class="text-muted">{{ lang.edit.pushover_vars|raw }}: <code>{SUBJECT}</code>, <code>{SENDER}</code>, <code>{SENDER_ADDRESS}</code>, <code>{SENDER_NAME}</code>, <code>{TO_NAME}</code>, <code>{TO_ADDRESS}</code>, <code>{MSG_ID}</code></p>
<div class="row"> <div class="row">
<div class="col-sm-6 mb-2"> <div class="col-sm-6 mb-2">
<label for="token">API Token/Key (Application)</label> <label for="token">API Token/Key (Application)</label>

View File

@ -42,8 +42,6 @@ echo -e "\e[32mTrying to determine GLIBC version...\e[0m"
elif [[ $(curl -sL -w "%{http_code}" https://github.com/docker/compose/releases/latest -o /dev/null) == "200" ]]; then elif [[ $(curl -sL -w "%{http_code}" https://github.com/docker/compose/releases/latest -o /dev/null) == "200" ]]; then
LATEST_COMPOSE=$(curl -Ls -w %{url_effective} -o /dev/null https://github.com/docker/compose/releases/latest) # redirect to latest release LATEST_COMPOSE=$(curl -Ls -w %{url_effective} -o /dev/null https://github.com/docker/compose/releases/latest) # redirect to latest release
LATEST_COMPOSE=${LATEST_COMPOSE##*/} #get the latest version from the redirect, inlcuding the "v" prefix LATEST_COMPOSE=${LATEST_COMPOSE##*/} #get the latest version from the redirect, inlcuding the "v" prefix
if [ $DC_DL_SUFFIX]; then
LATEST_COMPOSE=1.27.4 # force 1.27.4 for legacy systems, tag is not prefixed by "v"
COMPOSE_VERSION=$(docker-compose version --short) COMPOSE_VERSION=$(docker-compose version --short)
if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then
COMPOSE_PATH=$(command -v docker-compose) COMPOSE_PATH=$(command -v docker-compose)
@ -71,4 +69,4 @@ elif [ "${DOCKER_COMPOSE_VERSION}" == "native" ]; then
else else
echo -e "\e[31mCan not read DOCKER_COMPOSE_VERSION variable from mailcow.conf! Is your mailcow up to date? Exiting...\e[0m" echo -e "\e[31mCan not read DOCKER_COMPOSE_VERSION variable from mailcow.conf! Is your mailcow up to date? Exiting...\e[0m"
exit 1 exit 1
fi fi