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