Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
moecube
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
JoyJ
moecube
Commits
63355870
Commit
63355870
authored
Sep 07, 2016
by
h3remi7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add aria2
parent
51645d88
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
9 deletions
+75
-9
app/app-detail.component.html
app/app-detail.component.html
+1
-1
app/app-detail.component.ts
app/app-detail.component.ts
+10
-4
app/app.service.ts
app/app.service.ts
+30
-0
app/apps.component.ts
app/apps.component.ts
+2
-2
app/apps.service.ts
app/apps.service.ts
+1
-1
app/mycard.module.ts
app/mycard.module.ts
+2
-1
index.js
index.js
+29
-0
No files found.
app/app-detail.component.html
View file @
63355870
...
...
@@ -55,7 +55,7 @@
<td>
{{searchApp(mod.id).name[searchApp(mod.id).locales[0]]}}
</td>
<td>
{{mod.type}}
</td>
<td
*ngIf=
"checkInstall(mod.id)"
><button
type=
"button"
class=
"btn btn-danger btn-sm"
>
卸载
</button></td>
<td
*ngIf=
"!checkInstall(mod.id)"
><button
type=
"button"
class=
"btn btn-primary btn-sm"
>
安装
</button></td>
<td
*ngIf=
"!checkInstall(mod.id)"
><button
(click)=
"install()"
type=
"button"
class=
"btn btn-primary btn-sm"
>
安装
</button></td>
</tr>
</tbody>
</table>
...
...
app/app-detail.component.ts
View file @
63355870
import
{
Component
}
from
'
@angular/core
'
;
import
{
AppsService
}
from
'
./apps.service
'
import
{
AppService
}
from
'
./app.service
'
import
{
RoutingService
}
from
'
./routing.service
'
import
{
App
}
from
"
./app
"
;
...
...
@@ -12,6 +13,8 @@ declare var process;
})
export
class
AppDetailComponent
{
constructor
(
private
appsService
:
AppsService
,
private
appService
:
AppService
,
private
routingService
:
RoutingService
)
{
}
_currentApp
;
get
currentApp
():
App
{
return
this
.
searchApp
(
this
.
routingService
.
app
);
...
...
@@ -55,7 +58,6 @@ export class AppDetailComponent {
if
(
this
.
currentApp
)
{
if
(
this
.
currentApp
.
references
[
process
.
platform
]
&&
this
.
currentApp
.
references
[
process
.
platform
].
length
>
0
)
{
console
.
log
(
this
.
currentApp
.
references
[
process
.
platform
]);
let
refs
=
this
.
currentApp
.
references
[
process
.
platform
];
refs
=
refs
.
filter
((
ref
)
=>
{
return
contains
.
includes
(
ref
.
type
);
...
...
@@ -72,7 +74,7 @@ export class AppDetailComponent {
default
:
break
;
}
console
.
log
(
tmp
.
type
);
//
console.log(tmp.type);
return
tmp
;
});
return
refs
;
...
...
@@ -82,8 +84,6 @@ export class AppDetailComponent {
}
}
constructor
(
private
appsService
:
AppsService
,
private
routingService
:
RoutingService
)
{
}
searchApp
(
id
):
App
{
let
data
=
this
.
appsService
.
data
;
...
...
@@ -103,4 +103,10 @@ export class AppDetailComponent {
return
false
;
}
install
()
{
this
.
appService
.
download
();
}
}
app/app.service.ts
0 → 100644
View file @
63355870
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Http
}
from
'
@angular/http
'
;
import
'
rxjs/Rx
'
;
import
{
AppLocal
}
from
"
./app-local
"
;
// declare var System;
@
Injectable
()
export
class
AppService
{
Aria2
=
window
[
'
System
'
].
_nodeRequire
(
'
aria2
'
);
constructor
(
private
http
:
Http
)
{
}
download
()
{
const
aria2
=
new
this
.
Aria2
();
console
.
log
(
aria2
);
aria2
.
open
(()
=>
{
//aria2.addUri(['http://thief.mycard.moe/metalinks/th13.meta4']);
})
}
}
app/apps.component.ts
View file @
63355870
...
...
@@ -12,11 +12,11 @@ export class AppsComponent {
constructor
(
private
appsService
:
AppsService
,
private
routingService
:
RoutingService
)
{
appsService
.
getApps
(()
=>
{
console
.
log
(
appsService
.
data
)
//
console.log(appsService.data)
if
(
appsService
.
data
.
length
>
0
)
{
this
.
selectApp
(
appsService
.
data
[
0
].
id
);
let
tmp
=
this
.
appsService
.
data
.
filter
((
v
)
=>
v
.
id
===
this
.
routingService
.
app
);
console
.
log
(
tmp
);
//
console.log(tmp);
}
});
}
...
...
app/apps.service.ts
View file @
63355870
...
...
@@ -19,7 +19,7 @@ export class AppsService {
})
.
subscribe
(
data
=>
{
this
.
data
=
data
;
console
.
log
(
this
.
data
);
//
console.log(this.data);
if
(
typeof
(
callback
)
===
'
function
'
)
{
callback
();
}
...
...
app/mycard.module.ts
View file @
63355870
...
...
@@ -14,12 +14,13 @@ import { CommunityComponent } from './community.component';
import
{
RoutingService
}
from
'
./routing.service
'
;
import
{
AppsService
}
from
'
./apps.service
'
;
import
{
AppService
}
from
'
./app.service
'
;
@
NgModule
({
imports
:
[
BrowserModule
,
HttpModule
],
declarations
:
[
MyCardComponent
,
LoginComponent
,
StoreComponent
,
LobbyComponent
,
CommunityComponent
,
AppsComponent
,
AppDetailComponent
,
RosterComponent
,
CandyComponent
],
bootstrap
:
[
MyCardComponent
],
providers
:
[
RoutingService
,
AppsService
],
providers
:
[
RoutingService
,
AppsService
,
AppService
],
})
export
class
MyCard
{
}
\ No newline at end of file
index.js
View file @
63355870
...
...
@@ -4,6 +4,35 @@ const app = electron.app
// Module to create native browser window.
const
BrowserWindow
=
electron
.
BrowserWindow
function
createAria2c
()
{
"
use strict
"
;
const
ChildProcess
=
require
(
'
child_process
'
);
const
path
=
require
(
'
path
'
);
const
appFolder
=
path
.
resolve
(
process
.
execPath
,
'
..
'
);
const
rootAtomFolder
=
path
.
resolve
(
appFolder
,
'
..
'
);
const
aria2Bin
=
path
.
resolve
(
path
.
join
(
rootAtomFolder
,
'
aria2c.exe
'
));
const
aria2Name
=
'
arai2
'
;
const
spawn
=
function
(
command
,
args
)
{
let
spawnedProcess
,
error
;
try
{
spawnedProcess
=
ChildProcess
.
spawn
(
command
,
args
,
{
detached
:
true
});
}
catch
(
error
)
{}
return
spawnedProcess
;
};
const
aria2c
=
spawn
(
'
aria2c
'
,
[
'
--enable-rpc
'
,
'
--rpc-allow-origin-all
'
]);
aria2c
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
`
${
data
}
`
);
})
}
createAria2c
();
// this should be placed at top of main.js to handle setup events quickly
if
(
handleSquirrelEvent
())
{
// squirrel event handled and app will exit in 1000ms, so don't do anything else
...
...
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