File tree 3 files changed +25
-2
lines changed
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 52
52
"@types/wtfnode" : " ^0.7.0" ,
53
53
"@typescript-eslint/eslint-plugin" : " ^4.7.0" ,
54
54
"@typescript-eslint/parser" : " ^4.7.0" ,
55
- "compression" : " ^1.7.4" ,
56
55
"doctoc" : " ^1.4.0" ,
57
56
"eslint" : " ^7.7.0" ,
58
57
"eslint-config-prettier" : " ^6.0.0" ,
77
76
"dependencies" : {
78
77
"@coder/logger" : " 1.1.16" ,
79
78
"body-parser" : " ^1.19.0" ,
79
+ "compression" : " ^1.7.4" ,
80
80
"cookie-parser" : " ^1.4.5" ,
81
81
"env-paths" : " ^2.2.0" ,
82
82
"express" : " ^5.0.0-alpha.8" ,
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ export class PluginAPI {
251
251
if ( ! p . routerPath ) {
252
252
throw new Error ( "plugin missing router path" )
253
253
}
254
- if ( ! p . routerPath . startsWith ( "/" ) || p . routerPath . length < 2 ) {
254
+ if ( ! p . routerPath . startsWith ( "/" ) ) {
255
255
throw new Error ( `plugin router path ${ q ( p . routerPath ) } : invalid` )
256
256
}
257
257
if ( ! p . homepageURL ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as express from "express"
3
3
import * as fs from "fs"
4
4
import * as path from "path"
5
5
import { HttpCode } from "../src/common/http"
6
+ import { AuthType } from "../src/node/cli"
6
7
import { codeServer , PluginAPI } from "../src/node/plugin"
7
8
import * as apps from "../src/node/routes/apps"
8
9
import * as httpserver from "./httpserver"
@@ -26,6 +27,28 @@ describe("plugin", () => {
26
27
27
28
const app = express . default ( )
28
29
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
+
29
52
papi . mount ( app , wsApp )
30
53
app . use ( "/api/applications" , apps . router ( papi ) )
31
54
You can’t perform that action at this time.
0 commit comments