Commit 2a2847cb authored by 神楽坂玲奈's avatar 神楽坂玲奈

Merge branch 'v3' of github.com:mycard/mycard into v3

parents 3b12e822 8816b859
...@@ -332,6 +332,9 @@ export class AppsService { ...@@ -332,6 +332,9 @@ export class AppsService {
} else { } else {
readyToUpdate = app.isReady() && mods.every((mod) => mod.isReady()); readyToUpdate = app.isReady() && mods.every((mod) => mod.isReady());
} }
if (app.id === "ygopro") {
console.log(111);
}
if (readyToUpdate && (verify || app.local!.version !== app.version )) { if (readyToUpdate && (verify || app.local!.version !== app.version )) {
app.status.status = "updating"; app.status.status = "updating";
try { try {
...@@ -348,15 +351,16 @@ export class AppsService { ...@@ -348,15 +351,16 @@ export class AppsService {
let deletedFiles: Set<string> = new Set<string>(); let deletedFiles: Set<string> = new Set<string>();
// 遍历寻找新增加的文件 // 遍历寻找新增加的文件
for (let [file,checksum] of latestFiles) { for (let [file,checksum] of latestFiles) {
if (!localFiles.has(file)) { if (!localFiles.has(file) && latestFiles.get(file) !== "") {
changedFiles.add(file);
addedFiles.add(file); addedFiles.add(file);
// changedFiles包含addedFiles,addedFiles仅供mod更新的时候使用。
changedFiles.add(file);
} }
} }
// 遍历寻找旧版本与新版本不一样的文件和新版本比旧版少了的文件 // 遍历寻找旧版本与新版本不一样的文件和新版本比旧版少了的文件
for (let [file,checksum] of localFiles) { for (let [file,checksum] of localFiles) {
if (latestFiles.has(file)) { if (latestFiles.has(file)) {
if (latestFiles.get(file) !== checksum) { if (latestFiles.get(file) !== checksum && latestFiles.get(file) !== "") {
changedFiles.add(file); changedFiles.add(file);
} }
} else { } else {
...@@ -364,11 +368,6 @@ export class AppsService { ...@@ -364,11 +368,6 @@ export class AppsService {
} }
} }
// changedFiles包含addedFiles,addedFiles仅供mod更新的时候使用。
for (let addedFile of addedFiles) {
changedFiles.add(addedFile);
}
let backupFiles: string[] = []; let backupFiles: string[] = [];
let restoreFiles: string[] = []; let restoreFiles: string[] = [];
if (app.parent) { if (app.parent) {
...@@ -443,7 +442,7 @@ export class AppsService { ...@@ -443,7 +442,7 @@ 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/metalinks/"; 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 updateUrl = updateServer + app.id;
...@@ -516,7 +515,7 @@ export class AppsService { ...@@ -516,7 +515,7 @@ export class AppsService {
this.ref.tick(); this.ref.tick();
}); });
} catch (e) { } catch (e) {
throw e;
} }
let files = await this.downloadService.getFiles(downloadId); let files = await this.downloadService.getFiles(downloadId);
app.status.status = "waiting"; app.status.status = "waiting";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment