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
34a9559e
Commit
34a9559e
authored
May 02, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QAQ
parent
393fdaaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
35 deletions
+29
-35
.idea/workspace.xml
.idea/workspace.xml
+10
-21
src/routes/upload.ts
src/routes/upload.ts
+19
-14
No files found.
.idea/workspace.xml
View file @
34a9559e
...
...
@@ -66,11 +66,9 @@
<file
leaf-file-name=
"upload.ts"
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/src/routes/upload.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"182"
>
<caret
line=
"158"
column=
"0"
lean-forward=
"true"
selection-start-line=
"158"
selection-start-column=
"0"
selection-end-line=
"158"
selection-end-column=
"0"
/>
<folding>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"298"
>
<caret
line=
"201"
column=
"28"
lean-forward=
"true"
selection-start-line=
"201"
selection-start-column=
"28"
selection-end-line=
"201"
selection-end-column=
"28"
/>
<folding
/>
</state>
</provider>
</entry>
...
...
@@ -410,12 +408,12 @@
<workItem
from=
"1493198225466"
duration=
"47067000"
/>
<workItem
from=
"1493371982129"
duration=
"6000"
/>
<workItem
from=
"1493372010655"
duration=
"3472000"
/>
<workItem
from=
"1493692283332"
duration=
"1
6749
000"
/>
<workItem
from=
"1493692283332"
duration=
"1
8515
000"
/>
</task>
<servers
/>
</component>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"2
18520
000"
/>
<option
name=
"totallyTimeSpent"
value=
"2
20286
000"
/>
</component>
<component
name=
"TodoView"
>
<todo-panel
id=
"selected-file"
>
...
...
@@ -518,13 +516,6 @@
</component>
<component
name=
"XDebuggerManager"
>
<breakpoint-manager>
<breakpoints>
<line-breakpoint
enabled=
"true"
type=
"javascript"
>
<url>
file://$PROJECT_DIR$/src/routes/upload.ts
</url>
<line>
154
</line>
<properties
/>
</line-breakpoint>
</breakpoints>
<option
name=
"time"
value=
"1"
/>
</breakpoint-manager>
<watches-manager
/>
...
...
@@ -845,19 +836,17 @@
</entry>
<entry
file=
"file://$PROJECT_DIR$/config.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
198
"
>
<caret
line=
"1
1"
column=
"40"
lean-forward=
"true"
selection-start-line=
"11"
selection-start-column=
"40"
selection-end-line=
"11"
selection-end-column=
"40
"
/>
<state
relative-caret-position=
"
216
"
>
<caret
line=
"1
2"
column=
"51"
lean-forward=
"true"
selection-start-line=
"12"
selection-start-column=
"51"
selection-end-line=
"12"
selection-end-column=
"51
"
/>
<folding
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/routes/upload.ts"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"182"
>
<caret
line=
"158"
column=
"0"
lean-forward=
"true"
selection-start-line=
"158"
selection-start-column=
"0"
selection-end-line=
"158"
selection-end-column=
"0"
/>
<folding>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"298"
>
<caret
line=
"201"
column=
"28"
lean-forward=
"true"
selection-start-line=
"201"
selection-start-column=
"28"
selection-end-line=
"201"
selection-end-column=
"28"
/>
<folding
/>
</state>
</provider>
</entry>
...
...
src/routes/upload.ts
View file @
34a9559e
...
...
@@ -149,26 +149,28 @@ const uploadPackageUrl = async (ctx: Context) => {
// testUrl: https://r.my-card.in/release/dist/0c16a3ecb115fd7cf575ccdd64f62a8f3edc635b087950e4ed4f3f781972bbfd.tar.gz
const
downloader
=
new
Aria2
;
await
downloader
.
open
();
let
pack
=
await
mongodb
.
Packages
.
findOne
({
_id
:
toObjectID
(
ctx
.
request
.
body
.
_id
)});
let
_gid
;
if
(
!
pack
)
{
return
ctx
.
throw
(
400
,
'
pack not exists
'
);
}
await
downloader
.
open
();
downloader
.
onDownloadStart
=
async
({
gid
})
=>
{
_gid
=
gid
;
console
.
log
(
gid
);
pack
!
.
status
=
'
uploading
'
;
await
pack
!
.
save
();
const
{
files
}
=
await
downloader
.
send
(
'
tellStatus
'
,
gid
);
const
[
file
]
=
files
;
const
[
url
]
=
file
.
uris
;
if
(
ctx
.
request
.
body
.
url
==
url
.
uri
)
{
pack
!
.
status
=
'
uploading
'
;
await
pack
!
.
save
();
}
};
downloader
.
onDownloadComplete
=
async
(
m
)
=>
{
if
(
m
.
gid
==
_gid
)
{
const
{
files
}
=
await
downloader
.
send
(
'
tellStatus
'
,
m
.
gid
)
;
const
[
file
]
=
file
s
;
downloader
.
onDownloadComplete
=
async
(
{
gid
}
)
=>
{
const
{
files
}
=
await
downloader
.
send
(
'
tellStatus
'
,
gid
);
const
[
file
]
=
files
;
const
[
url
]
=
file
.
uri
s
;
if
(
ctx
.
request
.
body
.
url
==
url
.
uri
)
{
try
{
await
checkFilePath
(
file
);
...
...
@@ -195,8 +197,11 @@ const uploadPackageUrl = async (ctx: Context) => {
};
downloader
.
onDownloadError
=
async
(
err
)
=>
{
// console.log(await downloader.send('tellStatus', err.gid))
if
(
err
.
gid
==
_gid
)
{
const
{
files
}
=
await
downloader
.
send
(
'
tellStatus
'
,
err
.
gid
);
const
[
file
]
=
files
;
const
[
url
]
=
file
.
uris
;
if
(
ctx
.
request
.
body
.
url
==
url
.
uri
)
{
pack
!
.
status
=
'
failed
'
;
await
pack
!
.
save
();
console
.
log
(
err
);
...
...
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