diff --git a/web/pages/components/chart.tsx b/web/pages/components/chart.tsx
index 3412331c9..9ccfd6880 100644
--- a/web/pages/components/chart.tsx
+++ b/web/pages/components/chart.tsx
@@ -1,27 +1,43 @@
import { LineChart, XAxis, YAxis, Line, Tooltip, Legend } from "recharts";
import { timeFormat } from "d3-time-format";
-export default function Chart({ data, color, unit }) {
- const CustomizedTooltip = (props) => {
- const { active, payload } = props;
- if (active && payload && payload[0]) {
- const time = payload[0].payload
- ? timeFormat("%I:%M")(new Date(payload[0].payload.time), {
- nearestTo: 1,
- })
- : "";
- return (
-
@@ -84,10 +105,10 @@ export default function Stats() {
}
if (!broadcaster) {
- return Offline();
+ return
;
}
- const videoQualitySettings = videoSettings.map(function (setting, index) {
+ const videoQualitySettings = videoSettings.map((setting, index) => {
const audioSetting =
setting.audioPassthrough || setting.audioBitrate === 0
? `${streamDetails.audioBitrate} kpbs (passthrough)`
@@ -95,13 +116,21 @@ export default function Stats() {
return (
- {Item("Output", `Video variant ${index}`, "")}
- {Item(
- "Outbound Video Stream",
- `${setting.videoBitrate} kbps ${setting.framerate} fps`,
- ""
- )}
- {Item("Outbound Audio Stream", audioSetting, "")}
+
+
+
);
});
@@ -114,39 +143,45 @@ export default function Stats() {
Server Overview
- {Item(
- `Stream started ${formatRelative(
+
- )}
-
- {Item("Viewers", viewerCount, )}
- {Item("Peak viewer count", sessionMaxViewerCount, )}
+ )}`}
+ value={formatDistanceToNow(new Date(lastConnectTime))}
+ prefix={}
+ />
+ }
+ />
+ }
+ />
- {Item("Input", formatIPAddress(remoteAddr), "")}
- {Item("Inbound Video Stream", streamVideoDetailString, "")}
- {Item("Inbound Audio Stream", streamAudioDetailString, "")}
+
+
+
{videoQualitySettings}
);
}
-
-function Offline() {
- return (
-
- There is no stream currently active. Start one.
- }
- />
-
- );
-}
diff --git a/web/pages/update-server-config.tsx b/web/pages/update-server-config.tsx
index 201656507..782703047 100644
--- a/web/pages/update-server-config.tsx
+++ b/web/pages/update-server-config.tsx
@@ -1,10 +1,249 @@
-import React, { useState, useEffect, useContext } from 'react';
+import React, { useState, useEffect } from 'react';
import { Table, Typography, Input } from 'antd';
import { SERVER_CONFIG, fetchData, FETCH_INTERVAL } from './utils/apis';
+import { isEmptyObject } from './utils/format';
const { Title } = Typography;
const { TextArea } = Input;
+function KeyValueTable({ title, data }) {
+ const columns = [
+ {
+ title: "Name",
+ dataIndex: "name",
+ key: "name",
+ },
+ {
+ title: "Value",
+ dataIndex: "value",
+ key: "value",
+ },
+ ];
+
+ return (
+
+ );
+}
+
+function SocialHandles({ config }) {
+ if (!config) {
+ return null;
+ }
+
+ const columns = [
+ {
+ title: "Platform",
+ dataIndex: "platform",
+ key: "platform",
+ },
+ {
+ title: "URL",
+ dataIndex: "url",
+ key: "url",
+ render: (url) => `
${url}`
+ },
+ ];
+
+ return (
+
+ );
+}
+
+function InstanceDetails({ config }) {
+ console.log(config)
+ if (!config || isEmptyObject(config)) {
+ return null;
+ }
+
+ const { instanceDetails = {}, yp, streamKey, ffmpegPath, webServerPort } = config;
+
+ const data = [
+ {
+ name: "Server name",
+ value: instanceDetails.name,
+ },
+ {
+ name: "Title",
+ value: instanceDetails.title,
+ },
+ {
+ name: "Summary",
+ value: instanceDetails.summary,
+ },
+ {
+ name: "Logo",
+ value: instanceDetails.logo.large,
+ },
+ {
+ name: "Tags",
+ value: instanceDetails.tags.join(", "),
+ },
+ {
+ name: "NSFW",
+ value: instanceDetails.nsfw.toString(),
+ },
+ {
+ name: "Shows in Owncast directory",
+ value: yp.enabled.toString(),
+ },
+ ];
+
+ const configData = [
+ {
+ name: "Stream key",
+ value: streamKey,
+ },
+ {
+ name: "ffmpeg path",
+ value: ffmpegPath,
+ },
+ {
+ name: "Web server port",
+ value: webServerPort,
+ },
+ ];
+
+ return (
+ <>
+
+
+ >
+ );
+}
+
+function VideoVariants({ config }) {
+ if (!config) {
+ return null;
+ }
+
+ const videoQualityColumns = [
+ {
+ title: "Video bitrate",
+ dataIndex: "videoBitrate",
+ key: "videoBitrate",
+ render: (bitrate) =>
+ bitrate === 0 || !bitrate ? "Passthrough" : `${bitrate} kbps`,
+ },
+ {
+ title: "Framerate",
+ dataIndex: "framerate",
+ key: "framerate",
+ },
+ {
+ title: "Encoder preset",
+ dataIndex: "encoderPreset",
+ key: "framerate",
+ },
+ {
+ title: "Audio bitrate",
+ dataIndex: "audioBitrate",
+ key: "audioBitrate",
+ render: (bitrate) =>
+ bitrate === 0 || !bitrate ? "Passthrough" : `${bitrate} kbps`,
+ },
+ ];
+
+ const miscVideoSettingsColumns = [
+ {
+ title: "Name",
+ dataIndex: "name",
+ key: "name",
+ },
+ {
+ title: "Value",
+ dataIndex: "value",
+ key: "value",
+ },
+ ];
+
+ const miscVideoSettings = [
+ {
+ name: "Segment length",
+ value: config.videoSettings.segmentLengthSeconds,
+ },
+ {
+ name: "Number of segments",
+ value: config.videoSettings.numberOfPlaylistItems,
+ },
+ ];
+
+ return (
+
+
Video configuration
+
+
+
+
+ );
+}
+
+function Storage({ config }) {
+ if (!config) {
+ return null;
+ }
+
+ const data = [
+ {
+ name: "Enabled",
+ value: config.s3.enabled.toString(),
+ },
+ {
+ name: "Endpoint",
+ value: config.s3.endpoint,
+ },
+ {
+ name: "Access Key",
+ value: config.s3.accessKey,
+ },
+ {
+ name: "Secret",
+ value: config.s3.secret,
+ },
+ {
+ name: "Bucket",
+ value: config.s3.bucket,
+ },
+ {
+ name: "Region",
+ value: config.s3.region,
+ },
+ ];
+ return
+}
+
+function PageContent({ config }) {
+ if (!config) {
+ return null;
+ }
+ return (
+
+
Page content
+
+
+ );
+}
+
export default function ServerConfig() {
const [config, setConfig] = useState();
@@ -46,255 +285,15 @@ export default function ServerConfig() {
overflow: "auto",
}}
>
-
-
-
-
-
+
+
+
+
+
{JSON.stringify(config)}
- );
-
- function InstanceDetails() {
- console.log(config)
- if (!config) {
- return null;
- }
-
- const data = [
- {
- name: "Server name",
- value: config.instanceDetails.name,
- },
- {
- name: "Title",
- value: config.instanceDetails.title,
- },
- {
- name: "Summary",
- value: config.instanceDetails.summary,
- },
- {
- name: "Logo",
- value: config.instanceDetails.logo.large,
- },
- {
- name: "Tags",
- value: config.instanceDetails.tags.join(", "),
- },
- {
- name: "NSFW",
- value: config.instanceDetails.nsfw.toString(),
- },
- {
- name: "Shows in Owncast directory",
- value: config.yp.enabled.toString(),
- },
- ];
-
- const configData = [
- {
- name: "Stream key",
- value: config.streamKey,
- },
- {
- name: "ffmpeg path",
- value: config.ffmpegPath,
- },
- {
- name: "Web server port",
- value: config.webServerPort,
- },
- ];
-
- return (
- <>
-