refactor
This commit is contained in:
parent
120af977a9
commit
9e5c8d94bf
|
@ -71,7 +71,7 @@ const props = withDefaults(defineProps<{
|
||||||
const achievements = ref<Misskey.entities.UsersAchievementsResponse | null>(null);
|
const achievements = ref<Misskey.entities.UsersAchievementsResponse | null>(null);
|
||||||
const lockedAchievements = computed(() => ACHIEVEMENT_TYPES.filter(x => !(achievements.value ?? []).some(a => a.name === x)));
|
const lockedAchievements = computed(() => ACHIEVEMENT_TYPES.filter(x => !(achievements.value ?? []).some(a => a.name === x)));
|
||||||
|
|
||||||
function fetch() {
|
function _fetch_() {
|
||||||
misskeyApi('users/achievements', { userId: props.user.id }).then(res => {
|
misskeyApi('users/achievements', { userId: props.user.id }).then(res => {
|
||||||
achievements.value = [];
|
achievements.value = [];
|
||||||
for (const t of ACHIEVEMENT_TYPES) {
|
for (const t of ACHIEVEMENT_TYPES) {
|
||||||
|
@ -84,11 +84,11 @@ function fetch() {
|
||||||
|
|
||||||
function clickHere() {
|
function clickHere() {
|
||||||
claimAchievement('clickedClickHere');
|
claimAchievement('clickedClickHere');
|
||||||
fetch();
|
_fetch_();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetch();
|
_fetch_();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -265,6 +265,8 @@ onUnmounted(() => {
|
||||||
if (handle) {
|
if (handle) {
|
||||||
window.cancelAnimationFrame(handle);
|
window.cancelAnimationFrame(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: WebGLリソースの解放
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -111,13 +111,13 @@ const props = defineProps<{
|
||||||
fileId: string,
|
fileId: string,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
async function fetch() {
|
async function _fetch_() {
|
||||||
file.value = await misskeyApi('drive/files/show', { fileId: props.fileId });
|
file.value = await misskeyApi('drive/files/show', { fileId: props.fileId });
|
||||||
info.value = await misskeyApi('admin/drive/show-file', { fileId: props.fileId });
|
info.value = await misskeyApi('admin/drive/show-file', { fileId: props.fileId });
|
||||||
isSensitive.value = file.value.isSensitive;
|
isSensitive.value = file.value.isSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch();
|
_fetch_();
|
||||||
|
|
||||||
async function del() {
|
async function del() {
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm({
|
||||||
|
|
|
@ -39,7 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton primary @click="read(announcement)"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton>
|
<MkButton primary @click="read(announcement)"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<MkError v-else-if="error" @retry="fetch()"/>
|
<MkError v-else-if="error" @retry="_fetch_()"/>
|
||||||
<MkLoading v-else/>
|
<MkLoading v-else/>
|
||||||
</Transition>
|
</Transition>
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,7 +66,7 @@ const announcement = ref<Misskey.entities.Announcement | null>(null);
|
||||||
const error = ref<any>(null);
|
const error = ref<any>(null);
|
||||||
const path = computed(() => props.announcementId);
|
const path = computed(() => props.announcementId);
|
||||||
|
|
||||||
function fetch() {
|
function _fetch_() {
|
||||||
announcement.value = null;
|
announcement.value = null;
|
||||||
misskeyApi('announcements/show', {
|
misskeyApi('announcements/show', {
|
||||||
announcementId: props.announcementId,
|
announcementId: props.announcementId,
|
||||||
|
@ -96,7 +96,7 @@ async function read(target: Misskey.entities.Announcement): Promise<void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => path.value, fetch, { immediate: true });
|
watch(() => path.value, _fetch_, { immediate: true });
|
||||||
|
|
||||||
const headerActions = computed(() => []);
|
const headerActions = computed(() => []);
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ const folderHierarchy = computed(() => {
|
||||||
});
|
});
|
||||||
const isImage = computed(() => file.value?.type.startsWith('image/'));
|
const isImage = computed(() => file.value?.type.startsWith('image/'));
|
||||||
|
|
||||||
async function fetch() {
|
async function _fetch_() {
|
||||||
fetching.value = true;
|
fetching.value = true;
|
||||||
|
|
||||||
file.value = await misskeyApi('drive/files/show', {
|
file.value = await misskeyApi('drive/files/show', {
|
||||||
|
@ -134,7 +134,7 @@ function move() {
|
||||||
fileId: file.value.id,
|
fileId: file.value.id,
|
||||||
folderId: folder[0] ? folder[0].id : null,
|
folderId: folder[0] ? folder[0].id : null,
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
await fetch();
|
await _fetch_();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ function toggleSensitive() {
|
||||||
fileId: file.value.id,
|
fileId: file.value.id,
|
||||||
isSensitive: !file.value.isSensitive,
|
isSensitive: !file.value.isSensitive,
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
await fetch();
|
await _fetch_();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
@ -169,7 +169,7 @@ function rename() {
|
||||||
fileId: file.value.id,
|
fileId: file.value.id,
|
||||||
name: name,
|
name: name,
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
await fetch();
|
await _fetch_();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ async function describe() {
|
||||||
fileId: file.value.id,
|
fileId: file.value.id,
|
||||||
comment: caption.length === 0 ? null : caption,
|
comment: caption.length === 0 ? null : caption,
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
await fetch();
|
await _fetch_();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
closed: () => dispose(),
|
closed: () => dispose(),
|
||||||
|
@ -212,7 +212,7 @@ async function deleteFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetch();
|
await _fetch_();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ function close_(): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetch() {
|
async function _fetch_() {
|
||||||
if (!url.value || !hash.value) {
|
if (!url.value || !hash.value) {
|
||||||
errorKV.value = {
|
errorKV.value = {
|
||||||
title: i18n.ts._externalResourceInstaller._errors._invalidParams.title,
|
title: i18n.ts._externalResourceInstaller._errors._invalidParams.title,
|
||||||
|
@ -229,7 +229,7 @@ async function install() {
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
url.value = urlParams.get('url');
|
url.value = urlParams.get('url');
|
||||||
hash.value = urlParams.get('hash');
|
hash.value = urlParams.get('hash');
|
||||||
fetch();
|
_fetch_();
|
||||||
|
|
||||||
definePage(() => ({
|
definePage(() => ({
|
||||||
title: i18n.ts._externalResourceInstaller.title,
|
title: i18n.ts._externalResourceInstaller.title,
|
||||||
|
|
|
@ -198,7 +198,7 @@ if (iAmModerator) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetch(): Promise<void> {
|
async function _fetch_(): Promise<void> {
|
||||||
if (iAmAdmin) {
|
if (iAmAdmin) {
|
||||||
meta.value = await misskeyApi('admin/meta');
|
meta.value = await misskeyApi('admin/meta');
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ function refreshMetadata(): void {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch();
|
_fetch_();
|
||||||
|
|
||||||
const headerActions = computed(() => [{
|
const headerActions = computed(() => [{
|
||||||
text: `https://${props.host}`,
|
text: `https://${props.host}`,
|
||||||
|
|
|
@ -30,11 +30,11 @@ import { antennasCache } from '@/cache.js';
|
||||||
|
|
||||||
const antennas = computed(() => antennasCache.value.value ?? []);
|
const antennas = computed(() => antennasCache.value.value ?? []);
|
||||||
|
|
||||||
function fetch() {
|
function _fetch_() {
|
||||||
antennasCache.fetch();
|
antennasCache.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch();
|
_fetch_();
|
||||||
|
|
||||||
const headerActions = computed(() => [{
|
const headerActions = computed(() => [{
|
||||||
asFullButton: true,
|
asFullButton: true,
|
||||||
|
@ -42,7 +42,7 @@ const headerActions = computed(() => [{
|
||||||
text: i18n.ts.reload,
|
text: i18n.ts.reload,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
antennasCache.delete();
|
antennasCache.delete();
|
||||||
fetch();
|
_fetch_();
|
||||||
},
|
},
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,11 @@ const $i = ensureSignin();
|
||||||
|
|
||||||
const items = computed(() => userListsCache.value.value ?? []);
|
const items = computed(() => userListsCache.value.value ?? []);
|
||||||
|
|
||||||
function fetch() {
|
function _fetch_() {
|
||||||
userListsCache.fetch();
|
userListsCache.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch();
|
_fetch_();
|
||||||
|
|
||||||
async function create() {
|
async function create() {
|
||||||
const { canceled, result: name } = await os.inputText({
|
const { canceled, result: name } = await os.inputText({
|
||||||
|
@ -53,7 +53,7 @@ async function create() {
|
||||||
if (canceled || name == null) 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_();
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerActions = computed(() => [{
|
const headerActions = computed(() => [{
|
||||||
|
@ -62,7 +62,7 @@ const headerActions = computed(() => [{
|
||||||
text: i18n.ts.reload,
|
text: i18n.ts.reload,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
userListsCache.delete();
|
userListsCache.delete();
|
||||||
fetch();
|
_fetch_();
|
||||||
},
|
},
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ definePage(() => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
fetch();
|
_fetch_();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,8 @@ const menuDef = computed<SuperMenuDef[]>(() => [{
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (el.value == null) return; // TSを黙らすため
|
||||||
|
|
||||||
ro.observe(el.value);
|
ro.observe(el.value);
|
||||||
|
|
||||||
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
|
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
|
||||||
|
@ -198,6 +200,8 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
|
if (el.value == null) return; // TSを黙らすため
|
||||||
|
|
||||||
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
|
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
|
||||||
|
|
||||||
if (!narrow.value && currentPage.value?.route.name == null) {
|
if (!narrow.value && currentPage.value?.route.name == null) {
|
||||||
|
@ -215,7 +219,7 @@ watch(router.currentRef, (to) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emailNotConfigured = computed(() => instance.enableEmail && ($i.email == null || !$i.emailVerified));
|
const emailNotConfigured = computed(() => $i && instance.enableEmail && ($i.email == null || !$i.emailVerified));
|
||||||
|
|
||||||
provideMetadataReceiver((metadataGetter) => {
|
provideMetadataReceiver((metadataGetter) => {
|
||||||
const info = metadataGetter();
|
const info = metadataGetter();
|
||||||
|
|
|
@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<SearchMarker path="/settings/profile" :label="i18n.ts.profile" :keywords="['profile']" icon="ti ti-user">
|
<SearchMarker path="/settings/profile" :label="i18n.ts.profile" :keywords="['profile']" icon="ti ti-user">
|
||||||
<div class="_gaps_m">
|
<div class="_gaps_m">
|
||||||
<div class="_panel">
|
<div class="_panel">
|
||||||
<div :class="$style.banner" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : null }">
|
<div :class="$style.banner" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : '' }">
|
||||||
<div :class="$style.bannerEdit">
|
<div :class="$style.bannerEdit">
|
||||||
<SearchMarker :keywords="['banner', 'change']">
|
<SearchMarker :keywords="['banner', 'change']">
|
||||||
<MkButton primary rounded @click="changeBanner"><SearchLabel>{{ i18n.ts._profile.changeBanner }}</SearchLabel></MkButton>
|
<MkButton primary rounded @click="changeBanner"><SearchLabel>{{ i18n.ts._profile.changeBanner }}</SearchLabel></MkButton>
|
||||||
|
|
|
@ -10,8 +10,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkCodeEditor>
|
</MkCodeEditor>
|
||||||
|
|
||||||
<div class="_buttons">
|
<div class="_buttons">
|
||||||
<MkButton :disabled="installThemeCode == null || installThemeCode.trim() === ''" inline @click="() => previewTheme(installThemeCode)"><i class="ti ti-eye"></i> {{ i18n.ts.preview }}</MkButton>
|
<MkButton :disabled="installThemeCode == null || installThemeCode.trim() === ''" inline @click="() => previewTheme(installThemeCode!)"><i class="ti ti-eye"></i> {{ i18n.ts.preview }}</MkButton>
|
||||||
<MkButton :disabled="installThemeCode == null || installThemeCode.trim() === ''" primary inline @click="() => install(installThemeCode)"><i class="ti ti-check"></i> {{ i18n.ts.install }}</MkButton>
|
<MkButton :disabled="installThemeCode == null || installThemeCode.trim() === ''" primary inline @click="() => install(installThemeCode!)"><i class="ti ti-check"></i> {{ i18n.ts.install }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -39,7 +39,7 @@ async function install(code: string): Promise<void> {
|
||||||
});
|
});
|
||||||
installThemeCode.value = null;
|
installThemeCode.value = null;
|
||||||
router.push('/settings/theme');
|
router.push('/settings/theme');
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
switch (err.message.toLowerCase()) {
|
switch (err.message.toLowerCase()) {
|
||||||
case 'this theme is already installed':
|
case 'this theme is already installed':
|
||||||
os.alert({
|
os.alert({
|
||||||
|
|
|
@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #label>{{ i18n.ts._theme.code }}</template>
|
<template #label>{{ i18n.ts._theme.code }}</template>
|
||||||
<template #caption><button class="_textButton" @click="copyThemeCode()">{{ i18n.ts.copy }}</button></template>
|
<template #caption><button class="_textButton" @click="copyThemeCode()">{{ i18n.ts.copy }}</button></template>
|
||||||
</MkTextarea>
|
</MkTextarea>
|
||||||
<MkButton v-if="!builtinThemes.some(t => t.id == selectedTheme.id)" danger @click="uninstall()"><i class="ti ti-trash"></i> {{ i18n.ts.uninstall }}</MkButton>
|
<MkButton v-if="!builtinThemes.some(t => t.id == selectedTheme!.id)" danger @click="uninstall()"><i class="ti ti-trash"></i> {{ i18n.ts.uninstall }}</MkButton>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -23,6 +23,7 @@ export type Theme = {
|
||||||
author: string;
|
author: string;
|
||||||
desc?: string;
|
desc?: string;
|
||||||
base?: 'dark' | 'light';
|
base?: 'dark' | 'light';
|
||||||
|
kind?: 'dark' | 'light'; // legacy
|
||||||
props: Record<string, string>;
|
props: Record<string, string>;
|
||||||
codeHighlighter?: {
|
codeHighlighter?: {
|
||||||
base: BundledTheme;
|
base: BundledTheme;
|
||||||
|
|
Loading…
Reference in New Issue