Skip to content

Commit 2a13d00

Browse files
committed
plugin.ts: Add homepageURL to plugin and application
1 parent 6870948 commit 2a13d00

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

‎src/node/plugin.ts

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class PluginAPI {
7272
displayName: p.displayName,
7373
description: p.description,
7474
routerPath: p.routerPath,
75+
homepageURL: p.homepageURL,
7576
},
7677
}
7778
}),
@@ -197,6 +198,9 @@ export class PluginAPI {
197198
if (!p.routerPath) {
198199
throw new Error("plugin missing router path")
199200
}
201+
if (!p.homepageURL) {
202+
throw new Error("plugin missing homepage")
203+
}
200204

201205
p.init({
202206
logger: logger,

‎test/plugin.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe("plugin", () => {
2222

2323
description: "This app does XYZ.",
2424
iconPath: "/test-plugin/test-app/icon.svg",
25+
homepageURL: "https://example.com",
2526
path: "/test-plugin/test-app",
2627

2728
plugin: {
@@ -32,6 +33,7 @@ describe("plugin", () => {
3233
displayName: "Test Plugin",
3334
description: "Plugin used in code-server tests.",
3435
routerPath: "/test-plugin",
36+
homepageURL: "https://example.com",
3537
},
3638
},
3739
],

‎test/test-plugin/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as pluginapi from "../../../typings/pluginapi"
44

55
export const displayName = "Test Plugin"
66
export const routerPath = "/test-plugin"
7+
export const homepageURL = "https://example.com"
78
export const description = "Plugin used in code-server tests."
89

910
export function init(config: pluginapi.PluginConfig) {
@@ -27,6 +28,7 @@ export function applications(): pluginapi.Application[] {
2728
path: "/test-app",
2829

2930
description: "This app does XYZ.",
31+
homepageURL: "https://example.com",
3032
},
3133
]
3234
}

‎typings/pluginapi.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ export interface Plugin {
8787
*/
8888
readonly routerPath: string
8989

90+
/**
91+
* Link to plugin homepage.
92+
*/
93+
readonly homepageURL: string
94+
9095
/**
9196
* init is called so that the plugin may initialize itself with the config.
9297
*/
@@ -144,4 +149,9 @@ export interface Application {
144149
* <code-server-root>/<plugin-path>/<app-path>/<icon-path>
145150
*/
146151
readonly iconPath: string
152+
153+
/**
154+
* Link to application homepage.
155+
*/
156+
readonly homepageURL: string
147157
}

0 commit comments

Comments
 (0)