Compare commits

...

6 commits
1.0 ... main

Author SHA1 Message Date
87b4c93268
Create PRIVACY.md 2025-03-16 11:32:29 +01:00
feaaa65960
add showcase 2025-03-15 22:05:41 +01:00
971a980def
firefox support beta 2025-03-15 19:41:30 +01:00
862be4f924
Merge branch 'main' of https://github.com/skidoodle/hostinfo 2025-03-15 18:04:54 +01:00
35a47fee32
fix location icon 2025-03-15 18:04:53 +01:00
b4989027f7
Create LICENSE 2025-03-15 17:57:29 +01:00
10 changed files with 90 additions and 13 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 skidoodle
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

36
PRIVACY.md Normal file
View file

@ -0,0 +1,36 @@
# Privacy Policy
**Last Updated:** 2025-03-16
Thank you for using HostInfo (the "Extension"). This Privacy Policy explains how we handle your information when you use our Extension. Please read this policy carefully to understand our practices regarding your data.
## 1. **Information We Do Not Collect**
HostInfo does not collect, store, or transmit any personal or sensitive information from its users. This includes, but is not limited to:
- Personal identification information (e.g., name, email address, phone number).
- Browsing history or activity.
- IP addresses or location data (except as described below for GeoIP lookups).
- Any other data that could be used to identify you.
## 2. **Third-Party Services**
The Extension uses the following third-party services to provide functionality:
- **Cloudflare DNS (`cloudflare-dns.com`)**: The Extension queries hostnames using Cloudflare's DNS service to resolve website IP addresses. This is done to provide accurate and fast DNS resolution. Cloudflare's privacy policy can be found [here](https://www.cloudflare.com/privacypolicy/).
- **GeoIP Lookups (`ip.albert.lol`)**: The Extension uses `ip.albert.lol` to perform GeoIP lookups. This service may receive your IP address to determine your approximate geographic location (e.g., country or region). No other personal information is shared with this service.
Neither of these services is used to collect, store, or track your personal information. The data sent to these services is used solely for the purpose of providing the Extension's functionality.
## 3. **How We Use Information**
Since we do not collect any personal information, there is no data to use, share, or sell. The Extension operates locally on your device and only communicates with the aforementioned third-party services for DNS resolution and GeoIP lookups.
## 4. **Changes to This Privacy Policy**
We may update this Privacy Policy from time to time. If we make any changes, we will update the "Last Updated" date at the top of this policy. We encourage you to review this Privacy Policy periodically to stay informed about how we are protecting your information.
## 5. **Contact Us**
If you have any questions or concerns about this Privacy Policy, please feel free to contact us at `contact@albert.lol`.

View file

@ -2,6 +2,8 @@
A browser extension built with [WXT.dev](https://wxt.dev) and React that lets you discover the origin of the website you're visiting. With a single click, you can view detailed information such as the **country of origin**, **IP address**, **ASN (Autonomous System Number)**, and more. You can also quickly search for the website's details on [Censys](https://censys.io) for deeper insights.
<img src="https://github.com/user-attachments/assets/83a6316c-54b8-41a8-8d43-c794a5f62696" alt="Showcase" width="200"/>
---
## ✨ Features

View file

@ -1,4 +1,4 @@
import { LinkIcon, ServerIcon, IdentificationIcon } from '@heroicons/react/24/outline';
import { LinkIcon, ServerIcon, IdentificationIcon, MapPinIcon } from '@heroicons/react/24/outline';
import { codes } from '@/utils/codes';
export default function ServerInfo({ data }: { data: ServerData }) {
@ -69,7 +69,7 @@ export default function ServerInfo({ data }: { data: ServerData }) {
</div>
<div className="flex items-center space-x-3">
<IdentificationIcon className="w-6 h-6 text-blue-400 flex-shrink-0" />
<MapPinIcon className="w-6 h-6 text-blue-400 flex-shrink-0" />
<div>
<p className="text-sm text-gray-400">Location</p>
<p className="font-medium">{countryName}</p>

View file

@ -49,18 +49,18 @@ async function handleTabUpdate(url: string) {
}
}
chrome.tabs.onActivated.addListener(async activeInfo => {
const tab = await chrome.tabs.get(activeInfo.tabId)
browser.tabs.onActivated.addListener(async activeInfo => {
const tab = await browser.tabs.get(activeInfo.tabId)
if (tab.url) await handleTabUpdate(tab.url)
})
chrome.tabs.onUpdated.addListener(async (_tabId, changeInfo) => {
browser.tabs.onUpdated.addListener(async (_tabId, changeInfo) => {
if (changeInfo.url) await handleTabUpdate(changeInfo.url)
})
export default defineBackground({
main() {
chrome.runtime.onMessage.addListener((request, _sender, sendResponse) => {
browser.runtime.onMessage.addListener((request: any, _sender, sendResponse) => {
if (request.type === 'FETCH_SERVER_INFO') {
;(async () => {
try {
@ -99,6 +99,9 @@ export default defineBackground({
})()
return true
}
sendResponse({ error: 'Unknown request type', data: null })
return true
})
},
})

View file

@ -1,3 +1,8 @@
import { useState, useEffect } from 'react';
import browser from 'webextension-polyfill';
import { isPrivateIP } from '@/utils';
import { FetchServerInfoRequest, FetchServerInfoResponse, ServerData } from '@/utils/model';
export function useTabData() {
const [data, setData] = useState<ServerData | null>(null)
const [loading, setLoading] = useState(true)
@ -6,7 +11,7 @@ export function useTabData() {
useEffect(() => {
const fetchData = async () => {
try {
const [tab] = await chrome.tabs.query({
const [tab] = await browser.tabs.query({
active: true,
currentWindow: true,
})
@ -43,7 +48,7 @@ export function useTabData() {
})
}
const response = await chrome.runtime.sendMessage({
const response = await browser.runtime.sendMessage<FetchServerInfoRequest, FetchServerInfoResponse>({
type: 'FETCH_SERVER_INFO',
hostname: hostname,
})

View file

@ -2,7 +2,7 @@
"name": "hostinfo",
"description": "Receive information of a domain directly in the browser when browsing a website",
"private": true,
"version": "0.0.0",
"version": "1.2",
"type": "module",
"scripts": {
"dev": "wxt",

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)

View file

@ -13,3 +13,13 @@ export interface DNSEntry {
type: number
data: string
}
export interface FetchServerInfoRequest {
type: 'FETCH_SERVER_INFO';
hostname: string;
}
export interface FetchServerInfoResponse {
error?: string;
data?: ServerData;
}

View file

@ -2,10 +2,10 @@ import { defineConfig } from 'wxt';
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
extensionApi: 'chrome',
extensionApi: 'webextension-polyfill',
modules: ['@wxt-dev/module-react'],
manifest: {
permissions: ['tabs', 'activeTab', 'webRequest', 'file://*', 'debugger'],
permissions: ['tabs', 'activeTab', 'webRequest'],
host_permissions: ['https://ip.albert.lol/*', 'https://dns.google/*', 'https://flagcdn.com/*'],
action: {
default_title: 'Host Info',