mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-15 18:35:42 +02:00
* enhance: 非ログイン時にはMisskey Hub経由で別サーバーに遷移できるように * fix * サーバーサイド照会を削除 * クライアント側の照会動作 * hubを経由せずにリモートで続行できるように * fix と pleaseLogin誘導箇所の追加 * fix * fix * Update CHANGELOG.md --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
40 lines
888 B
TypeScript
40 lines
888 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { defineAsyncComponent } from 'vue';
|
|
import { $i } from '@/account.js';
|
|
import { i18n } from '@/i18n.js';
|
|
import { popup } from '@/os.js';
|
|
|
|
export type OpenOnRemoteOptions = {
|
|
type: 'web';
|
|
path: string;
|
|
} | {
|
|
type: 'lookup';
|
|
path: string;
|
|
} | {
|
|
type: 'share';
|
|
params: Record<string, string>;
|
|
};
|
|
|
|
export function pleaseLogin(path?: string, openOnRemote?: OpenOnRemoteOptions) {
|
|
if ($i) return;
|
|
|
|
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {
|
|
autoSet: true,
|
|
message: openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired,
|
|
openOnRemote,
|
|
}, {
|
|
cancelled: () => {
|
|
if (path) {
|
|
window.location.href = path;
|
|
}
|
|
},
|
|
closed: () => dispose(),
|
|
});
|
|
|
|
throw new Error('signin required');
|
|
}
|