1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

add grpc devtools extension

This commit is contained in:
Roman Khafizianov 2025-06-05 18:10:52 +02:00
parent caf4653079
commit 9f2f54fd74
No known key found for this signature in database
GPG key ID: F07A7D55A2684852
7 changed files with 166 additions and 7 deletions

View file

@ -13,6 +13,10 @@ const Store = require('electron-store');
const suffix = app.isPackaged ? '' : 'dev';
const store = new Store({ name: [ 'localStorage', suffix ].join('-') });
// gRPC DevTools extension ID
const GRPC_DEVTOOLS_ID = 'fohdnlaeecihjiendkfhifhlgldpeopm';
const { installExtension } = require('@tomjs/electron-devtools-installer');
// Fix notifications app name
if (is.windows) {
app.setAppUserModelId(app.name);
@ -182,7 +186,7 @@ function createWindow () {
});
};
app.on('ready', () => {
app.on('ready', async () => {
session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
callback({
responseHeaders: {
@ -192,6 +196,21 @@ app.on('ready', () => {
});
});
// Load gRPC DevTools extension in development mode
if (is.development) {
try {
// Install the extension using electron-devtools-installer
const extension = await installExtension(GRPC_DEVTOOLS_ID, {
loadExtensionOptions: {
allowFileAccess: true
}
});
console.log(`✅ gRPC DevTools extension installed`);
} catch (err) {
console.error('❌ Failed to install gRPC DevTools extension:', err.message);
}
}
ConfigManager.init(waitForLibraryAndCreateWindows);
});
@ -242,4 +261,4 @@ app.on('open-url', (e, url) => {
Util.send(mainWindow, 'route', Util.getRouteFromUrl(url));
mainWindow.show();
};
});
});