added desktop and rust version

This commit is contained in:
2025-09-25 15:32:49 +06:00
parent 10af1a9a63
commit 2c2725cd19
29 changed files with 12835 additions and 1589 deletions

View 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'
});