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
702b1bd3
Commit
702b1bd3
authored
Mar 03, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ws protocal): 修复所有ws自动获取
自动获取websocket无需再手动指定
parent
c2c833f2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
15 deletions
+12
-15
views.py
jlog/views.py
+0
-3
foot_script.html
templates/foot_script.html
+0
-1
log_online.html
templates/jlog/log_online.html
+12
-11
No files found.
jlog/views.py
View file @
702b1bd3
...
@@ -9,7 +9,6 @@ from django.http import HttpResponseNotFound
...
@@ -9,7 +9,6 @@ from django.http import HttpResponseNotFound
from
jlog.log_api
import
renderTemplate
from
jlog.log_api
import
renderTemplate
from
jlog.models
import
Log
,
ExecLog
,
FileLog
from
jlog.models
import
Log
,
ExecLog
,
FileLog
from
jumpserver.settings
import
WEB_SOCKET_URL
@require_role
(
'admin'
)
@require_role
(
'admin'
)
...
@@ -66,8 +65,6 @@ def log_list(request, offset):
...
@@ -66,8 +65,6 @@ def log_list(request, offset):
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
web_monitor_url
=
'
%
s/monitor'
%
WEB_SOCKET_URL
web_kill_url
=
'/kill'
session_id
=
request
.
session
.
session_key
session_id
=
request
.
session
.
session_key
return
render_to_response
(
'jlog/log_
%
s.html'
%
offset
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jlog/log_
%
s.html'
%
offset
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
templates/foot_script.html
View file @
702b1bd3
...
@@ -36,6 +36,5 @@
...
@@ -36,6 +36,5 @@
}
else
{
}
else
{
$
(
"#"
+
s1
).
addClass
(
'active'
);
$
(
"#"
+
s1
).
addClass
(
'active'
);
$
(
'#'
+
s1
+
' .'
+
s2
).
addClass
(
'active'
);
$
(
'#'
+
s1
+
' .'
+
s2
).
addClass
(
'active'
);
console
.
log
(
s1
)
}
}
</script>
</script>
templates/jlog/log_online.html
View file @
702b1bd3
...
@@ -128,17 +128,17 @@
...
@@ -128,17 +128,17 @@
</div>
</div>
{#
<script
src=
"http://{{ web_socket_host }}/socket.io/socket.io.js"
></script>
#}
<script>
<script>
{
#
$
(
document
).
ready
(
function
(){
#
}
{
#
$
(
'.monitor'
).
click
(
function
(){
#
}
{
#
window
.
open
(
'/jlog/monitor/'
,
'监控'
,
'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'
);
#
}
{
#
})
#
}
{
#
});
#
}
function
init
(
obj
){
function
init
(
obj
){
if
(
window
.
location
.
protocol
==
'https:'
)
{
var
protocol
=
'wss://'
;
}
else
{
var
protocol
=
'ws://'
;
}
var
endpoint
=
protocol
+
document
.
URL
.
match
(
RegExp
(
'//(.*?)/'
))[
1
]
+
'/monitor'
;
var
file_path
=
obj
.
attr
(
'file_path'
);
var
file_path
=
obj
.
attr
(
'file_path'
);
var
wsUri
=
'{{ web_monitor_url }}'
;
var
socket
=
new
WebSocket
(
endpoint
+
'?file_path='
+
file_path
);
var
socket
=
new
WebSocket
(
wsUri
+
'?file_path='
+
file_path
);
var
term
=
new
Terminal
({
var
term
=
new
Terminal
({
cols
:
80
,
cols
:
80
,
...
@@ -165,7 +165,6 @@
...
@@ -165,7 +165,6 @@
BootstrapDialog
.
show
({
message
:
function
(){
BootstrapDialog
.
show
({
message
:
function
(){
//服务器端认证
//服务器端认证
{
#
socket
.
send
(
'login'
,
{
userid
:
message
.
id
,
filename
:
message
.
filename
,
username
:
username
,
seed
:
seed
});
#
}
window
.
setTimeout
(
function
(){
window
.
setTimeout
(
function
(){
$
(
'.terminal'
).
detach
().
appendTo
(
'#term'
);
$
(
'.terminal'
).
detach
().
appendTo
(
'#term'
);
socket
.
onmessage
=
function
(
evt
){
socket
.
onmessage
=
function
(
evt
){
...
@@ -204,9 +203,11 @@
...
@@ -204,9 +203,11 @@
});
});
function
cut
(
num
,
login_type
){
function
cut
(
num
,
login_type
){
console
.
log
(
login_type
);
var
protocol
=
window
.
location
.
protocol
;
var
endpoint
=
protocol
+
'//'
+
document
.
URL
.
match
(
RegExp
(
'//(.*?)/'
))[
1
]
+
'/kill'
;
if
(
login_type
==
'web'
){
if
(
login_type
==
'web'
){
var
g_url
=
'{{ web_kill_url }}'
+
'?id='
+
num
;
var
g_url
=
endpoint
+
'?id='
+
num
;
console
.
log
(
g_url
);
}
else
{
}
else
{
var
g_url
=
"{% url 'log_kill' %}?id="
+
num
;
var
g_url
=
"{% url 'log_kill' %}?id="
+
num
;
}
}
...
...
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