Skip to content

Add Web Admin Dashboard, JSON API, and Basic Auth#22

Open
NangenX wants to merge 4 commits intorozhuk-im:masterfrom
NangenX:master
Open

Add Web Admin Dashboard, JSON API, and Basic Auth#22
NangenX wants to merge 4 commits intorozhuk-im:masterfrom
NangenX:master

Conversation

@NangenX
Copy link

@NangenX NangenX commented Dec 14, 2025

Description:
This PR introduces a lightweight, embedded web administration dashboard to monitor the server status, stream hubs, and connected clients in real-time. It adheres to the "lite" philosophy of the project by requiring no external dependencies or extra files.

Key Features:

Web Dashboard (/admin):

A modern, dark-themed, single-page interface embedded directly into the binary.
Real-time monitoring (1s refresh rate) of CPU, RAM, and Network I/O.
Detailed view of Stream Hubs, including source addresses (UDP/RTP) and input bitrates.
Expandable client lists showing Client IP, User Agent, and connection duration.
JSON API (/api/stats):

New endpoint providing structured system and stream data in JSON format.
Implemented without external JSON libraries to maintain zero dependencies.
Basic Authentication:

Added support for HTTP Basic Authentication to protect the /admin and /api/stats endpoints.
Configurable via msd_lite.conf.
Configuration Changes:
To enable Basic Authentication, add the following section to msd_lite.conf inside the tag:

<msd>
    ...
    <admin>
        <user>admin</user>
        <password>your_secure_password</password>
    </admin>
    ...
</msd>

}

static void
base64_encode(const uint8_t *src, size_t len, uint8_t *dst) {
Copy link
Owner

@rozhuk-im rozhuk-im Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is base64 encoder/decoder in liblcb: /include/utils/base64.h

static void
json_escape_str(io_buf_p buf, const char *str) {
while (*str) {
if (*str == '"') io_buf_printf(buf, "\\\"");
Copy link
Owner

@rozhuk-im rozhuk-im Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is mem_replace_arr() for things like that, or at least switch() is better.

@rozhuk-im
Copy link
Owner

Awesome work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants