Archived
1
0

Move login JS to a separate file

Mostly so the base URL resolution code can be shared.
This commit is contained in:
Asher
2020-08-04 15:03:11 -05:00
parent de568d446b
commit 751a5ea3ad
4 changed files with 14 additions and 7 deletions

View File

@ -47,10 +47,5 @@
</div>
</body>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/dist/register.js"></script>
<script>
const parts = window.location.pathname.replace(/^\//g, "").split("/")
parts[parts.length - 1] = "{{BASE}}"
const url = new URL(window.location.origin + "/" + parts.join("/"))
document.getElementById("base").value = url.pathname
</script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/dist/login.js"></script>
</html>

View File

@ -0,0 +1,7 @@
import { getOptions } from "../../common/util"
const options = getOptions()
const el = document.getElementById("base") as HTMLInputElement
if (el) {
el.value = options.base
}