refactor (client): $instance -> instance

This commit is contained in:
naskya 2024-03-07 10:52:32 +09:00
parent 031e272052
commit ce406f9861
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
11 changed files with 36 additions and 40 deletions

View file

@ -10,7 +10,7 @@
</div> </div>
<div :class="$style.text"> <div :class="$style.text">
{{ i18n.ts._aboutFirefish.pleaseDonateToFirefish }} {{ i18n.ts._aboutFirefish.pleaseDonateToFirefish }}
<p v-if="$instance.donationLink"> <p v-if="instance.donationLink">
{{ {{
i18n.t("_aboutFirefish.pleaseDonateToHost", { i18n.t("_aboutFirefish.pleaseDonateToHost", {
host: hostname, host: hostname,
@ -27,9 +27,9 @@
>{{ i18n.ts._aboutFirefish.donate }}</MkButton >{{ i18n.ts._aboutFirefish.donate }}</MkButton
> >
<MkButton <MkButton
v-if="$instance.donationLink" v-if="instance.donationLink"
gradate gradate
@click="openExternal($instance.donationLink)" @click="openExternal(instance.donationLink)"
>{{ >{{
i18n.t("_aboutFirefish.donateHost", { i18n.t("_aboutFirefish.donateHost", {
host: hostname, host: hostname,

View file

@ -205,7 +205,6 @@ function checkForSplash() {
app.config.globalProperties = { app.config.globalProperties = {
$i, $i,
$instance: instance,
}; };
widgets(app); widgets(app);

View file

@ -46,10 +46,3 @@ export const emojiTags = computed(() => {
} }
return Array.from(tags); return Array.from(tags);
}); });
// このファイルに書きたくないけどここに書かないと何故かVeturが認識しない
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
$instance: typeof instance;
}
}

View file

@ -35,7 +35,7 @@
><MkEmoji ><MkEmoji
class="emoji" class="emoji"
:emoji="emoji.emoji" :emoji="emoji.emoji"
:custom-emojis="$instance.emojis" :custom-emojis="instance.emojis"
:is-reaction="false" :is-reaction="false"
:normal="true" :normal="true"
:no-style="true" :no-style="true"
@ -96,6 +96,7 @@ import { defaultReactions, defaultStore } from "@/store";
import * as os from "@/os"; import * as os from "@/os";
import { definePageMetadata } from "@/scripts/page-metadata"; import { definePageMetadata } from "@/scripts/page-metadata";
import icon from "@/scripts/icon"; import icon from "@/scripts/icon";
import { instance } from "@/instance";
let easterEggReady = false; let easterEggReady = false;
const easterEggEmojis = ref([]); const easterEggEmojis = ref([]);

View file

@ -56,7 +56,8 @@ import MkFolder from "@/components/MkFolder.vue";
import MkTab from "@/components/MkTab.vue"; import MkTab from "@/components/MkTab.vue";
import { emojiCategories, emojiTags } from "@/instance"; import { emojiCategories, emojiTags } from "@/instance";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import icon from "@/scripts/icon"; import iconify from "@/scripts/icon";
import { instance } from "@/instance";
export default defineComponent({ export default defineComponent({
components: { components: {
@ -72,7 +73,7 @@ export default defineComponent({
return { return {
q: "", q: "",
customEmojiCategories: emojiCategories, customEmojiCategories: emojiCategories,
customEmojis: this.$instance.emojis, customEmojis: instance.emojis,
tags: emojiTags, tags: emojiTags,
selectedTags: new Set(), selectedTags: new Set(),
searchEmojis: null, searchEmojis: null,
@ -127,6 +128,10 @@ export default defineComponent({
this.selectedTags.add(tag); this.selectedTags.add(tag);
} }
}, },
icon(name: string): string {
return iconify(name);
},
}, },
}); });
</script> </script>

View file

@ -28,7 +28,7 @@
<div <div
class="_formBlock fwhjspax" class="_formBlock fwhjspax"
:style="{ :style="{
backgroundImage: `url(${$instance.bannerUrl})`, backgroundImage: `url(${instance.bannerUrl})`,
}" }"
> >
<div class="content"> <div class="content">
@ -41,7 +41,7 @@
@click="easterEgg" @click="easterEgg"
/> />
<div class="name"> <div class="name">
<b>{{ $instance.name || host }}</b> <b>{{ instance.name || host }}</b>
</div> </div>
</div> </div>
</div> </div>
@ -49,7 +49,7 @@
<MkKeyValue class="_formBlock"> <MkKeyValue class="_formBlock">
<template #key>{{ i18n.ts.description }}</template> <template #key>{{ i18n.ts.description }}</template>
<template #value <template #value
><div v-html="$instance.description"></div ><div v-html="instance.description"></div
></template> ></template>
</MkKeyValue> </MkKeyValue>
@ -70,7 +70,7 @@
i18n.ts.administrator i18n.ts.administrator
}}</template> }}</template>
<template #value>{{ <template #value>{{
$instance.maintainerName instance.maintainerName
}}</template> }}</template>
</MkKeyValue> </MkKeyValue>
<MkKeyValue class="_formBlock"> <MkKeyValue class="_formBlock">
@ -78,20 +78,20 @@
i18n.ts.contact i18n.ts.contact
}}</template> }}</template>
<template #value>{{ <template #value>{{
$instance.maintainerEmail instance.maintainerEmail
}}</template> }}</template>
</MkKeyValue> </MkKeyValue>
</FormSplit> </FormSplit>
<FormLink <FormLink
v-if="$instance.tosUrl" v-if="instance.tosUrl"
:to="$instance.tosUrl" :to="instance.tosUrl"
class="_formBlock" class="_formBlock"
external external
>{{ i18n.ts.tos }}</FormLink >{{ i18n.ts.tos }}</FormLink
> >
<FormLink <FormLink
v-if="$instance.donationLink" v-if="instance.donationLink"
:to="$instance.donationLink" :to="instance.donationLink"
external external
> >
<template #icon <template #icon
@ -99,7 +99,7 @@
></template> ></template>
{{ {{
i18n.t("_aboutFirefish.donateHost", { i18n.t("_aboutFirefish.donateHost", {
host: $instance.name || host, host: instance.name || host,
}) })
}} }}
<template #suffix>Donate</template> <template #suffix>Donate</template>

