Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

# Change these settings to your own preference
[*]
indent_style = space
indent_size = 4
tab_width = 4

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
.idea

/dev

*.sw?

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript
13 changes: 13 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.*.swp
._*
.DS_Store
.editorconfig
.git
.gitignore
.hg
.lock-wscript
.wafpickle-*
CVS
npm-debug.log
travis.yml
/docs
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:
- "0.12"
before_script:
- "sh -e /etc/init.d/xvfb start"
- npm install node-red-firebase
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 André L.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

69 changes: 54 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,66 @@
# Firebase nodes for Node-RED

Check it out! Now you can access your Firebase data with Node-RED!
[![Dependency Status](https://gemnasium.com/vergissberlin/node-red-firebase.svg)](https://gemnasium.com/vergissberlin/node-red-firebase) [![Build Status](https://api.travis-ci.org/vergissberlin/node-red-firebase.png?branch=master)](https://travis-ci.org/vergissberlin/node-red-firebase) [![Inline docs](http://inch-ci.org/github/vergissberlin/node-red-firebase.svg?branch=master)](http://inch-ci.org/github/vergissberlin/node-red-firebase) [![Issues](http://img.shields.io/github/issues/vergissberlin/node-red-firebase.svg)](https://github.com/vergissberlin/node-red-firebase/issues "GitHub ticket system") [![npm version](https://img.shields.io/npm/v/node-red-contrib-keymetrics.png)](https://npmjs.org/package/node-red-firebase "View this project on npm") [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vergissberlin/node-red-firebase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Greenkeeper badge](https://badges.greenkeeper.io/vergissberlin/node-red-firebase.svg)](https://greenkeeper.io/)

---

Check it out! Now you can access your Firebase data with Node-RED!
This allows you to automate Firebase data manipulation or generate custom events based on what's going on with your data store.

Installing node-red-firebase
----------------------------

npm install firebase
cd nodes/
git clone https://github.com/hovissimo/node-red-firebase
![Inline docs](docs/node-watch-200.png) ![Inline docs](docs/node-query-200.png) ![Inline docs](docs/node-modify-200.png)


## Dedicated to

**If you are using**

- the fantastic program [Node-RED](http://nodered.org),
- and you wanna interact with [Firebase API](https://www.firebase.com) <sup>[1](#glossary)</sup>,

**that node is made for you!**

---

## Features

Check out the demo flows
-----------------------
To see the Firebase nodes in action, you can start Node-RED with
1. **Modify node**
- [SET](https://www.firebase.com/docs/web/api/firebase/set.html), [PUSH](https://www.firebase.com/docs/web/api/firebase/push.html), [UPDATE](https://www.firebase.com/docs/web/api/firebase/update.html), [REMOVE](https://www.firebase.com/docs/web/api/firebase/remove.html) record
2. **Watch node**
- Watch [on changes](https://www.firebase.com/docs/web/api/query/on.html) _Firebase_ API childs and send content to the output of the node
3. **Query node**
- Query to a value of a Firebase node

node red nodes/node-red-firebase/demo_flows.json

## Installation

Note: You'll need to register your own Firebase account, and edit all of the Firebase nodes to use your personal Firebase URL.
cd ~/.node-red
npm install node-red-firebase
node-red -v

Open your *Node-RED* Frontend and you will find the new node under the group *output*. **Happy wiring!**

## Demo
Check out the demo flows to see the Firebase nodes in action, you can start Node-RED with

node-red node_modules/node-red-firebase/demo_flows.json

It's easiest to see what's going on if you have the live Firebase view open in another browser window while you interact with the flows.

Have questions? Found a bug?
-----------------------------
Please submit issues to the Github issue tracker
## Bugs, questions, contribute
- **Found a bug?** Please submit issues to the [Github issue tracker](https://github.com/vergissberlin/node-red-firebase/issues).
- **Have questions?** Please use [Gitter](https://gitter.im/vergissberlin/node-red-firebase?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) to get in contact with me
- **Wanna contribute?** Please make a [fork](https://github.com/vergissberlin/node-red-firebase#fork-destination-box) an send me an pull request.


## Thanks
Special thanks to
- Dave Conway-Jones and Nick O'Leary from IBM, founders of Node-RED.
- [hvissimo](https://github.com/hovissimo) for base of the Firebase node.


---

**Glossary <a id="glossary"></a>**

1. *[PM2](https://github.com/Unitech/pm2) Firebase is a cloud services provider and backend as a service company based in San Francisco, California. The company makes a number of products for software developers building mobile or web applications.*

Binary file added docs/node-modify-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-modify-300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-modify-500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-query-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-query-300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-query-500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-watch-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-watch-300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/node-watch-500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/settings-modify-500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions firebase_login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<script type="text/x-red" data-template-name="firebase login">

<!-- Select type -->
<div class="form-row">
<label for="node-config-input-appid"><i class="fa fa-fire"></i>Firebase</label>
https:// <input class="input-append-left" type="text" id="node-config-input-appid" placeholder="your-firebase-appid" style="width: 36%">.firebaseio.com
</div>


<!-- Select type -->
<div class="form-row">
<label for="login-type-select"><i class="fa fa-shield"></i> Type</label>
<select id="login-type-select">
<option value="custom">Custom with secret</option>
<option value="email">Email</option>
</select>
<input type="hidden" id="node-config-input-type">
</div>


<!-- Custom login -->
<div class="form-row login-row login-row-custom hidden" id="login-row-custom">
<label for="node-config-input-uid"><i class="fa fa-user"></i> User id</label>
<input class="input-append-left" type="text" id="node-config-input-uid" placeholder="your user id">
</div>
<div class="form-row login-row login-row-custom hidden" id="login-row-custom">
<label for="node-config-input-secret"><i class="fa fa-credit-card"></i> Secret</label>
<input class="input-append-left" type="password" id="node-config-input-secret" placeholder="your secret">
</div>


<!-- Email login -->
<div class="form-row login-row login-row-email hidden" id="login-row-email">
<label for="node-config-input-email"><i class="fa fa-envelope"></i> Email</label>
<input class="input-append-left" type="email" id="node-config-input-email" placeholder="your@email.com">
</div>
<div class="form-row login-row login-row-email hidden" id="login-row-email-password">
<label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
<input class="input-append-left" type="password" id="node-config-input-password">
</div>


<!-- Tips -->
<div class="form-tips">
<p>Enter your firebase id <code>https://&#x3C;your-firebase&#x3E;.firebasio.com</code> and credentials.</p>
</div>

</script>

<script type="text/javascript">
(function () {

RED.nodes.registerType('firebase login', {
category: 'config',

defaults: {
appid: {value: '', required: false},
value: {value: '', required: false},
uid: {value: '', required: false},
secret: {value: '', required: false},
email: {value: '', required: false},
password: {value: '', required: false}
},

credentials: {
appid: {type: 'text', required: true},
type: {type: 'text', required: false},
uid: {type: 'text', required: true},
secret: {type: 'password', required: true},
email: {type: 'text', required: true},
password: {type: 'password', required: true}
},

label: function () {
return typeof this.appid ? 'Firebase ' + this.appid : 'Firebase ' + this.email;
},

labelStyle: function () {
return this.name ? 'node_label_italic' : '';
},

oneditprepare: function () {

var
$nodeConfigInputType = $('#node-config-input-type'),
type = $nodeConfigInputType.val(),
$loginTypeSelect = $('#login-type-select');

$loginTypeSelect.change(function () {
var id = $(this).find('option:selected').val();
$('.login-row').hide();
$('.login-row-' + id).show();
$nodeConfigInputType.val(id);
});

$('.login-row').hide();

// select current type
if (type) {
$loginTypeSelect.val(
$nodeConfigInputType.val()
);
$('.login-row-' + type).show();
} else {
// set default
$('.login-row-custom').show();
$nodeConfigInputType.val('custom');
}
},
exportable: true
});
})();
</script>
Loading