fixes #234: relaunch app on plugin update
This commit is contained in:
parent
52abf5556b
commit
a0c9dbad4f
@ -144,6 +144,10 @@ function handleIPCs() {
|
|||||||
ipcMain.handle("openExternalUrl", async (_event, url) => {
|
ipcMain.handle("openExternalUrl", async (_event, url) => {
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
});
|
});
|
||||||
|
ipcMain.handle("relaunch", async (_event, url) => {
|
||||||
|
dispose(requiredModules);
|
||||||
|
app.relaunch();
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to delete a file from the user data folder
|
* Used to delete a file from the user data folder
|
||||||
|
|||||||
@ -17,6 +17,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
|||||||
|
|
||||||
openExternalUrl: (url: string) => ipcRenderer.invoke("openExternalUrl", url),
|
openExternalUrl: (url: string) => ipcRenderer.invoke("openExternalUrl", url),
|
||||||
|
|
||||||
|
relaunch: () => ipcRenderer.invoke("relaunch"),
|
||||||
|
|
||||||
deleteFile: (filePath: string) => ipcRenderer.invoke("deleteFile", filePath),
|
deleteFile: (filePath: string) => ipcRenderer.invoke("deleteFile", filePath),
|
||||||
|
|
||||||
downloadFile: (url: string, path: string) =>
|
downloadFile: (url: string, path: string) =>
|
||||||
|
|||||||
@ -81,9 +81,7 @@ export const Preferences = () => {
|
|||||||
// Send the filename of the to be installed plugin
|
// Send the filename of the to be installed plugin
|
||||||
// to the main process for installation
|
// to the main process for installation
|
||||||
const installed = await plugins.install([pluginFile]);
|
const installed = await plugins.install([pluginFile]);
|
||||||
if (typeof window !== "undefined") {
|
if (installed) window.electronAPI.relaunch();
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Uninstall a plugin on clicking uninstall
|
// Uninstall a plugin on clicking uninstall
|
||||||
@ -99,6 +97,7 @@ export const Preferences = () => {
|
|||||||
? "Plugin successfully uninstalled"
|
? "Plugin successfully uninstalled"
|
||||||
: "Plugin could not be uninstalled"
|
: "Plugin could not be uninstalled"
|
||||||
);
|
);
|
||||||
|
if (res) window.electronAPI.relaunch();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update all plugins on clicking update plugins
|
// Update all plugins on clicking update plugins
|
||||||
@ -106,6 +105,7 @@ export const Preferences = () => {
|
|||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await window.pluggableElectronIpc.update([plugin], true);
|
await window.pluggableElectronIpc.update([plugin], true);
|
||||||
|
window.electronAPI.relaunch();
|
||||||
}
|
}
|
||||||
// plugins.update(active.map((plg) => plg.name));
|
// plugins.update(active.map((plg) => plg.name));
|
||||||
};
|
};
|
||||||
@ -176,9 +176,7 @@ export const Preferences = () => {
|
|||||||
type="submit"
|
type="submit"
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"rounded-md px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",
|
"rounded-md px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",
|
||||||
fileName
|
fileName ? "bg-indigo-600 hover:bg-indigo-500" : "bg-gray-500"
|
||||||
? "bg-indigo-600 hover:bg-indigo-500"
|
|
||||||
: "bg-gray-500"
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
Install Plugin
|
Install Plugin
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user