mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-05-06 19:47:47 -05:00
Add desktopQuickEntryShortcut to frontend settings with a Desktop App section in General settings, only visible when running in the Electron app. The setting syncs to the desktop main process via IPC whenever settings are loaded or saved.
17 lines
731 B
JavaScript
17 lines
731 B
JavaScript
const {contextBridge, ipcRenderer} = require('electron')
|
|
|
|
contextBridge.exposeInMainWorld('vikunjaDesktop', {
|
|
startOAuthLogin: (apiUrl) => ipcRenderer.invoke('oauth:start-login', apiUrl),
|
|
onOAuthTokens: (callback) => {
|
|
ipcRenderer.removeAllListeners('oauth:tokens')
|
|
ipcRenderer.on('oauth:tokens', (_event, tokens) => callback(tokens))
|
|
},
|
|
onOAuthError: (callback) => {
|
|
ipcRenderer.removeAllListeners('oauth:error')
|
|
ipcRenderer.on('oauth:error', (_event, error) => callback(error))
|
|
},
|
|
refreshToken: (apiUrl, refreshToken) => ipcRenderer.invoke('oauth:refresh-token', apiUrl, refreshToken),
|
|
updateQuickEntryShortcut: (shortcut) => ipcRenderer.send('desktop:update-quick-entry-shortcut', shortcut),
|
|
isDesktop: true,
|
|
})
|