Fixed style bypass.
This commit is contained in:
@@ -39,29 +39,19 @@ function shieldMethods(methods) {
|
||||
|
||||
const styleMethods = (() => {
|
||||
if (config.platform === 'irc') {
|
||||
return shieldMethods({
|
||||
return {
|
||||
...styles,
|
||||
code: bypass,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if (config.platform === 'schat') {
|
||||
const methods = {
|
||||
return {
|
||||
bold: schatBold,
|
||||
italic: schatItalic,
|
||||
code: schatCode,
|
||||
...Object.fromEntries(Object.entries(config.schatColorAliases).map(([color, value]) => [color, (text) => schatColor(text, value)])),
|
||||
};
|
||||
|
||||
const handler = {
|
||||
get(target, prop) {
|
||||
return target[prop] || bypass;
|
||||
},
|
||||
};
|
||||
|
||||
const shieldedMethods = shieldMethods(methods);
|
||||
|
||||
return new Proxy(shieldedMethods, handler);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -74,4 +64,12 @@ const expandedMethods = {
|
||||
answer: (value) => styleMethods.bold(styleMethods.yellow(value)),
|
||||
};
|
||||
|
||||
module.exports = expandedMethods;
|
||||
const handler = {
|
||||
get(target, prop) {
|
||||
return target[prop] || bypass;
|
||||
},
|
||||
};
|
||||
|
||||
const shieldedMethods = shieldMethods(expandedMethods);
|
||||
|
||||
module.exports = new Proxy(shieldedMethods, handler);
|
||||
|
||||
Reference in New Issue
Block a user