File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 5252 "@types/wtfnode" : " ^0.7.0" ,
5353 "@typescript-eslint/eslint-plugin" : " ^4.7.0" ,
5454 "@typescript-eslint/parser" : " ^4.7.0" ,
55- "compression" : " ^1.7.4" ,
5655 "doctoc" : " ^1.4.0" ,
5756 "eslint" : " ^7.7.0" ,
5857 "eslint-config-prettier" : " ^6.0.0" ,
7776 "dependencies" : {
7877 "@coder/logger" : " 1.1.16" ,
7978 "body-parser" : " ^1.19.0" ,
79+ "compression" : " ^1.7.4" ,
8080 "cookie-parser" : " ^1.4.5" ,
8181 "env-paths" : " ^2.2.0" ,
8282 "express" : " ^5.0.0-alpha.8" ,
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ export class PluginAPI {
251251 if ( ! p . routerPath ) {
252252 throw new Error ( "plugin missing router path" )
253253 }
254- if ( ! p . routerPath . startsWith ( "/" ) || p . routerPath . length < 2 ) {
254+ if ( ! p . routerPath . startsWith ( "/" ) ) {
255255 throw new Error ( `plugin router path ${ q ( p . routerPath ) } : invalid` )
256256 }
257257 if ( ! p . homepageURL ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as express from "express"
33import * as fs from "fs"
44import * as path from "path"
55import { HttpCode } from "../src/common/http"
6+ import { AuthType } from "../src/node/cli"
67import { codeServer , PluginAPI } from "../src/node/plugin"
78import * as apps from "../src/node/routes/apps"
89import * as httpserver from "./httpserver"
@@ -26,6 +27,28 @@ describe("plugin", () => {
2627
2728 const app = express . default ( )
2829 const wsApp = express . default ( )
30+
31+ const common : express . RequestHandler = ( req , _ , next ) => {
32+ // Routes might use these arguments.
33+ req . args = {
34+ _ : [ ] ,
35+ auth : AuthType . None ,
36+ host : "localhost" ,
37+ port : 8080 ,
38+ "proxy-domain" : [ ] ,
39+ config : "~/.config/code-server/config.yaml" ,
40+ verbose : false ,
41+ usingEnvPassword : false ,
42+ usingEnvHashedPassword : false ,
43+ "extensions-dir" : "" ,
44+ "user-data-dir" : "" ,
45+ }
46+ next ( )
47+ }
48+
49+ app . use ( common )
50+ wsApp . use ( common )
51+
2952 papi . mount ( app , wsApp )
3053 app . use ( "/api/applications" , apps . router ( papi ) )
3154
You can’t perform that action at this time.
0 commit comments