From 035d573d88976cf36aa7f8ba2a4236d9ea2c1da0 Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Wed, 4 Sep 2024 11:33:42 +0800 Subject: [PATCH] do not copy the substore server file --- src/main/resolve/server.ts | 4 ++-- src/main/utils/init.ts | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/resolve/server.ts b/src/main/resolve/server.ts index 5dab11c..961e033 100644 --- a/src/main/resolve/server.ts +++ b/src/main/resolve/server.ts @@ -1,6 +1,6 @@ import { getAppConfig, getControledMihomoConfig } from '../config' import { Worker } from 'worker_threads' -import { subStoreDir } from '../utils/dirs' +import { resourcesFilesDir, subStoreDir } from '../utils/dirs' import http from 'http' import net from 'net' import path from 'path' @@ -57,7 +57,7 @@ export async function startSubStoreServer(): Promise { if (!useSubStore) return if (subStorePort) return subStorePort = await findAvailablePort(3000) - new Worker(path.join(subStoreDir(), 'sub-store.bundle.js'), { + new Worker(path.join(resourcesFilesDir(), 'sub-store.bundle.js'), { env: { SUB_STORE_BACKEND_API_PORT: subStorePort.toString(), SUB_STORE_DATA_BASE_PATH: subStoreDir() diff --git a/src/main/utils/init.ts b/src/main/utils/init.ts index f92bc54..d621123 100644 --- a/src/main/utils/init.ts +++ b/src/main/utils/init.ts @@ -83,15 +83,7 @@ async function initFiles(): Promise { await copyFile(sourcePath, testTargrtPath) } } - const copySubStore = async (): Promise => { - const targetPath = path.join(subStoreDir(), 'sub-store.bundle.js') - const sourcePath = path.join(resourcesFilesDir(), 'sub-store.bundle.js') - if (existsSync(sourcePath)) { - await copyFile(sourcePath, targetPath) - } - } await Promise.all([ - copySubStore(), copy('country.mmdb'), copy('geoip.dat'), copy('geosite.dat'),