From 52feba0e3ac53391c4b29150ed4af9712541aded Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Mar 2020 10:39:36 +0900 Subject: Refactor: Use === --- src/server/api/stream/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/api') diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 05594ac722..9a6c247463 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -117,7 +117,7 @@ export default class Connection { this.subscribingNotes[payload.id]++; - if (this.subscribingNotes[payload.id] == 1) { + if (this.subscribingNotes[payload.id] === 1) { this.subscriber.on(`noteStream:${payload.id}`, this.onNoteStreamMessage); } -- cgit v1.2.3-freya From bb835a6e8ac36d4055b9da3b37f27e8b0d5bea37 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Mar 2020 10:49:43 +0900 Subject: Fix bug --- src/models/repositories/notification.ts | 4 ++-- src/server/api/define.ts | 6 +++--- src/server/api/endpoints/notifications/create.ts | 2 +- src/server/api/stream/index.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/server/api') diff --git a/src/models/repositories/notification.ts b/src/models/repositories/notification.ts index a8978cc01b..b484c43c5e 100644 --- a/src/models/repositories/notification.ts +++ b/src/models/repositories/notification.ts @@ -46,8 +46,8 @@ export class NotificationRepository extends Repository { } : {}), ...(notification.type === 'app' ? { body: notification.customBody, - header: notification.customHeader || token!.name, - icon: notification.customIcon || token!.iconUrl, + header: notification.customHeader || token?.name, + icon: notification.customIcon || token?.iconUrl, } : {}), }); } diff --git a/src/server/api/define.ts b/src/server/api/define.ts index 2ee0ba4868..1c7ee26479 100644 --- a/src/server/api/define.ts +++ b/src/server/api/define.ts @@ -15,12 +15,12 @@ type Params = { export type Response = Record | void; type executor = - (params: Params, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken, file?: any, cleanup?: Function) => + (params: Params, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken | null, file?: any, cleanup?: Function) => Promise>>; export default function (meta: T, cb: executor) - : (params: any, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken, file?: any) => Promise { - return (params: any, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken, file?: any) => { + : (params: any, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken | null, file?: any) => Promise { + return (params: any, user: T['requireCredential'] extends true ? ILocalUser : ILocalUser | null, token: AccessToken | null, file?: any) => { function cleanup() { fs.unlink(file.path, () => {}); } diff --git a/src/server/api/endpoints/notifications/create.ts b/src/server/api/endpoints/notifications/create.ts index fed422b645..6267699e90 100644 --- a/src/server/api/endpoints/notifications/create.ts +++ b/src/server/api/endpoints/notifications/create.ts @@ -29,7 +29,7 @@ export const meta = { export default define(meta, async (ps, user, token) => { createNotification(user.id, 'app', { - appAccessTokenId: token.id, + appAccessTokenId: token ? token.id : null, customBody: ps.body, customHeader: ps.header, customIcon: ps.icon, diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 9a6c247463..a5ff56f51d 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -18,7 +18,7 @@ export default class Connection { public user?: User; public following: User['id'][] = []; public muting: User['id'][] = []; - public token: AccessToken; + public token: AccessToken | null | undefined; private wsConnection: websocket.connection; public subscriber: EventEmitter; private channels: Channel[] = []; -- cgit v1.2.3-freya From c52aeb66184c9f17f6ba2df3c4b256ab31ecdd6e Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Mar 2020 11:28:55 +0900 Subject: Fix type --- src/server/api/stream/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/api') diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index a5ff56f51d..2781d14bd9 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -18,7 +18,7 @@ export default class Connection { public user?: User; public following: User['id'][] = []; public muting: User['id'][] = []; - public token: AccessToken | null | undefined; + public token?: AccessToken; private wsConnection: websocket.connection; public subscriber: EventEmitter; private channels: Channel[] = []; -- cgit v1.2.3-freya From 09e3ddbd57d3e18b079619f00af533500d99770c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Mar 2020 17:06:36 +0900 Subject: アプリの権限を確認できるように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/pages/apps.vue | 6 ++++++ src/server/api/endpoints/i/apps.ts | 1 + 2 files changed, 7 insertions(+) (limited to 'src/server/api') diff --git a/src/client/pages/apps.vue b/src/client/pages/apps.vue index 03c6707f95..445bba34c8 100644 --- a/src/client/pages/apps.vue +++ b/src/client/pages/apps.vue @@ -27,6 +27,12 @@
+
+ {{ $t('details') }} +
    +
  • {{ $t(`_permissions.${p}`) }}
  • +
+
diff --git a/src/server/api/endpoints/i/apps.ts b/src/server/api/endpoints/i/apps.ts index dc74123ce3..3b5cd21a79 100644 --- a/src/server/api/endpoints/i/apps.ts +++ b/src/server/api/endpoints/i/apps.ts @@ -38,5 +38,6 @@ export default define(meta, async (ps, user) => { name: token.name, createdAt: token.createdAt, lastUsedAt: token.lastUsedAt, + permission: token.permission, }))); }); -- cgit v1.2.3-freya From 02cc1891f21012f1e2527749bbacf054e6728cb0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Mar 2020 17:44:14 +0900 Subject: Add miauth info into meta.features --- src/server/api/endpoints/meta.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'src/server/api') diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 8eaa65a2c6..41adc855d2 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -159,6 +159,7 @@ export default define(meta, async (ps, me) => { github: instance.enableGithubIntegration, discord: instance.enableDiscordIntegration, serviceWorker: instance.enableServiceWorker, + miauth: true, }; } -- cgit v1.2.3-freya