added: client: show instance info in ticker

This commit is contained in:
Chloe Kudryavtsev 2022-08-25 17:26:11 -04:00
commit 20514e3950
4 changed files with 26 additions and 4 deletions

View file

@ -9,6 +9,7 @@ For older Misskey versions, see [CHANGELOG-OLD.md](./CHANGELOG-OLD.md).
## Unreleased ## Unreleased
### Added ### Added
- Client: Show instance info in ticker
- Client: Readded group pages - Client: Readded group pages
- Client: add re-collapsing to quoted notes - Client: add re-collapsing to quoted notes

View file

@ -1,18 +1,21 @@
<template> <template>
<div class="hpaizdrt" :style="bg"> <div class="hpaizdrt" :style="bg" v-tooltip="instance.softwareName + ' ' + instance.softwareVersion">
<img v-if="instance.faviconUrl" class="icon" :src="instance.faviconUrl"/> <img v-if="instance.faviconUrl" class="icon" :src="instance.faviconUrl"/>
<span class="name">{{ instance.name }}</span> <span class="name">{{ instance.name }}</span>
<span v-if="instance.softwareName" class="software">{{ instance.softwareName }}</span>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { instanceName } from '@/config'; import { instanceName, version, software } from '@/config';
const props = defineProps<{ const props = defineProps<{
instance?: { instance?: {
faviconUrl?: string; faviconUrl?: string;
name: string; name: string;
themeColor?: string; themeColor?: string;
softwareName?: string;
softwareVersion?: string;
}; };
}>(); }>();
@ -21,6 +24,8 @@ const instance = props.instance ?? {
faviconUrl: '/favicon.ico', faviconUrl: '/favicon.ico',
name: instanceName, name: instanceName,
themeColor: (document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement).content, themeColor: (document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement).content,
softwareName: software,
softwareVersion: version,
}; };
const themeColor = instance.themeColor ?? '#777777'; const themeColor = instance.themeColor ?? '#777777';
@ -33,6 +38,7 @@ const bg = {
<style lang="scss" scoped> <style lang="scss" scoped>
.hpaizdrt { .hpaizdrt {
$height: 1.1rem; $height: 1.1rem;
position: relative;
height: $height; height: $height;
border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px;
@ -59,11 +65,24 @@ const bg = {
} }
> .name { > .name {
margin-left: 4px; margin-left: .3em;
line-height: $height; line-height: $height;
font-size: 0.9em; font-size: 0.9em;
vertical-align: top; vertical-align: top;
font-weight: bold; font-weight: bold;
} }
> .software {
float: right;
margin-right: .3em;
line-height: $height;
font-size: 0.9em;
vertical-align: top;
color: var(--fg);
text-shadow: none;
text-transform: capitalize;
}
} }
</style> </style>

View file

@ -10,6 +10,7 @@ export const lang = localStorage.getItem('lang');
export const langs = _LANGS_; export const langs = _LANGS_;
export const locale = JSON.parse(localStorage.getItem('locale')); export const locale = JSON.parse(localStorage.getItem('locale'));
export const version = _VERSION_; export const version = _VERSION_;
export const instanceName = siteName === 'Misskey' ? host : siteName; export const software = _SOFTWARE_;
export const instanceName = siteName === 'FoundKey' ? host : siteName;
export const ui = localStorage.getItem('ui'); export const ui = localStorage.getItem('ui');
export const debug = localStorage.getItem('debug') === 'true'; export const debug = localStorage.getItem('debug') === 'true';

View file

@ -33,6 +33,7 @@ export default defineConfig(({ command, mode }) => {
define: { define: {
_VERSION_: JSON.stringify(meta.version), _VERSION_: JSON.stringify(meta.version),
_SOFTWARE_: JSON.stringify(meta.name),
_LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]) => [k, v._lang_])), _LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]) => [k, v._lang_])),
_ENV_: JSON.stringify(process.env.NODE_ENV), _ENV_: JSON.stringify(process.env.NODE_ENV),
_DEV_: process.env.NODE_ENV !== 'production', _DEV_: process.env.NODE_ENV !== 'production',