From 5ba650bb6fe746b36e2d46f7f3f1d6162442f5ca Mon Sep 17 00:00:00 2001 From: fxxjdedd <506036406@qq.com> Date: Tue, 28 Jul 2020 20:14:52 +0800 Subject: [PATCH] feat: persist route query to local Provide a way for the shell script running in the docker container to get the url query. --- src/node/app/vscode.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/node/app/vscode.ts b/src/node/app/vscode.ts index 37cf1046d..e80a2b238 100644 --- a/src/node/app/vscode.ts +++ b/src/node/app/vscode.ts @@ -134,6 +134,7 @@ export class VscodeHttpProvider extends HttpProvider { return { redirect: "/login", query: { to: this.options.base } } } try { + this.persistRouteQuery(request, route) return await this.getRoot(request, route) } catch (error) { const message = `
VS Code failed to load.
${ @@ -164,6 +165,13 @@ export class VscodeHttpProvider extends HttpProvider { throw new HttpError("Not found", HttpCode.NotFound) } + + private persistRouteQuery(request: http.IncomingMessage, route: Route): void { + const content = Object.keys(route.query).reduce((content, next) => { + return (content += `${next}=${route.query[next]}\n`) + }, "") + fs.writeFile(path.resolve(paths.data, "query"), content) + } private async getRoot(request: http.IncomingMessage, route: Route): Promise { const remoteAuthority = request.headers.host as string