From 6fbb3874883cf0e4c0d470ec54788b63cac243a1 Mon Sep 17 00:00:00 2001 From: Tad Wang Date: Thu, 21 Jan 2016 11:53:56 +0800 Subject: [PATCH 1/2] fix wss support for web_monitor_uri Https support --- jlog/views.py | 2 +- templates/jlog/log_online.html | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jlog/views.py b/jlog/views.py index ff0eaf1c0..e2565250e 100644 --- a/jlog/views.py +++ b/jlog/views.py @@ -66,7 +66,7 @@ def log_list(request, offset): contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request) - web_monitor_uri = 'ws://%s/monitor' % WEB_SOCKET_HOST + web_monitor_uri = '%s/monitor' % WEB_SOCKET_HOST web_kill_uri = 'http://%s/kill' % WEB_SOCKET_HOST session_id = request.session.session_key return render_to_response('jlog/log_%s.html' % offset, locals(), context_instance=RequestContext(request)) diff --git a/templates/jlog/log_online.html b/templates/jlog/log_online.html index 14e55f957..d934a125e 100644 --- a/templates/jlog/log_online.html +++ b/templates/jlog/log_online.html @@ -136,8 +136,13 @@ {# })#} {# });#} function init(obj){ + var protocol = "ws://"; + if (window.location.protocol == 'https:') { + protocol = 'wss://'; + } + var file_path = obj.attr('file_path'); - var wsUri = '{{ web_monitor_uri }}'; + var wsUri = protocol + '{{ web_monitor_uri }}'; var socket = new WebSocket(wsUri + '?file_path=' + file_path); var term = new Terminal({ From 852de35e3e7e3721f275e7b8d07e2a1786a75804 Mon Sep 17 00:00:00 2001 From: Tad Wang Date: Thu, 21 Jan 2016 13:02:23 +0800 Subject: [PATCH 2/2] fix term.js input error problem handler is undefined. --- templates/jlog/log_online.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/jlog/log_online.html b/templates/jlog/log_online.html index d934a125e..f82969156 100644 --- a/templates/jlog/log_online.html +++ b/templates/jlog/log_online.html @@ -146,9 +146,10 @@ var socket = new WebSocket(wsUri + '?file_path=' + file_path); var term = new Terminal({ - cols: 80, - rows: 24, - screenKeys: false + cols: 80, + rows: 24, + screenKeys: false, + handler: function(){return false} }); var tag = $('
');