-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
72 lines (63 loc) · 2.17 KB
/
index.tsx
File metadata and controls
72 lines (63 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* eslint-disable simple-header/header */
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
import definePlugin, { OptionType } from "@utils/types";
const settings = definePluginSettings({
removeCloseButton: {
type: OptionType.BOOLEAN,
default: true,
description: "Remove redundant close button, which might actually break plugin if accidentally pressed",
restartNeeded: true,
hidden: true
}
});
// By default Discord only seems too displays 'Staging' so we map the names ourself
const names: Record<string, string> = {
stable: "Stable",
ptb: "PTB",
canary: "Canary",
staging: "Staging"
};
// Useless for the normal User, but useful for me
migratePluginSettings("DiscordDevBanner", "devBanner");
export default definePlugin({
name: "DiscordDevBanner",
description: "Enables the Discord developer banner, in which displays the build-ID",
authors: [
// Import from EquicordDevs for Equicord
{ name: "krystalskullofficial", id: 929208515883569182n },
],
settings,
patches: [
{
find: '"isHideDevBanner"',
replacement: [
{
match: '"staging"===window.GLOBAL_ENV.RELEASE_CHANNEL',
replace: "true"
},
{
predicate: () => settings.store.removeCloseButton,
match: /(\i=\(\)=>)\(.*?\}\);/,
replace: "$1null;",
},
{
match: /\i\.\i\.format\(.{0,15},{buildNumber:(.{0,10})}\)/,
replace: "$self.transform($1)"
}
]
}
],
transform(buildNumber: string) {
const releaseChannel: string = window.GLOBAL_ENV.RELEASE_CHANNEL;
if (names[releaseChannel]) {
return `${names[releaseChannel]} ${buildNumber}`;
} else {
return `${releaseChannel.charAt(0).toUpperCase() + releaseChannel.slice(1)} ${buildNumber}`;
}
},
});