Skip to content

Commit

Permalink
Add option for staticClientPath in ServerConfig to override web client
Browse files Browse the repository at this point in the history
  • Loading branch information
nisargjhaveri committed Sep 1, 2024
1 parent 3b76d7b commit fdfeabf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ declare module 'express-session' {
}

export type ServerConfiguration = {
/**
* Password required to connect to the server.
* When provided, the server will require clients to authenticate using this password.
* If not set, no authentication is required.
*/
password?: string;

/**
* Path to the static files to serve.
* Useful when remote-adb is bundled and the static files are not in the default location, or to use a custom web client.
*/
staticClientPath?: string;
}

export class Server {
Expand Down Expand Up @@ -106,7 +117,7 @@ export class Server {
});

// Serve static files from client
app.use(express.static(path.join(__dirname, '../web')));
app.use(express.static(this.serverConfig?.staticClientPath ?? path.join(__dirname, '../web')));

// Setup web socket server
wss.on('connection', this.handleWsConnection);
Expand Down

0 comments on commit fdfeabf

Please sign in to comment.