about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorLuke Granger-Brown <hg@lukegb.com>2020-07-11T00·48+0000
committerlukegb <lukegb@tvl.fyi>2020-07-11T00·57+0000
commitb65575fc31fd9326db7989eb8a9b15439dd8866e (patch)
tree149984954f43391c238e6b30e4cce83982f1b417 /third_party
parent9eb248e0c5f75eef5da2d80363462337aba99f44 (diff)
fix(gerrit): Load fonts from Google Fonts instead. r/1252
This also incidentally includes a fix for _not_ loading fonts from
Google Fonts, but I don't really care about that.

Change-Id: I6e00791d0ba06cb1e3c029e1b8617c33000d2ab1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1041
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch6
-rw-r--r--third_party/gerrit/0002-Syntax-highlight-nix.patch6
-rw-r--r--third_party/gerrit/0003-Syntax-highlight-rules.pl.patch6
-rw-r--r--third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch6
-rw-r--r--third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch26
-rw-r--r--third_party/gerrit/0006-Always-use-Google-Fonts.patch28
-rw-r--r--third_party/gerrit/default.nix2
7 files changed, 68 insertions, 12 deletions
diff --git a/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch b/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch
index a6b3fab9674c..30dfd4fffac5 100644
--- a/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch
+++ b/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch
@@ -1,7 +1,7 @@
-From d0ae1a93f6e3cc91fe066a48fa4b8911d15bfc4c Mon Sep 17 00:00:00 2001
+From 6884c9e2aacc33fb12db926c6d6b3737b9aa67b1 Mon Sep 17 00:00:00 2001
 From: Luke Granger-Brown <git@lukegb.com>
 Date: Thu, 2 Jul 2020 23:02:09 +0100
-Subject: [PATCH 1/4] Use detzip in download_bower.py
+Subject: [PATCH 1/6] Use detzip in download_bower.py
 
 ---
  tools/js/download_bower.py | 2 +-
@@ -21,5 +21,5 @@ index 1df4b826bc..65bda74082 100755
  
          if args.s:
 -- 
-2.25.1
+2.27.0
 
diff --git a/third_party/gerrit/0002-Syntax-highlight-nix.patch b/third_party/gerrit/0002-Syntax-highlight-nix.patch
index 41fa3145352c..9dd71fbcf59a 100644
--- a/third_party/gerrit/0002-Syntax-highlight-nix.patch
+++ b/third_party/gerrit/0002-Syntax-highlight-nix.patch
@@ -1,7 +1,7 @@
-From 1b869d045cbb557ed5475be1131282fa8e4afc76 Mon Sep 17 00:00:00 2001
+From 0da464ae9982b279fe3ca4c4ec6a361ae9fded24 Mon Sep 17 00:00:00 2001
 From: Luke Granger-Brown <git@lukegb.com>
 Date: Thu, 2 Jul 2020 23:02:32 +0100
-Subject: [PATCH 2/4] Syntax highlight nix
+Subject: [PATCH 2/6] Syntax highlight nix
 
 ---
  .../app/elements/diff/gr-syntax-layer/gr-syntax-layer.js         | 1 +
@@ -20,5 +20,5 @@ index f1e930f177..cc937cff67 100644
  const ASYNC_DELAY = 10;
  
 -- 
-2.25.1
+2.27.0
 
diff --git a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch
index 072fbb38f5db..c458223dcfc8 100644
--- a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch
+++ b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch
@@ -1,7 +1,7 @@
-From 0e4599e43c0f57c7636af3b8b384c212e1700351 Mon Sep 17 00:00:00 2001
+From ec8d9361d081070202a4b54035209077022dfca6 Mon Sep 17 00:00:00 2001
 From: Luke Granger-Brown <git@lukegb.com>
 Date: Thu, 2 Jul 2020 23:02:43 +0100
-Subject: [PATCH 3/4] Syntax highlight rules.pl
+Subject: [PATCH 3/6] Syntax highlight rules.pl
 
 ---
  .../elements/diff/gr-syntax-layer/gr-syntax-layer.js   | 10 ++++++++++
@@ -40,5 +40,5 @@ index cc937cff67..2145bc169b 100644
    }
  
 -- 
-2.25.1
+2.27.0
 
