mirror of
https://github.com/coder/code-server.git
synced 2026-05-05 12:05:18 +02:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user