From b4449eaacb7d943143b8190f3dedecbfe85340fa Mon Sep 17 00:00:00 2001 From: jliddev Date: Fri, 18 Nov 2022 10:45:48 -0600 Subject: [PATCH] Use std scan result --- wowup-electron/app/ipc-events.ts | 6 +++--- wowup-electron/app/wowup-folder-scanner.ts | 8 +++++--- wowup-electron/package-lock.json | 14 +++++++------- wowup-electron/package.json | 2 +- wowup-electron/src/common/wowup/models.ts | 8 -------- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/wowup-electron/app/ipc-events.ts b/wowup-electron/app/ipc-events.ts index 289a8a5e..d9eefc5f 100644 --- a/wowup-electron/app/ipc-events.ts +++ b/wowup-electron/app/ipc-events.ts @@ -85,7 +85,7 @@ import { DownloadStatusType } from "../src/common/models/download-status-type"; import { FsDirent, TreeNode } from "../src/common/models/ipc-events"; import { UnzipRequest } from "../src/common/models/unzip-request"; import { RendererChannels } from "../src/common/wowup"; -import { MenuConfig, SystemTrayConfig, WowUpScanResult } from "../src/common/wowup/models"; +import { MenuConfig, SystemTrayConfig } from "../src/common/wowup/models"; import { createAppMenu } from "./app-menu"; import * as fsp from "fs/promises"; @@ -109,7 +109,7 @@ import { GetDirectoryTreeRequest } from "../src/common/models/ipc-request"; import { ProductDb } from "../src/common/wowup/product-db"; import { restoreWindow } from "./window-state"; import { firstValueFrom, from, mergeMap, toArray } from "rxjs"; -import { Addon, FsStats } from "wowup-lib-core"; +import { Addon, AddonScanResult, FsStats } from "wowup-lib-core"; let PENDING_OPEN_URLS: string[] = []; @@ -367,7 +367,7 @@ export function initializeIpcHandlers(window: BrowserWindow): void { return true; }); - handle(IPC_WOWUP_GET_SCAN_RESULTS, async (evt, filePaths: string[]): Promise => { + handle(IPC_WOWUP_GET_SCAN_RESULTS, async (evt, filePaths: string[]): Promise => { const taskResults = await firstValueFrom( from(filePaths).pipe( mergeMap((folder) => from(new WowUpFolderScanner(folder).scanFolder()), 3), diff --git a/wowup-electron/app/wowup-folder-scanner.ts b/wowup-electron/app/wowup-folder-scanner.ts index 80656abf..4ec67600 100644 --- a/wowup-electron/app/wowup-folder-scanner.ts +++ b/wowup-electron/app/wowup-folder-scanner.ts @@ -1,10 +1,10 @@ import * as _ from "lodash"; import * as path from "path"; import * as log from "electron-log"; -import { WowUpScanResult } from "../src/common/wowup/models"; import { exists, readDirRecursive, hashFile, hashString } from "./file.utils"; import * as fsp from "fs/promises"; import { firstValueFrom, from, mergeMap, toArray } from "rxjs"; +import { AddonScanResult } from "wowup-lib-core"; const INVALID_PATH_CHARS = [ "|", @@ -75,7 +75,7 @@ export class WowUpFolderScanner { return //gis; } - public async scanFolder(): Promise { + public async scanFolder(): Promise { const files = await readDirRecursive(this._folderPath); files.forEach((fp) => (this._fileMap[fp.toLowerCase()] = fp)); @@ -97,9 +97,11 @@ export class WowUpFolderScanner { const hashConcat = _.orderBy(fingerprintList).join(""); const fingerprint = hashString(hashConcat); - const result: WowUpScanResult = { + const result: AddonScanResult = { + source: 'wowup', fileFingerprints: fingerprintList, fingerprint, + fingerprintNum: 0, path: this._folderPath, folderName: path.basename(this._folderPath), fileCount: matchingFiles.length, diff --git a/wowup-electron/package-lock.json b/wowup-electron/package-lock.json index 4c99e2a7..b88c6701 100644 --- a/wowup-electron/package-lock.json +++ b/wowup-electron/package-lock.json @@ -24,7 +24,7 @@ "pushy-electron": "1.0.10", "rxjs": "7.5.6", "win-ca": "3.5.0", - "wowup-lib-core": "0.0.1", + "wowup-lib-core": "0.0.3", "yauzl": "2.10.0" }, "devDependencies": { @@ -23236,9 +23236,9 @@ "license": "Apache-2.0" }, "node_modules/wowup-lib-core": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/wowup-lib-core/-/wowup-lib-core-0.0.1.tgz", - "integrity": "sha512-1ECaJcFzDG/yNzi6YFBTBuax/IbHYnXeedlufqVxKrdF0YtW1aeYyLZLFLPb9zwjuCggcMkof+2wNtm+2mD1+A==" + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wowup-lib-core/-/wowup-lib-core-0.0.3.tgz", + "integrity": "sha512-4DiOLh7L88KPYIBnIdGOAcjzED/LdTuia0/FL0wwuyapYOrvOHXKnqtBQ/NmBjZP/7LxVxzvStzUH4e+H+CluA==" }, "node_modules/wrap-ansi": { "version": "7.0.0", @@ -38498,9 +38498,9 @@ "dev": true }, "wowup-lib-core": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/wowup-lib-core/-/wowup-lib-core-0.0.1.tgz", - "integrity": "sha512-1ECaJcFzDG/yNzi6YFBTBuax/IbHYnXeedlufqVxKrdF0YtW1aeYyLZLFLPb9zwjuCggcMkof+2wNtm+2mD1+A==" + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wowup-lib-core/-/wowup-lib-core-0.0.3.tgz", + "integrity": "sha512-4DiOLh7L88KPYIBnIdGOAcjzED/LdTuia0/FL0wwuyapYOrvOHXKnqtBQ/NmBjZP/7LxVxzvStzUH4e+H+CluA==" }, "wrap-ansi": { "version": "7.0.0", diff --git a/wowup-electron/package.json b/wowup-electron/package.json index 37998fe7..bce8e4c7 100644 --- a/wowup-electron/package.json +++ b/wowup-electron/package.json @@ -70,7 +70,7 @@ "pushy-electron": "1.0.10", "rxjs": "7.5.6", "win-ca": "3.5.0", - "wowup-lib-core": "0.0.1", + "wowup-lib-core": "0.0.3", "yauzl": "2.10.0" }, "devDependencies": { diff --git a/wowup-electron/src/common/wowup/models.ts b/wowup-electron/src/common/wowup/models.ts index bca90477..d8fffa68 100644 --- a/wowup-electron/src/common/wowup/models.ts +++ b/wowup-electron/src/common/wowup/models.ts @@ -53,14 +53,6 @@ export interface SystemTrayConfig { checkUpdateLabel: string; } -export interface WowUpScanResult { - fileCount: number; - fileFingerprints: string[]; - fingerprint: string; - folderName: string; - path: string; -} - export type PushAction = "addon-update"; export interface PushNotification {