Skip to content

Commit 9cc92d0

Browse files
authored
v.1.1.7.3 update
1 parent ac4103a commit 9cc92d0

File tree

7 files changed

+58
-24
lines changed

7 files changed

+58
-24
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ Unreleased VER.
66
- remove python privex helpers code (?)
77
- save settings into cookies + accept cookies modal (?)
88
- export to xlsx file (table) (?)
9+
- fix dropdown update if use fomantic ui div based dropdown
910

11+
12+
VER. 1.1.7.3
13+
- ~~BUG: postfix queue ID length may not be equal to 10 symbols~~
14+
- ~~BUG: exim wrong parsing mail_to for some bounces ~~
15+
- ~~add DLR developed logo in footer~~
1016
VER. 1.1.7.2
1117
- ~~BUG: log_lines filter outputs the same id emails (only exim?)~~
1218
- ~~BUG: dark mode filling text search with black font color instead of white~~

mlp/main.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@
3535

3636
# !!! change version upon update !!!
3737
global VERSION
38-
VERSION ="1.1.7.2"
38+
VERSION ="1.1.7.3"
3939

4040
# postfix regexp
4141
postf_match = r'([A-Za-z]+[ \t]+[0-9]+[ \t]+[0-9]+\:[0-9]+:[0-9]+).*'
4242
"""(0) Regex to match the Date/Time at the start of each log line"""
43-
postf_match += r'([A-F0-9]{11})\:[ \t]+?(.*)'
43+
# postf_match += r'([A-F0-9]{11})\:[ \t]+?(.*)'
44+
postf_match += r'\:[ \t]([A-F0-9]{1,15})\:[ \t]+?(.*)'
4445
"""Regex to match the (1) Queue ID and the (2) Log Message"""
4546

4647
# exim regexp (for syslog and separate mainlog)
@@ -144,40 +145,45 @@ async def import_log(logfile: str) -> Dict[str, PostfixMessage]:
144145
# avoid utf-8 codec error
145146
with open(logfile, 'rb') as f:
146147
while True:
148+
147149
line = f.readline().decode(errors='replace')
148150
if not line: break
149151

150152
m = match.match(line)
153+
151154
if not m: continue
152155

153156
dtime, qid, msg = m.groups()
154157
"""Thu Mar 09 2023 14:13:35 GMT+00:00 ---- '%a %b %d %Y %H:%M:%S %Z' """
155158
"""Mar 13 10:57:04
156159
dtime = datetime.strptime(dtime, '%b %d %H:%M:%S').replace(year=datetime.today().year).strftime('%d.%m.%Y-%H:%M:%S')
157160
print("New time stamp: "+ dtime)"""
161+
#log.info(m)
158162
#print("m.groups[1]: ",m.groups()[1])# - queue_id
159163
#print("m.groups[2]: ",m.groups()[2])# - message
160164
# merge multiple mail_to strings into one for the one queue_id
161165

162166
#m['mail_to'] += ", "+recipients
163167
#print("mail_to: ",m['mail_to'])
164-
168+
#print("mail_to: ",m['mail_to'])
165169
if qid not in messages:
166170
messages[qid] = PostfixMessage(timestamp=dtime, queue_id=qid)
167171
messages[qid].merge(await parse_line(msg))
168-
169-
cheking_mailto = messages[qid]['mail_to']
172+
#print(messages[qid])
173+
#print(msg)
174+
checking_mailto = messages[qid]['mail_to']
170175
if qid not in set(multiple_recipients):
171-
if qid == same_qid or same_qid=='':
176+
if qid == same_qid or same_qid == '':
172177
if messages[qid]['status'].get('code') is not None:
173-
# check if there are already recipients in message
174-
#print("Looking for ",cheking_mailto," in message '",msg, "' related to qid ", qid)
175-
if cheking_mailto in msg:
176-
same_qid = qid
177-
counter += 1
178+
# check if there are already recipients in message and there are recipients parsed
179+
#print("Looking for ",checking_mailto," in message \"",msg, "\" related to qid ", qid)
180+
if checking_mailto != '':
181+
if checking_mailto in msg:
182+
same_qid = qid
183+
counter += 1
178184
else:
179185
#print("New message ID: ", qid)
180-
#print("There are ", counter," recipients in message ",same_qid)
186+
#print("There are", counter,"recipients in message id",same_qid)
181187
if counter > 1:
182188
multiple_recipients.append(same_qid)
183189
counter = 0
@@ -239,6 +245,7 @@ async def main():
239245
r, conn, r_q = await get_rethink()
240246
r_q: rethinkdb.query
241247
"""housekeeping from old logs"""
248+
242249
housekeeping_days = settings.housekeeping_days
243250
if housekeeping_days != '':
244251
log.info('Start housekeeping')
@@ -301,7 +308,7 @@ async def main():
301308
continue
302309
# check if there are many recipients
303310
if m.get('id') in set(multiple_recipients):
304-
#print("There multiple recipients in ",m.get('id'))
311+
print("There multiple recipients in ",m.get('id'))
305312
m['mail_to'] += " and more (check log lines)"
306313
m['status']['code'] = 'multiple'
307314
m['status']['message'] = 'multiple, see log lines below'

