mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Add basic announce capability to mdns node.
This commit is contained in:
@@ -16,15 +16,15 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="discovery">
|
||||
<div class="form-row">
|
||||
<label for="node-input-service"><i class="icon-gear"></i> Service</label>
|
||||
<label for="node-input-service"><i class="fa fa-gear"></i> Service</label>
|
||||
<input type="text" id="node-input-service" placeholder="_http._tcp">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-topic"><i class="icon-tasks"></i> Topic</label>
|
||||
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
|
||||
<input type="text" id="node-input-topic" placeholder="Topic">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-tips">The service <i>must</i> start with an underscore _ and end ._tcp or ._udp</div>
|
||||
@@ -63,3 +63,58 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-template-name="announce">
|
||||
<div class="form-row">
|
||||
<label for="node-input-service"><i class="fa fa-gear"></i> Service</label>
|
||||
<input type="text" id="node-input-service" placeholder="_http._tcp">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-port"><i class="fa fa-random"></i> Port</label>
|
||||
<input type="text" id="node-input-port" placeholder="9999">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-txt"><i class="fa fa-tasks"></i> TxtRecord</label>
|
||||
<input type="text" id="node-input-txt" placeholder='"name":"value","name2":"value2"'>
|
||||
</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 of service">
|
||||
</div>
|
||||
<div class="form-tips">%h in the name will be replaced by the machine hostname.</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="announce">
|
||||
<p>Provides a Bonjour / Avahi / Zeroconf announcement node.</p>
|
||||
<p>If <b>msg.payload</b> is 0 - the announcement is stopped. Any other value starts the announcement process.</p>
|
||||
<p>The announcement can be customised by the msg if not configured in the edit panel.</p>
|
||||
<p><ul>
|
||||
<li><b>msg.service</b> - For a full list of official service types see <i><a href="http://www.dns-sd.org/ServiceTypes.html" target="_new">this list</a></i>.</li>
|
||||
<li><b>msg.port</b> - the tcp or udp port to use.</li>
|
||||
<li><b>msg.name</b> - the short description name of the service. If you use %h in the name, it will be replaced by the machine hostname.</li>
|
||||
<li><b>msg.txtRecord</b> - a set of comma separated name:value pairs </li>
|
||||
</ul></p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('announce',{
|
||||
category: 'network-output',
|
||||
color:"palegoldenrod",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
service: {value:"",required:true,validate:RED.validators.regex(/^_.*\._(tc|ud)p$/)},
|
||||
port: {value:""},
|
||||
txt: {value:""}
|
||||
},
|
||||
inputs:1,
|
||||
outputs:0,
|
||||
icon: "bonjour.png",
|
||||
align:"right",
|
||||
label: function() {
|
||||
return this.name||this.service||"announce";
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user