summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-12-11 23:49:13 +0500
committerilotterytea <iltsu@alright.party>2025-12-11 23:49:13 +0500
commit3ef6044be93e16ebc5325921ebfcc5c89878e999 (patch)
tree1e2a7218ee0d85ac12fd8aa37b099e196274aa86
parent5af7121ef495ce4d04b39da470331dd6421025d9 (diff)
feat: fetch data from api
-rw-r--r--api.js8
-rw-r--r--extension.js11
-rw-r--r--manifest.json4
3 files changed, 22 insertions, 1 deletions
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": [
+ "<all_urls>"
+ ],
"content_scripts": [
{
"matches": [
"*://*.twitch.tv/*"
],
"js": [
+ "api.js",
"chat.js",
"extension.js"
]