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
c4c7bf92
Commit
c4c7bf92
authored
Mar 14, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ca144cb6
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
60 additions
and
67 deletions
+60
-67
backend/app-store.db
backend/app-store.db
+0
-0
backend/app/setting.py
backend/app/setting.py
+1
-2
backend/controller/build_logs_manager.py
backend/controller/build_logs_manager.py
+2
-3
backend/controller/upload_manager.py
backend/controller/upload_manager.py
+2
-2
backend/deploy.py
backend/deploy.py
+2
-2
backend/view/netdisc.py
backend/view/netdisc.py
+1
-2
frontend/src/utils/index.js
frontend/src/utils/index.js
+8
-0
frontend/src/utils/utils.js
frontend/src/utils/utils.js
+24
-46
frontend/src/views/app-store/build.vue
frontend/src/views/app-store/build.vue
+1
-0
frontend/src/views/app-store/framework.vue
frontend/src/views/app-store/framework.vue
+7
-5
frontend/src/views/app-store/index.vue
frontend/src/views/app-store/index.vue
+12
-5
No files found.
backend/app-store.db
View file @
c4c7bf92
No preview for this file type
backend/app/setting.py
View file @
c4c7bf92
...
...
@@ -11,7 +11,7 @@ config = dict(
NAME
=
'evm_store'
,
DEBUG
=
True
,
HOST
=
"0.0.0.0"
,
PORT
=
5000
,
PORT
=
9999
,
SECRET_KEY
=
'secret_key_EhuqUkwV'
,
LOGIN_DISABLED
=
False
,
BACKUP_DIR
=
conf
.
get
(
'application'
,
'backup_dir'
),
...
...
@@ -25,7 +25,6 @@ config = dict(
},
TABLE_PREFIX
=
'evm_store_'
,
MD5_SALT
=
"EhuqUkwV"
,
UPLOAD_SERVER
=
"{}://{}:{}/"
.
format
(
conf
.
get
(
'uploads'
,
'protocol'
),
conf
.
get
(
'uploads'
,
'host'
),
conf
.
get
(
'uploads'
,
'port'
)),
UPLOAD_PATH
=
os
.
getcwd
(),
UPLOAD_DIR
=
conf
.
get
(
'uploads'
,
'upload_dir'
),
TEMPLATE_PATH
=
os
.
path
.
join
(
os
.
getcwd
(),
"static"
),
...
...
backend/controller/build_logs_manager.py
View file @
c4c7bf92
...
...
@@ -80,12 +80,11 @@ class BuildLogsManager(object):
for
af
in
app_files
:
if
sf
.
id
==
af
[
0
]:
t
=
os
.
path
.
normpath
(
af
[
1
]
.
replace
(
config
.
get
(
"UPLOAD_PATH"
),
""
))
.
replace
(
'
\\
'
,
'/'
)
sf
.
set
(
path
=
urljoin
(
config
.
get
(
"UPLOAD_SERVER"
),
t
)
)
sf
.
set
(
path
=
t
)
flush
()
commit
()
epk_path
=
os
.
sep
.
join
([
target_dir
.
replace
(
config
.
get
(
"UPLOAD_PATH"
),
""
),
"{}.epk"
.
format
(
dir_format
)])
epk_path
=
urljoin
(
config
.
get
(
"UPLOAD_SERVER"
),
epk_path
.
replace
(
'
\\
'
,
'/'
))
epk_path
=
os
.
sep
.
join
([
target_dir
.
replace
(
config
.
get
(
"UPLOAD_PATH"
),
""
),
"{}.epk"
.
format
(
dir_format
)])
.
replace
(
'
\\
'
,
'/'
)
app_info
[
'md5'
]
=
str
(
app_info
[
'md5'
])
result
=
BuildLogs
(
app
=
app
,
app_path
=
epk_path
,
app_info
=
app_info
,
create_by
=
editor
,
create_at
=
datetime
.
now
(),
update_by
=
editor
,
update_at
=
datetime
.
now
())
...
...
backend/controller/upload_manager.py
View file @
c4c7bf92
...
...
@@ -146,8 +146,8 @@ class UploadManager(object):
return
{
"uuid"
:
str
(
uuid
.
uuid4
()),
# 附件唯一编号
"filename"
:
obj
[
'filename'
],
# 附件名称
"filesize"
:
os
.
path
.
getsize
(
saveFile
),
# 附件大小
"filepath"
:
parse
.
urljoin
(
config
.
get
(
"UPLOAD_SERVER"
),
'/'
.
join
(
os
.
path
.
join
(
relative_path
,
filename
)
.
split
(
'
\\
'
))
),
# 附件存储路径
"filesize"
:
os
.
path
.
getsize
(
saveFile
),
# 附件大小
"filepath"
:
os
.
sep
.
join
([
relative_path
,
filename
])
.
replace
(
"
\\
"
,
"/"
),
# 附件存储路径
},
"upload file [
%
s] successfully!"
%
obj
[
'filename'
]
except
Exception
as
e
:
# repr(e)
traceback
.
print_exc
()
...
...
backend/deploy.py
View file @
c4c7bf92
...
...
@@ -58,9 +58,9 @@ def update_nginx_conf():
lines
=
src
.
readlines
()
for
content
in
lines
:
if
content
.
find
(
" listen 80;"
)
!=
-
1
:
dst
.
write
(
" listen {};
\n
"
.
format
(
conf
.
get
(
'uploads'
,
'port'
)))
dst
.
write
(
" listen {};
\n
"
.
format
(
conf
.
get
(
'uploads'
,
'port'
)
or
80
))
elif
content
.
find
(
" server_name localhost;"
)
!=
-
1
:
dst
.
write
(
" server_name {};
\n
"
.
format
(
conf
.
get
(
'uploads'
,
'host'
)))
dst
.
write
(
" server_name {};
\n
"
.
format
(
conf
.
get
(
'uploads'
,
'host'
)
or
"localhost"
))
elif
content
.
find
(
" root html;"
)
!=
-
1
:
dst
.
write
(
" root {};
\n
"
.
format
(
os
.
getcwd
()))
else
:
...
...
backend/view/netdisc.py
View file @
c4c7bf92
...
...
@@ -11,7 +11,6 @@ from fullstack.login import Auth
from
fullstack.validation
import
validate_schema
from
fullstack.response
import
ResponseCode
,
response_result
from
schema.netdisc
import
AddSchema
,
DeleteSchema
,
QuerySchema
,
UpdateSchema
from
app.setting
import
config
from
utils
import
random_string
logger
=
logging
.
getLogger
(
"netdiscApi"
)
...
...
@@ -136,7 +135,7 @@ def get_list():
try
:
result
,
count
,
message
=
signalManager
.
actionGetNetDiscList
.
emit
(
request
.
schema_data
)
if
result
:
return
response_result
(
ResponseCode
.
OK
,
data
=
result
,
msg
=
message
,
count
=
count
,
url
=
config
.
get
(
"UPLOAD_SERVER"
)
)
return
response_result
(
ResponseCode
.
OK
,
data
=
result
,
msg
=
message
,
count
=
count
)
else
:
return
response_result
(
ResponseCode
.
REQUEST_ERROR
,
msg
=
message
)
except
Exception
as
e
:
...
...
frontend/src/utils/index.js
View file @
c4c7bf92
...
...
@@ -294,3 +294,11 @@ export function download(name, url) {
resolve
();
});
}
export
function
checkURL
(
URL
)
{
var
str
=
URL
,
Expression
=
/http
(
s
)?
:
\/\/([\w
-
]
+
\.)
+
[\w
-
]
+
(\/[\w
- .
\/
?%&=
]
*
)?
/
,
objExp
=
new
RegExp
(
Expression
);
return
objExp
.
test
(
str
)
}
frontend/src/utils/utils.js
View file @
c4c7bf92
import
utils
from
"
hey-utils
"
;
const
rclass
=
/
[\t\r\n\f]
/g
;
export
default
utils
.
extend
({},
utils
,
{
getClass
(
elem
)
{
return
(
elem
.
getAttribute
&&
elem
.
getAttribute
(
"
class
"
))
||
""
;
},
hasClass
(
elem
,
selector
)
{
let
className
;
className
=
`
${
selector
}
`
;
if
(
elem
.
nodeType
===
1
&&
`
${
this
.
getClass
(
elem
)}
`
.
replace
(
rclass
,
"
"
).
indexOf
(
className
)
>
-
1
)
{
return
true
;
}
return
false
;
},
});
function
formatNumber
(
n
)
{
n
=
n
.
toString
();
return
n
[
1
]
?
n
:
"
0
"
+
n
;
n
=
n
.
toString
();
return
n
[
1
]
?
n
:
"
0
"
+
n
;
}
export
function
getUTCDateTime
(
datetime
)
{
var
year
=
datetime
.
getUTCFullYear
();
var
month
=
datetime
.
getUTCMonth
()
+
1
;
var
day
=
datetime
.
getUTCDate
();
var
hour
=
datetime
.
getUTCHours
();
var
minute
=
datetime
.
getUTCMinutes
();
var
second
=
datetime
.
getUTCSeconds
();
return
[
year
,
month
,
day
,
hour
,
minute
,
second
].
map
(
formatNumber
);
var
year
=
datetime
.
getUTCFullYear
();
var
month
=
datetime
.
getUTCMonth
()
+
1
;
var
day
=
datetime
.
getUTCDate
();
var
hour
=
datetime
.
getUTCHours
();
var
minute
=
datetime
.
getUTCMinutes
();
var
second
=
datetime
.
getUTCSeconds
();
return
[
year
,
month
,
day
,
hour
,
minute
,
second
].
map
(
formatNumber
);
}
export
function
formatDateTime
(
datetime
=
[],
format
=
[
"
-
"
,
"
-
"
,
"
"
,
"
:
"
,
"
:
"
]
datetime
=
[],
format
=
[
"
-
"
,
"
-
"
,
"
"
,
"
:
"
,
"
:
"
]
)
{
let
result
=
""
;
datetime
.
forEach
((
d
,
i
)
=>
{
result
+=
i
<
5
?
d
+
format
[
i
]
:
d
;
});
return
result
;
let
result
=
""
;
datetime
.
forEach
((
d
,
i
)
=>
{
result
+=
i
<
5
?
d
+
format
[
i
]
:
d
;
});
return
result
;
}
export
function
formatUTCDateTime
(
datetime
)
{
if
(
!
(
datetime
instanceof
Date
))
datetime
=
new
Date
(
datetime
);
datetime
=
getUTCDateTime
(
datetime
);
const
format
=
[
"
-
"
,
"
-
"
,
"
"
,
"
:
"
,
"
:
"
];
let
result
=
""
;
datetime
.
forEach
((
d
,
i
)
=>
{
result
+=
i
<
5
?
d
+
format
[
i
]
:
d
;
});
return
result
;
if
(
!
(
datetime
instanceof
Date
))
datetime
=
new
Date
(
datetime
);
datetime
=
getUTCDateTime
(
datetime
);
const
format
=
[
"
-
"
,
"
-
"
,
"
"
,
"
:
"
,
"
:
"
];
let
result
=
""
;
datetime
.
forEach
((
d
,
i
)
=>
{
result
+=
i
<
5
?
d
+
format
[
i
]
:
d
;
});
return
result
;
}
frontend/src/views/app-store/build.vue
View file @
c4c7bf92
...
...
@@ -169,6 +169,7 @@ export default {
const
body
=
document
.
getElementsByTagName
(
"
body
"
)[
0
];
const
link
=
document
.
createElement
(
"
a
"
);
body
.
appendChild
(
link
);
link
.
target
=
"
_blank
"
;
link
.
href
=
row
.
app_path
;
link
.
click
();
document
.
body
.
removeChild
(
link
);
...
...
frontend/src/views/app-store/framework.vue
View file @
c4c7bf92
...
...
@@ -64,7 +64,7 @@
</template>
<
script
>
import
{
getFrameworkList
,
deleteFramework
,
addFramework
,
updateFramework
}
from
'
@/api/app-store
'
import
{
mapTrim
,
compareObjectDiff
}
from
'
@/utils/index
'
import
{
mapTrim
,
compareObjectDiff
,
checkURL
}
from
'
@/utils/index
'
import
{
formatUTCDateTime
}
from
'
@/utils/utils
'
export
default
{
name
:
"
Framework
"
,
...
...
@@ -169,11 +169,13 @@ export default {
}
})
},
handleRemove
()
{
},
handleRemove
()
{},
handleSuccess
(
res
)
{
this
.
post
.
assets
.
files
.
push
(
res
.
data
.
filepath
)
if
(
res
.
code
==
200
)
{
if
(
!
checkURL
(
res
.
data
.
filepath
))
res
.
data
.
filepath
=
`
${
window
.
location
.
origin
}
/
${
res
.
data
.
filepath
}
`
this
.
post
.
assets
.
files
.
push
(
res
.
data
.
filepath
)
}
},
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
...
...
frontend/src/views/app-store/index.vue
View file @
c4c7bf92
...
...
@@ -130,7 +130,7 @@
drag
:action=
"`${window.location.protocol}//${window.location.host}/api/v1/evm_store/upload`"
:on-remove=
"handleRemove"
:on-success=
"handle
AppFiles
UploadSuccess"
:on-success=
"handleUploadSuccess"
multiple
name=
"binfile"
>
...
...
@@ -189,7 +189,7 @@
</template>
<
script
>
import
{
getAppsList
,
deleteApp
,
addApp
,
updateApp
,
buildApp
,
addFramework
}
from
"
@/api/app-store
"
;
import
{
mapTrim
}
from
"
@/utils/index
"
;
import
{
mapTrim
,
checkURL
}
from
"
@/utils/index
"
;
export
default
{
name
:
"
AppIndex
"
,
...
...
@@ -299,12 +299,19 @@ export default {
}
);
},
handleAppFilesUploadSuccess
(
res
)
{
this
.
post
.
app_files
.
push
(
res
.
data
)
handleUploadSuccess
(
res
)
{
if
(
res
.
code
==
200
)
{
if
(
!
checkURL
(
res
.
data
.
filepath
))
res
.
data
.
filepath
=
`
${
window
.
location
.
origin
}
/
${
res
.
data
.
filepath
}
`
this
.
post
.
app_files
.
push
(
res
.
data
)
}
},
handleAvatarSuccess
(
res
,
file
)
{
if
(
res
.
code
==
200
)
if
(
res
.
code
==
200
)
{
if
(
!
checkURL
(
res
.
data
.
filepath
))
res
.
data
.
filepath
=
`
${
window
.
location
.
origin
}
/
${
res
.
data
.
filepath
}
`
this
.
post
.
app_icon
=
res
.
data
}
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
);
},
beforeAvatarUpload
()
{
...
...
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