*: allows for BASE_PATH configuration

This should unblock users who'd like to run the UI under a subpath on an existing vhost of their reverse proxy.
This is far from behind the most pretty/smart way to do it, but it works for all intent and purposes.
Fixes https://github.com/ngoduykhanh/wireguard-ui/issues/37
This commit is contained in:
Quentin Machu 2022-04-10 20:01:46 +08:00
parent a667efaa19
commit 63f88ab63d
12 changed files with 97 additions and 78 deletions

View file

@ -9,13 +9,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<link rel="stylesheet" href="static/plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="{{.basePath}}/static/plugins/fontawesome-free/css/all.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- icheck bootstrap -->
<link rel="stylesheet" href="static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<link rel="stylesheet" href="{{.basePath}}/static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="static/dist/css/adminlte.min.css">
<link rel="stylesheet" href="{{.basePath}}/static/dist/css/adminlte.min.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
@ -71,11 +71,11 @@
</div>
<!-- /.login-box -->
<!-- jQuery -->
<script src="static/plugins/jquery/jquery.min.js"></script>
<script src="{{.basePath}}/static/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="{{.basePath}}/static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="static/dist/js/adminlte.min.js"></script>
<script src="{{.basePath}}/static/dist/js/adminlte.min.js"></script>
</body>
<script>
@ -85,7 +85,7 @@
if (nextURL) {
window.location.href = nextURL;
} else {
window.location.href = '/';
window.location.href = '/wireguard/';
}
}
</script>
@ -104,7 +104,7 @@
$.ajax({
cache: false,
method: 'POST',
url: '/login',
url: '{{.basePath}}/login',
dataType: 'json',
contentType: "application/json",
data: JSON.stringify(data),