Last active
December 30, 2020 08:02
-
-
Save woxtu/b8e200d7062979307588acc79be2101c to your computer and use it in GitHub Desktop.
Qiitadon 新着 通知
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ws = new WebSocket("wss://streaming.qiitadon.com:4000/api/v1/streaming/?stream=public:local"); | |
ws.addEventListener("message", (ev) => { | |
const { event, payload } = JSON.parse(ev.data); | |
if (event == "update") { | |
const status = JSON.parse(payload); | |
chrome.notifications.create(status.id, { | |
type: "basic", | |
iconUrl: status.account.avatar || status.account.avatar_static || "icon.png", | |
title: status.account.display_name || status.account.username, | |
message: status.content.replace(/<\/?[^>]+(>|$)/g, ""), | |
}); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "qiitadon-new-arrivals-notification", | |
"version": "1.0", | |
"description": "qiitadon-new-arrivals-notification", | |
"icons": { | |
"128": "icon.png" | |
}, | |
"permissions": ["notifications","https://file.qiitadon.com/*"], | |
"background": { | |
"scripts": ["background.js"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment