I started a branch feature/initial-release-scope to collaborate on the initial release scope.
Project Overview
The project is split into a frontend project (based on React & Gatsby.js; representing the hotspot portal accessed by the client) and the backend (built with Strapi) for the required APIs, server logic (Telegram & Unifi) & admin UI (maintaining supported sites & data for a given connection to the Unifi Controller).
Backend
The development environment for Strapi is based on node & yarn (npm). To install the required dependencies run yarn install on project root. Using yarn develop the backend server can be started and will listen by default on port 1337.
For the moment a local sqlite database is being used. Later for a productive usage, a real db (for example containerd) is recommended. Configuration (see config files in folder ./config as well as the Strapi documentation) would need to be changed in order to connect to, for example a mariadb.
The datamodel and service logic can be found under ./src/api. See the Strapi Documentation for details. In a nutshell:
The Entity UnifiSite represents a site available on the connected controller that shall be accessible using the hotspot manager, and need to be created by an admin.
Connection to the Telegram Bot is established using the telegram service using the bot token maintained in the system envs.
See .env.example for the foreseen environment variables
Telegram Users can register to be approver for a site using /register <UnifiSiteID> <RegistrationPassword>, which is being persisted with the entity Approver
The Frontend is creating new access requests using dedicated API endpoints for the entity Access-Request
The Service logic is finding the correct site settings, storing the required values of the access request and asking approvers for the site to give or reject access
Frontend
The frontend ca. be found in the subfolder ./ui. Dependencies can be installed using yarn install. Additionally the gatsby-cli is required. The development server can be run using yarn develop, by default starting on port 8000.
Please note that for productive usage the frontend is built into static HTML/JS files using the build script, which results in the build result to be stored in the folder ./ui/public. It is foreseen that the built UI is being put to the public folder (see docs), thus being then hosted by strapi. (In theory this is not the best approach, but two servers are a bit of an overkill for a hotspot portal solution).
For now the connection to the API using localhost:1337 is hardcoded for development, but needs to be moved into configuration to support development and productive usage.
The basic flow with the hotspot portal & the API works already including the status management.
I haven't yet reached the state of testing the authorize guest functionality in the backend, as here I use a different library than before in my private version.
Required work (list to be completed)
[x] [Frontend] Create basic UI flow for Hotspot portal
[ ] [Frontend] UI Improvements
[ ] [Frontend] Open Source Licenses & Legal Information
[ ] [Frontend] Central Management of API URL (Production vs Development)
[ ] [Frontend] Check Redirect behavior after approval and improve indicating to device internet connection is available
[ ] [Frontend] Adding i18n
[x] [Backend] Basic setup of data model & core logic
[ ] [Backend] Test & Correct interaction with the Unifi API (switched the library, haven't fully tested yet the correct functionality)
[ ] [Backend] Support to proactively querying clients in network waiting for approval (in case Hotspot portal is not launchpad on client device)
[ ] [Backend] Database Configuration for both production & development
Feel free to contribute or ask questions regarding concepts or understanding of certain things below.
I started a branch
feature/initial-release-scope
to collaborate on the initial release scope.Project Overview
The project is split into a frontend project (based on React & Gatsby.js; representing the hotspot portal accessed by the client) and the backend (built with Strapi) for the required APIs, server logic (Telegram & Unifi) & admin UI (maintaining supported sites & data for a given connection to the Unifi Controller).
Backend
The development environment for Strapi is based on node & yarn (npm). To install the required dependencies run
yarn install
on project root. Usingyarn develop
the backend server can be started and will listen by default on port1337
.For the moment a local sqlite database is being used. Later for a productive usage, a real db (for example containerd) is recommended. Configuration (see config files in folder
./config
as well as the Strapi documentation) would need to be changed in order to connect to, for example a mariadb.The datamodel and service logic can be found under
./src/api
. See the Strapi Documentation for details. In a nutshell:UnifiSite
represents a site available on the connected controller that shall be accessible using the hotspot manager, and need to be created by an admin.telegram
service using the bot token maintained in the system envs./register <UnifiSiteID> <RegistrationPassword>
, which is being persisted with the entityApprover
Access-Request
Frontend
The frontend ca. be found in the subfolder
./ui
. Dependencies can be installed usingyarn install
. Additionally thegatsby-cli
is required. The development server can be run usingyarn develop
, by default starting on port8000
.Please note that for productive usage the frontend is built into static HTML/JS files using the build script, which results in the build result to be stored in the folder
./ui/public
. It is foreseen that the built UI is being put to thepublic
folder (see docs), thus being then hosted by strapi. (In theory this is not the best approach, but two servers are a bit of an overkill for a hotspot portal solution).For now the connection to the API using
localhost:1337
is hardcoded for development, but needs to be moved into configuration to support development and productive usage.The basic flow with the hotspot portal & the API works already including the status management. I haven't yet reached the state of testing the authorize guest functionality in the backend, as here I use a different library than before in my private version.
Required work (list to be completed)
Feel free to contribute or ask questions regarding concepts or understanding of certain things below.