2020-10-30 15:18:59 +08:00
|
|
|
import * as express from "express"
|
2020-11-04 10:11:14 +08:00
|
|
|
import * as fspath from "path"
|
2020-11-04 06:13:21 +08:00
|
|
|
import * as pluginapi from "../../../typings/pluginapi"
|
2020-10-30 15:18:59 +08:00
|
|
|
|
2020-11-05 12:10:41 +08:00
|
|
|
export const plugin: pluginapi.Plugin = {
|
|
|
|
displayName: "Test Plugin",
|
|
|
|
routerPath: "/test-plugin",
|
|
|
|
homepageURL: "https://example.com",
|
|
|
|
description: "Plugin used in code-server tests.",
|
2020-11-04 10:11:14 +08:00
|
|
|
|
2020-11-06 22:51:46 +08:00
|
|
|
init(config) {
|
2020-11-05 12:10:41 +08:00
|
|
|
config.logger.debug("test-plugin loaded!")
|
|
|
|
},
|
2020-10-30 15:18:59 +08:00
|
|
|
|
2020-11-06 22:51:46 +08:00
|
|
|
router() {
|
2020-11-05 12:10:41 +08:00
|
|
|
const r = express.Router()
|
2020-11-06 22:51:46 +08:00
|
|
|
r.get("/test-app", (req, res) => {
|
2020-11-06 23:09:35 +08:00
|
|
|
res.sendFile(fspath.resolve(__dirname, "../public/index.html"))
|
2020-11-06 22:51:46 +08:00
|
|
|
})
|
2020-11-05 12:10:41 +08:00
|
|
|
r.get("/goland/icon.svg", (req, res) => {
|
|
|
|
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
|
|
|
|
})
|
|
|
|
return r
|
|
|
|
},
|
2020-10-30 15:18:59 +08:00
|
|
|
|
2020-11-06 22:51:46 +08:00
|
|
|
applications() {
|
2020-11-05 12:10:41 +08:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
name: "Test App",
|
|
|
|
version: "4.0.0",
|
|
|
|
iconPath: "/icon.svg",
|
|
|
|
path: "/test-app",
|
2020-11-04 10:11:14 +08:00
|
|
|
|
2020-11-05 12:10:41 +08:00
|
|
|
description: "This app does XYZ.",
|
|
|
|
homepageURL: "https://example.com",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
2020-10-30 15:18:59 +08:00
|
|
|
}
|