(fix) ページキャッシュが効く問題を修正 (#12105)

This commit is contained in:
かっこかり 2023-10-23 09:14:36 +09:00 committed by GitHub
parent 9221cbf42b
commit 796265fc50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 9 deletions

View File

@ -94,7 +94,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, onMounted, nextTick } from 'vue'; import { ref, computed, onActivated, onDeactivated, nextTick } from 'vue';
import MkLoading from '@/components/global/MkLoading.vue'; import MkLoading from '@/components/global/MkLoading.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import FormSection from '@/components/form/section.vue'; import FormSection from '@/components/form/section.vue';
@ -120,9 +120,8 @@ const errorKV = ref<{
description: '', description: '',
}); });
const urlParams = new URLSearchParams(window.location.search); const url = ref<string | null>(null);
const url = urlParams.get('url'); const hash = ref<string | null>(null);
const hash = urlParams.get('hash');
const data = ref<{ const data = ref<{
type: 'plugin' | 'theme'; type: 'plugin' | 'theme';
@ -152,7 +151,7 @@ function goToMisskey(): void {
} }
async function fetch() { async function fetch() {
if (!url || !hash) { if (!url.value || !hash.value) {
errorKV.value = { errorKV.value = {
title: i18n.ts._externalResourceInstaller._errors._invalidParams.title, title: i18n.ts._externalResourceInstaller._errors._invalidParams.title,
description: i18n.ts._externalResourceInstaller._errors._invalidParams.description, description: i18n.ts._externalResourceInstaller._errors._invalidParams.description,
@ -161,8 +160,8 @@ async function fetch() {
return; return;
} }
const res = await os.api('fetch-external-resources', { const res = await os.api('fetch-external-resources', {
url, url: url.value,
hash, hash: hash.value,
}).catch((err) => { }).catch((err) => {
switch (err.id) { switch (err.id) {
case 'bb774091-7a15-4a70-9dc5-6ac8cf125856': case 'bb774091-7a15-4a70-9dc5-6ac8cf125856':
@ -297,10 +296,17 @@ async function install() {
} }
} }
onMounted(() => { onActivated(() => {
const urlParams = new URLSearchParams(window.location.search);
url.value = urlParams.get('url');
hash.value = urlParams.get('hash');
fetch(); fetch();
}); });
onDeactivated(() => {
uiPhase.value = 'fetching';
});
const headerActions = computed(() => []); const headerActions = computed(() => []);
const headerTabs = computed(() => []); const headerTabs = computed(() => []);