Skip to content

Commit

Permalink
fix(eventSubWebsocket): add missing scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Oct 28, 2023
1 parent a4c1aef commit 0524aa2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions d.ts/src/helpers/socket.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import { ValidationError } from 'class-validator';
import { Socket } from 'socket.io';
import { FindConditions } from 'typeorm';

import { QuickActions } from '../../../src/database/entity/dashboard';
import { WidgetCustomInterface, WidgetSocialInterface } from '../../../src/database/entity/widget';
import { QuickActions } from '../../../src/database/entity/dashboard.js';
import { WidgetCustomInterface, WidgetSocialInterface } from '../../../src/database/entity/widget.js';

import { AliasGroup, Alias } from '~/database/entity/alias';
import { CacheGamesInterface } from '~/database/entity/cacheGames';
Expand Down Expand Up @@ -83,6 +83,7 @@ type generic<T extends Record<string, any>, K = 'id'> = {

export type ClientToServerEventsWithNamespace = {
'/': GenericEvents & {
'token::broadcaster-missing-scopes': (cb: (scopes: string[]) => void) => void,
'leaveBot': () => void,
'joinBot': () => void,
'channelName': (cb: (name: string) => void) => void,
Expand Down
5 changes: 5 additions & 0 deletions src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { processAuth, default as socketSystem } from '~/socket.js';
import highlights from '~/systems/highlights.js';
import translateLib, { translate } from '~/translate.js';
import { variables } from '~/watchers.js';
import { broadcasterMissingScopes } from './services/twitch/eventSubWebsocket.js';

// __dirname is not available in ES6 module
const __dirname = new URL('.', import.meta.url).pathname;
Expand Down Expand Up @@ -384,6 +385,10 @@ class Panel extends Core {
setDEBUG(data);
});

adminEndpoint('/', 'token::broadcaster-missing-scopes', (cb) => {
cb(broadcasterMissingScopes);
});

adminEndpoint('/', 'panel::alerts', (cb) => {
const toShow: { errors: typeof errors, warns: typeof warns } = { errors: [], warns: [] };
do {
Expand Down
3 changes: 3 additions & 0 deletions src/services/twitch/eventSubWebsocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ setInterval(() => {
}
}, 10000);

// TODO: add missing scopes
export const broadcasterMissingScopes: string[] = [];

class EventSubWebsocket {
listener: EventSubWsListener;
listenerBroadcasterId?: string;
Expand Down

0 comments on commit 0524aa2

Please sign in to comment.