From 2a13d003d37d97f8650bd15f29baa45cd4fb1d5a Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 3 Nov 2020 21:45:25 -0500 Subject: [PATCH] plugin.ts: Add homepageURL to plugin and application --- src/node/plugin.ts | 4 ++++ test/plugin.test.ts | 2 ++ test/test-plugin/src/index.ts | 2 ++ typings/pluginapi.d.ts | 10 ++++++++++ 4 files changed, 18 insertions(+) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index 9523782bc..368d6f7ff 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -72,6 +72,7 @@ export class PluginAPI { displayName: p.displayName, description: p.description, routerPath: p.routerPath, + homepageURL: p.homepageURL, }, } }), @@ -197,6 +198,9 @@ export class PluginAPI { if (!p.routerPath) { throw new Error("plugin missing router path") } + if (!p.homepageURL) { + throw new Error("plugin missing homepage") + } p.init({ logger: logger, diff --git a/test/plugin.test.ts b/test/plugin.test.ts index bc13fc803..ed040dc21 100644 --- a/test/plugin.test.ts +++ b/test/plugin.test.ts @@ -22,6 +22,7 @@ describe("plugin", () => { description: "This app does XYZ.", iconPath: "/test-plugin/test-app/icon.svg", + homepageURL: "https://example.com", path: "/test-plugin/test-app", plugin: { @@ -32,6 +33,7 @@ describe("plugin", () => { displayName: "Test Plugin", description: "Plugin used in code-server tests.", routerPath: "/test-plugin", + homepageURL: "https://example.com", }, }, ], diff --git a/test/test-plugin/src/index.ts b/test/test-plugin/src/index.ts index 161203319..2fc1ddab0 100644 --- a/test/test-plugin/src/index.ts +++ b/test/test-plugin/src/index.ts @@ -4,6 +4,7 @@ import * as pluginapi from "../../../typings/pluginapi" export const displayName = "Test Plugin" export const routerPath = "/test-plugin" +export const homepageURL = "https://example.com" export const description = "Plugin used in code-server tests." export function init(config: pluginapi.PluginConfig) { @@ -27,6 +28,7 @@ export function applications(): pluginapi.Application[] { path: "/test-app", description: "This app does XYZ.", + homepageURL: "https://example.com", }, ] } diff --git a/typings/pluginapi.d.ts b/typings/pluginapi.d.ts index dbb985a58..3ce5e5d0c 100644 --- a/typings/pluginapi.d.ts +++ b/typings/pluginapi.d.ts @@ -87,6 +87,11 @@ export interface Plugin { */ readonly routerPath: string + /** + * Link to plugin homepage. + */ + readonly homepageURL: string + /** * init is called so that the plugin may initialize itself with the config. */ @@ -144,4 +149,9 @@ export interface Application { * /// */ readonly iconPath: string + + /** + * Link to application homepage. + */ + readonly homepageURL: string }