mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
custom substore icon
This commit is contained in:
parent
72faa1e5c2
commit
74fa513f83
BIN
resources/subStoreIcon.png
Normal file
BIN
resources/subStoreIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -1,9 +1,11 @@
|
||||||
import { getAppConfig, getControledMihomoConfig } from '../config'
|
import { getAppConfig, getControledMihomoConfig } from '../config'
|
||||||
import { Worker } from 'worker_threads'
|
import { Worker } from 'worker_threads'
|
||||||
import { resourcesFilesDir, subStoreDir } from '../utils/dirs'
|
import { resourcesFilesDir, subStoreDir } from '../utils/dirs'
|
||||||
|
import subStoreIcon from '../../../resources/subStoreIcon.png?asset'
|
||||||
import http from 'http'
|
import http from 'http'
|
||||||
import net from 'net'
|
import net from 'net'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { nativeImage } from 'electron'
|
||||||
|
|
||||||
export let pacPort: number
|
export let pacPort: number
|
||||||
export let subStorePort: number
|
export let subStorePort: number
|
||||||
|
@ -57,10 +59,14 @@ export async function startSubStoreServer(): Promise<void> {
|
||||||
if (!useSubStore || useCustomSubStore) return
|
if (!useSubStore || useCustomSubStore) return
|
||||||
if (subStorePort) return
|
if (subStorePort) return
|
||||||
subStorePort = await findAvailablePort(3000)
|
subStorePort = await findAvailablePort(3000)
|
||||||
|
const icon = nativeImage.createFromPath(subStoreIcon)
|
||||||
|
icon.toDataURL()
|
||||||
new Worker(path.join(resourcesFilesDir(), '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(),
|
||||||
|
SUB_STORE_BACKEND_CUSTOM_ICON: icon.toDataURL(),
|
||||||
|
SUB_STORE_BACKEND_CUSTOM_NAME: 'Mihomo Party'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user