Plugin

PermissionFreeWill

Disables the client-side restrictions for channel permission management.

Servers Roles
index.ts
Download

Source

src/plugins/permissionFreeWill/index.ts
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import { definePluginSettings } from "@api/Settings";
8import { Devs } from "@utils/constants";
9import { canonicalizeMatch } from "@utils/patches";
10import definePlugin, { OptionType } from "@utils/types";
11
12const settings = definePluginSettings({
13 lockout: {
14 type: OptionType.BOOLEAN,
15 default: true,
16 description: 'Bypass the permission lockout prevention ("Pretty sure you don\'t want to do this")',
17 restartNeeded: true
18 },
19 onboarding: {
20 type: OptionType.BOOLEAN,
21 default: true,
22 description: 'Bypass the onboarding requirements ("Making this change will make your server incompatible [...]")',
23 restartNeeded: true
24 }
25});
26
27export default definePlugin({
28 name: "PermissionFreeWill",
29 description: "Disables the client-side restrictions for channel permission management.",
30 tags: ["Servers", "Roles"],
31 authors: [Devs.lewisakura],
32
33 patches: [
34 // Permission lockout, just set the check to true
35 {
36 find: "#{intl::STAGE_CHANNEL_CANNOT_OVERWRITE_PERMISSION}",
37 replacement: [
38 {
39 match: /case"DENY":.{0,50}if\((?=\i\.\i\.can)/,
40 replace: "$&true||"
41 }
42 ],
43 predicate: () => settings.store.lockout
44 },
45 // Onboarding, same thing but we need to prevent the check
46 {
47 find: "#{intl::ONBOARDING_CHANNEL_THRESHOLD_WARNING}",
48 replacement: [
49 {
50 // replace export getters with functions that always resolve to true
51 match: /{(?:\i:\(\)=>\i,?){2}}/,
52 replace: m => m.replaceAll(canonicalizeMatch(/\(\)=>\i/g), "()=>()=>Promise.resolve(true)")
53 }
54 ],
55 predicate: () => settings.store.onboarding
56 }
57 ],
58 settings
59});
60