Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
a8eb9f3e
Commit
a8eb9f3e
authored
9 years ago
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jlog, websocket url) 修复ws使用 ws协议还是wss协议
1. 不再需要浏览器判断什么协议,需要在jumpserver.conf注明 ref #63
parent
a88d8ca4
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
24 deletions
+10
-24
connect.py
connect.py
+0
-1
views.py
jlog/views.py
+3
-3
jumpserver.conf
jumpserver.conf
+2
-4
settings.py
jumpserver/settings.py
+1
-1
views.py
jumpserver/views.py
+1
-2
log_online.html
templates/jlog/log_online.html
+2
-7
web_terminal.html
templates/jlog/web_terminal.html
+1
-6
No files found.
connect.py
View file @
a8eb9f3e
...
...
@@ -824,7 +824,6 @@ def main():
except
IndexError
,
e
:
color_print
(
e
)
time
.
sleep
(
5
)
pass
if
__name__
==
'__main__'
:
main
()
This diff is collapsed.
Click to expand it.
jlog/views.py
View file @
a8eb9f3e
...
...
@@ -9,7 +9,7 @@ from django.http import HttpResponseNotFound
from
jlog.log_api
import
renderTemplate
from
jlog.models
import
Log
,
ExecLog
,
FileLog
from
jumpserver.settings
import
WEB_SOCKET_
HOST
from
jumpserver.settings
import
WEB_SOCKET_
URL
@require_role
(
'admin'
)
...
...
@@ -66,8 +66,8 @@ def log_list(request, offset):
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
web_monitor_ur
i
=
'
%
s/monitor'
%
WEB_SOCKET_HOST
web_kill_ur
i
=
'/kill'
web_monitor_ur
l
=
'
%
s/monitor'
%
WEB_SOCKET_URL
web_kill_ur
l
=
'/kill'
session_id
=
request
.
session
.
session_key
return
render_to_response
(
'jlog/log_
%
s.html'
%
offset
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
This diff is collapsed.
Click to expand it.
jumpserver.conf
View file @
a8eb9f3e
[
base
]
url
=
http
://
192
.
168
.
244
.
129
websocket_url
=
ws
://
192
.
168
.
244
.
129
key
=
88
aaaf7ffe3c6c04
log
=
debug
...
...
@@ -10,14 +11,11 @@ user = jumpserver
password
=
mysql234
database
=
jumpserver
[
websocket
]
web_socket_host
=
192
.
168
.
244
.
129
:
3000
[
mail
]
mail_enable
=
1
email_host
=
smtp
.
qq
.
com
email_port
=
25
email_host_user
=
xxxxxxxx
@
qq
.
com
email_host_password
=
xxxxxx
email_use_tls
=
Fals
e
email_use_tls
=
Tru
e
This diff is collapsed.
Click to expand it.
jumpserver/settings.py
View file @
a8eb9f3e
...
...
@@ -41,7 +41,7 @@ SSH_KEY_DIR = os.path.join(BASE_DIR, 'keys/role_keys')
KEY
=
config
.
get
(
'base'
,
'key'
)
URL
=
config
.
get
(
'base'
,
'url'
)
LOG_LEVEL
=
config
.
get
(
'base'
,
'log'
)
WEB_SOCKET_
HOST
=
config
.
get
(
'websocket'
,
'web_socket_host
'
)
WEB_SOCKET_
URL
=
config
.
get
(
'base'
,
'websocket_url
'
)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
...
...
This diff is collapsed.
Click to expand it.
jumpserver/views.py
View file @
a8eb9f3e
...
...
@@ -356,8 +356,7 @@ def web_terminal(request):
if
asset
:
print
asset
hostname
=
asset
.
hostname
# web_terminal_uri = '%s/ws/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
web_terminal_uri
=
'/ws/terminal?id=
%
s&role=
%
s'
%
(
asset_id
,
role_name
)
web_terminal_url
=
'
%
s/ws/terminal?id=
%
s&role=
%
s'
%
(
WEB_SOCKET_URL
,
asset_id
,
role_name
)
return
render_to_response
(
'jlog/web_terminal.html'
,
locals
())
This diff is collapsed.
Click to expand it.
templates/jlog/log_online.html
View file @
a8eb9f3e
...
...
@@ -136,13 +136,8 @@
{
#
})
#
}
{
#
});
#
}
function
init
(
obj
){
var
protocol
=
"ws://"
;
if
(
window
.
location
.
protocol
==
'https:'
)
{
protocol
=
'wss://'
;
}
var
file_path
=
obj
.
attr
(
'file_path'
);
var
wsUri
=
protocol
+
'{{ web_monitor_uri
}}'
;
var
wsUri
=
'{{ web_monitor_url
}}'
;
var
socket
=
new
WebSocket
(
wsUri
+
'?file_path='
+
file_path
);
var
term
=
new
Terminal
({
...
...
@@ -211,7 +206,7 @@
function
cut
(
num
,
login_type
){
console
.
log
(
login_type
);
if
(
login_type
==
'web'
){
var
g_url
=
'{{ web_kill_ur
i
}}'
+
'?id='
+
num
;
var
g_url
=
'{{ web_kill_ur
l
}}'
+
'?id='
+
num
;
}
else
{
var
g_url
=
"{% url 'log_kill' %}?id="
+
num
;
}
...
...
This diff is collapsed.
Click to expand it.
templates/jlog/web_terminal.html
View file @
a8eb9f3e
...
...
@@ -43,12 +43,7 @@
}
WSSHClient
.
prototype
.
connect
=
function
(
options
)
{
var
protocol
=
"ws://"
;
if
(
window
.
location
.
protocol
==
'https:'
)
{
protocol
=
'wss://'
;
}
var
endpoint
=
protocol
+
document
.
URL
.
match
(
RegExp
(
'//(.*?)/'
))[
1
]
+
'{{ web_terminal_uri }}'
;
var
endpoint
=
'{{ web_terminal_url }}'
;
if
(
window
.
WebSocket
)
{
this
.
_connection
=
new
WebSocket
(
endpoint
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment