Skip to content

Commit 0222229

Browse files
improve branding (#1979)
Co-authored-by: Saikrishna321 <saikrishna321@yahoo.com>
1 parent 1f9878d commit 0222229

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

dashboard-frontend

src/modules

src/plugin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,12 @@ class DevicePlugin extends BasePlugin {
200200
log.info('proxy is not required for axios');
201201
}
202202
hasEmulators = pluginArgs.emulators && pluginArgs.emulators.length > 0;
203-
expressApp.use('/device-farm', createRouter(pluginArgs));
204203

204+
// Register proxy middleware before routes to ensure it runs early in the middleware chain
205+
// This is necessary for intercepting session requests before they reach route handlers
205206
registerProxyMiddlware(expressApp, cliArgs, externalModule.getMiddleWares());
207+
208+
expressApp.use('/device-farm', createRouter(pluginArgs));
206209
externalModule.updateServer(expressApp, httpServer);
207210
if (hasEmulators && pluginArgs.platform.toLowerCase() === 'android') {
208211
log.info('Emulators will be booted!!');

src/proxy/wd-command-proxy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ export function registerProxyMiddlware(
136136
middlewares: ExpressMiddleware[],
137137
) {
138138
log.info('Registering proxy middleware');
139-
const index = expressApp.router.stack.findIndex((s: any) => s.route);
139+
// In Express 5.x, app.router is deprecated. Middleware order is determined by registration order.
140+
// Since this is called early in the plugin lifecycle, it will run before route handlers.
140141
expressApp.use('/', handler(cliArgs, middlewares));
141-
expressApp.router.stack.splice(index, 0, expressApp.router.stack.pop());
142142
}
143143

144144
export function wrapRequestWithMiddleware(options: {

0 commit comments

Comments
 (0)