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
bbec5216
Commit
bbec5216
authored
Sep 08, 2016
by
h3remi7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge commit
parent
e549a400
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
94 additions
and
39 deletions
+94
-39
.gitignore
.gitignore
+1
-0
app/app-detail.component.css
app/app-detail.component.css
+5
-0
app/app-detail.component.html
app/app-detail.component.html
+6
-1
app/app-detail.component.ts
app/app-detail.component.ts
+6
-4
app/app.service.ts
app/app.service.ts
+0
-30
app/apps.service.ts
app/apps.service.ts
+74
-1
app/mycard.module.ts
app/mycard.module.ts
+1
-2
apps.json
apps.json
+1
-1
No files found.
.gitignore
View file @
bbec5216
...
...
@@ -2,6 +2,7 @@
/app/*.js.map
/node_modules/
/dist/
/cache/
/typings/
/npm-debug.log
/.idea/
...
...
app/app-detail.component.css
View file @
bbec5216
...
...
@@ -15,3 +15,8 @@
padding
:
0
;
}
progress
{
margin
:
0
;
margin-top
:
2px
;
}
app/app-detail.component.html
View file @
bbec5216
...
...
@@ -55,7 +55,12 @@
<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
(click)=
"install()"
type=
"button"
class=
"btn btn-primary btn-sm"
>
安装
</button></td>
<td
*ngIf=
"!checkInstall(mod.id)"
>
<button
(click)=
"install(mod.id)"
type=
"button"
class=
"btn btn-primary btn-sm"
>
安装
</button>
<progress
class=
"progress progress-striped progress-animated"
value=
"25"
max=
"100"
></progress>
{{appsService.getDownloadStatus(mod.id) | json}}
{{appsService.downloads_info | json}}
</td>
</tr>
</tbody>
</table>
...
...
app/app-detail.component.ts
View file @
bbec5216
import
{
Component
}
from
'
@angular/core
'
;
import
{
AppsService
}
from
'
./apps.service
'
import
{
AppService
}
from
'
./app.service
'
import
{
RoutingService
}
from
'
./routing.service
'
import
{
App
}
from
"
./app
"
;
...
...
@@ -13,7 +12,7 @@ declare var process;
})
export
class
AppDetailComponent
{
constructor
(
private
appsService
:
AppsService
,
private
appService
:
AppService
,
private
routingService
:
RoutingService
)
{
constructor
(
private
appsService
:
AppsService
,
private
routingService
:
RoutingService
)
{
}
_currentApp
;
get
currentApp
():
App
{
...
...
@@ -103,8 +102,11 @@ export class AppDetailComponent {
return
false
;
}
install
()
{
this
.
appService
.
download
();
install
(
id
)
{
let
uri
=
this
.
searchApp
(
id
).
download
;
if
(
uri
)
{
this
.
appsService
.
download
(
id
,
uri
);
}
}
...
...
app/app.service.ts
deleted
100644 → 0
View file @
e549a400
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.service.ts
View file @
bbec5216
...
...
@@ -6,10 +6,38 @@ import {AppLocal} from "./app-local";
@
Injectable
()
export
class
AppsService
{
constructor
(
private
http
:
Http
)
{
let
cc
=
"
abdas19238d
"
;
this
.
downloads_info
[
cc
]
=
1
;
}
fs
=
window
[
'
System
'
].
_nodeRequire
(
'
fs
'
);
path
=
window
[
'
System
'
].
_nodeRequire
(
'
path
'
);
mkdirp
=
window
[
'
System
'
].
_nodeRequire
(
'
mkdirp
'
);
electron
=
window
[
'
System
'
].
_nodeRequire
(
'
electron
'
);
Aria2
=
window
[
'
System
'
].
_nodeRequire
(
'
aria2
'
);
data
:
App
[];
downloads_info
=
{};
constructor
(
private
http
:
Http
)
{
_download_dir
;
get
download_dir
()
{
const
dir
=
this
.
path
.
join
(
this
.
electron
.
remote
.
app
.
getAppPath
(),
'
cache
'
);
if
(
!
this
.
fs
.
existsSync
(
dir
))
{
console
.
log
(
'
cache not exists
'
);
this
.
mkdirp
(
dir
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
err
)
}
else
{
console
.
log
(
'
create cache dir
'
);
}
});
}
return
dir
;
}
getApps
(
callback
)
{
...
...
@@ -26,5 +54,50 @@ export class AppsService {
});
}
download
(
id
,
uri
)
{
const
aria2
=
new
this
.
Aria2
();
console
.
log
(
id
);
console
.
log
(
uri
);
let
tmp_gid
;
aria2
.
open
().
then
(()
=>
{
aria2
.
addUri
([
uri
],
{
'
dir
'
:
this
.
download_dir
},
(
error
,
gid
)
=>
{
if
(
error
)
{
console
.
error
(
error
);
}
console
.
log
(
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
)
{
let
gid
=
this
.
downloads_info
[
id
];
console
.
log
(
this
.
downloads_info
);
let
info
=
{};
const
aria2
=
new
this
.
Aria2
();
aria2
.
tellStatus
(
gid
,
(
err
,
res
)
=>
{
console
.
log
(
res
);
info
=
res
;
});
return
info
;
}
}
app/mycard.module.ts
View file @
bbec5216
...
...
@@ -14,13 +14,12 @@ 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
,
AppService
],
providers
:
[
RoutingService
,
AppsService
],
schemas
:
[
NO_ERRORS_SCHEMA
]
})
export
class
MyCard
{
...
...
apps.json
View file @
bbec5216
...
...
@@ -24,7 +24,7 @@
"locales"
:
[
"zh-CN"
],
"download"
:
""
,
"download"
:
"
http://thief.mycard.moe/metalinks/th13.meta4
"
,
"news"
:
[
{
"title"
:
"News Title"
,
...
...
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