diff --git a/src/messaging/layer2/ExtensionMessage.ts b/src/messaging/layer2/ExtensionMessage.ts index f786325..cb138e2 100644 --- a/src/messaging/layer2/ExtensionMessage.ts +++ b/src/messaging/layer2/ExtensionMessage.ts @@ -3,7 +3,7 @@ import { L2ReqMsg, L2ResMsg, MESSAGE_TO_EXTENSION_HANDSHAKE, MESSAGE_TO_EXTENSIO export type PortContext = { id: string - name: string + name: string //暂时没什么用 port: chrome.runtime.Port portMessageHandler: Layer1Protocol ready: boolean diff --git a/src/messaging/layer2/InjectMessage.ts b/src/messaging/layer2/InjectMessage.ts index 4103c92..ed9b26e 100644 --- a/src/messaging/layer2/InjectMessage.ts +++ b/src/messaging/layer2/InjectMessage.ts @@ -1,4 +1,3 @@ -import { MESSAGE_TARGET_INJECT } from '@/consts/const' import Layer1Protocol from '../layer1/Layer1Protocol' import { L2ReqMsg, L2ResMsg, MESSAGE_TO_EXTENSION_HANDSHAKE, MESSAGE_TO_EXTENSION_ROUTE_MSG, TAG_TARGET_APP, TAG_TARGET_INJECT } from '../const' @@ -64,7 +63,7 @@ class InjectMessage { }) { this.methods = methods this.port = chrome.runtime.connect(import.meta.env.VITE_EXTENSION_ID, { - name: MESSAGE_TARGET_INJECT, + name: 'bilibili-inject', }) this.portMessageHandler = new Layer1Protocol(this.messageHandler, this.port) this.portMessageHandler.sendMessage({ diff --git a/src/messaging/layer2/useMessageService.ts b/src/messaging/layer2/useMessageService.ts index 3ab6e22..b835c75 100644 --- a/src/messaging/layer2/useMessageService.ts +++ b/src/messaging/layer2/useMessageService.ts @@ -1,7 +1,4 @@ import { useCallback, useMemo } from 'react' -import { - MESSAGE_TARGET_APP, -} from '@/consts/const' import { Waiter } from '@kky002/kky-util' import Layer1Protocol from '../layer1/Layer1Protocol' import { L2ReqMsg, L2ResMsg, MESSAGE_TO_EXTENSION_HANDSHAKE, TAG_TARGET_APP } from '../const' @@ -67,7 +64,7 @@ const useMessageService = (methods?: { const port = useMemo(() => { return chrome.runtime.connect(import.meta.env.VITE_EXTENSION_ID, { - name: MESSAGE_TARGET_APP, + name: 'bilibili-app', }) }, []) portMessageHandler = useMemo(() => {