mirror of https://github.com/coder/code-server.git
plugin.ts: Add homepageURL to plugin and application
This commit is contained in:
parent
687094802e
commit
2a13d003d3
|
@ -72,6 +72,7 @@ export class PluginAPI {
|
||||||
displayName: p.displayName,
|
displayName: p.displayName,
|
||||||
description: p.description,
|
description: p.description,
|
||||||
routerPath: p.routerPath,
|
routerPath: p.routerPath,
|
||||||
|
homepageURL: p.homepageURL,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -197,6 +198,9 @@ export class PluginAPI {
|
||||||
if (!p.routerPath) {
|
if (!p.routerPath) {
|
||||||
throw new Error("plugin missing router path")
|
throw new Error("plugin missing router path")
|
||||||
}
|
}
|
||||||
|
if (!p.homepageURL) {
|
||||||
|
throw new Error("plugin missing homepage")
|
||||||
|
}
|
||||||
|
|
||||||
p.init({
|
p.init({
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
|
|
@ -22,6 +22,7 @@ describe("plugin", () => {
|
||||||
|
|
||||||
description: "This app does XYZ.",
|
description: "This app does XYZ.",
|
||||||
iconPath: "/test-plugin/test-app/icon.svg",
|
iconPath: "/test-plugin/test-app/icon.svg",
|
||||||
|
homepageURL: "https://example.com",
|
||||||
path: "/test-plugin/test-app",
|
path: "/test-plugin/test-app",
|
||||||
|
|
||||||
plugin: {
|
plugin: {
|
||||||
|
@ -32,6 +33,7 @@ describe("plugin", () => {
|
||||||
displayName: "Test Plugin",
|
displayName: "Test Plugin",
|
||||||
description: "Plugin used in code-server tests.",
|
description: "Plugin used in code-server tests.",
|
||||||
routerPath: "/test-plugin",
|
routerPath: "/test-plugin",
|
||||||
|
homepageURL: "https://example.com",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -4,6 +4,7 @@ import * as pluginapi from "../../../typings/pluginapi"
|
||||||
|
|
||||||
export const displayName = "Test Plugin"
|
export const displayName = "Test Plugin"
|
||||||
export const routerPath = "/test-plugin"
|
export const routerPath = "/test-plugin"
|
||||||
|
export const homepageURL = "https://example.com"
|
||||||
export const description = "Plugin used in code-server tests."
|
export const description = "Plugin used in code-server tests."
|
||||||
|
|
||||||
export function init(config: pluginapi.PluginConfig) {
|
export function init(config: pluginapi.PluginConfig) {
|
||||||
|
@ -27,6 +28,7 @@ export function applications(): pluginapi.Application[] {
|
||||||
path: "/test-app",
|
path: "/test-app",
|
||||||
|
|
||||||
description: "This app does XYZ.",
|
description: "This app does XYZ.",
|
||||||
|
homepageURL: "https://example.com",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,11 @@ export interface Plugin {
|
||||||
*/
|
*/
|
||||||
readonly routerPath: string
|
readonly routerPath: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link to plugin homepage.
|
||||||
|
*/
|
||||||
|
readonly homepageURL: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init is called so that the plugin may initialize itself with the config.
|
* init is called so that the plugin may initialize itself with the config.
|
||||||
*/
|
*/
|
||||||
|
@ -144,4 +149,9 @@ export interface Application {
|
||||||
* <code-server-root>/<plugin-path>/<app-path>/<icon-path>
|
* <code-server-root>/<plugin-path>/<app-path>/<icon-path>
|
||||||
*/
|
*/
|
||||||
readonly iconPath: string
|
readonly iconPath: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link to application homepage.
|
||||||
|
*/
|
||||||
|
readonly homepageURL: string
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue