Skip to content

Commit 096eb37

Browse files
committed
Fix guest login when the first room is protected with RoomProtectPlugin & Publish 0.0.7
1 parent 38fa50c commit 096eb37

3 files changed

Lines changed: 39 additions & 27 deletions

File tree

package-lock.json

Lines changed: 30 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "skychat-cli",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Connect to a SkyChat instance using CLI",
55
"main": "lib/index.js",
66
"files": [
@@ -20,8 +20,8 @@
2020
"skychat": "^1.0.4"
2121
},
2222
"devDependencies": {
23-
"@types/blessed": "^0.1.22",
24-
"nodemon": "^3.0.1",
25-
"typescript": "^5.1.6"
23+
"@types/blessed": "^0.1.25",
24+
"nodemon": "^3.1.0",
25+
"typescript": "^5.4.5"
2626
}
2727
}

src/SkyChatCLI.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ export class SkyChatCLI {
126126
}
127127

128128
// If yes, join first room
129-
this.client.join(this.client.state.rooms[0].id);
129+
const availableRoom = this.client.state.rooms.find(room => ! room.isPrivate && ! room.plugins.roomprotect);
130+
if (! availableRoom) {
131+
throw new Error('No available room to join');
132+
}
133+
this.client.join(availableRoom.id);
130134

131135
// If credentials are provided, login
132136
if (credentials?.username && credentials?.password) {

0 commit comments

Comments
 (0)