Move login JS to a separate file
Mostly so the base URL resolution code can be shared.
This commit is contained in:
@ -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>
|
||||
|
7
src/browser/pages/login.ts
Normal file
7
src/browser/pages/login.ts
Normal 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
|
||||
}
|
Reference in New Issue
Block a user