new plugin: OverrideForumDefaults (#2272)

Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
Inbestigator 2024-03-21 18:16:24 -07:00 committed by GitHub
parent 5646fe402a
commit 1cb295b1b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,54 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
const settings = definePluginSettings({
defaultLayout: {
type: OptionType.SELECT,
options: [
{ label: "List", value: 1, default: true },
{ label: "Gallery", value: 2 }
],
description: "Which layout to use as default"
},
defaultSortOrder: {
type: OptionType.SELECT,
options: [
{ label: "Recently Active", value: 0, default: true },
{ label: "Date Posted", value: 1 }
],
description: "Which sort order to use as default"
}
});
export default definePlugin({
name: "OverrideForumDefaults",
description: "Allows you to override default forum layout/sort order. you can still change it on a per-channel basis",
authors: [Devs.Inbestigator],
patches: [
{
find: "getDefaultLayout(){",
replacement: [
{
match: /getDefaultLayout\(\){/,
replace: "$&return $self.getLayout();"
},
{
match: /getDefaultSortOrder\(\){/,
replace: "$&return $self.getSortOrder();"
}
]
}
],
getLayout: () => settings.store.defaultLayout,
getSortOrder: () => settings.store.defaultSortOrder,
settings
});

View file

@ -418,6 +418,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "Elvyra",
id: 708275751816003615n,
},
Inbestigator: {
name: "Inbestigator",
id: 761777382041714690n
},
newwares: {
name: "newwares",
id: 421405303951851520n