From fd8af884938eb3f1c5abb1876aba50e0b4473821 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 9 May 2019 11:52:37 -0500 Subject: [PATCH] Use separate asset version for cache busting --- src/invidious.cr | 13 ++++--- src/invidious/views/components/player.ecr | 2 +- .../views/components/player_sources.ecr | 32 ++++++++--------- .../views/components/subscribe_widget.ecr | 2 +- src/invidious/views/embed.ecr | 4 +-- src/invidious/views/licenses.ecr | 34 +++++++++---------- src/invidious/views/template.ecr | 24 ++++++------- src/invidious/views/watch.ecr | 2 +- 8 files changed, 59 insertions(+), 54 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 2ef89ac3..25bd3672 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -53,6 +53,11 @@ CURRENT_BRANCH = {{ "#{`git branch | sed -n '/\* /s///p'`.strip}" }} CURRENT_COMMIT = {{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit`.strip}" }} CURRENT_VERSION = {{ "#{`git describe --tags --abbrev=0`.strip}" }} +# This is used to determine the `?v=` on the end of file URLs (for cache busting). We +# only need to expire modified assets, so we can use this to find the last commit that changes +# any assets +ASSET_COMMIT = {{ "#{`git rev-list HEAD --max-count=1 --abbrev-commit -- assets`.strip}" }} + SOFTWARE = { "name" => "invidious", "version" => "#{CURRENT_VERSION}-#{CURRENT_COMMIT}", @@ -1854,12 +1859,12 @@ post "/data_control" do |env| sleep 20.seconds env.response.puts %() - env.response.puts %() - env.response.puts %() + env.response.puts %() + env.response.puts %() if env.get("preferences").as(Preferences).dark_mode - env.response.puts %() + env.response.puts %() else - env.response.puts %() + env.response.puts %() end env.response.puts %(

) env.response.flush diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr index 3520ad29..a64ea39d 100644 --- a/src/invidious/views/components/player.ecr +++ b/src/invidious/views/components/player.ecr @@ -47,4 +47,4 @@ var player_data = { thumbnail: "<%= thumbnail %>" } - + diff --git a/src/invidious/views/components/player_sources.ecr b/src/invidious/views/components/player_sources.ecr index ed1239cc..003d2c3a 100644 --- a/src/invidious/views/components/player_sources.ecr +++ b/src/invidious/views/components/player_sources.ecr @@ -1,22 +1,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + <% if params.annotations %> - - + + <% end %> <% if params.listen || params.quality != "dash" %> - - + + <% end %> diff --git a/src/invidious/views/components/subscribe_widget.ecr b/src/invidious/views/components/subscribe_widget.ecr index e555d6c5..1d9966b3 100644 --- a/src/invidious/views/components/subscribe_widget.ecr +++ b/src/invidious/views/components/subscribe_widget.ecr @@ -29,7 +29,7 @@ unsubscribe_text: '<%= HTML.escape(translate(locale, "Unsubscribe")) %>' } - + <% else %>

<%= rendered "components/player_sources" %> - + <%= HTML.escape(video.title) %> - Invidious