2022-08-29 23:42:47 +00:00
|
|
|
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,
|
2022-08-29 23:42:47 +00:00
|
|
|
patches: [{
|
|
|
|
find: "default.versionHash",
|
|
|
|
replacement: [
|
|
|
|
{
|
|
|
|
match: /return .{1,2}\("div"/,
|
|
|
|
replace: (m) => {
|
|
|
|
return `var versions=VencordNative.getVersions();${m}`;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2022-09-15 16:17:52 +00:00
|
|
|
match: /\w\.createElement.+?["']Host ["'].+?\):null/,
|
2022-08-29 23:42:47 +00:00
|
|
|
replace: m => {
|
|
|
|
const idx = m.indexOf("Host") - 1;
|
|
|
|
const template = m.slice(0, idx);
|
|
|
|
return `${m}, ${template}"Vencord ", "${gitHash}"), " "), ` +
|
|
|
|
`${template} "Electron ", versions.electron), " "), ` +
|
|
|
|
`${template} "Chrome ", versions.chrome), " ")`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
find: "Messages.ACTIVITY_SETTINGS",
|
|
|
|
replacement: {
|
2022-08-31 02:07:16 +00:00
|
|
|
match: /\{section:(.{1,2})\.SectionTypes\.HEADER,\s*label:(.{1,2})\.default\.Messages\.ACTIVITY_SETTINGS\}/,
|
2022-08-29 23:42:47 +00:00
|
|
|
replace: (m, mod) =>
|
|
|
|
`{section:${mod}.SectionTypes.HEADER,label:"Vencord"},` +
|
|
|
|
`{section:"Vencord",label:"Vencord",element:Vencord.Components.Settings},` +
|
|
|
|
`{section:${mod}.SectionTypes.DIVIDER},${m}`
|
|
|
|
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
});
|