Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
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
syntax_j
mycard
Commits
8adfd7c5
Commit
8adfd7c5
authored
Sep 08, 2016
by
h3remi7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aria2 init
parent
edbbf8ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
32 deletions
+57
-32
app/app-detail.component.html
app/app-detail.component.html
+1
-1
app/apps.service.ts
app/apps.service.ts
+56
-31
No files found.
app/app-detail.component.html
View file @
8adfd7c5
<h1>
{{name}}
</h1>
<h1>
{{name}}
</h1>
<h2>
{{appsService._aa}}
</h2>
<div
*ngIf=
"!isInstalled"
>
<div
*ngIf=
"!isInstalled"
>
<button
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
data-target=
"#install-modal"
>
安装
</button>
<button
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
data-target=
"#install-modal"
>
安装
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
导入
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
导入
</button>
...
...
app/apps.service.ts
View file @
8adfd7c5
...
@@ -8,8 +8,13 @@ import {AppLocal} from "./app-local";
...
@@ -8,8 +8,13 @@ import {AppLocal} from "./app-local";
export
class
AppsService
{
export
class
AppsService
{
constructor
(
private
http
:
Http
)
{
constructor
(
private
http
:
Http
)
{
let
cc
=
"
abdas19238d
"
;
let
loop
=
setInterval
(()
=>
{
this
.
downloads_info
[
cc
]
=
1
;
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
console
.
log
(
'
res:
'
,
res
);
this
.
downloadsInfo
=
res
;
})
},
1000
);
}
}
fs
=
window
[
'
System
'
].
_nodeRequire
(
'
fs
'
);
fs
=
window
[
'
System
'
].
_nodeRequire
(
'
fs
'
);
...
@@ -19,8 +24,50 @@ export class AppsService {
...
@@ -19,8 +24,50 @@ export class AppsService {
Aria2
=
window
[
'
System
'
].
_nodeRequire
(
'
aria2
'
);
Aria2
=
window
[
'
System
'
].
_nodeRequire
(
'
aria2
'
);
data
:
App
[];
data
:
App
[];
downloads_info
=
{};
downloadsInfo
=
{};
aria2IsOpen
=
false
;
_aria2
;
get
aria2
()
{
if
(
!
this
.
_aria2
)
{
this
.
_aria2
=
new
this
.
Aria2
();
console
.
log
(
"
new aria2
"
);
this
.
_aria2
.
onopen
=
()
=>
{
console
.
log
(
'
aria2 open
'
);
};
this
.
_aria2
.
onclose
=
()
=>
{
console
.
log
(
'
aria2 close
'
);
this
.
aria2IsOpen
=
false
;
};
this
.
_aria2
.
onDownloadComplete
=
(
response
)
=>
{
console
.
log
(
response
);
//aria2.tellStatus(tmp_gid, (err, res)=>{
// if(res.followedBy) {
// this.downloadsInfo[id] = res.followedBy[0];
// }
// console.log(res);
//});
};
this
.
_aria2
.
onmessage
=
(
m
)
=>
{
console
.
log
(
'
IN:
'
,
m
);
console
.
log
(
'
download infoi:
'
,
this
.
downloadsInfo
);
}
}
if
(
!
this
.
aria2IsOpen
)
{
this
.
_aria2
.
open
().
then
(()
=>
{
console
.
log
(
'
aria2 websocket open
'
)
this
.
aria2IsOpen
=
true
;
});
}
return
this
.
_aria2
;
}
_download_dir
;
_download_dir
;
get
download_dir
()
{
get
download_dir
()
{
...
@@ -55,45 +102,23 @@ export class AppsService {
...
@@ -55,45 +102,23 @@ export class AppsService {
}
}
download
(
id
,
uri
)
{
download
(
id
,
uri
)
{
const
aria2
=
new
this
.
Aria2
();
console
.
log
(
id
);
console
.
log
(
id
);
console
.
log
(
uri
);
console
.
log
(
uri
);
let
tmp_gid
;
let
tmp_gid
;
aria2
.
open
().
then
(()
=>
{
this
.
aria2
.
addUri
([
uri
],
{
'
dir
'
:
this
.
download_dir
},
(
error
,
gid
)
=>
{
aria2
.
addUri
([
uri
],
{
'
dir
'
:
this
.
download_dir
},
(
error
,
gid
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
}
}
console
.
log
(
gid
);
console
.
log
(
gid
);
tmp_gid
=
gid
;
tmp_gid
=
gid
;
});
});
});
aria2
.
onDownloadComplete
=
(
response
)
=>
{
console
.
log
(
response
);
aria2
.
tellStatus
(
tmp_gid
,
(
err
,
res
)
=>
{
if
(
res
.
followedBy
)
{
this
.
downloads_info
[
id
]
=
res
.
followedBy
[
0
];
}
console
.
log
(
res
);
});
};
}
}
getDownloadStatus
(
id
)
{
getDownloadStatus
(
id
)
{
let
gid
=
this
.
downloads_info
[
id
];
console
.
log
(
this
.
downloads_info
);
let
info
=
{};
let
info
=
{};
const
aria2
=
new
this
.
Aria2
();
aria2
.
tellStatus
(
gid
,
(
err
,
res
)
=>
{
console
.
log
(
res
);
info
=
res
;
});
return
info
;
return
info
;
...
...
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