node-red-contrib-matrix-chat/src/matrix-whois-user.html
Skylar Sadlier fd605005d1 Closes #99
- matrix-server-config now auto populates with first option
2023-10-21 19:47:12 -06:00

93 lines
3.8 KiB
HTML

<script type="text/javascript">
RED.nodes.registerType('matrix-whois-user', {
category: 'matrix',
color: '#00b7ca',
icon: "matrix.png",
outputLabels: ["success", "error"],
inputs:1,
outputs:2,
defaults: {
name: { value: null },
server: { type: "matrix-server-config" },
},
label: function() {
return this.name || "WhoIs User";
},
paletteLabel: 'WhoIs User'
});
</script>
<script type="text/html" data-template-name="matrix-whois-user">
<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>
<div class="form-row">
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
<input type="text" id="node-input-server">
</div>
<div class="form-tips" style="margin-bottom: 12px;">
User must be an admin to use this endpoint.
</div>
</script>
<script type="text/html" data-help-name="matrix-whois-user">
<h3>Details</h3>
<p>This node returns information about the active sessions for a specific user.</p>
<a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#query-current-sessions-for-a-user" target="_blank">Matrix API Endpoint Information</a>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg.userId
<span class="property-type">string</span>
</dt>
<dd> ID of user to do whois request for (ex: @bob:example.com)</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Success
<dl class="message-properties">
<dt>msg.payload <span class="property-type">object</span></dt>
<dd>This returns data directly from the API endpoint. <a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#query-current-sessions-for-a-user" target="_blank">Click here</a> to see more info.</dd>
<dt>msg.payload.user_id <span class="property-type">string</span></dt>
<dd>The Matrix user ID of the user.</dd>
<dt>msg.payload.devices <span class="property-type">object</span></dt>
<dd>Each key in this object is an identifier for one of the user's devices.</dd>
<dt>msg.payload.devices.X.sessions <span class="property-type">array</span></dt>
<dd>A user's sessions (i.e. what they did with an access token from one login).</dd>
<dt>msg.payload.devices.X.sessions[].connections <span class="property-type">array</span></dt>
<dd>Information about particular connections in the session.</dd>
<dt>msg.payload.devices.X.sessions[].connections[].ip <span class="property-type">string</span></dt>
<dd>Most recently seen IP address of the session.</dd>
<dt>msg.payload.devices.X.sessions[].connections[].last_seen <span class="property-type">integer</span></dt>
<dd>Unix timestamp that the session was last active.</dd>
<dt>msg.payload.devices.X.sessions[].connections[].user_agent <span class="property-type">string</span></dt>
<dd>User agent string last seen in the session.</dd>
</dl>
</li>
<li>Error
<dl class="message-properties">
<dt>msg.error <span class="property-type">string</span></dt>
<dd>the error that occurred.</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p>
<ul>
<li><a href="https://matrix-org.github.io/synapse/develop/admin_api/user_admin_api.html#query-current-sessions-for-a-user">Matrix Doc</a> - Doc reference for User Whois API</li>
</ul>
</p>
</script>