mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-16 09:57:08 -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 type { ThemeHeader } from "@utils/themes";
|
||||||
import { getThemeInfo, stripBOM, type UserThemeHeader } from "@utils/themes/bd";
|
import { getThemeInfo, stripBOM, type UserThemeHeader } from "@utils/themes/bd";
|
||||||
import { usercssParse } from "@utils/themes/usercss";
|
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 { Button, Card, Forms, React, showToast, TabBar, TextInput, Tooltip, useEffect, useMemo, useRef, useState } from "@webpack/common";
|
||||||
import type { ComponentType, Ref, SyntheticEvent } from "react";
|
import type { ComponentType, Ref, SyntheticEvent } from "react";
|
||||||
import type { UserstyleHeader } from "usercss-meta";
|
import type { UserstyleHeader } from "usercss-meta";
|
||||||
|
@ -50,10 +50,7 @@ type FileInput = ComponentType<{
|
||||||
multiple?: boolean;
|
multiple?: boolean;
|
||||||
filters?: { name?: string; extensions: string[]; }[];
|
filters?: { name?: string; extensions: string[]; }[];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
const InviteActions = findByPropsLazy("resolveInvite");
|
|
||||||
const FileInput: FileInput = findLazy(m => m.prototype?.activateUploadDialogue && m.prototype.setRef);
|
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-");
|
const cl = classNameFactory("vc-settings-theme-");
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,20 @@
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
border: 1px solid var(--background-modifier-accent);
|
border: 1px solid var(--background-modifier-accent);
|
||||||
max-height: unset;
|
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 {
|
.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;
|
if (!application_id) return undefined;
|
||||||
let application = ApplicationStore.getApplication(application_id);
|
let application = ApplicationStore.getApplication(application_id);
|
||||||
if (!application && fetchedApplications.has(application_id)) {
|
if (!application && fetchedApplications.has(application_id)) {
|
||||||
|
@ -309,7 +311,7 @@ export default definePlugin({
|
||||||
return null;
|
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>(
|
const [currentActivity, setCurrentActivity] = useState<Activity | null>(
|
||||||
activity?.type !== 4 ? activity! : null
|
activity?.type !== 4 ? activity! : null
|
||||||
);
|
);
|
||||||
|
@ -340,7 +342,7 @@ export default definePlugin({
|
||||||
if (settings.store.allActivitiesStyle === "carousel") {
|
if (settings.store.allActivitiesStyle === "carousel") {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||||
{currentActivity?.id === activity?.id ? (
|
{activity && currentActivity?.id === activity?.id ? (
|
||||||
<ActivityView
|
<ActivityView
|
||||||
activity={currentActivity}
|
activity={currentActivity}
|
||||||
user={user}
|
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,'
|
'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
|
// Group DMs top small & large icon
|
||||||
{
|
{
|
||||||
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,
|
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);
|
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.toString = originalMod.toString.bind(originalMod);
|
||||||
factory.original = 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 (!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;
|
export type FilterFn = (mod: any) => boolean;
|
||||||
|
|
||||||
type PropsFilter = Array<string>;
|
export type PropsFilter = Array<string>;
|
||||||
type CodeFilter = Array<string | RegExp>;
|
export type CodeFilter = Array<string | RegExp>;
|
||||||
type StoreNameFilter = string;
|
export type StoreNameFilter = string;
|
||||||
|
|
||||||
const stringMatches = (s: string, filter: CodeFilter) =>
|
export const stringMatches = (s: string, filter: CodeFilter) =>
|
||||||
filter.every(f =>
|
filter.every(f =>
|
||||||
typeof f === "string"
|
typeof f === "string"
|
||||||
? s.includes(f)
|
? s.includes(f)
|
||||||
: f.test(s)
|
: (f.global && (f.lastIndex = 0), f.test(s))
|
||||||
);
|
);
|
||||||
|
|
||||||
export const filters = {
|
export const filters = {
|
||||||
|
@ -258,6 +258,8 @@ export const findBulk = traceFunction("findBulk", function findBulk(...filterFns
|
||||||
* @returns string or null
|
* @returns string or null
|
||||||
*/
|
*/
|
||||||
export const findModuleId = traceFunction("findModuleId", function findModuleId(...code: CodeFilter) {
|
export const findModuleId = traceFunction("findModuleId", function findModuleId(...code: CodeFilter) {
|
||||||
|
code = code.map(canonicalizeMatch);
|
||||||
|
|
||||||
for (const id in wreq.m) {
|
for (const id in wreq.m) {
|
||||||
if (stringMatches(wreq.m[id].toString(), code)) return id;
|
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> {
|
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 exports = {} as Record<S, any>;
|
||||||
|
|
||||||
const id = findModuleId(...code);
|
const id = findModuleId(...Array.isArray(code) ? code : [code]);
|
||||||
if (id === null)
|
if (id === null)
|
||||||
return exports;
|
return exports;
|
||||||
|
|
||||||
|
@ -606,6 +605,8 @@ export function waitFor(filter: string | PropsFilter | FilterFn, callback: Callb
|
||||||
* @returns Mapping of found modules
|
* @returns Mapping of found modules
|
||||||
*/
|
*/
|
||||||
export function search(...code: CodeFilter) {
|
export function search(...code: CodeFilter) {
|
||||||
|
code = code.map(canonicalizeMatch);
|
||||||
|
|
||||||
const results = {} as Record<number, Function>;
|
const results = {} as Record<number, Function>;
|
||||||
const factories = wreq.m;
|
const factories = wreq.m;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue