diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Vencord.ts | 1 | ||||
-rw-r--r-- | src/VencordNative.ts | 3 | ||||
-rw-r--r-- | src/components/Settings.tsx | 4 | ||||
-rw-r--r-- | src/components/Test.tsx | 7 | ||||
-rw-r--r-- | src/components/index.ts | 1 | ||||
-rw-r--r-- | src/plugins/clientInfo.ts | 17 | ||||
-rw-r--r-- | src/plugins/settings.ts | 39 | ||||
-rw-r--r-- | src/pluginsModule.d.ts | 7 | ||||
-rw-r--r-- | src/utils/quickCss.ts | 2 |
9 files changed, 54 insertions, 27 deletions
diff --git a/src/Vencord.ts b/src/Vencord.ts index e804133..4364468 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -1,6 +1,7 @@ export * as Plugins from "./plugins"; export * as Webpack from "./utils/webpack"; export * as Api from "./api"; +export * as Components from "./components"; import "./utils/patchWebpack"; import "./utils/quickCss"; diff --git a/src/VencordNative.ts b/src/VencordNative.ts index 0fc5d16..7fbe6df 100644 --- a/src/VencordNative.ts +++ b/src/VencordNative.ts @@ -7,5 +7,6 @@ export default { cb(css); }); }, - getQuickCss: () => ipcRenderer.invoke(IPC_GET_QUICK_CSS) as Promise<string> + getQuickCss: () => ipcRenderer.invoke(IPC_GET_QUICK_CSS) as Promise<string>, + getVersions: () => process.versions };
\ No newline at end of file diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx new file mode 100644 index 0000000..f996448 --- /dev/null +++ b/src/components/Settings.tsx @@ -0,0 +1,4 @@ +export default function Settings(props) { + console.log(props); + return (<p>Hi</p>); +}
\ No newline at end of file diff --git a/src/components/Test.tsx b/src/components/Test.tsx deleted file mode 100644 index 14a46dd..0000000 --- a/src/components/Test.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from "react"; - -export default () => { - <div> - Hi - </div>; -}; diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 0000000..b999c27 --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1 @@ +export { default as Settings } from "./Settings";
\ No newline at end of file diff --git a/src/plugins/clientInfo.ts b/src/plugins/clientInfo.ts deleted file mode 100644 index 77cc70c..0000000 --- a/src/plugins/clientInfo.ts +++ /dev/null @@ -1,17 +0,0 @@ -import definePlugin from "../utils/types"; - -export default definePlugin({ - name: "ClientInfo", - description: "Adds extra info to Client Info in settings", - author: "Vendicated", - patches: [{ - find: "default.versionHash", - replacement: { - match: /\w\.createElement.+?["']Host ["'].+?\):null/, - replace: m => { - const idx = m.indexOf("Host") - 1; - return `${m},${m.slice(0, idx)}"Vencord ".repeat(50),"1.0.0")," ")`; - } - } - }] -});
\ No newline at end of file diff --git a/src/plugins/settings.ts b/src/plugins/settings.ts new file mode 100644 index 0000000..fa214f0 --- /dev/null +++ b/src/plugins/settings.ts @@ -0,0 +1,39 @@ +import definePlugin from "../utils/types"; +import gitHash from "git-hash"; + +export default definePlugin({ + name: "Settings", + description: "Adds Settings UI and debug info", + author: "Vendicated", + patches: [{ + find: "default.versionHash", + replacement: [ + { + match: /return .{1,2}\("div"/, + replace: (m) => { + return `var versions=VencordNative.getVersions();${m}`; + } + }, + { + match: /\w\.createElement.+?["']Host ["'].+?\):null/, + 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: { + match: /\{section:(.{1,2})\.SectionTypes\.HEADER,label:(.{1,2})\.default\.Messages\.ACTIVITY_SETTINGS\}/, + replace: (m, mod) => + `{section:${mod}.SectionTypes.HEADER,label:"Vencord"},` + + `{section:"Vencord",label:"Vencord",element:Vencord.Components.Settings},` + + `{section:${mod}.SectionTypes.DIVIDER},${m}` + + } + }] +});
\ No newline at end of file diff --git a/src/pluginsModule.d.ts b/src/pluginsModule.d.ts index 0ef3819..8c2ac23 100644 --- a/src/pluginsModule.d.ts +++ b/src/pluginsModule.d.ts @@ -1,4 +1,9 @@ declare module "plugins" { const plugins: import("./utils/types").Plugin[]; export default plugins; -}
\ No newline at end of file +} + +declare module "git-hash" { + const hash: string; + export default hash; +} diff --git a/src/utils/quickCss.ts b/src/utils/quickCss.ts index 573eccc..724fde8 100644 --- a/src/utils/quickCss.ts +++ b/src/utils/quickCss.ts @@ -3,4 +3,4 @@ document.addEventListener("DOMContentLoaded", async () => { document.head.appendChild(style); VencordNative.handleQuickCssUpdate((css: string) => style.innerText = css); style.innerText = await VencordNative.getQuickCss(); -});
\ No newline at end of file +}); |