diff --git a/enjoy/package.json b/enjoy/package.json index 3181867c5..fe9091449 100644 --- a/enjoy/package.json +++ b/enjoy/package.json @@ -125,7 +125,6 @@ "electron-forge-plugin-dependencies": "^1.0.0", "electron-log": "^5.2.3", "electron-playwright-helpers": "^1.7.1", - "electron-settings": "^4.0.4", "electron-squirrel-startup": "^1.0.1", "electron-unhandled": "^5.0.0", "eslint": "^9.15.0", @@ -195,6 +194,7 @@ "dependencies": { "@andrkrn/ffprobe-static": "^5.2.0", "echogarden": "^1.8.7", + "electron-settings": "^4.0.4", "ffmpeg-static": "^5.2.0", "file-type": "^19.6.0", "fluent-ffmpeg": "^2.1.3", diff --git a/enjoy/src/main/camdict.ts b/enjoy/src/main/camdict.ts index ca64f3032..c0416b1ed 100644 --- a/enjoy/src/main/camdict.ts +++ b/enjoy/src/main/camdict.ts @@ -1,13 +1,9 @@ import { ipcMain } from "electron"; import path from "path"; import log from "@main/logger"; -import url from "url"; import { Sequelize, DataType } from "sequelize-typescript"; -const __filename = url.fileURLToPath(import.meta.url); -const __dirname = path - .dirname(__filename) - .replace("app.asar", "app.asar.unpacked"); +const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked"); const logger = log.scope("camdict"); diff --git a/enjoy/src/main/db/index.ts b/enjoy/src/main/db/index.ts index d267890ff..0e9b9736e 100644 --- a/enjoy/src/main/db/index.ts +++ b/enjoy/src/main/db/index.ts @@ -42,14 +42,12 @@ import { } from "./handlers"; import os from "os"; import path from "path"; -import url from "url"; import { i18n } from "@main/i18n"; import { UserSettingKeyEnum } from "@/types/enums"; import log from "@main/logger"; import fs from "fs-extra"; -const __filename = url.fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const __dirname = import.meta.dirname; const logger = log.scope("DB"); const db = { diff --git a/enjoy/src/main/echogarden.ts b/enjoy/src/main/echogarden.ts index 31ec1ae3c..40bb848d4 100644 --- a/enjoy/src/main/echogarden.ts +++ b/enjoy/src/main/echogarden.ts @@ -33,13 +33,10 @@ Echogarden.setGlobalOption( "https://hf-mirror.com/echogarden/echogarden-packages/resolve/main/" ); -const __filename = url.fileURLToPath(import.meta.url); /* * sample files will be in /app.asar.unpacked instead of /app.asar */ -const __dirname = path - .dirname(__filename) - .replace("app.asar", "app.asar.unpacked"); +const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked"); const logger = log.scope("echogarden"); class EchogardenWrapper { diff --git a/enjoy/src/main/ffmpeg.ts b/enjoy/src/main/ffmpeg.ts index 73ddef82e..46b0f9a8c 100644 --- a/enjoy/src/main/ffmpeg.ts +++ b/enjoy/src/main/ffmpeg.ts @@ -16,10 +16,7 @@ import { enjoyUrlToPath, pathToEnjoyUrl } from "@main/utils"; */ Ffmpeg.setFfmpegPath(ffmpegPath.replace("app.asar", "app.asar.unpacked")); Ffmpeg.setFfprobePath(ffprobePath.replace("app.asar", "app.asar.unpacked")); -const __filename = url.fileURLToPath(import.meta.url); -const __dirname = path - .dirname(__filename) - .replace("app.asar", "app.asar.unpacked"); +const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked"); const logger = log.scope("ffmpeg"); export default class FfmpegWrapper { diff --git a/enjoy/src/main/window.ts b/enjoy/src/main/window.ts index 5ed738a87..2f2bfa2c4 100644 --- a/enjoy/src/main/window.ts +++ b/enjoy/src/main/window.ts @@ -18,7 +18,6 @@ import { REPO_URL, WS_URL } from "@/constants"; import { AudibleProvider, TedProvider, YoutubeProvider } from "@main/providers"; import Ffmpeg from "@main/ffmpeg"; import { Waveform } from "./waveform"; -import url from "url"; import echogarden from "./echogarden"; import camdict from "./camdict"; import dict from "./dict"; @@ -26,10 +25,8 @@ import mdict from "./mdict"; import decompresser from "./decompresser"; import { UserSetting } from "@main/db/models"; import { platform } from "os"; -import { t } from "i18next"; -const __filename = url.fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); +const __dirname = import.meta.dirname; const logger = log.scope("window"); diff --git a/enjoy/src/main/youtubedr.ts b/enjoy/src/main/youtubedr.ts index acc8327c1..c55edb6ce 100644 --- a/enjoy/src/main/youtubedr.ts +++ b/enjoy/src/main/youtubedr.ts @@ -6,15 +6,10 @@ import os from "os"; import log from "@main/logger"; import snakeCase from "lodash/snakeCase"; import settings from "@main/settings"; -import url from "url"; import mainWin from "@main/window"; -const __filename = url.fileURLToPath(import.meta.url); - // youtubedr bin file will be in /app.asar.unpacked instead of /app.asar -const __dirname = path - .dirname(__filename) - .replace("app.asar", "app.asar.unpacked"); +const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked"); const logger = log.scope("YOUTUBEDR");