From c978fd9faf3d299b3c32013877c3d8bca0f89887 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 29 Jun 2023 18:05:27 -0700 Subject: [PATCH 1/3] fix: :bug: fix tapping parent on mobile causing side effects --- packages/client/src/components/MkMenu.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/MkMenu.vue b/packages/client/src/components/MkMenu.vue index dea14ef05..aa3a3a300 100644 --- a/packages/client/src/components/MkMenu.vue +++ b/packages/client/src/components/MkMenu.vue @@ -130,7 +130,7 @@ class="_button item parent" :class="{ childShowing: childShowingItem === item }" @mouseenter="showChildren(item, $event)" - @click="showChildren(item, $event)" + @click.stop="showChildren(item, $event)" > Date: Thu, 29 Jun 2023 19:12:42 -0700 Subject: [PATCH 2/3] fix: :bug: standard input for 2FA token Closes #10361, removes client dependency --- locales/en-US.yml | 1 + locales/ja-JP.yml | 1 + packages/client/package.json | 1 - packages/client/src/components/MkSignin.vue | 20 ++++++----- packages/client/src/style.scss | 40 ++++++++++----------- pnpm-lock.yaml | 12 ------- 6 files changed, 33 insertions(+), 42 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index c1854ba06..cc327c5aa 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1513,6 +1513,7 @@ _2fa: renewTOTPConfirm: "This will cause verification codes from your previous app to stop working" renewTOTPOk: "Reconfigure" renewTOTPCancel: "Cancel" + token: "2FA Token" _permissions: "read:account": "View your account information" "write:account": "Edit your account information" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 617930db1..21f616808 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1336,6 +1336,7 @@ _2fa: renewTOTPConfirm: "今までの認証アプリの確認コードは使用できなくなります" renewTOTPOk: "再設定する" renewTOTPCancel: "やめておく" + token: "多要素認証トークン" _permissions: "read:account": "アカウントの情報を見る" "write:account": "アカウントの情報を変更する" diff --git a/packages/client/package.json b/packages/client/package.json index a843d63ed..2ec569381 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -89,7 +89,6 @@ "vue-isyourpasswordsafe": "^2.0.0", "vue-plyr": "^7.0.0", "vue-prism-editor": "2.0.0-alpha.2", - "vue3-otp-input": "^0.4.1", "vuedraggable": "4.1.0" } } diff --git a/packages/client/src/components/MkSignin.vue b/packages/client/src/components/MkSignin.vue index 27de73c49..cebfda8d3 100644 --- a/packages/client/src/components/MkSignin.vue +++ b/packages/client/src/components/MkSignin.vue @@ -99,17 +99,19 @@ > - + > + + + =16.0.0', npm: '>=8.0.0'} - peerDependencies: - vue: ^3.0.* - dependencies: - vue: 3.3.4 - dev: true - /vue@2.7.14: resolution: {integrity: sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==} dependencies: From 3dc1af2b7cf1744f73897f0825cd577170676107 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Thu, 29 Jun 2023 19:53:46 -0700 Subject: [PATCH 3/3] feat: :sparkles: introduce local user select dialog Used for selecting group members and proxy account. Closes #7987, API change: users/search-by-username-and-host now takes `maxDaysSinceLastActive` parameter and doesn't have any active threshold anymore by default. --- .../users/search-by-username-and-host.ts | 17 +- .../components/MkUserSelectLocalDialog.vue | 223 ++++++++++++++++++ packages/client/src/os.ts | 19 ++ .../client/src/pages/admin/proxy-account.vue | 19 +- packages/client/src/pages/my-groups/group.vue | 4 +- 5 files changed, 273 insertions(+), 9 deletions(-) create mode 100644 packages/client/src/components/MkUserSelectLocalDialog.vue diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index eeccf6938..f34083233 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -32,6 +32,12 @@ export const paramDef = { username: { type: "string", nullable: true }, host: { type: "string", nullable: true }, limit: { type: "integer", minimum: 1, maximum: 100, default: 10 }, + maxDaysSinceLastActive: { + type: "integer", + minimum: 1, + maximum: 1000, + default: 30, + }, detail: { type: "boolean", default: true }, }, anyOf: [{ required: ["username"] }, { required: ["host"] }], @@ -40,7 +46,9 @@ export const paramDef = { // TODO: avatar,bannerをJOINしたいけどエラーになる export default define(meta, paramDef, async (ps, me) => { - const activeThreshold = new Date(Date.now() - 1000 * 60 * 60 * 24 * 30); // 30日 + const activeThreshold = ps.maxDaysSinceLastActive + ? new Date(Date.now() - 1000 * 60 * 60 * 24 * ps.maxDaysSinceLastActive) + : null; if (ps.host) { const q = Users.createQueryBuilder("user") @@ -75,8 +83,10 @@ export default define(meta, paramDef, async (ps, me) => { .andWhere("user.isSuspended = FALSE") .andWhere("user.usernameLower LIKE :username", { username: `${sqlLikeEscape(ps.username.toLowerCase())}%`, - }) - .andWhere( + }); + + if (activeThreshold) { + query.andWhere( new Brackets((qb) => { qb.where("user.updatedAt IS NULL").orWhere( "user.updatedAt > :activeThreshold", @@ -84,6 +94,7 @@ export default define(meta, paramDef, async (ps, me) => { ); }), ); + } query.setParameters(followingQuery.getParameters()); diff --git a/packages/client/src/components/MkUserSelectLocalDialog.vue b/packages/client/src/components/MkUserSelectLocalDialog.vue new file mode 100644 index 000000000..e74a63da2 --- /dev/null +++ b/packages/client/src/components/MkUserSelectLocalDialog.vue @@ -0,0 +1,223 @@ + + + + + diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 32bb8f76b..0802d8e34 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -631,6 +631,25 @@ export async function selectUser() { }); } +export async function selectLocalUser() { + return new Promise((resolve, reject) => { + popup( + defineAsyncComponent({ + loader: () => import("@/components/MkUserSelectLocalDialog.vue"), + loadingComponent: MkWaitingDialog, + delay: 1000, + }), + {}, + { + ok: (user) => { + resolve(user); + }, + }, + "closed", + ); + }); +} + export async function selectInstance(): Promise { return new Promise((resolve, reject) => { popup( diff --git a/packages/client/src/pages/admin/proxy-account.vue b/packages/client/src/pages/admin/proxy-account.vue index 87b3c684e..7d72b0ac0 100644 --- a/packages/client/src/pages/admin/proxy-account.vue +++ b/packages/client/src/pages/admin/proxy-account.vue @@ -20,12 +20,15 @@ }} - {{ i18n.ts.selectAccount }}{{ i18n.ts.selectAccount }} + {{ + i18n.ts.remove + }} @@ -34,7 +37,7 @@