Skip to content

Commit 6b9b302

Browse files
committed
Basic autologin mechanism for e2e
1 parent a419546 commit 6b9b302

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/App.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,24 @@ function App() {
120120
newClient.registerMcpPackage(McpAwnsPing);
121121
newClient.connect();
122122
newClient.requestNotificationPermission();
123+
124+
// Check for URL parameters for auto-login (useful for testing/e2e)
125+
const urlParams = new URLSearchParams(window.location.search);
126+
const username = urlParams.get('username');
127+
const password = urlParams.get('password');
128+
129+
if (username && password) {
130+
// Auto-login when connected
131+
newClient.once('connect', () => {
132+
console.log('Auto-logging in with URL params...');
133+
setTimeout(() => {
134+
newClient.sendCommand(username);
135+
setTimeout(() => {
136+
newClient.sendCommand(password);
137+
}, 500);
138+
}, 1000);
139+
});
140+
}
123141
setClient(newClient);
124142
setShowSidebar(!isMobile);
125143
window.mudClient = newClient;

0 commit comments

Comments
 (0)