diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6b71acb1c..b45ca0faf 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -673,6 +673,7 @@ narrow: "狭い" reloadToApplySetting: "設定はページリロード後に反映されます。今すぐリロードしますか?" showTitlebar: "タイトルバーを表示する" clearCache: "キャッシュをクリア" +onlineUsersCount: "{n}人がオンライン" _aboutMisskey: about: "Misskeyはsyuiloによって2014年から開発されている、オープンソースのソフトウェアです。" @@ -1015,6 +1016,7 @@ _widgets: postForm: "投稿フォーム" slideshow: "スライドショー" button: "ボタン" + onlineUsers: "オンラインユーザー" _cw: hide: "隠す" diff --git a/src/client/components/global/i18n.ts b/src/client/components/global/i18n.ts index b1142caf9..abf0c9685 100644 --- a/src/client/components/global/i18n.ts +++ b/src/client/components/global/i18n.ts @@ -11,6 +11,11 @@ export default defineComponent({ required: false, default: 'span', }, + textTag: { + type: String, + required: false, + default: null, + }, }, render() { let str = this.src; @@ -32,6 +37,6 @@ export default defineComponent({ str = str.substr(nextBracketClose + 1); } - return h(this.tag, parsed.map(x => typeof x === 'string' ? x : this.$slots[x.arg]())); + return h(this.tag, parsed.map(x => typeof x === 'string' ? (this.textTag ? h(this.textTag, x) : x) : this.$slots[x.arg]())); } }); diff --git a/src/client/components/page-window.vue b/src/client/components/page-window.vue index 5ea0e0801..37342c403 100644 --- a/src/client/components/page-window.vue +++ b/src/client/components/page-window.vue @@ -1,6 +1,6 @@ + + diff --git a/src/server/api/endpoints/get-online-users-count.ts b/src/server/api/endpoints/get-online-users-count.ts new file mode 100644 index 000000000..752110488 --- /dev/null +++ b/src/server/api/endpoints/get-online-users-count.ts @@ -0,0 +1,22 @@ +import define from '../define'; +import redis from '../../../db/redis'; +import config from '../../../config'; + +export const meta = { + tags: ['meta'], + + requireCredential: false as const, + + params: { + } +}; + +export default define(meta, (ps, user) => { + return new Promise((res, rej) => { + redis.pubsub('numsub', config.host, (_, x) => { + res({ + count: x[1] + }); + }); + }); +});