mirror of
https://github.com/Mailu/Mailu.git
synced 2025-02-09 13:23:54 +02:00
Remove WEB_ variables from setup.
Setup is meant for the standard use case where you don't change WEB_*. WEB_* can still be changed via mailu.env
This commit is contained in:
parent
0e04871cbe
commit
823b01041a
@ -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 }}
|
||||
|
@ -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))
|
||||
|
@ -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("");
|
||||
|
@ -60,8 +60,8 @@ Or in plain English: if receivers start to classify your mail as spam, this post
|
||||
|
||||
<div class="form-check form-check-inline">
|
||||
<label class="form-check-label">
|
||||
<input class="form-check-input" type="checkbox" name="disable_statistics" value="True">
|
||||
Opt-out of statistics
|
||||
<input class="form-check-input" type="checkbox" name="statistics_enabled" value="True">
|
||||
Opt-in for anonymized statistics
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -82,8 +82,7 @@ manage your email domains, users, etc.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="checkbox" name="admin_enabled" value="true" id="admin" checked>
|
||||
<label>Enable the admin UI (and path to the admin UI)</label>
|
||||
<input class="form-control" type="text" name="admin_path" id="admin_path" style="display: none">
|
||||
<label>Enable the admin UI</label>
|
||||
</div>
|
||||
|
||||
<p>The API interface is a RESTful API for changing the Mailu configuration.
|
||||
@ -93,8 +92,8 @@ manage your email domains, users, etc.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="checkbox" name="api_enabled" value="true" id="api_enabled" >
|
||||
<label>Enable the API (and path to the API)</label>
|
||||
<input class="form-control" type="text" name="api_path" id="api_path" style="display: none">
|
||||
<label>Enable the API</label>
|
||||
<br>
|
||||
<label name="api_token_label" id="api_token_label">API token</label>
|
||||
<input class="form-control" type="text" name="api_token" id="api_token" style="display: none" value="{{ secret(32) }}">
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user