Skip to content

Commit 4e76c4a

Browse files
committed
Add Statistics and Admin Portal to README.md
1 parent 42fd930 commit 4e76c4a

7 files changed

Lines changed: 201 additions & 76 deletions

File tree

.env

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# HTTP_ADDRESS=:8080
66
# HTTPS_REDIRECT_PORT=80
7-
# HTTP_ENABLE_REDIRECT=TRUE
7+
# ENABLE_HTTP_REDIRECT=TRUE
88
# NETWORK_TEST_ON_START=TRUE
99
# INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=TRUE
1010

@@ -20,9 +20,9 @@
2020
# AUTHORIZATION
2121
# ################
2222

23-
# LOCAL STREAM PROFILE
24-
# STREAM_PROFILE_ACTIVE=TRUE
23+
# LOCAL STREAM PROFILES
2524
# STREAM_PROFILE_PATH=./profiles
25+
# STREAM_PROFILE_POLICY=ANYONE_WITH_RESERVED
2626

2727
# WEBHOOK AUTHORIZATION
2828
# WEBHOOK_URL=http://your-server
@@ -33,6 +33,7 @@
3333

3434
# DISABLE_FRONTEND=TRUE
3535
# FRONTEND_PATH="./web/build"
36+
# FRONTEND_ADMIN_TOKEN=ChangeMe
3637

3738
# ################
3839
# DEBUGGING

.env.development

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# HTTP_ADDRESS=:8080
66
# HTTPS_REDIRECT_PORT=80
7-
# HTTP_ENABLE_REDIRECT=TRUE
7+
# ENABLE_HTTP_REDIRECT=TRUE
88
# NETWORK_TEST_ON_START=FALSE
99
# INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=TRUE
1010

@@ -20,9 +20,9 @@
2020
# AUTHORIZATION
2121
# ################
2222

23-
# LOCAL STREAM PROFILE
24-
# STREAM_PROFILE_ACTIVE=TRUE
23+
# LOCAL STREAM PROFILES
2524
# STREAM_PROFILE_PATH=./profiles
25+
# STREAM_PROFILE_POLICY=ANYONE_WITH_RESERVED
2626

2727
# WEBHOOK AUTHORIZATION
2828
# WEBHOOK_URL=http://your-server
@@ -33,6 +33,7 @@
3333

3434
# DISABLE_FRONTEND=TRUE
3535
# FRONTEND_PATH="./web/build"
36+
# FRONTEND_ADMIN_TOKEN=ChangeMe
3637

3738
# ################
3839
# STUN

.env.production

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# HTTP_ADDRESS=:8080
66
# HTTPS_REDIRECT_PORT=80
7-
# HTTP_ENABLE_REDIRECT=TRUE
7+
# ENABLE_HTTP_REDIRECT=TRUE
88
# NETWORK_TEST_ON_START=TRUE
99
# INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=TRUE
1010

@@ -20,9 +20,9 @@
2020
# AUTHORIZATION
2121
# ################
2222

23-
# LOCAL STREAM PROFILE
24-
# STREAM_PROFILE_ACTIVE=TRUE
23+
# LOCAL STREAM PROFILES
2524
# STREAM_PROFILE_PATH=./profiles
25+
# STREAM_PROFILE_POLICY=ANYONE_WITH_RESERVED
2626

2727
# WEBHOOK AUTHORIZATION
2828
# WEBHOOK_URL=http://your-server
@@ -33,6 +33,7 @@
3333

3434
# DISABLE_FRONTEND=TRUE
3535
# FRONTEND_PATH="./web/build"
36+
# FRONTEND_ADMIN_TOKEN=ChangeMe
3637

3738
# ################
3839
# DEBUGGING

.github/img/adminPortal.png

222 KB
Loading

.github/img/statistics.png

420 KB
Loading

README.md

Lines changed: 181 additions & 63 deletions
Large diffs are not rendered by default.

web/src/components/admin/menus/StatusPage.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useContext, useEffect, useState } from "react";
1+
import { useCallback, useContext, useEffect, useState } from "react";
22
import { LocaleContext } from "../../../providers/LocaleProvider";
33
import {
44
clearAdminToken,
@@ -9,8 +9,9 @@ import {
99
const StatusPage = () => {
1010
const { locale } = useContext(LocaleContext)
1111
const [response, setResponse] = useState<StatusResult[]>()
12+
const statusRefreshIntervalMs = 5000
1213

13-
const refreshStatus = () => {
14+
const refreshStatus = useCallback(() => {
1415
fetch(`/api/admin/status`, {
1516
method: "GET",
1617
headers: {
@@ -28,11 +29,14 @@ const StatusPage = () => {
2829
.then((result) => {
2930
setResponse(() => result)
3031
});
31-
};
32+
}, []);
3233

3334
useEffect(() => {
3435
refreshStatus()
35-
}, [])
36+
const interval = setInterval(refreshStatus, statusRefreshIntervalMs);
37+
38+
return () => clearInterval(interval);
39+
}, [refreshStatus, statusRefreshIntervalMs])
3640

3741
return (
3842
<div className="p-6 w-full max-w-6xl mx-auto">

0 commit comments

Comments
 (0)