Last active
July 20, 2024 13:39
-
-
Save Dobby233Liu/b5497c163d68c6d8ec4a5126ed5d1059 to your computer and use it in GitHub Desktop.
Discord CDN timebomb informer: Prints to the console about the issued/expires search parameters in Discord attachment URLs
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
// ==UserScript== | |
// @name Discord CDN timebomb informer | |
// @namespace https://dobby233liu.github.io | |
// @version 1.0.0c | |
// @description Prints to the console about the issued/expires search parameters in Discord attachment URLs | |
// @author Liu "Dobby233Liu" Wenyuan | |
// @match https://media.discordapp.net/attachments/* | |
// @match https://cdn.discordapp.com/attachments/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=discord.com | |
// @grant none | |
// @run-at document-start | |
// @updateURL https://gist.github.com/Dobby233Liu/b5497c163d68c6d8ec4a5126ed5d1059/raw/isex.user.js | |
// @downloadURL https://gist.github.com/Dobby233Liu/b5497c163d68c6d8ec4a5126ed5d1059/raw/isex.user.js | |
// @supportURL https://gist.github.com/Dobby233Liu/b5497c163d68c6d8ec4a5126ed5d1059 | |
// @license WTFPL | |
// ==/UserScript== | |
"use strict" | |
function dateFromHex(n) { | |
if (!n) return null | |
return new Date(parseInt("0x" + n) * 1000 /* unix --> js */) | |
} | |
let search = new URLSearchParams(location.search) | |
let is = dateFromHex(search.get("is")) | |
let ex = dateFromHex(search.get("ex")) | |
let hm = search.get("hm") | |
if (!(is || ex || hm)) return | |
console.warn("[TIMEBOMB]", hm ? "(signature: " + hm + ")" : "") | |
if (is) { | |
console.log("issued:", is) | |
} | |
if (ex) { | |
let now = new Date() | |
console.log("expires:", ex, now >= ex ? "(passed)" : "") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment