add functioning graceful shutdown/restart buttons to toopie.html
This commit is contained in:
@@ -50,3 +50,12 @@ fetch("http://proxy.i2p").then(myJson => {
|
||||
console.log("FETCH RESULT", myJson);
|
||||
contentUpdateById("proxy-check", "proxySuccessStatus");
|
||||
});
|
||||
|
||||
UpdateContents();
|
||||
|
||||
const minutes = 0.2;
|
||||
const interval = minutes * 60 * 1000;
|
||||
|
||||
setInterval(function() {
|
||||
UpdateContents();
|
||||
}, interval);
|
||||
|
||||
@@ -15,7 +15,7 @@ function makeid(length) {
|
||||
function send(message) {
|
||||
async function postData(url = "", data = {}) {
|
||||
// Default options are marked with *
|
||||
console.log("(i2pcontrol)");
|
||||
//console.log("(i2pcontrol)");
|
||||
let requestBody = JSON.stringify(data);
|
||||
let opts = {
|
||||
method: "POST", // *GET, POST, PUT, DELETE, etc.
|
||||
@@ -59,7 +59,7 @@ function gettoken(authtoken) {
|
||||
}
|
||||
|
||||
function Done(output) {
|
||||
console.log("(i2pcontrol) I2PControl connection tested,", output);
|
||||
//console.log("(i2pcontrol) I2PControl connection tested,", output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ function Echo(message) {
|
||||
|
||||
function UpdateEchoElementByID(Query, ID) {
|
||||
function updateelement(update) {
|
||||
console.log("(i2pcontrol)", update);
|
||||
//console.log("(i2pcontrol)", update);
|
||||
document.getElementById(ID).innerText = update;
|
||||
}
|
||||
let net = Echo(Query);
|
||||
@@ -134,7 +134,7 @@ function I2PControl(Query) {
|
||||
|
||||
function UpdateI2PControlElementByID(Query, ID) {
|
||||
function updateelement(update) {
|
||||
console.log("(i2pcontrol)", update);
|
||||
//console.log("(i2pcontrol)", update);
|
||||
document.getElementById(ID).innerText = update;
|
||||
}
|
||||
let net = I2PControl(Query);
|
||||
@@ -159,12 +159,12 @@ function RouterInfo(Query) {
|
||||
|
||||
function UpdateRouterInfoElementByID(Query, ID) {
|
||||
function updateelement(update) {
|
||||
console.log(
|
||||
"(i2pcontrol)",
|
||||
update.result[Query],
|
||||
ID,
|
||||
document.getElementById(ID)
|
||||
);
|
||||
//console.log(
|
||||
//"(i2pcontrol)",
|
||||
//update.result[Query],
|
||||
//ID,
|
||||
//document.getElementById(ID)
|
||||
//);
|
||||
document.getElementById(ID).innerText = update.result[Query];
|
||||
}
|
||||
let net = RouterInfo(Query);
|
||||
@@ -189,7 +189,7 @@ function RouterManager(Query) {
|
||||
|
||||
function UpdateRouterManagerElementByID(Query, ID) {
|
||||
function updateelement(update) {
|
||||
console.log("(i2pcontrol)", update);
|
||||
//console.log("(i2pcontrol)", update);
|
||||
document.getElementById(ID).innerText = update;
|
||||
}
|
||||
let net = RouterManage(Query);
|
||||
@@ -214,7 +214,7 @@ function NetworkSetting(Query) {
|
||||
|
||||
function UpdateNetworkSettingElementByID(Query, ID) {
|
||||
function updateelement(update) {
|
||||
console.log("(i2pcontrol)", update);
|
||||
//console.log("(i2pcontrol)", update);
|
||||
document.getElementById(ID).innerText = update;
|
||||
}
|
||||
let net = NetworkSetting(Query);
|
||||
@@ -268,13 +268,5 @@ function UpdateContents() {
|
||||
);
|
||||
}
|
||||
|
||||
UpdateContents();
|
||||
|
||||
const minutes = 0.125;
|
||||
const interval = minutes * 60 * 1000;
|
||||
|
||||
setInterval(function() {
|
||||
// catch all the errors.
|
||||
UpdateContents().catch(console.log);
|
||||
}, interval); //var done = Echo(hello);
|
||||
//var done = Echo(hello);
|
||||
//done.then(Done);
|
||||
|
||||
6
info.js
6
info.js
@@ -71,6 +71,12 @@ document.addEventListener("click", clickEvent => {
|
||||
};
|
||||
}
|
||||
refreshIdentity();
|
||||
} else if (clickEvent.target.id === "label-router-restart") {
|
||||
console.log("attempting to initiate graceful restart");
|
||||
RouterManager("RestartGraceful");
|
||||
} else if (clickEvent.target.id === "label-router-shutdown") {
|
||||
console.log("attempting to initiate graceful shutdown");
|
||||
RouterManager("ShutdownGraceful");
|
||||
} else if (clickEvent.target.id === "search-submit") {
|
||||
console.log("attempting to create search tab");
|
||||
goSearch();
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
},
|
||||
"background": {
|
||||
"scripts": [
|
||||
"i2pcontrol/i2pcontrol.js",
|
||||
"privacy.js",
|
||||
"platform.js",
|
||||
"background.js",
|
||||
@@ -50,7 +51,6 @@
|
||||
"proxy.js",
|
||||
"info.js",
|
||||
"home.js",
|
||||
"i2pcontrol/i2pcontrol.js",
|
||||
"scrub.js",
|
||||
"bookmarks.js"
|
||||
]
|
||||
|
||||
10
toopie.html
10
toopie.html
@@ -8,12 +8,10 @@
|
||||
<h1>I2P Router Information</h1>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a id="label-router-restart" target="_blank">Restart:</a> <span id="router-restart">Restart router</span>
|
||||
<li><button id="label-router-restart" target="_blank">Restart: <span id="router-restart">Gracefully restart router</span></button>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a id="label-router-shutdown" target="_blank">Shutdown:</a> <span id="router-shutdown">Gracefully shutdown router</span>
|
||||
<li><button id="label-router-shutdown" target="_blank">Shutdown: <span id="router-shutdown">Gracefully shutdown router</span></button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -56,6 +54,8 @@
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<script src="i2pcontrol/i2pcontrol.js"></script>
|
||||
<script src="i2pcontrol/i2pcontrol.js"></script>
|
||||
<script src="info.js"></script>
|
||||
<script src="content.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
BIN
toopie.png
BIN
toopie.png
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 68 KiB |
Reference in New Issue
Block a user