Rework how we bypass browser caches of the scouting app
This patch adds a new way to access files on the webserver. Users can
now request files by their sha256 checksum. The URL pattern follows
`/sha256/<checksum>/<path>`. The `<path>` portion doesn't actually
matter, but it helps with readability.
This patch migrates the main bundle and the pictures to use the new
checksum-addressable scheme.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I76eaa9b0f69af98e48e8e73e32c82ce2916fbe41
diff --git a/scouting/www/BUILD b/scouting/www/BUILD
index 726749b..647af14 100644
--- a/scouting/www/BUILD
+++ b/scouting/www/BUILD
@@ -66,6 +66,29 @@
cmd = "cp $(location :main_bundle_compiled)/main_bundle.min.js $(OUTS)",
)
+py_binary(
+ name = "index_html_generator",
+ srcs = ["index_html_generator.py"],
+)
+
+genrule(
+ name = "generate_index_html",
+ srcs = [
+ "index.template.html",
+ "main_bundle_file.js",
+ ],
+ outs = ["index.html"],
+ cmd = " ".join([
+ "$(location :index_html_generator)",
+ "--template $(location index.template.html)",
+ "--bundle $(location main_bundle_file.js)",
+ "--output $(location index.html)",
+ ]),
+ tools = [
+ ":index_html_generator",
+ ],
+)
+
# Create a copy of zone.js here so that we can have a predictable path to
# source it from on the webserver.
genrule(