1
1
import { field , logger } from "@coder/logger"
2
2
import * as crypto from "crypto"
3
- import { RequestHandler , Router , static as createStaticRouteHandler } from "express"
3
+ import { RequestHandler , Router } from "express"
4
4
import { promises as fs } from "fs"
5
5
import * as path from "path"
6
6
import { resolve } from "path"
@@ -15,6 +15,7 @@ import { authenticated, commonTemplateVars, ensureAuthenticated, redirect } from
15
15
import { getMediaMime , pathToFsPath } from "../util"
16
16
import { VscodeProvider } from "../vscode"
17
17
import { Router as WsRouter } from "../wsRouter"
18
+ import { createServeDirectoryHandler } from "./static"
18
19
19
20
export const router = Router ( )
20
21
@@ -103,13 +104,8 @@ wsRouter.ws("/", ensureAuthenticated, async (req) => {
103
104
)
104
105
await vscode . sendWebsocket ( req . ws , req . query )
105
106
} )
106
- router . use (
107
- "/lib" ,
108
- createStaticRouteHandler ( resolve ( rootPath , "lib" ) , {
109
- index : false ,
110
- cacheControl : commit !== "development" ,
111
- } ) ,
112
- )
107
+
108
+ createServeDirectoryHandler ( router , "/lib" , resolve ( rootPath , "lib" ) )
113
109
114
110
interface TarHandlerQueryParams extends ParsedQs {
115
111
filePath ?: string | string [ ]
0 commit comments