about summary refs log tree commit diff
path: root/web
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-09-30T22·12+0300
committertazjin <mail@tazj.in>2021-10-01T15·33+0000
commit5c9c4aa56625962cf6c61abd069c392415864754 (patch)
tree2d49d9c9fb52ee4dff59a6bdc5e72e35d36e5e45 /web
parentce575bf65bb73a8e55a26701879a39b52d67c200 (diff)
refactor(web/tvl/template): Make static asset URL configurable r/2942
Change-Id: I168924cd7b15103d64c9ad72172f72304e1d3a7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3659
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'web')
-rw-r--r--web/atward/indexHtml/default.nix2
-rw-r--r--web/tvl/template/default.nix10
2 files changed, 5 insertions, 7 deletions
diff --git a/web/atward/indexHtml/default.nix b/web/atward/indexHtml/default.nix
index adf7c1761a..ebe5168763 100644
--- a/web/atward/indexHtml/default.nix
+++ b/web/atward/indexHtml/default.nix
@@ -1,8 +1,8 @@
 { depot, ... }:
 
 depot.web.tvl.template {
-  useUrls = true;
   title = "atward";
+  staticUrl = "https://tvl.fyi/static";
   content = ''
     atward
     ======
diff --git a/web/tvl/template/default.nix b/web/tvl/template/default.nix
index 7f4aa399a4..fa8b860cff 100644
--- a/web/tvl/template/default.nix
+++ b/web/tvl/template/default.nix
@@ -8,15 +8,13 @@
 , extraHead ? null
   # optional extra html to inject into <footer>
 , extraFooter ? null
-  # whether to use global URLs instead of absolute paths
-, useUrls ? false
+  # URL at which static assets are located
+, staticUrl ? "/static"
 }@args:
 
 let
   inherit (pkgs) runCommandNoCC lib;
   inherit (depot.tools) cheddar;
-
-  baseUrl = lib.optionalString useUrls "https://tvl.fyi";
 in
 
 runCommandNoCC "index.html" {
@@ -26,8 +24,8 @@ runCommandNoCC "index.html" {
       <meta charset="utf-8">
       <meta name="viewport" content="width=device-width, initial-scale=1">
       <meta name="description" content="The Virus Lounge">
-      <link rel="stylesheet" type="text/css" href="${baseUrl}/static/tvl.css" media="all">
-      <link rel="icon" type="image/webp" href="${baseUrl}/static/favicon.webp">
+      <link rel="stylesheet" type="text/css" href="${staticUrl}/tvl.css" media="all">
+      <link rel="icon" type="image/webp" href="${staticUrl}/favicon.webp">
       <title>${title}</title>
   '' + lib.optionalString (args ? extraHead) extraHead + ''
     </head>