From 694ed22bffebf6924ef6a9bc061602cb39675f8e Mon Sep 17 00:00:00 2001 From: Justin Mclean Date: Mon, 28 Sep 2026 14:15:59 +1000 Subject: [PATCH 1/2] feat(site): add the kapa.ai Ask the docs widget Adds the widget behind a consent screen, with analytics off, and an Ask the docs navbar button that opens it. Allows the kapa and reCAPTCHA domains through the ASF CSP, as approved in the ASF privacy policy. --- .htaccess | 6 ++++++ src/app/layout.tsx | 28 ++++++++++++++++++++++++++ src/components/ask-ai-button.tsx | 34 ++++++++++++++++++++++++++++++++ src/lib/layout.shared.tsx | 11 +++++++++++ 4 files changed, 79 insertions(+) create mode 100644 src/components/ask-ai-button.tsx diff --git a/.htaccess b/.htaccess index c2733fadd4..f340045395 100644 --- a/.htaccess +++ b/.htaccess @@ -21,3 +21,9 @@ # "Not Found" body and the 404.html produced by `next build` is never used. # The status code stays 404 either way; this only replaces the body. ErrorDocument 404 /404.html + +# CSP permissions for iggy.apache.org: the kapa.ai "Ask AI" widget and the +# Google reCAPTCHA it uses. kapa.ai is approved by VP Data Privacy in the ASF +# privacy policy: +# https://privacy.apache.org/policies/privacy-policy-public.html#i-kapaai +SetEnv CSP_PROJECT_DOMAINS "https://widget.kapa.ai/ https://proxy.kapa.ai/ https://kapa-widget-proxy-la7dkmplpq-uc.a.run.app/ https://metrics.kapa.ai/ https://www.google.com/ https://www.gstatic.com/" diff --git a/src/app/layout.tsx b/src/app/layout.tsx index b11f6bb8f3..24a38450ef 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -137,6 +137,34 @@ _paq.push(['enableLinkTracking']); })();`} + {/* + kapa.ai "Ask AI" widget, through the Kapa Open Source Program. kapa.ai + is approved in the ASF privacy policy: + https://privacy.apache.org/policies/privacy-policy-public.html#i-kapaai + The widget script loads on every page, but no question goes to kapa + until the visitor accepts the consent screen, and kapa's analytics + cookie and fingerprinting are off. The launcher is hidden; the + "Ask the docs" button in the navbar opens the modal. + */} +