diff --git a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
index 558ef0b45ac6..e9c4e006977c 100644
--- a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
+++ b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
@@ -1,7 +1,7 @@
-From a908a0e96a74300784416b5e3ff4cb2493b521ee Mon Sep 17 00:00:00 2001
+From ec764594563ede6d8bfffca0c9593f29ae80fc88 Mon Sep 17 00:00:00 2001
 From: Luke Granger-Brown <git@lukegb.com>
 Date: Thu, 2 Jul 2020 23:03:02 +0100
-Subject: [PATCH 4/4] Add titles to CLs over HTTP
+Subject: [PATCH 4/6] Add titles to CLs over HTTP
 
 ---
  .../gerrit/httpd/raw/IndexHtmlUtil.java       | 14 +++-
@@ -213,5 +213,5 @@ index d162714399..0ba228ad00 100644
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">{\n}
  
 -- 
-2.25.1
+2.27.0
 
diff --git a/third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch b/third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch
new file mode 100644
index 000000000000..742411a575e6
--- /dev/null
+++ b/third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch
@@ -0,0 +1,26 @@
+From f3e91155c990ee7e329be8ad799e5bddfc26434e Mon Sep 17 00:00:00 2001
+From: Luke Granger-Brown <git@lukegb.com>
+Date: Sat, 11 Jul 2020 00:45:57 +0000
+Subject: [PATCH 5/6] When using local fonts, always assume Gerrit is mounted
+ at the root.
+
+---
+ polygerrit-ui/app/rollup.config.js | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/polygerrit-ui/app/rollup.config.js b/polygerrit-ui/app/rollup.config.js
+index d83f24fb25..adf573c1ab 100644
+--- a/polygerrit-ui/app/rollup.config.js
++++ b/polygerrit-ui/app/rollup.config.js
+@@ -50,7 +50,7 @@ const importLocalFontMetaUrlResolver = function() {
+     name: 'import-meta-url-resolver',
+     resolveImportMeta: function (property, data) {
+       if(property === 'url' && data.moduleId.endsWith('/@polymer/font-roboto-local/roboto.js')) {
+-        return 'new URL("..", document.baseURI).href';
++        return 'new URL("/", document.baseURI).href';
+       }
+       return null;
+     }
+-- 
+2.27.0
+
diff --git a/third_party/gerrit/0006-Always-use-Google-Fonts.patch b/third_party/gerrit/0006-Always-use-Google-Fonts.patch
new file mode 100644
index 000000000000..5f6e8eb0ec61
--- /dev/null
+++ b/third_party/gerrit/0006-Always-use-Google-Fonts.patch
@@ -0,0 +1,28 @@
+From 3b757716417b1b8d5326e952133d986ec160a048 Mon Sep 17 00:00:00 2001
+From: Luke Granger-Brown <git@lukegb.com>
+Date: Sat, 11 Jul 2020 00:46:13 +0000
+Subject: [PATCH 6/6] Always use Google Fonts.
+
+We're not a corporate, and we're not behind the GFW. Always use Google Fonts,
+because even though we no longer get the caching benefits (boo, browsers),
+it is still a better geographically-distributed CDN.
+---
+ java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
+index d5f43de025..9c68a1d327 100644
+--- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
++++ b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
+@@ -231,7 +231,7 @@ public class IndexHtmlUtil {
+     if (urlParameterMap.containsKey("ce")) {
+       data.put("polyfillCE", "true");
+     }
+-    if (urlParameterMap.containsKey("gf")) {
++    if (/* urlParameterMap.containsKey("gf") || */ true) {
+       data.put("useGoogleFonts", "true");
+     }
+ 
+-- 
+2.27.0
+
diff --git a/third_party/gerrit/default.nix b/third_party/gerrit/default.nix
index 127f4cb815e1..620ccd259ab3 100644
--- a/third_party/gerrit/default.nix
+++ b/third_party/gerrit/default.nix
@@ -44,6 +44,8 @@ pkgs.buildBazelPackage {
     ./0002-Syntax-highlight-nix.patch
     ./0003-Syntax-highlight-rules.pl.patch
     ./0004-Add-titles-to-CLs-over-HTTP.patch
+    ./0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch
+    ./0006-Always-use-Google-Fonts.patch
   ];
 
   bazelTarget = "release";