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() {
|
public init() {
|
||||||
subscribeToBroadcast(lensProtocolChannel, ((_event, { rawUrl }) => {
|
subscribeToBroadcast(lensProtocolChannel, ((_event, { rawUrl }) => {
|
||||||
console.log(`receiving: ${rawUrl}`);
|
logger.info(`receiving: ${rawUrl}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.route(Url(rawUrl, true));
|
this.route(Url(rawUrl, true));
|
||||||
|
|||||||
@ -41,23 +41,27 @@ export async function bootstrap(App: AppComponent) {
|
|||||||
extensionDiscovery.init();
|
extensionDiscovery.init();
|
||||||
const lensProtocolRouter = LensProtocolRouter.getInstance<LensProtocolRouter>();
|
const lensProtocolRouter = LensProtocolRouter.getInstance<LensProtocolRouter>();
|
||||||
|
|
||||||
lensProtocolRouter.init();
|
logger.info(`[PROTOCOL ROUTER] Calling lensProtocolRouter.init()`);
|
||||||
lensProtocolRouter.onMissingExtension(async name => {
|
|
||||||
if (!extensionLoader.isInstalled(name)) {
|
|
||||||
logger.info(`[PROTOCOL ROUTER]: Extension ${name} not installed, installing..`);
|
|
||||||
|
|
||||||
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;
|
logger.info(`[PROTOCOL ROUTER]: Extension ${name} installed and enabled.`);
|
||||||
} else {
|
|
||||||
logger.info(`[PROTOCOL ROUTER]: Extension already installed, but route is missing.`);
|
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
} else {
|
||||||
});
|
logger.info(`[PROTOCOL ROUTER]: Extension already installed, but route is missing.`);
|
||||||
protocolEndpoints.registerHandlers();
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
protocolEndpoints.registerHandlers();
|
||||||
|
}
|
||||||
|
|
||||||
// preload common stores
|
// preload common stores
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user