Add server overview home page

This commit is contained in:
Gabe Kangas
2020-10-25 18:57:23 -07:00
parent f946c4e2b8
commit 049012485e
4 changed files with 162 additions and 39 deletions

View File

@@ -29,11 +29,10 @@ export const CONNECTED_CLIENTS = `${API_LOCATION}clients`;
// Get hardware stats
export const HARDWARE_STATS = `${API_LOCATION}hardwarestats`;
// Current Stream status (no auth)
// use `admin/broadcaster` instead
// export const STREAM_STATUS = '/api/status';
// Current Stream status.
// This is literally the same as /api/status except it supports
// auth.
export const STREAM_STATUS = `${API_LOCATION}status`;
export async function fetchData(url) {
const encoded = btoa(`${ADMIN_USERNAME}:${ADMIN_STREAMKEY}`);

14
web/pages/utils/format.ts Normal file
View File

@@ -0,0 +1,14 @@
export function formatIPAddress(ipAddress: string): string {
const ipAddressComponents = ipAddress.split(':')
// Wipe out the port component
ipAddressComponents[ipAddressComponents.length - 1] = '';
let ip = ipAddressComponents.join(':')
ip = ip.slice(0, ip.length - 1)
if (ip === '[::1]') {
return "Localhost"
}
return ip;
}