feat(ext): expose extension to main-world and auth with token

This commit is contained in:
Simon
2026-01-28 19:47:15 +08:00
parent ff75aebc20
commit ef2d115742
7 changed files with 192 additions and 9 deletions

View File

@@ -19,5 +19,12 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
export default defineBackground(() => {
console.log('[Background] Service Worker started')
chrome.storage.local.get('PageAgentExtUserAuthToken').then((result) => {
if (result.PageAgentExtUserAuthToken) return
const userAuthToken = crypto.randomUUID()
chrome.storage.local.set({ PageAgentExtUserAuthToken: userAuthToken })
})
chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }).catch(() => {})
})