fix StartupTimings & Decor (#3963)

This commit is contained in:
thororen 2026-02-09 19:19:17 -05:00 committed by GitHub
parent 50c5124e1c
commit f9c404c229
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 24 deletions

View file

@ -570,3 +570,19 @@ export function CloudUploadIcon(props: IconProps) {
</Icon>
);
}
export const ClockIcon = (props?: any) => {
return (
<Icon
{...props}
viewBox="0 0 24 24"
>
<path
fillRule="evenodd"
clipRule="evenodd"
fill={props.fill || "currentColor"}
d="M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm1-18a1 1 0 1 0-2 0v7c0 .27.1.52.3.7l3 3a1 1 0 0 0 1.4-1.4L13 11.58V5Z"
/>
</Icon>
);
};

View file

@ -92,6 +92,16 @@ const settings = definePluginSettings({
}
});
const settingsSectionMap: [string, string][] = [
["VencordSettings", "vencord_main_panel"],
["VencordPlugins", "vencord_plugins_panel"],
["VencordThemes", "vencord_themes_panel"],
["VencordUpdater", "vencord_updater_panel"],
["VencordCloud", "vencord_cloud_panel"],
["VencordBackupAndRestore", "vencord_backup_restore_panel"],
["VencordPatchHelper", "vencord_patch_helper_panel"]
];
export default definePlugin({
name: "Settings",
description: "Adds Settings UI and debug info",
@ -99,6 +109,7 @@ export default definePlugin({
required: true,
settings,
settingsSectionMap,
patches: [
{
@ -205,15 +216,7 @@ export default definePlugin({
},
getSettingsSectionMappings() {
return [
["VencordSettings", "vencord_main_panel"],
["VencordPlugins", "vencord_plugins_panel"],
["VencordThemes", "vencord_themes_panel"],
["VencordUpdater", "vencord_updater_panel"],
["VencordCloud", "vencord_cloud_panel"],
["VencordBackupAndRestore", "vencord_backup_restore_panel"],
["VencordPatchHelper", "vencord_patch_helper_panel"]
];
return settingsSectionMap;
},
buildLayout(originalLayoutBuilder: SettingsLayoutBuilder) {

View file

@ -108,7 +108,7 @@ export default definePlugin({
replace: "$self.useUserDecorAvatarDecoration($2)??$1"
},
{
match: /(?<=userValue:)((\i)(?:.{0,10})?\.avatarDecoration)/,
match: /(?<=userValue:)((\i(?:\.author)?)\?\.avatarDecoration)/,
replace: "$self.useUserDecorAvatarDecoration($2)??$1"
}
]

View file

@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { ClockIcon } from "@components/Icons";
import SettingsPlugin from "@plugins/_core/settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
@ -25,18 +27,21 @@ export default definePlugin({
name: "StartupTimings",
description: "Adds Startup Timings to the Settings menu",
authors: [Devs.Megu],
patches: [{
find: ".SEARCH_NO_RESULTS&&0===",
replacement: [
{
match: /(?<=}\)([,;])(\i\.settings)\.forEach.+?(\i)\.push.+\)\)\}\))(?=\)\})/,
replace: (_, commaOrSemi, settings, elements) => "" +
`${commaOrSemi}${settings}?.[0]==="EXPERIMENTS"` +
`&&${elements}.push({section:"StartupTimings",label:"Startup Timings",element:$self.StartupTimingPage})`,
},
]
}],
StartupTimingPage
start() {
SettingsPlugin.customEntries.push({
key: "vencord_startup_timings",
title: "Startup Timings",
Component: StartupTimingPage,
Icon: ClockIcon
});
SettingsPlugin.settingsSectionMap.push(["VencordStartupTimings", "vencord_startup_timings"]);
},
stop() {
function removeFromArray<T>(arr: T[], predicate: (e: T) => boolean) {
const idx = arr.findIndex(predicate);
if (idx !== -1) arr.splice(idx, 1);
}
removeFromArray(SettingsPlugin.customEntries, e => e.key === "vencord_startup_timings");
removeFromArray(SettingsPlugin.settingsSectionMap, entry => entry[1] === "vencord_startup_timings");
},
});