Add software versions to about page

This commit is contained in:
silverpill 2022-10-27 00:55:14 +00:00
parent 6e617c19d3
commit 34c36bc6ec
2 changed files with 27 additions and 0 deletions

View file

@ -27,6 +27,7 @@ export interface InstanceInfo {
title: string; title: string;
short_description: string; short_description: string;
description: string; description: string;
version: string;
registrations: boolean; registrations: boolean;
login_message: string; login_message: string;
post_character_limit: number; post_character_limit: number;

View file

@ -3,6 +3,12 @@
<template #content v-if="instance"> <template #content v-if="instance">
<h1>{{ instance.title }}</h1> <h1>{{ instance.title }}</h1>
<div class="description static-text" v-html="renderMarkdown(instance.description)"></div> <div class="description static-text" v-html="renderMarkdown(instance.description)"></div>
<details class="technical-info static-text">
<summary>Technical Info</summary>
mitra version: {{ getMitraVersion(instance.version) }}
<br>
mitra-web version: {{ APP_VERSION }}
</details>
</template> </template>
</sidebar-layout> </sidebar-layout>
<static-page v-else-if="currentUser === null && instance" class="wide"> <static-page v-else-if="currentUser === null && instance" class="wide">
@ -16,6 +22,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { $ } from "vue/macros" import { $ } from "vue/macros"
import { APP_VERSION } from "@/constants"
import SidebarLayout from "@/components/SidebarLayout.vue" import SidebarLayout from "@/components/SidebarLayout.vue"
import StaticPage from "@/components/StaticPage.vue" import StaticPage from "@/components/StaticPage.vue"
import { useCurrentUser } from "@/store/user" import { useCurrentUser } from "@/store/user"
@ -24,13 +31,32 @@ import { renderMarkdown } from "@/utils/markdown"
const { currentUser } = $(useCurrentUser()) const { currentUser } = $(useCurrentUser())
const { instance } = $(useInstanceInfo()) const { instance } = $(useInstanceInfo())
function getMitraVersion(apiVersion: string): string {
const match = apiVersion.match(/.+Mitra ([\d.]+)/)
if (match) {
return match[1]
} else {
return "unknown"
}
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "../styles/layout"; @import "../styles/layout";
@import "../styles/theme";
/* Internal page */ /* Internal page */
.content .description { .content .description {
font-size: 18px; font-size: 18px;
} }
.technical-info {
font-size: 18px;
margin-top: 25px;
summary {
font-weight: bold;
}
}
</style> </style>