Skip to content

Commit

Permalink
fix: handle partial auth toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Whipstickgostop committed Nov 2, 2024
1 parent ca09aa2 commit 13c5233
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/client/src/ws/StreamerbotClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,15 @@ export class StreamerbotClient {
}

private async authenticate(data: StreamerbotHelloRequest): Promise<void> {
if (!this.options.password) {
console.debug('No password provided for authentication');
if (!this._authEnabled || !this.options.password) {
console.debug('No password provided for authentication. Checking if auth is enforced for all requests...');
const res = await this.getInfo();
if (res.status === 'ok') {
this._authenticated = false;
this.version = data.info.version;
this.info = data.info;
return;
}
await this.disconnect();
throw new Error('Authentication required');
}
Expand Down Expand Up @@ -328,6 +335,7 @@ export class StreamerbotClient {
this._reconnectTimeout && clearTimeout(this._reconnectTimeout);

try {
// Force a getInfo call for backwards compat with Streamer.bot v0.2.4 and older
if (!this._authEnabled) {
void this.getInfo().catch(() => console.debug('Failed to get Streamer.bot info'));
}
Expand Down

0 comments on commit 13c5233

Please sign in to comment.