From 3ef6044be93e16ebc5325921ebfcc5c89878e999 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Thu, 11 Dec 2025 23:49:13 +0500 Subject: feat: fetch data from api --- api.js | 8 ++++++++ extension.js | 11 ++++++++++- manifest.json | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 api.js diff --git a/api.js b/api.js new file mode 100644 index 0000000..09fa615 --- /dev/null +++ b/api.js @@ -0,0 +1,8 @@ +function getTinyEmotesUserByName(instanceUrl, name) { + return fetch(`${instanceUrl}/users.php?name=${name}`, { + "headers": { + "Accept": "application/json" + } + }).then((r) => r.json()) + .catch(err => console.error('Fetch failed:', err)); +} \ No newline at end of file diff --git a/extension.js b/extension.js index f910541..756c75e 100644 --- a/extension.js +++ b/extension.js @@ -3,7 +3,16 @@ const start = () => { if (document.querySelector("div[data-a-target=chat-input]") == null) { return; } - console.log(getChannelName()); + + const channelName = getChannelName(); + if (!channelName) { + return; + } + + getTinyEmotesUserByName("https://alright.party", channelName) + .then((x) => { + console.log(x); + }); }; function onPageReady(cb) { diff --git a/manifest.json b/manifest.json index 70442f8..963b550 100644 --- a/manifest.json +++ b/manifest.json @@ -6,12 +6,16 @@ "icons": { "48": "icons/48.png" }, + "permissions": [ + "" + ], "content_scripts": [ { "matches": [ "*://*.twitch.tv/*" ], "js": [ + "api.js", "chat.js", "extension.js" ] -- cgit v1.2.3