2024-06-20 15:35:28 +02:00
|
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
2023-04-24 19:42:49 +00:00
|
|
|
|
|
|
|
|
// dev uses http://localhost, prod uses file://...index.html
|
2023-12-16 16:49:26 +00:00
|
|
|
const isDev = window.location.protocol === 'http:';
|
2023-04-24 19:42:49 +00:00
|
|
|
|
|
|
|
|
const defaultPlebbitOptions = {
|
2023-12-16 16:49:26 +00:00
|
|
|
plebbitRpcClientsOptions: ['ws://localhost:9138'],
|
|
|
|
|
};
|
2023-04-24 19:42:49 +00:00
|
|
|
|
2023-12-16 16:49:26 +00:00
|
|
|
contextBridge.exposeInMainWorld('defaultPlebbitOptions', defaultPlebbitOptions);
|
2024-06-20 15:35:28 +02:00
|
|
|
contextBridge.exposeInMainWorld('defaultMediaIpfsGatewayUrl', 'http://localhost:6473');
|
2023-04-24 19:42:49 +00:00
|
|
|
|
2024-06-20 15:35:28 +02:00
|
|
|
// receive plebbit rpc auth key from main
|
|
|
|
|
ipcRenderer.on('plebbit-rpc-auth-key', (event, plebbitRpcAuthKey) => contextBridge.exposeInMainWorld('plebbitRpcAuthKey', plebbitRpcAuthKey));
|
|
|
|
|
ipcRenderer.send('get-plebbit-rpc-auth-key');
|
2023-12-11 00:49:36 +00:00
|
|
|
|
|
|
|
|
// uncomment for logs
|
|
|
|
|
// localStorage.debug = 'plebbit-js:*,plebbit-react-hooks:*,plebchan:*'
|