Created
December 9, 2022 10:45
-
-
Save thewisenerd/36e963906f8c75df3d35767f6c9c5ae5 to your computer and use it in GitHub Desktop.
azure cost portal url decode
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
// string sanitization? | |
function t(n) { | |
for (var t, i = [], r = 0; r < n.length; r++) | |
t = n.charCodeAt(r), | |
t < 128 | |
? i.push(t) | |
: t < 2048 | |
? i.push(192 | t >> 6, 128 | t & 63) | |
: t < 55296 || t >= 57344 | |
? i.push(224 | t >> 12, 128 | t >> 6 & 63, 128 | t & 63) | |
: (r++, t = 65536 + ((t & 1023) << 10 | n.charCodeAt(r) & 1023), | |
i.push(240 | t >> 18, 128 | t >> 12 & 63, 128 | t >> 6 & 63, 128 | t & 63)); | |
return i | |
} | |
function r(n) { | |
var r = t(n) | |
, u = i.gzip(r); | |
return String.fromCharCode.apply(null, u) | |
} | |
function u(n) { | |
var t = r(n); | |
return btoa(t) | |
} | |
function f(n) { | |
var t = u(n); | |
return encodeURIComponent(t) | |
} | |
t.prototype._getViewLinkUrl = function() { | |
var t = this | |
, n = this._dataContext; | |
return n.userLastState ? MsPortalFx.Base.Security.getUserInfo().then((function(i) { | |
var e = encodeURIComponent(t.bladeUtils.scope().scopeId()), | |
o = g.StringCompression.compressAndEncodeBase64AndUri(n.userLastState), r, u, f; | |
try { | |
r = window.top.location.origin | |
} catch (s) { | |
console.log(s); | |
u = MsPortalFx.getEnvironmentValue("envName"); | |
r = u === "ff" ? "https://portal.azure.us" : u === "ussec" ? "https://portal.azure.microsoft.scloud" : u === "usnat" ? "https://portal.azure.eaglex.ic.gov" : u === "df" ? "https://df.onecloud.azure-test.net" : "https://portal.azure.com" | |
} | |
return f = "".concat(r, "#@").concat(i.domainName, "/blade/Microsoft_Azure_CostManagement/Menu/open/CostAnalysis/scope/").concat(e, "/view/").concat(o), | |
f.length > 2e3 && (f = ""), | |
f | |
} | |
// /scope/{urlEncode(f"/subscriptions/{subcriptionId}")}/view/{urlEncode(gzip(state))} | |
// decodeURIComponent() | base64 -d the part after `view/` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment