Created
September 17, 2024 15:25
-
-
Save thewisenerd/e199438a3dfca7f1f24f3903591f7d80 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
(() => { | |
const xsrf = [...new URLSearchParams(window.location.search)].find(x => x[0].length == 32); | |
if (!xsrf) throw new Error("xsrf token not found"); | |
fetch('/sysmgmt/2015/server/vconsole?type=HTML5', { | |
headers: {'xsrf-token': xsrf[0]} | |
}).then(res => { | |
if (!res.ok) throw new Error(`invalid status code: ${res.status}`); | |
return res.json(); | |
}).then((response) => { | |
const nextLoc = response['Location']; | |
if (!nextLoc) throw new Error("unable to infer viewer 'Location' from response"); | |
console.log("\"Copy link address\" the following URL and open in a new tab", nextLoc); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment