mirror of https://github.com/jumpserver/jumpserver
Merge pull request #38 from wptad/master
fix wss issue when using https #37 支持 wss 和 httpspull/45/merge
commit
80fde52dc5
|
@ -344,7 +344,7 @@ def download(request):
|
||||||
def exec_cmd(request):
|
def exec_cmd(request):
|
||||||
role = request.GET.get('role')
|
role = request.GET.get('role')
|
||||||
check_assets = request.GET.get('check_assets', '')
|
check_assets = request.GET.get('check_assets', '')
|
||||||
web_terminal_uri = 'ws://%s/exec?role=%s' % (WEB_SOCKET_HOST, role)
|
web_terminal_uri = '%s/exec?role=%s' % (WEB_SOCKET_HOST, role)
|
||||||
return my_render('exec_cmd.html', locals(), request)
|
return my_render('exec_cmd.html', locals(), request)
|
||||||
|
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ def web_terminal(request):
|
||||||
if asset:
|
if asset:
|
||||||
print asset
|
print asset
|
||||||
hostname = asset.hostname
|
hostname = asset.hostname
|
||||||
web_terminal_uri = 'ws://%s/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
|
web_terminal_uri = '%s/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
|
||||||
return render_to_response('jlog/web_terminal.html', locals())
|
return render_to_response('jlog/web_terminal.html', locals())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,13 @@
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var wsUri = "{{ web_terminal_uri }}"; //请求的websocket url
|
|
||||||
|
var protocol = "ws://";
|
||||||
|
if (window.location.protocol == 'https:') {
|
||||||
|
protocol = 'wss://';
|
||||||
|
}
|
||||||
|
|
||||||
|
var wsUri = protocol + "{{ web_terminal_uri }}"; //请求的websocket url
|
||||||
var ws = new WebSocket(wsUri);
|
var ws = new WebSocket(wsUri);
|
||||||
|
|
||||||
function createSystemMessage(message) {
|
function createSystemMessage(message) {
|
||||||
|
|
|
@ -43,7 +43,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
WSSHClient.prototype.connect = function(options) {
|
WSSHClient.prototype.connect = function(options) {
|
||||||
var endpoint = '{{ web_terminal_uri }}';
|
var protocol = "ws://";
|
||||||
|
if (window.location.protocol == 'https:') {
|
||||||
|
protocol = 'wss://';
|
||||||
|
}
|
||||||
|
|
||||||
|
var endpoint = protocol + '{{ web_terminal_uri }}';
|
||||||
|
|
||||||
if (window.WebSocket) {
|
if (window.WebSocket) {
|
||||||
this._connection = new WebSocket(endpoint);
|
this._connection = new WebSocket(endpoint);
|
||||||
|
|
Loading…
Reference in New Issue