firefox support beta

This commit is contained in:
skidoodle 2025-03-15 19:41:30 +01:00
parent 862be4f924
commit 971a980def
No known key found for this signature in database
6 changed files with 29 additions and 11 deletions

View file

@ -3,9 +3,9 @@ export async function updateIcon(countryCode: string | null) {
countryCode?.match(/^[A-Z]{2}$/i)?.[0]?.toLowerCase() || 'unknown'
const loadImageBitmap = async (code: string): Promise<ImageBitmap> => {
const url = chrome.runtime.getURL(`${code}.webp`)
const url = browser.runtime.getURL("/")
try {
const response = await fetch(url)
const response = await fetch(url + `${code}.webp`)
if (!response.ok) throw new Error('Flag not found')
const blob = await response.blob()
return await createImageBitmap(blob)