3.0.1 init commit

- Removed Go HTTP client UA
- Added optional bypass of websocket origin check #107
- Added basic forward proxy for debug
- Fixed UI error in network utils tab
This commit is contained in:
Toby Chui
2024-03-10 14:49:18 +08:00
parent 9b2168466c
commit 200c924acd
29 changed files with 849 additions and 37 deletions

View File

@@ -84,7 +84,23 @@
Paste to Terminal <code style="float: right;">Shift + Insert</code>
</div>
</div>
<div class="ui divider"></div>
<h2>Forward Proxy</h2>
<p>Setup a basic HTTP forward proxy to access web server in another LAN<br>
To enable forward proxy in your domain, add a proxy rule to 127.0.0.1:{selected_port}</p>
<form class="ui form">
<div class="field">
<label>Listening Port</label>
<div class="ui action input">
<input id="forwardProxyPort" type="number" placeholder="5587" step="1", min="1024" max="65535" value="5587">
<button onclick="updateForwardProxyPort(); event.preventDefault();" class="ui basic button"><i class="ui green check icon"></i> Apply</button>
</div>
</div>
<div id="forwardProxyButtons" class="field">
<button onclick="toggleForwadProxy(true); event.preventDefault();" class="ui basic small green button startBtn"><i class="ui green arrow alternate circle up icon"></i> Start</button>
<button onclick="toggleForwadProxy(false); event.preventDefault();" class="ui basic small red button stopBtn"><i class="ui red minus circle icon"></i> Stop</button>
</div>
</form>
<div class="ui divider"></div>
<h2>Wake On LAN</h2>
<p>Wake up a remote server by WOL Magic Packet or an IoT device</p>
@@ -558,6 +574,68 @@ function renderWhoisDomainTable(jsonData) {
}
//Forward Proxy
function initForwardProxyInfo(){
$.get("/api/tools/fwdproxy/enable", function(data){
if (data == true){
//Disable the start btn
$("#forwardProxyButtons").find(".startBtn").addClass('disabled');
$("#forwardProxyButtons").find(".stopBtn").removeClass('disabled');
}else{
$("#forwardProxyButtons").find(".startBtn").removeClass('disabled');
$("#forwardProxyButtons").find(".stopBtn").addClass('disabled');
}
});
$.get("/api/tools/fwdproxy/port", function(data){
$("#forwardProxyPort").val(data);
})
}
initForwardProxyInfo();
function toggleForwadProxy(enabled){
$.ajax({
url: "/api/tools/fwdproxy/enable",
method: "POST",
data: {
"enable": enabled
},
success: function(data){
if (data.error != undefined){
msgbox(data.error, false);
}else{
msgbox(`Forward proxy ${enabled?"enabled":"disabled"}`)
}
initForwardProxyInfo();
}
})
}
function updateForwardProxyPort(){
let newPortNumber = $("#forwardProxyPort").val();
if (newPortNumber < 1024 || newPortNumber > 65535){
$("#newPortNumber").parent().addClass('error');
}else{
$("#newPortNumber").parent().removeClass('error');
}
$.ajax({
url: "/api/tools/fwdproxy/port",
method: "POST",
data: {
"port": newPortNumber
},
success: function(data){
if (data.error != undefined){
msgbox(data.error, false);
}
msgbox("Forward proxy port updated");
initForwardProxyInfo();
}
});
}
</script>

View File

@@ -4,12 +4,12 @@
<p>You might find these tools or information helpful when setting up your gateway server</p>
</div>
<div class="ui top attached tabular menu">
<a class="nettools item active" data-tab="tab1"><i class="ui user circle blue icon"></i> Accounts</a>
<a class="nettools item" data-tab="tab2">Toolbox</a>
<a class="nettools item" data-tab="tab3">System</a>
<a class="utils item active" data-tab="utiltab1"><i class="ui user circle blue icon"></i> Accounts</a>
<a class="utils item" data-tab="utiltab2">Toolbox</a>
<a class="utils item" data-tab="utiltab3">System</a>
</div>
<div class="ui bottom attached tab segment nettoolstab active" data-tab="tab1">
<div class="ui bottom attached tab segment utilitiesTabs active" data-tab="utiltab1">
<div class="extAuthOnly" style="display:none;">
<div class="ui basic segment">
<i class="ui green circle check icon"></i> Account options are not available due to -noauth flag is set to true.
@@ -99,7 +99,7 @@
</form>
</div>
</div>
<div class="ui bottom attached tab segment nettoolstab" data-tab="tab2">
<div class="ui bottom attached tab segment utilitiesTabs" data-tab="utiltab2">
<h3> IP Address to CIDR</h3>
<p>No experience with CIDR notations? Here are some tools you can use to make setting up easier.</p>
<div class="ui basic segment">
@@ -128,7 +128,7 @@
</div>
<div class="ui divider"></div>
</div>
<div class="ui bottom attached tab segment nettoolstab" data-tab="tab3">
<div class="ui bottom attached tab segment utilitiesTabs" data-tab="utiltab3">
<!-- Config Tools -->
<h3>System Backup & Restore</h3>
<p>Options related to system backup, migrate and restore.</p>
@@ -175,7 +175,16 @@
<br>
</div>
<script>
$('.menu .nettools.item').tab();
$('.menu .utils.item').tab();
// Switch tabs when clicking on the menu items
$('.menu .utils.item').on('click', function() {
$('.menu .utils.item').removeClass('active');
$(this).addClass('active');
var tab = $(this).attr('data-tab');
$('.utilitiesTabs.tab.segment').removeClass('active');
$('div[data-tab="' + tab + '"]').addClass('active');
});
/*
Account Password utilities
*/