Skip to content

Commit

Permalink
1XL v1.4.19 HOTFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
1Lighty authored Jan 29, 2025
1 parent caf084f commit e3577e6
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions Plugins/1XenoLib.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @description Simple library to complement plugins with shared code without lowering performance. Also adds needed buttons to some plugins.
* @author 1Lighty
* @authorId 239513071272329217
* @version 1.4.18
* @version 1.4.19
* @invite NYvWdN5
* @donate https://paypal.me/lighty13
* @source https://github.com/1Lighty/BetterDiscordPlugins/blob/master/Plugins/1XenoLib.plugin.js
Expand Down Expand Up @@ -106,7 +106,7 @@ module.exports = (() => {
twitter_username: ''
}
],
version: '1.4.18',
version: '1.4.19',
description: 'Simple library to complement plugins with shared code without lowering performance. Also adds needed buttons to some plugins.',
github: 'https://github.com/1Lighty',
github_raw: 'https://raw.githubusercontent.com/1Lighty/BetterDiscordPlugins/master/Plugins/1XenoLib.plugin.js'
Expand All @@ -115,7 +115,7 @@ module.exports = (() => {
{
title: 'Fixed',
type: 'fixed',
items: ['Fixed toggles in plugin settings not appearing (this includes MessageLoggerV2 settings and any others)', 'Part 2 cause it didn\'t work the first time']
items: ['HOTFIX for not working at all']
}
],
defaultConfig: [
Expand Down Expand Up @@ -904,8 +904,31 @@ module.exports = (() => {


try {
XenoLib.ReactComponents.ButtonOptions = WebpackModules.getByProps('Button', 'ButtonColors');
XenoLib.ReactComponents.Button = WebpackModules.getByProps('Button', 'ButtonColors').Button;

const ButtonOptionsRaw = ZLibrary.WebpackModules.getModule(e => {
if (typeof e === 'function') return false;
const possFuncs = Object.values(e);
if (possFuncs.length < 3 || possFuncs.length > 8) return false;
if (!possFuncs.some(e => typeof e === 'object' && e?.BRAND_INVERTED)) return false;
return true;
})
let ButtonOptions = {};
for (let item of Object.values(ButtonOptionsRaw)) {
if (item.OUTLINED) ButtonOptions.ButtonLooks = item;
else if (item.BRAND) ButtonOptions.ButtonColors = item;
else if (item.SMALL) ButtonOptions.ButtonSizes = item;
else if (typeof item === 'function') {
const funcString = item.toString();
if (funcString.includes('.disabledButtonWrapper,')) ButtonOptions.Button = item;
// else if (funcString.match(/to:\w,onClick:\w,onMouseUp:\w/)) ButtonOptions.ButtonLink = item;
// else console.log('Unknown item!', item);
}
//else console.log('Unknown item!', item);
// there is 1 more func called "getButtonStyle" but we don't care about it :v
}
if (ButtonOptions.Button.Link) ButtonOptions.ButtonLink = ButtonOptions.Button.Link;
XenoLib.ReactComponents.ButtonOptions = ButtonOptions;
XenoLib.ReactComponents.Button = ButtonOptions.Button;
} catch (e) {
Logger.stacktrace('Error getting Button component', e);
}
Expand Down Expand Up @@ -2270,8 +2293,18 @@ module.exports = (() => {
}
}

const ThemeProvider = WebpackModules.getByProps('RootThemeContextProvider').RootThemeContextProvider;
const useSyncExternalStore = WebpackModules.getByProps('useSyncExternalStore').useSyncExternalStore;
const ThemeProvider = (() => {
let RootThemeContextProvider = null;
WebpackModules.getModule(e => {
const possFuncs = Object.values(e);
if (possFuncs.length < 3 || possFuncs.length > 10) return false;
if (!possFuncs.some(e => typeof e === 'function' && e.toString().includes('useThemeContext must be used within a ThemeContext.Provider'))) return false;
RootThemeContextProvider = possFuncs.find(e => e.toString().match(/theme:\w,primaryColor:\w,secondaryColor:\w,/));
return true;
})
return RootThemeContextProvider;
})() || (props => props.children);
// const useSyncExternalStore = WebpackModules.getByProps('useSyncExternalStore').useSyncExternalStore;
const ThemeStore = WebpackModules.getModule(m => m.theme);

function DiscordThemeProviderWrapper(props) {
Expand Down

0 comments on commit e3577e6

Please sign in to comment.