GooseMod v5.1.2: Fix (B)BD causing GM to error on getting localStorage

pull/8/head
Oj18 4 years ago
parent ee51fd21f1
commit 3d091f1d49

@ -1,5 +1,11 @@
# GooseMod Changelog
## v5.1.2 [2020-11-29]
- ### Fixes
- Fixed getting localStorage / loading erroring out when using (B)BD
## v5.1.1 [2020-11-16]
- ### Fixes

6
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -99,7 +99,7 @@ const init = async function () {
this.disabledModules = {};
this.lastVersion = localStorage.getItem('goosemodLastVersion');
this.version = '5.1.1';
this.version = '5.1.2';
this.versionHash = '<hash>'; // Hash of built final js file is inserted here via build script
fetch('https://goosemod-api.netlify.app/injectVersion.json').then((x) => x.json().then((latestInjectVersionInfo) => {

@ -1,13 +1,15 @@
// Bypass to get Local Storage (Discord block / remove it) - Source / credit: https://stackoverflow.com/questions/52509440/discord-window-localstorage-is-undefined-how-to-get-access-to-the-localstorage
function getLocalStoragePropertyDescriptor() {
const iframe = document.createElement('iframe');
document.head.append(iframe);
const frame = document.createElement('frame');
frame.src = 'about:blank';
const pd = Object.getOwnPropertyDescriptor(iframe.contentWindow, 'localStorage');
document.body.appendChild(frame);
iframe.remove();
let r = Object.getOwnPropertyDescriptor(frame.contentWindow, 'localStorage');
return pd;
frame.remove();
return r;
}
export default () => {

Loading…
Cancel
Save