From 751a5ea3ad6bec3e32201a37cfccdc0c2f31f462 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 4 Aug 2020 15:03:11 -0500 Subject: [PATCH] Move login JS to a separate file Mostly so the base URL resolution code can be shared. --- ci/build/build-code-server.sh | 1 + ci/dev/watch.ts | 6 +++++- src/browser/pages/login.html | 7 +------ src/browser/pages/login.ts | 7 +++++++ 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 src/browser/pages/login.ts diff --git a/ci/build/build-code-server.sh b/ci/build/build-code-server.sh index f0e4ddc3..1d2942d9 100755 --- a/ci/build/build-code-server.sh +++ b/ci/build/build-code-server.sh @@ -21,6 +21,7 @@ main() { --public-url "." \ --out-dir dist \ $([[ $MINIFY ]] || echo --no-minify) \ + src/browser/login.ts \ src/browser/register.ts \ src/browser/serviceWorker.ts } diff --git a/ci/dev/watch.ts b/ci/dev/watch.ts index ba386b75..7e56c186 100644 --- a/ci/dev/watch.ts +++ b/ci/dev/watch.ts @@ -164,7 +164,11 @@ class Watcher { private createBundler(out = "dist"): Bundler { return new Bundler( - [path.join(this.rootPath, "src/browser/register.ts"), path.join(this.rootPath, "src/browser/serviceWorker.ts")], + [ + path.join(this.rootPath, "src/browser/login.ts"), + path.join(this.rootPath, "src/browser/register.ts"), + path.join(this.rootPath, "src/browser/serviceWorker.ts"), + ], { outDir: path.join(this.rootPath, out), cacheDir: path.join(this.rootPath, ".cache"), diff --git a/src/browser/pages/login.html b/src/browser/pages/login.html index 586c9c66..f2b26299 100644 --- a/src/browser/pages/login.html +++ b/src/browser/pages/login.html @@ -47,10 +47,5 @@ - + diff --git a/src/browser/pages/login.ts b/src/browser/pages/login.ts new file mode 100644 index 00000000..c7fc92d4 --- /dev/null +++ b/src/browser/pages/login.ts @@ -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 +}