e61b29ec6a
* fix: compare plugin versions semantically in market updates * fix: prioritize plugin site-packages for in-process pip * fix: reload starlette from plugin target site-packages * fix: harden plugin dependency import precedence in frozen runtime * fix: improve plugin dependency conflict handling * refactor: simplify plugin conflict checks and version utils * fix: expand transitive plugin dependencies for conflict checks * fix: recover conflicting plugin dependencies during module prefer * fix: reuse renderer restart flow for tray backend restart * fix: add recoverable plugin dependency conflict handling * revert: remove plugin version comparison changes * fix: add missing tray restart backend labels
23 lines
820 B
JavaScript
23 lines
820 B
JavaScript
'use strict';
|
|
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
contextBridge.exposeInMainWorld('astrbotDesktop', {
|
|
isElectron: true,
|
|
isElectronRuntime: () => ipcRenderer.invoke('astrbot-desktop:is-electron-runtime'),
|
|
getBackendState: () => ipcRenderer.invoke('astrbot-desktop:get-backend-state'),
|
|
restartBackend: (authToken) =>
|
|
ipcRenderer.invoke('astrbot-desktop:restart-backend', authToken),
|
|
stopBackend: () => ipcRenderer.invoke('astrbot-desktop:stop-backend'),
|
|
onTrayRestartBackend: (callback) => {
|
|
const listener = () => {
|
|
if (typeof callback === 'function') {
|
|
callback();
|
|
}
|
|
};
|
|
ipcRenderer.on('astrbot-desktop:tray-restart-backend', listener);
|
|
return () =>
|
|
ipcRenderer.removeListener('astrbot-desktop:tray-restart-backend', listener);
|
|
},
|
|
});
|