this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

it works! icon changes color w/ txt record

+60
+17
background.js
··· 1 + function setIcon(tabId, iconName) { 2 + chrome.action.setIcon({ path: iconName, tabId }) 3 + } 4 + 5 + chrome.runtime.onInstalled.addListener(() => { 6 + chrome.tabs.query({}, (tabs) => { 7 + tabs.forEach((tab) => setIcon(tab.id, "logo48_gray.png")) 8 + }) 9 + }) 10 + 11 + chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { 12 + if (message.type === "DID_FOUND") { 13 + setIcon(sender.tab.id, "logo48.png") 14 + } else { 15 + setIcon(sender.tab.id, "logo48_gray.png") 16 + } 17 + })
+23
content.js
··· 1 + function getDomainName() { 2 + return window.location.hostname 3 + } 4 + 5 + async function checkForDID(domain) { 6 + const response = await fetch( 7 + `https://dns.google/resolve?name=_atproto.${domain}&type=TXT` 8 + ) 9 + const data = await response.json() 10 + const records = data?.Answer?.filter((record) => record.type === 16) || [] 11 + return records.some((record) => record.data.includes("did=did:plc:")) 12 + } 13 + 14 + ;(async function () { 15 + const domain = getDomainName() 16 + const didFound = await checkForDID(domain) 17 + 18 + if (didFound) { 19 + chrome.runtime.sendMessage({ type: "DID_FOUND" }) 20 + } else { 21 + chrome.runtime.sendMessage({ type: "DID_NOT_FOUND" }) 22 + } 23 + })()
icon.png

This is a binary file and will not be displayed.

logo128.png

This is a binary file and will not be displayed.

logo128_gray.png

This is a binary file and will not be displayed.

logo48.png

This is a binary file and will not be displayed.

logo48_gray.png

This is a binary file and will not be displayed.

+20
manifest.json
··· 1 + { 2 + "manifest_version": 3, 3 + "name": "DID Detector", 4 + "version": "1.0", 5 + "description": "Detects Decentralized Identifiers (DIDs) in a domain's TXT records and updates the icon.", 6 + "action": { 7 + "default_popup": "popup/build/index.html", 8 + "default_icon": { "48": "logo48_gray.png", "128": "logo128_gray.png" } 9 + }, 10 + "permissions": ["activeTab", "tabs"], 11 + "background": { 12 + "service_worker": "background.js" 13 + }, 14 + "content_scripts": [ 15 + { 16 + "matches": ["<all_urls>"], 17 + "js": ["content.js"] 18 + } 19 + ] 20 + }