forked from curiouscoder-cmd/ENV_Storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
37 lines (33 loc) · 1.4 KB
/
preload.js
File metadata and controls
37 lines (33 loc) · 1.4 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
30
31
32
33
34
35
36
37
import { contextBridge, ipcRenderer } from 'electron';
// Expose protected methods that allow the renderer process to use
// the ipcRenderer without exposing the entire object
contextBridge.exposeInMainWorld('electronAPI', {
// Auth
auth: {
checkSetup: () => ipcRenderer.invoke('auth:check-setup'),
setup: (password) => ipcRenderer.invoke('auth:setup', password),
login: (password) => ipcRenderer.invoke('auth:login', password),
logout: () => ipcRenderer.invoke('auth:logout'),
isAuthenticated: () => ipcRenderer.invoke('auth:is-authenticated'),
},
// Projects
projects: {
list: () => ipcRenderer.invoke('projects:list'),
create: (data) => ipcRenderer.invoke('projects:create', data),
update: (data) => ipcRenderer.invoke('projects:update', data),
delete: (id) => ipcRenderer.invoke('projects:delete', id),
},
// Environment Variables
envVars: {
list: (projectId) => ipcRenderer.invoke('envvars:list', projectId),
create: (data) => ipcRenderer.invoke('envvars:create', data),
update: (data) => ipcRenderer.invoke('envvars:update', data),
delete: (id) => ipcRenderer.invoke('envvars:delete', id),
export: (data) => ipcRenderer.invoke('envvars:export', data),
copyToProject: (data) => ipcRenderer.invoke('envvars:copy-to-project', data),
},
// Audit Logs
audit: {
list: (options) => ipcRenderer.invoke('audit:list', options),
},
});