Vencord/src/plugins/settings.ts

35 lines
1.3 KiB
TypeScript
Raw Normal View History

import definePlugin from "../utils/types";
import gitHash from "git-hash";
export default definePlugin({
name: "Settings",
description: "Adds Settings UI and debug info",
author: "Vendicated",
2022-08-31 02:07:16 +00:00
required: true,
patches: [{
2022-09-27 12:34:57 +00:00
find: "().versionHash",
replacement: [
{
2022-09-27 12:34:57 +00:00
match: /\w\.createElement\(.{1,2}.Fragment,.{0,30}\{[^}]+\},"Host ".+?\):null/,
replace: m => {
const idx = m.indexOf("Host") - 1;
const template = m.slice(0, idx);
return `${m}, ${template}"Vencord ", "${gitHash}"), " "), ` +
2022-09-27 12:34:57 +00:00
`${template} "Electron ",VencordNative.getVersions().electron)," "), ` +
`${template} "Chrome ",VencordNative.getVersions().chrome)," ")`;
}
}
]
}, {
find: "Messages.ACTIVITY_SETTINGS",
replacement: {
2022-09-27 12:34:57 +00:00
match: /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/,
replace: (m, mod) =>
2022-09-27 12:34:57 +00:00
`{section:${mod}.ID.HEADER,label:"Vencord"},` +
`{section:"Vencord",label:"Vencord",element:Vencord.Components.Settings},` +
2022-09-27 12:34:57 +00:00
`{section:${mod}.ID.DIVIDER},${m}`
}
}]
2022-09-16 20:59:34 +00:00
});