diff --git a/.env.development b/.env.development index 5222874..97e15b6 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1 @@ VITE_ENV=web-dev - -VITE_EXTENSION_ID=nejipfbcnfhckfpmlgibfommbnahchko \ No newline at end of file diff --git a/.env.production_chrome b/.env.production_chrome index 7c05a93..8b3b6d9 100644 --- a/.env.production_chrome +++ b/.env.production_chrome @@ -1,4 +1,3 @@ NODE_ENV=production -VITE_ENV=chrome -VITE_EXTENSION_ID=bciglihaegkdhoogebcdblfhppoilclp \ No newline at end of file +VITE_ENV=chrome \ No newline at end of file diff --git a/src/messaging/layer2/InjectMessaging.ts b/src/messaging/layer2/InjectMessaging.ts index 29e7cd7..ae33f38 100644 --- a/src/messaging/layer2/InjectMessaging.ts +++ b/src/messaging/layer2/InjectMessaging.ts @@ -62,7 +62,7 @@ class InjectMessaging['params'], context: MethodContext) => Promise }) { this.methods = methods - this.port = chrome.runtime.connect(import.meta.env.VITE_EXTENSION_ID, { + this.port = chrome.runtime.connect({ name: 'bilibili-inject', }) this.l1protocol = new Layer1Protocol(this.messageHandler, this.port) diff --git a/src/messaging/layer2/useMessagingService.ts b/src/messaging/layer2/useMessagingService.ts index 9fa3379..9232695 100644 --- a/src/messaging/layer2/useMessagingService.ts +++ b/src/messaging/layer2/useMessagingService.ts @@ -63,7 +63,7 @@ const useMessagingService = (methods?: { }, [methods]) const port = useMemo(() => { - return chrome.runtime.connect(import.meta.env.VITE_EXTENSION_ID, { + return chrome.runtime.connect({ name: 'bilibili-app', }) }, []) diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index fe625b7..4361dd3 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,7 +1,6 @@ /// interface ImportMetaEnv { - readonly VITE_EXTENSION_ID: string } interface ImportMeta {