diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env index cffafe15..7c36a7ec 100644 --- a/setup/flavors/compose/mailu.env +++ b/setup/flavors/compose/mailu.env @@ -40,7 +40,11 @@ AUTH_RATELIMIT_USER={{ auth_ratelimit_user }}/day {% endif %} # Opt-out of statistics, replace with "True" to opt out -DISABLE_STATISTICS={{ disable_statistics or 'False' }} +{% if statistics_enabled %} +DISABLE_STATISTICS=False +{% else %} +DISABLE_STATISTICS=True +{% endif %} ################################### # Optional features @@ -120,24 +124,22 @@ FULL_TEXT_SEARCH=en ################################### # Path to redirect / to -{% if webmail_type != 'none' and webmail_path == '' %} -WEBROOT_REDIRECT=/ +{% if webmail_type != 'none' %} +WEBROOT_REDIRECT=/webmail +{% elif admin_enabled %} +WEBROOT_REDIRECT=/admin {% else %} -WEBROOT_REDIRECT={{ webmail_path }} +WEBROOT_REDIRECT= {% endif %} # Path to the admin interface if enabled -WEB_ADMIN={{ admin_path }} +WEB_ADMIN=/admin # Path to the webmail if enabled -{% if webmail_type != 'none' and webmail_path == '' %} -WEB_WEBMAIL=/ -{% else %} -WEB_WEBMAIL={{ webmail_path }} -{% endif %} +WEB_WEBMAIL=/webmail # Path to the API interface if enabled -WEB_API={{ api_path }} +WEB_API=/api # Website name SITENAME={{ site_name }} diff --git a/setup/server.py b/setup/server.py index 89a0815e..806be40e 100644 --- a/setup/server.py +++ b/setup/server.py @@ -120,28 +120,10 @@ def build_app(path): except ValueError as err: flask.flash('Invalid configuration: ' + str(err)) valid = False - if data['webmail_type'] != 'none': - if data['webmail_path'] == '': - flask.flash('Webmail path cannot be empty when webmail is enabled', 'error') - valid = False - if data['webmail_path'][0] != '/': - flask.flash('Webmail path must start with a leading slash "/"', 'error') - valid = False - if 'admin_enabled' in data: - if data['admin_enabled'] == 'true': - if data['admin_path'] == '': - flask.flash('Admin path cannot be empty when admin is enabled', 'error') - valid = False - if data['admin_path'][0] != '/': - flask.flash('Admin path must start with a leading slash "/"', 'error') - valid = False if 'api_enabled' in data: if (data['api_enabled'] == 'true'): - if data['api_path'] == '' or data['api_token'] == '': - flask.flash('API path and API token cannot be empty when API is enabled', 'error') - valid = False - if data['api_path'][0] != '/': - flask.flash('API path must start with a leading slash "/"', 'error') + if data['api_token'] == '': + flask.flash('API token cannot be empty when API is enabled', 'error') valid = False if valid: db.set(data['uid'], json.dumps(data)) diff --git a/setup/static/render.js b/setup/static/render.js index 5a7e0c56..cde25107 100644 --- a/setup/static/render.js +++ b/setup/static/render.js @@ -6,61 +6,13 @@ $(document).ready(function() { $("#container").show(); }); -$(document).ready(function() { - if ($("#webmail").val() == 'none') { - $("#webmail_path").hide(); - $("#webmail_path").val(""); - $("#webmail_path").prop('required',false); - } else { - $("#webmail_path").show(); - $("#webmail_path").val("/webmail"); - $("#webmail_path").prop('required',true); - } - $("#webmail").click(function() { - if (this.value == 'none') { - $("#webmail_path").hide(); - $("#webmail_path").val(""); - $("#webmail_path").prop('required',false); - } else { - $("#webmail_path").show(); - $("#webmail_path").val("/webmail"); - $("#webmail_path").prop('required',true); - } - }); -}); - -$(document).ready(function() { - if ($('#admin').prop('checked')) { - $("#admin_path").show(); - $("#admin_path").val("/admin"); - $("#admin_path").prop('required',true); - } - $("#admin").change(function() { - if ($(this).is(":checked")) { - $("#admin_path").show(); - $("#admin_path").val("/admin"); - $("#admin_path").prop('required',true); - } else { - $("#admin_path").hide(); - $("#admin_path").val(""); - $("#admin_path").prop('required',false); - } - }); -}); - $(document).ready(function() { if ($('#api_enabled').prop('checked')) { - $("#api_path").show(); - $("#api_path").prop('required',true); - $("#api_path").val("/api") $("#api_token").show(); $("#api_token").prop('required',true); $("#api_token").val(token); $("#api_token_label").show(); } else { - $("#api_path").hide(); - $("#api_path").prop('required',false); - $("#api_path").val("") $("#api_token").hide(); $("#api_token").prop('required',false); $("#api_token").val(""); @@ -68,17 +20,11 @@ $(document).ready(function() { } $("#api_enabled").change(function() { if ($(this).is(":checked")) { - $("#api_path").show(); - $("#api_path").prop('required',true); - $("#api_path").val("/api"); $("#api_token").show(); $("#api_token").prop('required',true); $("#api_token").val(token) $("#api_token_label").show(); } else { - $("#api_path").hide(); - $("#api_path").prop('required',false); - $("#api_path").val("") $("#api_token").hide(); $("#api_token").prop('required',false); $("#api_token").val(""); diff --git a/setup/templates/steps/config.html b/setup/templates/steps/config.html index c1a5ff43..e01d9c97 100644 --- a/setup/templates/steps/config.html +++ b/setup/templates/steps/config.html @@ -60,8 +60,8 @@ Or in plain English: if receivers start to classify your mail as spam, this post
@@ -82,8 +82,7 @@ manage your email domains, users, etc.

- - +

The API interface is a RESTful API for changing the Mailu configuration. @@ -93,8 +92,8 @@ manage your email domains, users, etc.

- - + +