From 3a74f76ff9835dd03b4709a585195611f6a20e38 Mon Sep 17 00:00:00 2001
From: Kevin Morris
Date: Tue, 29 Jun 2021 22:44:41 -0700
Subject: [PATCH] FastAPI: use internal typeahead and remove jquery
Awesome!
Signed-off-by: Kevin Morris
---
aurweb/asgi.py | 5 +----
templates/index.html | 10 ++++++++++
templates/partials/head.html | 3 +++
templates/partials/layout.html | 1 -
templates/partials/typeahead.html | 30 ------------------------------
web/html/js/typeahead-home.js | 6 ++++++
6 files changed, 20 insertions(+), 35 deletions(-)
delete mode 100644 templates/partials/typeahead.html
create mode 100644 web/html/js/typeahead-home.js
diff --git a/aurweb/asgi.py b/aurweb/asgi.py
index 228b9a65..5f0ad01d 100644
--- a/aurweb/asgi.py
+++ b/aurweb/asgi.py
@@ -83,10 +83,7 @@ async def add_security_headers(request: Request, call_next: typing.Callable):
# Add CSP header.
nonce = request.user.nonce
csp = "default-src 'self'; "
- script_hosts = [
- "ajax.googleapis.com",
- "cdn.jsdelivr.net"
- ]
+ script_hosts = []
csp += f"script-src 'self' 'nonce-{nonce}' " + ' '.join(script_hosts)
# It's fine if css is inlined.
csp += "; style-src 'self' 'unsafe-inline'"
diff --git a/templates/index.html b/templates/index.html
index 8cd1cc78..f8745f33 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -93,4 +93,14 @@
+
+
+
+
+
+
+
{% endblock %}
diff --git a/templates/partials/head.html b/templates/partials/head.html
index 0351fd6e..9b438255 100644
--- a/templates/partials/head.html
+++ b/templates/partials/head.html
@@ -12,5 +12,8 @@
+
+
+
AUR ({{ language }}) - {{ title | tr }}
diff --git a/templates/partials/layout.html b/templates/partials/layout.html
index 019ebff7..68637ed7 100644
--- a/templates/partials/layout.html
+++ b/templates/partials/layout.html
@@ -6,6 +6,5 @@
{% include 'partials/navbar.html' %}
{% extends 'partials/body.html' %}
- {% include 'partials/typeahead.html' %}