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/streaming.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/server/api/streaming.ts') 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 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/streaming.ts') 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 @@