-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
118 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<% | ||
protocol="http://" | ||
%> | ||
|
||
<script type="text/javascript"> | ||
|
||
function copyToClipboard(text) { | ||
navigator.clipboard.writeText(text).then(() => { | ||
alert('复制成功: ' + text); | ||
window.location.reload(); | ||
}).catch(err => { | ||
console.error('复制失败: ', err); | ||
}); | ||
} | ||
//<![CDATA[ | ||
XHR.poll(3, '<%=url([[admin]], [[services]], [[nbtverify_status]])%>', null, | ||
function(x, res) { | ||
var tb = document.getElementById('nbtverify_status'); | ||
if (res && tb) | ||
{ | ||
const data= JSON.parse(res.data) | ||
console.log(JSON.stringify(data, null, 2)); | ||
if (res.running) | ||
{ | ||
// var URL = "<%=protocol%>" + window.location.hostname +":<%=luci.model.uci.cursor():get_first("nbtverify", "basic", "port") %>"; | ||
// tb.innerHTML = '<em><b style=\"color:green\"><%:The DDNS-GO service is running.%></b></em>'; | ||
// tb.innerHTML +='<em> <br/><br/>' + ' <b > <%:Click the new page to open ddns-go%> </em>'; | ||
tb.innerHTML = '<em><b style=\"color:green\"><%:The nbtverify service is running.%></b></em>'; | ||
// tb.innerHTML += "<input class=\"cbi-button cbi-button-reload \" type=\"button\" value=\"跳转\" onclick=\"window.open('"+ URL+ "/')\"/>"; | ||
try { | ||
const {result,detail}=data ?? {} | ||
const {baseUrl,success}=result ?? {} | ||
const {welcome,account,userIp,userMac,userName,deviceIp}=detail ?? {} | ||
const html = ` | ||
<span style="color: ${success?'green':'red'}; font-weight: bold;"><%:Success%>: ${success}</span> | ||
<br/> | ||
<span style="color: blue;font-size: large;">${welcome}</span> | ||
<br/> | ||
<span style="color: darkorange;font-size: large;">${account}</span> | ||
<br/> | ||
<div style="font-family: Arial, sans-serif; display: grid; grid-template-columns: 100px 1fr; gap: 10px; line-height: 1.5; align-items: center;"> | ||
<span style="display: flex; align-items: center;"><%:校园网IP%>:</span> | ||
<span style="font-weight: bold;">${userIp} | ||
<button onclick="copyToClipboard('${userIp}')" style="margin-left: 8px;" class="cbi-button cbi-button-neutral">复制</button> | ||
</span> | ||
<span style="display: flex; align-items: center;"><%:MAC%>:</span> | ||
<span style="font-weight: bold;">${userMac} | ||
<button onclick="copyToClipboard('${userMac}')" style="margin-left: 8px;" class="cbi-button cbi-button-neutral">复制</button> | ||
</span> | ||
<span style="display: flex; align-items: center;"><%:用户名%>:</span> | ||
<span style="font-weight: bold;">${userName} | ||
<button onclick="copyToClipboard('${userName}')" style="margin-left: 8px;" class="cbi-button cbi-button-neutral">复制</button> | ||
</span> | ||
<span style="display: flex; align-items: center;"><%:上级路由%>:</span> | ||
<span style="font-weight: bold;">${deviceIp} | ||
<button onclick="copyToClipboard('${deviceIp}')" style="margin-left: 8px;" class="cbi-button cbi-button-neutral">复制</button> | ||
</span> | ||
<span style="display: flex; align-items: center;"><%:登录地址%>:</span> | ||
<span style="font-weight: bold;"> | ||
<button onclick="copyToClipboard('${baseUrl}')" style="margin-left: 8px;" class="cbi-button cbi-button-neutral">复制</button> | ||
</span> | ||
</div> | ||
` | ||
tb.innerHTML += html | ||
|
||
} catch (error) { | ||
tb.innerHTML += '<br /><em style=\"color:red\"><%:backend error.%></em><br/>'; | ||
} | ||
} | ||
else | ||
{ | ||
tb.innerHTML = '<em style=\"color:red\"><%:The nbtverify service is not running.%></em><br/>'; | ||
} | ||
} | ||
} | ||
); | ||
//]]></script> | ||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style> | ||
<fieldset class="cbi-section"> | ||
<legend><%:nbtverify status%></legend> | ||
<p id="nbtverify_status"> | ||
<em><%:Collecting data...%></em> | ||
</p> | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters