mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-22 21:07:00 -04:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
84f56a6d54
6 changed files with 46 additions and 35 deletions
|
@ -25,16 +25,16 @@ export interface ButtonAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const actions: ButtonAction[] = [
|
export const actions: ButtonAction[] = [
|
||||||
{ id: "openSuncordSettings", label: "Open Suncord tab", callback: async () => await SettingsRouter.open("SuncordSettings"), registrar: "Suncord" },
|
{ id: "openEquicordSettings", label: "Open Equicord tab", callback: async () => await SettingsRouter.open("EquicordSettings"), registrar: "Equicord" },
|
||||||
{ id: "openPluginSettings", label: "Open Plugin tab", callback: () => SettingsRouter.open("SuncordPlugins"), registrar: "Suncord" },
|
{ id: "openPluginSettings", label: "Open Plugin tab", callback: () => SettingsRouter.open("EquicordPlugins"), registrar: "Equicord" },
|
||||||
{ id: "openThemesSettings", label: "Open Themes tab", callback: () => SettingsRouter.open("SuncordThemes"), registrar: "Suncord" },
|
{ id: "openThemesSettings", label: "Open Themes tab", callback: () => SettingsRouter.open("EquicordThemes"), registrar: "Equicord" },
|
||||||
{ id: "openUpdaterSettings", label: "Open Updater tab", callback: () => SettingsRouter.open("SuncordUpdater"), registrar: "Suncord" },
|
{ id: "openUpdaterSettings", label: "Open Updater tab", callback: () => SettingsRouter.open("EquicordUpdater"), registrar: "Equicord" },
|
||||||
{ id: "openSuncordCloudSettings", label: "Open Cloud tab", callback: () => SettingsRouter.open("SuncordCloud"), registrar: "Suncord" },
|
{ id: "openEquicordCloudSettings", label: "Open Cloud tab", callback: () => SettingsRouter.open("EquicordCloud"), registrar: "Equicord" },
|
||||||
{ id: "openBackupSettings", label: "Open Backup & Restore tab", callback: () => SettingsRouter.open("SuncordSettingsSync"), registrar: "Suncord" },
|
{ id: "openBackupSettings", label: "Open Backup & Restore tab", callback: () => SettingsRouter.open("EquicordSettingsSync"), registrar: "Equicord" },
|
||||||
{ id: "restartClient", label: "Restart Client", callback: () => relaunch(), registrar: "Suncord" },
|
{ id: "restartClient", label: "Restart Client", callback: () => relaunch(), registrar: "Equicord" },
|
||||||
{ id: "openQuickCSSFile", label: "Open Quick CSS File", callback: () => VencordNative.quickCss.openEditor(), registrar: "Suncord" },
|
{ id: "openQuickCSSFile", label: "Open Quick CSS File", callback: () => VencordNative.quickCss.openEditor(), registrar: "Equicord" },
|
||||||
{ id: "openSettingsFolder", label: "Open Settings Folder", callback: async () => showItemInFolder(await VencordNative.settings.getSettingsDir()), registrar: "Suncord" },
|
{ id: "openSettingsFolder", label: "Open Settings Folder", callback: async () => showItemInFolder(await VencordNative.settings.getSettingsDir()), registrar: "Equicord" },
|
||||||
{ id: "openInGithub", label: "Open in Github", callback: async () => VencordNative.native.openExternal(await getRepo()), registrar: "Suncord" },
|
{ id: "openInGithub", label: "Open in Github", callback: async () => VencordNative.native.openExternal(await getRepo()), registrar: "Equicord" },
|
||||||
|
|
||||||
{
|
{
|
||||||
id: "openInBrowser", label: "Open in Browser", callback: async () => {
|
id: "openInBrowser", label: "Open in Browser", callback: async () => {
|
||||||
|
@ -54,7 +54,7 @@ export const actions: ButtonAction[] = [
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, registrar: "Suncord"
|
}, registrar: "Equicord"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ export const actions: ButtonAction[] = [
|
||||||
if (choice && enabled) {
|
if (choice && enabled) {
|
||||||
return togglePlugin(choice, enabled.id === "enable");
|
return togglePlugin(choice, enabled.id === "enable");
|
||||||
}
|
}
|
||||||
}, registrar: "Suncord"
|
}, registrar: "Equicord"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ export const actions: ButtonAction[] = [
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, registrar: "Suncord"
|
}, registrar: "Equicord"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -125,7 +125,7 @@ export const actions: ButtonAction[] = [
|
||||||
position: Toasts.Position.BOTTOM
|
position: Toasts.Position.BOTTOM
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, registrar: "Suncord"
|
}, registrar: "Equicord"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -134,12 +134,12 @@ export const actions: ButtonAction[] = [
|
||||||
|
|
||||||
if (isOutdated) {
|
if (isOutdated) {
|
||||||
setTimeout(() => showNotification({
|
setTimeout(() => showNotification({
|
||||||
title: "A Suncord update is available!",
|
title: "A Equicord update is available!",
|
||||||
body: "Click here to view the update",
|
body: "Click here to view the update",
|
||||||
permanent: true,
|
permanent: true,
|
||||||
noPersist: true,
|
noPersist: true,
|
||||||
onClick() {
|
onClick() {
|
||||||
SettingsRouter.open("SuncordUpdater");
|
SettingsRouter.open("EquicordUpdater");
|
||||||
}
|
}
|
||||||
}), 10_000);
|
}), 10_000);
|
||||||
} else {
|
} else {
|
||||||
|
@ -152,7 +152,7 @@ export const actions: ButtonAction[] = [
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, registrar: "Suncord"
|
}, registrar: "Equicord"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,7 @@ export const actions: ButtonAction[] = [
|
||||||
if (choice) {
|
if (choice) {
|
||||||
NavigationRouter.transitionToGuild(choice.id);
|
NavigationRouter.transitionToGuild(choice.id);
|
||||||
}
|
}
|
||||||
}, registrar: "Suncord"
|
}, registrar: "Equicord"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -94,14 +94,12 @@ export default definePlugin({
|
||||||
start() {
|
start() {
|
||||||
document.addEventListener("keydown", this.event);
|
document.addEventListener("keydown", this.event);
|
||||||
|
|
||||||
if (IS_DEV) {
|
registerAction({
|
||||||
registerAction({
|
id: "openDevSettings",
|
||||||
id: "openDevSettings",
|
label: "Open Dev tab",
|
||||||
label: "Open Dev tab",
|
callback: () => SettingsRouter.open("EquicordPatchHelper"),
|
||||||
callback: () => SettingsRouter.open("SuncordPatchHelper"),
|
registrar: "Equicord"
|
||||||
registrar: "Suncord"
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
|
|
@ -83,7 +83,7 @@ function makeShortcuts() {
|
||||||
wpsearch: search,
|
wpsearch: search,
|
||||||
wpex: extract,
|
wpex: extract,
|
||||||
wpexs: (code: string) => extract(findModuleId(code)!),
|
wpexs: (code: string) => extract(findModuleId(code)!),
|
||||||
loadLazyChunks: IS_DEV ? loadLazyChunks : () => { throw new Error("loadLazyChunks is dev only."); },
|
loadLazyChunks: loadLazyChunks,
|
||||||
find,
|
find,
|
||||||
findAll: findAll,
|
findAll: findAll,
|
||||||
findByProps,
|
findByProps,
|
||||||
|
|
|
@ -442,7 +442,7 @@ export default definePlugin({
|
||||||
if (proto == null || typeof proto === "string") return;
|
if (proto == null || typeof proto === "string") return;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const premiumType: number = user?._realPremiumType ?? UserStore?.getCurrentUser?._realPremiumType ?? user?.premium_type ?? UserStore?.getCurrentUser()?.premiumType ?? 0;
|
const premiumType: number = user?._realPremiumType ?? user?.premium_type ?? UserStore?.getCurrentUser()?.premiumType ?? 0;
|
||||||
|
|
||||||
if (premiumType !== 2) {
|
if (premiumType !== 2) {
|
||||||
proto.appearance ??= AppearanceSettingsActionCreators.create();
|
proto.appearance ??= AppearanceSettingsActionCreators.create();
|
||||||
|
|
|
@ -6,17 +6,25 @@
|
||||||
|
|
||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { SelectedGuildStore, useState } from "@webpack/common";
|
import { SelectedGuildStore, useState } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
|
export const settings = definePluginSettings({
|
||||||
|
hideAtSymbol: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Whether the the @-symbol should be hidden.",
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "MentionAvatars",
|
name: "MentionAvatars",
|
||||||
description: "Shows user avatars inside mentions",
|
description: "Shows user avatars inside mentions",
|
||||||
authors: [Devs.Ven],
|
authors: [Devs.Ven, Devs.Luna],
|
||||||
|
|
||||||
patches: [{
|
patches: [{
|
||||||
find: ".USER_MENTION)",
|
find: ".USER_MENTION)",
|
||||||
replacement: {
|
replacement: {
|
||||||
|
@ -24,12 +32,12 @@ export default definePlugin({
|
||||||
replace: "children:$self.renderUsername({username:$1,user:$2})"
|
replace: "children:$self.renderUsername({username:$1,user:$2})"
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
settings,
|
||||||
renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => {
|
renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => {
|
||||||
const { user, username } = props;
|
const { user, username } = props;
|
||||||
const [isHovering, setIsHovering] = useState(false);
|
const [isHovering, setIsHovering] = useState(false);
|
||||||
|
|
||||||
if (!user) return <>@{username}</>;
|
if (!user) return <>{getUsernameString(username)}</>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
|
@ -37,8 +45,13 @@ export default definePlugin({
|
||||||
onMouseLeave={() => setIsHovering(false)}
|
onMouseLeave={() => setIsHovering(false)}
|
||||||
>
|
>
|
||||||
<img src={user.getAvatarURL(SelectedGuildStore.getGuildId(), 16, isHovering)} className="vc-mentionAvatars-avatar" />
|
<img src={user.getAvatarURL(SelectedGuildStore.getGuildId(), 16, isHovering)} className="vc-mentionAvatars-avatar" />
|
||||||
@{username}
|
{getUsernameString(username)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}, { noop: true })
|
}, { noop: true })
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getUsernameString(username: string) {
|
||||||
|
if (settings.store.hideAtSymbol) return username;
|
||||||
|
return `@${username}`;
|
||||||
|
}
|
||||||
|
|
|
@ -307,7 +307,7 @@ export default definePlugin({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: '+1]})},"overflow"))',
|
find: '})},"overflow"))',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Create a variable for the channel prop
|
// Create a variable for the channel prop
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue