1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-12 10:45:38 +02:00

Move sieve script generation to the admin container

This commit is contained in:
kaiyou 2018-09-27 08:11:26 +02:00
parent cfeaa189f9
commit 4d25083847
7 changed files with 9 additions and 15 deletions

View File

@ -6,7 +6,7 @@ import socket
import flask
internal = flask.Blueprint('internal', __name__)
internal = flask.Blueprint('internal', __name__, template_folder='templates')
@internal.app_errorhandler(RateLimitExceeded)
def rate_limit_handler(e):

View File

@ -8,8 +8,6 @@ require "regex";
require "relational";
require "date";
require "comparator-i;ascii-numeric";
require "vnd.dovecot.extdata";
require "vnd.dovecot.execute";
require "spamtestplus";
require "editheader";
require "index";
@ -20,21 +18,23 @@ if header :index 2 :matches "Received" "from * by * for <*>; *"
addheader "Delivered-To" "<${3}>";
}
if allof (string :is "${extdata.spam_enabled}" "1",
spamtest :percent :value "gt" :comparator "i;ascii-numeric" "${extdata.spam_threshold}")
{% if user.spam_enabled %}
if spamtest :percent :value "gt" :comparator "i;ascii-numeric" "{{ user.spam_threshold }}"
{
setflag "\\seen";
fileinto :create "Junk";
stop;
}
{% endif %}
if exists "X-Virus" {
discard;
stop;
}
if allof (string :is "${extdata.reply_enabled}" "1",
currentdate :value "le" "date" "${extdata.reply_enddate}")
{% if user.reply_enabled %}
if currentdate :value "le" "date" "{{ user.reply_enddate }}"
{
vacation :days 1 :subject "${extdata.reply_subject}" "${extdata.reply_body}";
vacation :days 1 :subject "{{ user.reply_subject }}" "{{ user.reply_body }}";
}
{% endif %}

View File

@ -122,7 +122,7 @@ def dovecot_quota(ns, user_email):
def dovecot_sieve(script, user_email):
user = models.User.query.get(user_email) or flask.abort(404)
if script == "default":
pass
return flask.jsonify(flask.render_template("default.sieve"))
else:
flask.abort(404)

View File

@ -139,9 +139,6 @@ plugin {
sieve = dict:proxy:/tmp/podop.socket:sieve
sieve_plugins = sieve_imapsieve sieve_extprograms
sieve_global_extensions = +spamtest +spamtestplus +vnd.dovecot.execute +editheader
sieve_before = /var/lib/dovecot/before.sieve
sieve_default = /var/lib/dovecot/default.sieve
sieve_after = /var/lib/dovecot/after.sieve
# Sieve execute
sieve_execute_bin_dir = /var/lib/dovecot/bin

View File

@ -1,3 +0,0 @@
#!/bin/sh
rspamc -h antispam:11334 -P mailu "learn_$1" /dev/stdin <&0