This repository has been archived on 2025-03-25. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
kernel-powercord-plugin-dow.../preload.js
2022-06-15 11:35:53 -04:00

21 lines
588 B
JavaScript

const { contextBridge } = require("electron")
const { resolve, join } = require("path")
const exec = require("util").promisify(require("child_process").exec)
contextBridge.exposeInMainWorld("download", async (link, plugin) => {
const pluginsPath = join(
resolve(__dirname, "..", ".."),
"powercord",
plugin ? "plugins" : "themes"
)
try {
await exec(`git clone ${link[0]}`, {
cwd: pluginsPath,
})
return { reloadMessage: "Please reload discord with Ctrl+R" }
} catch (error) {
return { error }
}
})