diff --git a/web/admin.js b/web/admin.js index 984eaa3..db80746 100644 --- a/web/admin.js +++ b/web/admin.js @@ -827,6 +827,8 @@ function set_wrapperr_settings() { function set_wrapperr_settings_call() { + var wrapperr_root_original = wrapperr_root; + document.getElementById("set_wrapperr_settings_form_button").disabled = true; document.getElementById("set_wrapperr_settings_form_button").style.opacity = '0.5'; @@ -843,6 +845,25 @@ function set_wrapperr_settings_call() { clear_cache = document.getElementById('clear_cache').checked; winter_theme = document.getElementById('winter_theme').checked; + if(wrapperr_root_original !== wrapperr_root) { + if(!confirm("You have changed the Wrapperr root/base URL. Wrapperr will attempt to restart and the interface to access this webpage will change. If you are using an URL base you must use a trailing '/' at the end of your new URL.")){ + return; + } + } + + if(wrapperr_root !== "") { + var wrapperr_root_last_char = wrapperr_root.charAt(wrapperr_root.length-1); + var wrapperr_root_first_char = wrapperr_root.charAt(0); + + if(wrapperr_root_last_char == "/" || wrapperr_root_first_char == "/") { + document.getElementById("set_wrapperr_settings_form_button").disabled = false; + document.getElementById("set_wrapperr_settings_form_button").style.opacity = '1'; + alert("No trailing or initial '/' needed for URL base."); + document.getElementById('wrapperr_root').focus(); + return; + } + } + if(timezone === '') { document.getElementById("set_wrapperr_settings_form_button").disabled = false; document.getElementById("set_wrapperr_settings_form_button").style.opacity = '1'; diff --git a/web/index.js b/web/index.js index 74189c3..6d1f7b5 100644 --- a/web/index.js +++ b/web/index.js @@ -372,7 +372,17 @@ function get_wrapper_version() { } }; xhttp.withCredentials = true; - xhttp.open("post", window.location + "api/get/wrapperr-version"); + + var url_current = window.location.toString(); + var last_char = url_current.charAt(window.location.length-1); + if(last_char == "/") { + var init_url = window.location + } else { + var init_url = window.location + "/" + } + + xhttp.open("post", init_url + "api/get/wrapperr-version"); + xhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xhttp.send(); return;