debugging of image display

This commit is contained in:
John Supplee 2019-03-03 21:15:16 +02:00
parent e29e3a5cba
commit 7600e727c1
2 changed files with 8 additions and 5 deletions

View File

@ -1,5 +1,7 @@
import os, os.path, re, json, time
import subprocess
import base64
import sys
from functools import wraps
@ -521,16 +523,16 @@ def privacy_status_set():
return "OK"
# Mailgraph
import base64
@app.route('/mailgraph/image.cgi', methods=['GET'])
@authorized_personnel_only
def mailgraph():
if request.query_string:
query = request.query_string
query = request.query_string.decode('utf-8', 'ignore')
if '&' in query:
query = query.split('&')[0]
app.logger.error("QUERY_STRING=%s" % query)
print("QUERY_STRING=%s" % query, file=sys.stderr)
code, bin_out = utils.shell(
"check_output",
@ -541,7 +543,7 @@ def mailgraph():
)
if code != 0:
return ('Error generating mailgraph image: %s' % request.query_string, 500)
return ('Error generating mailgraph image: %s' % query, 500)
headers, image_bytes = bin_out.split(b'\n\n', 1)

View File

@ -34,8 +34,9 @@
<script type="text/javascript">
function show_mailgraph() {
$('[data-src]').each(function() {
var that = this;
api(
$(this).attr('data-src'),
$(that).attr('data-src'),
'GET',
'',
function(data) {