mirror of
https://github.com/System-End/Vencord.git
synced 2026-04-19 23:22:48 +00:00
fix FriendsSince & own CustomRPC buttons not showing for yourself
This commit is contained in:
parent
b0115598ba
commit
b910b3d147
5 changed files with 22 additions and 11 deletions
|
|
@ -91,6 +91,10 @@ function isReporterTestable(p: Plugin, part: ReporterTestable) {
|
|||
: (p.reporterTestable & part) === part;
|
||||
}
|
||||
|
||||
export function pluginRequiresRestart(p: Plugin) {
|
||||
return p.requiresRestart !== false && (p.requiresRestart || !!p.patches?.length);
|
||||
}
|
||||
|
||||
export const startAllPlugins = traceFunction("startAllPlugins", function startAllPlugins(target: StartAt) {
|
||||
logger.info(`Starting plugins (stage ${target})`);
|
||||
for (const name in Plugins) {
|
||||
|
|
@ -119,7 +123,7 @@ export function startDependenciesRecursive(p: Plugin) {
|
|||
settings[d].enabled = true;
|
||||
dep.isDependency = true;
|
||||
|
||||
if (dep.patches) {
|
||||
if (pluginRequiresRestart(dep)) {
|
||||
logger.warn(`Enabling dependency ${d} requires restart.`);
|
||||
restartNeeded = true;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { showNotice } from "@api/Notices";
|
||||
import { isPluginEnabled, startDependenciesRecursive, startPlugin, stopPlugin } from "@api/PluginManager";
|
||||
import { isPluginEnabled, pluginRequiresRestart, startDependenciesRecursive, startPlugin, stopPlugin } from "@api/PluginManager";
|
||||
import { CogWheel, InfoIcon } from "@components/Icons";
|
||||
import { AddonCard } from "@components/settings/AddonCard";
|
||||
import { isObjectEmpty } from "@utils/misc";
|
||||
|
|
@ -49,8 +49,8 @@ export function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, on
|
|||
}
|
||||
}
|
||||
|
||||
// if the plugin has patches, dont use stopPlugin/startPlugin. Wait for restart to apply changes.
|
||||
if (plugin.patches?.length) {
|
||||
// if the plugin requires a restart, don't use stopPlugin/startPlugin. Wait for restart to apply changes.
|
||||
if (pluginRequiresRestart(plugin)) {
|
||||
settings.enabled = !wasEnabled;
|
||||
onRestartNeeded(plugin.name, "enabled");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -215,17 +215,20 @@ export default definePlugin({
|
|||
description: "Add a fully customisable Rich Presence (Game status) to your Discord profile",
|
||||
authors: [Devs.captain, Devs.AutumnVN, Devs.nin0dev],
|
||||
dependencies: ["UserSettingsAPI"],
|
||||
start: setRpc,
|
||||
stop: () => setRpc(true),
|
||||
// This plugin's patch is not important for functionality, so don't require a restart
|
||||
requiresRestart: false,
|
||||
settings,
|
||||
|
||||
start: setRpc,
|
||||
stop: () => setRpc(true),
|
||||
|
||||
// Discord hides buttons on your own Rich Presence for some reason. This patch disables that behaviour
|
||||
patches: [
|
||||
{
|
||||
find: ".party?(0",
|
||||
all: true,
|
||||
find: ".buttons.length)>=1",
|
||||
replacement: {
|
||||
match: /\i\.id===\i\.id\?null:/,
|
||||
replace: ""
|
||||
match: /.getId\(\)===\i.id/,
|
||||
replace: "$& && false"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const containerWrapper = findByPropsLazy("memberSinceWrapper");
|
|||
const container = findByPropsLazy("memberSince");
|
||||
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
|
||||
const locale = findByPropsLazy("getLocale");
|
||||
const Section = findComponentByCodeLazy('"auto":"smooth"', ".section");
|
||||
const Section = findComponentByCodeLazy('headingVariant:"text-xs/medium"', ".section");
|
||||
|
||||
export default definePlugin({
|
||||
name: "FriendsSince",
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ export interface PluginDef {
|
|||
* Whether this plugin should be enabled by default, but can be disabled
|
||||
*/
|
||||
enabledByDefault?: boolean;
|
||||
/**
|
||||
* Whether enabling or disabling this plugin requires a restart. Defaults to true if the plugin has patches.
|
||||
*/
|
||||
requiresRestart?: boolean;
|
||||
/**
|
||||
* When to call the start() method
|
||||
* @default StartAt.WebpackReady
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue