-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
29 lines (28 loc) · 1.65 KB
/
Copy pathpreload.js
File metadata and controls
29 lines (28 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("electronAPI", {
getHistory: () => ipcRenderer.invoke("get-history"),
addHistory: (entry) => ipcRenderer.invoke("add-history", entry),
clearHistory: () => ipcRenderer.invoke("clear-history"),
getBudget: () => ipcRenderer.invoke("get-budget"),
setBudget: (budget) => ipcRenderer.invoke("set-budget", budget),
getSettings: () => ipcRenderer.invoke("get-settings"),
setSetting: (key, value) => ipcRenderer.invoke("set-setting", key, value),
getLicenseStatus: () => ipcRenderer.invoke("get-license-status"),
activateLicense: (licenseKey) => ipcRenderer.invoke("activate-license", licenseKey),
deactivateLicense: () => ipcRenderer.invoke("deactivate-license"),
openPurchasePage: () => ipcRenderer.invoke("open-purchase-page"),
clearSettings: () => ipcRenderer.invoke("clear-settings"),
clearAllData: () => ipcRenderer.invoke("clear-all-data"),
getAllData: () => ipcRenderer.invoke("get-all-data"),
importHistory: (entries) => ipcRenderer.invoke("import-history", entries),
scanLocalUsage: (source) => ipcRenderer.invoke("scan-local-usage", source),
getProxyStatus: () => ipcRenderer.invoke("get-proxy-status"),
startProxy: (config) => ipcRenderer.invoke("start-proxy", config),
stopProxy: () => ipcRenderer.invoke("stop-proxy"),
listOllamaModels: () => ipcRenderer.invoke("list-ollama-models"),
sendLocalChat: (payload) => ipcRenderer.invoke("send-local-chat", payload),
fetchOpenAIUsage: (apiKey) => ipcRenderer.invoke("fetch-openai-usage", apiKey),
onClipboardText: (callback) => {
ipcRenderer.on("clipboard-text", (_, text) => callback(text));
},
});