node-red-node-web-nodes
Version:
A collection of Node-RED nodes for popular web services.
202 lines (187 loc) • 8.31 kB
HTML
<!--
Copyright 2014 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="dropbox-config">
<div class="form-row">
<label for="node-config-input-appkey" style="width:120px;"><i class="fa fa-key"></i> App Key</label>
<input class="input-append-left" type="text" id="node-config-input-appkey" style="width: 60%;" >
</div>
<div class="form-row">
<label for="node-config-input-appsecret" style="width:120px;"><i class="fa fa-lock"></i> App Secret</label>
<input class="input-append-left" type="password" id="node-config-input-appsecret" style="width: 60%;" >
</div>
<div class="form-row">
<label for="node-config-input-accesstoken" style="width:120px;"><i class="fa fa-bookmark"></i> Access Token</label>
<input class="input-append-left" type="password" id="node-config-input-accesstoken" style="width: 60%;" >
</div>
<div class="form-tips">
To obtain these credentials, visit the <i><a href="https://www.dropbox.com/developers" target="_new">Dropbox developer home</a></i>.<br/>
Once signed up:
<ol>
<li>click "Create app",</li>
<li>select "Dropbox API app",</li>
<li>select "Files and datastores",</li>
<li>choose an appropriate answer as to whether your node should be
limited to its own folder or given full access. (This can be
changed later so choose "Yes" to restrict the application
while testing might be a good idea.)</li>
<li>choose an app name</li>
<li>click "Create app".</li>
</ol>
The subsequent app page will contain the App key, App secret and a
"Generate" button to produce a suitable "access token".
</div>
</script>
<script type="text/javascript">
(function() {
RED.nodes.registerType('dropbox-config',{
category: 'config',
defaults: { },
credentials: {
appkey: {type:"text",required:true},
appsecret: {type: "password",required:true},
accesstoken: {type: "password",required:true},
},
label: function() {
return 'Dropbox'; // TODO: get display_name from account info?
},
exportable: false,
});
})();
</script>
<script type="text/x-red" data-template-name="dropbox in">
<div class="form-row">
<label for="node-input-dropbox"><i class="fa fa-user"></i> Dropbox</label>
<input type="text" id="node-input-dropbox">
</div>
<div class="form-row node-input-filepattern">
<label for="node-input-filepattern"><i class="fa fa-file"></i> Filename Pattern</label>
<input type="text" id="node-input-filepattern" placeholder="Filepattern">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="dropbox in">
<p>Dropbox watch node. Watches for file events on Dropbox.</p>
<p>By default all file events are reported, but the filename pattern can
be supplied to limit the events to files which have full filenames
that match the glob pattern.</p>
<p>The event messages consist of the
full filename in <b>msg.payload</b> property, the filename
in <b>msg.file</b>, the event type in <b>msg.event</b> and
the <a href="https://github.com/dropbox/dropbox-js">dropbox.js</a>
API <a href="http://coffeedoc.info/github/dropbox/dropbox-js/master/classes/Dropbox/Http/PulledChange.html">PulledChange</a>
object in <b>msg.data</b>.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('dropbox in',{
category: 'storage-input',
color:"#C0DEED",
defaults: {
dropbox: {type:"dropbox-config",required:true},
filepattern: {value:""},
name: {value:""}
},
inputs: 0,
outputs: 1,
icon: "dropbox.png",
label: function() {
return this.name||this.filepattern||'Dropbox';
}
});
</script>
<script type="text/x-red" data-template-name="dropbox">
<div class="form-row">
<label for="node-input-dropbox"><i class="fa fa-user"></i> Dropbox</label>
<input type="text" id="node-input-dropbox">
</div>
<div class="form-row node-input-filename">
<label for="node-input-filename"><i class="fa fa-file"></i> Filename</label>
<input type="text" id="node-input-filename" placeholder="Filename">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="dropbox">
<p>Dropbox input node. Downloads content from Dropbox.</p>
<p>The filename on Dropbox is taken from the node <b>filename</b>
property or the <b>msg.filename</b> property.</p>
<p>The downloaded content is sent as <b>msg.payload</b> property. If the download
fails <b>msg.error</b> will contain an error object.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('dropbox',{
category: 'storage-input',
color:"#C0DEED",
defaults: {
dropbox: {type:"dropbox-config",required:true},
filename: {value:""},
name: {value:""}
},
inputs: 1,
outputs: 1,
icon: "dropbox.png",
align: "right",
label: function() {
return this.name||this.filename||'Dropbox';
}
});
</script>
<script type="text/x-red" data-template-name="dropbox out">
<div class="form-row">
<label for="node-input-dropbox"><i class="fa fa-user"></i> Dropbox</label>
<input type="text" id="node-input-dropbox">
</div>
<div class="form-row node-input-filename">
<label for="node-input-filename"><i class="fa fa-file"></i> Filename</label>
<input type="text" id="node-input-filename" placeholder="Filename">
</div>
<div class="form-row node-input-localFilename">
<label for="node-input-localFilename"><i class="fa fa-file"></i> Local Filename</label>
<input type="text" id="node-input-localFilename" placeholder="Local Filename">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="dropbox out">
<p>Dropbox out node. Uploads content to Dropbox.</p>
<p>The filename on Dropbox is taken from the node <b>filename</b> property or the <b>msg.filename</b> property.</p>
<p>You can pass in content either as a filename by setting the <b>localFilename</b> field or
<b>msg.localFilename</b> property, or you can pass in content directly using <b>msg.payload</b>.</p>
<p>The file will be uploaded to a directory on Dropbox called Apps/{appname}/{appfolder}
where {appname} and {appfolder} are set when you set up the Dropbox application key and token.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('dropbox out',{
category: 'storage-output',
color:"#C0DEED",
defaults: {
dropbox: {type:"dropbox-config",required:true},
filename: {value:""},
localFilename: {value:""},
name: {value:""}
},
inputs:1,
outputs:0,
icon: "dropbox.png",
align: "right",
label: function() {
return this.name||this.filename||this.localFilename||'Dropbox';
}
});
</script>