From 210fc049c40865a09f0ec747cd9d51b12208dd3c Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 3 Nov 2020 16:30:45 -0600 Subject: [PATCH] Document VS Code endpoints --- src/node/routes/static.ts | 3 +++ src/node/routes/vscode.ts | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/node/routes/static.ts b/src/node/routes/static.ts index 0678c231..e073219e 100644 --- a/src/node/routes/static.ts +++ b/src/node/routes/static.ts @@ -32,6 +32,9 @@ router.get("/(:commit)(/*)?", async (req, res) => { res.header("Cache-Control", "public, max-age=31536000") } + /** + * Used by VS Code to load extensions into the web worker. + */ const tar = Array.isArray(req.query.tar) ? req.query.tar[0] : req.query.tar if (typeof tar === "string") { let stream: Readable = tarFs.pack(pathToFsPath(tar)) diff --git a/src/node/routes/vscode.ts b/src/node/routes/vscode.ts index cec3a832..e7842a29 100644 --- a/src/node/routes/vscode.ts +++ b/src/node/routes/vscode.ts @@ -71,6 +71,9 @@ router.ws("/", async (socket, _, req) => { await vscode.sendWebsocket(socket, req.query) }) +/** + * TODO: Might currently be unused. + */ router.get("/resource(/*)?", async (req, res) => { ensureAuthenticated(req) if (typeof req.query.path === "string") { @@ -79,6 +82,9 @@ router.get("/resource(/*)?", async (req, res) => { } }) +/** + * Used by VS Code to load files. + */ router.get("/vscode-remote-resource(/*)?", async (req, res) => { ensureAuthenticated(req) if (typeof req.query.path === "string") { @@ -87,6 +93,10 @@ router.get("/vscode-remote-resource(/*)?", async (req, res) => { } }) +/** + * VS Code webviews use these paths to load files and to load webview assets + * like HTML and JavaScript. + */ router.get("/webview/*", async (req, res) => { ensureAuthenticated(req) res.set("Content-Type", getMediaMime(req.path))