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
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
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 {
category
:
Category
;
parent
?:
App
;
get
download
():
string
{
let
downloadUrl
=
"
https://thief.mycard.moe/metalinks/
"
;
return
downloadUrl
+
this
.
id
+
"
.meta4
"
;
static
downloadUrl
(
app
:
App
,
platform
:
string
,
locale
:
string
):
string
{
if
(
app
.
id
===
"
ygopro
"
)
{
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/
"
;
return
checksumUrl
+
this
.
id
;
static
checksumUrl
(
app
:
App
,
platform
:
string
,
locale
:
string
):
string
{
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
{
let
updateUrl
=
"
https://thief.mycard.moe/update/
"
;
return
updateUrl
+
this
.
id
;
static
updateUrl
(
app
:
App
,
platform
:
string
,
locale
:
string
):
string
{
if
(
app
.
id
===
"
ygopro
"
)
{
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
>
;
...
...
app/apps.service.ts
View file @
22c2eb51
...
...
@@ -20,6 +20,7 @@ import {ComparableSet} from "./shared/ComparableSet";
import
{
Observable
,
Observer
}
from
"
rxjs/Rx
"
;
import
Timer
=
NodeJS
.
Timer
;
import
ReadableStream
=
NodeJS
.
ReadableStream
;
import
{
platform
}
from
"
os
"
;
const
Aria2
=
require
(
'
aria2
'
);
const
sudo
=
require
(
'
electron-sudo
'
);
const
Logger
=
{
...
...
@@ -597,19 +598,13 @@ export class AppsService {
}
async
doUpdate
(
app
:
App
,
changedFiles
?:
Set
<
string
>
,
deletedFiles
?:
Set
<
string
>
)
{
const
updateServer
=
"
https://thief.mycard.moe/update/
"
;
if
(
changedFiles
&&
changedFiles
.
size
>
0
)
{
Logger
.
info
(
"
Update changed files:
"
,
changedFiles
);
let
updateUrl
=
updateServer
+
app
.
id
;
if
(
app
.
id
===
"
ygopro
"
)
{
let
locale
=
this
.
settingsService
.
getLocale
();
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
locale
=
this
.
settingsService
.
getLocale
();
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
let
updateUrl
=
App
.
updateUrl
(
app
,
process
.
platform
,
locale
);
let
metalink
=
await
this
.
http
.
post
(
updateUrl
,
changedFiles
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
downloadDir
=
path
.
join
(
path
.
dirname
(
app
.
local
!
.
path
),
"
downloading
"
);
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
downloadDir
);
...
...
@@ -663,16 +658,11 @@ export class AppsService {
await
this
.
doInstall
(
task
);
};
const
addDownloadTask
=
async
(
app
:
App
,
dir
:
string
):
Promise
<
{
app
:
App
,
files
:
string
[]}
>
=>
{
let
metalinkUrl
=
app
.
download
;
if
(
app
.
id
===
"
ygopro
"
)
{
let
locale
=
this
.
settingsService
.
getLocale
();
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
locale
=
this
.
settingsService
.
getLocale
();
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
let
metalinkUrl
=
App
.
downloadUrl
(
app
,
process
.
platform
,
locale
);
app
.
status
.
status
=
"
downloading
"
;
let
metalink
=
await
this
.
http
.
get
(
metalinkUrl
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
dir
);
...
...
@@ -920,9 +910,6 @@ export class AppsService {
// installingId: string = '';
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();
map
:
Map
<
string
,
string
>
=
new
Map
();
...
...
@@ -1155,18 +1142,13 @@ export class AppsService {
}
async
getChecksumFile
(
app
:
App
):
Promise
<
Map
<
string
,
string
>
>
{
let
checksumUrl
=
this
.
checksumURL
+
app
.
id
;
if
(
app
.
id
===
"
ygopro
"
)
{
let
locale
=
this
.
settingsService
.
getLocale
();
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
checksumUrl
=
this
.
checksumURL
+
app
.
id
+
"
-
"
+
process
.
platform
+
'
-
'
+
locale
;
}
else
if
(
app
.
id
===
"
desmume
"
)
{
checksumUrl
=
this
.
checksumURL
+
app
.
id
+
"
-
"
+
process
.
platform
;
let
locale
=
this
.
settingsService
.
getLocale
();
if
(
!
[
'
zh-CN
'
,
'
en-US
'
,
'
ja-JP
'
].
includes
(
locale
))
{
locale
=
'
en-US
'
;
}
let
checksumUrl
=
App
.
checksumUrl
(
app
,
process
.
platform
,
locale
);
return
this
.
http
.
get
(
checksumUrl
)
.
map
((
response
)
=>
{
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