mirror of
https://github.com/owncast/owncast.git
synced 2024-10-24 05:25:58 +03:00
Add config values to home overview
This commit is contained in:
parent
df14a55429
commit
9689f66d2e
2 changed files with 19 additions and 11 deletions
|
@ -54,12 +54,11 @@ export default function Stats() {
|
||||||
|
|
||||||
|
|
||||||
// Pull in the server config so we can show config overview.
|
// Pull in the server config so we can show config overview.
|
||||||
const [videoSettings, setVideoSettings] = useState([]);
|
const [config, setConfig] = useState([]);
|
||||||
const getConfig = async () => {
|
const getConfig = async () => {
|
||||||
try {
|
try {
|
||||||
const result = await fetchData(SERVER_CONFIG);
|
const result = await fetchData(SERVER_CONFIG);
|
||||||
const variants = result && result.videoSettings && result.videoSettings.videoQualityVariants;
|
setConfig(result);
|
||||||
setVideoSettings(variants);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +70,7 @@ export default function Stats() {
|
||||||
getConfig();
|
getConfig();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (!stats || isEmptyObject(stats)) {
|
if (isEmptyObject(config) || isEmptyObject(stats)) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Skeleton active />
|
<Skeleton active />
|
||||||
|
@ -85,6 +84,7 @@ export default function Stats() {
|
||||||
return <Offline />;
|
return <Offline />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const videoSettings = config.videoSettings.videoQualityVariants;
|
||||||
const videoQualitySettings = videoSettings.map((setting, index) => {
|
const videoQualitySettings = videoSettings.map((setting, index) => {
|
||||||
const audioSetting =
|
const audioSetting =
|
||||||
setting.audioPassthrough || setting.audioBitrate === 0
|
setting.audioPassthrough || setting.audioBitrate === 0
|
||||||
|
@ -93,11 +93,6 @@ export default function Stats() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row gutter={[16, 16]} key={index}>
|
<Row gutter={[16, 16]} key={index}>
|
||||||
<StatisticItem
|
|
||||||
title="Output"
|
|
||||||
value={`Video variant ${index}`}
|
|
||||||
prefix={null}
|
|
||||||
/>
|
|
||||||
<StatisticItem
|
<StatisticItem
|
||||||
title="Outbound Video Stream"
|
title="Outbound Video Stream"
|
||||||
value={`${setting.videoBitrate} kbps ${setting.framerate} fps`}
|
value={`${setting.videoBitrate} kbps ${setting.framerate} fps`}
|
||||||
|
@ -159,6 +154,19 @@ export default function Stats() {
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
{videoQualitySettings}
|
{videoQualitySettings}
|
||||||
|
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<StatisticItem
|
||||||
|
title="Stream key"
|
||||||
|
value={config.streamKey}
|
||||||
|
prefix={null}
|
||||||
|
/>
|
||||||
|
<StatisticItem
|
||||||
|
title="Directory registration enabled"
|
||||||
|
value={config.yp.enabled.toString()}
|
||||||
|
prefix={null}
|
||||||
|
/>
|
||||||
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ export function formatIPAddress(ipAddress: string): string {
|
||||||
|
|
||||||
// check if obj is {}
|
// check if obj is {}
|
||||||
export function isEmptyObject(obj) {
|
export function isEmptyObject(obj) {
|
||||||
return Object.keys(obj).length === 0;
|
return !obj || Object.keys(obj).length === 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue