mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 13:16:05 +00:00
fix
This commit is contained in:
parent
fa788ce964
commit
782f49c8b2
17
app/index.js
17
app/index.js
|
@ -5,10 +5,13 @@ var CONFIG = require("lib/config");
|
||||||
var FILE = require("lib/file");
|
var FILE = require("lib/file");
|
||||||
var OldBrowser = require("lib/oldbrowser");
|
var OldBrowser = require("lib/oldbrowser");
|
||||||
var HTTP = require("lib/http");
|
var HTTP = require("lib/http");
|
||||||
|
var SYS = require("lib/system");
|
||||||
|
|
||||||
var apiUrl = CONFIG.readConfig("/Config/ApiUrl").first().text;
|
var apiUrl = CONFIG.readConfig("/Config/ApiUrl").first().text;
|
||||||
var token, userId;
|
var token, userId;
|
||||||
|
|
||||||
|
var servers = [];
|
||||||
|
|
||||||
var getAssignedServers = function() {
|
var getAssignedServers = function() {
|
||||||
var assignedServers = [];
|
var assignedServers = [];
|
||||||
|
|
||||||
|
@ -48,6 +51,11 @@ var showServers = function() {
|
||||||
entry.find("a.title").text(res.data[i].ipaddress);
|
entry.find("a.title").text(res.data[i].ipaddress);
|
||||||
entry.find("div.description").text(res.data[i].name);
|
entry.find("div.description").text(res.data[i].name);
|
||||||
entry.appendTo("#listview");
|
entry.appendTo("#listview");
|
||||||
|
|
||||||
|
servers.push({
|
||||||
|
"data": res.data[i],
|
||||||
|
"entry": entry
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +72,15 @@ var showServers = function() {
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var pingTest = function() {
|
||||||
|
for (var i = 0; i < servers.length; i++) {
|
||||||
|
var responseTime = SYS.pingTest(servers[i].data.ipaddress);
|
||||||
|
servers[i].entry.find("span.ping").text("Speed: " + responseTime + " ms");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.getElementById("btn_pingtest").onclick = pingTest;
|
||||||
|
pingTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,17 @@
|
||||||
<div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div>
|
<div class="col width-fit mobile-width-fit"><span class="icon icon-bookmark color-blue"></span></div>
|
||||||
<div class="col width-fill mobile-width-fill">
|
<div class="col width-fill mobile-width-fill">
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
<span class="text">
|
<span class="ping text">
|
||||||
123
|
N/A
|
||||||
</span>
|
</span>
|
||||||
<span class="icon icon-star color-yellow"></span>
|
<span class="icon icon-star color-yellow"></span>
|
||||||
</span>
|
</span>
|
||||||
<div class="col width-fill mobile-width-fill">
|
<div class="col width-fill mobile-width-fill">
|
||||||
<a class="title fatty" href="#">Repo 1</a>
|
<a class="title fatty" href="#">Repo 1</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="description col">This is one of my coolest repos.</div>
|
<div class="description col">
|
||||||
|
<span class="text">This is one of my coolest repos.</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,5 +26,6 @@
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button id="btn_logout" class="button" type="button">로그아웃</button>
|
<button id="btn_logout" class="button" type="button">로그아웃</button>
|
||||||
|
<button id="btn_pingtest" class="button" type="button">속도 재측정</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -191,3 +191,14 @@ exports.createShortcut = function(shoutcutName, fileName) {
|
||||||
link.WorkingDirectory = workingDirectory;
|
link.WorkingDirectory = workingDirectory;
|
||||||
link.Save();
|
link.Save();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.pingTest = function(remoteAddr) {
|
||||||
|
var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2");
|
||||||
|
var query = "Select * From win32_PingStatus where address='" + remoteAddr + "'";
|
||||||
|
|
||||||
|
var colItems = wmi.ExecQuery(query);
|
||||||
|
var enumItems = new Enumerator(colItems);
|
||||||
|
var objItem = enumItems.item();
|
||||||
|
|
||||||
|
return objItem.ResponseTime;
|
||||||
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNjA0NTU4MjExLCJ0dGwiOjIwLCJ0eXBlIjoiYXV0aCIsImtleSI6Ijg1N2NlZDg1LTMzOWEtNDViNS04YTQ5LTJjOGM0YmE4ZDVmNCIsInByb2plY3QiOiJuZXRzb2xpZCJ9.1SzHv4-nbeBhm4qdfNHI3vswEEZvv5J0fqx_pwt1gEE
|
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNjA0NTU4NDA2LCJ0dGwiOjIwLCJ0eXBlIjoiYXV0aCIsImtleSI6Ijg1N2NlZDg1LTMzOWEtNDViNS04YTQ5LTJjOGM0YmE4ZDVmNCIsInByb2plY3QiOiJuZXRzb2xpZCJ9.g9b-GIIye9n8rypaoeDp9j7-AfBMeXIPQeRo01kjtd0
|
Loading…
Reference in New Issue
Block a user