Skip to content

A Webserver that provides the config/contents for the chrome-tab-rotate Chrome extension

License

Notifications You must be signed in to change notification settings

timoa/chrome-tab-rotate-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chrome-tab-rotate Webserver

Latest Release Build Status Docker Pulls

Quality Gate Status Security Rating Maintainability Rating

Bugs Code Smells Coverage Duplicated Lines (%)

A Webserver that provides the config/contents for the Tab Rotate Chrome extension.

The Chrome extension is open-source as chrome-tab-rotate.

This project is part of a bigger project called ScreenKit that includes the use of Raspberry PI, Chilipie Kiosk (Linux OS) that starts Chromium in fullscreen and other features, the Tab Rotate Chrome extension and this project that manage the contents and screens.

Features

  • Simple way to rotate contents on multiple screens!
  • Allow to use multiple Chrome Tab Rotate config files (playlists)
  • Webserver (Fastify) that can serves playlists and local contents (images, videos, etc.)
  • Default playlist for new screens or for using the same content on all the screens
  • Custom playlist based on the IP of the screen (support also local proxy server)
  • Available as a Docker image or by using npm/pm2

Warning

This project is meant to be use on a private network and not hosted on Internet.

Currently, there is no authentication, that mean that anyone in your local network can access to the playlist(s). Don't include any credential (Basic Auth or token) under your URLs if you want to keep them secret.

Also don't add content that needs to stay private for the same reason.

How to start

Docker image

Default with demo contents

The simplest way to test this project is by using Docker. The command below will launch the server with the demo contents from the src/examples/default.json playlist.

docker-compose up

Now, you can see the Playlist (JSON format) from your browser or command line at http://localhost:9000

curl http://localhost:9000

Customize with your own contents and screens

Simply copy the config files from the src/examples folder to the config folder (root of the project) and update these JSON files:

From To
src/examples/inventory.json => config/inventory.json
src/examples/playlists/default.json => config/playlists/default.json

If you want to have a specific playlist per screen, just create a playlist that will use the screen name that you filled on the inventory file.

For example, if you have the monitoring-01 and monitoring-02 in your your inventory.json file like this:

{
  "screens": [
    {
      "name": "monitoring-01",
      "ip": "10.0.0.11"
    },
    {
      "name": "monitoring-02",
      "ip": "10.0.0.12"
    }
  ]
}

You can create a playlist for each, by naming the file like this:

config/playlists/monitoring-01.json config/playlists/monitoring-02.json

Now, restart the Docker container to see the changes:

docker-compose down
docker-compose up
curl http://localhost:9000

Configure the Tab Rotate Chrome extension

Now that you have a web server up and running, you can set the options of the Tab Rotate Chrome extension to Remote Url and use:

  • http://localhost:9000 if the webserver is running on the same host as your Chrome browser
  • http://{ip of your webserver}:9000 if you're using a different host to test the Chrome Extension

Tab Rotate Chrome extension options

API Endpoints

Name Method Endpoint Description
Playlist GET / Provides the playlist based on the IP that request the endpoint or the default one
Content GET /content/:path Serve the local content from the path from the /public folder
Healthcheck GET /_health Allow to perform a healthcheck to see if the app is still live

Tests

API

You can launch the Docker container or node.js app and test the endpoints with Postman:

Run in Postman

NPM

Unit-tests

npm test

Coverage

npm run test:coverage

Functional

npm run test:functional

Will be replace by chai-http soon.

TODO

  • Split screen configuration and playlist
  • Add an endpoint to get random content from a folder (images for ex.)
  • Allow to edit the playlists and screens via a CMS instead of JSON files
  • Allow to schedule specific content (JIRA board during morning standup for ex.)
  • Support multiple playlists for the same IP (2x HDMI on the RPi 4 for ex.)