|
@@ -1,11 +1,11 @@
|
|
|
<div class="ui stackable grid">
|
|
|
- <div class="ten wide column">
|
|
|
- <div id="serverstatus" class="ui green statustab inverted segment">
|
|
|
+ <div class="ten wide column serverstatusWrapper">
|
|
|
+ <div id="serverstatus" class="ui statustab inverted segment">
|
|
|
<h1 class="ui header" style="margin-top: 1em; margin-left: 0.4em; padding-bottom: 1em;">
|
|
|
- <i class="power off icon"></i>
|
|
|
+ <i id="rpStatusIcon" class="loading spinner icon"></i>
|
|
|
<div class="content">
|
|
|
- <span id="statusTitle">Offline</span>
|
|
|
- <div class="sub header" id="statusText">Reverse proxy server is offline</div>
|
|
|
+ <span id="statusTitle">Loading</span>
|
|
|
+ <div class="sub header" id="statusText">Checking server status</div>
|
|
|
</div>
|
|
|
</h1>
|
|
|
<div class="dot-container">
|
|
@@ -16,7 +16,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="six wide column">
|
|
|
+ <div class="six wide column statisticWrapper">
|
|
|
<div class="ui greybackground statustab segment">
|
|
|
<h5 class="ui header">
|
|
|
<i class="exchange icon"></i>
|
|
@@ -51,77 +51,74 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-<div class="ui divider"></div>
|
|
|
-<h4>Basic Settings</h4>
|
|
|
-<p>Inbound Port (Port to be proxied)</p>
|
|
|
-<div class="ui action fluid notloopbackOnly input">
|
|
|
- <input type="text" id="incomingPort" placeholder="Incoming Port" value="80">
|
|
|
- <button class="ui basic green notloopbackOnly button" onclick="handlePortChange();">Apply</button>
|
|
|
-</div>
|
|
|
-<br>
|
|
|
-<div id="tls" class="ui toggle notloopbackOnly checkbox">
|
|
|
- <input type="checkbox">
|
|
|
- <label>Use TLS to serve proxy request</label>
|
|
|
-</div>
|
|
|
<br>
|
|
|
-<div id="redirect" class="ui toggle notloopbackOnly checkbox" style="margin-top: 0.6em;">
|
|
|
- <input type="checkbox">
|
|
|
- <label>Force redirect HTTP request to HTTPS<br>
|
|
|
- <small>(Only apply when listening port is not 80)</small></label>
|
|
|
-</div>
|
|
|
-<br>
|
|
|
-<div id="portUpdateSucc" class="ui green message" style="display:none;">
|
|
|
- <i class="ui green checkmark icon"></i> Setting Updated
|
|
|
-</div>
|
|
|
-<Br>
|
|
|
-<button id="startbtn" class="ui teal button" onclick="startService();">Start Service</button>
|
|
|
-<button id="stopbtn" class="ui red notloopbackOnly disabled button" onclick="stopService();">Stop Service</button>
|
|
|
-<div id="rploopbackWarning" class="ui segment" style="display:none;">
|
|
|
- <b><i class="yellow warning icon"></i> Loopback Routing Warning</b><br>
|
|
|
- <small>This management interface is a loopback proxied service. <br>If you want to shutdown the reverse proxy server, please remove the proxy rule for the management interface and refresh.</small>
|
|
|
-</div>
|
|
|
-<div id="statusErrmsg" class="ui red message" style="display: none;"></div>
|
|
|
-<div class="ui divider"></div>
|
|
|
-<div class="">
|
|
|
-<h4>Statistic Overview</h4>
|
|
|
-<div class="ui two column stackable grid">
|
|
|
- <div class="column">
|
|
|
- <p>Visitor Counts</p>
|
|
|
- <table class="ui unstackable inverted celled table">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>Country ISO Code</th>
|
|
|
- <th>Unique Visitors</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody id="countryCodetable">
|
|
|
+<div class="standardContainer">
|
|
|
+ <h4>Basic Settings</h4>
|
|
|
+ <p>Inbound Port (Port to be proxied)</p>
|
|
|
+ <div class="ui action fluid notloopbackOnly input">
|
|
|
+ <input type="text" id="incomingPort" placeholder="Incoming Port" value="80">
|
|
|
+ <button class="ui basic green notloopbackOnly button" onclick="handlePortChange();">Apply</button>
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <div id="tls" class="ui toggle notloopbackOnly checkbox">
|
|
|
+ <input type="checkbox">
|
|
|
+ <label>Use TLS to serve proxy request</label>
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <div id="redirect" class="ui toggle notloopbackOnly checkbox" style="margin-top: 0.6em;">
|
|
|
+ <input type="checkbox">
|
|
|
+ <label>Force redirect HTTP request to HTTPS<br>
|
|
|
+ <small>(Only apply when listening port is not 80)</small></label>
|
|
|
+ </div>
|
|
|
+ <br><br>
|
|
|
+ <button id="startbtn" class="ui teal button" onclick="startService();">Start Service</button>
|
|
|
+ <button id="stopbtn" class="ui red notloopbackOnly disabled button" onclick="stopService();">Stop Service</button>
|
|
|
+ <div id="rploopbackWarning" class="ui segment" style="display:none;">
|
|
|
+ <b><i class="yellow warning icon"></i> Loopback Routing Warning</b><br>
|
|
|
+ <small>This management interface is a loopback proxied service. <br>If you want to shutdown the reverse proxy server, please remove the proxy rule for the management interface and refresh.</small>
|
|
|
+ </div>
|
|
|
+ <div class="ui divider"></div>
|
|
|
+ <div class="">
|
|
|
+ <h4>Statistic Overview</h4>
|
|
|
+ <div class="ui two column stackable grid">
|
|
|
+ <div class="column">
|
|
|
+ <p>Visitor Counts</p>
|
|
|
+ <table class="ui unstackable inverted celled table">
|
|
|
+ <thead>
|
|
|
<tr>
|
|
|
- <td colspan="2">No Data</td>
|
|
|
+ <th>Country ISO Code</th>
|
|
|
+ <th>Unique Visitors</th>
|
|
|
</tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
- <div class="column">
|
|
|
- <p>Proxy Request Types</p>
|
|
|
- <table class="ui unstackable inverted celled table">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>Proxy Type</th>
|
|
|
- <th>Count</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody id="forwardTypeTable">
|
|
|
+ </thead>
|
|
|
+ <tbody id="countryCodetable">
|
|
|
+ <tr>
|
|
|
+ <td colspan="2">No Data</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="column">
|
|
|
+ <p>Proxy Request Types</p>
|
|
|
+ <table class="ui unstackable inverted celled table">
|
|
|
+ <thead>
|
|
|
<tr>
|
|
|
- <td colspan="2">No Data</td>
|
|
|
+ <th>Proxy Type</th>
|
|
|
+ <th>Count</th>
|
|
|
</tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ </thead>
|
|
|
+ <tbody id="forwardTypeTable">
|
|
|
+ <tr>
|
|
|
+ <td colspan="2">No Data</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <button class="ui right floated basic button" onclick="getDailySummaryDetails();"><i class="green refresh icon"></i> Refresh</button>
|
|
|
+ <br><br>
|
|
|
</div>
|
|
|
-<br>
|
|
|
-<button class="ui right floated basic button" onclick="getDailySummaryDetails();"><i class="green refresh icon"></i> Refresh</button>
|
|
|
-<br><br>
|
|
|
<script>
|
|
|
let loopbackProxiedInterface = false;
|
|
|
//Initial the start stop button if this is reverse proxied
|
|
@@ -145,11 +142,13 @@
|
|
|
}
|
|
|
$("#serverstatus").addClass("green");
|
|
|
$("#statusTitle").text("Online");
|
|
|
+ $("#rpStatusIcon").attr("class", "green circle check icon");
|
|
|
$("#statusText").text("Serving request on port: " + data.Option.Port);
|
|
|
}else{
|
|
|
$("#startbtn").removeClass("disabled");
|
|
|
$("#stopbtn").addClass("disabled");
|
|
|
$("#statusTitle").text("Offline");
|
|
|
+ $("#rpStatusIcon").attr("class", "black circle times icon")
|
|
|
$("#statusText").text("Reverse proxy server is offline");
|
|
|
$("#serverstatus").removeClass("green");
|
|
|
}
|
|
@@ -197,8 +196,8 @@
|
|
|
$("#country").html((Object.keys(data)[0])?Object.keys(data)[0]:"No Data");
|
|
|
$("#countryList").html(`
|
|
|
<div>
|
|
|
- ${(Object.keys(data)[1])?Object.keys(data)[1]:"No Data"}<br>
|
|
|
- ${(Object.keys(data)[2])?Object.keys(data)[2]:"No Data"}
|
|
|
+ ${(Object.keys(data)[1])?Object.keys(data)[1]:"-"}<br>
|
|
|
+ ${(Object.keys(data)[2])?Object.keys(data)[2]:"-"}
|
|
|
</div>
|
|
|
`);
|
|
|
|
|
@@ -213,7 +212,7 @@
|
|
|
|
|
|
if (Object.keys(data).length == 0){
|
|
|
$("#countryCodetable").append(`<tr>
|
|
|
- <td colspan="2">No Data</td>
|
|
|
+ <td colspan="2"><i class="ui green circle check icon"></i> No Data</td>
|
|
|
</tr>`);
|
|
|
}
|
|
|
|
|
@@ -235,8 +234,8 @@
|
|
|
$("#forwardtype").html((Object.keys(data)[0])?fft(Object.keys(data)[0]) + ": " + abbreviateNumber(data[Object.keys(data)[0]]):"No Data");
|
|
|
$("#forwardtypeList").html(`
|
|
|
<div>
|
|
|
- ${(Object.keys(data)[1])?fft(Object.keys(data)[1]) + ": " + abbreviateNumber(data[Object.keys(data)[1]]):"No Data"}<br>
|
|
|
- ${(Object.keys(data)[2])?fft(Object.keys(data)[2]) + ": " + abbreviateNumber(data[Object.keys(data)[2]]):"No Data"}
|
|
|
+ ${(Object.keys(data)[1])?fft(Object.keys(data)[1]) + ": " + abbreviateNumber(data[Object.keys(data)[1]]):"-"}<br>
|
|
|
+ ${(Object.keys(data)[2])?fft(Object.keys(data)[2]) + ": " + abbreviateNumber(data[Object.keys(data)[2]]):"-"}
|
|
|
</div>
|
|
|
`);
|
|
|
|
|
@@ -250,7 +249,7 @@
|
|
|
|
|
|
if (Object.keys(data).length == 0){
|
|
|
$("#forwardTypeTable").append(`<tr>
|
|
|
- <td colspan="2">No Data</td>
|
|
|
+ <td colspan="2"><i class="ui green circle check icon"></i> No Data</td>
|
|
|
</tr>`);
|
|
|
}
|
|
|
});
|
|
@@ -276,7 +275,7 @@
|
|
|
function startService(){
|
|
|
$.post("/api/proxy/enable", {enable: true}, function(data){
|
|
|
if (data.error != undefined){
|
|
|
- statusErrmsg(data.error);
|
|
|
+ msgbox(data.error, false, 5000);
|
|
|
}
|
|
|
initRPStaste();
|
|
|
});
|
|
@@ -285,30 +284,25 @@
|
|
|
function stopService(){
|
|
|
$.post("/api/proxy/enable", {enable: false}, function(data){
|
|
|
if (data.error != undefined){
|
|
|
- statusErrmsg(data.error);
|
|
|
+ msgbox(data.error, false, 5000);
|
|
|
}
|
|
|
initRPStaste();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- //Show error message
|
|
|
- function statusErrmsg(message){
|
|
|
- $("#statusErrmsg").html(`<i class="red remove icon"></i> ${message}`);
|
|
|
- $("#statusErrmsg").slideDown('fast').delay(5000).slideUp('fast');
|
|
|
- }
|
|
|
|
|
|
function handlePortChange(){
|
|
|
var newPortValue = $("#incomingPort").val();
|
|
|
- if (isNaN(newPortValue - 1)){
|
|
|
- alert("Invalid incoming port value");
|
|
|
+ if (isNaN(newPortValue - 1) || newPortValue < 1 || newPortValue > 65535){
|
|
|
+ msgbox("Invalid incoming port value", false, 5000);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.post("/api/proxy/setIncoming", {incoming: newPortValue}, function(data){
|
|
|
if (data.error != undefined){
|
|
|
- statusErrmsg(data.error);
|
|
|
+ msgbox(data.error, false, 5000);
|
|
|
}
|
|
|
- $("#portUpdateSucc").stop().finish().slideDown("fast").delay(3000).slideUp("fast");
|
|
|
+ msgbox("Setting Updated");
|
|
|
initRPStaste();
|
|
|
});
|
|
|
}
|
|
@@ -330,7 +324,7 @@
|
|
|
alert(data.error);
|
|
|
}else{
|
|
|
//Updated
|
|
|
- $("#portUpdateSucc").stop().finish().slideDown("fast").delay(3000).slideUp("fast");
|
|
|
+ msgbox("Setting Updated");
|
|
|
initRPStaste();
|
|
|
}
|
|
|
}
|
|
@@ -366,7 +360,7 @@
|
|
|
alert(data.error);
|
|
|
}else{
|
|
|
//Updated
|
|
|
- $("#portUpdateSucc").stop().finish().slideDown("fast").delay(3000).slideUp("fast");
|
|
|
+ msgbox("Setting Updated");
|
|
|
initRPStaste();
|
|
|
}
|
|
|
}
|