mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix double handler bug.
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
parent
71793b0797
commit
b7e4aa38cb
@ -68,7 +68,7 @@ export class LensProtocolRouter extends Singleton {
|
||||
|
||||
public init() {
|
||||
subscribeToBroadcast(lensProtocolChannel, ((_event, { rawUrl }) => {
|
||||
console.log(`receiving: ${rawUrl}`);
|
||||
logger.info(`receiving: ${rawUrl}`);
|
||||
|
||||
try {
|
||||
this.route(Url(rawUrl, true));
|
||||
|
||||
@ -41,23 +41,27 @@ export async function bootstrap(App: AppComponent) {
|
||||
extensionDiscovery.init();
|
||||
const lensProtocolRouter = LensProtocolRouter.getInstance<LensProtocolRouter>();
|
||||
|
||||
lensProtocolRouter.init();
|
||||
lensProtocolRouter.onMissingExtension(async name => {
|
||||
if (!extensionLoader.isInstalled(name)) {
|
||||
logger.info(`[PROTOCOL ROUTER]: Extension ${name} not installed, installing..`);
|
||||
logger.info(`[PROTOCOL ROUTER] Calling lensProtocolRouter.init()`);
|
||||
|
||||
await Promise.all([installFromNpm(name), extensionLoader.waitForEnabled(name)]);
|
||||
if (process.isMainFrame) {
|
||||
lensProtocolRouter.init();
|
||||
lensProtocolRouter.onMissingExtension(async name => {
|
||||
if (!extensionLoader.isInstalled(name)) {
|
||||
logger.info(`[PROTOCOL ROUTER]: Extension ${name} not installed, installing..`);
|
||||
|
||||
logger.info(`[PROTOCOL ROUTER]: Extension ${name} installed and enabled.`);
|
||||
await Promise.all([installFromNpm(name), extensionLoader.waitForEnabled(name)]);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
logger.info(`[PROTOCOL ROUTER]: Extension already installed, but route is missing.`);
|
||||
logger.info(`[PROTOCOL ROUTER]: Extension ${name} installed and enabled.`);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
protocolEndpoints.registerHandlers();
|
||||
return true;
|
||||
} else {
|
||||
logger.info(`[PROTOCOL ROUTER]: Extension already installed, but route is missing.`);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
protocolEndpoints.registerHandlers();
|
||||
}
|
||||
|
||||
// preload common stores
|
||||
await Promise.all([
|
||||
|
||||
Loading…
Reference in New Issue
Block a user