This commit is contained in:
syuilo 2025-08-26 09:08:00 +09:00
parent 120af977a9
commit 9e5c8d94bf
14 changed files with 39 additions and 32 deletions

View File

@ -71,7 +71,7 @@ const props = withDefaults(defineProps<{
const achievements = ref<Misskey.entities.UsersAchievementsResponse | null>(null);
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 => {
achievements.value = [];
for (const t of ACHIEVEMENT_TYPES) {
@ -84,11 +84,11 @@ function fetch() {
function clickHere() {
claimAchievement('clickedClickHere');
fetch();
_fetch_();
}
onMounted(() => {
fetch();
_fetch_();
});
</script>

View File

@ -265,6 +265,8 @@ onUnmounted(() => {
if (handle) {
window.cancelAnimationFrame(handle);
}
// TODO: WebGL
});
</script>

View File

@ -111,13 +111,13 @@ const props = defineProps<{
fileId: string,
}>();
async function fetch() {
async function _fetch_() {
file.value = await misskeyApi('drive/files/show', { fileId: props.fileId });
info.value = await misskeyApi('admin/drive/show-file', { fileId: props.fileId });
isSensitive.value = file.value.isSensitive;
}
fetch();
_fetch_();
async function del() {
const { canceled } = await os.confirm({

View File

@ -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>
</div>
</div>
<MkError v-else-if="error" @retry="fetch()"/>
<MkError v-else-if="error" @retry="_fetch_()"/>
<MkLoading v-else/>
</Transition>
</div>
@ -66,7 +66,7 @@ const announcement = ref<Misskey.entities.Announcement | null>(null);
const error = ref<any>(null);
const path = computed(() => props.announcementId);
function fetch() {
function _fetch_() {
announcement.value = null;
misskeyApi('announcements/show', {
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(() => []);

View File

@ -105,7 +105,7 @@ const folderHierarchy = computed(() => {
});
const isImage = computed(() => file.value?.type.startsWith('image/'));
async function fetch() {
async function _fetch_() {
fetching.value = true;
file.value = await misskeyApi('drive/files/show', {
@ -134,7 +134,7 @@ function move() {
fileId: file.value.id,
folderId: folder[0] ? folder[0].id : null,
}).then(async () => {
await fetch();
await _fetch_();
});
});
}
@ -146,7 +146,7 @@ function toggleSensitive() {
fileId: file.value.id,
isSensitive: !file.value.isSensitive,
}).then(async () => {
await fetch();
await _fetch_();
}).catch(err => {
os.alert({
type: 'error',
@ -169,7 +169,7 @@ function rename() {
fileId: file.value.id,
name: name,
}).then(async () => {
await fetch();
await _fetch_();
});
});
}
@ -186,7 +186,7 @@ async function describe() {
fileId: file.value.id,
comment: caption.length === 0 ? null : caption,
}).then(async () => {
await fetch();
await _fetch_();
});
},
closed: () => dispose(),
@ -212,7 +212,7 @@ async function deleteFile() {
}
onMounted(async () => {
await fetch();
await _fetch_();
});
</script>

View File

@ -80,7 +80,7 @@ function close_(): void {
}
}
async function fetch() {
async function _fetch_() {
if (!url.value || !hash.value) {
errorKV.value = {
title: i18n.ts._externalResourceInstaller._errors._invalidParams.title,
@ -229,7 +229,7 @@ async function install() {
const urlParams = new URLSearchParams(window.location.search);
url.value = urlParams.get('url');
hash.value = urlParams.get('hash');
fetch();
_fetch_();
definePage(() => ({
title: i18n.ts._externalResourceInstaller.title,

View File

@ -198,7 +198,7 @@ if (iAmModerator) {
});
}
async function fetch(): Promise<void> {
async function _fetch_(): Promise<void> {
if (iAmAdmin) {
meta.value = await misskeyApi('admin/meta');
}
@ -276,7 +276,7 @@ function refreshMetadata(): void {
});
}
fetch();
_fetch_();
const headerActions = computed(() => [{
text: `https://${props.host}`,

View File

@ -30,11 +30,11 @@ import { antennasCache } from '@/cache.js';
const antennas = computed(() => antennasCache.value.value ?? []);
function fetch() {
function _fetch_() {
antennasCache.fetch();
}
fetch();
_fetch_();
const headerActions = computed(() => [{
asFullButton: true,
@ -42,7 +42,7 @@ const headerActions = computed(() => [{
text: i18n.ts.reload,
handler: () => {
antennasCache.delete();
fetch();
_fetch_();
},
}]);

View File

@ -40,11 +40,11 @@ const $i = ensureSignin();
const items = computed(() => userListsCache.value.value ?? []);
function fetch() {
function _fetch_() {
userListsCache.fetch();
}
fetch();
_fetch_();
async function create() {
const { canceled, result: name } = await os.inputText({
@ -53,7 +53,7 @@ async function create() {
if (canceled || name == null) return;
await os.apiWithDialog('users/lists/create', { name: name });
userListsCache.delete();
fetch();
_fetch_();
}
const headerActions = computed(() => [{
@ -62,7 +62,7 @@ const headerActions = computed(() => [{
text: i18n.ts.reload,
handler: () => {
userListsCache.delete();
fetch();
_fetch_();
},
}]);
@ -74,7 +74,7 @@ definePage(() => ({
}));
onActivated(() => {
fetch();
_fetch_();
});
</script>

View File

@ -188,6 +188,8 @@ const menuDef = computed<SuperMenuDef[]>(() => [{
}]);
onMounted(() => {
if (el.value == null) return; // TS
ro.observe(el.value);
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
@ -198,6 +200,8 @@ onMounted(() => {
});
onActivated(() => {
if (el.value == null) return; // TS
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
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) => {
const info = metadataGetter();

View File

@ -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">
<div class="_gaps_m">
<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">
<SearchMarker :keywords="['banner', 'change']">
<MkButton primary rounded @click="changeBanner"><SearchLabel>{{ i18n.ts._profile.changeBanner }}</SearchLabel></MkButton>

View File

@ -10,8 +10,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkCodeEditor>
<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() === ''" primary inline @click="() => install(installThemeCode)"><i class="ti ti-check"></i> {{ i18n.ts.install }}</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>
</div>
</div>
</template>
@ -39,7 +39,7 @@ async function install(code: string): Promise<void> {
});
installThemeCode.value = null;
router.push('/settings/theme');
} catch (err) {
} catch (err: any) {
switch (err.message.toLowerCase()) {
case 'this theme is already installed':
os.alert({

View File

@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts._theme.code }}</template>
<template #caption><button class="_textButton" @click="copyThemeCode()">{{ i18n.ts.copy }}</button></template>
</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>
</div>
</template>

View File

@ -23,6 +23,7 @@ export type Theme = {
author: string;
desc?: string;
base?: 'dark' | 'light';
kind?: 'dark' | 'light'; // legacy
props: Record<string, string>;
codeHighlighter?: {
base: BundledTheme;