diff --git a/src/web/app/common/define-widget.ts b/src/web/app/common/define-widget.ts index 6088efd7e5..930a7c5868 100644 --- a/src/web/app/common/define-widget.ts +++ b/src/web/app/common/define-widget.ts @@ -2,7 +2,7 @@ import Vue from 'vue'; export default function(data: { name: string; - props?: T; + props?: () => T; }) { return Vue.extend({ props: { @@ -17,20 +17,9 @@ export default function(data: { }, data() { return { - props: data.props || {} as T + props: data.props ? data.props() : {} as T }; }, - watch: { - props(newProps, oldProps) { - if (JSON.stringify(newProps) == JSON.stringify(oldProps)) return; - (this as any).api('i/update_home', { - id: this.id, - data: newProps - }).then(() => { - (this as any).os.i.client_settings.home.find(w => w.id == this.id).data = newProps; - }); - } - }, created() { if (this.props) { Object.keys(this.props).forEach(prop => { @@ -39,6 +28,18 @@ export default function(data: { } }); } + + this.$watch('props', newProps => { + console.log(this.id, newProps); + (this as any).api('i/update_home', { + id: this.id, + data: newProps + }).then(() => { + (this as any).os.i.client_settings.home.find(w => w.id == this.id).data = newProps; + }); + }, { + deep: true + }); } }); } diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index c4208aa913..4b9375f548 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -1,9 +1,8 @@ import { EventEmitter } from 'eventemitter3'; -import * as riot from 'riot'; +import api from './scripts/api'; import signout from './scripts/signout'; import Progress from './scripts/loading'; import HomeStreamManager from './scripts/streaming/home-stream-manager'; -import api from './scripts/api'; import DriveStreamManager from './scripts/streaming/drive-stream-manager'; import ServerStreamManager from './scripts/streaming/server-stream-manager'; import RequestsStreamManager from './scripts/streaming/requests-stream-manager'; @@ -226,22 +225,8 @@ export default class MiOS extends EventEmitter { // フェッチが完了したとき const fetched = me => { if (me) { - riot.observable(me); - - // この me オブジェクトを更新するメソッド - me.update = data => { - if (data) Object.assign(me, data); - me.trigger('updated'); - }; - // ローカルストレージにキャッシュ localStorage.setItem('me', JSON.stringify(me)); - - // 自分の情報が更新されたとき - me.on('updated', () => { - // キャッシュ更新 - localStorage.setItem('me', JSON.stringify(me)); - }); } this.i = me; @@ -270,8 +255,6 @@ export default class MiOS extends EventEmitter { // 後から新鮮なデータをフェッチ fetchme(cachedMe.token, freshData => { Object.assign(cachedMe, freshData); - cachedMe.trigger('updated'); - cachedMe.trigger('refreshed'); }); } else { // Get token from cookie diff --git a/src/web/app/common/scripts/streaming/home-stream.ts b/src/web/app/common/scripts/streaming/home-stream.ts index 11ad754ef0..a92b61caed 100644 --- a/src/web/app/common/scripts/streaming/home-stream.ts +++ b/src/web/app/common/scripts/streaming/home-stream.ts @@ -16,7 +16,9 @@ export default class Connection extends Stream { }, 1000 * 60); // 自分の情報が更新されたとき - this.on('i_updated', me.update); + this.on('i_updated', i => { + Object.assign(me, i); + }); // トークンが再生成されたとき // このままではAPIが利用できないので強制的にサインアウトさせる diff --git a/src/web/app/desktop/-tags/home-widgets/channel.tag b/src/web/app/desktop/-tags/home-widgets/channel.tag deleted file mode 100644 index c20a851e79..0000000000 --- a/src/web/app/desktop/-tags/home-widgets/channel.tag +++ /dev/null @@ -1,318 +0,0 @@ - - -

%i18n:desktop.tags.mk-channel-home-widget.get-started%

- - - -
- - -

読み込み中

-
-

まだ投稿がありません

- -
- - - -
- - -
- { post.index }: - { post.user.name } - ID:{ post.user.username } -
-
- >>{ post.reply.index } - { post.text } -
- -
-
- - -
- - - - - - diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index b647f4031d..4f2ac61ee2 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -23,6 +23,7 @@ import MkIndex from './views/pages/index.vue'; import MkUser from './views/pages/user/user.vue'; import MkSelectDrive from './views/pages/selectdrive.vue'; import MkDrive from './views/pages/drive.vue'; +import MkHomeCustomize from './views/pages/home-customize.vue'; /** * init @@ -66,6 +67,8 @@ init(async (launch) => { app.$router.addRoutes([{ path: '/', name: 'index', component: MkIndex + }, { + path: '/i/customize-home', component: MkHomeCustomize }, { path: '/i/drive', component: MkDrive }, { diff --git a/src/web/app/desktop/views/components/calendar.vue b/src/web/app/desktop/views/components/calendar.vue index a21d3e6148..08b08f8d42 100644 --- a/src/web/app/desktop/views/components/calendar.vue +++ b/src/web/app/desktop/views/components/calendar.vue @@ -1,5 +1,5 @@