Skip to content

Commit 0e8c41e

Browse files
fix: allow Google Books preview iframe in CSP and properly implement shareable book card
1 parent 019e501 commit 0e8c41e

4 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎backend/app.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ def _apply_security_headers(response):
181181
"""Apply hardening headers to every API response."""
182182
csp_policy = (
183183
"default-src 'self'; "
184-
"script-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com; "
184+
"script-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://www.google.com; "
185185
"style-src 'self' https://fonts.googleapis.com https://cdnjs.cloudflare.com; "
186186
"img-src 'self' data: https:; "
187187
"font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com; "
188188
"connect-src 'self' https: ws: wss:; "
189+
"frame-src 'self' https://books.google.com https://www.google.com; "
189190
"object-src 'none'; "
190191
"base-uri 'self'; "
191192
"frame-ancestors 'none'; "

‎frontend/js/book-preview.js‎

20.1 KB
Binary file not shown.

‎frontend/pages/app.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ <h3>Your Reading Mood Tags</h3>
438438
<script src="../js/config.js"></script>
439439
<script src="../js/security.js"></script>
440440
<script src="../js/app.js"></script>
441+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
441442
<script src="../js/book-preview.js"></script>
442443
<script src="../js/pwa.js"></script>
443444
<script src="../js/footer.js"></script>

‎frontend/pages/library.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ <h3>Reader Reviews</h3>
549549
<script src="../js/config.js"></script>
550550
<script src="../js/library-3d.js"></script>
551551
<script src="../js/app.js"></script>
552+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
552553
<script src="../js/book-preview.js"></script>
553554
<script src="../js/footer.js"></script>
554555
<script src="../script/header-scroll.js"></script>

0 commit comments

Comments
 (0)