diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-03-28 18:07:41 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-03-28 18:07:41 +0900 |
| commit | 614a1d74ddf388dcb82f69722c96696ad530602d (patch) | |
| tree | faf2d14d1d82ea321080ebb677d8c402460c9a5b /src/server/api/stream | |
| parent | Add i/apps private API (diff) | |
| download | sharkey-614a1d74ddf388dcb82f69722c96696ad530602d.tar.gz sharkey-614a1d74ddf388dcb82f69722c96696ad530602d.tar.bz2 sharkey-614a1d74ddf388dcb82f69722c96696ad530602d.zip | |
Resolve #6192
Diffstat (limited to 'src/server/api/stream')
| -rw-r--r-- | src/server/api/stream/index.ts | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 4b233b9a8b..05594ac722 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -9,10 +9,7 @@ import { EventEmitter } from 'events'; import { User } from '../../../models/entities/user'; import { Users, Followings, Mutings } from '../../../models'; import { ApiError } from '../error'; - -type App = { - permission: string[]; -}; +import { AccessToken } from '../../../models/entities/access-token'; /** * Main stream connection @@ -21,7 +18,7 @@ export default class Connection { public user?: User; public following: User['id'][] = []; public muting: User['id'][] = []; - public app: App; + public token: AccessToken; private wsConnection: websocket.connection; public subscriber: EventEmitter; private channels: Channel[] = []; @@ -33,12 +30,12 @@ export default class Connection { wsConnection: websocket.connection, subscriber: EventEmitter, user: User | null | undefined, - app: App | null | undefined + token: AccessToken | null | undefined ) { this.wsConnection = wsConnection; this.subscriber = subscriber; if (user) this.user = user; - if (app) this.app = app; + if (token) this.token = token; this.wsConnection.on('message', this.onWsConnectionMessage); @@ -86,7 +83,7 @@ export default class Connection { const endpoint = payload.endpoint || payload.ep; // alias // 呼び出し - call(endpoint, user, this.app, payload.data).then(res => { + call(endpoint, user, this.token, payload.data).then(res => { this.sendMessageToWs(`api:${payload.id}`, { res }); }).catch((e: ApiError) => { this.sendMessageToWs(`api:${payload.id}`, { |