mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
pass correct 'id' when registering from extensions
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
9202db5c20
commit
d66e600e7a
@ -53,13 +53,13 @@ export class LensExtension {
|
||||
onProtocolRequest(pathSchema: string, handler: RouteHandler): void {
|
||||
const lpr = LensProtocolRouter.getInstance<LensProtocolRouter>();
|
||||
|
||||
lpr.extensionOn(this.id, pathSchema, handler);
|
||||
lpr.extensionOn(this.name, pathSchema, handler);
|
||||
}
|
||||
|
||||
removeProtocolHandlers(): void {
|
||||
const lpr = LensProtocolRouter.getInstance<LensProtocolRouter>();
|
||||
|
||||
lpr.removeExtensionHandlers(this.id);
|
||||
lpr.removeExtensionHandlers(this.name);
|
||||
}
|
||||
|
||||
get description() {
|
||||
|
||||
@ -161,6 +161,7 @@ export class LensProtocolRouter extends Singleton {
|
||||
const [match, handler] = route;
|
||||
|
||||
delete match.params[EXTENSION_NAME_MATCH];
|
||||
delete match.params[EXTENSION_PUBLISHER_MATCH];
|
||||
handler({
|
||||
pathname: match.params,
|
||||
search: url.query,
|
||||
@ -169,10 +170,12 @@ export class LensProtocolRouter extends Singleton {
|
||||
|
||||
public on(urlSchema: string, handler: RouteHandler): void {
|
||||
pathToRegexp(urlSchema); // verify now that the schema is valid
|
||||
logger.info(`${LensProtocolRouter.LoggingPrefix}: internal registering ${urlSchema}`);
|
||||
this.internalRoutes.set(urlSchema, handler);
|
||||
}
|
||||
|
||||
public extensionOn(id: ExtensionId, urlSchema: string, handler: RouteHandler): void {
|
||||
logger.info(`${LensProtocolRouter.LoggingPrefix}: extension ${id} registering ${urlSchema}`);
|
||||
pathToRegexp(urlSchema); // verify now that the schema is valid
|
||||
|
||||
if (!this.extentionRoutes.has(id)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user