mirror of
https://github.com/Mailu/Mailu.git
synced 2025-03-03 14:52:36 +02:00
Implement FETCHMAIL_ENABLED
This commit is contained in:
parent
e600f20762
commit
8a60b658b4
@ -16,13 +16,14 @@ DEFAULT_CONFIG = {
|
||||
'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
|
||||
@ -59,7 +60,7 @@ DEFAULT_CONFIG = {
|
||||
# Web settings
|
||||
'SITENAME': 'Mailu',
|
||||
'WEBSITE': 'https://mailu.io',
|
||||
'ADMIN' : 'none',
|
||||
'ADMIN': 'none',
|
||||
'WEB_ADMIN': '/admin',
|
||||
'WEB_WEBMAIL': '/webmail',
|
||||
'WEBMAIL': 'none',
|
||||
|
@ -31,12 +31,14 @@
|
||||
<p>{% trans %}Auto-reply{% endtrans %}</p>
|
||||
</a>
|
||||
</li>
|
||||
{%- if config["FETCHMAIL_ENABLED"] %}
|
||||
<li class="nav-item" role="none">
|
||||
<a href="{{ url_for('.fetch_list') }}" class="nav-link" role="menuitem">
|
||||
<i class="nav-icon fas fa-download"></i>
|
||||
<p>{% trans %}Fetched accounts{% endtrans %}</p>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif %}
|
||||
<li class="nav-item" role="none">
|
||||
<a href="{{ url_for('.token_list') }}" class="nav-link" role="menuitem">
|
||||
<i class="nav-icon fas fa-ticket-alt"></i>
|
||||
|
@ -1,5 +1,6 @@
|
||||
from mailu import models
|
||||
from mailu.ui import ui, forms, access
|
||||
from flask import current_app as app
|
||||
|
||||
import flask
|
||||
import flask_login
|
||||
@ -10,6 +11,8 @@ import wtforms
|
||||
@ui.route('/fetch/list/<path:user_email>', methods=['GET'])
|
||||
@access.owner(models.User, 'user_email')
|
||||
def fetch_list(user_email):
|
||||
if not app.config['FETCHMAIL_ENABLED']:
|
||||
flask.abort(404)
|
||||
user_email = user_email or flask_login.current_user.email
|
||||
user = models.User.query.get(user_email) or flask.abort(404)
|
||||
return flask.render_template('fetch/list.html', user=user)
|
||||
@ -19,6 +22,8 @@ def fetch_list(user_email):
|
||||
@ui.route('/fetch/create/<path:user_email>', methods=['GET', 'POST'])
|
||||
@access.owner(models.User, 'user_email')
|
||||
def fetch_create(user_email):
|
||||
if not app.config['FETCHMAIL_ENABLED']:
|
||||
flask.abort(404)
|
||||
user_email = user_email or flask_login.current_user.email
|
||||
user = models.User.query.get(user_email) or flask.abort(404)
|
||||
form = forms.FetchForm()
|
||||
@ -37,6 +42,8 @@ def fetch_create(user_email):
|
||||
@ui.route('/fetch/edit/<fetch_id>', methods=['GET', 'POST'])
|
||||
@access.owner(models.Fetch, 'fetch_id')
|
||||
def fetch_edit(fetch_id):
|
||||
if not app.config['FETCHMAIL_ENABLED']:
|
||||
flask.abort(404)
|
||||
fetch = models.Fetch.query.get(fetch_id) or flask.abort(404)
|
||||
form = forms.FetchForm(obj=fetch)
|
||||
if form.validate_on_submit():
|
||||
@ -55,6 +62,8 @@ def fetch_edit(fetch_id):
|
||||
@access.confirmation_required("delete a fetched account")
|
||||
@access.owner(models.Fetch, 'fetch_id')
|
||||
def fetch_delete(fetch_id):
|
||||
if not app.config['FETCHMAIL_ENABLED']:
|
||||
flask.abort(404)
|
||||
fetch = models.Fetch.query.get(fetch_id) or flask.abort(404)
|
||||
user = fetch.user
|
||||
models.db.session.delete(fetch)
|
||||
|
@ -102,6 +102,9 @@ support or e.g. mismatching TLS versions to deliver emails to Mailu.
|
||||
|
||||
.. _fetchmail:
|
||||
|
||||
When ``FETCHMAIL_ENABLED`` is set to ``True``, the fetchmail functionality is shown in the admin interface.
|
||||
The container itself still needs to be deployed manually. As fetchmail is optional, ``FETCHMAIL_ENABLED`` defaults to ``False``.
|
||||
|
||||
The ``FETCHMAIL_DELAY`` is a delay (in seconds) for the fetchmail service to
|
||||
go and fetch new email if available. Do not use too short delays if you do not
|
||||
want to be blacklisted by external services, but not too long delays if you
|
||||
|
@ -79,6 +79,9 @@ RELAYNETS=
|
||||
# Will relay all outgoing mails if configured
|
||||
RELAYHOST={{ relayhost }}
|
||||
|
||||
# Show fetchmail functionality in admin interface
|
||||
FETCHMAIL_ENABLED={{ fetchmail_enabled or 'False' }}
|
||||
|
||||
# Fetchmail delay
|
||||
FETCHMAIL_DELAY={{ fetchmail_delay or '600' }}
|
||||
|
||||
|
1
towncrier/newsfragments/2127.feature
Normal file
1
towncrier/newsfragments/2127.feature
Normal file
@ -0,0 +1 @@
|
||||
Add FETCHMAIL_ENABLED to toggle the fetchmail functionality in the admin interface
|
Loading…
x
Reference in New Issue
Block a user