From 650d7f0c6b8389d2cfd1814b1be1003cb8af1370 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Fri, 12 Apr 2024 17:35:18 +0800 Subject: [PATCH 1/2] fix: Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist. (#518) close #522 #518 --- src/background/messageListeners/index.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/background/messageListeners/index.ts b/src/background/messageListeners/index.ts index 16ce931d..3be80fc5 100644 --- a/src/background/messageListeners/index.ts +++ b/src/background/messageListeners/index.ts @@ -14,10 +14,15 @@ import API_VIDEO from './video' import API_WATCHLATER from './watchLater' export function setupAllMsgLstnrs() { - // Merge all API objects into one - const FullAPI = Object.assign({}, API_AUTH, API_ANIME, API_HISTORY, API_FAVORITE, API_MOMENT, API_NOTIFICATION, API_RANKING, API_SEARCH, API_USER, API_VIDEO, API_WATCHLATER) - // Create a message listener for each API - const handleMessage = apiListenerFactory(FullAPI) - browser.runtime.onMessage.removeListener(handleMessage) - browser.runtime.onMessage.addListener(handleMessage) + browser.runtime.onConnect.removeListener(handleConnect) + browser.runtime.onConnect.addListener(handleConnect) + + function handleConnect() { + // Merge all API objects into one + const FullAPI = Object.assign({}, API_AUTH, API_ANIME, API_HISTORY, API_FAVORITE, API_MOMENT, API_NOTIFICATION, API_RANKING, API_SEARCH, API_USER, API_VIDEO, API_WATCHLATER) + // Create a message listener for each API + const handleMessage = apiListenerFactory(FullAPI) + browser.runtime.onMessage.removeListener(handleMessage) + browser.runtime.onMessage.addListener(handleMessage) + } } From 723c92c316959ed37ea09008e34cf735097a997f Mon Sep 17 00:00:00 2001 From: Hakadao Date: Fri, 12 Apr 2024 17:36:31 +0800 Subject: [PATCH 2/2] chore: update version number --- .github/workflows/changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 8f08052e..f6a1eef8 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -19,6 +19,6 @@ jobs: token: ${{ secrets.RELEASE_TOKEN }} release-type: node package-name: release-please-action - release-as: 0.16.2 + release-as: 0.16.4 signoff: 'github-actions <41898282+github-actions[bot]@users.noreply.github.com>' changelog-types: '[{"type":"types","section":"Types","hidden":false},{"type":"revert","section":"Reverts","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"improvement","section":"Feature Improvements","hidden":false},{"type":"docs","section":"Docs","hidden":false},{"type":"i18n","section":"I18n","hidden":true},{"type":"style","section":"Style Changes","hidden":false},{"type":"ci","section":"CI","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"contributor","section":"New Contributors","hidden":false},{"type":"notice","section":"Notices","hidden":false}]'