Merge branch 'develop' into cgsama-patch-1

This commit is contained in:
cgsama 2023-06-30 06:40:53 +00:00
commit 42ede2ce6a
15 changed files with 320 additions and 63 deletions

View File

@ -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"

View File

@ -1336,6 +1336,7 @@ _2fa:
renewTOTPConfirm: "今までの認証アプリの確認コードは使用できなくなります"
renewTOTPOk: "再設定する"
renewTOTPCancel: "やめておく"
token: "多要素認証トークン"
_permissions:
"read:account": "アカウントの情報を見る"
"write:account": "アカウントの情報を変更する"

View File

@ -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());

View File

@ -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"
}
}

View File

@ -65,7 +65,7 @@ function chosen(emoji: any) {
}
function opening() {
picker.value?.reset();
// picker.value?.reset();
picker.value?.focus();
}
</script>

View File

@ -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)"
>
<i
v-if="item.icon"

View File

@ -224,7 +224,7 @@
</div>
</article>
</div>
<button v-else class="muted _button" @click="muted.muted = false">
<button v-else class="muted _button" @click="muted.muted = false" @contextmenu.stop.prevent>
<I18n :src="softMuteReasonI18nSrc(muted.what)" tag="small">
<template #name>
<MkA
@ -954,5 +954,8 @@ defineExpose({
._blur_text {
pointer-events: auto;
}
&:active ._blur_text {
filter: blur(0px);
}
}
</style>

View File

@ -99,17 +99,19 @@
><i class="ph-lock ph-bold ph-lg"></i
></template>
</MkInput>
<vue3-otp-input
input-classes="_otp_input"
inputType="letter-numeric"
separator=""
:num-inputs="6"
<MkInput
v-model="token"
:should-auto-focus="true"
@on-change="updateToken"
@on-complete="onSubmit"
type="text"
autocomplete="one-time-code"
pattern="^[0-9]{6}$"
:spellcheck="false"
required
/>
>
<template #label>{{ i18n.ts._2fa.token }}</template>
<template #prefix
><i class="ph-poker-chip ph-bold ph-lg"></i
></template>
</MkInput>
<MkButton
type="submit"
:disabled="signing"

View File

@ -0,0 +1,223 @@
<template>
<XModalWindow
ref="dialogEl"
:with-ok-button="true"
:ok-button-disabled="selected == null"
@click="cancel()"
@close="cancel()"
@ok="ok()"
@closed="$emit('closed')"
>
<template #header>{{ i18n.ts.selectUser }}</template>
<div class="tbhwbxdg">
<div class="form">
<FormSplit :min-width="170">
<MkInput
v-model="username"
:autofocus="true"
@update:modelValue="search"
>
<template #label>{{ i18n.ts.username }}</template>
<template #prefix>@</template>
</MkInput>
</FormSplit>
</div>
<div
v-if="username != '' || host != ''"
class="result"
:class="{ hit: users.length > 0 }"
>
<div v-if="users.length > 0" class="users">
<div
v-for="user in users"
:key="user.id"
class="user"
:class="{
selected: selected && selected.id === user.id,
}"
@click="selected = user"
@dblclick="ok()"
>
<MkAvatar
:user="user"
class="avatar"
:show-indicator="true"
disableLink
/>
<div class="body">
<MkUserName :user="user" class="name" />
<MkAcct :user="user" class="acct" />
</div>
</div>
</div>
<div v-else class="empty">
<span>{{ i18n.ts.noUsers }}</span>
</div>
</div>
<div v-if="username == '' && host == ''" class="recent">
<div class="users">
<div
v-for="user in recentUsers"
:key="user.id"
class="user"
:class="{
selected: selected && selected.id === user.id,
}"
@click="selected = user"
@dblclick="ok()"
>
<MkAvatar
:user="user"
class="avatar"
:show-indicator="true"
disableLink
/>
<div class="body">
<MkUserName :user="user" class="name" />
<MkAcct :user="user" class="acct" />
</div>
</div>
</div>
</div>
</div>
</XModalWindow>
</template>
<script lang="ts" setup>
import { nextTick, onMounted } from "vue";
import * as misskey from "calckey-js";
import MkInput from "@/components/form/input.vue";
import FormSplit from "@/components/form/split.vue";
import XModalWindow from "@/components/MkModalWindow.vue";
import * as os from "@/os";
import { defaultStore } from "@/store";
import { i18n } from "@/i18n";
const emit = defineEmits<{
(ev: "ok", selected: misskey.entities.UserDetailed): void;
(ev: "cancel"): void;
(ev: "closed"): void;
}>();
let username = $ref("");
let host = $ref("");
let users: misskey.entities.UserDetailed[] = $ref([]);
let recentUsers: misskey.entities.UserDetailed[] = $ref([]);
let selected: misskey.entities.UserDetailed | null = $ref(null);
let dialogEl = $ref();
const search = () => {
if (username === "" && host === "") {
users = [];
return;
}
os.api("users/search-by-username-and-host", {
username: username,
host: null,
limit: 10,
detail: false,
}).then((_users) => {
users = _users;
});
};
const ok = () => {
if (selected == null) return;
emit("ok", selected);
dialogEl.close();
// 使
let recents = defaultStore.state.recentlyUsedUsers;
recents = recents.filter((x) => x !== selected.id);
recents.unshift(selected.id);
defaultStore.set("recentlyUsedUsers", recents.splice(0, 16));
};
const cancel = () => {
emit("cancel");
dialogEl.close();
};
onMounted(() => {
os.api("users/show", {
userIds: defaultStore.state.recentlyUsedUsers,
}).then((users) => {
recentUsers = users;
});
});
</script>
<style lang="scss" scoped>
.tbhwbxdg {
> .form {
padding: 0 var(--root-margin);
}
> .result,
> .recent {
display: flex;
flex-direction: column;
overflow: auto;
height: 100%;
&.result.hit {
padding: 0;
}
&.recent {
padding: 0;
}
> .users {
flex: 1;
overflow: auto;
padding: 8px 0;
> .user {
display: flex;
align-items: center;
padding: 8px var(--root-margin);
font-size: 14px;
&:hover {
background: var(--X7);
}
&.selected {
background: var(--accent);
color: #fff;
}
> * {
pointer-events: none;
user-select: none;
}
> .avatar {
width: 45px;
height: 45px;
}
> .body {
padding: 0 8px;
min-width: 0;
> .name {
display: block;
font-weight: bold;
}
> .acct {
opacity: 0.5;
}
}
}
}
> .empty {
opacity: 0.7;
text-align: center;
}
}
}
</style>

