47ng / create-freebox-app

Create an API application to use with a Freebox.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

create-freebox-app

Create an API application to use with a Freebox.

Compatible Freeboxes:

  • Freebox Mini 4K
  • Freebox Revolution (untested)

Read the Freebox API documentation before using.

Usage

Requirements

The script uses the following environment variables:

  • FREEBOX_URL (required): URL where to reach your Freebox
  • APP_ID (required): Unique identifier for your app
  • APP_NAME (required): Your app name
  • APP_VERSION (required): Your app's version
  • DEVICE_NAME (optional): Where the app will run / be deployed

Using Docker

This repository comes bundled as a Docker image for convenience:

$ docker run                          \
  -it                                 \
  --rm                                \
  -e FREEBOX_URL="http://192.168.1.1" \
  -e APP_ID="com.example.my-app"      \
  -e APP_NAME="My App"                \
  -e APP_VERSION="1.2.3"              \
  -e DEVICE_NAME="NAS"                \
  47ng/create-freebox-app

Using Node.js

  1. Install dependencies
$ yarn install
or
$ npm install
  1. Setup your environment

Create a .env file next to package.json, with the contents (customize to your needs):

FREEBOX_URL="http://192.168.1.1"
APP_ID="com.example.my-app"
APP_NAME="My App"
APP_VERSION="1.2.3"
DEVICE_NAME="NAS"
  1. Run the script:
$ yarn start
or
$ npm run start

Tips

Don't forget to stay close to your Freebox to manually accept the app authorization request.

What next ?

Use your app token to login to the Freebox API.

I'm planning on making an express middleware library to facilitate the exchange of session tokens with a Freebox, stay tuned.

About

Create an API application to use with a Freebox.

License:MIT License


Languages

Language:JavaScript 89.0%Language:Dockerfile 11.0%