From 3c9c01f8eb01aa92937bd4f5464d043fc111a7ae Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 23 Jan 2023 22:41:01 +0100 Subject: [PATCH 1/9] Add style for responsive design --- webmails/roundcube/login/skins/elastic/mailu.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webmails/roundcube/login/skins/elastic/mailu.css b/webmails/roundcube/login/skins/elastic/mailu.css index a14d25b1..648609b3 100644 --- a/webmails/roundcube/login/skins/elastic/mailu.css +++ b/webmails/roundcube/login/skins/elastic/mailu.css @@ -9,3 +9,13 @@ color: #fff; background-color: #45555c; } +@media screen and (max-width: 480px) { + #taskmenu a.button-mailu { + background-position: 0px; + background-size: 40px 40px; + } + #taskmenu a.button-mailu.selected, #taskmenu a.button-mailu.selected:hover, #taskmenu a.button-mailu:hover { + color: #000; + background-color: #ececec; + } +} From 65595d139a0a7cf8f09a4ebaabf3174b02fbfaa3 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 23 Jan 2023 22:41:13 +0100 Subject: [PATCH 2/9] Set default sort order for all lists --- core/admin/mailu/ui/templates/admin/list.html | 2 +- core/admin/mailu/ui/templates/alias/list.html | 2 +- core/admin/mailu/ui/templates/alternative/list.html | 2 +- core/admin/mailu/ui/templates/fetch/list.html | 2 +- core/admin/mailu/ui/templates/manager/list.html | 2 +- core/admin/mailu/ui/templates/token/list.html | 2 +- core/admin/mailu/ui/templates/user/list.html | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/admin/mailu/ui/templates/admin/list.html b/core/admin/mailu/ui/templates/admin/list.html index e50c0ee6..05f9e68d 100644 --- a/core/admin/mailu/ui/templates/admin/list.html +++ b/core/admin/mailu/ui/templates/admin/list.html @@ -11,7 +11,7 @@ {%- endblock %} {%- block content %} -{%- call macros.table() %} +{%- macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/alias/list.html b/core/admin/mailu/ui/templates/alias/list.html index 833e44c1..76e28624 100644 --- a/core/admin/mailu/ui/templates/alias/list.html +++ b/core/admin/mailu/ui/templates/alias/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- call macros.table() %} +{%- macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/alternative/list.html b/core/admin/mailu/ui/templates/alternative/list.html index 97482ac3..d55bd0dd 100644 --- a/core/admin/mailu/ui/templates/alternative/list.html +++ b/core/admin/mailu/ui/templates/alternative/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- call macros.table() %} +{%- macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/fetch/list.html b/core/admin/mailu/ui/templates/fetch/list.html index 74d3a02f..d26c164f 100644 --- a/core/admin/mailu/ui/templates/fetch/list.html +++ b/core/admin/mailu/ui/templates/fetch/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- call macros.table() %} +{%- macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/manager/list.html b/core/admin/mailu/ui/templates/manager/list.html index 95dc9f4a..b08dab6b 100644 --- a/core/admin/mailu/ui/templates/manager/list.html +++ b/core/admin/mailu/ui/templates/manager/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- call macros.table(order='[[2,"asc"]]') %} +{%- call macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/token/list.html b/core/admin/mailu/ui/templates/token/list.html index a6eee9c3..e25111c9 100644 --- a/core/admin/mailu/ui/templates/token/list.html +++ b/core/admin/mailu/ui/templates/token/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- call macros.table() %} +{%- macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/user/list.html b/core/admin/mailu/ui/templates/user/list.html index 873c37e8..28fa2ca8 100644 --- a/core/admin/mailu/ui/templates/user/list.html +++ b/core/admin/mailu/ui/templates/user/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- call macros.table() %} +{%- macros.table(order='[[2,"asc"]]') %} {% trans %}Actions{% endtrans %} From 3af3aa93957446762d6d916c432cbe01e024de31 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 23 Jan 2023 23:00:59 +0100 Subject: [PATCH 3/9] Show quota in domain list --- core/admin/mailu/ui/templates/domain/list.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/admin/mailu/ui/templates/domain/list.html b/core/admin/mailu/ui/templates/domain/list.html index 4889bc8d..c4b4cd51 100644 --- a/core/admin/mailu/ui/templates/domain/list.html +++ b/core/admin/mailu/ui/templates/domain/list.html @@ -19,6 +19,7 @@ {% trans %}Domain name{% endtrans %} {% trans %}Mailbox count{% endtrans %} {% trans %}Alias count{% endtrans %} + {% trans %}Quota{% endtrans %} {% trans %}Comment{% endtrans %} {% trans %}Enable sign-up{% endtrans %} {% trans %}Created{% endtrans %} @@ -46,6 +47,7 @@ {{ domain.name }} {{ domain.users | count }} / {{ '∞' if domain.max_users == -1 else domain.max_users }} {{ domain.aliases | count }} / {{ '∞' if domain.max_aliases == -1 else domain.max_aliases }} + {{ (domain.max_quota_bytes | filesizeformat) if domain.max_quota_bytes else '∞' }} {{ domain.comment or '' }} {% if domain.signup_enabled %}{% trans %}yes{% endtrans %}{% else %}{% trans %}no{% endtrans %}{% endif %} {{ domain.created_at | format_date }} From 31e974f829f99ca2f55eac6f3a5233c530cd8918 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 23 Jan 2023 23:01:17 +0100 Subject: [PATCH 4/9] Add edit button to admin and manager lists --- core/admin/mailu/ui/templates/admin/list.html | 1 + core/admin/mailu/ui/templates/manager/list.html | 1 + 2 files changed, 2 insertions(+) diff --git a/core/admin/mailu/ui/templates/admin/list.html b/core/admin/mailu/ui/templates/admin/list.html index 05f9e68d..0ccc396d 100644 --- a/core/admin/mailu/ui/templates/admin/list.html +++ b/core/admin/mailu/ui/templates/admin/list.html @@ -22,6 +22,7 @@ {%- for admin in admins %} +   {{ admin }} diff --git a/core/admin/mailu/ui/templates/manager/list.html b/core/admin/mailu/ui/templates/manager/list.html index b08dab6b..6ec0c8e9 100644 --- a/core/admin/mailu/ui/templates/manager/list.html +++ b/core/admin/mailu/ui/templates/manager/list.html @@ -24,6 +24,7 @@ {%- for manager in domain.managers %} +   {{ manager }} From 2fa0461803bdea12ee063c251fc3e70d19738ca7 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Wed, 25 Jan 2023 20:46:24 +0100 Subject: [PATCH 5/9] Fix sliders --- core/admin/assets/assets/app.js | 7 +++++-- core/admin/mailu/ui/templates/domain/create.html | 2 +- core/admin/mailu/ui/templates/user/create.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/admin/assets/assets/app.js b/core/admin/assets/assets/app.js index 661e0242..a5338878 100644 --- a/core/admin/assets/assets/app.js +++ b/core/admin/assets/assets/app.js @@ -86,9 +86,12 @@ $('document').ready(function() { if (value_element.length) { value_element = $(value_element[0]); var infinity = $(this).data('infinity'); - var step = $(this).attr('step'); + var unit = $(this).attr('unit'); + if (typeof unit === 'undefined' && unit === false) { + unit=1; + } $(this).on('input', function() { - var num = (infinity && this.value == 0) ? '∞' : (this.value/step).toFixed(2); + var num = (infinity && this.value == 0) ? '∞' : (this.value/unit).toFixed(2); if (num.endsWith('.00')) num = num.substr(0, num.length - 3); value_element.text(num); }).trigger('input'); diff --git a/core/admin/mailu/ui/templates/domain/create.html b/core/admin/mailu/ui/templates/domain/create.html index f0d5308d..5674e52b 100644 --- a/core/admin/mailu/ui/templates/domain/create.html +++ b/core/admin/mailu/ui/templates/domain/create.html @@ -10,7 +10,7 @@ {{ form.hidden_tag() }} {{ macros.form_field(form.name) }} {{ macros.form_fields((form.max_users, form.max_aliases)) }} - {{ macros.form_field(form.max_quota_bytes, step=50*10**6, max=50*10**9, data_infinity="true", + {{ macros.form_field(form.max_quota_bytes, unit=10**9, step=50*10**6, max=50*10**9, data_infinity="true", prepend=' GB') }} {{ macros.form_field(form.signup_enabled) }} {{ macros.form_field(form.comment) }} diff --git a/core/admin/mailu/ui/templates/user/create.html b/core/admin/mailu/ui/templates/user/create.html index 495e788b..ba8904f6 100644 --- a/core/admin/mailu/ui/templates/user/create.html +++ b/core/admin/mailu/ui/templates/user/create.html @@ -21,7 +21,7 @@ {%- endcall %} {%- call macros.card(_("Features and quotas"), theme="success") %} - {{ macros.form_field(form.quota_bytes, step=50*10**6, max=(max_quota_bytes or domain.max_quota_bytes or 50*10**9), data_infinity="true", + {{ macros.form_field(form.quota_bytes, unit=10**9, step=50*10**6, max=(max_quota_bytes or domain.max_quota_bytes or 50*10**9), data_infinity="true", prepend=' GB') }} {{ macros.form_field(form.enable_imap) }} {{ macros.form_field(form.enable_pop) }} From 8b0b87984dfcb69d9fa8e2770b32bbab86d5dcc5 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 26 Jan 2023 20:10:51 +0100 Subject: [PATCH 6/9] Duh. Fix macros call --- core/admin/mailu/ui/templates/admin/list.html | 2 +- core/admin/mailu/ui/templates/alias/list.html | 2 +- core/admin/mailu/ui/templates/alternative/list.html | 2 +- core/admin/mailu/ui/templates/fetch/list.html | 2 +- core/admin/mailu/ui/templates/token/list.html | 2 +- core/admin/mailu/ui/templates/user/list.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/admin/mailu/ui/templates/admin/list.html b/core/admin/mailu/ui/templates/admin/list.html index 0ccc396d..4fb9e32d 100644 --- a/core/admin/mailu/ui/templates/admin/list.html +++ b/core/admin/mailu/ui/templates/admin/list.html @@ -11,7 +11,7 @@ {%- endblock %} {%- block content %} -{%- macros.table(order='[[1,"asc"]]') %} +{%- call macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/alias/list.html b/core/admin/mailu/ui/templates/alias/list.html index 76e28624..63dcb306 100644 --- a/core/admin/mailu/ui/templates/alias/list.html +++ b/core/admin/mailu/ui/templates/alias/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- macros.table(order='[[1,"asc"]]') %} +{%- call macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/alternative/list.html b/core/admin/mailu/ui/templates/alternative/list.html index d55bd0dd..4b8397cf 100644 --- a/core/admin/mailu/ui/templates/alternative/list.html +++ b/core/admin/mailu/ui/templates/alternative/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- macros.table(order='[[1,"asc"]]') %} +{%- call macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/fetch/list.html b/core/admin/mailu/ui/templates/fetch/list.html index d26c164f..c021096e 100644 --- a/core/admin/mailu/ui/templates/fetch/list.html +++ b/core/admin/mailu/ui/templates/fetch/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- macros.table(order='[[1,"asc"]]') %} +{%- call macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/token/list.html b/core/admin/mailu/ui/templates/token/list.html index e25111c9..1e61cf6b 100644 --- a/core/admin/mailu/ui/templates/token/list.html +++ b/core/admin/mailu/ui/templates/token/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- macros.table(order='[[1,"asc"]]') %} +{%- call macros.table(order='[[1,"asc"]]') %} {% trans %}Actions{% endtrans %} diff --git a/core/admin/mailu/ui/templates/user/list.html b/core/admin/mailu/ui/templates/user/list.html index 28fa2ca8..8d9f2873 100644 --- a/core/admin/mailu/ui/templates/user/list.html +++ b/core/admin/mailu/ui/templates/user/list.html @@ -13,7 +13,7 @@ {%- endblock %} {%- block content %} -{%- macros.table(order='[[2,"asc"]]') %} +{%- call macros.table(order='[[2,"asc"]]') %} {% trans %}Actions{% endtrans %} From f00059d10cc47a1193fe69875fdda74a9de60ffa Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 27 Jan 2023 15:12:24 +0100 Subject: [PATCH 7/9] Show mailu version in web interface after logging in --- core/admin/mailu/configuration.py | 5 +++++ core/admin/mailu/ui/templates/base.html | 1 + 2 files changed, 6 insertions(+) diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py index 004fe504..11d79643 100644 --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -18,6 +18,7 @@ DEFAULT_CONFIG = { 'TEMPLATES_AUTO_RELOAD': True, 'MEMORY_SESSIONS': False, 'FETCHMAIL_ENABLED': True, + 'MAILU_VERSION': 'unknown', # Database settings 'DB_FLAVOR': None, 'DB_USER': 'mailu', @@ -157,6 +158,10 @@ class ConfigManager: self.config['HOSTNAME'] = hostnames[0] self.config['DEFAULT_SPAM_THRESHOLD'] = int(self.config['DEFAULT_SPAM_THRESHOLD']) self.config['PROXY_AUTH_WHITELIST'] = set(ipaddress.ip_network(cidr, False) for cidr in (cidr.strip() for cidr in self.config['PROXY_AUTH_WHITELIST'].split(',')) if cidr) + try: + self.config['MAILU_VERSION'] = open('/version', 'r').read() + except FileNotFoundError: + pass # update the app config app.config.update(self.config) diff --git a/core/admin/mailu/ui/templates/base.html b/core/admin/mailu/ui/templates/base.html index 2ab21492..f351f719 100644 --- a/core/admin/mailu/ui/templates/base.html +++ b/core/admin/mailu/ui/templates/base.html @@ -78,6 +78,7 @@ fork on Github +
{{ config["MAILU_VERSION"] }}
From 8f425ce081b614053bd052f0c8dca0ec46aac175 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 27 Jan 2023 15:28:58 +0100 Subject: [PATCH 8/9] Move unit to data-attr and fix defaulting to 1 --- core/admin/assets/assets/app.js | 4 ++-- core/admin/mailu/ui/templates/domain/create.html | 2 +- core/admin/mailu/ui/templates/user/create.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/admin/assets/assets/app.js b/core/admin/assets/assets/app.js index a5338878..33f63433 100644 --- a/core/admin/assets/assets/app.js +++ b/core/admin/assets/assets/app.js @@ -86,8 +86,8 @@ $('document').ready(function() { if (value_element.length) { value_element = $(value_element[0]); var infinity = $(this).data('infinity'); - var unit = $(this).attr('unit'); - if (typeof unit === 'undefined' && unit === false) { + var unit = $(this).data('unit'); + if (typeof unit === 'undefined' || unit === false) { unit=1; } $(this).on('input', function() { diff --git a/core/admin/mailu/ui/templates/domain/create.html b/core/admin/mailu/ui/templates/domain/create.html index 5674e52b..4eb7bfc8 100644 --- a/core/admin/mailu/ui/templates/domain/create.html +++ b/core/admin/mailu/ui/templates/domain/create.html @@ -10,7 +10,7 @@ {{ form.hidden_tag() }} {{ macros.form_field(form.name) }} {{ macros.form_fields((form.max_users, form.max_aliases)) }} - {{ macros.form_field(form.max_quota_bytes, unit=10**9, step=50*10**6, max=50*10**9, data_infinity="true", + {{ macros.form_field(form.max_quota_bytes, step=50*10**6, max=50*10**9, data_infinity="true", data_unit=10**9, prepend=' GB') }} {{ macros.form_field(form.signup_enabled) }} {{ macros.form_field(form.comment) }} diff --git a/core/admin/mailu/ui/templates/user/create.html b/core/admin/mailu/ui/templates/user/create.html index ba8904f6..dff78f64 100644 --- a/core/admin/mailu/ui/templates/user/create.html +++ b/core/admin/mailu/ui/templates/user/create.html @@ -21,7 +21,7 @@ {%- endcall %} {%- call macros.card(_("Features and quotas"), theme="success") %} - {{ macros.form_field(form.quota_bytes, unit=10**9, step=50*10**6, max=(max_quota_bytes or domain.max_quota_bytes or 50*10**9), data_infinity="true", + {{ macros.form_field(form.quota_bytes, step=50*10**6, max=(max_quota_bytes or domain.max_quota_bytes or 50*10**9), data_infinity="true", data_unit=10**9, prepend=' GB') }} {{ macros.form_field(form.enable_imap) }} {{ macros.form_field(form.enable_pop) }} From 50fc1cb8b320f15f40d1693db79ebd7354e2913c Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 27 Jan 2023 15:34:09 +0100 Subject: [PATCH 9/9] Move version style to app.css --- core/admin/assets/assets/app.css | 6 ++++++ core/admin/mailu/ui/templates/base.html | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/admin/assets/assets/app.css b/core/admin/assets/assets/app.css index 84644900..a25a4cfb 100644 --- a/core/admin/assets/assets/app.css +++ b/core/admin/assets/assets/app.css @@ -57,3 +57,9 @@ fieldset:disabled .form-control:disabled { .input-group-text { margin-right: 1em; } + +/* version string */ +.mailu-version { + font-size: 60%; + line-height: 0; +} diff --git a/core/admin/mailu/ui/templates/base.html b/core/admin/mailu/ui/templates/base.html index f351f719..6484b355 100644 --- a/core/admin/mailu/ui/templates/base.html +++ b/core/admin/mailu/ui/templates/base.html @@ -78,7 +78,11 @@ fork on Github -
{{ config["MAILU_VERSION"] }}
+
+ + {{ config["MAILU_VERSION"] }} + +