mirror of
https://github.com/danog/code-server.git
synced 2024-11-26 20:34:56 +01:00
Expose replaceTemplates to plugins
This is mainly so they can get relative paths in their HTML, in particular code-server's static base so they can use the favicon and service worker.
This commit is contained in:
parent
36aad9bdab
commit
22d194515a
@ -5,6 +5,7 @@ import * as path from "path"
|
||||
import * as semver from "semver"
|
||||
import * as pluginapi from "../../typings/pluginapi"
|
||||
import { version } from "./constants"
|
||||
import { replaceTemplates } from "./http"
|
||||
import { proxy } from "./proxy"
|
||||
import * as util from "./util"
|
||||
import { Router as WsRouter, WebsocketRouter, wss } from "./wsRouter"
|
||||
@ -23,6 +24,7 @@ require("module")._load = function (request: string, parent: object, isMain: boo
|
||||
field,
|
||||
Level,
|
||||
proxy,
|
||||
replaceTemplates,
|
||||
WsRouter,
|
||||
wss,
|
||||
}
|
||||
|
12
typings/pluginapi.d.ts
vendored
12
typings/pluginapi.d.ts
vendored
@ -123,8 +123,20 @@ export { express }
|
||||
*/
|
||||
export { field, Level, Logger }
|
||||
|
||||
/**
|
||||
* code-server's proxy server.
|
||||
*/
|
||||
export const proxy: ProxyServer
|
||||
|
||||
/**
|
||||
* Replace variables in HTML: TO, BASE, CS_STATIC_BASE, and OPTIONS.
|
||||
*/
|
||||
export function replaceTemplates<T extends object>(
|
||||
req: express.Request,
|
||||
content: string,
|
||||
extraOpts?: Omit<T, "base" | "csStaticBase" | "logLevel">,
|
||||
): string
|
||||
|
||||
/**
|
||||
* Your plugin module must have a top level export "plugin" that implements this interface.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user