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
f5212323
Commit
f5212323
authored
May 02, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only one arira2 socket channel
parent
c6a497f9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
64 deletions
+55
-64
.idea/workspace.xml
.idea/workspace.xml
+46
-56
package/main.ts
package/main.ts
+4
-3
src/routes/upload.ts
src/routes/upload.ts
+5
-5
No files found.
.idea/workspace.xml
View file @
f5212323
This diff is collapsed.
Click to expand it.
package/main.ts
View file @
f5212323
...
@@ -75,12 +75,13 @@ export async function bundle(...args) {
...
@@ -75,12 +75,13 @@ export async function bundle(...args) {
const
fullHash
=
await
caculateSHA256
(
filePath
);
const
fullHash
=
await
caculateSHA256
(
filePath
);
const
fullSize
=
(
await
fs
.
statAsync
(
filePath
)).
size
;
const
fullSize
=
(
await
fs
.
statAsync
(
filePath
)).
size
;
let
fullPath
=
path
.
join
(
path
.
dirname
(
filePath
)
,
`
${
fullHash
}
.tar.gz`
);
let
fullPath
=
path
.
join
(
dist_path
,
`
${
fullHash
}
.tar.gz`
);
await
fs
.
renameAsync
(
filePath
,
fullPath
);
await
fs
.
renameAsync
(
filePath
,
fullPath
);
await
fs
.
removeAsync
(
uploadFile_path
);
await
fs
.
removeAsync
(
package_path
);
return
{
return
{
uploadFilePath
:
uploadFile_path
,
pckagePath
:
package_path
,
distPath
:
dist_path
,
distPath
:
dist_path
,
files
:
Array
.
from
(
files
.
values
()),
files
:
Array
.
from
(
files
.
values
()),
archives
:
Array
.
from
(
archives
.
values
()),
archives
:
Array
.
from
(
archives
.
values
()),
...
...
src/routes/upload.ts
View file @
f5212323
...
@@ -14,6 +14,11 @@ import config from '../../config';
...
@@ -14,6 +14,11 @@ import config from '../../config';
import
{
UploadOSS
}
from
'
../utils
'
;
import
{
UploadOSS
}
from
'
../utils
'
;
import
Router
=
require
(
'
koa-router
'
);
import
Router
=
require
(
'
koa-router
'
);
const
downloader
=
new
Aria2
;
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
);
...
@@ -148,15 +153,12 @@ const uploadPackageUrl = async (ctx: Context) => {
...
@@ -148,15 +153,12 @@ const uploadPackageUrl = async (ctx: Context) => {
}
}
// 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
)});
if
(
!
pack
)
{
if
(
!
pack
)
{
return
ctx
.
throw
(
400
,
'
pack not exists
'
);
return
ctx
.
throw
(
400
,
'
pack not exists
'
);
}
}
await
downloader
.
open
();
downloader
.
onDownloadStart
=
async
()
=>
{
downloader
.
onDownloadStart
=
async
()
=>
{
pack
!
.
status
=
'
uploading
'
;
pack
!
.
status
=
'
uploading
'
;
await
pack
!
.
save
();
await
pack
!
.
save
();
...
@@ -183,8 +185,6 @@ const uploadPackageUrl = async (ctx: Context) => {
...
@@ -183,8 +185,6 @@ const uploadPackageUrl = async (ctx: Context) => {
// 上传完,干掉本地目录
// 上传完,干掉本地目录
await
fs
.
removeAsync
(
bundled
.
distPath
);
await
fs
.
removeAsync
(
bundled
.
distPath
);
await
fs
.
removeAsync
(
bundled
.
pckagePath
);
await
fs
.
removeAsync
(
bundled
.
uploadFilePath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
trace
(
e
);
console
.
trace
(
e
);
pack
!
.
status
=
'
failed
'
;
pack
!
.
status
=
'
failed
'
;
...
...
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