mirror of
https://github.com/skidoodle/hostinfo
synced 2026-04-28 09:37:37 +02:00
add cloudflare
This commit is contained in:
+8
-3
@@ -1,9 +1,14 @@
|
||||
export async function updateIcon(countryCode: string | null) {
|
||||
const validCode =
|
||||
countryCode?.match(/^[A-Z]{2}$/i)?.[0]?.toLowerCase() || 'unknown'
|
||||
let validCode
|
||||
if (countryCode === 'cloudflare') {
|
||||
validCode = 'cloudflare'
|
||||
} else {
|
||||
validCode =
|
||||
countryCode?.match(/^[A-Z]{2}$/i)?.[0]?.toLowerCase() || 'unknown'
|
||||
}
|
||||
|
||||
const loadImageBitmap = async (code: string): Promise<ImageBitmap> => {
|
||||
const url = browser.runtime.getURL("/")
|
||||
const url = browser.runtime.getURL('/')
|
||||
try {
|
||||
const response = await fetch(url + `${code}.webp`)
|
||||
if (!response.ok) throw new Error('Flag not found')
|
||||
|
||||
Reference in New Issue
Block a user