mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-14 00:53:04 -04:00
ShowHiddenChannels: Stage and voice channels support (#469)
Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
parent
291f38115c
commit
992a77e76c
7 changed files with 362 additions and 142 deletions
|
@ -21,6 +21,7 @@ import Logger from "@utils/Logger";
|
|||
import { canonicalizeReplacement } from "@utils/patches";
|
||||
import { PatchReplacement } from "@utils/types";
|
||||
|
||||
import { traceFunction } from "../debug/Tracer";
|
||||
import { _initWebpack } from ".";
|
||||
|
||||
let webpackChunk: any[];
|
||||
|
@ -132,6 +133,7 @@ function patchPush() {
|
|||
|
||||
for (let i = 0; i < patches.length; i++) {
|
||||
const patch = patches[i];
|
||||
const executePatch = traceFunction(`patch by ${patch.plugin}`, (match: string | RegExp, replace: string) => code.replace(match, replace));
|
||||
if (patch.predicate && !patch.predicate()) continue;
|
||||
|
||||
if (code.includes(patch.find)) {
|
||||
|
@ -146,7 +148,7 @@ function patchPush() {
|
|||
canonicalizeReplacement(replacement, patch.plugin);
|
||||
|
||||
try {
|
||||
const newCode = code.replace(replacement.match, replacement.replace as string);
|
||||
const newCode = executePatch(replacement.match, replacement.replace as string);
|
||||
if (newCode === code && !patch.noWarn) {
|
||||
logger.warn(`Patch by ${patch.plugin} had no effect (Module id is ${id}): ${replacement.match}`);
|
||||
if (IS_DEV) {
|
||||
|
@ -187,7 +189,7 @@ function patchPush() {
|
|||
}
|
||||
|
||||
logger.errorCustomFmt(...Logger.makeTitle("white", "Before"), context);
|
||||
logger.errorCustomFmt(...Logger.makeTitle("white", "After"), context);
|
||||
logger.errorCustomFmt(...Logger.makeTitle("white", "After"), patchedContext);
|
||||
const [titleFmt, ...titleElements] = Logger.makeTitle("white", "Diff");
|
||||
logger.errorCustomFmt(titleFmt + fmt, ...titleElements, ...elements);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue