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
7bef5175
Commit
7bef5175
authored
9 years ago
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持修改窗口大小
parent
ea973bbb
master
auditor_jym
audits
dev
dev_beta
dev_beta_db
gengmei
lagacy-0.4.0
node_service
password
rbac
restrict_access
test
v52
wph
1.5.2
1.5.1
1.5.0
1.4.10
1.4.9
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.3
1.3.2
1.3.1
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.0
0.3.3
0.3.2
0.3.2-rc2
0.3.1
0.3.0-beta
v1.4.10
v1.4.7
v1.4.4
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
6 deletions
+59
-6
views.py
jumpserver/views.py
+4
-0
run_websocket.py
run_websocket.py
+9
-1
asset_list.html
templates/jasset/asset_list.html
+13
-2
web_terminal.html
templates/jlog/web_terminal.html
+29
-2
perm_role_detail.html
templates/jperm/perm_role_detail.html
+4
-1
No files found.
jumpserver/views.py
View file @
7bef5175
...
...
@@ -352,6 +352,10 @@ def exec_cmd(request):
def
web_terminal
(
request
):
asset_id
=
request
.
GET
.
get
(
'id'
)
role_name
=
request
.
GET
.
get
(
'role'
)
asset
=
get_object
(
Asset
,
id
=
asset_id
)
if
asset
:
print
asset
hostname
=
asset
.
hostname
web_terminal_uri
=
'ws://
%
s/terminal?id=
%
s&role=
%
s'
%
(
WEB_SOCKET_HOST
,
asset_id
,
role_name
)
return
render_to_response
(
'jlog/web_terminal.html'
,
locals
())
...
...
This diff is collapsed.
Click to expand it.
run_websocket.py
View file @
7bef5175
...
...
@@ -333,7 +333,13 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
data
=
json
.
loads
(
message
)
if
not
data
:
return
if
data
.
get
(
'data'
):
if
'resize'
in
data
.
get
(
'data'
):
self
.
channel
.
resize_pty
(
data
.
get
(
'data'
)
.
get
(
'resize'
)
.
get
(
'cols'
,
80
),
data
.
get
(
'data'
)
.
get
(
'resize'
)
.
get
(
'rows'
,
24
)
)
elif
data
.
get
(
'data'
):
self
.
term
.
input_mode
=
True
if
str
(
data
[
'data'
])
in
[
'
\r
'
,
'
\n
'
,
'
\r\n
'
]:
if
self
.
term
.
vim_flag
:
...
...
@@ -350,6 +356,8 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
self
.
term
.
data
=
''
self
.
term
.
input_mode
=
False
self
.
channel
.
send
(
data
[
'data'
])
else
:
pass
def
on_close
(
self
):
logger
.
debug
(
'Websocket: Close request'
)
...
...
This diff is collapsed.
Click to expand it.
templates/jasset/asset_list.html
View file @
7bef5175
...
...
@@ -233,6 +233,7 @@
layer
.
alert
(
'没有授权系统用户'
)
}
else
if
(
dataArray
.
length
==
1
&&
data
!=
'error'
&&
navigator
.
platform
==
'Win32'
){
/*
var title = 'Jumpserver Web Terminal' + '<span class="text-info"> '+ hostname +'</span>';
layer.open({
type: 2,
...
...
@@ -242,8 +243,10 @@
area: ['628px', '420px'],
content: new_url+data
});
*/
window
.
open
(
new_url
+
data
,
''
,
'width=628px, height=420px'
)
}
else
if
(
dataArray
.
length
==
1
&&
data
!=
'error'
){
layer
.
open
({
/*
layer.open({
type: 2,
title: title,
maxmin: true,
...
...
@@ -251,6 +254,9 @@
area: ['628px', '452px'],
content: new_url+data
});
*/
window
.
open
(
new_url
+
data
,
''
,
'width=628px, height=440px'
)
}
else
{
aUrl
=
''
;
...
...
@@ -276,6 +282,7 @@
var
hostname
=
$
(
a
).
attr
(
'value'
);
var
title
=
'Jumpserver Web Terminal - '
+
'<span class="text-info"> '
+
hostname
+
'</span>'
;
if
(
navigator
.
platform
==
'Win32'
){
/*
layer.open({
type: 2,
title: title,
...
...
@@ -284,8 +291,11 @@
shade: false,
content: new_url
});
*/
window
.
open
(
new_url
,
''
,
'height=628px, width=420px'
)
}
else
{
/*
layer.open({
type: 2,
title: title,
...
...
@@ -294,6 +304,8 @@
shade: false,
content: new_url
});
*/
window
.
open
(
new_url
,
''
,
'height=628px, width=452px'
)
}
return
false
...
...
@@ -310,7 +322,6 @@
shade
:
false
,
content
:
new_url
});
console
.
log
(
new_url
);
return
false
}
...
...
This diff is collapsed.
Click to expand it.
templates/jlog/web_terminal.html
View file @
7bef5175
...
...
@@ -2,7 +2,7 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
Jumpserver
web terminal
</title>
<title>
Jumpserver
Web Terminal: {{ hostname }}
</title>
<style>
body
{
...
...
@@ -37,6 +37,8 @@
<script
type=
"application/javascript"
src=
"/static/js/term.js"
>
</script>
<script
type=
"application/javascript"
>
var
rowHeight
=
1
;
var
colWidth
=
1
;
function
WSSHClient
()
{
}
...
...
@@ -101,7 +103,22 @@
term
.
write
(
data
);
}
}));
rowHeight
=
0.0
+
1.00
*
$
(
'.terminal'
).
height
()
/
24
;
colWidth
=
0.0
+
1.00
*
$
(
'.terminal'
).
width
()
/
80
;
return
{
'term'
:
term
,
'client'
:
client
};
}
function
resize
(){
$
(
'.terminal'
).
css
(
'width'
,
window
.
innerWidth
-
25
);
console
.
log
(
window
.
innerWidth
);
console
.
log
(
window
.
innerWidth
-
10
);
var
rows
=
Math
.
floor
(
window
.
innerHeight
/
rowHeight
)
-
1
;
var
cols
=
Math
.
floor
(
window
.
innerWidth
/
colWidth
)
-
1
;
return
{
rows
:
rows
,
cols
:
cols
};
}
</script>
<script
type=
'application/javascript'
>
...
...
@@ -110,7 +127,17 @@
};
$
(
'#ssh'
).
show
();
openTerminal
(
options
);
var
term_client
=
openTerminal
(
options
);
console
.
log
(
rowHeight
);
window
.
onresize
=
function
(){
var
geom
=
resize
();
console
.
log
(
geom
);
term_client
.
term
.
resize
(
geom
.
cols
,
geom
.
rows
);
term_client
.
client
.
send
({
'resize'
:
{
'roles'
:
geom
.
rows
,
'cols'
:
geom
.
cols
}});
$
(
'#ssh'
).
show
();
}
});
</script>
</body>
...
...
This diff is collapsed.
Click to expand it.
templates/jperm/perm_role_detail.html
View file @
7bef5175
...
...
@@ -325,7 +325,10 @@
$
(
'.push_failed'
).
click
(
function
()
{
var
fail_reason
=
$
(
this
).
attr
(
'title'
);
layer
.
alert
(
fail_reason
)
layer
.
alert
(
fail_reason
,
{
skin
:
'layui-layer-molv'
,
area
:
'500px'
})
});
...
...
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