Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
wanli
evm-store
Commits
1c54c989
Commit
1c54c989
authored
Mar 24, 2021
by
wanliofficial
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新epk打包工具
parent
806e0d66
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
10 deletions
+31
-10
backend/controller/apps_manager.py
backend/controller/apps_manager.py
+3
-3
backend/utils/tools_epk.py
backend/utils/tools_epk.py
+28
-6
backend/view/apps.py
backend/view/apps.py
+0
-1
No files found.
backend/controller/apps_manager.py
View file @
1c54c989
...
@@ -38,9 +38,9 @@ class AppsManager(object):
...
@@ -38,9 +38,9 @@ class AppsManager(object):
if
not
editor
:
if
not
editor
:
return
False
,
"current user is not exists"
return
False
,
"current user is not exists"
result
=
Apps
.
get
(
app_name
=
data
.
get
(
"app_name"
),
is_delete
=
False
)
# result = Apps.select(app_name=data.get("app_name"), is_delete=False).count(
)
if
result
:
# if result < 1
:
return
False
,
"app_name has been exists."
#
return False, "app_name has been exists."
data
.
update
({
data
.
update
({
'create_by'
:
editor
,
'create_by'
:
editor
,
...
...
backend/utils/tools_epk.py
View file @
1c54c989
...
@@ -97,21 +97,35 @@ class EpkApp(object):
...
@@ -97,21 +97,35 @@ class EpkApp(object):
with
open
(
fpath
,
"rb"
)
as
f
:
with
open
(
fpath
,
"rb"
)
as
f
:
filecontent
=
f
.
read
()
filecontent
=
f
.
read
()
print
(
fpath
)
newmd5
=
self
.
md5
(
filecontent
)
newmd5
=
self
.
md5
(
filecontent
)
print
(
md5path
)
with
open
(
md5path
,
"wb"
)
as
f
:
with
open
(
md5path
,
"wb"
)
as
f
:
f
.
write
(
newmd5
)
f
.
write
(
newmd5
)
return
newmd5
return
newmd5
def
sign
(
self
,
content
):
ret
=
b
""
for
i
in
range
(
int
(
len
(
content
)
/
2
)):
ret
+=
struct
.
pack
(
"<B"
,
int
(
"0x
%
s"
%
(
content
[
i
*
2
:
i
*
2
+
2
]),
16
))
ret
=
ret
+
b
'EVM is NB ++!'
return
ret
def
md5
(
self
,
filecontent
):
def
md5
(
self
,
filecontent
):
md5
=
hashlib
.
md5
()
#获取一个md5加密算法对象
newmd5
=
''
md5
.
update
(
filecontent
)
#指定需要加密的字符串
content
=
filecontent
newmd5
=
md5
.
hexdigest
()
#获取加密后的16进制字符串
for
i
in
range
(
3
):
md5
=
hashlib
.
md5
()
#获取一个md5加密算法对象
md5
.
update
(
content
)
#指定需要加密的字符串
newmd5
=
md5
.
hexdigest
()
#获取加密后的16进制字符串
print
(
newmd5
)
content
=
self
.
sign
(
newmd5
)
ret
=
b
""
ret
=
b
""
for
i
in
range
(
int
(
len
(
newmd5
)
/
2
)):
for
i
in
range
(
int
(
len
(
newmd5
)
/
2
)):
ret
+=
struct
.
pack
(
"<B"
,
int
(
"0x
%
s"
%
(
newmd5
[
i
*
2
:
i
*
2
+
2
]),
16
))
ret
+=
struct
.
pack
(
"<B"
,
int
(
"0x
%
s"
%
(
newmd5
[
i
*
2
:
i
*
2
+
2
]),
16
))
return
ret
return
ret
def
packFile
(
self
,
info
,
level
=
9
):
def
packFile
(
self
,
info
,
level
=
9
):
...
@@ -119,6 +133,7 @@ class EpkApp(object):
...
@@ -119,6 +133,7 @@ class EpkApp(object):
fpath
=
os
.
sep
.
join
([
self
.
_appDir
,
fname
])
fpath
=
os
.
sep
.
join
([
self
.
_appDir
,
fname
])
fext
=
info
[
"ext"
]
fext
=
info
[
"ext"
]
fileBytes
=
b
""
fileBytes
=
b
""
if
fext
==
"md5"
:
if
fext
==
"md5"
:
fileBytes
+=
struct
.
pack
(
"<B"
,
1
)
fileBytes
+=
struct
.
pack
(
"<B"
,
1
)
...
@@ -132,9 +147,17 @@ class EpkApp(object):
...
@@ -132,9 +147,17 @@ class EpkApp(object):
with
open
(
fpath
,
"rb"
)
as
fc
:
with
open
(
fpath
,
"rb"
)
as
fc
:
fileContentBytes
=
fc
.
read
()
fileContentBytes
=
fc
.
read
()
print
(
info
[
"name"
])
print
(
len
(
fileContentBytes
))
fileBytes
+=
struct
.
pack
(
"<L"
,
len
(
fileContentBytes
))
fileBytes
+=
struct
.
pack
(
"<L"
,
len
(
fileContentBytes
))
fileCompressBytes
=
zlib
.
compress
(
fileContentBytes
,
level
)
if
fext
==
"md5"
:
fileCompressBytes
=
fileContentBytes
else
:
fileCompressBytes
=
zlib
.
compress
(
fileContentBytes
,
level
)
print
(
len
(
fileCompressBytes
))
fileBytes
+=
struct
.
pack
(
"<L"
,
len
(
fileCompressBytes
))
fileBytes
+=
struct
.
pack
(
"<L"
,
len
(
fileCompressBytes
))
...
@@ -191,7 +214,6 @@ class EpkApp(object):
...
@@ -191,7 +214,6 @@ class EpkApp(object):
result
=
ret
result
=
ret
return
result
return
result
def
main
(
path
,
appName
):
def
main
(
path
,
appName
):
epk
=
EpkApp
(
appName
,
path
)
epk
=
EpkApp
(
appName
,
path
)
epk
.
pack
()
epk
.
pack
()
...
...
backend/view/apps.py
View file @
1c54c989
...
@@ -111,7 +111,6 @@ def build_app(id):
...
@@ -111,7 +111,6 @@ def build_app(id):
return
response_result
(
ResponseCode
.
NOTHING_CHANGE
,
msg
=
message
)
return
response_result
(
ResponseCode
.
NOTHING_CHANGE
,
msg
=
message
)
@
apps_api
.
route
(
"/getBuildApp/<uuid:id>"
,
methods
=
[
'POST'
])
@
apps_api
.
route
(
"/getBuildApp/<uuid:id>"
,
methods
=
[
'POST'
])
@
validate_schema
(
LogAddScheme
)
@
Auth
.
auth_required
@
Auth
.
auth_required
def
get_build_app
(
id
):
def
get_build_app
(
id
):
user
=
request
.
current_user
.
get
(
"id"
)
user
=
request
.
current_user
.
get
(
"id"
)
...
...
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