From fa0814f9393b3a15869df8d780e91bc6f03d112e Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 28 Oct 2021 22:00:38 +0900 Subject: [PATCH 1/2] fix e2e test --- cypress/integration/basic.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress/integration/basic.js b/cypress/integration/basic.js index 182f70ff68..a754f41b98 100644 --- a/cypress/integration/basic.js +++ b/cypress/integration/basic.js @@ -128,7 +128,8 @@ describe('After user signup', () => { cy.get('[data-cy-signin-username] input').type('alice'); cy.get('[data-cy-signin-password] input').type('alice1234{enter}'); - cy.contains('アカウントが凍結されています'); + // TODO: cypressにブラウザの言語指定できる機能が実装され次第英語のみテストするようにする + cy.contains(/アカウントが凍結されています|This account has been suspended due to/gi); }); }); From 4f7ae81d5f20d392ec2fb9df6542446a1659ad48 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 29 Oct 2021 00:55:07 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=99=E3=82=8B=E3=82=A2=E3=82=AB=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=AEID=E3=82=92=E3=82=AF=E3=82=A8=E3=83=AA?= =?UTF-8?q?=E6=96=87=E5=AD=97=E5=88=97=E3=81=A7=E6=8C=87=E5=AE=9A=E3=81=99?= =?UTF-8?q?=E3=82=8B=E6=A9=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/init.ts | 21 +++++++++++++++++++++ src/client/scripts/login-id.ts | 11 +++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/client/scripts/login-id.ts diff --git a/src/client/init.ts b/src/client/init.ts index 123d4020e1..e64804e54b 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -37,6 +37,8 @@ import { isMobile } from '@client/scripts/is-mobile'; import { initializeSw } from '@client/scripts/initialize-sw'; import { reloadChannel } from '@client/scripts/unison-reload'; import { reactionPicker } from '@client/scripts/reaction-picker'; +import { deleteLoginId } from '@client/scripts/login-id'; +import { getAccountFromId } from '@client/scripts/get-account-from-id'; console.info(`Misskey v${version}`); @@ -116,6 +118,25 @@ const html = document.documentElement; html.setAttribute('lang', lang); //#endregion +//#region loginId +const params = new URLSearchParams(location.search); +const loginId = params.get('loginId'); + +if (loginId) { + const target = deleteLoginId(location.href); + + if (!$i || $i.id !== loginId) { + const account = await getAccountFromId(loginId); + if (account) { + login(account.token, target); + } + } + + history.replaceState({ misskey: 'loginId' }, '', target); +} + +//#endregion + //#region Fetch user if ($i && $i.token) { if (_DEV_) { diff --git a/src/client/scripts/login-id.ts b/src/client/scripts/login-id.ts new file mode 100644 index 0000000000..50e5229558 --- /dev/null +++ b/src/client/scripts/login-id.ts @@ -0,0 +1,11 @@ +export function appendLoginId(url: string, loginId: string) { + const u = new URL(url, origin); + u.searchParams.append('loginId', loginId); + return u.toString(); +} + +export function deleteLoginId(url: string) { + const u = new URL(url); + u.searchParams.delete('loginId'); + return u.toString(); +}