Quick and nasty time based parental controls for a Unifi based network
This project is no longer actively maintained by the original author as the teenagers have left the building and I don't have a use case for it any more.
Please feel free to fork, improve, customise and do what you wish with it.
Issues will no longer be actioned.
Thanks for the interest.
Time based block/unblock of clients for a Unifi based network.
Uses:
Clone the repo and then do:
npm install
Generate a self signed certificate using generate-ssl-cert.sh
- this requires openssl
to be installed. Alternatively a certificate from Lets Encrypt using standalone authintication with CertBot could be used.
Add certificate information, Unifi Controller details and login information to config.json
and .env
respectively - see -sample
files for examples
/* xxx */
sed
one liner if you are using Linux/MacOS sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' config-sample.jsonc > config.json
DEBUG=unifi-parental:* npm start
Fire up a browser and head to https://localhost:4000/ to access the interface.
Click Save
to send the schedule to the server and to schedule the block/unblock actions. This is required to be done initially every time the server is started. (ie: the schedule is not applied on startup of the server)
The code (javascript, html, css, images and fonts) for the time schedule chart were saved using a browser from a Fritz!Box 7390 ADSL modem/router. The source files served to the browser contained no license information.
The file public\js\timer.js
has been modified to return data in a more usable format for both the client and server. Portions of this file have been used in the server side code for scheduling block/unblock actions.