Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added area and location #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "airbnb/legacy",
"rules": {
"func-names": 0,
"no-console": 0,
"guard-for-in": 0,
"max-len": 1
},
"env": {
"node": true,
"mocha": true,
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules/
.DS_Store
.project
.settings/
*.sw*
*.swp
npm-debug.log
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "node"
script:
- npm run lint-js
- npm test
82 changes: 82 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Change Log

All notable changes to this project will be documented in this file.

As of `v0.1.0`, this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

## [0.2.4] - 2016-01-13

* Extracts macros into a standalone lib/macros.js file
* Adds Favicon (thanks @flochtililoch)
* Adds npm run test:watch action (thanks @OvisMaximus)
* Travis build will now run linter
* Updated dependencies
* Uses local version of jQuery for testing now

## [0.2.3] - 2016-01-03

* Fixing bug where labels were loaded before config (thanks @flochtililoch)

## [0.2.2] - 2016-01-01

* Removing `Makefile` for running tests. Only need `package.json`.
* Fixing .gitignore error for the global lirc_web build

## [0.2.1] - 2015-12-31

* `lirc_web` can now be installed globally and called by `lirc_web` from CLI
* Adding ESLint to the mix and ensuring all JS conforms to Airbnb ES5 standards

## [0.2.0] - 2015-12-30

* Adding `blacklist` configuration option to hide unused keys from UI (thanks @OvisMaximus)
* Adding support for SSL (thanks @de-live-gdev)
* Fixing example config in the README (thanks @de-live-gdev)
* Fixes url escaping bug with macros and remotes (issue #23)

## [0.1.0] - 2015-12-30

* Locking npm versions to ensure future install work
* Adding `CHANGELOG.md`
* Adding `/refresh` link on bottom to reload UI after making changes to LIRC (thanks @f00f)
* Adding ability to set custom labels on command and remote names (thanks @elysion)
* Adding Apple mobile app capability, disabling zoom (thanks @elysion)
* Moving Lato fonts locally to remove external network dependency

## [0.0.8] - 2014-01-18

* Adding `macros` configuration option
* Fixing bug with setInterval causing repeaters to potentially never stop

## [0.0.7] - 2013-12-29

* Adding `send_start` and `send_stop` support to UI
* Adding `config.json` configuration file which allows users to set options
* Adding `repeaters` as a configuration file
* Adding documentation about API to README
* Setting up proper test suite with LIRC test fixtures

## [0.0.6] - 2013-12-01

* Adding `upstart` example configuration files

## [0.0.5] - 2013-08-21

* Locking swig dependency due to breaking change in new version
* `urlencode` command names (thanks @joe-forbes)

## [0.0.4] - 2013-05-16

* Fixing iOS caching error that was preventing commands from sending

## [0.0.3] - 2013-03-31

## [0.0.2] - 2013-03-22

* Include compiled JS and CSS for ease of installation

## [0.0.1] - 2013-03-20

* Initial commit and integration with `lirc_node`
109 changes: 58 additions & 51 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,60 @@
module.exports = function(grunt) {

// Load some tasks
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-develop');

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

uglify: {
app: {
src: ['static/js/vendor/zepto.min.js',
'static/js/vendor/zepto.touch.js',
'static/js/vendor/fastclick.js',
'static/js/app/*.js'],
dest: 'static/js/compiled/app.js'
}
},

less: {
app: {
files: {
"static/css/compiled/app.css": "static/css/app.less"
}
}
module.exports = function (grunt) {
// Load some tasks
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-develop');
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

uglify: {
app: {
src: ['static/js/vendor/zepto.min.js',
'static/js/vendor/zepto.touch.js',
'static/js/vendor/fastclick.js',
'static/js/app/*.js'],
dest: 'static/js/compiled/app.js',
},
},

less: {
app: {
files: {
'static/css/compiled/app.css': 'static/css/app.less',
},

watch: {
scripts: {
files: ['static/js/app/*.js', 'static/js/vendor/*.js'],
tasks: ['uglify:app']
},
stylesheets: {
files: ['static/css/*.less'],
tasks: ['less']
}
},

develop: {
server: {
file: 'app.js',
env: { NODE_ENV: 'development'}
}
}
});

grunt.registerTask('default', ['uglify', 'less']);
grunt.registerTask('server', ['uglify', 'less', 'develop', 'watch']);

},
},

eslint: {
target: ['Gruntfile.js', 'app.js', 'lib/**/*.js', 'test/**/*.js'],
},

watch: {
scripts: {
files: ['static/js/app/*.js', 'static/js/vendor/*.js'],
tasks: ['uglify:app'],
},
stylesheets: {
files: ['static/css/*.less'],
tasks: ['less'],
},
serverscripts: {
files: ['<%= eslint.target %>'],
tasks: ['eslint'],
},
},

develop: {
server: {
file: 'app.js',
env: { NODE_ENV: 'development' },
},
},
});

grunt.registerTask('default', ['uglify', 'less', 'eslint']);
grunt.registerTask('server', ['uglify', 'less', 'eslint', 'develop', 'watch']);
};
12 changes: 0 additions & 12 deletions Makefile

This file was deleted.

80 changes: 65 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,53 @@ This project allows you to control LIRC from any web browser - phone, tablet, or

