Fix error
This commit is contained in:
parent
5ddddcfe3e
commit
4811d6d77a
2 changed files with 16 additions and 6 deletions
14
preload.js
14
preload.js
|
@ -1,6 +1,7 @@
|
|||
const { contextBridge } = require("electron")
|
||||
const { resolve, join } = require("path")
|
||||
const { promises, constants } = require("fs")
|
||||
const { access } = promises
|
||||
|
||||
const exec = require("util").promisify(require("child_process").exec)
|
||||
|
||||
|
@ -16,18 +17,27 @@ contextBridge.exposeInMainWorld("installPackage", async (link) => {
|
|||
cwd: packagesPath,
|
||||
})
|
||||
|
||||
try {
|
||||
await access(join(packagePath, "package.json"), constants.F_OK)
|
||||
try {
|
||||
await exec(`pnpm i --production`, {
|
||||
cwd: packagePath,
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
await promises.access(join(packagePath, "main.js"), constants.F_OK)
|
||||
await access(join(packagePath, "main.js"), constants.F_OK)
|
||||
return {
|
||||
reloadMessage:
|
||||
"Main.js file detected: Please quit Discord from the system tray",
|
||||
}
|
||||
} catch (error) {
|
||||
return { reloadMessage: "Please reload discord with Ctrl+R" }
|
||||
return {
|
||||
reloadMessage: "Please reload discord with Ctrl+R",
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
return { error }
|
||||
|
|
|
@ -120,7 +120,7 @@ export default new (class PackageDownloader {
|
|||
if (
|
||||
props?.message &&
|
||||
props.channel &&
|
||||
props.channel.id == "899717501120806963"
|
||||
props.channel?.id == "899717501120806963"
|
||||
)
|
||||
args[0].children.unshift(React.createElement(Button))
|
||||
|
||||
|
|
Reference in a new issue