Spawn vscode on demand (#4499)

* Refactor vscode router to load async.

* Bump vscode.

* fix volumes (#4497)

* Fix : recreate the termux guide to adapt the recent changes (#4472)

* Fix : recreate the termux guide to adapt the recent changes

Termux nodejs-lts changed from v14 to v16 and there are many issues people are facing such as with argon2. Hence I recommend changing it to this install process which is comparably better and has one less issue :^)

I've also added some extra things such as installing GO and Python, idk about the TOC tree but this is pretty much it.

* yarn-fmt and minor typos

https://github.com/cdr/code-server/pull/4472#issuecomment-964752180

* Fix : replace unnecessary steps to be linked to a guide

* Change from private gist to a section in Extra

* Remove reference to non-existent step

* ready to merge!

Co-authored-by: Joe Previte <jjprevite@gmail.com>

Co-authored-by: Jinu <jlandowner8@gmail.com>
Co-authored-by: Han Seung Min - 한승민 <hanseungmin.ar@gmail.com>
Co-authored-by: Joe Previte <jjprevite@gmail.com>
This commit is contained in:
Teffen
2021-11-14 20:03:20 -05:00
committed by GitHub
parent 6606040835
commit e705948ef3
4 changed files with 89 additions and 57 deletions

View File

@@ -10,7 +10,7 @@ import { HttpCode, HttpError } from "../../common/http"
import { plural } from "../../common/util"
import { App } from "../app"
import { AuthType, DefaultedArgs } from "../cli"
import { commit, isDevMode, rootPath } from "../constants"
import { commit, rootPath } from "../constants"
import { Heart } from "../heart"
import { ensureAuthenticated, redirect } from "../http"
import { PluginAPI } from "../plugin"
@@ -23,7 +23,7 @@ import * as login from "./login"
import * as logout from "./logout"
import * as pathProxy from "./pathProxy"
import * as update from "./update"
import { createVSServerRouter, VSServerResult } from "./vscode"
import { CodeServerRouteWrapper } from "./vscode"
/**
* Register all routes and middleware.
@@ -138,20 +138,12 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
app.router.use("/update", update.router)
let vscode: VSServerResult
try {
vscode = await createVSServerRouter(args)
app.router.use("/", vscode.router)
app.wsRouter.use("/", vscode.wsRouter.router)
app.router.use("/vscode", vscode.router)
app.wsRouter.use("/vscode", vscode.wsRouter.router)
} catch (error: any) {
if (isDevMode) {
logger.warn(error)
logger.warn("VS Server router may still be compiling.")
} else {
throw error
}
const vsServerRouteHandler = new CodeServerRouteWrapper()
// Note that the root route is replaced in Coder Enterprise by the plugin API.
for (const routePrefix of ["/", "/vscode"]) {
app.router.use(routePrefix, vsServerRouteHandler.router)
app.wsRouter.use(routePrefix, vsServerRouteHandler.wsRouter)
}
app.router.use(() => {
@@ -164,6 +156,6 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
return () => {
heart.dispose()
pluginApi?.dispose()
vscode?.codeServerMain.dispose()
vsServerRouteHandler.dispose()
}
}