enhance(frontend): リモートで開くオプション

This commit is contained in:
kakkokari-gtyih 2024-12-10 15:35:04 +09:00
parent 0ac6e05008
commit 6acc27687d

View File

@ -5,6 +5,7 @@
import { defineAsyncComponent } from 'vue'; import { defineAsyncComponent } from 'vue';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { instance } from '@/instance.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { popup } from '@/os.js'; import { popup } from '@/os.js';
@ -51,10 +52,17 @@ export function pleaseLogin(opts: {
} = {}) { } = {}) {
if ($i) return; 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')), { const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {
autoSet: true, autoSet: true,
message: opts.message ?? (opts.openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired), message: opts.message ?? (_openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired),
openOnRemote: opts.openOnRemote, openOnRemote: _openOnRemote,
}, { }, {
cancelled: () => { cancelled: () => {
if (opts.path) { if (opts.path) {