26 lines
796 B
TypeScript
26 lines
796 B
TypeScript
|
|
/**
|
|||
|
|
* HoloLake Desktop · Preload 脚本
|
|||
|
|
*
|
|||
|
|
* 在渲染进程和主进程之间建立安全桥梁。
|
|||
|
|
* 渲染进程不能直接访问 Node.js API,只能通过这个桥梁通信。
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
import { contextBridge, ipcRenderer } from 'electron';
|
|||
|
|
|
|||
|
|
// 暴露给渲染进程的安全 API
|
|||
|
|
contextBridge.exposeInMainWorld('hololake', {
|
|||
|
|
// 应用信息
|
|||
|
|
platform: process.platform,
|
|||
|
|
version: '0.5.0',
|
|||
|
|
|
|||
|
|
// 数据目录
|
|||
|
|
getDataPath: () => ipcRenderer.invoke('get-data-path'),
|
|||
|
|
|
|||
|
|
// Forgejo 远程仓库管理(预留接口)
|
|||
|
|
forgejo: {
|
|||
|
|
getRemotes: () => ipcRenderer.invoke('forgejo:get-remotes'),
|
|||
|
|
addRemote: (url: string) => ipcRenderer.invoke('forgejo:add-remote', url),
|
|||
|
|
push: () => ipcRenderer.invoke('forgejo:push'),
|
|||
|
|
pull: () => ipcRenderer.invoke('forgejo:pull'),
|
|||
|
|
},
|
|||
|
|
});
|