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
a099d2a2
Commit
a099d2a2
authored
Nov 27, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中文播放bug
parent
bd885da1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
connect.py
connect.py
+3
-1
log_api.py
jlog/log_api.py
+2
-2
No files found.
connect.py
View file @
a099d2a2
...
...
@@ -25,6 +25,7 @@ from jumpserver.api import logger, Log, TtyLog, get_role_key, CRYPTOR
from
jperm.perm_api
import
gen_resource
,
get_group_asset_perm
,
get_group_user_perm
,
user_have_perm
from
jumpserver.settings
import
LOG_DIR
from
jperm.ansible_api
import
Command
from
jlog.log_api
import
escapeString
login_user
=
get_object
(
User
,
username
=
getpass
.
getuser
())
...
...
@@ -365,8 +366,9 @@ class SshTty(Tty):
self
.
vim_data
+=
x
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
flush
()
es_x
=
escapeString
(
x
)
now_timestamp
=
time
.
time
()
log_time_f
.
write
(
'
%
s
%
s
\n
'
%
(
round
(
now_timestamp
-
pre_timestamp
,
4
),
len
(
x
)))
log_time_f
.
write
(
'
%
s
%
s
\n
'
%
(
round
(
now_timestamp
-
pre_timestamp
,
4
),
len
(
es_
x
)))
log_file_f
.
write
(
x
)
pre_timestamp
=
now_timestamp
log_file_f
.
flush
()
...
...
jlog/log_api.py
View file @
a099d2a2
...
...
@@ -29,7 +29,6 @@ def escapeString(string):
string
=
string
.
encode
(
'unicode_escape'
)
.
decode
(
'utf-8'
,
'ignore'
)
except
(
UnicodeEncodeError
,
UnicodeDecodeError
):
string
=
string
.
decode
(
'utf-8'
,
'ignore'
)
print
repr
(
string
)
string
=
string
.
replace
(
"'"
,
"
\\
'"
)
string
=
'
\'
'
+
string
+
'
\'
'
return
string
...
...
@@ -52,13 +51,14 @@ def scriptToJSON(scriptf, timing=None):
for
t
in
timing
:
dt
=
scriptf
.
read
(
t
[
1
])
data
=
escapeString
(
dt
)
# print ('###### (%s, %s)' % (t[1], data))
offset
+=
t
[
0
]
ret
.
append
((
data
,
offset
))
return
dumps
(
ret
)
def
renderTemplate
(
script_path
,
time_file_path
,
dimensions
=
(
24
,
80
),
templatename
=
DEFAULT_TEMPLATE
):
#with copen(script_path, encoding='utf-8', errors='replace') as scriptf:
#
with copen(script_path, encoding='utf-8', errors='replace') as scriptf:
with
open
(
script_path
)
as
scriptf
:
with
open
(
time_file_path
)
as
timef
:
timing
=
getTiming
(
timef
)
...
...
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