Skip to content

Commit

Permalink
don't download fonts when Save-Data is on
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Sep 30, 2024
1 parent fe08cbf commit c4d811e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions liberapay/utils/state_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def attach_environ_to_request(environ, request):
except UnicodeDecodeError:
request.hostname = ''
request.subdomain = None
request.save_data = request.headers.get(b'Save-Data') == b'on'


def create_response_object(request, website):
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions templates/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<link rel="icon" href="{{ website.asset('liberapay/icon-v2_black.16.png') }}" type="image/png">
<link rel="apple-touch-icon" href="{{ website.asset('liberapay/icon-v2_black-on-yellow.200.png') }}">
<link rel="stylesheet" href="{{ website.asset('bootstrap/css/bootstrap.css') }}">
% if not request.save_data
<link rel="stylesheet" href="{{ website.asset('fonts.css') }}" type="text/css">
% endif
<link rel="stylesheet" href="{{ website.asset('base.css') }}" type="text/css">
% block head_alternates
% if request.method in constants.SAFE_METHODS and response.code == 200
Expand Down
3 changes: 3 additions & 0 deletions www/assets/fonts.css.spt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[---]
[---] text/css via scss
@import "style/fonts";

0 comments on commit c4d811e

Please sign in to comment.