diff --git a/index.js b/index.js index b3968ac..d1ce5c8 100644 --- a/index.js +++ b/index.js @@ -87,7 +87,7 @@ async function addIp( ctx ){ // Remove ip after some time setTimeout(function(){ exec(`sudo ip -6 a del dev ${ethDev} ${ip}/64`); - },60*1000 ); + }, 5*60*1000 ); const ips = await exec(`ip -6 a show dev ${ethDev}| grep inet6.*global | awk '{print $2}'`); ctx.body = { ips : ips.split('\n').filter(v => v.length ).map( v => v.slice(0, -3)) }; @@ -98,7 +98,7 @@ async function logger( ctx, next ){ const startTime = Date.now(); await next(); const requestTime = Date.now() - startTime; - console.log(`${ctx.method} ${ctx.response.status} ${ctx.ip} "${ctx.request.headers['user-agent']}" - ${requestTime}`); + console.log(`${new Date().toISOString()} ${ctx.method} ${ctx.response.status} ${ctx.ip} "${ctx.request.headers['user-agent']}" - ${requestTime}`); } diff --git a/static/app.js b/static/app.js index 426e600..1c2a95f 100644 --- a/static/app.js +++ b/static/app.js @@ -20,7 +20,7 @@ function api( method, url, data ){ return response.json(); } return response.json().then( v =>{ - throw v; + alert( v.error ); }); }); } @@ -45,9 +45,6 @@ var app = new Vue({ .then( res =>{ this.ips = res.ips; }) - .catch( res =>{ - alert( res.error ) - }); } } }); diff --git a/static/index.html b/static/index.html index c41a375..11c3d22 100644 --- a/static/index.html +++ b/static/index.html @@ -10,7 +10,7 @@ * List of public IPv6 IP assigned to the currently running server is shown below. * We can click on each link and verify whether that IP is globally accessible or not by visiting the link * Optionally, we can add new public IPv6 address using the form displayed in the bottom. - * Newly added IP will only persist for one minute. It will be removed after that. + * Newly added IP will only persist for five minute. It will be removed after that. * Please note that, we are only allowed change last 64 bits of existing global ip. Otherwise it won't work