This commit is contained in:
Louis Vézina 2020-02-23 21:47:26 -05:00
parent 44f090fd92
commit 5466ce42e9
3 changed files with 9 additions and 126 deletions

View File

@ -14,7 +14,8 @@ def create_app():
# Flask Setup
app = Flask(__name__,
template_folder=os.path.join(os.path.dirname(__file__), '..', 'views'),
static_folder=os.path.join(os.path.dirname(__file__), '..', 'static'))
static_folder=os.path.join(os.path.dirname(__file__), '..', 'static'),
static_url_path=base_url + 'static')
app.route = prefix_route(app.route, base_url.rstrip('/'))
app.config["SECRET_KEY"] = 'test'
@ -38,7 +39,7 @@ def create_app():
def http_error_handler(error):
return redirect(base_url.rstrip('/')), 302
socketio.init_app(app)
socketio.init_app(app, path=base_url+'socket.io', cors_allowed_origins='*')
return app

View File

@ -280,10 +280,12 @@
});
events = io.connect({
'reconnection': true,
'reconnectionDelay': 1000,
'reconnectionDelayMax' : 3000,
'reconnectionAttempts': 3
path: '{{ settings.general.base_url }}socket.io',
upgrade: false,
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax : 3000,
reconnectionAttempts: 3
});
events.on('reconnect_failed', (reason) => {

View File

@ -1,120 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="{{base_url}}static/jquery/jquery-latest.min.js"></script>
<script src="{{base_url}}static/semantic/semantic.min.js"></script>
<script src="{{base_url}}static/jquery/tablesort.js"></script>
<link rel="stylesheet" href="{{base_url}}static/semantic/semantic.min.css">
<style>
body {
background-color: #272727;
}
</style>
</head>
<body>
<div id='logs_loader' class="ui page dimmer">
<div id="loader_text" class="ui indeterminate text loader">Loading...</div>
</div>
<div class="content">
<table class="ui very basic selectable table">
<thead>
<tr>
<th class="collapsing"></th>
<th>Message</th>
<th class="collapsing">Time</th>
</tr>
</thead>
<tbody>
%import time
%import datetime
%import pretty
%for log in logs:
%line = []
%line = log.split('|')
<tr class='log' data-message="\\
%try:
{{line[3]}}\\
%except:
\\
%end
" data-exception="\\
%try:
{{line[4]}}\\
%except:
\\
%end
">
<td class="collapsing"><i class="\\
%try:
%if line[1] == 'INFO ':
blue info circle icon \\
%elif line[1] == 'WARNING ':
yellow warning circle icon \\
%elif line[1] == 'ERROR ':
red bug icon \\
%elif line[1] == 'DEBUG ':
bug icon \\
%end
%except:
%pass
%end
"></i></td>
<td>\\
%try:
{{line[3]}}\\
%except:
\\
%end
</td>
<td title="\\
%try:
{{line[0]}}" class="collapsing">{{pretty.date(int(time.mktime(datetime.datetime.strptime(line[0], "%d/%m/%Y %H:%M:%S").timetuple())))}}</td>
%except:
" class="collapsing"></td>
%end
</tr>
%end
</tbody>
</table>
</div>
<div id="modal" class="ui small modal">
<i class="close icon"></i>
<div class="header">
<div>Details</div>
</div>
<div class="content">
Message
<div id='message' class="ui segment">
<p></p>
</div>
Exception
<div id='exception' class="ui segment">
<p></p>
</div>
</div>
<div class="actions">
<button class="ui cancel button" >Close</button>
</div>
</div>
</body>
</html>
<script>
$('.modal')
.modal({
autofocus: false
});
$('.log').on('click', function(){
$("#message").html($(this).data("message"));
let exception = $(this).data("exception");
exception = exception.replace(/'/g,"");
exception = exception.replace(/\\n\s\s\s\s/g, "\\n&emsp;&emsp;");
exception = exception.replace(/\\n\s\s/g, "\\n&emsp;");
exception = exception.replace(/\\n/g, "<br />");
$("#exception").html(exception);
$('#modal').modal('show');
});
</script>