chore: add reinstall plugins CTA
This commit is contained in:
parent
91d49d1fe6
commit
b8b7c416c7
@ -147,6 +147,18 @@ function handleIPCs() {
|
||||
ipcMain.handle("relaunch", async (_event, url) => {
|
||||
dispose(requiredModules);
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
|
||||
ipcMain.handle("reloadPlugins", async (_event, url) => {
|
||||
const userDataPath = app.getPath("userData");
|
||||
const fullPath = join(userDataPath, "plugins");
|
||||
|
||||
rmdir(fullPath, { recursive: true }, function (err) {
|
||||
if (err) console.log(err);
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -13,6 +13,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
||||
|
||||
pluginPath: () => ipcRenderer.invoke("pluginPath"),
|
||||
|
||||
reloadPlugins: () => ipcRenderer.invoke("reloadPlugins"),
|
||||
|
||||
appVersion: () => ipcRenderer.invoke("appVersion"),
|
||||
|
||||
openExternalUrl: (url: string) => ipcRenderer.invoke("openExternalUrl", url),
|
||||
|
||||
@ -172,15 +172,30 @@ export const Preferences = () => {
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
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",
|
||||
fileName ? "bg-indigo-600 hover:bg-indigo-500" : "bg-gray-500"
|
||||
)}
|
||||
>
|
||||
Install Plugin
|
||||
</button>
|
||||
<div className="flex flex-col space-y-2">
|
||||
<button
|
||||
type="submit"
|
||||
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",
|
||||
fileName
|
||||
? "bg-blue-500 hover:bg-blue-300"
|
||||
: "bg-gray-500"
|
||||
)}
|
||||
>
|
||||
Install Plugin
|
||||
</button>
|
||||
|
||||
<button
|
||||
className={classNames(
|
||||
"bg-blue-500 hover:bg-blue-300 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"
|
||||
)}
|
||||
onClick={() => {
|
||||
window.electronAPI.reloadPlugins();
|
||||
}}
|
||||
>
|
||||
Reload Plugins
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user