Plugin
PermissionFreeWill
Disables the client-side restrictions for channel permission management.
1
/*2
* FiveCord — a Discord client mod3
* Copyright (c) 2025 FiveCord4
* SPDX-License-Identifier: GPL-3.0-or-later5
*/6
7
import { definePluginSettings } from "@api/Settings";8
import { Devs } from "@utils/constants";9
import { canonicalizeMatch } from "@utils/patches";10
import definePlugin, { OptionType } from "@utils/types";11
12
const settings = definePluginSettings({13
lockout: {14
type: OptionType.BOOLEAN,15
default: true,16
description: 039;Bypass the permission lockout prevention ("Pretty sure you don\039;t want to do this")039;,17
restartNeeded: true18
},19
onboarding: {20
type: OptionType.BOOLEAN,21
default: true,22
description: 039;Bypass the onboarding requirements ("Making this change will make your server incompatible [...]")039;,23
restartNeeded: true24
}25
});26
27
export 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 true35
{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.lockout44
},45
// Onboarding, same thing but we need to prevent the check46
{47
find: "#{intl::ONBOARDING_CHANNEL_THRESHOLD_WARNING}",48
replacement: [49
{50
// replace export getters with functions that always resolve to true51
match: /{(?:\i:\(\)=>\i,?){2}}/,52
replace: m => m.replaceAll(canonicalizeMatch(/\(\)=>\i/g), "()=>()=>Promise.resolve(true)")53
}54
],55
predicate: () => settings.store.onboarding56
}57
],58
settings59
});60