Skip to content

Commit

Permalink
enhance(frontend): 外部アプリ認証画面の改良 (misskey-dev#14828)
Browse files Browse the repository at this point in the history
Cherry-picked from 076cc95

Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
  • Loading branch information
u1-liquid and kakkokari-gtyih committed Nov 5, 2024
1 parent 557f45b commit f2c1be7
Show file tree
Hide file tree
Showing 14 changed files with 964 additions and 226 deletions.
30 changes: 30 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,33 @@ keepOriginalFilenameDescription: "If you turn off this setting, files names will
noDescription: "There is not the explanation"
alwaysConfirmFollow: "Always confirm when following"
inquiry: "Contact"
tryAgain: "Please try again later"
confirmWhenRevealingSensitiveMedia: "Confirm when revealing sensitive media"
sensitiveMediaRevealConfirm: "This might be a sensitive media. Are you sure to reveal?"
createdLists: "Created lists"
createdAntennas: "Created antennas"
fromX: "From {x}"
genEmbedCode: "Generate embed code"
noteOfThisUser: "Notes by this user"
clipNoteLimitExceeded: "No more notes can be added to this clip."
performance: "Performance"
modified: "Modified"
discard: "Discard"
thereAreNChanges: "There are {n} change(s)"
signinWithPasskey: "Sign in with Passkey"
unknownWebAuthnKey: "Unknown Passkey"
passkeyVerificationFailed: "Passkey verification has failed."
passkeyVerificationSucceededButPasswordlessLoginDisabled: "Passkey verification has succeeded but password-less login is disabled."
messageToFollower: "Message to followers"
target: "Target"
testCaptchaWarning: "This function is intended for CAPTCHA testing purposes.\n<strong>Do not use in a production environment.</strong>"
prohibitedWordsForNameOfUser: "Prohibited words for user names"
prohibitedWordsForNameOfUserDescription: "If any of the strings in this list are included in the user's name, the name will be denied. Users with moderator privileges are not affected by this restriction."
yourNameContainsProhibitedWords: "Your name contains prohibited words"
yourNameContainsProhibitedWordsDescription: "If you wish to use this name, please contact your server administrator."
thisContentsAreMarkedAsSigninRequiredByAuthor: "Set by the author to require login to view"
lockdown: "Lockdown"
pleaseSelectAccount: "Select an account"
here: "here"
mutualLink: "Mutual Link"
saveThisFile: "Save this file to Drive"
Expand Down Expand Up @@ -2184,8 +2211,11 @@ _auth:
permissionAsk: "This application requests the following permissions"
pleaseGoBack: "Please go back to the application"
callback: "Returning to the application"
accepted: "Access granted"
denied: "Access denied"
scopeUser: "Operate as the following user"
pleaseLogin: "Please log in to authorize applications."
byClickingYouWillBeRedirectedToThisUrl: "When access is granted, you will automatically be redirected to the following URL"
_antennaSources:
all: "All notes"
homeTimeline: "Notes from followed users"
Expand Down
120 changes: 120 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5114,6 +5114,114 @@ export interface Locale extends ILocale {
* お問い合わせ
*/
"inquiry": string;
/**
* もう一度お試しください。
*/
"tryAgain": string;
/**
* センシティブなメディアを表示するとき確認する
*/
"confirmWhenRevealingSensitiveMedia": string;
/**
* センシティブなメディアです。表示しますか?
*/
"sensitiveMediaRevealConfirm": string;
/**
* 作成したリスト
*/
"createdLists": string;
/**
* 作成したアンテナ
*/
"createdAntennas": string;
/**
* {x}から
*/
"fromX": ParameterizedString<"x">;
/**
* 埋め込みコードを生成
*/
"genEmbedCode": string;
/**
* このユーザーのノート一覧
*/
"noteOfThisUser": string;
/**
* これ以上このクリップにノートを追加できません。
*/
"clipNoteLimitExceeded": string;
/**
* パフォーマンス
*/
"performance": string;
/**
* 変更あり
*/
"modified": string;
/**
* 破棄
*/
"discard": string;
/**
* {n}件の変更があります
*/
"thereAreNChanges": ParameterizedString<"n">;
/**
* パスキーでログイン
*/
"signinWithPasskey": string;
/**
* 登録されていないパスキーです。
*/
"unknownWebAuthnKey": string;
/**
* パスキーの検証に失敗しました。
*/
"passkeyVerificationFailed": string;
/**
* パスキーの検証に成功しましたが、パスワードレスログインが無効になっています。
*/
"passkeyVerificationSucceededButPasswordlessLoginDisabled": string;
/**
* フォロワーへのメッセージ
*/
"messageToFollower": string;
/**
* 対象
*/
"target": string;
/**
* CAPTCHAのテストを目的とした機能です。<strong>本番環境で使用しないでください。</strong>
*/
"testCaptchaWarning": string;
/**
* 禁止ワード(ユーザーの名前)
*/
"prohibitedWordsForNameOfUser": string;
/**
* このリストに含まれる文字列がユーザーの名前に含まれる場合、ユーザーの名前の変更を拒否します。モデレーター権限を持つユーザーはこの制限の影響を受けません。
*/
"prohibitedWordsForNameOfUserDescription": string;
/**
* 変更しようとした名前に禁止された文字列が含まれています
*/
"yourNameContainsProhibitedWords": string;
/**
* 名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。
*/
"yourNameContainsProhibitedWordsDescription": string;
/**
* 投稿者により、表示にはログインが必要と設定されています
*/
"thisContentsAreMarkedAsSigninRequiredByAuthor": string;
/**
* ロックダウン
*/
"lockdown": string;
/**
* アカウントを選択してください
*/
"pleaseSelectAccount": string;
/**
* 通報の種類
*/
Expand Down Expand Up @@ -8525,14 +8633,26 @@ export interface Locale extends ILocale {
* アプリケーションに戻っています
*/
"callback": string;
/**
* アクセスを許可しました
*/
"accepted": string;
/**
* アクセスを拒否しました
*/
"denied": string;
/**
* 以下のユーザーとして操作しています
*/
"scopeUser": string;
/**
* アプリケーションにアクセス許可を与えるには、ログインが必要です。
*/
"pleaseLogin": string;
/**
* アクセスを許可すると、自動で以下のURLに遷移します
*/
"byClickingYouWillBeRedirectedToThisUrl": string;
};
"_antennaSources": {
/**
Expand Down
30 changes: 30 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,33 @@ keepOriginalFilenameDescription: "この設定をオフにすると、アップ
noDescription: "説明文はありません"
alwaysConfirmFollow: "フォローの際常に確認する"
inquiry: "お問い合わせ"
tryAgain: "もう一度お試しください。"
confirmWhenRevealingSensitiveMedia: "センシティブなメディアを表示するとき確認する"
sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?"
createdLists: "作成したリスト"
createdAntennas: "作成したアンテナ"
fromX: "{x}から"
genEmbedCode: "埋め込みコードを生成"
noteOfThisUser: "このユーザーのノート一覧"
clipNoteLimitExceeded: "これ以上このクリップにノートを追加できません。"
performance: "パフォーマンス"
modified: "変更あり"
discard: "破棄"
thereAreNChanges: "{n}件の変更があります"
signinWithPasskey: "パスキーでログイン"
unknownWebAuthnKey: "登録されていないパスキーです。"
passkeyVerificationFailed: "パスキーの検証に失敗しました。"
passkeyVerificationSucceededButPasswordlessLoginDisabled: "パスキーの検証に成功しましたが、パスワードレスログインが無効になっています。"
messageToFollower: "フォロワーへのメッセージ"
target: "対象"
testCaptchaWarning: "CAPTCHAのテストを目的とした機能です。<strong>本番環境で使用しないでください。</strong>"
prohibitedWordsForNameOfUser: "禁止ワード(ユーザーの名前)"
prohibitedWordsForNameOfUserDescription: "このリストに含まれる文字列がユーザーの名前に含まれる場合、ユーザーの名前の変更を拒否します。モデレーター権限を持つユーザーはこの制限の影響を受けません。"
yourNameContainsProhibitedWords: "変更しようとした名前に禁止された文字列が含まれています"
yourNameContainsProhibitedWordsDescription: "名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。"
thisContentsAreMarkedAsSigninRequiredByAuthor: "投稿者により、表示にはログインが必要と設定されています"
lockdown: "ロックダウン"
pleaseSelectAccount: "アカウントを選択してください"
abuseReportCategory: "通報の種類"
selectCategory: "カテゴリを選択"
reportComplete: "通報完了"
Expand Down Expand Up @@ -2230,8 +2257,11 @@ _auth:
permissionAsk: "このアプリは次の権限を要求しています"
pleaseGoBack: "アプリケーションに戻ってやっていってください"
callback: "アプリケーションに戻っています"
accepted: "アクセスを許可しました"
denied: "アクセスを拒否しました"
scopeUser: "以下のユーザーとして操作しています"
pleaseLogin: "アプリケーションにアクセス許可を与えるには、ログインが必要です。"
byClickingYouWillBeRedirectedToThisUrl: "アクセスを許可すると、自動で以下のURLに遷移します"

_antennaSources:
all: "全てのノート"
Expand Down
34 changes: 34 additions & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,37 @@ useTotp: "일회용 비밀번호 사용"
useBackupCode: "백업 코드 사용"
launchApp: "앱 실행"
useNativeUIForVideoAudioPlayer: "브라우저 UI에서 미디어 재생"
keepOriginalFilename: "원본 파일 이름을 유지"
keepOriginalFilenameDescription: "이 설정을 끄면 업로드를 할 때 파일 이름이 자동으로 무작위 문자열로 바뀝니다."
noDescription: "설명문이 없습니다"
alwaysConfirmFollow: "팔로우일 때 항상 확인하기"
inquiry: "문의하기"
tryAgain: "다시 시도해 주세요."
confirmWhenRevealingSensitiveMedia: "민감한 미디어를 열 때 두 번 확인"
sensitiveMediaRevealConfirm: "민감한 미디어입니다. 표시할까요?"
createdLists: "만든 리스트"
createdAntennas: "만든 안테나"
fromX: "{x}부터"
genEmbedCode: "임베디드 코드 만들기"
noteOfThisUser: "이 유저의 노트 목록"
clipNoteLimitExceeded: "더 이상 이 클립에 노트를 추가 할 수 없습니다."
performance: "퍼포먼스"
modified: "변경 있음"
discard: "파기"
thereAreNChanges: "{n}건 변경이 있습니다."
signinWithPasskey: "패스키로 로그인"
unknownWebAuthnKey: "등록되지 않은 패스키입니다."
passkeyVerificationFailed: "패스키 검증을 실패했습니다."
passkeyVerificationSucceededButPasswordlessLoginDisabled: "패스키를 검증했으나, 비밀번호 없이 로그인하기가 꺼져 있습니다."
messageToFollower: "팔로워에 보낼 메시지"
target: "대상"
testCaptchaWarning: "CAPTCHA를 테스트하기 위한 기능입니다. <strong>실제 환경에서는 사용하지 마세요.</strong>"
prohibitedWordsForNameOfUser: "금지 단어 (사용자 이름)"
prohibitedWordsForNameOfUserDescription: "이 목록에 포함되는 키워드가 사용자 이름에 있는 경우, 일반 사용자는 이름을 바꿀 수 없습니다. 모더레이터 권한을 가진 사용자는 제한 대상에서 제외됩니다."
yourNameContainsProhibitedWords: "바꾸려는 이름에 금지된 키워드가 포함되어 있습니다."
yourNameContainsProhibitedWordsDescription: "이름에 금지된 키워드가 있습니다. 이름을 사용해야 하는 경우, 서버 관리자에 문의하세요."
lockdown: "잠금"
pleaseSelectAccount: "계정을 선택해 주세요"
here: "여기"
mutualLink: "서로링크"
saveThisFile: "이 파일을 드라이브에 저장"
Expand Down Expand Up @@ -2166,8 +2197,11 @@ _auth:
permissionAsk: "이 앱은 다음의 권한을 요청합니다"
pleaseGoBack: "앱으로 돌아가서 시도해 주세요"
callback: "앱으로 돌아갑니다"
accepted: "접근이 허가되었습니다"
denied: "접근이 거부되었습니다"
scopeUser: "다음 사용자로서 작업 중"
pleaseLogin: "어플리케이션의 접근을 허가하려면 로그인하십시오."
byClickingYouWillBeRedirectedToThisUrl: "접근을 허가하면 자동으로 다음 URL로 이동합니다"
_antennaSources:
all: "모든 노트"
homeTimeline: "팔로우중인 유저의 노트"
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/_boot_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '@/style.scss';
import { mainBoot } from '@/boot/main-boot.js';
import { subBoot } from '@/boot/sub-boot.js';

const subBootPaths = ['/share', '/auth', '/miauth', '/signup-complete'];
const subBootPaths = ['/share', '/auth', '/miauth', '/oauth', '/sso', '/signup-complete'];

if (subBootPaths.some(i => location.pathname === i || location.pathname.startsWith(i + '/'))) {
subBoot();
Expand Down
68 changes: 48 additions & 20 deletions packages/frontend/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,24 +232,6 @@ export async function openAccountMenu(opts: {
}, ev: MouseEvent) {
if (!$i) return;

function showSigninDialog() {
popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {}, {
done: res => {
addAccount(res.id, res.i);
success();
},
}, 'closed');
}

function createAccount() {
popup(defineAsyncComponent(() => import('@/components/MkSignupDialog.vue')), {}, {
done: res => {
addAccount(res.id, res.i);
switchAccountWithToken(res.i);
},
}, 'closed');
}

async function switchAccount(account: Misskey.entities.UserDetailed) {
const storedAccounts = await getAccounts();
const found = storedAccounts.find(x => x.id === account.id);
Expand Down Expand Up @@ -306,10 +288,22 @@ export async function openAccountMenu(opts: {
text: i18n.ts.addAccount,
children: [{
text: i18n.ts.existingAccount,
action: () => { showSigninDialog(); },
action: () => {
getAccountWithSigninDialog().then(res => {
if (res != null) {
success();
}
});
},
}, {
text: i18n.ts.createAccount,
action: () => { createAccount(); },
action: () => {
getAccountWithSignupDialog().then(res => {
if (res != null) {
switchAccountWithToken(res.token);
}
});
},
}],
}, {
type: 'link' as const,
Expand All @@ -326,6 +320,40 @@ export async function openAccountMenu(opts: {
}
}

export function getAccountWithSigninDialog(): Promise<{ id: string, token: string } | null> {
return new Promise((resolve) => {
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {}, {
done: async (res: Misskey.entities.SigninFlowResponse & { finished: true }) => {
await addAccount(res.id, res.i);
resolve({ id: res.id, token: res.i });
},
cancelled: () => {
resolve(null);
},
closed: () => {
dispose();
},
});
});
}

export function getAccountWithSignupDialog(): Promise<{ id: string, token: string } | null> {
return new Promise((resolve) => {
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSignupDialog.vue')), {}, {
done: async (res: Misskey.entities.SignupResponse) => {
await addAccount(res.id, res.token);
resolve({ id: res.id, token: res.token });
},
cancelled: () => {
resolve(null);
},
closed: () => {
dispose();
},
});
});
}

if (_DEV_) {
(window as any).$i = $i;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

import MkAuthConfirm from './MkAuthConfirm.vue';
void MkAuthConfirm;
Loading

0 comments on commit f2c1be7

Please sign in to comment.