External UniFi guest portal
GPL-3.0 License
This project is a voucher code captive portal for UniFi networks.
To run the captive portal, you will need:
docker pull carlgo11/guest-portal
docker run -d \
-p 80:3000 \
--env-file .env \
carlgo11/guest-portal
.env
file with the environment variables found under Configuration.docker-compose.yml
file with the following data:
version: '3.8'
services:
redis:
image: redis:alpine
volumes:
- redis:/data
node:
image: carlgo11/guest-portal
ports:
- 3001:3000
env_file: .env
volumes:
redis:
By default, the captive portal fetches the Bing Image of the Day to use as the background. If you prefer to use your own background images, follow these steps:
The captive portal can display use different backgrounds depending on the season. If you wish to use this, follow these steps:
Create a new directory with the following subdirectories:
Spring
Summer
Autumn
Winter
Place your desired background images inside these folders. The client will automatically select the appropriate background image based on the browser window resolution.
Specify which hemisphere you're in (north
or south
) in the .env
file. This is necessary to calculate the current season accurately.
Link the parent directory of your custom background images to /app/public/img/backgrounds/
in the Docker container.
If using docker, you can link the directory by adding the following line to the docker command:
docker run -d \
-p 80:3000 \
--env-file .env \
+ -v $(pwd)/backgrounds:/app/public/img/backgrounds \
carlgo11/guest-portal
If using Docker Compose, link the directory by adding the following lines to docker-compose.yml
:
version: '3.8'
services:
redis:
image: redis:alpine
volumes:
- redis:/data
node:
image: carlgo11/guest-portal
+ volumes:
+ - ./backgrounds:/app/public/img/background
ports:
- 3001:3000
env_file: .env
volumes:
redis:
Create a new directory and place your desired background images inside this directory. The client will automatically select the appropriate background image based on the browser window resolution.
Link the directory containing your background images to /app/public/img/backgrounds/
in the Docker container.
If using the Docker CLI, you can link the directory by adding the following line to the docker command:
docker run -d \
-p 80:3000 \
--env-file .env \
+ -v $(pwd)/backgrounds:/app/public/img/backgrounds \
carlgo11/guest-portal
The captive portal can be configured using the following environment variables:
Variable | Description | Default Value |
---|---|---|
HEMISPHERE |
Hemisphere setting for seasonal background selection | |
IMG_PATH |
Path to background images | img/background |
ORIGIN |
Origin URL for WebAuthn | http://localhost:3000 |
UNIFI_HOST |
UniFi controller host IP address | |
UNIFI_PORT |
UniFi controller port | 443 |
UNIFI_TLS |
Enable TLS for UniFi controller | false |
UNIFI_USERNAME |
Username for UniFi controller authentication | |
UNIFI_PASSWORD |
Password for UniFi controller authentication | |
UNIFI_SITE |
UniFi site name | default |
UNIFI_SSID |
WLAN SSID name | |
REDIS_HOST |
Redis server host | redis |
REDIS_PORT |
Redis server port | 6379 |