mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
fix substore server
This commit is contained in:
parent
8e00cb4bbf
commit
2f54934b85
@ -58,10 +58,15 @@ export async function startPacServer(): Promise<void> {
|
||||
|
||||
export async function startSubStoreServer(): Promise<void> {
|
||||
const { useSubStore = true, useCustomSubStore = false } = await getAppConfig()
|
||||
if (!useSubStore || useCustomSubStore) return
|
||||
if (subStorePort) return
|
||||
subStorePort = await findAvailablePort(3000)
|
||||
if (!useSubStore) return
|
||||
if (!subStoreFrontendPort) {
|
||||
subStoreFrontendPort = await findAvailablePort(4000)
|
||||
const app = express()
|
||||
app.use(express.static(path.join(resourcesFilesDir(), 'sub-store-frontend')))
|
||||
app.listen(subStoreFrontendPort)
|
||||
}
|
||||
if (!useCustomSubStore && !subStorePort) {
|
||||
subStorePort = await findAvailablePort(3000)
|
||||
const icon = nativeImage.createFromPath(subStoreIcon)
|
||||
icon.toDataURL()
|
||||
new Worker(path.join(resourcesFilesDir(), 'sub-store.bundle.js'), {
|
||||
@ -72,7 +77,5 @@ export async function startSubStoreServer(): Promise<void> {
|
||||
SUB_STORE_BACKEND_CUSTOM_NAME: 'Mihomo Party'
|
||||
}
|
||||
})
|
||||
const app = express()
|
||||
app.use(express.static(path.join(resourcesFilesDir(), 'sub-store-frontend')))
|
||||
app.listen(subStoreFrontendPort)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user