From ffaec0b9712df9a5024c0883a154442f02b72a03 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 28 Aug 2017 23:47:43 +0900 Subject: #497 --- src/web/app/common/scripts/home-stream.js | 6 ++++++ src/web/app/common/tags/api-info.tag | 27 ----------------------- src/web/app/common/tags/index.js | 1 - src/web/app/desktop/scripts/password-dialog.js | 11 ++++++++++ src/web/app/desktop/tags/input-dialog.tag | 7 +++++- src/web/app/desktop/tags/settings.tag | 30 ++++++++++++++++++++++++++ src/web/app/mobile/tags/page/settings/api.tag | 19 ++++++++++++++++ 7 files changed, 72 insertions(+), 29 deletions(-) delete mode 100644 src/web/app/common/tags/api-info.tag create mode 100644 src/web/app/desktop/scripts/password-dialog.js (limited to 'src/web') diff --git a/src/web/app/common/scripts/home-stream.js b/src/web/app/common/scripts/home-stream.js index 24f13cd291..c54cbd7f19 100644 --- a/src/web/app/common/scripts/home-stream.js +++ b/src/web/app/common/scripts/home-stream.js @@ -1,6 +1,7 @@ 'use strict'; import Stream from './stream'; +import signout from './signout'; /** * Home stream connection @@ -12,6 +13,11 @@ class Connection extends Stream { }); this.on('i_updated', me.update); + + this.on('my_token_regenerated', () => { + alert('%i18n:common.my-token-regenerated%'); + signout(); + }); } } diff --git a/src/web/app/common/tags/api-info.tag b/src/web/app/common/tags/api-info.tag deleted file mode 100644 index 612f20a7a8..0000000000 --- a/src/web/app/common/tags/api-info.tag +++ /dev/null @@ -1,27 +0,0 @@ - -

Token:{ I.token }

-

APIを利用するには、上記のトークンを「i」というキーでパラメータに付加してリクエストします。

-

アカウントを乗っ取られてしまう可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。

-

万が一このトークンが漏れたりその可能性がある場合は - できます。(副作用として、ログインしているすべてのデバイスでログアウトが発生します) -

- - -
diff --git a/src/web/app/common/tags/index.js b/src/web/app/common/tags/index.js index 5dc4ef4546..1ee8dab42d 100644 --- a/src/web/app/common/tags/index.js +++ b/src/web/app/common/tags/index.js @@ -14,7 +14,6 @@ require('./forkit.tag'); require('./introduction.tag'); require('./copyright.tag'); require('./signin-history.tag'); -require('./api-info.tag'); require('./twitter-setting.tag'); require('./authorized-apps.tag'); require('./poll.tag'); diff --git a/src/web/app/desktop/scripts/password-dialog.js b/src/web/app/desktop/scripts/password-dialog.js new file mode 100644 index 0000000000..2bdc93e421 --- /dev/null +++ b/src/web/app/desktop/scripts/password-dialog.js @@ -0,0 +1,11 @@ +import * as riot from 'riot'; + +export default (title, onOk, onCancel) => { + const dialog = document.body.appendChild(document.createElement('mk-input-dialog')); + return riot.mount(dialog, { + title: title, + type: 'password', + onOk: onOk, + onCancel: onCancel + }); +}; diff --git a/src/web/app/desktop/tags/input-dialog.tag b/src/web/app/desktop/tags/input-dialog.tag index f343c4625a..78fd62ee8b 100644 --- a/src/web/app/desktop/tags/input-dialog.tag +++ b/src/web/app/desktop/tags/input-dialog.tag @@ -5,7 +5,7 @@
- +
@@ -126,6 +126,7 @@ this.placeholder = this.opts.placeholder; this.default = this.opts.default; this.allowEmpty = this.opts.allowEmpty != null ? this.opts.allowEmpty : true; + this.type = this.opts.type ? this.opts.type : 'text'; this.on('mount', () => { this.text = this.refs.window.refs.text; @@ -156,6 +157,10 @@ this.refs.window.close(); }; + this.onInput = () => { + this.update(); + }; + this.onKeydown = e => { if (e.which == 13) { // Enter e.preventDefault(); diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index a89cfda0e4..7fc6acb4a8 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -211,3 +211,33 @@ }; + + +

Token:{ I.token }

+

APIを利用するには、上記のトークンを「i」というキーでパラメータに付加してリクエストします。

+

アカウントを乗っ取られてしまう可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。

+

万が一このトークンが漏れたりその可能性がある場合はトークンを再生成できます。(副作用として、ログインしているすべてのデバイスでログアウトが発生します)

+ + +
diff --git a/src/web/app/mobile/tags/page/settings/api.tag b/src/web/app/mobile/tags/page/settings/api.tag index 46419eb3db..25413e2d80 100644 --- a/src/web/app/mobile/tags/page/settings/api.tag +++ b/src/web/app/mobile/tags/page/settings/api.tag @@ -15,3 +15,22 @@ }); + + +

Token:{ I.token }

+

APIを利用するには、上記のトークンを「i」というキーでパラメータに付加してリクエストします。

+

アカウントを乗っ取られてしまう可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。

+

万が一このトークンが漏れたりその可能性がある場合はデスクトップ版Misskeyから再生成できます。

+ + +
-- cgit v1.2.3-freya