mirror of
https://github.com/WowUp/WowUp.git
synced 2026-04-23 07:17:00 -04:00
Fix #848
This commit is contained in:
@@ -317,13 +317,13 @@ export class CurseAddonProvider extends AddonProvider {
|
||||
return response;
|
||||
}
|
||||
|
||||
private async getAddonsByFingerprints(fingerprints: number[]): Promise<CurseFingerprintsResponse> {
|
||||
const url = `${API_URL}/fingerprint`;
|
||||
// private async getAddonsByFingerprints(fingerprints: number[]): Promise<CurseFingerprintsResponse> {
|
||||
// const url = `${API_URL}/fingerprint`;
|
||||
|
||||
console.log(`Curse Fetching fingerprints`, JSON.stringify(fingerprints));
|
||||
// console.log(`Curse Fetching fingerprints`, JSON.stringify(fingerprints));
|
||||
|
||||
return await this._circuitBreaker.postJson(url, fingerprints);
|
||||
}
|
||||
// return await this._circuitBreaker.postJson(url, fingerprints);
|
||||
// }
|
||||
|
||||
private async getAllIds(addonIds: number[]): Promise<CurseSearchResult[]> {
|
||||
if (!addonIds?.length) {
|
||||
|
||||
@@ -334,8 +334,6 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
}
|
||||
|
||||
private onAddonSyncError = (error: AddonSyncError) => {
|
||||
console.debug("onAddonSyncError", error);
|
||||
const durationMs = 4000;
|
||||
let errorMessage = this.translate.instant("COMMON.ERRORS.ADDON_SYNC_ERROR", {
|
||||
providerName: error.providerName,
|
||||
});
|
||||
@@ -360,7 +358,6 @@ export class AppComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
error.innerError instanceof GitHubFetchRepositoryError ||
|
||||
error.innerError instanceof GitHubFetchReleasesError
|
||||
) {
|
||||
const err = error.innerError as GitHubFetchRepositoryError;
|
||||
errorMessage = this.translate.instant("COMMON.ERRORS.GITHUB_REPOSITORY_FETCH_ERROR", {
|
||||
addonName: error.addonName,
|
||||
});
|
||||
|
||||
@@ -362,7 +362,6 @@ export class MyAddonsComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
try {
|
||||
console.debug("onRefresh");
|
||||
await this.addonService.syncAllClients();
|
||||
// await this.addonService.syncInstallationAddons(this.selectedInstallation);
|
||||
await this.loadAddons(this.selectedInstallation);
|
||||
await this._wowUpAddonService.updateForInstallation(this.selectedInstallation);
|
||||
} catch (e) {
|
||||
@@ -933,7 +932,11 @@ export class MyAddonsComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
this._cdRef.detectChanges();
|
||||
|
||||
try {
|
||||
const addons = await this.addonService.getAddons(installation, reScan);
|
||||
let addons = await this.addonService.getAddons(installation, reScan);
|
||||
if (reScan) {
|
||||
await this.addonService.syncInstallationAddons(installation);
|
||||
addons = await this.addonService.getAddons(installation, false);
|
||||
}
|
||||
|
||||
const rowData = this.formatAddons(addons);
|
||||
this.enableControls = this.calculateControlState();
|
||||
|
||||
@@ -967,6 +967,27 @@ export class AddonService {
|
||||
return this._addonStorage.getAllForInstallationId(installation.id);
|
||||
}
|
||||
|
||||
public async rescanInstallation(installation: WowInstallation): Promise<Addon[]> {
|
||||
if (!installation) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Fetch existing installation addons
|
||||
let addons = this._addonStorage.getAllForInstallationId(installation.id);
|
||||
|
||||
// Collect info on filesystem addons
|
||||
const newAddons = await this.scanAddons(installation);
|
||||
|
||||
this._addonStorage.removeAllForInstallation(installation.id);
|
||||
|
||||
// Map the old installation addon settings to the new ones
|
||||
addons = this.updateAddons(addons, newAddons);
|
||||
|
||||
await this._addonStorage.saveAll(addons);
|
||||
|
||||
return addons;
|
||||
}
|
||||
|
||||
public async getAddons(installation: WowInstallation, rescan = false): Promise<Addon[]> {
|
||||
if (!installation) {
|
||||
return [];
|
||||
@@ -975,16 +996,9 @@ export class AddonService {
|
||||
let addons = this._addonStorage.getAllForInstallationId(installation.id);
|
||||
|
||||
if (rescan || addons.length === 0) {
|
||||
const newAddons = await this.scanAddons(installation);
|
||||
this._addonStorage.removeAllForInstallation(installation.id);
|
||||
|
||||
addons = this.updateAddons(addons, newAddons);
|
||||
await this._addonStorage.saveAll(addons);
|
||||
addons = await this.rescanInstallation(installation);
|
||||
}
|
||||
|
||||
// Only sync non-ignored addons
|
||||
// const notIgnored = _.filter(addons, (addon) => addon.isIgnored === false);
|
||||
|
||||
return addons;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user