mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-09-12 12:12:14 +08:00
chore: improve compatibility for firefox (#38)
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
|||||||
isUsingApiKey,
|
isUsingApiKey,
|
||||||
} from '../config/index.mjs'
|
} from '../config/index.mjs'
|
||||||
import { isSafari } from '../utils/is-safari'
|
import { isSafari } from '../utils/is-safari'
|
||||||
|
import { isFirefox } from '../utils/is-firefox'
|
||||||
|
|
||||||
const KEY_ACCESS_TOKEN = 'accessToken'
|
const KEY_ACCESS_TOKEN = 'accessToken'
|
||||||
const cache = new ExpiryMap(10 * 1000)
|
const cache = new ExpiryMap(10 * 1000)
|
||||||
@@ -112,7 +113,7 @@ Browser.contextMenus.removeAll().then(() => {
|
|||||||
id: menuId + 'new',
|
id: menuId + 'new',
|
||||||
parentId: menuId,
|
parentId: menuId,
|
||||||
title: 'New Chat',
|
title: 'New Chat',
|
||||||
contexts: ['selection'],
|
contexts: [isFirefox() ? 'all' : 'selection'],
|
||||||
})
|
})
|
||||||
for (const index in defaultConfig.selectionTools) {
|
for (const index in defaultConfig.selectionTools) {
|
||||||
const key = defaultConfig.selectionTools[index]
|
const key = defaultConfig.selectionTools[index]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export * from './fetch-sse'
|
|||||||
export * from './get-conversation-pairs'
|
export * from './get-conversation-pairs'
|
||||||
export * from './get-possible-element-by-query-selector'
|
export * from './get-possible-element-by-query-selector'
|
||||||
export * from './init-session'
|
export * from './init-session'
|
||||||
|
export * from './is-firefox.mjs'
|
||||||
export * from './is-mobile'
|
export * from './is-mobile'
|
||||||
export * from './is-safari'
|
export * from './is-safari'
|
||||||
export * from './limited-fetch'
|
export * from './limited-fetch'
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export function isFirefox() {
|
||||||
|
return navigator.userAgent.includes('Firefox')
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user