mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
ui - allow setup on wizard to install on /, fix double slashes when installed and disable caching on setup URLs
This commit is contained in:
parent
e9ddf81df5
commit
ec4f76d8ac
2 changed files with 11 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{% if UI_HOST != "" and not has_variable(all, "USE_UI", "yes") +%}
|
||||
location /setup {
|
||||
etag off;
|
||||
add_header Last-Modified "";
|
||||
set $backendui "{{ UI_HOST }}";
|
||||
proxy_pass $backendui;
|
||||
proxy_set_header Host $host;
|
||||
|
|
@ -20,6 +21,8 @@ location /setup {
|
|||
}
|
||||
|
||||
location /setup/check {
|
||||
etag off;
|
||||
add_header Last-Modified "";
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
||||
|
|
|
|||
12
src/ui/templates/setup.html
vendored
12
src/ui/templates/setup.html
vendored
|
|
@ -254,7 +254,7 @@
|
|||
class="col-span-12 disabled:opacity-75 focus:valid:border-green-500 focus:invalid:border-red-500 outline-none focus:border-primary text-sm leading-5.6 ease block w-full appearance-none rounded-lg border border-solid border-gray-300 bg-white bg-clip-padding px-4 py-2 font-normal text-gray-700 transition-all placeholder:text-gray-500"
|
||||
placeholder="/admin"
|
||||
value="{{ random_url }}"
|
||||
pattern="\/[a-zA-Z0-9\-]{1,255}$"
|
||||
pattern="^\/([\/a-zA-Z0-9\-]{0,255})$"
|
||||
required />
|
||||
</div>
|
||||
<!-- end ui url-->
|
||||
|
|
@ -440,6 +440,7 @@
|
|||
if (!this.urlInp.value.startsWith("/")) {
|
||||
this.urlInp.value = "/" + this.urlInp.value;
|
||||
}
|
||||
this.urlInp.value = this.urlInp.value.replace("//", "/");
|
||||
this.resumeEl.textContent = `http${
|
||||
this.sslCheck.getAttribute("data-checked") === "true" ? "s" : ""
|
||||
}://${this.servInp.value}${this.urlInp.value}`;
|
||||
|
|
@ -595,6 +596,9 @@
|
|||
const api = `http${
|
||||
this.sslCheck.getAttribute("data-checked") === "true" ? "s" : ""
|
||||
}://${this.servInp.value}${this.urlInp.value}`;
|
||||
if (!api.endsWith("/")) {
|
||||
api = `${api}/`;
|
||||
}
|
||||
|
||||
fetch(window.location.href, {
|
||||
method: "POST",
|
||||
|
|
@ -604,11 +608,11 @@
|
|||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
setTimeout(() => {
|
||||
window.open(`${api}/login`, "_self");
|
||||
window.open(`${api}login`, "_self");
|
||||
}, 60000);
|
||||
setTimeout(() => {
|
||||
setInterval(() => {
|
||||
fetch(`${api}/check`, {
|
||||
fetch(`${api}check`, {
|
||||
mode: "cors",
|
||||
cache: "no-cache",
|
||||
})
|
||||
|
|
@ -618,7 +622,7 @@
|
|||
}
|
||||
}).then(res => {
|
||||
if (res.message === "ok") {
|
||||
window.open(`${api}/login`, "_self");
|
||||
window.open(`${api}login`, "_self");
|
||||
}
|
||||
})
|
||||
.catch((err) => {});
|
||||
|
|
|
|||
Loading…
Reference in a new issue