Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
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
coco
Commits
a3a69ec1
Commit
a3a69ec1
authored
Oct 22, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
9fd46abf
697c8d8f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
13 deletions
+17
-13
connector.py
coco/httpd/elfinder/connector.py
+2
-0
sftp.py
coco/httpd/elfinder/volumes/sftp.py
+1
-8
elfinder.zh_CN.js
coco/httpd/static/plugins/elfinder/i18n/elfinder.zh_CN.js
+1
-1
models.py
coco/models.py
+0
-1
sftp.py
coco/sftp.py
+12
-2
requirements.txt
requirements/requirements.txt
+1
-1
No files found.
coco/httpd/elfinder/connector.py
View file @
a3a69ec1
...
...
@@ -111,7 +111,9 @@ class ElFinderConnector:
func
()
except
Exception
as
e
:
self
.
response
[
'error'
]
=
'
%
s'
%
e
logger
.
error
(
"Error occur ------------------------------"
)
logger
.
exception
(
e
)
logger
.
error
(
"Error end ------------------------------"
)
def
get_request_data
(
self
):
data_source
=
{}
...
...
coco/httpd/elfinder/volumes/sftp.py
View file @
a3a69ec1
...
...
@@ -88,7 +88,6 @@ class SFTPVolume(BaseVolume):
def
list
(
self
,
target
,
name_only
=
False
):
""" Returns a list of files/directories in the target directory. """
path
=
self
.
_path
(
target
)
print
(
"List {} {}"
.
format
(
target
,
path
))
with
self
.
lock
:
return
self
.
_list
(
path
)
...
...
@@ -96,7 +95,6 @@ class SFTPVolume(BaseVolume):
""" Get the sub directory of directory
"""
path
=
self
.
_path
(
target
)
print
(
"Tree {} {}"
.
format
(
target
,
path
))
with
self
.
lock
:
infos
=
self
.
_list
(
path
)
tree
=
list
(
filter
(
lambda
x
:
x
[
'mime'
]
==
'directory'
,
infos
))
...
...
@@ -107,7 +105,6 @@ class SFTPVolume(BaseVolume):
获取目录的父目录, 如果deep为0,则直到根
"""
path
=
self
.
_path
(
target
)
.
rstrip
(
self
.
path_sep
)
print
(
"Parents {} {}"
.
format
(
target
,
path
))
with
self
.
lock
:
return
self
.
_parents
(
path
,
depth
=
depth
)
...
...
@@ -173,7 +170,6 @@ class SFTPVolume(BaseVolume):
remote_path
=
self
.
_remote_path
(
path
)
try
:
data
=
self
.
sftp
.
lstat
(
remote_path
)
print
(
data
)
exist
=
True
except
FileNotFoundError
:
exist
=
False
...
...
@@ -188,7 +184,6 @@ class SFTPVolume(BaseVolume):
def
paste
(
self
,
targets
,
dest
,
cut
):
""" Moves/copies target files/directories from source to dest. """
print
(
"Paste {} {} {}"
.
format
(
targets
,
dest
,
cut
))
dest_parent_path
=
self
.
_path
(
dest
)
added
=
[]
removed
=
[]
...
...
@@ -198,14 +193,12 @@ class SFTPVolume(BaseVolume):
dest_path
=
self
.
_join
(
dest_parent_path
,
self
.
_base_name
(
src_path
))
if
self
.
is_dir
(
src_path
):
raise
OSError
(
"Copy folder unsupported now"
)
print
(
"Paste {} to => {}"
.
format
(
src_path
,
dest_parent_path
))
if
self
.
is_exist
(
dest_path
):
print
(
"Exist {}"
.
format
(
dest_path
))
continue
src_remote_path
=
self
.
_remote_path
(
src_path
)
dest_remote_path
=
self
.
_remote_path
(
dest_path
)
try
:
f
=
self
.
sftp
.
open
(
src_remote_path
,
mode
=
'r'
)
try
:
attr
=
self
.
sftp
.
putfo
(
f
,
dest_remote_path
)
if
cut
:
removed
.
append
(
self
.
remove
(
target
))
...
...
coco/httpd/static/plugins/elfinder/i18n/elfinder.zh_CN.js
View file @
a3a69ec1
...
...
@@ -422,7 +422,7 @@
'minsLeft'
:
'剩余 $1 分钟'
,
// from v2.1.17 added 13.11.2016
'openAsEncoding'
:
'使用所选编码重新打开'
,
// from v2.1.19 added 2.12.2016
'saveAsEncoding'
:
'使用所选编码保存'
,
// from v2.1.19 added 2.12.2016
'selectFolder'
:
'选择目录'
,
// from v2.1.20 added 13.12.2016
'selectFolder'
:
'选择目录
(暂不支持)
'
,
// from v2.1.20 added 13.12.2016
'firstLetterSearch'
:
'首字母搜索'
,
// from v2.1.23 added 24.3.2017
'presets'
:
'预置'
,
// from v2.1.25 added 26.5.2017
'tooManyToTrash'
:
'项目太多,不能移动到回收站.'
,
// from v2.1.25 added 9.6.2017
...
...
coco/models.py
View file @
a3a69ec1
...
...
@@ -332,7 +332,6 @@ class BaseServer:
return
self
.
_cmd_parser
.
parse_output
(
self
.
output_data
)
def
_parse_input
(
self
):
print
(
"Parse input: {}"
.
format
(
self
.
input_data
))
if
not
self
.
input_data
:
return
return
self
.
_cmd_parser
.
parse_input
(
self
.
input_data
)
...
...
coco/sftp.py
View file @
a3a69ec1
...
...
@@ -73,6 +73,8 @@ class SFTPServer(paramiko.SFTPServerInterface):
self
.
server
.
connection
.
user
)
for
asset
in
assets
:
if
asset
.
protocol
!=
'ssh'
:
continue
value
=
{}
key
=
asset
.
hostname
if
asset
.
org_id
:
...
...
@@ -96,7 +98,6 @@ class SFTPServer(paramiko.SFTPServerInterface):
active_channels
=
[
c
for
c
in
trans
.
_channels
.
values
()
if
not
c
.
closed
]
if
not
active_channels
:
print
(
"CLose transport"
)
trans
.
close
()
if
proxy
:
proxy
.
close
()
...
...
@@ -414,6 +415,9 @@ class InternalSFTPClient(SFTPServer):
attr
=
super
()
.
lstat
.
__wrapped__
(
self
,
path
)
return
attr
def
rmdir
(
self
,
path
):
return
super
()
.
rmdir
.
__wrapped__
(
self
,
path
)
def
get_channel
(
self
):
return
FakeChannel
.
new
()
...
...
@@ -422,7 +426,13 @@ class InternalSFTPClient(SFTPServer):
def
putfo
(
self
,
f
,
path
,
callback
=
None
,
confirm
=
True
):
client
,
rpath
=
self
.
get_sftp_client_rpath
(
path
)
return
client
.
putfo
(
f
,
rpath
,
callback
=
callback
,
confirm
=
confirm
)
success
=
False
try
:
attr
=
client
.
putfo
(
f
,
rpath
,
callback
=
callback
,
confirm
=
confirm
)
success
=
True
return
attr
finally
:
self
.
create_ftp_log
(
path
,
'Upload'
,
success
)
def
close
(
self
):
return
self
.
session_ended
()
requirements/requirements.txt
View file @
a3a69ec1
...
...
@@ -18,7 +18,7 @@ idna==2.6
itsdangerous==0.24
Jinja2==2.10
jmespath==0.9.3
jms-storage==0.0.1
8
jms-storage==0.0.1
9
jumpserver-python-sdk==0.0.50
MarkupSafe==1.0
oss2==2.4.0
...
...
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