admin/home: link releases after check-for-updates

Massimo Melina committed Nov 3, 2024 at 15:00 UTC 2b48102e6a1b109fd74988fc7516d61630eab369
2 files changed +6 -4
admin/src/HomePage.ts
+5 -3
@@ -1,6 +1,6 @@
1 // This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3 -import { createElement as h, ReactNode, useState } from 'react'
3 +import { createElement as h, Fragment, ReactNode, useState } from 'react'
4 import { Box, Card, CardContent, LinearProgress, Link } from '@mui/material'
5 import { apiCall, useApiEx, useApiList } from './api'
6 import {
@@ -121,11 +121,13 @@ export default function HomePage() {
121 { k: 'update_to_beta', comp: CheckboxField, label: "Include beta versions" },
122 ] }
123 }),
124 - updates && with_(_.find(updates, 'isNewer'), newer =>
124 + updates && with_(_.find(updates, 'isNewer'), newer => h(Fragment, {},
125 !updates.length || !status.updatePossible && !newer ? entry('', "No update available")
126 : newer && !status.updatePossible ? entry('success', `Version ${newer.name} available`)
127 : h(Flex, { vert: true },
128 - updates.map((x: any) => h(Update, { info: x })) )),
128 + updates.map((x: any) => h(Update, { info: x })) ),
129 + entry('', h(Link, { href: REPO_URL + 'releases/', target: 'repo' }, "All releases"))
130 + )),
131 h(SwitchThemeBtn, { variant: 'outlined' }),
132 Date.now() - Number(new Date(status.started)) > HOUR && h(Link, {
133 title: "Donate",
src/log.ts
+1 -1
@@ -113,7 +113,7 @@ export const logMw: Koa.Middleware = async (ctx, next) => {
113 }
114 }
115 const format = '%s - %s [%s] "%s %s HTTP/%s" %d %s %s\n' // Apache's Common Log Format
116 - const a = now.toString().split(' ')
116 + const a = now.toString().split(' ') // like nginx, our default log contains the time of log writing
117 const date = a[2]+'/'+a[1]+'/'+a[3]+':'+a[4]+' '+a[5]?.slice(3)
118 const user = getCurrentUsername(ctx)
119 const length = ctx.state.length ?? ctx.length