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
9c93d5a8
Commit
9c93d5a8
authored
Feb 25, 2016
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add /ws/
parent
4f75f76d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
5 deletions
+6
-5
views.py
jumpserver/views.py
+3
-2
run_websocket.py
run_websocket.py
+1
-1
exec_cmd.html
templates/exec_cmd.html
+1
-1
web_terminal.html
templates/jlog/web_terminal.html
+1
-1
No files found.
jumpserver/views.py
View file @
9c93d5a8
...
...
@@ -344,7 +344,7 @@ def download(request):
def
exec_cmd
(
request
):
role
=
request
.
GET
.
get
(
'role'
)
check_assets
=
request
.
GET
.
get
(
'check_assets'
,
''
)
web_terminal_uri
=
'
%
s/exec?role=
%
s'
%
(
WEB_SOCKET_HOST
,
role
)
web_terminal_uri
=
'
/ws/exec?role=
%
s'
%
(
role
)
return
my_render
(
'exec_cmd.html'
,
locals
(),
request
)
...
...
@@ -356,7 +356,8 @@ 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 = '%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
)
return
render_to_response
(
'jlog/web_terminal.html'
,
locals
())
run_websocket.py
View file @
9c93d5a8
...
...
@@ -442,7 +442,7 @@ def main():
(
r'/monitor'
,
MonitorHandler
),
(
r'/ws/terminal'
,
WebTerminalHandler
),
(
r'/kill'
,
WebTerminalKillHandler
),
(
r'/exec'
,
ExecHandler
),
(
r'/
ws/
exec'
,
ExecHandler
),
(
r"/static/(.*)"
,
tornado
.
web
.
StaticFileHandler
,
dict
(
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"static"
))),
(
'.*'
,
tornado
.
web
.
FallbackHandler
,
dict
(
fallback
=
container
)),
...
...
templates/exec_cmd.html
View file @
9c93d5a8
...
...
@@ -29,7 +29,7 @@
protocol
=
'wss://'
;
}
var
wsUri
=
protocol
+
"{{ web_terminal_uri }}"
;
//请求的websocket url
var
wsUri
=
protocol
+
document
.
URL
.
match
(
RegExp
(
'//(.*?)/'
))[
1
]
+
"{{ web_terminal_uri }}"
;
//请求的websocket url
var
ws
=
new
WebSocket
(
wsUri
);
function
createSystemMessage
(
message
)
{
...
...
templates/jlog/web_terminal.html
View file @
9c93d5a8
...
...
@@ -48,7 +48,7 @@
protocol
=
'wss://'
;
}
var
endpoint
=
protocol
+
'{{ web_terminal_uri }}'
;
var
endpoint
=
protocol
+
document
.
URL
.
match
(
RegExp
(
'//(.*?)/'
))[
1
]
+
'{{ web_terminal_uri }}'
;
if
(
window
.
WebSocket
)
{
this
.
_connection
=
new
WebSocket
(
endpoint
);
...
...
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