Show info about hosted WebUI in "About" (#482)
This commit is contained in:
@@ -286,8 +286,11 @@
|
|||||||
"label": {
|
"label": {
|
||||||
"browse": "Browse",
|
"browse": "Browse",
|
||||||
"client": "Client",
|
"client": "Client",
|
||||||
|
"discord": "Discord",
|
||||||
"display": "Display",
|
"display": "Display",
|
||||||
"filter": "Filter",
|
"filter": "Filter",
|
||||||
|
"github": "GitHub",
|
||||||
|
"links": "Links",
|
||||||
"loading": "Loading…",
|
"loading": "Loading…",
|
||||||
"never": "Never",
|
"never": "Never",
|
||||||
"none": "None",
|
"none": "None",
|
||||||
@@ -493,14 +496,22 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"about": {
|
"about": {
|
||||||
"label": {
|
"server": {
|
||||||
"build_time": "Build time",
|
"label": {
|
||||||
"discord": "Discord",
|
"address": "Server address",
|
||||||
"github": "GitHub",
|
"build_time": "Build time",
|
||||||
"server_address": "Server address",
|
"github": "$t(global.label.github) $t(settings.server.title.server)",
|
||||||
"server_version": "Server version"
|
"version": "Server version"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"title": "About"
|
"title": "About",
|
||||||
|
"webui": {
|
||||||
|
"label": {
|
||||||
|
"channel": "$t(settings.webui.title.webui) channel",
|
||||||
|
"github": "$t(global.label.github) $t(settings.webui.title.webui)",
|
||||||
|
"version": "$t(settings.webui.title.webui) version"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"backup": {
|
"backup": {
|
||||||
"automated": {
|
"automated": {
|
||||||
|
|||||||
@@ -2604,7 +2604,7 @@ export type GetMangasQuery = { __typename?: 'Query', mangas: { __typename?: 'Man
|
|||||||
export type GetAboutQueryVariables = Exact<{ [key: string]: never; }>;
|
export type GetAboutQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
export type GetAboutQuery = { __typename?: 'Query', aboutServer: { __typename?: 'AboutServerPayload', buildTime: any, buildType: string, discord: string, github: string, name: string, revision: string, version: string } };
|
export type GetAboutQuery = { __typename?: 'Query', aboutServer: { __typename?: 'AboutServerPayload', buildTime: any, buildType: string, discord: string, github: string, name: string, revision: string, version: string }, aboutWebUI: { __typename?: 'WebUIUpdateInfo', channel: string, tag: string, updateAvailable: boolean } };
|
||||||
|
|
||||||
export type CheckForServerUpdatesQueryVariables = Exact<{ [key: string]: never; }>;
|
export type CheckForServerUpdatesQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ export const GET_ABOUT = gql`
|
|||||||
revision
|
revision
|
||||||
version
|
version
|
||||||
}
|
}
|
||||||
|
aboutWebUI {
|
||||||
|
channel
|
||||||
|
tag
|
||||||
|
updateAvailable
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import List from '@mui/material/List';
|
|||||||
import ListItem from '@mui/material/ListItem';
|
import ListItem from '@mui/material/ListItem';
|
||||||
import ListItemText from '@mui/material/ListItemText';
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import ListSubheader from '@mui/material/ListSubheader';
|
||||||
|
import { Divider } from '@mui/material';
|
||||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||||
import { ListItemLink } from '@/components/util/ListItemLink';
|
import { ListItemLink } from '@/components/util/ListItemLink';
|
||||||
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext';
|
import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext';
|
||||||
@@ -26,41 +28,84 @@ export function About() {
|
|||||||
}, [t]);
|
}, [t]);
|
||||||
|
|
||||||
const { data } = requestManager.useGetAbout();
|
const { data } = requestManager.useGetAbout();
|
||||||
const about = data?.aboutServer;
|
const { aboutServer, aboutWebUI } = data ?? {};
|
||||||
|
|
||||||
useSetDefaultBackTo('settings');
|
useSetDefaultBackTo('settings');
|
||||||
|
|
||||||
if (about === undefined) {
|
if (!aboutServer || !aboutWebUI) {
|
||||||
return <LoadingPlaceholder />;
|
return <LoadingPlaceholder />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const version = () => {
|
const version = () => {
|
||||||
if (about.buildType === 'Stable') return `${about.version}`;
|
if (aboutServer.buildType === 'Stable') return `${aboutServer.version}`;
|
||||||
return `${about.version}-${about.revision}`;
|
return `${aboutServer.version}-${aboutServer.revision}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildTime = () => new Date(about.buildTime * 1000).toUTCString();
|
const buildTime = () => new Date(aboutServer.buildTime * 1000).toUTCString();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<ListItem>
|
<List
|
||||||
<ListItemText
|
sx={{ padding: 0 }}
|
||||||
primary={t('settings.server.title.server')}
|
subheader={
|
||||||
secondary={`${about.name} ${about.buildType}`}
|
<ListSubheader component="div" id="about-server-info">
|
||||||
/>
|
{t('settings.server.title.server')}
|
||||||
</ListItem>
|
</ListSubheader>
|
||||||
<ListItem>
|
}
|
||||||
<ListItemText primary={t('settings.about.label.server_version')} secondary={version()} />
|
>
|
||||||
</ListItem>
|
<ListItem>
|
||||||
<ListItem>
|
<ListItemText
|
||||||
<ListItemText primary={t('settings.about.label.build_time')} secondary={buildTime()} />
|
primary={t('settings.server.title.server')}
|
||||||
</ListItem>
|
secondary={`${aboutServer.name} ${aboutServer.buildType}`}
|
||||||
<ListItemLink directLink to={about.github}>
|
/>
|
||||||
<ListItemText primary={t('settings.about.label.github')} secondary={about.github} />
|
</ListItem>
|
||||||
</ListItemLink>
|
<ListItem>
|
||||||
<ListItemLink directLink to={about.discord}>
|
<ListItemText primary={t('settings.about.server.label.version')} secondary={version()} />
|
||||||
<ListItemText primary={t('settings.about.label.discord')} secondary={about.discord} />
|
</ListItem>
|
||||||
</ListItemLink>
|
<ListItem>
|
||||||
|
<ListItemText primary={t('settings.about.server.label.build_time')} secondary={buildTime()} />
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
<Divider />
|
||||||
|
<List
|
||||||
|
sx={{ padding: 0 }}
|
||||||
|
subheader={
|
||||||
|
<ListSubheader component="div" id="about-webui-info">
|
||||||
|
{t('settings.webui.title.webui')}
|
||||||
|
</ListSubheader>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemText primary={t('settings.about.webui.label.version')} secondary={aboutWebUI.tag} />
|
||||||
|
</ListItem>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemText
|
||||||
|
primary={t('settings.about.webui.label.channel')}
|
||||||
|
secondary={aboutWebUI.channel.toLocaleUpperCase()}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
<Divider />
|
||||||
|
<List
|
||||||
|
subheader={
|
||||||
|
<ListSubheader component="div" id="about-links">
|
||||||
|
{t('global.label.links')}
|
||||||
|
</ListSubheader>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ListItemLink directLink to={aboutServer.github}>
|
||||||
|
<ListItemText primary={t('settings.about.server.label.github')} secondary={aboutServer.github} />
|
||||||
|
</ListItemLink>
|
||||||
|
<ListItemLink directLink to="https://github.com/Suwayomi/Tachidesk-WebUI">
|
||||||
|
<ListItemText
|
||||||
|
primary={t('settings.about.webui.label.github')}
|
||||||
|
secondary="https://github.com/Suwayomi/Tachidesk-WebUI"
|
||||||
|
/>
|
||||||
|
</ListItemLink>
|
||||||
|
<ListItemLink directLink to={aboutServer.discord}>
|
||||||
|
<ListItemText primary={t('global.label.discord')} secondary={aboutServer.discord} />
|
||||||
|
</ListItemLink>
|
||||||
|
</List>
|
||||||
</List>
|
</List>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export const ServerSettings = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TextSetting
|
<TextSetting
|
||||||
settingName={t('settings.about.label.server_address')}
|
settingName={t('settings.about.server.label.address')}
|
||||||
handleChange={handleServerAddressChange}
|
handleChange={handleServerAddressChange}
|
||||||
value={serverAddress}
|
value={serverAddress}
|
||||||
placeholder="http://localhost:4567"
|
placeholder="http://localhost:4567"
|
||||||
|
|||||||
Reference in New Issue
Block a user