Skip to content

Commit

Permalink
fix substore proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Nov 19, 2024
1 parent f004921 commit b411a8f
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/main/resolve/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,27 @@ export async function startSubStoreBackendServer(): Promise<void> {
icon.toDataURL()
const stdout = createWriteStream(substoreLogPath(), { flags: 'a' })
const stderr = createWriteStream(substoreLogPath(), { flags: 'a' })
const env = {
SUB_STORE_BACKEND_API_PORT: subStorePort.toString(),
SUB_STORE_BACKEND_API_HOST: subStoreHost,
SUB_STORE_DATA_BASE_PATH: subStoreDir(),
SUB_STORE_BACKEND_CUSTOM_ICON: icon.toDataURL(),
SUB_STORE_BACKEND_CUSTOM_NAME: 'Mihomo Party',
SUB_STORE_BACKEND_SYNC_CRON: subStoreBackendSyncCron,
SUB_STORE_BACKEND_DOWNLOAD_CRON: subStoreBackendDownloadCron,
SUB_STORE_BACKEND_UPLOAD_CRON: subStoreBackendUploadCron,
SUB_STORE_MMDB_COUNTRY_PATH: path.join(mihomoWorkDir(), 'country.mmdb'),
SUB_STORE_MMDB_ASN_PATH: path.join(mihomoWorkDir(), 'ASN.mmdb')
}
subStoreBackendWorker = new Worker(path.join(resourcesFilesDir(), 'sub-store.bundle.js'), {
env: {
SUB_STORE_BACKEND_API_PORT: subStorePort.toString(),
SUB_STORE_BACKEND_API_HOST: subStoreHost,
SUB_STORE_DATA_BASE_PATH: subStoreDir(),
SUB_STORE_BACKEND_CUSTOM_ICON: icon.toDataURL(),
SUB_STORE_BACKEND_CUSTOM_NAME: 'Mihomo Party',
SUB_STORE_BACKEND_SYNC_CRON: subStoreBackendSyncCron,
SUB_STORE_BACKEND_DOWNLOAD_CRON: subStoreBackendDownloadCron,
SUB_STORE_BACKEND_UPLOAD_CRON: subStoreBackendUploadCron,
SUB_STORE_MMDB_COUNTRY_PATH: path.join(mihomoWorkDir(), 'country.mmdb'),
SUB_STORE_MMDB_ASN_PATH: path.join(mihomoWorkDir(), 'ASN.mmdb'),
HTTP_PROXY: useProxyInSubStore ? `http://127.0.0.1:${port}` : undefined,
HTTPS_PROXY: useProxyInSubStore ? `http://127.0.0.1:${port}` : undefined,
ALL_PROXY: useProxyInSubStore ? `http://127.0.0.1:${port}` : undefined
}
env: useProxyInSubStore
? {
...env,
HTTP_PROXY: `http://127.0.0.1:${port}`,
HTTPS_PROXY: `http://127.0.0.1:${port}`,
ALL_PROXY: `http://127.0.0.1:${port}`
}
: env
})
subStoreBackendWorker.stdout.pipe(stdout)
subStoreBackendWorker.stderr.pipe(stderr)
Expand Down

0 comments on commit b411a8f

Please sign in to comment.