Created
August 14, 2021 14:30
-
-
Save gpioblink/3c2833a94ac1add8e2e6bee0b695c72f to your computer and use it in GitHub Desktop.
Chromeで開いたURLをDiscordに上げて他人に晒すプログラム (注意: セキュリティ対策一切ないので信用できる人とのみ使ってください)
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
chrome.tabs.onUpdated.addListener((tabid, changeInfo, tab) => { | |
const url = "https://ptb.discord.com/api/webhooks/<DiscordのWebHook URLを貼る>" | |
console.log(changeInfo.url, changeInfo.title, tab.url) | |
if(changeInfo.title) { | |
const data_url = tab.url | |
const title = changeInfo.title | |
const postData = { | |
"username": "PunishMe", | |
"content": `<名前を入れる>さんが閲覧: ${title}\n${data_url}` | |
} | |
const postDataStr = JSON.stringify(postData) | |
const options = { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Content-Length': encodeURIComponent(postDataStr).replace(/%../g,"x").length | |
}, | |
body: postDataStr | |
} | |
fetch(url, options) | |
} | |
}) |
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
{ | |
"name": "Punish Me", | |
"version": "1.0", | |
"manifest_version": 3, | |
"background": { | |
"service_worker": "background.js" | |
}, | |
"permissions": [ | |
"tabs" | |
], | |
"action": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment