Commit Graph

510 Commits

Author SHA1 Message Date
Jake Howard d809890b0f
Add naive CSP
This is a very weak setup so far, as requires some more testing to confirm which origins are allowed for each resource.
2022-10-30 19:09:38 +00:00
Jake Howard e630ef8856
Allow swagger editor to make CORS requests 2022-10-30 19:00:27 +00:00
Jake Howard 91d022c44c
Bump HSTS to 30 days 2022-10-30 18:56:40 +00:00
Jake Howard dc02e989e1
Fix number of queries 2022-10-30 13:39:02 +00:00
Jake Howard 1eb14f3fb5
Ensure feed titles reference the full site 2022-10-30 12:53:35 +00:00
Jake Howard fe3c741347
Construct HTML title in Python
Site is cached, and makes it easier to reference elsewhere
2022-10-30 12:53:15 +00:00
Jake Howard 2e4e54418d
Reduce debounce time for search 2022-10-29 16:28:18 +01:00
Jake Howard 0ac4fd1135
Don't fill full width in lightbox 2022-10-29 16:25:51 +01:00
Jake Howard bb8c40f72e
Use sri_static tag for dark mode 2022-10-29 15:19:58 +01:00
Jake Howard 7ed5255b69
Add cache around navbar and footer
Intentionally outside the tag as generating the context does queries
2022-10-29 15:14:39 +01:00
Jake Howard 0e20ad3269
Fix query numbers based on guestbook heading 2022-10-29 15:02:41 +01:00
Jake Howard b6fa67163f
Only show ToC if there are enough items 2022-10-29 14:57:12 +01:00
Jake Howard 2fbc96946d
Ensure dark mode toggle is always in the corner 2022-10-29 14:50:53 +01:00
Jake Howard c0ba7bc62e
Add guestbook link 2022-10-29 14:50:01 +01:00
Jake Howard a031adefda
Add tag list button to post list hero 2022-10-29 13:22:21 +01:00
Jake Howard 394d9028ba
Fix spacing for footer icons 2022-10-24 20:45:07 +01:00
Jake Howard cb6aed2567
Replace `drf-yasg` with DRF native schema generator
I don't need anything advance. Just redirect to the swagger editor for the UI. Makes the app much simpler
2022-10-23 21:30:00 +01:00
Jake Howard 9cfa369d56
Replace tags menu item with dashboard item 2022-10-23 20:30:17 +01:00
Jake Howard 3b02f21f81
Use OOB to set results count and fix jumping when loading pages
This correctly centers the pagination spinner, and ensures there's only 1.
2022-10-23 18:52:39 +01:00
Jake Howard a70f789a8d
Add indicator to search infinite scroll 2022-10-23 18:34:32 +01:00
Jake Howard 0971fcd8a3
Account for spaces after tags when extracting text 2022-10-21 17:46:13 +01:00
Jake Howard c8f01870d4
Use simpler listing on tag list page 2022-10-21 17:20:58 +01:00
Jake Howard 26fabf3a43
Ensure tags are sorted 2022-10-21 17:11:15 +01:00
Jake Howard db6dd80385
Remove ToC from blog list page
Showing an accurate ToC is complex alongside pagination
2022-10-21 16:56:40 +01:00
Jake Howard 214f10002c
Cache latest blog post 2022-10-21 13:20:22 +01:00
Jake Howard 35579a8803
Remove dedicated fragments cache
Reuse the default one to avoid an extra redis connection
2022-10-21 11:40:49 +01:00
Jake Howard 549a48769d
Swap curlylint and djhtml with djlint 2022-10-05 14:17:00 +01:00
Jake Howard 315412ff5d
Remove unused import and update query count 2022-10-05 09:23:58 +01:00
Jake Howard ee4914324c
Cache fragments for 6 hours
They really shouldn't change often
2022-10-04 21:27:53 +01:00
Jake Howard 6a1acd1684
Decrease page size
Infinite scroll makes this much easier
2022-10-04 21:17:16 +01:00
Jake Howard c09669693f
Exclude singleton pages from search results 2022-10-04 21:12:55 +01:00
Jake Howard b515b6368c
Optimise for cache hits
Don't select/prefetch for listing, because we cache the entire listing item. This makes the main query more efficient, thus page loads faster.
2022-10-04 20:49:29 +01:00
Jake Howard fa85c8ba80
Cache fragments for longer, and clear when editing page 2022-10-04 20:14:26 +01:00
Jake Howard 9096bd4b0b
Fix sizing of content images 2022-10-02 22:38:10 +01:00
Jake Howard 04aa301c75
Add management command to purge caches 2022-10-02 20:47:40 +01:00
Jake Howard 8f66feeaa5
Remove test 404 and 500 paths outside dev 2022-10-02 19:25:36 +01:00
Jake Howard 8844aad247
Disallow API from being indexed 2022-10-02 19:20:40 +01:00
Jake Howard 6d0c25128c
Always disallow wagtail admin 2022-10-02 19:17:33 +01:00
Jake Howard 197f2ea0aa
Move cache handling to views 2022-10-02 18:53:51 +01:00
Jake Howard 1ae3288a73
Store template fragments in separate cache
This makes clearing them less expensive
2022-10-02 17:32:32 +01:00
Jake Howard a2d1aff112
Reduce API page size 2022-10-02 17:28:20 +01:00
Jake Howard 23b8454fe4
Add template caching for listing components 2022-10-02 17:27:55 +01:00
Jake Howard 6775a336e1
Revert "Add the ability to cache model attributes in redis"
This reverts commit 7c008c2149.
2022-10-02 16:17:55 +01:00
Jake Howard cd48ae7810
Revert "Replace spotify data cache with new cached properties"
This reverts commit a3d9fa177e.
2022-10-02 16:17:49 +01:00
Jake Howard a3d9fa177e
Replace spotify data cache with new cached properties
Also replace the update script with one which will do everything
2022-09-30 09:07:31 +01:00
Jake Howard 7c008c2149
Add the ability to cache model attributes in redis
This not only means they persist longer than the instance, but can also be shared between processes. This is especially useful for list pages, as rendering content for summaries etc is quite expensive
2022-09-29 22:59:23 +01:00
Jake Howard d1523a886b
Use fira-code package with support for font-display 2022-09-29 21:05:19 +01:00
Jake Howard f2e2719647
Add title to navbar icon links 2022-09-29 20:55:43 +01:00
Jake Howard e05d2675d5
Add blank alt tag to hero image 2022-09-29 20:55:35 +01:00
Jake Howard e7037d01b0
Remove stray description tag 2022-09-29 20:42:25 +01:00
Jake Howard 1f5e151314
Ignore more blocks when getting plaintext 2022-09-25 21:54:02 +01:00
Jake Howard 92f1a17b9f
Always show pagination buttons 2022-09-25 21:10:35 +01:00
Jake Howard ac30206e97
Fix pagination controls showing up 2022-09-25 21:06:43 +01:00
Jake Howard 79c9550ee2
Make sure commento works in dark mode 2022-09-23 17:27:03 +01:00
Jake Howard dcb8162517
Ensure tags use code font 2022-09-23 16:44:22 +01:00
Jake Howard e4476e1b2a
Ensure heading ids are always valid ids 2022-09-23 15:36:23 +01:00
Jake Howard bee03a8e64
Add link to tags list to tags on content details 2022-09-23 08:45:17 +01:00
Jake Howard 4b10ce6f6f
Restyle content details to be icons rather than tags
This looks much nicer, and is simpler to work with
2022-09-23 08:34:49 +01:00
Jake Howard 6c481672c4
Improve margin around blog post date headers 2022-09-21 14:18:35 +01:00
Jake Howard bccc948995
Restructure fields in editor pages
Move as much as possible out of the "Content" tab, so that's just about
the actual content
2022-09-21 13:30:06 +01:00
Jake Howard 2d537d3b10
Correctly get language
Operator precedence is important
2022-09-21 13:29:57 +01:00
Jake Howard 82701a706c
Show blog list ToC with newest first 2022-09-20 09:54:26 +01:00
Jake Howard 65b36f5b07
Disable workflows in admin
I'm the only one using it, so it doesn't really make sense. And disabling it outright can make things perform faster
2022-09-20 09:25:40 +01:00
Jake Howard e62f9de9fc
Add indexing of unsplash photos 2022-09-20 09:24:00 +01:00
Jake Howard 997da9779c
Link to admin posts list, not the posts page itself 2022-09-19 21:40:40 +01:00
Jake Howard d5aac8ac50
Don't show header if there's nothing useful to show 2022-09-19 16:34:02 +01:00
Jake Howard 77e34cbf02
Show number of blog posts on admin dashboard 2022-09-15 08:54:23 +01:00
Jake Howard f3b248110e
Hide updated date when creating unsplash photos 2022-09-15 08:19:22 +01:00
Jake Howard 592da67185
Add blockquote and super/sub scripts to rich text 2022-09-15 08:19:08 +01:00
Jake Howard fb15c480a3
Add link to full content in iframe block 2022-09-08 20:58:13 +01:00
Jake Howard c6c913c3e7
Make subtitle more visually distinct from content 2022-09-08 14:42:45 +01:00
Jake Howard 8b027206b1
Add comments and sharing to all content pages
Listing pages already have this block overwritten for pagination
controls
2022-09-08 14:37:18 +01:00
Jake Howard 63909a31c0
Add iframe block 2022-09-08 14:31:01 +01:00
Jake Howard c56cc2f995
Correctly get lexer for language
`get_lexer_by_name` doesn't actually get the lexer by its name...
2022-09-07 14:44:39 +01:00
Jake Howard c7e56ab038
Don't show word count if there isn't one
This mostly covers spotify pages, which use a custom reading time but
don't have words.
2022-09-06 09:17:42 +01:00
Jake Howard 71f74251bb
Don't require code header 2022-09-06 08:58:44 +01:00
Jake Howard b95506d711
Don't load analytics when logged in or preview 2022-09-06 08:24:54 +01:00
Jake Howard 1474131771
Thin fonts on 500 page 2022-09-05 14:29:17 +01:00
Jake Howard 0711288197
Style 500 page 2022-09-05 14:17:48 +01:00
Jake Howard 0a136496f4
Remove caches from base template
These components are pretty efficient, and it makes content editing more
annoying.
2022-09-05 13:58:36 +01:00
Jake Howard c40987c14f
Add healthcheck 2022-09-05 13:35:48 +01:00
Jake Howard db24bb7e0a
Disable password reset 2022-09-05 13:13:01 +01:00
Jake Howard 8805416807
Disable update check
I work for torchbox, i'll notice
2022-09-04 21:10:06 +01:00
Jake Howard a76b9df329
Fix 404s if there's no resolver match 2022-09-04 18:17:06 +01:00
Jake Howard f40681d06a
Add caching to listing feeds 2022-09-04 17:34:04 +01:00
Jake Howard 7cd88c9fbd
Just set cache control rather than caching page content
This avoids storing tonnes of stuff in the cache, when it doesn't matter
_too_ much
2022-09-04 17:29:04 +01:00
Jake Howard ddb68f7d43
Ensure media is served by Django 2022-09-04 17:23:41 +01:00
Jake Howard b167cd4ca4
Set `ALLOWED_HOSTS` correctly based on base hostname 2022-09-04 16:52:05 +01:00
Jake Howard d93bc2450d
Remove sentry enviornment variable
There will be only 1
2022-09-04 16:40:59 +01:00
Jake Howard e21d525259
Reset migrations
During dev I made loads, but I don't need them now
2022-09-04 15:56:51 +01:00
Jake Howard ee307bcfbf
Define rich text features in settings
This removes them from migrations, avoiding the need to create new ones
when they change
2022-09-03 21:07:27 +01:00
Jake Howard 210ad88a2e
Add renditions cache 2022-09-03 17:33:11 +01:00
Jake Howard a053e27833
Use richtext for subtitle 2022-09-03 17:00:09 +01:00
Jake Howard 6dfbb830ef
Add IE11 deterrent 2022-09-03 16:35:39 +01:00
Jake Howard eaa5b063f4
Use smaller, PNG image for meta image
This ensures it's not too large, but also crawlers are more likely to
support PNG than webp
2022-09-03 16:21:24 +01:00
Jake Howard be009dcb37
Convert all images to webp
It's so much smaller!
2022-09-03 16:15:08 +01:00
Jake Howard 8691d11a15
Only render comments in debug 2022-09-02 17:20:03 +01:00
Jake Howard 7fff13f0ab
Add lightbox for content images 2022-09-02 17:18:40 +01:00
Jake Howard 611e343564
Just use a simple icon field
The library has some issues, even if it is great

