This commit is contained in:
parent
24975c2e0d
commit
3acd082fb0
28 changed files with 3454 additions and 836 deletions
|
|
@ -6,12 +6,9 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<title>Chattz</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="../static/styles.css" />
|
||||
<!-- Lucide Icons -->
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
<script src="../static/vendor/lucide.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
function onIpc(channel, callback) {
|
||||
const listener = (_event, payload) => callback(payload);
|
||||
ipcRenderer.on(channel, listener);
|
||||
return () => ipcRenderer.removeListener(channel, listener);
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
copyToClipboard: (text) => ipcRenderer.invoke('clipboard-write', text),
|
||||
getConfig: () => ipcRenderer.invoke('get-config'),
|
||||
storageGet: (key) => ipcRenderer.invoke('storage-get', key),
|
||||
storageSet: (key, value) => ipcRenderer.invoke('storage-set', key, value),
|
||||
storageRemove: (key) => ipcRenderer.invoke('storage-remove', key),
|
||||
getUpdateState: () => ipcRenderer.invoke('get-update-state'),
|
||||
checkForUpdatesNow: () => ipcRenderer.invoke('check-for-updates-now'),
|
||||
checkForUpdates: () => ipcRenderer.send('check-for-updates'),
|
||||
downloadUpdate: () => ipcRenderer.send('download-update'),
|
||||
quitAndInstall: () => ipcRenderer.send('quit-and-install'),
|
||||
onUpdateState: (callback) => ipcRenderer.on('update-state', (event, state) => callback(state)),
|
||||
onUpdateAvailable: (callback) => ipcRenderer.on('update-available', (event, info) => callback(info)),
|
||||
onUpdateDownloaded: (callback) => ipcRenderer.on('update-downloaded', (event, info) => callback(info)),
|
||||
onUpdateError: (callback) => ipcRenderer.on('update-error', (event, error) => callback(error))
|
||||
onUpdateState: (callback) => onIpc('update-state', callback),
|
||||
onUpdateAvailable: (callback) => onIpc('update-available', callback),
|
||||
onUpdateDownloaded: (callback) => onIpc('update-downloaded', callback),
|
||||
onUpdateError: (callback) => onIpc('update-error', callback)
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue