mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-11 23:53:03 -04:00
Merge branch 'dev'
This commit is contained in:
commit
d6396efbd5
6 changed files with 35 additions and 25 deletions
|
@ -35,7 +35,7 @@ import { useAwaiter } from "@utils/react";
|
|||
import type { ThemeHeader } from "@utils/themes";
|
||||
import { getThemeInfo, stripBOM, type UserThemeHeader } from "@utils/themes/bd";
|
||||
import { usercssParse } from "@utils/themes/usercss";
|
||||
import { findByPropsLazy, findLazy } from "@webpack";
|
||||
import { findLazy } from "@webpack";
|
||||
import { Button, Card, Forms, React, showToast, TabBar, TextInput, Tooltip, useEffect, useMemo, useRef, useState } from "@webpack/common";
|
||||
import type { ComponentType, Ref, SyntheticEvent } from "react";
|
||||
import type { UserstyleHeader } from "usercss-meta";
|
||||
|
@ -50,10 +50,7 @@ type FileInput = ComponentType<{
|
|||
multiple?: boolean;
|
||||
filters?: { name?: string; extensions: string[]; }[];
|
||||
}>;
|
||||
|
||||
const InviteActions = findByPropsLazy("resolveInvite");
|
||||
const FileInput: FileInput = findLazy(m => m.prototype?.activateUploadDialogue && m.prototype.setRef);
|
||||
const TextAreaProps = findLazy(m => typeof m.textarea === "string");
|
||||
|
||||
const cl = classNameFactory("vc-settings-theme-");
|
||||
|
||||
|
|
|
@ -33,6 +33,20 @@
|
|||
padding: 0.5em;
|
||||
border: 1px solid var(--background-modifier-accent);
|
||||
max-height: unset;
|
||||
background-color: transparent;
|
||||
box-sizing: border-box;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
resize: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.vc-settings-theme-links::placeholder {
|
||||
color: var(--header-secondary);
|
||||
}
|
||||
|
||||
.vc-settings-theme-links:focus {
|
||||
background-color: var(--background-tertiary);
|
||||
}
|
||||
|
||||
.vc-cloud-settings-sync-grid {
|
||||
|
|
|
@ -127,7 +127,9 @@ const ActivityTooltip = ({ activity, application, user }: Readonly<{ activity: A
|
|||
);
|
||||
};
|
||||
|
||||
function getActivityApplication({ application_id }: Activity) {
|
||||
function getActivityApplication(activity: Activity | null) {
|
||||
if (!activity) return undefined;
|
||||
const { application_id } = activity;
|
||||
if (!application_id) return undefined;
|
||||
let application = ApplicationStore.getApplication(application_id);
|
||||
if (!application && fetchedApplications.has(application_id)) {
|
||||
|
@ -309,7 +311,7 @@ export default definePlugin({
|
|||
return null;
|
||||
},
|
||||
|
||||
showAllActivitiesComponent({ activity, user, ...props }: Readonly<{ activity: Activity; user: User; application: Application; type: string; }>) {
|
||||
showAllActivitiesComponent({ activity, user, ...props }: Readonly<{ activity: Activity | null; user: User; application: Application; type: string; }>) {
|
||||
const [currentActivity, setCurrentActivity] = useState<Activity | null>(
|
||||
activity?.type !== 4 ? activity! : null
|
||||
);
|
||||
|
@ -340,7 +342,7 @@ export default definePlugin({
|
|||
if (settings.store.allActivitiesStyle === "carousel") {
|
||||
return (
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
{currentActivity?.id === activity?.id ? (
|
||||
{activity && currentActivity?.id === activity?.id ? (
|
||||
<ActivityView
|
||||
activity={currentActivity}
|
||||
user={user}
|
||||
|
|
|
@ -203,14 +203,6 @@ export default definePlugin({
|
|||
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
|
||||
}
|
||||
})),
|
||||
// Old User DMs "User Profile" popup in the right
|
||||
{
|
||||
find: ".avatarPositionPanel",
|
||||
replacement: {
|
||||
match: /(avatarWrapperNonUserBot.{0,50})onClick:(\i\|\|\i)\?void 0(?<=,avatarSrc:(\i).+?)/,
|
||||
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
|
||||
}
|
||||
},
|
||||
// Group DMs top small & large icon
|
||||
{
|
||||
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,
|
||||
|
|
|
@ -233,7 +233,7 @@ function patchFactories(factories: Record<string, (module: any, exports: any, re
|
|||
logger.error("Error while firing callback for Webpack subscription:\n", err, filter, callback);
|
||||
}
|
||||
}
|
||||
} as any as { toString: () => string, original: any, (...args: any[]): void; };
|
||||
} as any as { toString: () => string, original: any, (...args: any[]): void; $$vencordPatchedSource?: string; };
|
||||
|
||||
factory.toString = originalMod.toString.bind(originalMod);
|
||||
factory.original = originalMod;
|
||||
|
@ -354,5 +354,9 @@ function patchFactories(factories: Record<string, (module: any, exports: any, re
|
|||
|
||||
if (!patch.all) patches.splice(i--, 1);
|
||||
}
|
||||
|
||||
if (mod !== originalMod) {
|
||||
factory.$$vencordPatchedSource = String(mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,15 +38,15 @@ export let cache: WebpackInstance["c"];
|
|||
|
||||
export type FilterFn = (mod: any) => boolean;
|
||||
|
||||
type PropsFilter = Array<string>;
|
||||
type CodeFilter = Array<string | RegExp>;
|
||||
type StoreNameFilter = string;
|
||||
export type PropsFilter = Array<string>;
|
||||
export type CodeFilter = Array<string | RegExp>;
|
||||
export type StoreNameFilter = string;
|
||||
|
||||
const stringMatches = (s: string, filter: CodeFilter) =>
|
||||
export const stringMatches = (s: string, filter: CodeFilter) =>
|
||||
filter.every(f =>
|
||||
typeof f === "string"
|
||||
? s.includes(f)
|
||||
: f.test(s)
|
||||
: (f.global && (f.lastIndex = 0), f.test(s))
|
||||
);
|
||||
|
||||
export const filters = {
|
||||
|
@ -258,6 +258,8 @@ export const findBulk = traceFunction("findBulk", function findBulk(...filterFns
|
|||
* @returns string or null
|
||||
*/
|
||||
export const findModuleId = traceFunction("findModuleId", function findModuleId(...code: CodeFilter) {
|
||||
code = code.map(canonicalizeMatch);
|
||||
|
||||
for (const id in wreq.m) {
|
||||
if (stringMatches(wreq.m[id].toString(), code)) return id;
|
||||
}
|
||||
|
@ -452,12 +454,9 @@ export function findExportedComponentLazy<T extends object = any>(...props: Prop
|
|||
* })
|
||||
*/
|
||||
export const mapMangledModule = traceFunction("mapMangledModule", function mapMangledModule<S extends string>(code: string | RegExp | CodeFilter, mappers: Record<S, FilterFn>): Record<S, any> {
|
||||
if (!Array.isArray(code)) code = [code];
|
||||
code = code.map(canonicalizeMatch);
|
||||
|
||||
const exports = {} as Record<S, any>;
|
||||
|
||||
const id = findModuleId(...code);
|
||||
const id = findModuleId(...Array.isArray(code) ? code : [code]);
|
||||
if (id === null)
|
||||
return exports;
|
||||
|
||||
|
@ -606,6 +605,8 @@ export function waitFor(filter: string | PropsFilter | FilterFn, callback: Callb
|
|||
* @returns Mapping of found modules
|
||||
*/
|
||||
export function search(...code: CodeFilter) {
|
||||
code = code.map(canonicalizeMatch);
|
||||
|
||||
const results = {} as Record<number, Function>;
|
||||
const factories = wreq.m;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue