diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-03-09 14:28:01 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-03-09 14:28:01 +0900 |
| commit | be7e3b9a0cb81b78a744993fef2fa2fd2833fa9c (patch) | |
| tree | c82e18ce93ec0a24c57d7e36eb54a09266b3a25b /packages/frontend/src/scripts/please-login.ts | |
| parent | enhnace(frontend): 文字列比較のためのローマナイズを強化(... (diff) | |
| download | sharkey-be7e3b9a0cb81b78a744993fef2fa2fd2833fa9c.tar.gz sharkey-be7e3b9a0cb81b78a744993fef2fa2fd2833fa9c.tar.bz2 sharkey-be7e3b9a0cb81b78a744993fef2fa2fd2833fa9c.zip | |
refactor(frontend): scripts -> utility
Diffstat (limited to 'packages/frontend/src/scripts/please-login.ts')
| -rw-r--r-- | packages/frontend/src/scripts/please-login.ts | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/packages/frontend/src/scripts/please-login.ts b/packages/frontend/src/scripts/please-login.ts deleted file mode 100644 index a8a330eb6d..0000000000 --- a/packages/frontend/src/scripts/please-login.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and misskey-project - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { defineAsyncComponent } from 'vue'; -import { $i } from '@/account.js'; -import { instance } from '@/instance.js'; -import { i18n } from '@/i18n.js'; -import { popup } from '@/os.js'; - -export type OpenOnRemoteOptions = { - /** - * 外部のMisskey Webで特定のパスを開く - */ - type: 'web'; - - /** - * 内部パス(例: `/settings`) - */ - path: string; -} | { - /** - * 外部のMisskey Webで照会する - */ - type: 'lookup'; - - /** - * 照会したいエンティティのURL - * - * (例: `https://misskey.example.com/notes/abcdexxxxyz`) - */ - url: string; -} | { - /** - * 外部のMisskeyでノートする - */ - type: 'share'; - - /** - * `/share` ページに渡すクエリストリング - * - * @see https://go.misskey-hub.net/spec/share/ - */ - params: Record<string, string>; -}; - -export function pleaseLogin(opts: { - path?: string; - message?: string; - openOnRemote?: OpenOnRemoteOptions; -} = {}) { - if ($i) return; - - let _openOnRemote: OpenOnRemoteOptions | undefined = undefined; - - // 連合できる場合と、(連合ができなくても)共有する場合は外部連携オプションを設定 - if (opts.openOnRemote != null && (instance.federation !== 'none' || opts.openOnRemote.type === 'share')) { - _openOnRemote = opts.openOnRemote; - } - - const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), { - autoSet: true, - message: opts.message ?? (_openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired), - openOnRemote: _openOnRemote, - }, { - cancelled: () => { - if (opts.path) { - window.location.href = opts.path; - } - }, - closed: () => dispose(), - }); - - throw new Error('signin required'); -} |