Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
37175b9e
Commit
37175b9e
authored
May 02, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check did
parent
00768121
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
82 deletions
+53
-82
.idea/workspace.xml
.idea/workspace.xml
+33
-27
config.ts
config.ts
+1
-1
src/routes/upload.ts
src/routes/upload.ts
+19
-18
src/serives/Queue.ts
src/serives/Queue.ts
+0
-36
No files found.
.idea/workspace.xml
View file @
37175b9e
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
</component>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"f0cbce64-0ebc-4f60-8c2d-2fe9e214a8c0"
name=
"Default"
comment=
""
>
<list
default=
"true"
id=
"f0cbce64-0ebc-4f60-8c2d-2fe9e214a8c0"
name=
"Default"
comment=
""
>
<change
type=
"DELETED"
beforePath=
"$PROJECT_DIR$/src/serives/Queue.ts"
afterPath=
""
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/config.ts"
afterPath=
"$PROJECT_DIR$/config.ts"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/src/routes/upload.ts"
afterPath=
"$PROJECT_DIR$/src/routes/upload.ts"
/>
<change
type=
"MODIFICATION"
beforePath=
"$PROJECT_DIR$/src/routes/upload.ts"
afterPath=
"$PROJECT_DIR$/src/routes/upload.ts"
/>
</list>
</list>
<ignored
path=
"mycard-console-backend.iws"
/>
<ignored
path=
"mycard-console-backend.iws"
/>
...
@@ -65,8 +68,8 @@
...
@@ -65,8 +68,8 @@
<file
leaf-file-name=
"upload.ts"
pinned=
"false"
current-in-tab=
"true"
>
<file
leaf-file-name=
"upload.ts"
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/src/routes/upload.ts"
>
<entry
file=
"file://$PROJECT_DIR$/src/routes/upload.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
202
"
>
<state
relative-caret-position=
"
-584
"
>
<caret
line=
"1
82"
column=
"27"
lean-forward=
"true"
selection-start-line=
"182"
selection-start-column=
"27"
selection-end-line=
"182"
selection-end-column=
"27
"
/>
<caret
line=
"1
61"
column=
"15"
lean-forward=
"true"
selection-start-line=
"161"
selection-start-column=
"15"
selection-end-line=
"161"
selection-end-column=
"15
"
/>
<folding>
<folding>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
</folding>
</folding>
...
@@ -74,16 +77,6 @@
...
@@ -74,16 +77,6 @@
</provider>
</provider>
</entry>
</entry>
</file>
</file>
<file
leaf-file-name=
"Queue.ts"
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/src/serives/Queue.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"-51"
>
<caret
line=
"11"
column=
"3"
lean-forward=
"true"
selection-start-line=
"11"
selection-start-column=
"3"
selection-end-line=
"11"
selection-end-column=
"3"
/>
<folding
/>
</state>
</provider>
</entry>
</file>
</leaf>
</leaf>
</component>
</component>
<component
name=
"FileTemplateManagerImpl"
>
<component
name=
"FileTemplateManagerImpl"
>
...
@@ -168,11 +161,11 @@
...
@@ -168,11 +161,11 @@
<option
value=
"$PROJECT_DIR$/src/models/App.ts"
/>
<option
value=
"$PROJECT_DIR$/src/models/App.ts"
/>
<option
value=
"$PROJECT_DIR$/package/utils.ts"
/>
<option
value=
"$PROJECT_DIR$/package/utils.ts"
/>
<option
value=
"$PROJECT_DIR$/aria2.conf"
/>
<option
value=
"$PROJECT_DIR$/aria2.conf"
/>
<option
value=
"$PROJECT_DIR$/config.ts"
/>
<option
value=
"$PROJECT_DIR$/package/main.ts"
/>
<option
value=
"$PROJECT_DIR$/package/main.ts"
/>
<option
value=
"$PROJECT_DIR$/src/utils.ts"
/>
<option
value=
"$PROJECT_DIR$/src/utils.ts"
/>
<option
value=
"$PROJECT_DIR$/src/serives/download.ts"
/>
<option
value=
"$PROJECT_DIR$/src/serives/download.ts"
/>
<option
value=
"$PROJECT_DIR$/migrate.ts"
/>
<option
value=
"$PROJECT_DIR$/migrate.ts"
/>
<option
value=
"$PROJECT_DIR$/config.ts"
/>
<option
value=
"$PROJECT_DIR$/src/routes/upload.ts"
/>
<option
value=
"$PROJECT_DIR$/src/routes/upload.ts"
/>
</list>
</list>
</option>
</option>
...
@@ -230,6 +223,20 @@
...
@@ -230,6 +223,20 @@
<option
name=
"myItemType"
value=
"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode"
/>
<option
name=
"myItemType"
value=
"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode"
/>
</PATH_ELEMENT>
</PATH_ELEMENT>
</PATH>
</PATH>
<PATH>
<PATH_ELEMENT>
<option
name=
"myItemId"
value=
"moecube-console"
/>
<option
name=
"myItemType"
value=
"com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode"
/>
</PATH_ELEMENT>
<PATH_ELEMENT>
<option
name=
"myItemId"
value=
"moecube-console"
/>
<option
name=
"myItemType"
value=
"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode"
/>
</PATH_ELEMENT>
<PATH_ELEMENT>
<option
name=
"myItemId"
value=
"src"
/>
<option
name=
"myItemType"
value=
"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode"
/>
</PATH_ELEMENT>
</PATH>
</subPane>
</subPane>
</pane>
</pane>
</panes>
</panes>
...
@@ -405,12 +412,12 @@
...
@@ -405,12 +412,12 @@
<workItem
from=
"1493198225466"
duration=
"47067000"
/>
<workItem
from=
"1493198225466"
duration=
"47067000"
/>
<workItem
from=
"1493371982129"
duration=
"6000"
/>
<workItem
from=
"1493371982129"
duration=
"6000"
/>
<workItem
from=
"1493372010655"
duration=
"3472000"
/>
<workItem
from=
"1493372010655"
duration=
"3472000"
/>
<workItem
from=
"1493692283332"
duration=
"1
5219
000"
/>
<workItem
from=
"1493692283332"
duration=
"1
6251
000"
/>
</task>
</task>
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"TimeTrackingManager"
>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"21
6990
000"
/>
<option
name=
"totallyTimeSpent"
value=
"21
8022
000"
/>
</component>
</component>
<component
name=
"TodoView"
>
<component
name=
"TodoView"
>
<todo-panel
id=
"selected-file"
>
<todo-panel
id=
"selected-file"
>
...
@@ -423,7 +430,6 @@
...
@@ -423,7 +430,6 @@
</component>
</component>
<component
name=
"ToolWindowManager"
>
<component
name=
"ToolWindowManager"
>
<frame
x=
"55"
y=
"23"
width=
"1377"
height=
"872"
extended-state=
"0"
/>
<frame
x=
"55"
y=
"23"
width=
"1377"
height=
"872"
extended-state=
"0"
/>
<editor
active=
"true"
/>
<layout>
<layout>
<window_info
id=
"TODO"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"TODO"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"DB Browser"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"DB Browser"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.33"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
...
@@ -433,7 +439,7 @@
...
@@ -433,7 +439,7 @@
<window_info
id=
"Run"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32975295"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Run"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32975295"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Terminal"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.31794873"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Terminal"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.31794873"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"TypeScript"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32820514"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"TypeScript"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32820514"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Project"
active=
"
fals
e"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.14011799"
sideWeight=
"0.49384886"
order=
"0"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Project"
active=
"
tru
e"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
show_stripe_button=
"true"
weight=
"0.14011799"
sideWeight=
"0.49384886"
order=
"0"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Find"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32846716"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Find"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.32846716"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Structure"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.25"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Structure"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.25"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Favorites"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.23725356"
sideWeight=
"0.50615114"
order=
"2"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Favorites"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
show_stripe_button=
"true"
weight=
"0.23725356"
sideWeight=
"0.50615114"
order=
"2"
side_tool=
"true"
content_ui=
"tabs"
/>
...
@@ -762,14 +768,6 @@
...
@@ -762,14 +768,6 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/config.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"108"
>
<caret
line=
"6"
column=
"2"
lean-forward=
"false"
selection-start-line=
"6"
selection-start-column=
"2"
selection-end-line=
"6"
selection-end-column=
"2"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/package.json"
>
<entry
file=
"file://$PROJECT_DIR$/package.json"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"342"
>
<state
relative-caret-position=
"342"
>
...
@@ -838,10 +836,18 @@
...
@@ -838,10 +836,18 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/config.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"108"
>
<caret
line=
"6"
column=
"53"
lean-forward=
"true"
selection-start-line=
"6"
selection-start-column=
"53"
selection-end-line=
"6"
selection-end-column=
"53"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/routes/upload.ts"
>
<entry
file=
"file://$PROJECT_DIR$/src/routes/upload.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
202
"
>
<state
relative-caret-position=
"
-584
"
>
<caret
line=
"1
82"
column=
"27"
lean-forward=
"true"
selection-start-line=
"182"
selection-start-column=
"27"
selection-end-line=
"182"
selection-end-column=
"27
"
/>
<caret
line=
"1
61"
column=
"15"
lean-forward=
"true"
selection-start-line=
"161"
selection-start-column=
"15"
selection-end-line=
"161"
selection-end-column=
"15
"
/>
<folding>
<folding>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
</folding>
</folding>
...
...
config.ts
View file @
37175b9e
...
@@ -7,7 +7,7 @@ export default {
...
@@ -7,7 +7,7 @@ export default {
upload_path
:
path
.
join
(
__dirname
,
'
./test/upload
'
),
upload_path
:
path
.
join
(
__dirname
,
'
./test/upload
'
),
download_path
:
path
.
join
(
__dirname
,
'
./test/release/downloads
'
),
download_path
:
path
.
join
(
__dirname
,
'
./test/release/downloads
'
),
new_apps_json
:
`
${
baseUrl
}
/v2/apps`
,
new_apps_json
:
`
${
baseUrl
}
/v2/apps`
,
upload_url
:
`
${
test
Url
}
/v1/upload/packageUrl`
,
upload_url
:
`
${
base
Url
}
/v1/upload/packageUrl`
,
old_apps_json
:
'
https://api.moecube.com/apps.json
'
,
old_apps_json
:
'
https://api.moecube.com/apps.json
'
,
new_package
:
`
${
baseUrl
}
/v1/package/`
,
new_package
:
`
${
baseUrl
}
/v1/package/`
,
new_app
:
(
appId
)
=>
`
${
baseUrl
}
/v1/app/
${
appId
}
`
,
new_app
:
(
appId
)
=>
`
${
baseUrl
}
/v1/app/
${
appId
}
`
,
...
...
src/routes/upload.ts
View file @
37175b9e
...
@@ -152,18 +152,20 @@ const uploadPackageUrl = async (ctx: Context) => {
...
@@ -152,18 +152,20 @@ const uploadPackageUrl = async (ctx: Context) => {
ctx
.
throw
(
400
,
'
params error
'
);
ctx
.
throw
(
400
,
'
params error
'
);
}
}
// testUrl: https://r.my-card.in/release/dist/0c16a3ecb115fd7cf575ccdd64f62a8f3edc635b087950e4ed4f3f781972bbfd.tar.gz
// testUrl: https://r.my-card.in/release/dist/0c16a3ecb115fd7cf575ccdd64f62a8f3edc635b087950e4ed4f3f781972bbfd.tar.gz
DownloadQueue
.
run
(
async
(
queue
,
_next
)
=>
{
let
pack
=
await
mongodb
.
Packages
.
findOne
({
_id
:
toObjectID
(
ctx
.
request
.
body
.
_id
)});
let
pack
=
await
mongodb
.
Packages
.
findOne
({
_id
:
toObjectID
(
ctx
.
request
.
body
.
_id
)})
;
let
_gid
;
if
(
!
pack
)
{
if
(
!
pack
)
{
return
ctx
.
throw
(
400
,
'
pack not exists
'
);
return
ctx
.
throw
(
400
,
'
pack not exists
'
);
}
}
downloader
.
onDownloadStart
=
async
()
=>
{
downloader
.
onDownloadStart
=
async
(
gid
)
=>
{
pack
!
.
status
=
'
uploading
'
;
_gid
=
gid
;
await
pack
!
.
save
();
pack
!
.
status
=
'
uploading
'
;
};
await
pack
!
.
save
();
};
downloader
.
onDownloadComplete
=
async
(
m
)
=>
{
downloader
.
onDownloadComplete
=
async
(
m
)
=>
{
if
(
m
.
gid
=
_gid
)
{
const
{
files
}
=
await
downloader
.
send
(
'
tellStatus
'
,
m
.
gid
);
const
{
files
}
=
await
downloader
.
send
(
'
tellStatus
'
,
m
.
gid
);
const
[
file
]
=
files
;
const
[
file
]
=
files
;
...
@@ -184,23 +186,22 @@ const uploadPackageUrl = async (ctx: Context) => {
...
@@ -184,23 +186,22 @@ const uploadPackageUrl = async (ctx: Context) => {
// 上传完,干掉本地目录
// 上传完,干掉本地目录
await
fs
.
removeAsync
(
bundled
.
distPath
);
await
fs
.
removeAsync
(
bundled
.
distPath
);
_next
();
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
trace
(
e
);
console
.
trace
(
e
);
pack
!
.
status
=
'
failed
'
;
pack
!
.
status
=
'
failed
'
;
await
pack
!
.
save
();
await
pack
!
.
save
();
_next
();
}
}
};
}
};
downloader
.
onDownloadError
=
async
(
err
)
=>
{
downloader
.
onDownloadError
=
async
(
err
)
=>
{
// console.log(await downloader.send('tellStatus', err.gid))
// console.log(await downloader.send('tellStatus', err.gid))
if
(
err
.
gid
=
_gid
)
{
pack
!
.
status
=
'
failed
'
;
pack
!
.
status
=
'
failed
'
;
await
pack
!
.
save
();
await
pack
!
.
save
();
console
.
log
(
err
);
console
.
log
(
err
);
_next
();
}
};
};
});
ctx
.
body
=
await
new
Promise
((
resolve
,
reject
)
=>
{
ctx
.
body
=
await
new
Promise
((
resolve
,
reject
)
=>
{
...
...
src/serives/Queue.ts
deleted
100644 → 0
View file @
00768121
export
default
class
Queue
{
running
:
number
;
queue
:
Function
[];
concurrency
:
number
;
constructor
()
{
this
.
concurrency
=
1
;
this
.
running
=
0
;
this
.
queue
=
[];
}
set
(
args
)
{
return
Object
.
assign
(
this
,
args
);
}
run
(
task
)
{
this
.
queue
.
push
(
task
);
this
.
next
();
return
this
;
}
next
()
{
while
(
this
.
running
<
this
.
concurrency
&&
this
.
queue
.
length
)
{
let
task
=
this
.
queue
.
shift
();
if
(
task
)
{
task
(
this
,
()
=>
{
this
.
running
--
;
this
.
next
();
});
this
.
running
++
;
}
}
}
}
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