mirror of
https://github.com/skidoodle/hostinfo
synced 2026-04-28 09:37:37 +02:00
refactor DNS resolution and IP handling; remove unused utility
This commit is contained in:
@@ -1,12 +1,3 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { isPrivateIP } from '@/utils'
|
||||
import {
|
||||
FetchServerInfoRequest,
|
||||
FetchServerInfoResponse,
|
||||
ServerData,
|
||||
} from '@/utils/model'
|
||||
import browser from 'webextension-polyfill'
|
||||
|
||||
export function useTabData() {
|
||||
const [data, setData] = useState<ServerData | null>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -38,20 +29,6 @@ export function useTabData() {
|
||||
})
|
||||
}
|
||||
|
||||
const isInternal = isPrivateIP(hostname)
|
||||
if (isInternal) {
|
||||
return setData({
|
||||
origin: '',
|
||||
ip: hostname,
|
||||
hostname: '',
|
||||
country: '',
|
||||
city: '',
|
||||
org: '',
|
||||
isLocal: true,
|
||||
isBrowserResource: false,
|
||||
})
|
||||
}
|
||||
|
||||
const response = await browser.runtime.sendMessage<
|
||||
FetchServerInfoRequest,
|
||||
FetchServerInfoResponse
|
||||
|
||||
Reference in New Issue
Block a user