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