mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
Do not load installation progress from cache (#527)
This commit is contained in:
parent
b39cc98e18
commit
8ee3f77abd
1 changed files with 11 additions and 2 deletions
|
@ -3,7 +3,7 @@ import { mkdirp } from "mkdirp";
|
|||
import fs from "fs";
|
||||
import log from "./logger";
|
||||
import { getTeaPath } from "./tea-dir";
|
||||
import { Packages } from "../../src/libs/types";
|
||||
import { GUIPackage, Packages } from "../../src/libs/types";
|
||||
|
||||
const pkgsFilePath = path.join(getTeaPath(), "tea.xyz/gui/pkgs.json");
|
||||
const pkgsFolder = path.join(getTeaPath(), "tea.xyz/gui");
|
||||
|
@ -28,7 +28,16 @@ export async function loadPackageCache(): Promise<Packages> {
|
|||
try {
|
||||
log.info(`loading package cache from ${pkgsFilePath}`);
|
||||
const pkgData = fs.readFileSync(pkgsFilePath);
|
||||
return JSON.parse(pkgData.toString()) as Packages;
|
||||
const pkgs = JSON.parse(pkgData.toString()) as Packages;
|
||||
|
||||
if (pkgs?.packages) {
|
||||
pkgs.packages = pkgs.packages.map((pkg: GUIPackage) => {
|
||||
const { install_progress_percentage, isUninstalling, synced, ...rest } = pkg;
|
||||
return rest;
|
||||
});
|
||||
}
|
||||
|
||||
return pkgs;
|
||||
} catch (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
log.error(err);
|
||||
|
|
Loading…
Reference in a new issue