This is part of the [Open Source Universal Remote](http://opensourceuniversalremote.com) project.

[![Build Status](https://travis-ci.org/alexbain/lirc_web.png)](https://travis-ci.org/alexbain/lirc_web)

## Installation

You'll need to have [LIRC](http://lirc.org) installed and configured on your machine to use ``lirc_web``. In addition, you'll need to install [nodejs](http://nodejs.org). Once you have LIRC and nodejs installed and configured, you'll be able to install ``lirc_web`` and it's dependencies:
You'll need to have [LIRC](http://lirc.org) installed and configured on your machine to use ``lirc_web``. In addition, you'll need to install [nodejs](http://nodejs.org). Once you have LIRC and nodejs installed and configured, you'll be able to install ``lirc_web``:

git clone git://github.com/alexbain/lirc_web.git
cd lirc_web
npm install
node app.js
npm install -g lirc_web
lirc_web

Note that you may need to run the `npm install` command with `sudo`.

You're set! Verify the web interface works by opening ``http://SERVER:3000/`` in a web browser.
### Viewing

If you want to have the app available via port 80 and start on boot, there are example NGINX and Upstart configuration files included in the ``example_configs/`` directory.
Verify the web interface works by opening ``http://SERVER:3000/`` in a web browser.

If you want to have `lirc_web` available via port 80 and start on boot, there are example NGINX and Upstart configuration files included in the ``example_configs/`` directory.

## Configuration

As of v0.0.8, ``lirc_web`` supports customization through a configuration file (``config.json``) in the root of the project. There are currently four configuration options:
As of v0.0.8, ``lirc_web`` supports customization through a configuration file.

You may place this configuration file in one of two locations and `lirc_web` will detect it:

1. Place a file named `.lirc_web_config.json` in the home directory of the user running `lirc_web` (global installation)
2. Place a file named `config.json` in the root of the `lirc_web` project directory (local / development installation)

These are the available configuration options:

1. ``repeaters`` - buttons that repeatedly send their commands while pressed. A common example are the volume buttons on most remote controls. While you hold the volume buttons down, the remote will repeatedly send the volume command to your device.
2. ``macros`` - a collection of commands that should be executed one after another. This allows you to automate actions like "Play Xbox 360" or "Listen to music via AirPlay". Each step in a macro is described in the format ``[ "REMOTE", "COMMAND" ]``, where ``REMOTE`` and ``COMMAND`` are defined by what you have programmed into LIRC. You can add delays between steps of macros in the format of ``[ "delay", 500 ]``. Note that the delay is measured in milliseconds so 1000 milliseconds = 1 second.
3. ``commandLabels`` - a way to rename commands that LIRC understands (``KEY_POWER``, ``KEY_VOLUMEUP``) with labels that humans prefer (``Power``, ``Volume Up``).
4. ``remoteLabels`` - a way to rename the remotes that LIRC understands (``XBOX360``) with labels that humans prefer (``Xbox 360``).
5. ``blacklists`` - a way to hide unused commands from your remotes.
6. ``server`` - server configuration settings (ports, [SSL](http://serverfault.com/a/366374)).


#### Example config.json:


{
"server" : {
"port" : 3000,
"ssl" : false,
"ssl_cert" : "/home/pi/lirc_web/server.cert",
"ssl_key" : "/home/pi/lirc_web/server.key",
"ssl_port" : 3001
},
"repeaters": {
"SonyTV": {
"VolumeUp": true,
Expand Down Expand Up @@ -69,12 +87,20 @@ As of v0.0.8, ``lirc_web`` supports customization through a configuration file (
"remoteLabels": {
"Xbox360": "Xbox 360"
}
"blacklists": {
"Yamaha": [
"AUX2",
"AUX3"
]
}
}

Please see the `example_configs/` directory.


## Using the JSON API

Building an app on top of lirc_web is straight forward with the included JSON based RESTful API.
Building an app on top of `lirc_web` is straight forward with the included JSON based RESTful API.

API endpoints:

Expand All @@ -90,9 +116,13 @@ API endpoints:
## Development

Would you like to contribute to and improve ``lirc_web``? Fantastic. To contribute
patches, run tests or benchmarks, install ``lirc_web`` using the instructions above. Once that is complete, you'll need to setup the development environment.
patches, run tests or benchmarks, install ``lirc_web`` locally:

git clone git://github.com/alexbain/lirc_web.git
cd lirc_web
npm install

Now, you'll need to setup the development environment. ``lirc_web`` uses the [GruntJS](http://gruntjs.com/) built system to make development easier.
Next, you'll need to setup the development environment. ``lirc_web`` uses the [GruntJS](http://gruntjs.com/) built system to make development easier.

Install GruntJS (build environment):

Expand All @@ -109,15 +139,35 @@ Install GruntJS (build environment):
You can run the test suite by running:

```
make test
npm test
```

If you develop test driven, you may want to launch a continuous test which automatically restarts when server or tests are modified:

```
npm run test:watch
```

You can run the linter to confirm JS conforms to standards by running:

```
npm run lint-js
```

You can also run the linter continuously via grunt:
```
grunt watch
```


## Contributing

Before you submit a pull request with your change, please be sure to:

* Add new tests that prove your change works as expected.
* Ensure all existing tests are still passing.
* Add new tests that prove your change works as expected
* Ensure all existing tests are still passing
* Run the linter to ensure your code conforms to the js styleguide
* Update CHANGELOG.md file ('Unreleased' section) with concise bullet points

Once you're sure everything is still working, open a pull request with a clear
description of what you changed and why. I will not accept a pull request which
Expand All @@ -130,7 +180,7 @@ The exception to this would be refactoring existing code or changing documentati

(The MIT License)

Copyright (c) 2013 Alex Bain &lt;[email protected]&gt;
Copyright (c) 2013-2016 Alex Bain &lt;[email protected]&gt;

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
Loading