mirror of
https://github.com/Dasemu/X-GeoBlock.git
synced 2026-11-26 23:36:11 +00:00
feat: add cross-browser X GeoBlock extension
This commit is contained in:
commit
0944faab3e
26 files changed
+803
No files matched your search
@@ -0,0 +1,3 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><title>X GeoBlock parser</title></head>
|
||||
<body><script src="../lib/parser.js"></script><script src="offscreen.js"></script></body></html>
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
const extensionApi = globalThis.browser || chrome;
|
||||
|
||||
extensionApi.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
||||
if (message?.type !== "parse-about-html") return false;
|
||||
try {
|
||||
const document = new DOMParser().parseFromString(message.html, "text/html");
|
||||
sendResponse(XGeoParser.parseAboutDocument(document, message.username));
|
||||
} catch (error) {
|
||||
sendResponse({ country: null, following: null, error: error.message });
|
||||
}
|
||||
return false;
|
||||
});
|
||||
Reference in new issue
Block a user