Skip to content

Instantly share code, notes, and snippets.

@thewisenerd
Created September 17, 2024 15:25
Show Gist options
  • Save thewisenerd/e199438a3dfca7f1f24f3903591f7d80 to your computer and use it in GitHub Desktop.
Save thewisenerd/e199438a3dfca7f1f24f3903591f7d80 to your computer and use it in GitHub Desktop.
'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