mirror of
https://github.com/skylord123/node-red-contrib-gamedig.git
synced 2025-07-08 19:51:06 -06:00
Compare commits
No commits in common. "09c763a605adf3e3b04cc48e620f4d816ec10d21" and "6836b82b0bd7a3283130db324868e0c7d1099be4" have entirely different histories.
09c763a605
...
6836b82b0b
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-contrib-gamedig",
|
||||
"version": "2.0.1",
|
||||
"version": "1.1.5",
|
||||
"description": "Query for the status of any game server using node-red",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -7,24 +7,17 @@
|
||||
server_type: { value: '', required: true },
|
||||
host: { value: '', required: true },
|
||||
port: { value: '' },
|
||||
halt_if: { value: '' },
|
||||
max_attempts: { value: '' },
|
||||
socket_timeout: { value: '' },
|
||||
attempt_timeout: { value: '' },
|
||||
halt_if: { value: '' }
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "icons/server.png",
|
||||
label: function() {
|
||||
if(this.name){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
if(this.host) {
|
||||
return (this.server_type ? this.server_type : 'Query') + ': ' + this.host + (this.port ? ":" + this.port : '');
|
||||
return `Query: ${this.host}`;
|
||||
}
|
||||
|
||||
return 'Query Game Server';
|
||||
return this.name || 'Query Game Server';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -59,7 +52,7 @@
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label> </label>
|
||||
<span>Query port for the server (not always the same as the join port). If this is left blank it will use the default port for the server type specified.</span>
|
||||
<span>Query port for the server (not always the same as the join port)</span>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
@ -74,33 +67,6 @@
|
||||
<label> </label>
|
||||
<span>Enter "online" or "offline" (without quotes) to filter out the state you don't want.</span>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-max_attempts"><i class="fa fa-server"></i> Max Attempts</label>
|
||||
<input type="text" id="node-input-max_attempts" placeholder="1" />
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label> </label>
|
||||
<span>Number of attempts to query server in case of failure.</span>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-socket_timeout"><i class="fa fa-server"></i> Socket Timeout</label>
|
||||
<input type="text" id="node-input-socket_timeout" placeholder="2000" />
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label> </label>
|
||||
<span>Milliseconds to wait for a single packet. Beware that increasing this will cause many queries to take longer even if the server is online.</span>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<label for="node-input-attempt_timeout"><i class="fa fa-server"></i> Attempt Timeout</label>
|
||||
<input type="text" id="node-input-attempt_timeout" placeholder="10000" />
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label> </label>
|
||||
<span>Milliseconds allowed for an entire query attempt. This timeout is not commonly hit, as the socketTimeout typically fires first.</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="query-game-server">
|
||||
@ -126,18 +92,6 @@
|
||||
msg.port <span class="property-type">integer</span>
|
||||
</dt>
|
||||
<dd>Query port of the server</dd>
|
||||
<dt class="optional">
|
||||
msg.max_attempts <span class="property-type">integer</span>
|
||||
</dt>
|
||||
<dd>Number of attempts to query server in case of failure.</dd>
|
||||
<dt class="optional">
|
||||
msg.socket_timeout <span class="property-type">integer</span>
|
||||
</dt>
|
||||
<dd>Milliseconds to wait for a single packet. Beware that increasing this will cause many queries to take longer even if the server is online.</dd>
|
||||
<dt class="optional">
|
||||
msg.attempt_timeout <span class="property-type">integer</span>
|
||||
</dt>
|
||||
<dd>Milliseconds allowed for an entire query attempt. This timeout is not commonly hit, as the socketTimeout typically fires first.</dd>
|
||||
</dl>
|
||||
<h3>Outputs</h3>
|
||||
<dl class="message-properties">
|
||||
@ -149,33 +103,5 @@
|
||||
msg.data <span class="property-type">object</span>
|
||||
</dt>
|
||||
<dd>Returns back the data we got from GameDig. Click <a href="https://github.com/sonicsnes/node-gamedig#return-value" style="color:#0000EE;">here</a> for more information on what this contains.</dd>
|
||||
<dt>
|
||||
msg.data.error <span class="property-type">string</span>
|
||||
</dt>
|
||||
<dd>Reason the server failed to query. Only returns if <code>msg.payload</code> is <code>offline</code>.</dd>
|
||||
<dt>
|
||||
msg.server_type <span class="property-type">string</span>
|
||||
</dt>
|
||||
<dt>
|
||||
msg.server_type <span class="property-type">string</span>
|
||||
</dt>
|
||||
<dt>
|
||||
msg.host <span class="property-type">string</span>
|
||||
</dt>
|
||||
<dt>
|
||||
msg.port <span class="property-type">integer</span>
|
||||
</dt>
|
||||
<dt>
|
||||
msg.halt_if <span class="property-type">string</span>
|
||||
</dt>
|
||||
<dt>
|
||||
msg.max_attempts <span class="property-type">integer</span>
|
||||
</dt>
|
||||
<dt>
|
||||
msg.socket_timeout <span class="property-type">integer</span>
|
||||
</dt>
|
||||
<dt>
|
||||
msg.attempt_timeout <span class="property-type">integer</span>
|
||||
</dt>
|
||||
</dl>
|
||||
</script>
|
@ -7,9 +7,6 @@ module.exports = function(RED) {
|
||||
this.host = config.host;
|
||||
this.port = config.port;
|
||||
this.halt_if = config.halt_if;
|
||||
this.max_attempts = config.max_attempts || 1;
|
||||
this.socket_timeout = config.socket_timeout || 2000;
|
||||
this.attempt_timeout = config.attempt_timeout || 10000;
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
|
||||
@ -29,25 +26,9 @@ module.exports = function(RED) {
|
||||
msg.halt_if = node.halt_if;
|
||||
}
|
||||
|
||||
if(node.max_attempts) {
|
||||
msg.max_attempts = node.max_attempts;
|
||||
}
|
||||
|
||||
if(node.socket_timeout) {
|
||||
msg.socket_timeout = node.socket_timeout;
|
||||
}
|
||||
|
||||
if(node.attempt_timeout) {
|
||||
msg.attempt_timeout = node.attempt_timeout;
|
||||
}
|
||||
|
||||
Gamedig.query({
|
||||
'type': msg.server_type,
|
||||
'host': msg.host,
|
||||
'port': msg.port,
|
||||
'maxAttempts': msg.max_attempts,
|
||||
'socketTimeout': msg.socket_timeout,
|
||||
'attemptTimeout': msg.attempt_timeout
|
||||
'host': msg.host
|
||||
})
|
||||
.then(function(state) {
|
||||
msg.payload = 'online';
|
||||
|
Loading…
x
Reference in New Issue
Block a user