mlp/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# exim regexp
3434
exim_to = re.compile(r'.*>.(.*).R=')
3535
exim_from = re.compile(r'.*<=.(.*).H=|.*F=<(.*)>')
36+
#exim_from = re.compile(r'.*<=.(.*).H=|.*F=<(.*)>|.*\*\*.(.*).R=')
3637
exim_subject = re.compile(r'.*Subject:\s(.*)')
3738
exim_size = re.compile(r'.*S=([0-9]{1,}).*')
3839
exim_message_id = re.compile(r'.*<=.*id=(.*)')
@@ -94,7 +95,7 @@ async def parse_line(mline) -> dict:
9495
_client = find_client.match(mline)
9596
_relay = find_relay.match(mline)
9697
_status = find_status.match(mline)
97-
98+
9899
if _to is not None: lm['mail_to'] = _to.group(1)
99100
if _subject is not None: lm['subject'] = _subject.group(1)
100101
if _size is not None: lm['size'] = round(float(_size.group(1))/1024, 2)

mlp/static/css/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@
1414
#app.dark .ui.inverted.segment, .ui.inverted.segments .segment, .ui.primary.inverted.segment {
1515
background: #2b2b2b;
1616
}
17+
#app.dark .developed_by {
18+
filter: brightness(1);
19+
}
20+
.developed_by {
21+
display: inline;
22+
height: 55px;
23+
opacity: .7;
24+
filter: brightness(0);
25+
/*position: absolute;
26+
right: 0px;
27+
top: 5px;
28+
margin-right: 10px;*/
29+
}
1730

1831
/*#app.dark #emails_list > div.top_title > div.logo > div.field.wrapper, #app.dark div.logo.login {
1932
filter: invert(1);
@@ -359,6 +372,8 @@ summary {
359372
/*all buttons except ui.buttons div*/
360373
button:not(.navi), #footer {
361374
width:100%;
375+
display: flex;
376+
justify-content: space-between;
362377
}
363378
/* fix of calendar z-index over modals*/
364379
.ui.popup {
10.5 KB
Loading

mlp/templates/base.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,19 @@
7272
{% block content %}{% endblock %}
7373

7474
<div v-if="!loading" class="ui segment" id="footer">
75-
<span v-if="localeData.footer.two" v-html="localeData.footer.two"></span>
76-
<span v-else v-html="fallbackLocaleData.footer.two"></span>
77-
{{ VERSION }}
78-
<span v-if="localeData.footer.three" v-html="localeData.footer.three"></span>
79-
<span v-else v-html="fallbackLocaleData.footer.three"></span>
80-
<br>
81-
<span style="opacity:.5;" v-if="localeData.footer.one" v-html="localeData.footer.one"></span>
82-
<span style="opacity:.5;" v-else v-html="fallbackLocaleData.footer.one"></span>
83-
75+
<div>
76+
<span v-if="localeData.footer.two" v-html="localeData.footer.two"></span>
77+
<span v-else v-html="fallbackLocaleData.footer.two"></span>
78+
{{ VERSION }}
79+
<span v-if="localeData.footer.three" v-html="localeData.footer.three"></span>
80+
<span v-else v-html="fallbackLocaleData.footer.three"></span>
81+
<br>
82+
<span style="opacity:.5;" v-if="localeData.footer.one" v-html="localeData.footer.one"></span>
83+
<span style="opacity:.5;" v-else v-html="fallbackLocaleData.footer.one"></span>
84+
</div>
85+
<a target="_blank" href="https://github.com/drlight17">
86+
<img class="developed_by" src="{{ url_for('static', filename='images/developed_by_drlight.png') }}" />
87+
</a>
8488
</div>
8589
</div>
8690

mlp/webui.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ async def api_emails():
185185
search_string = str(frm.pop('mail_to'))#.lower()
186186
recipient_match = ''
187187
if settings.mta == 'exim':
188-
recipient_match = "-> |=> |== |>> "
188+
recipient_match = "** |-> |=> |== |>> "
189+
#recipient_match = "-> |=> |== |>> "
189190
#recipient_match = "->|=>|==|>> "
190191
if settings.mta == 'sendmail' or settings.mta == 'postfix':
191192
recipient_match = "^to="

0 commit comments

Comments
 (0)