- GET /version (signed-in users only) answers the version and, when the binary knows it, the commit it was built from and whether the files had uncommitted changes - the commit is read from the build info Go records in a git checkout, so no build flag is needed - the side menu shows the version under the privacy line, and Settings has an About section with it - the menu's own requests (friends, version) are not counted as requests of an admin page in the Shell tests
18 lines
447 B
TypeScript
18 lines
447 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import { api } from '@/api/client'
|
|
|
|
export interface Version {
|
|
version: string
|
|
revision?: string
|
|
modified?: boolean
|
|
}
|
|
|
|
/** Which Sonda the server is. It cannot change while the page is open, so it is read once. */
|
|
export function useVersion() {
|
|
return useQuery({
|
|
queryKey: ['/version'],
|
|
queryFn: () => api.get<Version>('/version'),
|
|
staleTime: Infinity,
|
|
retry: false,
|
|
})
|
|
}
|