1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-25 07:47:05 +00:00

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

View File

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