View File

@ -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<Misskey.entities.Instance> {
return new Promise((resolve, reject) => {
popup(

View File

@ -20,12 +20,15 @@
}}</template>
</MkKeyValue>
<FormButton
<MkButton
primary
class="_formBlock"
@click="chooseProxyAccount"
>{{ i18n.ts.selectAccount }}</FormButton
>{{ i18n.ts.selectAccount }}</MkButton
>
<MkButton danger class="_formBlock" @click="del">{{
i18n.ts.remove
}}</MkButton>
</FormSuspense>
</MkSpacer>
</MkStickyContainer>
@ -34,7 +37,7 @@
<script lang="ts" setup>
import {} from "vue";
import MkKeyValue from "@/components/MkKeyValue.vue";
import FormButton from "@/components/MkButton.vue";
import MkButton from "@/components/MkButton.vue";
import MkInfo from "@/components/MkInfo.vue";
import FormSuspense from "@/components/form/suspense.vue";
import * as os from "@/os";
@ -54,7 +57,7 @@ async function init() {
}
function chooseProxyAccount() {
os.selectUser().then((user) => {
os.selectLocalUser().then((user) => {
proxyAccount = user;
proxyAccountId = user.id;
save();
@ -69,6 +72,14 @@ function save() {
});
}
function del() {
os.apiWithDialog("admin/update-meta", {
proxyAccountId: null,
}).then(() => {
fetchInstance();
});
}
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);

View File

@ -77,7 +77,7 @@ async function fetch() {
fetch();
function invite() {
os.selectUser().then((user) => {
os.selectLocalUser().then((user) => {
os.apiWithDialog("users/groups/invite", {
groupId: group.value.id,
userId: user.id,
@ -110,7 +110,7 @@ async function renameGroup() {
}
function transfer() {
os.selectUser().then((user) => {
os.selectLocalUser().then((user) => {
os.apiWithDialog("users/groups/transfer", {
groupId: group.value.id,
userId: user.id,

View File

@ -1,5 +1,6 @@
import data from "unicode-emoji-json/data-by-group.json";
import emojiComponents from "unicode-emoji-json/data-emoji-components.json";
import individualData from "unicode-emoji-json/data-by-emoji.json";
import keywordSet from "emojilib";
import { defaultStore } from "@/store";
@ -36,8 +37,6 @@ export const categoryMapping = {
} as const;
export function addSkinTone(emoji: string, skinTone?: number) {
const individualData = import("unicode-emoji-json/data-by-emoji.json");
const chosenSkinTone = skinTone || defaultStore.state.reactionPickerSkinTone;
const skinToneModifiers = [
"",
@ -47,15 +46,15 @@ export function addSkinTone(emoji: string, skinTone?: number) {
emojiComponents.medium_dark_skin_tone,
emojiComponents.dark_skin_tone,
];
if (individualData[emoji]?.skin_tone_support === false) {
const strippedEmoji = emoji.replace(
new RegExp(`(${skinToneModifiers.slice(1).join("|")})`, "gi"),
"",
);
if (individualData[strippedEmoji].skin_tone_support) {
return strippedEmoji + (skinToneModifiers[chosenSkinTone - 1] || "");
} else {
return emoji;
}
return (
emoji.replace(
new RegExp(`(${skinToneModifiers.slice(1).join("|")})`, "gi"),
"",
) + (skinToneModifiers[chosenSkinTone - 1] || "")
);
}
const unicodeFifteenEmojis = [

View File

@ -865,26 +865,26 @@ hr {
}
}
._otp_input {
width: 30px;
height: 30px;
padding: 5px;
margin: 1rem 7px auto;
font-size: 20px;
border-radius: 4px;
border: 2px solid var(--accent);
background-color: var(--accentedBg);
color: var(--fg);
text-align: center;
}
._otp_input.error {
border-color: var(--error) !important;
}
._otp_input::-webkit-inner-spin-button,
._otp_input::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
// ._otp_input {
// width: 30px;
// height: 30px;
// padding: 5px;
// margin: 1rem 7px auto;
// font-size: 20px;
// border-radius: 4px;
// border: 2px solid var(--accent);
// background-color: var(--accentedBg);
// color: var(--fg);
// text-align: center;
// }
// ._otp_input.error {
// border-color: var(--error) !important;
// }
// ._otp_input::-webkit-inner-spin-button,
// ._otp_input::-webkit-outer-spin-button {
// -webkit-appearance: none;
// margin: 0;
// }
@keyframes reset {
to {

View File

@ -916,9 +916,6 @@ importers:
vue-prism-editor:
specifier: 2.0.0-alpha.2
version: 2.0.0-alpha.2(vue@3.3.4)
vue3-otp-input:
specifier: ^0.4.1
version: 0.4.1(vue@3.3.4)
vuedraggable:
specifier: 4.1.0
version: 4.1.0(vue@3.3.4)
@ -15076,15 +15073,6 @@ packages:
vue: 3.3.4
dev: true
/vue3-otp-input@0.4.1(vue@3.3.4):
resolution: {integrity: sha512-wVl9i3DcWlO0C7fBI9V+RIP3crm/1tY72fuhvb3YM2JfbLoYofB96aPl5AgFhA0Cse5bQEMYtIvOeiqW3rfbAw==}
engines: {node: '>=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: