@@ -6,20 +6,20 @@ import { promises as fs } from "fs"
66import http from "http"
77import * as path from "path"
88import * as tls from "tls"
9+ import * as pluginapi from "../../../typings/pluginapi"
910import { HttpCode , HttpError } from "../../common/http"
1011import { plural } from "../../common/util"
1112import { AuthType , DefaultedArgs } from "../cli"
1213import { rootPath } from "../constants"
1314import { Heart } from "../heart"
14- import { replaceTemplates , redirect } from "../http"
15+ import { redirect , replaceTemplates } from "../http"
1516import { PluginAPI } from "../plugin"
1617import { getMediaMime , paths } from "../util"
17- import { WebsocketRequest } from "../wsRouter"
1818import * as apps from "./apps"
1919import * as domainProxy from "./domainProxy"
2020import * as health from "./health"
2121import * as login from "./login"
22- import * as proxy from "./pathProxy"
22+ import * as pathProxy from "./pathProxy"
2323// static is a reserved keyword.
2424import * as _static from "./static"
2525import * as update from "./update"
@@ -104,21 +104,21 @@ export const register = async (
104104 wsApp . use ( "/" , domainProxy . wsRouter . router )
105105
106106 app . all ( "/proxy/(:port)(/*)?" , ( req , res ) => {
107- proxy . proxy ( req , res )
107+ pathProxy . proxy ( req , res )
108108 } )
109- wsApp . get ( "/proxy/(:port)(/*)?" , ( req , res ) => {
110- proxy . wsProxy ( req as WebsocketRequest )
109+ wsApp . get ( "/proxy/(:port)(/*)?" , ( req ) => {
110+ pathProxy . wsProxy ( req as pluginapi . WebsocketRequest )
111111 } )
112112 // These two routes pass through the path directly.
113113 // So the proxied app must be aware it is running
114114 // under /absproxy/<someport>/
115115 app . all ( "/absproxy/(:port)(/*)?" , ( req , res ) => {
116- proxy . proxy ( req , res , {
116+ pathProxy . proxy ( req , res , {
117117 passthroughPath : true ,
118118 } )
119119 } )
120- wsApp . get ( "/absproxy/(:port)(/*)?" , ( req , res ) => {
121- proxy . wsProxy ( req as WebsocketRequest , {
120+ wsApp . get ( "/absproxy/(:port)(/*)?" , ( req ) => {
121+ pathProxy . wsProxy ( req as pluginapi . WebsocketRequest , {
122122 passthroughPath : true ,
123123 } )
124124 } )
@@ -146,7 +146,7 @@ export const register = async (
146146
147147 const papi = new PluginAPI ( logger , process . env . CS_PLUGIN , process . env . CS_PLUGIN_PATH )
148148 await papi . loadPlugins ( )
149- papi . mount ( app )
149+ papi . mount ( app , wsApp )
150150 app . use ( "/api/applications" , apps . router ( papi ) )
151151
152152 app . use ( ( ) => {
@@ -187,7 +187,7 @@ export const register = async (
187187
188188 const wsErrorHandler : express . ErrorRequestHandler = async ( err , req , res , next ) => {
189189 logger . error ( `${ err . message } ${ err . stack } ` )
190- ; ( req as WebsocketRequest ) . ws . end ( )
190+ ; ( req as pluginapi . WebsocketRequest ) . ws . end ( )
191191 }
192192
193193 wsApp . use ( wsErrorHandler )
0 commit comments