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
1204dca2
Commit
1204dca2
authored
May 02, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use multi downloader
parent
20e63d7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
.idea/workspace.xml
.idea/workspace.xml
+7
-7
src/routes/upload.ts
src/routes/upload.ts
+4
-5
No files found.
.idea/workspace.xml
View file @
1204dca2
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"BookmarkManager"
>
<component
name=
"BookmarkManager"
>
<bookmark
url=
"file://$PROJECT_DIR$/src/routes/upload.ts"
line=
"
23
"
/>
<bookmark
url=
"file://$PROJECT_DIR$/src/routes/upload.ts"
line=
"
18
"
/>
</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=
""
>
...
@@ -65,8 +65,8 @@
...
@@ -65,8 +65,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=
"
229
"
>
<state
relative-caret-position=
"
308
"
>
<caret
line=
"1
97"
column=
"62"
lean-forward=
"false"
selection-start-line=
"197"
selection-start-column=
"62"
selection-end-line=
"197"
selection-end-column=
"62
"
/>
<caret
line=
"1
56"
column=
"0"
lean-forward=
"true"
selection-start-line=
"156"
selection-start-column=
"0"
selection-end-line=
"156"
selection-end-column=
"0
"
/>
<folding>
<folding>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
</folding>
</folding>
...
@@ -409,12 +409,12 @@
...
@@ -409,12 +409,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=
"16
280
000"
/>
<workItem
from=
"1493692283332"
duration=
"16
349
000"
/>
</task>
</task>
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"TimeTrackingManager"
>
<component
name=
"TimeTrackingManager"
>
<option
name=
"totallyTimeSpent"
value=
"218
051
000"
/>
<option
name=
"totallyTimeSpent"
value=
"218
120
000"
/>
</component>
</component>
<component
name=
"TodoView"
>
<component
name=
"TodoView"
>
<todo-panel
id=
"selected-file"
>
<todo-panel
id=
"selected-file"
>
...
@@ -844,8 +844,8 @@
...
@@ -844,8 +844,8 @@
</entry>
</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=
"
229
"
>
<state
relative-caret-position=
"
308
"
>
<caret
line=
"1
97"
column=
"62"
lean-forward=
"false"
selection-start-line=
"197"
selection-start-column=
"62"
selection-end-line=
"197"
selection-end-column=
"62
"
/>
<caret
line=
"1
56"
column=
"0"
lean-forward=
"true"
selection-start-line=
"156"
selection-start-column=
"0"
selection-end-line=
"156"
selection-end-column=
"0
"
/>
<folding>
<folding>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
<element
signature=
"e#0#28#0"
expanded=
"true"
/>
</folding>
</folding>
...
...
src/routes/upload.ts
View file @
1204dca2
...
@@ -12,13 +12,8 @@ import {mongodb} from '../models/Iridium';
...
@@ -12,13 +12,8 @@ import {mongodb} from '../models/Iridium';
import
{
toObjectID
}
from
'
iridium
'
;
import
{
toObjectID
}
from
'
iridium
'
;
import
config
from
'
../../config
'
;
import
config
from
'
../../config
'
;
import
{
UploadOSS
}
from
'
../utils
'
;
import
{
UploadOSS
}
from
'
../utils
'
;
import
Queue
from
'
../serives/Queue
'
;
import
Router
=
require
(
'
koa-router
'
);
import
Router
=
require
(
'
koa-router
'
);
const
downloader
=
new
Aria2
;
let
DownloadQueue
=
new
Queue
;
downloader
.
open
();
const
checkFilePath
=
async
(
file
)
=>
{
const
checkFilePath
=
async
(
file
)
=>
{
if
([
'
.gz
'
,
'
.rar
'
,
'
.zip
'
,
'
.7z
'
].
indexOf
(
path
.
extname
(
file
.
path
))
===
-
1
)
{
if
([
'
.gz
'
,
'
.rar
'
,
'
.zip
'
,
'
.7z
'
].
indexOf
(
path
.
extname
(
file
.
path
))
===
-
1
)
{
console
.
log
(
file
);
console
.
log
(
file
);
...
@@ -152,12 +147,16 @@ const uploadPackageUrl = async (ctx: Context) => {
...
@@ -152,12 +147,16 @@ 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
const
downloader
=
new
Aria2
;
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
;
let
_gid
;
if
(
!
pack
)
{
if
(
!
pack
)
{
return
ctx
.
throw
(
400
,
'
pack not exists
'
);
return
ctx
.
throw
(
400
,
'
pack not exists
'
);
}
}
await
downloader
.
open
();
downloader
.
onDownloadStart
=
async
(
gid
)
=>
{
downloader
.
onDownloadStart
=
async
(
gid
)
=>
{
_gid
=
gid
;
_gid
=
gid
;
pack
!
.
status
=
'
uploading
'
;
pack
!
.
status
=
'
uploading
'
;
...
...
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