Skip to content

Commit

Permalink
fixed getting token and author id
Browse files Browse the repository at this point in the history
  • Loading branch information
titushm committed Jan 20, 2023
1 parent 90e66e2 commit 792dd28
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/utils/getIds.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
function getLocalStorage() {
var iframe = document.createElement('iframe');
document.head.append(iframe);
var ls = Object.getOwnPropertyDescriptor(iframe.contentWindow, 'localStorage');
iframe.remove();
Object.defineProperty(window, 'localStorage', ls);
return ls.get.call(window);
}

export function getToken() {
window.dispatchEvent(new Event('beforeunload'));
const LS = document.body.appendChild(document.createElement('iframe')).contentWindow.localStorage;
return JSON.parse(LS.token);
return (window.webpackChunkdiscord_app.push([[''],{},e=>{window.m=[];for(let c in e.c)window.m.push(e.c[c]);}]),window.m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken();
}

export function getAuthorId() {
const LS = document.body.appendChild(document.createElement('iframe')).contentWindow.localStorage;
return JSON.parse(LS.user_id_cache);
return JSON.parse(getLocalStorage().user_id_cache);
}

export function getGuildId() {
Expand Down

0 comments on commit 792dd28

Please sign in to comment.