Skip to content

Commit dfa9843

Browse files
committed
Move manifest override into code-server
This way we will not have to patch it.
1 parent d957619 commit dfa9843

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/node/routes/vscode.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { WebsocketRequest } from "../../../typings/pluginapi"
77
import { logError } from "../../common/util"
88
import { CodeArgs, toCodeArgs } from "../cli"
99
import { isDevMode } from "../constants"
10-
import { authenticated, ensureAuthenticated, redirect, self } from "../http"
10+
import { authenticated, ensureAuthenticated, redirect, replaceTemplates, self } from "../http"
1111
import { SocketProxyProvider } from "../socket"
1212
import { isFile, loadAMDModule } from "../util"
1313
import { Router as WsRouter } from "../wsRouter"
@@ -34,6 +34,23 @@ export class CodeServerRouteWrapper {
3434

3535
//#region Route Handlers
3636

37+
private manifest: express.Handler = async (req, res, next) => {
38+
res.writeHead(200, { 'Content-Type': 'application/manifest+json' })
39+
40+
return res.end(replaceTemplates(req, JSON.stringify({
41+
name: "code-server",
42+
short_name: "code-server",
43+
start_url: ".",
44+
display: "fullscreen",
45+
description: "Run Code on a remote server.",
46+
icons: [192,512].map((size => ({
47+
src: `{{BASE}}/_static/src/browser/media/pwa-icon-${size}.png`,
48+
type: "image/png",
49+
sizes: `${size}x${size}`,
50+
}))),
51+
}, null, 2)))
52+
}
53+
3754
private $root: express.Handler = async (req, res, next) => {
3855
const isAuthenticated = await authenticated(req)
3956
const NO_FOLDER_OR_WORKSPACE_QUERY = !req.query.folder && !req.query.workspace
@@ -141,6 +158,7 @@ export class CodeServerRouteWrapper {
141158

142159
constructor() {
143160
this.router.get("/", this.ensureCodeServerLoaded, this.$root)
161+
this.router.get(/manifest.json$/, this.manifest)
144162
this.router.all("*", ensureAuthenticated, this.ensureCodeServerLoaded, this.$proxyRequest)
145163
this._wsRouterWrapper.ws("/", ensureAuthenticated, this.ensureCodeServerLoaded, this.$proxyWebsocket)
146164
}

0 commit comments

Comments
 (0)