feat: persist route query to local
Provide a way for the shell script running in the docker container to get the url query.
This commit is contained in:
parent
638ab7c557
commit
5ba650bb6f
@ -134,6 +134,7 @@ export class VscodeHttpProvider extends HttpProvider {
|
|||||||
return { redirect: "/login", query: { to: this.options.base } }
|
return { redirect: "/login", query: { to: this.options.base } }
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
this.persistRouteQuery(request, route)
|
||||||
return await this.getRoot(request, route)
|
return await this.getRoot(request, route)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = `<div>VS Code failed to load.</div> ${
|
const message = `<div>VS Code failed to load.</div> ${
|
||||||
@ -164,6 +165,13 @@ export class VscodeHttpProvider extends HttpProvider {
|
|||||||
|
|
||||||
throw new HttpError("Not found", HttpCode.NotFound)
|
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<HttpResponse> {
|
private async getRoot(request: http.IncomingMessage, route: Route): Promise<HttpResponse> {
|
||||||
const remoteAuthority = request.headers.host as string
|
const remoteAuthority = request.headers.host as string
|
||||||
|
Reference in New Issue
Block a user