fix: empty block

This commit is contained in:
Moyasee
2025-10-21 21:09:31 +03:00
parent 72e6f1e328
commit 2022ff34cb
2 changed files with 5 additions and 10 deletions

View File

@@ -8,7 +8,6 @@ import { gameAchievementsSublevel, levelKeys, db } from "@main/level";
import { logger } from "@main/services/logger";
import type { GameShop, User } from "@types";
const uploadImageToCDN = async (imagePath: string): Promise<string> => {
const stat = fs.statSync(imagePath);
const fileBuffer = fs.readFileSync(imagePath);
@@ -33,7 +32,6 @@ const uploadImageToCDN = async (imagePath: string): Promise<string> => {
return response.achievementImageUrl;
};
const storeImageLocally = async (imagePath: string): Promise<string> => {
const fileBuffer = fs.readFileSync(imagePath);
const base64Image = fileBuffer.toString("base64");
@@ -42,7 +40,6 @@ const storeImageLocally = async (imagePath: string): Promise<string> => {
return `data:${mimeType?.mime || "image/jpeg"};base64,${base64Image}`;
};
const updateAchievementWithImageUrl = async (
shop: GameShop,
gameId: string,
@@ -55,7 +52,6 @@ const updateAchievementWithImageUrl = async (
);
};
export const uploadAchievementImage = async (
gameId: string,
achievementName: string,
@@ -103,7 +99,6 @@ export const uploadAchievementImage = async (
}
};
const uploadAchievementImageEvent = async (
_event: Electron.IpcMainInvokeEvent,
params: {

View File

@@ -5,11 +5,10 @@ import { app } from "electron";
import { logger } from "./logger";
export class ScreenshotService {
private static readonly SCREENSHOT_QUALITY = 80;
private static readonly SCREENSHOT_QUALITY = 80;
private static readonly SCREENSHOT_FORMAT = "jpeg";
private static readonly MAX_WIDTH = 1280;
private static readonly MAX_HEIGHT = 720;
private static readonly MAX_WIDTH = 1280;
private static readonly MAX_HEIGHT = 720;
private static compressImage(
image: Electron.NativeImage
@@ -147,7 +146,7 @@ export class ScreenshotService {
}
const cleanupEmptyDirs = (dir: string) => {
if (dir === screenshotsDir) return;
if (dir === screenshotsDir) return;
try {
const items = fs.readdirSync(dir);
@@ -156,6 +155,7 @@ export class ScreenshotService {
logger.log(`Cleaned up empty directory: ${dir}`);
}
} catch (error) {
logger.error(`Failed to read directory ${dir}:`, error);
}
};