Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Runtime temporary files
/tmp/

# Editor and OS artifacts
.DS_Store
*.swp
*.swo
*~
.vscode/
.idea/
96 changes: 95 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,96 @@
![OpenIPC logo](https://openipc.org/assets/openipc-logo-black.svg)

# opendrm-web
OpenDRM-web

Web interface for [OpenDRM](https://github.com/openipc/opendrm) — the OpenIPC
Digital Rights Management service for IP cameras.

Available on port 80 of your device after installation.

## Features

- **Dashboard** — real-time device status, DRM service state, network info
- **DRM Settings** — configure the OpenDRM service (port, log level, stream limit)
- **License Management** — activate and manage your OpenDRM license key
- **Stream Protection** — add and manage protected RTSP/HTTP streams
- **Network Settings** — configure Ethernet (DHCP or static IP)
- **Interface Settings** — change web UI password and color theme
- **Firmware Update** — update device firmware over the network
- **Tools** — web console and file browser

## Installation

Copy the `www/` directory to `/www` on your device:

```sh
scp -r www/* root@<camera-ip>:/www/
```

Or use the provided update script from the device itself:

```sh
/usr/sbin/updateopendrm
```

## Requirements

- OpenIPC firmware with [haserl](https://haserl.sourceforge.net/) CGI support
- A running HTTP server (e.g. `uhttpd` or `lighttpd`) serving `/www/`
- OpenDRM daemon (`opendrm`) installed at `/usr/sbin/opendrm`

## Default Credentials

> ⚠️ **SECURITY WARNING**: The web interface uses the system root credentials.
> You **must** change the default password immediately after first login.
> The interface enforces this — you will be redirected to the password change
> page on every access until a custom password is set.
>
> Default password: `12345`

## Directory Structure

```
www/
├── index.html # Redirects to /cgi-bin/status.cgi
├── a/
│ ├── logo.svg # OpenDRM logo
│ ├── main.css # Web UI stylesheet
│ └── main.js # Web UI JavaScript
└── cgi-bin/
├── status.cgi # Dashboard
├── drm-settings.cgi # DRM service configuration
├── drm-license.cgi # License management
├── drm-streams.cgi # Protected stream management
├── fw-network.cgi # Network settings
├── fw-interface.cgi # UI settings (password, theme)
├── fw-update.cgi # Firmware update
├── tool-console.cgi # Web console
├── tool-files.cgi # File browser
└── p/
├── common.cgi # Shared helper functions
├── header.cgi # HTML header & navigation
└── footer.cgi # HTML footer

sbin/
├── setnetwork # Network configuration helper
└── updateopendrm # Self-update script
```

## Support

OpenIPC offers two levels of support:

- **Free** community support via [Telegram chat](https://openipc.org/#telegram-chat-groups)
- **Paid** commercial support directly from the development team

For specific questions, contact [dev@openipc.org](mailto:dev@openipc.org).

## Contributing

Contributions are welcome. Please keep scripts minimal and optimized for
embedded Linux. Avoid external JavaScript libraries — plain JS is sufficient.
Use valid HTML5. See [OpenIPC contributing guidelines](https://openipc.org/).

## License

MIT — see [LICENSE](LICENSE).
45 changes: 45 additions & 0 deletions sbin/setnetwork
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh
# setnetwork - configure network interface
# Usage: setnetwork <mode> <address> <mask> <gateway> <dns> <hostname>
# mode: dhcp | static

MODE="${1:-dhcp}"
ADDRESS="$2"
MASK="${3:-255.255.255.0}"
GATEWAY="$4"
DNS="${5:-8.8.8.8}"
HOSTNAME="$6"

IFACE=$(ip route 2>/dev/null | awk '/default/ {print $5}' | head -n1)
IFACE="${IFACE:-eth0}"
NETWORK_CONF="/etc/network/interfaces"

[ -n "$HOSTNAME" ] && hostname "$HOSTNAME" && echo "$HOSTNAME" > /etc/hostname

cat > "$NETWORK_CONF" <<EOF
auto lo
iface lo inet loopback

auto ${IFACE}
EOF

if [ "$MODE" = "static" ] && [ -n "$ADDRESS" ]; then
cat >> "$NETWORK_CONF" <<EOF
iface ${IFACE} inet static
address ${ADDRESS}
netmask ${MASK}
gateway ${GATEWAY}
dns-nameservers ${DNS}
EOF
else
cat >> "$NETWORK_CONF" <<EOF
iface ${IFACE} inet dhcp
EOF
fi

if [ -n "$DNS" ]; then
echo "nameserver ${DNS}" > /etc/resolv.conf
fi

echo "Network configuration written to ${NETWORK_CONF}."
echo "Restart networking or reboot to apply changes."
30 changes: 30 additions & 0 deletions sbin/updateopendrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
# updateopendrm - download and install the latest opendrm-web release

set -e

REPO="OpenIPC/opendrm-web"
INSTALL_DIR="/www"
TMP_DIR="/tmp/opendrm-update"
GITHUB_API="https://api.github.com/repos/${REPO}/releases/latest"

echo "Checking for latest release of ${REPO}..."

url=$(wget -q -T10 -O- "$GITHUB_API" 2>/dev/null \
| grep '"tarball_url"' | head -n1 | cut -d'"' -f4)

if [ -z "$url" ]; then
echo "Error: could not retrieve release information." >&2
exit 1
fi

echo "Downloading $url..."
mkdir -p "$TMP_DIR"
wget -q -T30 -O "$TMP_DIR/release.tar.gz" "$url"

echo "Installing..."
tar -xzf "$TMP_DIR/release.tar.gz" -C "$TMP_DIR" --strip-components=1
cp -r "$TMP_DIR/www/"* "$INSTALL_DIR/"
rm -rf "$TMP_DIR"

echo "OpenDRM-web updated successfully."
16 changes: 16 additions & 0 deletions www/a/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading