refactor
This commit is contained in:
parent
782c9f9852
commit
3c998e1f48
|
@ -25,12 +25,12 @@ defineProps<{
|
|||
showing: boolean;
|
||||
x: number;
|
||||
y: number;
|
||||
title?: string;
|
||||
title?: string | null;
|
||||
series?: {
|
||||
backgroundColor: string;
|
||||
borderColor: string;
|
||||
text: string;
|
||||
}[];
|
||||
}[] | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
|
|
@ -15,7 +15,7 @@ import * as Misskey from 'misskey-js';
|
|||
import MkMediaList from '@/components/MkMediaList.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
block: Misskey.entities.PageBlock,
|
||||
block: Extract<Misskey.entities.PageBlock, { type: 'image' }>,
|
||||
page: Misskey.entities.Page,
|
||||
}>();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import MkNoteDetailed from '@/components/MkNoteDetailed.vue';
|
|||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
|
||||
const props = defineProps<{
|
||||
block: Misskey.entities.PageBlock,
|
||||
block: Extract<Misskey.entities.PageBlock, { type: 'note' }>,
|
||||
page: Misskey.entities.Page,
|
||||
}>();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import * as Misskey from 'misskey-js';
|
|||
const XBlock = defineAsyncComponent(() => import('./page.block.vue'));
|
||||
|
||||
defineProps<{
|
||||
block: Misskey.entities.PageBlock,
|
||||
block: Extract<Misskey.entities.PageBlock, { type: 'section' }>,
|
||||
h: number,
|
||||
page: Misskey.entities.Page,
|
||||
}>();
|
||||
|
|
|
@ -22,7 +22,7 @@ import { isEnabledUrlPreview } from '@/utility/url-preview.js';
|
|||
const MkUrlPreview = defineAsyncComponent(() => import('@/components/MkUrlPreview.vue'));
|
||||
|
||||
const props = defineProps<{
|
||||
block: Misskey.entities.PageBlock,
|
||||
block: Extract<Misskey.entities.PageBlock, { type: 'text' }>,
|
||||
page: Misskey.entities.Page,
|
||||
}>();
|
||||
|
||||
|
|
|
@ -51,3 +51,9 @@ export async function fetchInstance(force = false): Promise<Misskey.entities.Met
|
|||
|
||||
return instance;
|
||||
}
|
||||
|
||||
export type ClientOptions = {
|
||||
entrancePageStyle: 'classic' | 'simple';
|
||||
showTimelineForVisitor: boolean;
|
||||
showActivitiesForVisitor: boolean;
|
||||
};
|
||||
|
|
|
@ -152,6 +152,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
import { ref, computed } from 'vue';
|
||||
import JSON5 from 'json5';
|
||||
import { host } from '@@/js/config.js';
|
||||
import type { ClientOptions } from '@/instance.js';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkTextarea from '@/components/MkTextarea.vue';
|
||||
import * as os from '@/os.js';
|
||||
|
@ -166,9 +167,13 @@ import MkSwitch from '@/components/MkSwitch.vue';
|
|||
|
||||
const meta = await misskeyApi('admin/meta');
|
||||
|
||||
const entrancePageStyle = ref(meta.clientOptions.entrancePageStyle ?? 'classic');
|
||||
const showTimelineForVisitor = ref(meta.clientOptions.showTimelineForVisitor ?? true);
|
||||
const showActivitiesForVisitor = ref(meta.clientOptions.showActivitiesForVisitor ?? true);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const entrancePageStyle = ref<ClientOptions['entrancePageStyle']>(meta.clientOptions.entrancePageStyle ?? 'classic');
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const showTimelineForVisitor = ref<ClientOptions['showTimelineForVisitor']>(meta.clientOptions.showTimelineForVisitor ?? true);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const showActivitiesForVisitor = ref<ClientOptions['showActivitiesForVisitor']>(meta.clientOptions.showActivitiesForVisitor ?? true);
|
||||
|
||||
const iconUrl = ref(meta.iconUrl);
|
||||
const app192IconUrl = ref(meta.app192IconUrl);
|
||||
const app512IconUrl = ref(meta.app512IconUrl);
|
||||
|
@ -186,11 +191,11 @@ const manifestJsonOverride = ref(meta.manifestJsonOverride === '' ? '{}' : JSON.
|
|||
|
||||
function save() {
|
||||
os.apiWithDialog('admin/update-meta', {
|
||||
clientOptions: {
|
||||
clientOptions: ({
|
||||
entrancePageStyle: entrancePageStyle.value,
|
||||
showTimelineForVisitor: showTimelineForVisitor.value,
|
||||
showActivitiesForVisitor: showActivitiesForVisitor.value,
|
||||
},
|
||||
} as ClientOptions) as any,
|
||||
iconUrl: iconUrl.value,
|
||||
app192IconUrl: app192IconUrl.value,
|
||||
app512IconUrl: app512IconUrl.value,
|
||||
|
|
|
@ -107,7 +107,7 @@ const smtpPass = ref(meta.smtpPass);
|
|||
|
||||
async function testEmail() {
|
||||
const { canceled, result: destination } = await os.inputText({
|
||||
title: i18n.ts.destination,
|
||||
title: 'To',
|
||||
type: 'email',
|
||||
default: instance.maintainerEmail ?? '',
|
||||
placeholder: 'test@example.com',
|
||||
|
|
|
@ -81,10 +81,10 @@ function onStats(stats: Misskey.entities.QueueStats) {
|
|||
delayed.value = stats[props.domain].delayed;
|
||||
waiting.value = stats[props.domain].waiting;
|
||||
|
||||
chartProcess.value.pushData(stats[props.domain].activeSincePrevTick);
|
||||
chartActive.value.pushData(stats[props.domain].active);
|
||||
chartDelayed.value.pushData(stats[props.domain].delayed);
|
||||
chartWaiting.value.pushData(stats[props.domain].waiting);
|
||||
if (chartProcess.value != null) chartProcess.value.pushData(stats[props.domain].activeSincePrevTick);
|
||||
if (chartActive.value != null) chartActive.value.pushData(stats[props.domain].active);
|
||||
if (chartDelayed.value != null) chartDelayed.value.pushData(stats[props.domain].delayed);
|
||||
if (chartWaiting.value != null) chartWaiting.value.pushData(stats[props.domain].waiting);
|
||||
}
|
||||
|
||||
function onStatsLog(statsLog: Misskey.entities.QueueStatsLog) {
|
||||
|
@ -100,10 +100,10 @@ function onStatsLog(statsLog: Misskey.entities.QueueStatsLog) {
|
|||
dataWaiting.push(stats[props.domain].waiting);
|
||||
}
|
||||
|
||||
chartProcess.value.setData(dataProcess);
|
||||
chartActive.value.setData(dataActive);
|
||||
chartDelayed.value.setData(dataDelayed);
|
||||
chartWaiting.value.setData(dataWaiting);
|
||||
if (chartProcess.value != null) chartProcess.value.setData(dataProcess);
|
||||
if (chartActive.value != null) chartActive.value.setData(dataActive);
|
||||
if (chartDelayed.value != null) chartDelayed.value.setData(dataDelayed);
|
||||
if (chartWaiting.value != null) chartWaiting.value.setData(dataWaiting);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
@ -36,7 +36,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkInput v-model="name" pattern="[a-z0-9_]" autocapitalize="off">
|
||||
<template #label>{{ i18n.ts.name }}</template>
|
||||
</MkInput>
|
||||
<MkInput v-model="category" :datalist="customEmojiCategories">
|
||||
<MkInput v-model="category" :datalist="customEmojiCategories.filter(x => x != null)">
|
||||
<template #label>{{ i18n.ts.category }}</template>
|
||||
</MkInput>
|
||||
<MkInput v-model="aliases" autocapitalize="off">
|
||||
|
|
|
@ -135,7 +135,7 @@ const emit = defineEmits<{
|
|||
|
||||
const dialog = useTemplateRef('dialog');
|
||||
const page = ref(0);
|
||||
const token = ref<string | number | null>(null);
|
||||
const token = ref<string | null>(null);
|
||||
const backupCodes = ref<string[]>();
|
||||
|
||||
function cancel() {
|
||||
|
@ -145,7 +145,7 @@ function cancel() {
|
|||
async function tokenDone() {
|
||||
if (token.value == null) return;
|
||||
const res = await os.apiWithDialog('i/2fa/done', {
|
||||
token: typeof token.value === 'string' ? token.value : token.value.toString(),
|
||||
token: token.value.toString(), // 実装ミスなどでnumberが入る可能性を払拭できないため念のためtoString
|
||||
});
|
||||
|
||||
backupCodes.value = res.backupCodes;
|
||||
|
|
|
@ -17,8 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts" setup>
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { genId } from '@/utility/id.js';
|
||||
import XStatusbar from './statusbar.statusbar.vue';
|
||||
import { genId } from '@/utility/id.js';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
|
@ -39,6 +39,7 @@ onMounted(() => {
|
|||
async function add() {
|
||||
prefer.commit('statusbars', [...statusbars.value, {
|
||||
id: genId(),
|
||||
name: null,
|
||||
type: null,
|
||||
black: false,
|
||||
size: 'medium',
|
||||
|
|
|
@ -32,6 +32,15 @@ export type SoundStore = {
|
|||
volume: number;
|
||||
};
|
||||
|
||||
export type StatusbarStore = {
|
||||
name: string | null;
|
||||
id: string;
|
||||
type: string | null;
|
||||
size: 'verySmall' | 'small' | 'medium' | 'large' | 'veryLarge';
|
||||
black: boolean;
|
||||
props: Record<string, any>;
|
||||
};
|
||||
|
||||
type OmitStrict<T, K extends keyof T> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
|
||||
|
||||
// NOTE: デフォルト値は他の設定の状態に依存してはならない(依存していた場合、ユーザーがその設定項目単体で「初期値にリセット」した場合不具合の原因になる)
|
||||
|
@ -182,14 +191,7 @@ export const PREF_DEF = definePreferences({
|
|||
],
|
||||
},
|
||||
statusbars: {
|
||||
default: [] as {
|
||||
name: string;
|
||||
id: string;
|
||||
type: string;
|
||||
size: 'verySmall' | 'small' | 'medium' | 'large' | 'veryLarge';
|
||||
black: boolean;
|
||||
props: Record<string, any>;
|
||||
}[],
|
||||
default: [] as StatusbarStore[],
|
||||
},
|
||||
serverDisconnectedBehavior: {
|
||||
default: 'quiet' as 'quiet' | 'reload' | 'dialog',
|
||||
|
|
Loading…
Reference in New Issue