do not copy the substore server file

This commit is contained in:
pompurin404 2024-09-04 11:33:42 +08:00
parent d2957aebf5
commit 035d573d88
No known key found for this signature in database
2 changed files with 2 additions and 10 deletions

View File

@ -1,6 +1,6 @@
import { getAppConfig, getControledMihomoConfig } from '../config' import { getAppConfig, getControledMihomoConfig } from '../config'
import { Worker } from 'worker_threads' import { Worker } from 'worker_threads'
import { subStoreDir } from '../utils/dirs' import { resourcesFilesDir, subStoreDir } from '../utils/dirs'
import http from 'http' import http from 'http'
import net from 'net' import net from 'net'
import path from 'path' import path from 'path'
@ -57,7 +57,7 @@ export async function startSubStoreServer(): Promise<void> {
if (!useSubStore) return if (!useSubStore) return
if (subStorePort) return if (subStorePort) return
subStorePort = await findAvailablePort(3000) subStorePort = await findAvailablePort(3000)
new Worker(path.join(subStoreDir(), 'sub-store.bundle.js'), { new Worker(path.join(resourcesFilesDir(), 'sub-store.bundle.js'), {
env: { env: {
SUB_STORE_BACKEND_API_PORT: subStorePort.toString(), SUB_STORE_BACKEND_API_PORT: subStorePort.toString(),
SUB_STORE_DATA_BASE_PATH: subStoreDir() SUB_STORE_DATA_BASE_PATH: subStoreDir()

View File

@ -83,15 +83,7 @@ async function initFiles(): Promise<void> {
await copyFile(sourcePath, testTargrtPath) await copyFile(sourcePath, testTargrtPath)
} }
} }
const copySubStore = async (): Promise<void> => {
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([ await Promise.all([
copySubStore(),
copy('country.mmdb'), copy('country.mmdb'),
copy('geoip.dat'), copy('geoip.dat'),
copy('geosite.dat'), copy('geosite.dat'),