https://github.com/saschaludwig/django-fontawesome-6/pull/2
2022-09-02 15:29:12 +01:00
Jake Howard 7026aca934
Add account links to footer
Putting them in the navbar is too crowded.
2022-09-02 09:28:35 +01:00
Jake Howard 6d60cedc6f
Add comments 2022-09-02 08:27:42 +01:00
Jake Howard 22e99502cb
Add 2FA
This should only be required in production, but we'll see how it goes.
It doesn't work quite how I expected it to.
2022-09-01 08:53:54 +01:00
Jake Howard 54af457d8e
Add SRI 2022-09-01 08:36:39 +01:00
Jake Howard 5d370a0712
Unify pygments stylesheet
It's less generic and less cool, but this bakes the styles for dark and
light into a single stylesheet, and deals with switching without any JS.
2022-08-31 23:02:13 +01:00
Jake Howard 488369a247
Add filename and header show checkbox to code block 2022-08-31 22:30:08 +01:00
Jake Howard df09ec0f38
Ensure request is passed into the singleton URL cache
This removes needing extra queries
2022-08-31 19:06:02 +01:00
Jake Howard 25e49de081
Don't cache page bodies
They're still pretty fast to generate, and doing this breaks previews
completely
2022-08-31 18:54:09 +01:00
Jake Howard 27dc383d17
Use relative URL for singletons
It's rare they'll be needed externally, and this way there's less to do
2022-08-31 09:16:25 +01:00
Jake Howard ce3690384e
Make code header a solid bar instead
This is much easier to layout, and has the benefit of being able to fit
more in.