View file

@ -5,7 +5,7 @@
<div class="lxpfedzu"> <div class="lxpfedzu">
<div class="banner"> <div class="banner">
<img <img
:src="$instance.iconUrl || '/favicon.ico'" :src="instance.iconUrl || '/favicon.ico'"
alt="" alt=""
class="icon" class="icon"
/> />
@ -73,7 +73,7 @@ import MkSuperMenu from "@/components/MkSuperMenu.vue";
import MkInfo from "@/components/MkInfo.vue"; import MkInfo from "@/components/MkInfo.vue";
import { instance } from "@/instance"; import { instance } from "@/instance";
import { version } from "@/config"; import { version } from "@/config";
import { $i } from "@/reactiveAccount"; import { $i, isAdmin } from "@/reactiveAccount";
import * as os from "@/os"; import * as os from "@/os";
import { lookupUser } from "@/scripts/lookup-user"; import { lookupUser } from "@/scripts/lookup-user";
import { lookupFile } from "@/scripts/lookup-file"; import { lookupFile } from "@/scripts/lookup-file";
@ -214,7 +214,7 @@ const menuDef = computed(() => [
}, },
], ],
}, },
...($i?.isAdmin ...(isAdmin
? [ ? [
{ {
title: i18n.ts.settings, title: i18n.ts.settings,

View file

@ -145,12 +145,6 @@
:class="icon('help icon ph-info ph-xl ph-fw', false)" :class="icon('help icon ph-info ph-xl ph-fw', false)"
></i> ></i>
</button> </button>
<!-- <button v-click-anime v-tooltip.noDelay.right="$instance.name ?? i18n.ts.instance" class="item _button instance" @click="openInstanceMenu">
<img :src="$instance.faviconUrl || $instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
</button> -->
<!-- <button v-click-anime v-tooltip.noDelay.right="`${i18n.ts.account}: @${$i.username}`" class="item _button account" @click="openAccountMenu">
<MkAvatar :user="$i" class="account"/><MkAcct class="text" :user="$i"/>
</button> -->
</div> </div>
</div> </div>
</header> </header>

View file

@ -3,7 +3,7 @@
<div <div
v-if="mainRouter.currentRoute?.name === 'index'" v-if="mainRouter.currentRoute?.name === 'index'"
class="banner" class="banner"
:style="{ backgroundImage: `url(${$instance.bannerUrl})` }" :style="{ backgroundImage: `url(${instance.bannerUrl})` }"
> >
<div> <div>
<h1 v-if="meta"> <h1 v-if="meta">
@ -32,7 +32,7 @@
<div <div
v-else v-else
class="banner-mini" class="banner-mini"
:style="{ backgroundImage: `url(${$instance.bannerUrl})` }" :style="{ backgroundImage: `url(${instance.bannerUrl})` }"
> >
<div> <div>
<h1 v-if="meta"> <h1 v-if="meta">
@ -86,6 +86,7 @@ import MkButton from "@/components/MkButton.vue";
import { ColdDeviceStorage, defaultStore } from "@/store"; import { ColdDeviceStorage, defaultStore } from "@/store";
import { mainRouter } from "@/router"; import { mainRouter } from "@/router";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { instance } from "@/instance";
const DESKTOP_THRESHOLD = 1100; const DESKTOP_THRESHOLD = 1100;

View file

@ -4,7 +4,7 @@
:style="{ :style="{
backgroundImage: transparent backgroundImage: transparent
? 'none' ? 'none'
: `url(${$instance.backgroundImageUrl})`, : `url(${instance.backgroundImageUrl})`,
}" }"
> >
<div class="back" :class="{ transparent }"></div> <div class="back" :class="{ transparent }"></div>
@ -91,6 +91,7 @@ import XSigninDialog from "@/components/MkSigninDialog.vue";
import XSignupDialog from "@/components/MkSignupDialog.vue"; import XSignupDialog from "@/components/MkSignupDialog.vue";
import MkButton from "@/components/MkButton.vue"; import MkButton from "@/components/MkButton.vue";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { instance } from "@/instance";
export default defineComponent({ export default defineComponent({
components: { components: {
@ -128,6 +129,7 @@ export default defineComponent({
limit: 10, limit: 10,
}, },
i18n, i18n,
instance,
}; };
}, },

View file

@ -3,14 +3,14 @@
<div <div
:class="$style.container" :class="$style.container"
:style="{ :style="{
backgroundImage: `url(${$instance.bannerUrl})`, backgroundImage: `url(${instance.bannerUrl})`,
}" }"
> >
<div :class="$style.iconContainer"> <div :class="$style.iconContainer">
<img <img
:src=" :src="
$instance.faviconUrl || instance.faviconUrl ||
$instance.iconUrl || instance.iconUrl ||
'/favicon.ico' '/favicon.ico'
" "
alt="Instance logo" alt="Instance logo"
@ -20,7 +20,7 @@
<div :class="$style.bodyContainer"> <div :class="$style.bodyContainer">
<div :class="$style.body"> <div :class="$style.body">
<MkA :class="$style.name" to="/about" behavior="window">{{ <MkA :class="$style.name" to="/about" behavior="window">{{
$instance.name instance.name
}}</MkA> }}</MkA>
<div :class="$style.host">{{ host }}</div> <div :class="$style.host">{{ host }}</div>
</div> </div>
@ -34,6 +34,7 @@ import type { Widget, WidgetComponentExpose } from "./widget";
import { useWidgetPropsManager } from "./widget"; import { useWidgetPropsManager } from "./widget";
import type { GetFormResultType } from "@/scripts/form"; import type { GetFormResultType } from "@/scripts/form";
import { host } from "@/config"; import { host } from "@/config";
import { instance } from "@/instance";
const name = "serverInfo"; const name = "serverInfo";