Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change protocol name for deep links #122

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/kubectl-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
cat packages/kubectl-versions/build/versions.json | yq -pj '.[-1][-1]' > .github/version.log
version=$(cat .github/version.log)
yq -pj -oj -i '.config.bundledKubectlVersion="'"$version"'"' freelens/package.json
yq -pj -oj -i '.config.bundledKubectlVersion="'"$version"'"' packages/core/package.json
echo "Bundled kubectl version $version" > .github/pr_body.log

- name: Check for changes
Expand Down
6 changes: 4 additions & 2 deletions .renovaterc.json5
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"customType": "regex",
"extractVersionTemplate": "^(?<version>.*)$",
"fileMatch": [
"^freelens/package\\.json$"
"^freelens/package\\.json$",
"^packages/core/package\\.json$"
],
"matchStrings": [
"\"k8sProxyVersion\":\\s*\"(?<currentValue>\\d+\\.\\d+\\.\\d+)\""
Expand All @@ -42,7 +43,8 @@
"customType": "regex",
"extractVersionTemplate": "^(?<version>.*)$",
"fileMatch": [
"^freelens/package\\.json$"
"^freelens/package\\.json$",
"^packages/core/package\\.json$"
],
"matchStrings": [
"\"bundledHelmVersion\":\\s*\"(?<currentValue>\\d+\\.\\d+\\.\\d+)\""
Expand Down
6 changes: 3 additions & 3 deletions freelens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "freelens",
"private": true,
"productName": "Freelens",
"description": "Freelens - FOSS IDE for Kubernetes",
"description": "Freelens - Free IDE for Kubernetes",
"homepage": "https://freelens.app",
"version": "0.1.3",
"repository": {
Expand Down Expand Up @@ -239,9 +239,9 @@
"license": "build/license.txt"
},
"protocols": {
"name": "Lens Protocol Handler",
"name": "Freelens Protocol Handler",
"schemes": [
"lens"
"freelens"
],
"role": "Viewer"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/business-features/keyboard-shortcuts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/keyboard-shortcuts",
"private": false,
"version": "0.1.3",
"description": "Keyboard shortcuts for Lens",
"description": "Keyboard shortcuts for Freeens",
"type": "commonjs",
"files": [
"dist"
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/common/protocol-handler/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ProtocolHandlerRegistration {
}

/**
* The collection of the dynamic parts of a URI which initiated a `lens://`
* The collection of the dynamic parts of a URI which initiated a `freelens://`
* protocol request
*/
export interface RouteParams {
Expand Down Expand Up @@ -42,7 +42,7 @@ export interface RouteParams {

/**
* RouteHandler represents the function signature of the handler function for
* `lens://` protocol routing.
* `freelens://` protocol routing.
*/
export interface RouteHandler {
(params: RouteParams): void;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/common/protocol-handler/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export abstract class LensProtocolRouter {

/**
* Attempts to route the given URL to all internal routes that have been registered
* @param url the parsed URL that initiated the `lens://` protocol
* @param url the parsed URL that initiated the `freelens://` protocol
* @returns true if a route has been found
*/
protected _routeToInternal(url: Url<Record<string, string | undefined>>): RouteAttempt {
Expand Down Expand Up @@ -255,7 +255,7 @@ export abstract class LensProtocolRouter {
}

/**
* Add a handler under the `lens://app` tree of routing.
* Add a handler under the `freelens://app` tree of routing.
* @param pathSchema the URI path schema to match against for this handler
* @param handler a function that will be called if a protocol path matches
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const syncGeneralCatalogEntitiesInjectable = getInjectable({

return () => {
catalogEntityRegistry.addComputedSource(
"lens:general",
"freelens:general",
reactiveGeneralCatalogEntities,
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const setupDeepLinkingInjectable = getInjectable({
const showApplicationWindow = di.inject(showApplicationWindowInjectable);
const firstInstanceCommandLineArguments = di.inject(commandLineArgumentsInjectable);

logger.info(`📟 Setting protocol client for lens://`);
logger.info(`📟 Setting protocol client for freelens://`);

if (app.setAsDefaultProtocolClient("lens")) {
logger.info("📟 Protocol client register succeeded ✅");
Expand Down Expand Up @@ -65,5 +65,5 @@ export default setupDeepLinkingInjectable;
const getDeepLinkUrl = (commandLineArguments: string[]) => (
commandLineArguments
.map(toLower)
.find(startsWith("lens://"))
.find(startsWith("freelens://"))
);
40 changes: 20 additions & 20 deletions packages/core/src/main/protocol-handler/__test__/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ describe("protocol router tests", () => {
});

it("should broadcast invalid host on non internal or non extension URLs", async () => {
await lpr.route("lens://foobar");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInvalid, "invalid host", "lens://foobar");
await lpr.route("freelens://foobar");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInvalid, "invalid host", "freelens://foobar");
});

it("should broadcast internal route when called with valid host", async () => {
lpr.addInternalHandler("/", noop);

try {
expect(await lpr.route("lens://app")).toBeUndefined();
expect(await lpr.route("freelens://app")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(broadcastMessageMock).toHaveBeenCalledWith(ProtocolHandlerInternal, "lens://app", "matched");
expect(broadcastMessageMock).toHaveBeenCalledWith(ProtocolHandlerInternal, "freelens://app", "matched");
});

it("should broadcast external route when called with valid host", async () => {
Expand Down Expand Up @@ -98,20 +98,20 @@ describe("protocol router tests", () => {
lpr.addInternalHandler("/", noop);

try {
expect(await lpr.route("lens://app")).toBeUndefined();
expect(await lpr.route("freelens://app")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(broadcastMessageMock).toHaveBeenCalledWith(ProtocolHandlerInternal, "lens://app", "matched");
expect(broadcastMessageMock).toHaveBeenCalledWith(ProtocolHandlerInternal, "freelens://app", "matched");

try {
expect(await lpr.route("lens://extension/@mirantis/minikube")).toBeUndefined();
expect(await lpr.route("freelens://extension/@mirantis/minikube")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(broadcastMessageMock).toHaveBeenCalledWith(ProtocolHandlerExtension, "lens://extension/@mirantis/minikube", "matched");
expect(broadcastMessageMock).toHaveBeenCalledWith(ProtocolHandlerExtension, "freelens://extension/@mirantis/minikube", "matched");
});

it("should call handler if matches", async () => {
Expand All @@ -120,13 +120,13 @@ describe("protocol router tests", () => {
lpr.addInternalHandler("/page", () => { called = true; });

try {
expect(await lpr.route("lens://app/page")).toBeUndefined();
expect(await lpr.route("freelens://app/page")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(called).toBe(true);
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "lens://app/page", "matched");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "freelens://app/page", "matched");
});

it("should call most exact handler", async () => {
Expand All @@ -136,13 +136,13 @@ describe("protocol router tests", () => {
lpr.addInternalHandler("/page/:id", params => { called = params.pathname.id; });

try {
expect(await lpr.route("lens://app/page/foo")).toBeUndefined();
expect(await lpr.route("freelens://app/page/foo")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(called).toBe("foo");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "lens://app/page/foo", "matched");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "freelens://app/page/foo", "matched");
});

it("should call most exact handler for an extension", async () => {
Expand Down Expand Up @@ -176,13 +176,13 @@ describe("protocol router tests", () => {
enabledExtensions.set(extId, { name: "@foobar/icecream", enabled: true });

try {
expect(await lpr.route("lens://extension/@foobar/icecream/page/foob")).toBeUndefined();
expect(await lpr.route("freelens://extension/@foobar/icecream/page/foob")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(called).toBe("foob");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerExtension, "lens://extension/@foobar/icecream/page/foob", "matched");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerExtension, "freelens://extension/@foobar/icecream/page/foob", "matched");
});

it("should work with non-org extensions", async () => {
Expand Down Expand Up @@ -241,14 +241,14 @@ describe("protocol router tests", () => {
}

try {
expect(await lpr.route("lens://extension/icecream/page")).toBeUndefined();
expect(await lpr.route("freelens://extension/icecream/page")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}


expect(called).toBe(1);
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerExtension, "lens://extension/icecream/page", "matched");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerExtension, "freelens://extension/icecream/page", "matched");
});

it("should throw if urlSchema is invalid", () => {
Expand All @@ -264,13 +264,13 @@ describe("protocol router tests", () => {
lpr.addInternalHandler("/page/bar", () => { called = 4; });

try {
expect(await lpr.route("lens://app/page/foo/bar/bat")).toBeUndefined();
expect(await lpr.route("freelens://app/page/foo/bar/bat")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(called).toBe(3);
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "lens://app/page/foo/bar/bat", "matched");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "freelens://app/page/foo/bar/bat", "matched");
});

it("should call most exact handler with 2 found handlers", async () => {
Expand All @@ -281,12 +281,12 @@ describe("protocol router tests", () => {
lpr.addInternalHandler("/page/bar", () => { called = 4; });

try {
expect(await lpr.route("lens://app/page/foo/bar/bat")).toBeUndefined();
expect(await lpr.route("freelens://app/page/foo/bar/bat")).toBeUndefined();
} catch (error) {
expect(throwIfDefined(error)).not.toThrow();
}

expect(called).toBe(1);
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "lens://app/page/foo/bar/bat", "matched");
expect(broadcastMessageMock).toBeCalledWith(ProtocolHandlerInternal, "freelens://app/page/foo/bar/bat", "matched");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class LensProtocolRouterMain extends proto.LensProtocolRouter {
try {
const url = new URLParse(rawUrl, true);

if (url.protocol.toLowerCase() !== "lens:") {
if (url.protocol.toLowerCase() !== "freelens:") {
throw new proto.RoutingError(proto.RoutingErrorType.INVALID_PROTOCOL, url);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { afterApplicationIsLoadedInjectionToken } from "@freelensapp/application
const getDeepLinkUrl = (commandLineArguments: string[]) => (
commandLineArguments
.map(arg => arg.toLowerCase())
.find(arg => arg.startsWith("lens://"))
.find(arg => arg.startsWith("freelens://"))
);

const showInitialWindowInjectable = getInjectable({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const bindProtocolAddRouteHandlers = ({
<p>
{"Unknown Action for "}
<code>
lens://app/
freelens://app/
{tail}
</code>
. Are you on the latest version?
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-api/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@freelensapp/extensions",
"productName": "Freelens extensions",
"description": "Freelens - Open Source Kubernetes IDE: extensions",
"description": "Freelens - Free IDE for Kubernetes: extensions",
"version": "0.1.3",
"copyright": "© 2024-2025 Freelens Authors",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/infrastructure/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@freelensapp/eslint-config",
"version": "0.1.3",
"description": "Lens eslint and prettier configurations",
"description": "Freelens eslint and prettier configurations",
"author": {
"name": "Freelens Authors",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion packages/infrastructure/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/jest",
"private": false,
"version": "0.1.3",
"description": "Jest configuration and scripts for Lens packages.",
"description": "Jest configuration and scripts for Freelens packages.",
"type": "commonjs",
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/infrastructure/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/typescript",
"private": false,
"version": "0.1.3",
"description": "Typescript configuration for Lens packages.",
"description": "Typescript configuration for Freelens packages.",
"type": "commonjs",
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-extension-example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@freelensapp/legacy-extension-example",
"private": false,
"description": "An example bundled Lens extensions using the v1 API",
"description": "An example bundled Freelens extensions using the v1 API",
"version": "0.1.3",
"type": "commonjs",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-global-di/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/legacy-global-di",
"private": false,
"version": "0.1.3",
"description": "Injection tokens for implementing metrics for Lens",
"description": "Injection tokens for implementing metrics for Freelens",
"type": "commonjs",
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/logger",
"private": false,
"version": "0.1.3",
"description": "Highly extendable logger in the Lens.",
"description": "Highly extendable logger in the Freelens.",
"type": "commonjs",
"files": [
"dist"
Expand Down
2 changes: 1 addition & 1 deletion packages/metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/metrics",
"private": false,
"version": "0.1.3",
"description": "Injection tokens for implementing metrics for Lens",
"description": "Injection tokens for implementing metrics for Freelens",
"type": "commonjs",
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/node-fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@freelensapp/node-fetch",
"version": "0.1.3",
"description": "Node fetch for Lens",
"description": "Node fetch for Freelens",
"license": "MIT",
"private": false,
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/random-id/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/random",
"private": false,
"version": "0.1.3",
"description": "Highly extendable random in the Lens.",
"description": "Highly extendable random in the Freelens.",
"type": "commonjs",
"files": [
"dist"
Expand Down
2 changes: 1 addition & 1 deletion packages/routing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/routing",
"private": false,
"version": "0.1.3",
"description": "Highly extendable routing in the Lens.",
"description": "Highly extendable routing in the Freelens.",
"type": "commonjs",
"files": [
"dist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@freelensapp/application",
"private": false,
"version": "0.1.3",
"description": "Package for creating Lens applications",
"description": "Package for creating Freelens applications",
"type": "commonjs",
"files": [
"dist"
Expand Down
Loading