From 291beb45fcb7a4c856232b12848ebad8267e2840 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 1 Sep 2018 23:12:51 +0900 Subject: Use string interpolation --- src/server/api/stream/notes-stats.ts | 2 +- src/server/api/stream/server-stats.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/api/stream') diff --git a/src/server/api/stream/notes-stats.ts b/src/server/api/stream/notes-stats.ts index ab00620018..ba99403226 100644 --- a/src/server/api/stream/notes-stats.ts +++ b/src/server/api/stream/notes-stats.ts @@ -16,7 +16,7 @@ export default function(request: websocket.request, connection: websocket.connec switch (msg.type) { case 'requestLog': - ev.once('notesStatsLog:' + msg.id, statsLog => { + ev.once(`notesStatsLog:${msg.id}`, statsLog => { connection.send(JSON.stringify({ type: 'statsLog', body: statsLog diff --git a/src/server/api/stream/server-stats.ts b/src/server/api/stream/server-stats.ts index f6c1f14ebe..d4fbeefa04 100644 --- a/src/server/api/stream/server-stats.ts +++ b/src/server/api/stream/server-stats.ts @@ -16,7 +16,7 @@ export default function(request: websocket.request, connection: websocket.connec switch (msg.type) { case 'requestLog': - ev.once('serverStatsLog:' + msg.id, statsLog => { + ev.once(`serverStatsLog:${msg.id}`, statsLog => { connection.send(JSON.stringify({ type: 'statsLog', body: statsLog -- cgit v1.2.3-freya From dc1d7fa9d75dcf00a8e04b9f5ebe7c6262e0c597 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 4 Sep 2018 12:58:35 +0900 Subject: ローカルタイムラインストリームに認証不要で接続できるように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/stream/local-timeline.ts | 6 +++--- src/server/api/streaming.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/server/api/stream') diff --git a/src/server/api/stream/local-timeline.ts b/src/server/api/stream/local-timeline.ts index 82060a7aaa..25e0e00c9f 100644 --- a/src/server/api/stream/local-timeline.ts +++ b/src/server/api/stream/local-timeline.ts @@ -9,10 +9,10 @@ export default async function( request: websocket.request, connection: websocket.connection, subscriber: Xev, - user: IUser + user?: IUser ) { - const mute = await Mute.find({ muterId: user._id }); - const mutedUserIds = mute.map(m => m.muteeId.toString()); + const mute = user ? await Mute.find({ muterId: user._id }) : null; + const mutedUserIds = mute ? mute.map(m => m.muteeId.toString()) : []; // Subscribe stream subscriber.on('local-timeline', async note => { diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts index c8b2d4e0b9..e6094a40b2 100644 --- a/src/server/api/streaming.ts +++ b/src/server/api/streaming.ts @@ -52,6 +52,11 @@ module.exports = (server: http.Server) => { return; } + if (request.resourceURL.pathname === '/local-timeline') { + localTimelineStream(request, connection, ev, user); + return; + } + if (user == null) { connection.send('authentication-failed'); connection.close(); @@ -60,7 +65,6 @@ module.exports = (server: http.Server) => { const channel: any = request.resourceURL.pathname === '/' ? homeStream : - request.resourceURL.pathname === '/local-timeline' ? localTimelineStream : request.resourceURL.pathname === '/hybrid-timeline' ? hybridTimelineStream : request.resourceURL.pathname === '/global-timeline' ? globalTimelineStream : request.resourceURL.pathname === '/user-list' ? userListStream : -- cgit v1.2.3-freya From 1fea2cdcbe341bb56be1cd2b79a8115b482fab65 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 11 Sep 2018 20:57:25 +0900 Subject: Fix bug --- src/server/api/stream/home.ts | 14 +++++++------- src/server/api/stream/hybrid-timeline.ts | 14 +++++++------- src/server/api/stream/local-timeline.ts | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src/server/api/stream') diff --git a/src/server/api/stream/home.ts b/src/server/api/stream/home.ts index dc3ce9d19f..5f3b6744b2 100644 --- a/src/server/api/stream/home.ts +++ b/src/server/api/stream/home.ts @@ -36,6 +36,13 @@ export default async function( // Subscribe Home stream channel subscriber.on(`user-stream:${user._id}`, async x => { + // Renoteなら再pack + if (x.type == 'note' && x.body.renoteId != null) { + x.body.renote = await pack(x.body.renoteId, user, { + detail: true + }); + } + //#region 流れてきたメッセージがミュートしているユーザーが関わるものだったら無視する if (x.type == 'note') { if (mutedUserIds.includes(x.body.userId)) { @@ -54,13 +61,6 @@ export default async function( } //#endregion - // Renoteなら再pack - if (x.type == 'note' && x.body.renoteId != null) { - x.body.renote = await pack(x.body.renoteId, user, { - detail: true - }); - } - connection.send(JSON.stringify(x)); }); diff --git a/src/server/api/stream/hybrid-timeline.ts b/src/server/api/stream/hybrid-timeline.ts index c401145abe..d0dae9b0dd 100644 --- a/src/server/api/stream/hybrid-timeline.ts +++ b/src/server/api/stream/hybrid-timeline.ts @@ -19,6 +19,13 @@ export default async function( subscriber.on(`hybrid-timeline:${user._id}`, onEvent); async function onEvent(note: any) { + // Renoteなら再pack + if (note.renoteId != null) { + note.renote = await pack(note.renoteId, user, { + detail: true + }); + } + //#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する if (mutedUserIds.indexOf(note.userId) != -1) { return; @@ -31,13 +38,6 @@ export default async function( } //#endregion - // Renoteなら再pack - if (note.renoteId != null) { - note.renote = await pack(note.renoteId, user, { - detail: true - }); - } - connection.send(JSON.stringify({ type: 'note', body: note diff --git a/src/server/api/stream/local-timeline.ts b/src/server/api/stream/local-timeline.ts index 25e0e00c9f..e21c071bab 100644 --- a/src/server/api/stream/local-timeline.ts +++ b/src/server/api/stream/local-timeline.ts @@ -16,6 +16,13 @@ export default async function( // Subscribe stream subscriber.on('local-timeline', async note => { + // Renoteなら再pack + if (note.renoteId != null) { + note.renote = await pack(note.renoteId, user, { + detail: true + }); + } + //#region 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する if (mutedUserIds.indexOf(note.userId) != -1) { return; @@ -28,13 +35,6 @@ export default async function( } //#endregion - // Renoteなら再pack - if (note.renoteId != null) { - note.renote = await pack(note.renoteId, user, { - detail: true - }); - } - connection.send(JSON.stringify({ type: 'note', body: note -- cgit v1.2.3-freya From 109738ccb9ef8c203685e6f4bc31986ac2a17046 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 17 Sep 2018 09:00:20 +0900 Subject: ハッシュタグタイムラインを実装 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 5 + src/client/app/common/scripts/streaming/hashtag.ts | 13 +++ .../desktop/views/components/settings-window.vue | 8 +- .../app/desktop/views/components/settings.tags.vue | 65 +++++++++++ .../app/desktop/views/components/settings.vue | 18 +++- .../app/desktop/views/components/timeline.core.vue | 76 +++++++++---- .../app/desktop/views/components/timeline.vue | 119 +++++++++++++++++---- .../desktop/views/pages/deck/deck.column-core.vue | 1 + .../desktop/views/pages/deck/deck.hashtag-tl.vue | 117 ++++++++++++++++++++ .../desktop/views/pages/deck/deck.tl-column.vue | 7 +- src/client/app/desktop/views/pages/deck/deck.vue | 14 +++ .../app/mobile/views/pages/home.timeline.vue | 76 +++++++++---- src/client/app/mobile/views/pages/home.vue | 17 ++- src/client/app/store.ts | 1 + src/server/api/endpoints/notes/search_by_tag.ts | 45 ++++---- src/server/api/stream/hashtag.ts | 48 +++++++++ src/server/api/streaming.ts | 6 ++ src/services/note/create.ts | 6 +- src/stream.ts | 5 + 19 files changed, 555 insertions(+), 92 deletions(-) create mode 100644 src/client/app/common/scripts/streaming/hashtag.ts create mode 100644 src/client/app/desktop/views/components/settings.tags.vue create mode 100644 src/client/app/desktop/views/pages/deck/deck.hashtag-tl.vue create mode 100644 src/server/api/stream/hashtag.ts (limited to 'src/server/api/stream') diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 2a8cfebb57..a3b2bd88e7 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -166,6 +166,7 @@ common: home: "ホーム" local: "ローカル" hybrid: "ソーシャル" + hashtag: "ハッシュタグ" global: "グローバル" mentions: "あなた宛て" notifications: "通知" @@ -916,6 +917,10 @@ desktop/views/components/timeline.vue: global: "グローバル" mentions: "あなた宛て" list: "リスト" + hashtag: "ハッシュタグ" + add-tag-timeline: "ハッシュタグを追加" + add-list: "リストを追加" + list-name: "リスト名" desktop/views/components/ui.header.vue: welcome-back: "おかえりなさい、" diff --git a/src/client/app/common/scripts/streaming/hashtag.ts b/src/client/app/common/scripts/streaming/hashtag.ts new file mode 100644 index 0000000000..276b8f8d3d --- /dev/null +++ b/src/client/app/common/scripts/streaming/hashtag.ts @@ -0,0 +1,13 @@ +import Stream from './stream'; +import MiOS from '../../../mios'; + +export class HashtagStream extends Stream { + constructor(os: MiOS, me, q) { + super(os, 'hashtag', me ? { + i: me.token, + q: JSON.stringify(q) + } : { + q: JSON.stringify(q) + }); + } +} diff --git a/src/client/app/desktop/views/components/settings-window.vue b/src/client/app/desktop/views/components/settings-window.vue index deb865b102..b4cc570282 100644 --- a/src/client/app/desktop/views/components/settings-window.vue +++ b/src/client/app/desktop/views/components/settings-window.vue @@ -1,13 +1,19 @@ + + diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index 3911ec5931..312a7ed56e 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -5,6 +5,7 @@

%fa:desktop .fw%Web

%fa:R bell .fw%%i18n:@notification%

%fa:cloud .fw%%i18n:@drive%

+

%fa:hashtag .fw%%i18n:@tags%

%fa:ban .fw%%i18n:@mute%

%fa:puzzle-piece .fw%%i18n:@apps%

%fa:B twitter .fw%Twitter

@@ -138,6 +139,11 @@ +
+

%i18n:@tags%

+ +
+

%i18n:@mute%

@@ -222,6 +228,7 @@ import XApi from './settings.api.vue'; import XApps from './settings.apps.vue'; import XSignins from './settings.signins.vue'; import XDrive from './settings.drive.vue'; +import XTags from './settings.tags.vue'; import { url, langs, version } from '../../../config'; import checkForUpdate from '../../../common/scripts/check-for-update'; @@ -234,11 +241,18 @@ export default Vue.extend({ XApi, XApps, XSignins, - XDrive + XDrive, + XTags + }, + props: { + initialPage: { + type: String, + required: false + } }, data() { return { - page: 'profile', + page: this.initialPage || 'profile', meta: null, version, langs, diff --git a/src/client/app/desktop/views/components/timeline.core.vue b/src/client/app/desktop/views/components/timeline.core.vue index b6b5cca817..d2176dee87 100644 --- a/src/client/app/desktop/views/components/timeline.core.vue +++ b/src/client/app/desktop/views/components/timeline.core.vue @@ -15,6 +15,7 @@ diff --git a/src/client/app/desktop/views/pages/deck/deck.tl-column.vue b/src/client/app/desktop/views/pages/deck/deck.tl-column.vue index 231b505f5d..550b1be628 100644 --- a/src/client/app/desktop/views/pages/deck/deck.tl-column.vue +++ b/src/client/app/desktop/views/pages/deck/deck.tl-column.vue @@ -6,6 +6,7 @@ + {{ name }} @@ -14,6 +15,7 @@ + @@ -23,12 +25,14 @@ import Vue from 'vue'; import XColumn from './deck.column.vue'; import XTl from './deck.tl.vue'; import XListTl from './deck.list-tl.vue'; +import XHashtagTl from './deck.hashtag-tl.vue'; export default Vue.extend({ components: { XColumn, XTl, - XListTl + XListTl, + XHashtagTl }, props: { @@ -65,6 +69,7 @@ export default Vue.extend({ case 'hybrid': return '%i18n:common.deck.hybrid%'; case 'global': return '%i18n:common.deck.global%'; case 'list': return this.column.list.title; + case 'hashtag': return this.$store.state.settings.tagTimelines.find(x => x.id == this.column.tagTlId).title; } } }, diff --git a/src/client/app/desktop/views/pages/deck/deck.vue b/src/client/app/desktop/views/pages/deck/deck.vue index 4a4535959e..aafe9a45d3 100644 --- a/src/client/app/desktop/views/pages/deck/deck.vue +++ b/src/client/app/desktop/views/pages/deck/deck.vue @@ -161,6 +161,20 @@ export default Vue.extend({ w.close(); }); } + }, { + icon: '%fa:hashtag%', + text: '%i18n:common.deck.hashtag%', + action: () => { + (this as any).apis.input({ + title: '%i18n:@enter-hashtag-tl-title%' + }).then(title => { + this.$store.dispatch('settings/addDeckColumn', { + id: uuid(), + type: 'hashtag', + tagTlId: this.$store.state.settings.tagTimelines.find(x => x.title == title).id + }); + }); + } }, { icon: '%fa:bell R%', text: '%i18n:common.deck.notifications%', diff --git a/src/client/app/mobile/views/pages/home.timeline.vue b/src/client/app/mobile/views/pages/home.timeline.vue index d4fcea1f93..fecb2384ba 100644 --- a/src/client/app/mobile/views/pages/home.timeline.vue +++ b/src/client/app/mobile/views/pages/home.timeline.vue @@ -13,6 +13,7 @@