client: use cached instance information
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed

This commit is contained in:
Johann150 2022-10-11 10:46:25 +02:00
parent 4f9504d135
commit 2c411d59f4
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1
5 changed files with 12 additions and 39 deletions

View file

@ -1,17 +1,9 @@
<template>
<div v-if="meta" class="xfbouadm" :style="{ backgroundImage: `url(${ meta.backgroundImageUrl })` }"></div>
<div class="xfbouadm" :style="{ backgroundImage: `url(${ instance.backgroundImageUrl })` }"></div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import * as foundkey from 'foundkey-js';
import * as os from '@/os';
const meta = ref<foundkey.entities.DetailedInstanceMetadata>();
os.api('meta', { detail: true }).then(gotMeta => {
meta.value = gotMeta;
});
import { instance } from '@/instance';
</script>
<style lang="scss" scoped>

View file

@ -4,7 +4,7 @@
<div v-show="loaded" class="mjndxjch">
<img src="https://xn--931a.moe/assets/error.jpg" class="_ghost"/>
<p><b><i class="fas fa-exclamation-triangle"></i> {{ i18n.ts.pageLoadError }}</b></p>
<p v-if="meta && (version === meta.version)">{{ i18n.ts.pageLoadErrorDescription }}</p>
<p v-if="version === instance.version">{{ i18n.ts.pageLoadErrorDescription }}</p>
<p v-else-if="serverIsDead">{{ i18n.ts.serverIsDead }}</p>
<template v-else>
<p>{{ i18n.ts.newVersionOfClientAvailable }}</p>
@ -21,6 +21,7 @@
import * as foundkey from 'foundkey-js';
import MkButton from '@/components/ui/button.vue';
import { version } from '@/config';
import { instance } from '@/instance';
import * as os from '@/os';
import { unisonReload } from '@/scripts/unison-reload';
import { i18n } from '@/i18n';
@ -34,15 +35,11 @@ withDefaults(defineProps<{
let loaded = $ref(false);
let serverIsDead = $ref(false);
let meta = $ref<foundkey.entities.LiteInstanceMetadata | null>(null);
os.api('meta', {
detail: false,
}).then(res => {
// just checking whether the server is alive or dead
os.api('ping').then(() => {
loaded = true;
serverIsDead = false;
meta = res;
localStorage.setItem('v', res.version);
}, () => {
loaded = true;
serverIsDead = true;

View file

@ -1,5 +1,5 @@
<template>
<div v-if="meta" class="rsqzvsbo">
<div class="rsqzvsbo">
<div class="top">
<MkFeaturedPhotos class="bg"/>
<XTimeline class="tl"/>
@ -19,12 +19,12 @@
<div class="fg">
<h1>
<!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に -->
<!-- <img class="logo" v-if="meta.logoImageUrl" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
<!-- <img class="logo" v-if="instance.logoImageUrl" :src="instance.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
<span class="text">{{ instanceName }}</span>
</h1>
<div class="about">
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="desc" v-html="meta.description || i18n.ts.headlineMisskey"></div>
<div class="desc" v-html="instance.description || i18n.ts.headlineMisskey"></div>
</div>
<div class="action">
<MkButton inline rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.signup }}</MkButton>
@ -58,17 +58,13 @@ import { host, instanceName } from '@/config';
import * as os from '@/os';
import number from '@/filters/number';
import { i18n } from '@/i18n';
import { instance } from '@/instance';
let meta = $ref();
let stats = $ref();
let tags = $ref();
let onlineUsersCount = $ref();
let instances = $ref();
os.api('meta', { detail: true }).then(_meta => {
meta = _meta;
});
os.api('stats').then(_stats => {
stats = _stats;
});

View file

@ -1,8 +1,6 @@
<template>
<div v-if="meta">
<XSetup v-if="meta.requireSetup"/>
<XSetup v-if="instance.requireSetup"/>
<XEntrance v-else/>
</div>
</template>
<script lang="ts" setup>
@ -10,15 +8,10 @@ import { computed } from 'vue';
import XSetup from './welcome.setup.vue';
import XEntrance from './welcome.entrance.a.vue';
import { instanceName } from '@/config';
import { instance } from '@/instance';
import * as os from '@/os';
import { definePageMetadata } from '@/scripts/page-metadata';
let meta = $ref(null);
os.api('meta', { detail: true }).then(res => {
meta = res;
});
definePageMetadata(computed(() => ({
title: instanceName,
icon: null,

View file

@ -80,7 +80,6 @@ const announcements = {
let showMenu = $ref(false);
let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD);
let narrow = $ref(window.innerWidth < 1280);
let meta = $ref();
const keymap = $computed(() => {
return {
@ -94,10 +93,6 @@ const keymap = $computed(() => {
const root = $computed(() => mainRouter.currentRoute.value.name === 'index');
os.api('meta', { detail: true }).then(res => {
meta = res;
});
function signin() {
os.popup(XSigninDialog, {
autoSet: true,