Skip to content

Instantly share code, notes, and snippets.

@Dobby233Liu
Last active July 20, 2024 13:39
Show Gist options
  • Save Dobby233Liu/b5497c163d68c6d8ec4a5126ed5d1059 to your computer and use it in GitHub Desktop.
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
// ==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