diff --git a/ui/src/dialogs/AboutDialog.jsx b/ui/src/dialogs/AboutDialog.jsx
index ca9db79d7..facc056e0 100644
--- a/ui/src/dialogs/AboutDialog.jsx
+++ b/ui/src/dialogs/AboutDialog.jsx
@@ -1,4 +1,4 @@
-import React from 'react'
+import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import Link from '@material-ui/core/Link'
import Dialog from '@material-ui/core/Dialog'
@@ -16,6 +16,8 @@ import config from '../config'
import { DialogTitle } from './DialogTitle'
import { DialogContent } from './DialogContent'
import { INSIGHTS_DOC_URL } from '../consts.js'
+import subsonic from '../subsonic/index.js'
+import { Typography } from '@material-ui/core'
const links = {
homepage: 'navidrome.org',
@@ -29,7 +31,7 @@ const links = {
const LinkToVersion = ({ version }) => {
if (version === 'dev') {
- return {version}
+ return <>{version}>
}
const parts = version.split(' ')
@@ -41,12 +43,46 @@ const LinkToVersion = ({ version }) => {
}...${commitID}`
: `https://github.com/navidrome/navidrome/releases/tag/v${parts[0]}`
return (
-
+ <>
{parts[0]}
{' (' + commitID + ')'}
-
+ >
+ )
+}
+
+const ShowVersion = ({ uiVersion, serverVersion }) => {
+ const translate = useTranslate()
+
+ const showRefresh = uiVersion !== serverVersion
+
+ return (
+ <>
+
+
+ {translate('menu.version')}:
+
+
+
+
+
+ {showRefresh && (
+
+
+ UI {translate('menu.version')}:
+
+
+
+ window.location.reload()}>
+
+ {' ' + translate('ra.notification.new_version')}
+
+
+
+
+ )}
+ >
)
}
@@ -54,6 +90,23 @@ const AboutDialog = ({ open, onClose }) => {
const translate = useTranslate()
const { permissions } = usePermissions()
const { data, loading } = useGetOne('insights', 'insights_status')
+ const [serverVersion, setServerVersion] = useState('')
+ const uiVersion = config.version
+
+ useEffect(() => {
+ subsonic
+ .ping()
+ .then((resp) => resp.json['subsonic-response'])
+ .then((data) => {
+ if (data.status === 'ok') {
+ setServerVersion(data.serverVersion)
+ }
+ })
+ .catch((e) => {
+ // eslint-disable-next-line no-console
+ console.error('error pinging server', e)
+ })
+ }, [setServerVersion])
const lastRun = !loading && data?.lastRun
let insightsStatus = 'N/A'
@@ -74,12 +127,10 @@ const AboutDialog = ({ open, onClose }) => {
-
-
- {translate('menu.version')}:
-
-
-
+
{Object.keys(links).map((key) => {
return (
diff --git a/ui/src/dialogs/AboutDialog.test.jsx b/ui/src/dialogs/AboutDialog.test.jsx
index 5c4e2f77f..a751930cd 100644
--- a/ui/src/dialogs/AboutDialog.test.jsx
+++ b/ui/src/dialogs/AboutDialog.test.jsx
@@ -4,12 +4,15 @@ import { LinkToVersion } from './AboutDialog'
import TableBody from '@material-ui/core/TableBody'
import TableRow from '@material-ui/core/TableRow'
import Table from '@material-ui/core/Table'
+import TableCell from '@material-ui/core/TableCell'
const Wrapper = ({ version }) => (
diff --git a/ui/src/subsonic/index.js b/ui/src/subsonic/index.js
index a6d2c4c33..ce5116bcb 100644
--- a/ui/src/subsonic/index.js
+++ b/ui/src/subsonic/index.js
@@ -29,6 +29,8 @@ const url = (command, id, options) => {
return `/rest/${command}?${params.toString()}`
}
+const ping = () => httpClient(url('ping'))
+
const scrobble = (id, time, submission = true) =>
httpClient(
url('scrobble', id, {
@@ -88,6 +90,7 @@ const streamUrl = (id, options) => {
export default {
url,
+ ping,
scrobble,
nowPlaying,
download,