|
@@ -107,18 +107,26 @@
|
|
|
updateWebServerLinkSettings();
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+ //Update the current web server port settings
|
|
|
function updateWebServerLinkSettings(){
|
|
|
- let currentProxyRoot = $("#proxyRoot").val().trim();
|
|
|
- $.get("/api/webserv/status", function(webservStatus){
|
|
|
- if (currentProxyRoot == "127.0.0.1:" + webservStatus.ListeningPort || currentProxyRoot == "localhost:" + webservStatus.ListeningPort){
|
|
|
- //The root is pointing to the static web server
|
|
|
- $("#useStaticWebServer").parent().checkbox("set checked");
|
|
|
+ isUsingStaticWebServerAsRoot(function(isUsingWebServ){
|
|
|
+ if (isUsingWebServ){
|
|
|
$(".webservRootDisabled").addClass("disabled");
|
|
|
}else{
|
|
|
$(".webservRootDisabled").removeClass("disabled");
|
|
|
}
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function isUsingStaticWebServerAsRoot(callback){
|
|
|
+ let currentProxyRoot = $("#proxyRoot").val().trim();
|
|
|
+ $.get("/api/webserv/status", function(webservStatus){
|
|
|
+ if (currentProxyRoot == "127.0.0.1:" + webservStatus.ListeningPort || currentProxyRoot == "localhost:" + webservStatus.ListeningPort){
|
|
|
+ return callback(true);
|
|
|
+ }
|
|
|
+ return callback(false);
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function updateRootSettingStates(){
|
|
@@ -130,6 +138,7 @@
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
//Bind event to tab switch
|
|
|
tabSwitchEventBind["setroot"] = function(){
|
|
|
//On switch over to this page, update root info
|
|
@@ -161,6 +170,7 @@
|
|
|
}
|
|
|
checkCustomRedirectForUnsetSubd();
|
|
|
|
|
|
+ //Check if the given domain will redirect to https
|
|
|
function checkRootRequireTLS(targetDomain){
|
|
|
//Trim off the http or https from the origin
|
|
|
if (targetDomain.startsWith("http://")){
|
|
@@ -187,7 +197,7 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ //Set the new proxy root option
|
|
|
function setProxyRoot(){
|
|
|
var newpr = $("#proxyRoot").val();
|
|
|
if (newpr.trim() == ""){
|
|
@@ -210,18 +220,20 @@
|
|
|
//OK
|
|
|
initRootInfo(function(){
|
|
|
//Check if WebServ is enabled
|
|
|
- let currentProxyRoot = $("#proxyRoot").val().trim();
|
|
|
- $.get("/api/webserv/status", function(webservStatus){
|
|
|
- if (!webservStatus.Running){
|
|
|
+ isUsingStaticWebServerAsRoot(function(isUsingWebServ){
|
|
|
+ if (isUsingWebServ){
|
|
|
//Force enable static web server
|
|
|
- $("#webserv_enable").parent().checkbox("set checked");
|
|
|
+ //See webserv.html for details
|
|
|
+ setWebServerRunningState(true);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
setTimeout(function(){
|
|
|
+ //Update the checkbox
|
|
|
updateWebServerLinkSettings();
|
|
|
msgbox("Proxy Root Updated");
|
|
|
}, 1000);
|
|
|
- });
|
|
|
+
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
}
|