From 9e74a3b8fa69d63e8e432c48bafaf880098edf3b Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 23 Apr 2018 18:00:58 +0900 Subject: Refactor --- src/server/api/stream/home.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/server/api/stream') diff --git a/src/server/api/stream/home.ts b/src/server/api/stream/home.ts index a9d6ff241e..f629278848 100644 --- a/src/server/api/stream/home.ts +++ b/src/server/api/stream/home.ts @@ -32,17 +32,17 @@ export default async function( //#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する if (x.type == 'note') { - if (mutedUserIds.indexOf(x.body.userId) != -1) { + if (mutedUserIds.includes(x.body.userId)) { return; } - if (x.body.reply != null && mutedUserIds.indexOf(x.body.reply.userId) != -1) { + if (x.body.reply != null && mutedUserIds.includes(x.body.reply.userId)) { return; } - if (x.body.renote != null && mutedUserIds.indexOf(x.body.renote.userId) != -1) { + if (x.body.renote != null && mutedUserIds.includes(x.body.renote.userId)) { return; } } else if (x.type == 'notification') { - if (mutedUserIds.indexOf(x.body.userId) != -1) { + if (mutedUserIds.includes(x.body.userId)) { return; } } @@ -53,6 +53,7 @@ export default async function( connection.send(data); } break; + case 'note-stream': const noteId = channel.split(':')[2]; log(`RECEIVED: ${noteId} ${data} by @${user.username}`); -- cgit v1.2.3-freya From 3972e98f74cd8f31da013ed4e4e16b0d65435647 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 26 Apr 2018 11:02:15 +0900 Subject: wip --- src/server/api/stream/user-list.ts | 14 ++++++++++++++ src/server/api/streaming.ts | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 src/server/api/stream/user-list.ts (limited to 'src/server/api/stream') diff --git a/src/server/api/stream/user-list.ts b/src/server/api/stream/user-list.ts new file mode 100644 index 0000000000..ba03b97860 --- /dev/null +++ b/src/server/api/stream/user-list.ts @@ -0,0 +1,14 @@ +import * as websocket from 'websocket'; +import * as redis from 'redis'; +import { ParsedUrlQuery } from 'querystring'; + +export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void { + const q = request.resourceURL.query as ParsedUrlQuery; + const listId = q.listId as string; + + // Subscribe stream + subscriber.subscribe(`misskey:user-list-stream:${listId}`); + subscriber.on('message', (_, data) => { + connection.send(data); + }); +} diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index ce13253649..e4884ed7c4 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -6,6 +6,7 @@ import config from '../../config'; import homeStream from './stream/home'; import localTimelineStream from './stream/local-timeline'; import globalTimelineStream from './stream/global-timeline'; +import userListStream from './stream/user-list'; import driveStream from './stream/drive'; import messagingStream from './stream/messaging'; import messagingIndexStream from './stream/messaging-index'; @@ -70,6 +71,7 @@ module.exports = (server: http.Server) => { request.resourceURL.pathname === '/' ? homeStream : request.resourceURL.pathname === '/local-timeline' ? localTimelineStream : request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream : + request.resourceURL.pathname === '/user-list' ? userListStream : request.resourceURL.pathname === '/drive' ? driveStream : request.resourceURL.pathname === '/messaging' ? messagingStream : request.resourceURL.pathname === '/messaging-index' ? messagingIndexStream : -- cgit v1.2.3-freya From a8083eb52bc268829caa2d5453dec5d9a3c5185f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Apr 2018 17:54:50 +0900 Subject: バグ修正など MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/mios.ts | 8 +++----- src/client/app/desktop/views/components/settings.vue | 2 +- src/client/app/desktop/views/pages/welcome.vue | 12 ++++-------- src/client/app/mobile/views/pages/welcome.vue | 12 ++++-------- src/client/app/store.ts | 10 ++++++---- src/server/api/stream/home.ts | 5 +++-- 6 files changed, 21 insertions(+), 28 deletions(-) (limited to 'src/server/api/stream') diff --git a/src/client/app/common/mios.ts b/src/client/app/common/mios.ts index 7dcae47946..3973e4ae8c 100644 --- a/src/client/app/common/mios.ts +++ b/src/client/app/common/mios.ts @@ -332,7 +332,7 @@ export default class MiOS extends EventEmitter { const cachedSettings = JSON.parse(localStorage.getItem('settings')); if (cachedSettings) { - this.store.commit('settings/init', cachedSettings); + this.store.dispatch('settings/merge', cachedSettings); } //#endregion @@ -350,7 +350,7 @@ export default class MiOS extends EventEmitter { fetchme(cachedMe.token, freshData => { merge(cachedMe, freshData); - this.store.commit('settings/init', freshData.clientSettings); + this.store.dispatch('settings/merge', freshData.clientSettings); }); } else { // Get token from cookie @@ -358,9 +358,7 @@ export default class MiOS extends EventEmitter { fetchme(i, me => { if (me) { - Object.entries(me.clientSettings).forEach(([key, value]) => { - this.store.commit('settings/set', { key, value }); - }); + this.store.dispatch('settings/merge', me.clientSettings); fetched(me); } else { diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index af6ab12669..77606d4254 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -41,7 +41,7 @@
- +
diff --git a/src/client/app/desktop/views/pages/welcome.vue b/src/client/app/desktop/views/pages/welcome.vue index 3d6765c97e..898b6b2179 100644 --- a/src/client/app/desktop/views/pages/welcome.vue +++ b/src/client/app/desktop/views/pages/welcome.vue @@ -8,7 +8,7 @@

ようこそ! MisskeyはTwitter風ミニブログSNSです。思ったことや皆と共有したいことを投稿しましょう。タイムラインを見れば、皆の関心事をすぐにチェックすることもできます。詳しく...

- +
@@ -215,13 +215,9 @@ export default Vue.extend({ > * display inline-block margin 4px - - > * - display inline-block - width 38px - height 38px - vertical-align top - border-radius 6px + width 38px + height 38px + border-radius 6px > div:last-child diff --git a/src/client/app/mobile/views/pages/welcome.vue b/src/client/app/mobile/views/pages/welcome.vue index 4d236d7aa5..64cfa5a46c 100644 --- a/src/client/app/mobile/views/pages/welcome.vue +++ b/src/client/app/mobile/views/pages/welcome.vue @@ -22,7 +22,7 @@
- +