added desktop and rust version
This commit is contained in:
23
desktop/src/preload/preload.js
Normal file
23
desktop/src/preload/preload.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('api', {
|
||||
openFile: async () => ipcRenderer.invoke('file:open'),
|
||||
saveAs: async (payload) => ipcRenderer.invoke('file:saveAs', payload),
|
||||
saveToPath: async (payload) => ipcRenderer.invoke('file:saveToPath', payload),
|
||||
revealInFolder: async (filePath) => ipcRenderer.invoke('os:revealInFolder', filePath),
|
||||
getConfig: async (key) => ipcRenderer.invoke('config:get', key),
|
||||
setConfig: async (key, value) => ipcRenderer.invoke('config:set', key, value),
|
||||
getAllConfig: async () => ipcRenderer.invoke('config:getAll'),
|
||||
setAllConfig: async (config) => ipcRenderer.invoke('config:setAll', config),
|
||||
closeSettings: async () => ipcRenderer.invoke('settings:close'),
|
||||
localKnock: async (payload) => ipcRenderer.invoke('knock:local', payload),
|
||||
getNetworkInterfaces: async () => ipcRenderer.invoke('network:interfaces'),
|
||||
testConnection: async (payload) => ipcRenderer.invoke('network:test-connection', payload)
|
||||
});
|
||||
|
||||
// Пробрасываем конфигурацию в рендерер (безопасно)
|
||||
contextBridge.exposeInMainWorld('config', {
|
||||
apiBase: process.env.KNOCKER_DESKTOP_API_BASE || 'http://localhost:8080/api/v1'
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user