diff --git a/core/admin/assets/Dockerfile b/core/admin/assets/Dockerfile index 613aa6c0..33b9bdb9 100644 --- a/core/admin/assets/Dockerfile +++ b/core/admin/assets/Dockerfile @@ -5,7 +5,6 @@ FROM node:16-alpine3.16 WORKDIR /work COPY package.json ./ -COPY webpack.config.js ./ RUN set -euxo pipefail \ ; npm config set update-notifier false \ @@ -17,6 +16,7 @@ RUN set -euxo pipefail \ done COPY assets/ ./assets/ +COPY webpack.config.js ./ RUN set -euxo pipefail \ ; node_modules/.bin/webpack-cli --color diff --git a/core/admin/assets/assets/app.js b/core/admin/assets/assets/app.js index ad2b543a..661e0242 100644 --- a/core/admin/assets/assets/app.js +++ b/core/admin/assets/assets/app.js @@ -1,8 +1,3 @@ -require('./app.css'); - -import logo from './mailu.png'; -import modules from "./*.json"; - // Inspired from https://github.com/mehdibo/hibp-js/blob/master/hibp.js function sha1(string) { var buffer = new TextEncoder("utf-8").encode(string); diff --git a/core/admin/assets/assets/vendor.js b/core/admin/assets/assets/vendor.js index 906448cf..819240ad 100644 --- a/core/admin/assets/assets/vendor.js +++ b/core/admin/assets/assets/vendor.js @@ -1,5 +1,5 @@ // AdminLTE -import 'admin-lte/plugins/jquery/jquery.min.js'; +window.$ = window.jQuery = require('admin-lte/plugins/jquery/jquery.min.js'); import 'admin-lte/plugins/bootstrap/js/bootstrap.bundle.min.js'; import 'admin-lte/build/scss/adminlte.scss'; import 'admin-lte/build/js/AdminLTE.js'; @@ -18,7 +18,7 @@ import 'admin-lte/plugins/datatables/jquery.dataTables.min.js'; import 'admin-lte/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'; import 'admin-lte/plugins/datatables-responsive/js/dataTables.responsive.min.js'; import 'admin-lte/plugins/datatables-responsive/js/responsive.bootstrap4.min.js'; +import modules from "./*.json"; // clipboard.js -import 'clipboard/dist/clipboard.min.js'; - +window.ClipboardJS = require('clipboard/dist/clipboard.min.js'); diff --git a/core/admin/assets/webpack.config.js b/core/admin/assets/webpack.config.js index 25c966c1..8c3d6c27 100644 --- a/core/admin/assets/webpack.config.js +++ b/core/admin/assets/webpack.config.js @@ -9,7 +9,7 @@ module.exports = { mode: 'production', entry: { app: { - import: './assets/app.js', + import: ['./assets/app.css', './assets/mailu.png', './assets/app.js'], dependOn: 'vendor', }, vendor: './assets/vendor.js', diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py index b941e95c..d282bfc2 100644 --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -13,17 +13,19 @@ DEFAULT_CONFIG = { 'RATELIMIT_STORAGE_URL': '', 'DEBUG': False, 'DEBUG_PROFILER': False, + 'DEBUG_TB_INTERCEPT_REDIRECTS': False, 'DEBUG_ASSETS': '', 'DOMAIN_REGISTRATION': False, 'TEMPLATES_AUTO_RELOAD': True, 'MEMORY_SESSIONS': False, + 'FETCHMAIL_ENABLED': False, # Database settings 'DB_FLAVOR': None, 'DB_USER': 'mailu', 'DB_PW': None, 'DB_HOST': 'database', 'DB_NAME': 'mailu', - 'SQLITE_DATABASE_FILE':'data/main.db', + 'SQLITE_DATABASE_FILE': 'data/main.db', 'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db', 'SQLALCHEMY_TRACK_MODIFICATIONS': False, # Statistics management @@ -60,7 +62,7 @@ DEFAULT_CONFIG = { # Web settings 'SITENAME': 'Mailu', 'WEBSITE': 'https://mailu.io', - 'ADMIN' : 'none', + 'ADMIN': 'none', 'WEB_ADMIN': '/admin', 'WEB_WEBMAIL': '/webmail', 'WEBMAIL': 'none', @@ -73,7 +75,7 @@ DEFAULT_CONFIG = { 'SESSION_KEY_BITS': 128, 'SESSION_TIMEOUT': 3600, 'PERMANENT_SESSION_LIFETIME': 30*24*3600, - 'SESSION_COOKIE_SECURE': True, + 'SESSION_COOKIE_SECURE': None, 'CREDENTIAL_ROUNDS': 12, 'TLS_PERMISSIVE': True, 'TZ': 'Etc/UTC', @@ -156,6 +158,8 @@ class ConfigManager: self.config['SESSION_STORAGE_URL'] = f'redis://{self.config["REDIS_ADDRESS"]}/3' self.config['SESSION_COOKIE_SAMESITE'] = 'Strict' self.config['SESSION_COOKIE_HTTPONLY'] = True + if self.config['SESSION_COOKIE_SECURE'] is None: + self.config['SESSION_COOKIE_SECURE'] = self.config['TLS_FLAVOR'] != 'notls' self.config['SESSION_PERMANENT'] = True self.config['SESSION_TIMEOUT'] = int(self.config['SESSION_TIMEOUT']) self.config['PERMANENT_SESSION_LIFETIME'] = int(self.config['PERMANENT_SESSION_LIFETIME']) diff --git a/core/admin/mailu/ui/templates/sidebar.html b/core/admin/mailu/ui/templates/sidebar.html index a57a2abe..54448c8b 100644 --- a/core/admin/mailu/ui/templates/sidebar.html +++ b/core/admin/mailu/ui/templates/sidebar.html @@ -31,12 +31,14 @@

{% trans %}Auto-reply{% endtrans %}

+ {%- if config["FETCHMAIL_ENABLED"] %} + {%- endif %}