refactoe
This commit is contained in:
parent
506c8a259b
commit
120af977a9
|
@ -29,7 +29,7 @@ import MkButton from '@/components/MkButton.vue';
|
||||||
|
|
||||||
const state = ref<'fetching' | 'done'>('fetching');
|
const state = ref<'fetching' | 'done'>('fetching');
|
||||||
|
|
||||||
function fetch() {
|
function _fetch_() {
|
||||||
const params = new URL(window.location.href).searchParams;
|
const params = new URL(window.location.href).searchParams;
|
||||||
|
|
||||||
// acctのほうはdeprecated
|
// acctのほうはdeprecated
|
||||||
|
@ -44,20 +44,18 @@ function fetch() {
|
||||||
if (uri.startsWith('https://')) {
|
if (uri.startsWith('https://')) {
|
||||||
promise = misskeyApi('ap/show', {
|
promise = misskeyApi('ap/show', {
|
||||||
uri,
|
uri,
|
||||||
});
|
}).then(res => {
|
||||||
|
|
||||||
promise.then(res => {
|
|
||||||
if (res.type === 'User') {
|
if (res.type === 'User') {
|
||||||
mainRouter.replace('/@:acct/:page?', {
|
mainRouter.replace('/@:acct/:page?', {
|
||||||
params: {
|
params: {
|
||||||
acct: res.host != null ? `${res.object.username}@${res.object.host}` : res.object.username,
|
acct: res.host != null ? `${res.object.username}@${res.object.host}` : res.object.username,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
} else if (res.type === 'Note') {
|
} else if (res.type === 'Note') {
|
||||||
mainRouter.replace('/notes/:noteId/:initialTab?', {
|
mainRouter.replace('/notes/:noteId/:initialTab?', {
|
||||||
params: {
|
params: {
|
||||||
noteId: res.object.id,
|
noteId: res.object.id,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
os.alert({
|
os.alert({
|
||||||
|
@ -70,12 +68,11 @@ function fetch() {
|
||||||
if (uri.startsWith('acct:')) {
|
if (uri.startsWith('acct:')) {
|
||||||
uri = uri.slice(5);
|
uri = uri.slice(5);
|
||||||
}
|
}
|
||||||
promise = misskeyApi('users/show', Misskey.acct.parse(uri));
|
promise = misskeyApi('users/show', Misskey.acct.parse(uri)).then(user => {
|
||||||
promise.then(user => {
|
|
||||||
mainRouter.replace('/@:acct/:page?', {
|
mainRouter.replace('/@:acct/:page?', {
|
||||||
params: {
|
params: {
|
||||||
acct: user.host != null ? `${user.username}@${user.host}` : user.username,
|
acct: user.host != null ? `${user.username}@${user.host}` : user.username,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -96,7 +93,7 @@ function goToMisskey(): void {
|
||||||
window.location.href = '/';
|
window.location.href = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch();
|
_fetch_();
|
||||||
|
|
||||||
const headerActions = computed(() => []);
|
const headerActions = computed(() => []);
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<div v-if="items.length > 0" class="_gaps">
|
<div v-if="items.length > 0" class="_gaps">
|
||||||
<MkA v-for="list in items" :key="list.id" class="_panel" :class="$style.list" :to="`/my/lists/${ list.id }`">
|
<MkA v-for="list in items" :key="list.id" class="_panel" :class="$style.list" :to="`/my/lists/${ list.id }`">
|
||||||
<div style="margin-bottom: 4px;">{{ list.name }} <span :class="$style.nUsers">({{ i18n.tsx.nUsers({ n: `${list.userIds.length}/${$i.policies['userEachUserListsLimit']}` }) }})</span></div>
|
<div style="margin-bottom: 4px;">{{ list.name }} <span :class="$style.nUsers">({{ i18n.tsx.nUsers({ n: `${list.userIds!.length}/${$i.policies['userEachUserListsLimit']}` }) }})</span></div>
|
||||||
<MkAvatars :userIds="list.userIds" :limit="10"/>
|
<MkAvatars :userIds="list.userIds!" :limit="10"/>
|
||||||
</MkA>
|
</MkA>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,7 +50,7 @@ async function create() {
|
||||||
const { canceled, result: name } = await os.inputText({
|
const { canceled, result: name } = await os.inputText({
|
||||||
title: i18n.ts.enterListName,
|
title: i18n.ts.enterListName,
|
||||||
});
|
});
|
||||||
if (canceled) return;
|
if (canceled || name == null) return;
|
||||||
await os.apiWithDialog('users/lists/create', { name: name });
|
await os.apiWithDialog('users/lists/create', { name: name });
|
||||||
userListsCache.delete();
|
userListsCache.delete();
|
||||||
fetch();
|
fetch();
|
||||||
|
|
|
@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<MkFolder defaultOpen>
|
<MkFolder defaultOpen>
|
||||||
<template #label>{{ i18n.ts.members }}</template>
|
<template #label>{{ i18n.ts.members }}</template>
|
||||||
<template #caption>{{ i18n.tsx.nUsers({ n: `${list.userIds.length}/${$i.policies['userEachUserListsLimit']}` }) }}</template>
|
<template #caption>{{ i18n.tsx.nUsers({ n: `${list.userIds!.length}/${$i.policies['userEachUserListsLimit']}` }) }}</template>
|
||||||
|
|
||||||
<div class="_gaps_s">
|
<div class="_gaps_s">
|
||||||
<MkButton rounded primary style="margin: 0 auto;" @click="addUser()">{{ i18n.ts.addUser }}</MkButton>
|
<MkButton rounded primary style="margin: 0 auto;" @click="addUser()">{{ i18n.ts.addUser }}</MkButton>
|
||||||
|
|
|
@ -31,7 +31,7 @@ import { Paginator } from '@/utility/paginator.js';
|
||||||
|
|
||||||
const tab = ref('all');
|
const tab = ref('all');
|
||||||
const includeTypes = ref<string[] | null>(null);
|
const includeTypes = ref<string[] | null>(null);
|
||||||
const excludeTypes = computed(() => includeTypes.value ? notificationTypes.filter(t => !includeTypes.value.includes(t)) : null);
|
const excludeTypes = computed(() => includeTypes.value ? notificationTypes.filter(t => !includeTypes.value!.includes(t)) : null);
|
||||||
|
|
||||||
const mentionsPaginator = markRaw(new Paginator('notes/mentions', {
|
const mentionsPaginator = markRaw(new Paginator('notes/mentions', {
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
@ -71,7 +71,7 @@ const headerActions = computed(() => [tab.value === 'all' ? {
|
||||||
text: i18n.ts.markAllAsRead,
|
text: i18n.ts.markAllAsRead,
|
||||||
icon: 'ti ti-check',
|
icon: 'ti ti-check',
|
||||||
handler: () => {
|
handler: () => {
|
||||||
os.apiWithDialog('notifications/mark-all-as-read');
|
os.apiWithDialog('notifications/mark-all-as-read', {});
|
||||||
},
|
},
|
||||||
} : undefined].filter(x => x !== undefined));
|
} : undefined].filter(x => x !== undefined));
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<div v-if="$i.twoFactorEnabled" class="_gaps_s">
|
<div v-if="$i.twoFactorEnabled" class="_gaps_s">
|
||||||
<div v-text="i18n.ts._2fa.alreadyRegistered"/>
|
<div v-text="i18n.ts._2fa.alreadyRegistered"/>
|
||||||
<template v-if="$i.securityKeysList.length > 0">
|
<template v-if="$i.securityKeysList!.length > 0">
|
||||||
<MkButton @click="renewTOTP">{{ i18n.ts._2fa.renewTOTP }}</MkButton>
|
<MkButton @click="renewTOTP">{{ i18n.ts._2fa.renewTOTP }}</MkButton>
|
||||||
<MkInfo>{{ i18n.ts._2fa.whyTOTPOnlyRenew }}</MkInfo>
|
<MkInfo>{{ i18n.ts._2fa.whyTOTPOnlyRenew }}</MkInfo>
|
||||||
</template>
|
</template>
|
||||||
|
@ -58,7 +58,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<MkButton primary @click="addSecurityKey">{{ i18n.ts._2fa.registerSecurityKey }}</MkButton>
|
<MkButton primary @click="addSecurityKey">{{ i18n.ts._2fa.registerSecurityKey }}</MkButton>
|
||||||
<MkFolder v-for="key in $i.securityKeysList" :key="key.id">
|
<MkFolder v-for="key in $i.securityKeysList!" :key="key.id">
|
||||||
<template #label>{{ key.name }}</template>
|
<template #label>{{ key.name }}</template>
|
||||||
<template #suffix><I18n :src="i18n.ts.lastUsedAt"><template #t><MkTime :time="key.lastUsed"/></template></I18n></template>
|
<template #suffix><I18n :src="i18n.ts.lastUsedAt"><template #t><MkTime :time="key.lastUsed"/></template></I18n></template>
|
||||||
<div class="_buttons">
|
<div class="_buttons">
|
||||||
|
@ -72,7 +72,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</SearchMarker>
|
</SearchMarker>
|
||||||
|
|
||||||
<SearchMarker :keywords="['password', 'less', 'key', 'passkey', 'login', 'signin']">
|
<SearchMarker :keywords="['password', 'less', 'key', 'passkey', 'login', 'signin']">
|
||||||
<MkSwitch :disabled="!$i.twoFactorEnabled || $i.securityKeysList.length === 0" :modelValue="usePasswordLessLogin" @update:modelValue="v => updatePasswordLessLogin(v)">
|
<MkSwitch :disabled="!$i.twoFactorEnabled || $i.securityKeysList!.length === 0" :modelValue="usePasswordLessLogin" @update:modelValue="v => updatePasswordLessLogin(v)">
|
||||||
<template #label><SearchLabel>{{ i18n.ts.passwordLessLogin }}</SearchLabel></template>
|
<template #label><SearchLabel>{{ i18n.ts.passwordLessLogin }}</SearchLabel></template>
|
||||||
<template #caption><SearchText>{{ i18n.ts.passwordLessLoginDescription }}</SearchText></template>
|
<template #caption><SearchText>{{ i18n.ts.passwordLessLoginDescription }}</SearchText></template>
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
|
|
|
@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<!--<MkButton @click="refreshAllAccounts"><i class="ti ti-refresh"></i></MkButton>-->
|
<!--<MkButton @click="refreshAllAccounts"><i class="ti ti-refresh"></i></MkButton>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MkUserCardMini v-for="x in accounts" :key="x[0] + x[1].id" :user="x[1]" :class="$style.user" @click.prevent="menu(x[0], x[1], $event)"/>
|
<MkUserCardMini v-for="x in accounts" :key="x[0] + x[1].id" :user="x[1]" :class="$style.user" @click.prevent="showMenu(x[0], x[1], $event)"/>
|
||||||
</div>
|
</div>
|
||||||
</SearchMarker>
|
</SearchMarker>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,7 +36,7 @@ function refreshAllAccounts() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
function menu(host: string, account: Misskey.entities.UserDetailed, ev: MouseEvent) {
|
function showMenu(host: string, account: Misskey.entities.UserDetailed, ev: MouseEvent) {
|
||||||
let menu: MenuItem[];
|
let menu: MenuItem[];
|
||||||
|
|
||||||
menu = [{
|
menu = [{
|
||||||
|
|
|
@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
<template #label>{{ token.name }}</template>
|
<template #label>{{ token.name }}</template>
|
||||||
<template #caption>{{ token.description }}</template>
|
<template #caption>{{ token.description }}</template>
|
||||||
<template #suffix><MkTime :time="token.lastUsedAt"/></template>
|
<template v-if="token.lastUsedAt != null" #suffix><MkTime :time="token.lastUsedAt"/></template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<MkButton danger @click="revoke(token)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
<MkButton danger @click="revoke(token)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
||||||
</template>
|
</template>
|
||||||
|
@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #key>{{ i18n.ts.installedDate }}</template>
|
<template #key>{{ i18n.ts.installedDate }}</template>
|
||||||
<template #value><MkTime :time="token.createdAt" :mode="'detail'"/></template>
|
<template #value><MkTime :time="token.createdAt" :mode="'detail'"/></template>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
<MkKeyValue oneline>
|
<MkKeyValue v-if="token.lastUsedAt != null" oneline>
|
||||||
<template #key>{{ i18n.ts.lastUsedDate }}</template>
|
<template #key>{{ i18n.ts.lastUsedDate }}</template>
|
||||||
<template #value><MkTime :time="token.lastUsedAt" :mode="'detail'"/></template>
|
<template #value><MkTime :time="token.lastUsedAt" :mode="'detail'"/></template>
|
||||||
</MkKeyValue>
|
</MkKeyValue>
|
||||||
|
|
|
@ -74,7 +74,7 @@ import { instance } from '@/instance.js';
|
||||||
|
|
||||||
const $i = ensureSignin();
|
const $i = ensureSignin();
|
||||||
|
|
||||||
const emailAddress = ref($i.email);
|
const emailAddress = ref($i.email ?? '');
|
||||||
|
|
||||||
const onChangeReceiveAnnouncementEmail = (v) => {
|
const onChangeReceiveAnnouncementEmail = (v) => {
|
||||||
misskeyApi('i/update', {
|
misskeyApi('i/update', {
|
||||||
|
|
Loading…
Reference in New Issue