diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-08-30 17:45:23 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-08-30 17:45:23 +0900 |
| commit | 7fe0abc5cec71759807a41f383606dd156f11d88 (patch) | |
| tree | 47047bcfd5d49fcba1d1b8cb3007df56b4678cd2 /src | |
| parent | :v: (diff) | |
| download | sharkey-7fe0abc5cec71759807a41f383606dd156f11d88.tar.gz sharkey-7fe0abc5cec71759807a41f383606dd156f11d88.tar.bz2 sharkey-7fe0abc5cec71759807a41f383606dd156f11d88.zip | |
Implement #745
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/stream/home.ts | 10 | ||||
| -rw-r--r-- | src/web/app/common/scripts/home-stream.js | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/api/stream/home.ts b/src/api/stream/home.ts index 2ab8d3025b..d5fe01c261 100644 --- a/src/api/stream/home.ts +++ b/src/api/stream/home.ts @@ -2,6 +2,7 @@ import * as websocket from 'websocket'; import * as redis from 'redis'; import * as debug from 'debug'; +import User from '../models/user'; import serializePost from '../serializers/post'; const log = debug('misskey'); @@ -35,6 +36,15 @@ export default function homeStream(request: websocket.request, connection: webso const msg = JSON.parse(data.utf8Data); switch (msg.type) { + case 'alive': + // Update lastUsedAt + User.update({ _id: user._id }, { + $set: { + last_used_at: new Date() + } + }); + break; + case 'capture': if (!msg.id) return; const postId = msg.id; diff --git a/src/web/app/common/scripts/home-stream.js b/src/web/app/common/scripts/home-stream.js index c54cbd7f19..de9ceb3b51 100644 --- a/src/web/app/common/scripts/home-stream.js +++ b/src/web/app/common/scripts/home-stream.js @@ -12,6 +12,11 @@ class Connection extends Stream { i: me.token }); + // 最終利用日時を更新するため定期的にaliveメッセージを送信 + setInterval(() => { + this.send({ type: 'alive' }); + }, 1000 * 60); + this.on('i_updated', me.update); this.on('my_token_regenerated', () => { |