Skip to content

Commit

Permalink
enhance(frontend): リモートで開くオプション
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih committed Dec 10, 2024
1 parent 0ac6e05 commit 6acc276
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/frontend/src/scripts/please-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { defineAsyncComponent } from 'vue';
import { $i } from '@/account.js';
import { instance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { popup } from '@/os.js';

Expand Down Expand Up @@ -51,10 +52,17 @@ export function pleaseLogin(opts: {
} = {}) {
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 ?? (opts.openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired),
openOnRemote: opts.openOnRemote,
message: opts.message ?? (_openOnRemote ? i18n.ts.signinOrContinueOnRemote : i18n.ts.signinRequired),
openOnRemote: _openOnRemote,
}, {
cancelled: () => {
if (opts.path) {
Expand Down

0 comments on commit 6acc276

Please sign in to comment.