mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 04:04:16 +00:00
feat: [backend] better streaming auth
This commit is contained in:
@@ -108,14 +108,9 @@ export class StreamingApiServerService {
|
||||
try {
|
||||
[user, app] = await this.authenticateService.authenticate(token);
|
||||
|
||||
if (app !== null && !app.permission.some(p => p === 'read:account')) {
|
||||
if ((app !== null && !app.permission.some(p => p === 'read:account')) || user == null) {
|
||||
throw new AuthenticationError('Your app does not have necessary permissions to use websocket API.');
|
||||
}
|
||||
|
||||
// Ensure we have a valid user
|
||||
if (!user) {
|
||||
throw new AuthenticationError('Invalid token or user not found.');
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof AuthenticationError) {
|
||||
socket.write([
|
||||
|
||||
Reference in New Issue
Block a user