The transform was still leaving space allocated, which looked odd
2022-08-31 09:05:32 +01:00
Jake Howard 768223ba67
Add spacing around plusses in language dropdown
It looks so much better!
2022-08-30 22:49:05 +01:00
Jake Howard f3b603a82a
Add language and clipboard buttons to code blocks 2022-08-30 22:48:45 +01:00
Jake Howard 1e9ff9f24b
Remove CORS header from static files 2022-08-28 22:28:43 +01:00
Jake Howard e7c4acce8b
Add the ability to password protect pages
Useful for sharing drafts
2022-08-28 22:02:02 +01:00
Jake Howard 9ee46721c9
Use Wagtail login screen for admin-protected pages
Should never happen, but at least it won't look terrible
2022-08-28 20:34:23 +01:00
Jake Howard 6f073c6cfc
Update module name
This will handle more than just URLs
2022-08-28 20:30:50 +01:00
Jake Howard 442aeb21b8
Use singleton URL cache 2022-08-28 20:22:55 +01:00
Jake Howard ac46c0ae0b
Add start of simple module to help with caching singleton URLs 2022-08-28 17:42:21 +01:00
Jake Howard 557a28833b
Only show public pages 2022-08-28 16:51:27 +01:00
Jake Howard 47980032b0
Add autocomplete for blog pots tags 2022-08-28 16:18:31 +01:00
Jake Howard c660e54bae
Add method to prefetch for listing 2022-08-28 14:52:27 +01:00
Jake Howard 735ab73ec0
Inline `select_related` calls 2022-08-28 12:59:09 +01:00
Jake Howard 6403aca2a2
Add tests for search page 2022-08-28 12:57:10 +01:00
Jake Howard edbedcd0fa
Remove unnecessary extra query during search
Just pass the original queryset, which helps ordering and performance
2022-08-28 12:56:26 +01:00
Jake Howard 4ca2a97b2a
Update queries for favicon and add cache
It shouldn't change much, so let's cache it
2022-08-28 00:13:19 +01:00
Jake Howard 4b1d873bf8
Extend time for session cookies 2022-08-27 23:54:31 +01:00
Jake Howard 358013e16a
Add favicon 2022-08-27 23:44:56 +01:00
Jake Howard 46836a6d30
dark-mode 2022-08-27 23:20:30 +01:00
Jake Howard eddf4c88d1
Use monokai as the dark mode
I prefer how it looks
2022-08-27 22:48:22 +01:00
Jake Howard 27bce00c46
Remove subtitle from listing pages 2022-08-27 19:55:44 +01:00
Jake Howard e79625a441
Correctly allow ordering of collection pages
`.specific` isn't quite as magical as it needs to be, so we have to be
explicit
2022-08-27 13:13:14 +01:00
Jake Howard 2df1e82f31
Allow customizing HTML and hero titles 2022-08-27 13:12:45 +01:00
Jake Howard 3d155bb46f
Add management command to refresh caches of spotify playlists 2022-08-27 13:10:33 +01:00
Jake Howard 2b0779b26a
Install sentry 2022-08-27 12:59:02 +01:00
Jake Howard 48c5aa0e56
Test queries for list page 2022-08-27 12:39:50 +01:00
Jake Howard d83e3e0afe
Ensure all listing pages have pagination controls and feed links 2022-08-27 12:32:16 +01:00
Jake Howard e19a2456e7
Move listing functionality to generic base page 2022-08-27 12:21:13 +01:00
Jake Howard 655d3a484e
Fix indenting of time titles 2022-08-27 11:09:41 +01:00
Jake Howard d2e1cde927
Remove unnecessary extra div in footer 2022-08-26 23:25:02 +01:00
Jake Howard 0fbd36ce3e
Add pagination to blog post list 2022-08-26 23:13:06 +01:00
Jake Howard 958a838f98
Remove accidental import
Damn auto-import!
2022-08-26 10:10:46 +01:00
Jake Howard e0d17394b8
Don't index body on spotify pages
This includes API data, of which there is a lot
2022-08-25 23:52:46 +01:00
Jake Howard a4471a49ee
Store cookies securely 2022-08-25 23:16:20 +01:00
Jake Howard fb739f93fc
Add basic logging config 2022-08-25 23:15:27 +01:00
Jake Howard b7c18946b2
Store redirect files in cache 2022-08-25 23:08:59 +01:00
Jake Howard ccc9e24e77
Add some extra security headers 2022-08-25 23:08:04 +01:00
Jake Howard 309955a052
Load images async 2022-08-25 22:42:33 +01:00
Jake Howard 3f9288f5cb
Ensure hero images are prefetched during lists 2022-08-25 22:27:28 +01:00
Jake Howard 2539cc3538
Refresh body HTML async 2022-08-25 14:24:00 +01:00
Jake Howard 01d84fd29b
Add keybase URL 2022-08-25 14:11:47 +01:00
Jake Howard 37ab598d0d
Move well-known templates to well-known app 2022-08-25 14:07:08 +01:00
Jake Howard 82e7a00d8a
Add plausible 2022-08-25 14:01:32 +01:00
Jake Howard a48aeeb55d
Add management command to refresh content pages 2022-08-25 01:29:22 +01:00
Jake Howard a7aefb5ffc
Add basic tests for LMOTFY endpoints 2022-08-25 00:51:29 +01:00
Jake Howard fb44600ca2
Add more fields to LMOTFY serializer 2022-08-25 00:27:31 +01:00
Jake Howard e6c44e9a8a
Cache page content for a little
This is mostly useful on listing pages
2022-08-24 23:59:17 +01:00
Jake Howard d46fab9bdc
Add basic LMOTFY endpoint 2022-08-23 14:56:05 +01:00
Jake Howard f140e8107d
Add endpoint to list page URLs
I use this for my quick link grabber script
2022-08-23 09:23:22 +01:00
Jake Howard 4a82d1262d
Add a basic rate limit 2022-08-23 08:43:58 +01:00
Jake Howard 67095752d2
Add caching to schema views 2022-08-23 08:39:38 +01:00
Jake Howard 8dea738893
Redirect API root to swagger docs 2022-08-23 08:37:00 +01:00
Jake Howard fc141c9778
Add the skeleton for an API app
URL handling is a hack, but it works
2022-08-22 23:26:39 +01:00
Jake Howard 10005dfe02
Add all pages feed
This one is much simpler than the pages one, as there could be a lot of
pages
2022-08-22 23:17:16 +01:00
Jake Howard 922e259aaf
Add legacy redirect app 2022-08-22 21:11:46 +01:00
Jake Howard bfa4755871
Move well-known URLs into their own app 2022-08-22 20:33:52 +01:00
Jake Howard e74dbcc228
Add matrix client well-known view 2022-08-22 14:43:58 +01:00
Jake Howard 31c370c13e
Don't cache security.txt view for full expiry time
This could result in the expiry time being in the past
2022-08-22 14:39:12 +01:00
Jake Howard a110b9c34e
Add cache to robots.txt view 2022-08-22 14:38:32 +01:00
Jake Howard 521595a781
Add view to serve matrix server well-known URL 2022-08-22 14:37:29 +01:00
Jake Howard 10b32da3e0
Add crontab to project
Cron will likely be a duplicate compose service with a different
command.
2022-08-20 20:48:27 +01:00
Jake Howard 2fe0960623
Add management command to clear cache 2022-08-20 18:51:01 +01:00
Jake Howard 32a1486840
Ensure captions are optional 2022-08-20 18:38:28 +01:00
Jake Howard 900aaad850
Simplify caching for pygments styles 2022-08-20 18:32:25 +01:00
Jake Howard fd445375ae
Add caching to a few simple URLs
These do a few queries, and don't change often - ideal for caching
2022-08-20 18:31:08 +01:00
Jake Howard 2a46a70620
Add more elements to the dark mode 2022-08-20 17:45:12 +01:00
Jake Howard 727ad725d1
Add dark mode toggle 2022-08-20 15:31:14 +01:00
Jake Howard 3e6547881e
Rename blog post models
A "blog" isn't a blog "post"
2022-08-20 14:20:12 +01:00
Jake Howard adc6002217
Reuse online accounts query on contact page 2022-08-20 12:19:54 +01:00
Jake Howard 94efdfb1cc
Remove icons from navbar 2022-08-20 12:12:42 +01:00
Jake Howard 90545c3e2a
Fix reading time on blog list 2022-08-20 11:22:50 +01:00
Jake Howard 710a4c7955
Humanize reading time 2022-08-19 17:31:40 +01:00
Jake Howard 2dd660ed13
Add meta tags 2022-08-19 16:56:20 +01:00
Jake Howard af6449c9f8
Add a way to disable SEO indexing
Well, "disable"
2022-08-19 15:31:27 +01:00
Jake Howard cd4252cd64
Return 200 when viewing the dedicated 404 page 2022-08-19 15:07:59 +01:00
Jake Howard f452f5deed
Add security.txt 2022-08-19 15:06:18 +01:00
Jake Howard 1abc6da19b
Add robots.txt 2022-08-19 14:35:38 +01:00
Jake Howard 24d92f4760
Use smaller image URL for listing 2022-08-19 14:33:57 +01:00
Jake Howard 09c4b93245
Add typed table block 2022-08-19 13:48:45 +01:00
Jake Howard 5affe274bd
Don't serialize all language options in migrations 2022-08-19 13:40:40 +01:00
Jake Howard 57f5505c24
Add 404 page 2022-08-19 09:36:03 +01:00
Jake Howard a593dea561
Add spacing under results count on search page 2022-08-18 14:42:01 +01:00
Jake Howard 67c867ddd2
Put playlist link in hero 2022-08-18 14:32:58 +01:00
Jake Howard fd93df93a8
Add share links to spotify page 2022-08-18 14:31:02 +01:00
Jake Howard 29ce7efc13
Move spotify link above playlist 2022-08-18 14:30:51 +01:00
Jake Howard 8fa27e8c3c
Remove unnecessary extra template 2022-08-18 14:17:29 +01:00
Jake Howard fcf327e429
Derive more page context from spotify API 2022-08-18 14:14:46 +01:00
Jake Howard e094974f20
Make the spotify table look nicer 2022-08-18 09:25:14 +01:00
Jake Howard 55b723ba37
Cache spotify data 2022-08-18 09:21:57 +01:00
Jake Howard 872a6c0b30
Get all pages of playlist data
This also only gets the fields we need
2022-08-18 09:21:48 +01:00
Jake Howard ace30f4dbd
Add basic spotify page
It currently doesn't handle pagination, or caching
2022-08-17 22:17:32 +01:00
Jake Howard c26397ae8d
Separate common tests and add tests for common pages 2022-08-17 18:52:07 +01:00