Check window location host value to show the close button.

The close button was available even if the interface is requested remotely. Now the script hides the close button if the value of window.location.host is equal to 127.0.0.1 or localhost.
This commit is contained in:
Félix Aimé
2021-06-04 14:40:16 +02:00
committed by GitHub
parent fd66d2274e
commit 1d8c2387ca

View File

@ -53,7 +53,7 @@ export default {
load_config: function() { load_config: function() {
axios.get(`/api/misc/config`, { timeout: 60000 }) axios.get(`/api/misc/config`, { timeout: 60000 })
.then(response => { .then(response => {
this.quit_available = response.data.quit_option this.quit_available = (response.data.quit_option && (["localhost", "127.0.0.1"].some(h => window.location.host.includes(h) )))
this.off_available = response.data.shutdown_option this.off_available = response.data.shutdown_option
}) })
.catch(error => { console.log(error) }); .catch(error => { console.log(error) });
@ -73,4 +73,4 @@ export default {
this.check_update(); this.check_update();
} }
} }
</script> </script>