2 local ubus = require "ubus"
3 local sys = require "luci.sys"
4 local utl = require "luci.util"
7 function connect_ubus(methods)
9 local conn = ubus.connect()
12 error("Failed to connect to ubusd")
15 result = conn:call("otbr", methods, {})
20 function threadget(action)
21 local result = connect_ubus(action)
28 <h2><%:Add Joiner in Network: %><%=threadget("networkname").NetworkName%></h2>
33 <form class="inline" action="<%=url('admin/network/thread_add_joiner')%>" method="post" id="addForm" name="addForm" onsubmit="return validateForm()">
34 <div style="width:90%;margin-left:5%;">
35 <div class="cbi-value">
36 <label class="cbi-value-title" style="margin-right:5%;">New Joiner Credential</label>
37 <div class="cbi-value-title">
38 <input type="text" name="pskd" value="J01NME" style="width:40%;"/>
40 <div style="margin-left:25%;margin-top:1%;">
41 <span><img src="<%=resource .. "/cbi/help.gif"%>"/><%:The Joiner Credential is a device-specific string of all uppercase alphanumeric characters(0-9 and A-Y, excluding I, O, Q and Z for readability), with a length between 6 and 32 characters.%></span>
44 <div class="cbi-value">
45 <label class="cbi-value-title" style="margin-right:5%;">Restrict to a Specific Joiner</label>
46 <div class="cbi-value-title">
47 <input type="text" name="eui64" value="2157d22254527111" style="width:40%;"/>
49 <div style="margin-left:25%;margin-top:1%;">
50 <span><img src="<%=resource .. "/cbi/help.gif"%>"/><%:To restrict commissioning to a specific Joiner device, which is the devices factory-assigned IEEE EUI-64, use the eui64 parameter to get the EUI-64. You can input '*' to unrestrict to the specific joiner%></span>
53 <div class="cbi-value">
54 <label class="cbi-value-title" style="margin-right:5%;">Timeout</label>
55 <div class="cbi-value-title">
56 <input type="text" name="timeout" value="120" style="width:40%;"/>
60 <div class="cbi-page-actions right">
61 <input class="cbi-button cbi-button-neutral" style="float:left;" type="button" onclick="window.location.href='thread_view'" value="<%:Back to View%>" />
62 <input type="hidden" name="token" value="<%=token%>" />
63 <input class="cbi-button cbi-button-add important" type="submit" value="<%:Add%>" />
68 <script type="text/javascript" src="/luci-static/resources/handle_error.js"></script>
69 <script type="text/javascript">//<![CDATA[
70 handle_error(GetURLParameter('error'));
71 function validateForm()
73 var eui64 = document.forms["addForm"]["eui64"].value;
74 if(eui64.length != 16 && eui64 != "*")
76 alert("eui64 length must be 16 bytes or '*'");