Skip to content
This repository has been archived by the owner on Mar 14, 2020. It is now read-only.

tdack/unifi-parental

Repository files navigation

Unmaintained!

Please Note:

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.

================================

Unifi-parental

Time based block/unblock of clients for a Unifi based network.

Requires

  • a Unifi Controller accessible over the network
  • NodeJS v7.10.x or later (the latest LTS should suffice)
  • openssl installed to generate self signed ssl certificate

Uses:

  • node-unifi to access the Unifi Controller.
  • node-schedule for cron like scheduling of the block/unblock actions

Installation

Clone the repo and then do:

  1. npm install

  2. 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.

  3. Add certificate information, Unifi Controller details and login information to config.json and .env respectively - see -sample files for examples

  • if you copy the sample files, remove the comments ... /* xxx */
  • try this sed one liner if you are using Linux/MacOS
  sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' config-sample.jsonc > config.json
  1. Start the server:
DEBUG=unifi-parental:* npm start

Fire up a browser and head to https://localhost:4000/ to access the interface.

User 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)

Note

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.

TODO

  • Generate block/unblock schedule on startup
  • Check if clients should be blocked/unblocked at the time the schedule is applied
  • Keep track of the login state with the Unifi Controller better
  • Error handling if the login state is stale
  • Tidy up the client UI
    • make the Cancel button actually do something
    • show some confirmation that the schedule has been applied on the server

About

Quick and nasty time based parental controls for a Unifi based network

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •