1
0
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:
Leafus
2025-11-18 06:27:29 +01:00
parent 096aace964
commit 39177b6dcc

View File

@@ -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([