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
22c2eb51
Commit
22c2eb51
authored
Dec 27, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载,更新,校验链接带版本号
parent
4f8c7833
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
40 deletions
+35
-40
app/app.ts
app/app.ts
+22
-9
app/apps.service.ts
app/apps.service.ts
+13
-31
No files found.
app/app.ts
View file @
22c2eb51
...
@@ -58,19 +58,32 @@ export class App {
...
@@ -58,19 +58,32 @@ export class App {
category
:
Category
;
category
:
Category
;
parent
?:
App
;
parent
?:
App
;
get
download
():
string
{
static
downloadUrl
(
app
:
App
,
platform
:
string
,
locale
:
string
):
string
{
let
downloadUrl
=
"
https://thief.mycard.moe/metalinks/
"
;
if
(
app
.
id
===
"
ygopro
"
)
{
return
downloadUrl
+
this
.
id
+
"
.meta4
"
;
return
`https://thief.mycard.moe/metalink/
${
app
.
id
}
-
${
process
.
platform
}
/
${
app
.
version
}
`
}
else
if
(
app
.
id
===
"
desmume
"
)
{
return
`https://thief.mycard.moe/metalink/
${
app
.
id
}
-
${
process
.
platform
}
-
${
locale
}
/
${
app
.
version
}
`
}
return
`https://thief.mycard.moe/metalinks/
${
app
.
id
}
/
${
app
.
version
}
`
;
}
}
get
checksum
():
string
{
let
checksumUrl
=
"
https://thief.mycard.moe/checksum/
"
;
static
checksumUrl
(
app
:
App
,
platform
:
string
,
locale
:
string
):
string
{
return
checksumUrl
+
this
.
id
;
if
(
app
.
id
===
"
ygopro
"
)
{
return
`https://thief.mycard.moe/checksum/
${
app
.
id
}
-
${
platform
}
-
${
locale
}
/
${
app
.
version
}
`
}
else
if
(
app
.
id
===
"
desmume
"
)
{
return
`https://thief.mycard.moe/checksum/
${
app
.
id
}
-
${
platform
}
/
${
app
.
version
}
`
}
return
`https://thief.mycard.moe/checksum/
${
app
.
id
}
/
${
app
.
version
}
`
}
}
get
update
():
string
{
static
updateUrl
(
app
:
App
,
platform
:
string
,
locale
:
string
):
string
{
let
updateUrl
=
"
https://thief.mycard.moe/update/
"
;
if
(
app
.
id
===
"
ygopro
"
)
{
return
updateUrl
+
this
.
id
;
return
`https://thief.mycard.moe/update/
${
app
.
id
}
-
${
platform
}
-
${
locale
}
/
${
app
.
version
}
`
;
}
else
if
(
app
.
id
===
"
desmume
"
)
{
return
`https://thief.mycard.moe/update/
${
app
.
id
}
-
${
platform
}
/
${
app
.
version
}
`
;
}
return
`https://thief.mycard.moe/update/
${
app
.
id
}
/
${
app
.
version
}
`
;
}
}
actions
:
Map
<
string
,
Action
>
;
actions
:
Map
<
string
,
Action
>
;
...
...
app/apps.service.ts
View file @
22c2eb51
...
@@ -20,6 +20,7 @@ import {ComparableSet} from "./shared/ComparableSet";
...
@@ -20,6 +20,7 @@ import {ComparableSet} from "./shared/ComparableSet";
import
{
Observable
,
Observer
}
from
"
rxjs/Rx
"
;
import
{
Observable
,
Observer
}
from
"
rxjs/Rx
"
;
import
Timer
=
NodeJS
.
Timer
;
import
Timer
=
NodeJS
.
Timer
;
import
ReadableStream
=
NodeJS
.
ReadableStream
;
import
ReadableStream
=
NodeJS
.
ReadableStream
;
import
{
platform
}
from
"
os
"
;
const
Aria2
=
require
(
'
aria2
'
);
const
Aria2
=
require
(
'
aria2
'
);
const
sudo
=
require
(
'
electron-sudo
'
);
const
sudo
=
require
(
'
electron-sudo
'
);
const
Logger
=
{
const
Logger
=
{
...
@@ -597,19 +598,13 @@ export class AppsService {
...
@@ -597,19 +598,13 @@ export class AppsService {
}
}
async
doUpdate
(
app
:
App
,
changedFiles
?:
Set
<
string
>
,
deletedFiles
?:
Set
<
string
>
)
{
async
doUpdate
(
app
:
App
,
changedFiles
?:
Set
<
string
>
,
deletedFiles
?:
Set
<
string
>
)
{
const
updateServer
=
"
https://thief.mycard.moe/update/
"
;
if
(
changedFiles
&&
changedFiles
.
size
>
0
)
{
if
(
changedFiles
&&
changedFiles
.
size
>
0
)
{
Logger
.
info
(
"
Update changed files:
"
,
changedFiles
);
Logger
.
info
(
"
Update changed files:
"
,
changedFiles
);
let
updateUrl
=
updateServer
+
app
.
id
;
let
locale
=
this
.
settingsService
.
getLocale
();
if
(
app
.
id
===
"
ygopro
"
)
{
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
let
locale
=
this
.
settingsService
.
getLocale
();
locale
=
'
en-US
'
;
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
updateUrl
=
updateUrl
+
'
-
'
+
process
.
platform
+
'
-
'
+
locale
;
}
else
if
(
app
.
id
===
"
desmume
"
)
{
updateUrl
=
updateUrl
+
'
-
'
+
process
.
platform
;
}
}
let
updateUrl
=
App
.
updateUrl
(
app
,
process
.
platform
,
locale
);
let
metalink
=
await
this
.
http
.
post
(
updateUrl
,
changedFiles
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
metalink
=
await
this
.
http
.
post
(
updateUrl
,
changedFiles
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
downloadDir
=
path
.
join
(
path
.
dirname
(
app
.
local
!
.
path
),
"
downloading
"
);
let
downloadDir
=
path
.
join
(
path
.
dirname
(
app
.
local
!
.
path
),
"
downloading
"
);
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
downloadDir
);
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
downloadDir
);
...
@@ -663,16 +658,11 @@ export class AppsService {
...
@@ -663,16 +658,11 @@ export class AppsService {
await
this
.
doInstall
(
task
);
await
this
.
doInstall
(
task
);
};
};
const
addDownloadTask
=
async
(
app
:
App
,
dir
:
string
):
Promise
<
{
app
:
App
,
files
:
string
[]}
>
=>
{
const
addDownloadTask
=
async
(
app
:
App
,
dir
:
string
):
Promise
<
{
app
:
App
,
files
:
string
[]}
>
=>
{
let
metalinkUrl
=
app
.
download
;
let
locale
=
this
.
settingsService
.
getLocale
();
if
(
app
.
id
===
"
ygopro
"
)
{
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
let
locale
=
this
.
settingsService
.
getLocale
();
locale
=
'
en-US
'
;
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
metalinkUrl
=
"
https://thief.mycard.moe/metalinks/ygopro-
"
+
process
.
platform
+
'
-
'
+
locale
+
"
.meta4
"
;
}
else
if
(
app
.
id
===
"
desmume
"
)
{
metalinkUrl
=
"
https://thief.mycard.moe/metalinks/desmume-
"
+
process
.
platform
+
"
.meta4
"
;
}
}
let
metalinkUrl
=
App
.
downloadUrl
(
app
,
process
.
platform
,
locale
);
app
.
status
.
status
=
"
downloading
"
;
app
.
status
.
status
=
"
downloading
"
;
let
metalink
=
await
this
.
http
.
get
(
metalinkUrl
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
metalink
=
await
this
.
http
.
get
(
metalinkUrl
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
dir
);
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
dir
);
...
@@ -920,9 +910,6 @@ export class AppsService {
...
@@ -920,9 +910,6 @@ export class AppsService {
// installingId: string = '';
// installingId: string = '';
eventEmitter
=
new
EventEmitter
<
void
>
();
eventEmitter
=
new
EventEmitter
<
void
>
();
readonly
checksumURL
=
"
https://thief.mycard.moe/checksums/
"
;
readonly
updateServerURL
=
'
https://thief.mycard.moe/update/metalinks
'
;
// installQueue: Map<string,InstallTask> = new Map();
// installQueue: Map<string,InstallTask> = new Map();
map
:
Map
<
string
,
string
>
=
new
Map
();
map
:
Map
<
string
,
string
>
=
new
Map
();
...
@@ -1155,18 +1142,13 @@ export class AppsService {
...
@@ -1155,18 +1142,13 @@ export class AppsService {
}
}
async
getChecksumFile
(
app
:
App
):
Promise
<
Map
<
string
,
string
>
>
{
async
getChecksumFile
(
app
:
App
):
Promise
<
Map
<
string
,
string
>
>
{
let
checksumUrl
=
this
.
checksumURL
+
app
.
id
;
if
(
app
.
id
===
"
ygopro
"
)
{
let
locale
=
this
.
settingsService
.
getLocale
();
let
locale
=
this
.
settingsService
.
getLocale
();
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
locale
=
'
en-US
'
;
}
checksumUrl
=
this
.
checksumURL
+
app
.
id
+
"
-
"
+
process
.
platform
+
'
-
'
+
locale
;
}
else
if
(
app
.
id
===
"
desmume
"
)
{
checksumUrl
=
this
.
checksumURL
+
app
.
id
+
"
-
"
+
process
.
platform
;
}
}
let
checksumUrl
=
App
.
checksumUrl
(
app
,
process
.
platform
,
locale
);
return
this
.
http
.
get
(
checksumUrl
)
return
this
.
http
.
get
(
checksumUrl
)
.
map
((
response
)
=>
{
.
map
((
response
)
=>
{
let
map
=
new
Map
<
string
,
string
>
();
let
map
=
new
Map
<
string
,
string
>
();
...
...
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