Merge pull request #868 from WowUp/hotfix-2.2.2

Hotfix 2.2.2
This commit is contained in:
jliddev
2021-05-17 15:45:43 -05:00
committed by GitHub
6 changed files with 58 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "wowup",
"version": "2.2.0",
"version": "2.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,7 +1,7 @@
{
"name": "wowup",
"productName": "WowUp",
"version": "2.2.1",
"version": "2.2.2",
"description": "World of Warcraft addon updater",
"homepage": "https://wowup.io",
"author": {

View File

@@ -176,12 +176,20 @@ export class WowUpAddonProvider extends AddonProvider {
const fingerprintResponse = await this.getAddonsByFingerprints(fingerprints);
for (const scanResult of scanResults) {
// Wowup can deliver the wrong result sometimes, ensure the result matches the client type
scanResult.exactMatch = fingerprintResponse.exactMatches.find(
(exactMatch) =>
this.isGameType(exactMatch.matched_release, installation.clientType) &&
this.hasMatchingFingerprint(scanResult, exactMatch.matched_release)
const fingerprintMatches = fingerprintResponse.exactMatches.filter((exactMatch) =>
this.hasMatchingFingerprint(scanResult, exactMatch.matched_release)
);
let clientMatch = fingerprintMatches.find((exactMatch) =>
this.isGameType(exactMatch.matched_release, installation.clientType)
);
if (!clientMatch && fingerprintMatches.length > 0) {
console.warn(`No matching client type found for ${scanResult.folderName}, using fallback`);
clientMatch = fingerprintMatches[0];
}
scanResult.exactMatch = clientMatch;
}
for (const addonFolder of addonFolders) {
@@ -271,9 +279,7 @@ export class WowUpAddonProvider extends AddonProvider {
}
private getSearchResult(representation: WowUpAddonRepresentation, clientType: WowClientType): AddonSearchResult {
const wowGameType = this.getWowGameType(clientType);
const clientReleases = _.filter(representation.releases, (release) => release.game_type === wowGameType);
const searchResultFiles: AddonSearchResultFile[] = _.map(clientReleases, (release) =>
const searchResultFiles: AddonSearchResultFile[] = _.map(representation.releases, (release) =>
this.getSearchResultFile(release)
);

View File

@@ -507,7 +507,17 @@ export class GetAddonsComponent implements OnInit, OnDestroy {
}
private formatAddons(addons: AddonSearchResult[]): GetAddonListItem[] {
const addonList = addons.map((addon) => new GetAddonListItem(addon, this.defaultAddonChannel));
const addonList = addons
.map((addon) => {
try {
return new GetAddonListItem(addon, this.defaultAddonChannel);
} catch (e) {
console.error(e);
console.error(addon);
}
})
.filter((item) => item !== undefined);
return this.sortAddons(addonList);
}

View File

@@ -20,7 +20,7 @@ import {
} from "../../../common/constants";
import { Addon, AddonExternalId } from "../../../common/entities/addon";
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonCategory, AddonChannelType, AddonDependency, AddonDependencyType } from "../../../common/wowup/models";
import { AddonCategory, AddonChannelType, AddonDependency, AddonDependencyType, AddonWarningType } from "../../../common/wowup/models";
import { AddonProvider, GetAllResult } from "../../addon-providers/addon-provider";
import { CurseAddonProvider } from "../../addon-providers/curse-addon-provider";
import { WowUpAddonProvider } from "../../addon-providers/wowup-addon-provider";
@@ -1094,10 +1094,14 @@ export class AddonService {
const getAllResult = await addonProvider.getAll(installation, providerAddonIds);
this.handleSyncErrors(installation, getAllResult, addonProvider, addons);
await this.handleSyncResults(getAllResult, addons);
await this.handleSyncResults(getAllResult, addons, installation);
}
private async handleSyncResults(getAllResult: GetAllResult, addons: Addon[]): Promise<void> {
private async handleSyncResults(
getAllResult: GetAllResult,
addons: Addon[],
installation: WowInstallation
): Promise<void> {
for (const result of getAllResult.searchResults) {
const addon = addons.find((addon) => addon.externalId.toString() === result?.externalId?.toString());
if (!addon) {
@@ -1106,7 +1110,22 @@ export class AddonService {
try {
const latestFile = SearchResults.getLatestFile(result, addon?.channelType);
if (!latestFile) {
console.warn(`No latest file found: ${addon.name}, clientType: ${addon.clientType}`);
addon.warningType = AddonWarningType.NoProviderFiles;
this._addonStorage.set(addon.id, addon);
this._syncErrorSrc.next(
new AddonSyncError({
providerName: addon.providerName,
installationName: installation.label,
addonName: addon?.name,
})
);
continue;
}
this.setExternalIdString(addon);
addon.summary = result.summary;

View File

@@ -15,6 +15,15 @@ export class PatchNotesService {
}
const CHANGELOGS: ChangeLog[] = [
{
Version: "2.2.2",
html: `<div>
<h4 style="margin-top: 1em;">Changes</h4>
<ul>
<li>Fix some issues related to addons migrating from classic to TBC / Multiple toc files</li>
</ul>
</div>`,
},
{
Version: "2.2.1",
html: `<div>