Add simple form of cache busting

This commit is contained in:
Omar Roth 2019-05-08 08:58:10 -05:00
parent 59cbf95c4f
commit 4616f889fd
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2
8 changed files with 60 additions and 60 deletions

View File

@ -1845,12 +1845,12 @@ post "/data_control" do |env|
sleep 20.seconds
env.response.puts %(<meta http-equiv="refresh" content="0; url=#{referer}">)
env.response.puts %(<link rel="stylesheet" href="/css/ionicons.min.css">)
env.response.puts %(<link rel="stylesheet" href="/css/default.css">)
env.response.puts %(<link rel="stylesheet" href="/css/ionicons.min.css?v=<%= CURRENT_COMMIT %>">)
env.response.puts %(<link rel="stylesheet" href="/css/default.css?v=<%= CURRENT_COMMIT %>">)
if env.get("preferences").as(Preferences).dark_mode
env.response.puts %(<link rel="stylesheet" href="/css/darktheme.css">)
env.response.puts %(<link rel="stylesheet" href="/css/darktheme.css?v=<%= CURRENT_COMMIT %>">)
else
env.response.puts %(<link rel="stylesheet" href="/css/lighttheme.css">)
env.response.puts %(<link rel="stylesheet" href="/css/lighttheme.css?v=<%= CURRENT_COMMIT %>">)
end
env.response.puts %(<h3><div class="loading"><i class="icon ion-ios-refresh"></i></div></h3>)
env.response.flush
@ -5351,7 +5351,7 @@ if Kemal.config.ssl
end
static_headers do |response, filepath, filestat|
response.headers.add("Cache-Control", "max-age=86400")
response.headers.add("Cache-Control", "max-age=2629800")
end
public_folder "assets"

View File

@ -43,8 +43,8 @@
var player_data = {
aspect_ratio: '<%= aspect_ratio %>',
title: "<%= video.title.dump_unquoted %>",
description: "<%= description %>",
description: "<%= HTML.escape(description) %>",
thumbnail: "<%= thumbnail %>"
}
</script>
<script src="/js/player.js"></script>
<script src="/js/player.js?v=<%= CURRENT_COMMIT %>"></script>

View File

@ -1,22 +1,22 @@
<link rel="stylesheet" href="/css/video-js.min.css">
<link rel="stylesheet" href="/css/videojs-http-source-selector.css">
<link rel="stylesheet" href="/css/videojs.markers.min.css">
<link rel="stylesheet" href="/css/videojs-share.css">
<link rel="stylesheet" href="/css/videojs-vtt-thumbnails.css">
<script src="/js/video.min.js"></script>
<script src="/js/videojs-contrib-quality-levels.min.js"></script>
<script src="/js/videojs-http-source-selector.min.js"></script>
<script src="/js/videojs.hotkeys.min.js"></script>
<script src="/js/videojs-markers.min.js"></script>
<script src="/js/videojs-share.min.js"></script>
<script src="/js/videojs-vtt-thumbnails.min.js"></script>
<link rel="stylesheet" href="/css/video-js.min.css?v=<%= CURRENT_COMMIT %>">
<link rel="stylesheet" href="/css/videojs-http-source-selector.css?v=<%= CURRENT_COMMIT %>">
<link rel="stylesheet" href="/css/videojs.markers.min.css?v=<%= CURRENT_COMMIT %>">
<link rel="stylesheet" href="/css/videojs-share.css?v=<%= CURRENT_COMMIT %>">
<link rel="stylesheet" href="/css/videojs-vtt-thumbnails.css?v=<%= CURRENT_COMMIT %>">
<script src="/js/video.min.js?v=<%= CURRENT_COMMIT %>"></script>
<script src="/js/videojs-contrib-quality-levels.min.js?v=<%= CURRENT_COMMIT %>"></script>
<script src="/js/videojs-http-source-selector.min.js?v=<%= CURRENT_COMMIT %>"></script>
<script src="/js/videojs.hotkeys.min.js?v=<%= CURRENT_COMMIT %>"></script>
<script src="/js/videojs-markers.min.js?v=<%= CURRENT_COMMIT %>"></script>
<script src="/js/videojs-share.min.js?v=<%= CURRENT_COMMIT %>"></script>
<script src="/js/videojs-vtt-thumbnails.min.js?v=<%= CURRENT_COMMIT %>"></script>
<% if params.annotations %>
<link rel="stylesheet" href="/css/videojs-youtube-annotations.min.css">
<script src="/js/videojs-youtube-annotations.min.js"></script>
<link rel="stylesheet" href="/css/videojs-youtube-annotations.min.css?v=<%= CURRENT_COMMIT %>">
<script src="/js/videojs-youtube-annotations.min.js?v=<%= CURRENT_COMMIT %>"></script>
<% end %>
<% if params.listen || params.quality != "dash" %>
<link rel="stylesheet" href="/css/quality-selector.css">
<script src="/js/silvermine-videojs-quality-selector.min.js"></script>
<link rel="stylesheet" href="/css/quality-selector.css?v=<%= CURRENT_COMMIT %>">
<script src="/js/silvermine-videojs-quality-selector.min.js?v=<%= CURRENT_COMMIT %>"></script>
<% end %>

View File

@ -22,14 +22,14 @@
<script>
var subscribe_data = {
ucid: '<%= ucid %>',
author: '<%= author %>',
sub_count_text: '<%= sub_count_text %>',
author: '<%= HTML.escape(author) %>',
sub_count_text: '<%= HTML.escape(sub_count_text) %>',
csrf_token: '<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>',
subscribe_text: '<%= translate(locale, "Subscribe").gsub("'", "\\'") %>',
unsubscribe_text: '<%= translate(locale, "Unsubscribe").gsub("'", "\\'") %>'
subscribe_text: '<%= HTML.escape(translate(locale, "Subscribe")) %>',
unsubscribe_text: '<%= HTML.escape(translate(locale, "Unsubscribe")) %>'
}
</script>
<script src="/js/subscribe_widget.js"></script>
<script src="/js/subscribe_widget.js?v=<%= CURRENT_COMMIT %>"></script>
<% else %>
<p>
<a id="subscribe" class="pure-button pure-button-primary"

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="thumbnail" content="<%= thumbnail %>">
<%= rendered "components/player_sources" %>
<link rel="stylesheet" href="/css/default.css">
<link rel="stylesheet" href="/css/default.css?v=<%= CURRENT_COMMIT %>">
<title><%= HTML.escape(video.title) %> - Invidious</title>
<style>
#player {
@ -35,6 +35,6 @@ var video_data = {
</script>
<%= rendered "components/player" %>
<script src="/js/embed.js"></script>
<script src="/js/embed.js?v=<%= CURRENT_COMMIT %>"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<table id="jslicense-labels1">
<tr>
<td>
<a href="/js/embed.js">embed.js</a>
<a href="/js/embed.js?v=<%= CURRENT_COMMIT %>">embed.js</a>
</td>
<td>
@ -19,13 +19,13 @@
</td>
<td>
<a href="/js/embed.js"><%= translate(locale, "source") %></a>
<a href="/js/embed.js?v=<%= CURRENT_COMMIT %>"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr>
<td>
<a href="/js/player.js">player.js</a>
<a href="/js/player.js?v=<%= CURRENT_COMMIT %>">player.js</a>
</td>
<td>
@ -33,13 +33,13 @@
</td>
<td>
<a href="/js/player.js"><%= translate(locale, "source") %></a>
<a href="/js/player.js?v=<%= CURRENT_COMMIT %>"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr>
<td>
<a href="/js/silvermine-videojs-quality-selector.min.js">silvermine-videojs-quality-selector.min.js</a>
<a href="/js/silvermine-videojs-quality-selector.min.js?v=<%= CURRENT_COMMIT %>">silvermine-videojs-quality-selector.min.js</a>
</td>
<td>
@ -53,7 +53,7 @@
<tr>
<td>
<a href="/js/subscribe_widget.js">subscribe_widget.js</a>
<a href="/js/subscribe_widget.js?v=<%= CURRENT_COMMIT %>">subscribe_widget.js</a>
</td>
<td>
@ -61,13 +61,13 @@
</td>
<td>
<a href="/js/subscribe_widget.js"><%= translate(locale, "source") %></a>
<a href="/js/subscribe_widget.js?v=<%= CURRENT_COMMIT %>"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr>
<td>
<a href="/js/videojs-contrib-quality-levels.min.js">videojs-contrib-quality-levels.min.js</a>
<a href="/js/videojs-contrib-quality-levels.min.js?v=<%= CURRENT_COMMIT %>">videojs-contrib-quality-levels.min.js</a>
</td>
<td>
@ -81,7 +81,7 @@
<tr>
<td>
<a href="/js/videojs.hotkeys.min.js">videojs.hotkeys.min.js</a>
<a href="/js/videojs.hotkeys.min.js?v=<%= CURRENT_COMMIT %>">videojs.hotkeys.min.js</a>
</td>
<td>
@ -95,7 +95,7 @@
<tr>
<td>
<a href="/js/videojs-http-source-selector.min.js">videojs-http-source-selector.min.js</a>
<a href="/js/videojs-http-source-selector.min.js?v=<%= CURRENT_COMMIT %>">videojs-http-source-selector.min.js</a>
</td>
<td>
@ -109,7 +109,7 @@
<tr>
<td>
<a href="/js/videojs-markers.min.js">videojs-markers.min.js</a>
<a href="/js/videojs-markers.min.js?v=<%= CURRENT_COMMIT %>">videojs-markers.min.js</a>
</td>
<td>
@ -123,7 +123,7 @@
<tr>
<td>
<a href="/js/videojs-share.min.js">videojs-share.min.js</a>
<a href="/js/videojs-share.min.js?v=<%= CURRENT_COMMIT %>">videojs-share.min.js</a>
</td>
<td>
@ -137,7 +137,7 @@
<tr>
<td>
<a href="/js/videojs-vtt-thumbnails.min.js">videojs-vtt-thumbnails.min.js</a>
<a href="/js/videojs-vtt-thumbnails.min.js?v=<%= CURRENT_COMMIT %>">videojs-vtt-thumbnails.min.js</a>
</td>
<td>
@ -151,7 +151,7 @@
<tr>
<td>
<a href="/js/videojs-youtube-annotations.min.js">videojs-youtube-annotations.min.js</a>
<a href="/js/videojs-youtube-annotations.min.js?v=<%= CURRENT_COMMIT %>">videojs-youtube-annotations.min.js</a>
</td>
<td>
@ -165,7 +165,7 @@
<tr>
<td>
<a href="/js/video.min.js">video.min.js</a>
<a href="/js/video.min.js?v=<%= CURRENT_COMMIT %>">video.min.js</a>
</td>
<td>
@ -179,7 +179,7 @@
<tr>
<td>
<a href="/js/watch.js">watch.js</a>
<a href="/js/watch.js?v=<%= CURRENT_COMMIT %>">watch.js</a>
</td>
<td>
@ -187,7 +187,7 @@
</td>
<td>
<a href="/js/watch.js"><%= translate(locale, "source") %></a>
<a href="/js/watch.js?v=<%= CURRENT_COMMIT %>"><%= translate(locale, "source") %></a>
</td>
</tr>
</table>

View File

@ -14,14 +14,14 @@
<meta name="msapplication-TileColor" content="#575757">
<meta name="theme-color" content="#575757">
<link title="Invidious" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml">
<link rel="stylesheet" href="/css/pure-min.css">
<link rel="stylesheet" href="/css/grids-responsive-min.css">
<link rel="stylesheet" href="/css/ionicons.min.css">
<link rel="stylesheet" href="/css/default.css">
<link rel="stylesheet" href="/css/pure-min.css?v=<%= CURRENT_COMMIT %>">
<link rel="stylesheet" href="/css/grids-responsive-min.css?v=<%= CURRENT_COMMIT %>">
<link rel="stylesheet" href="/css/ionicons.min.css?v=<%= CURRENT_COMMIT %>">
<link rel="stylesheet" href="/css/default.css?v=<%= CURRENT_COMMIT %>">
<% if env.get("preferences").as(Preferences).dark_mode %>
<link rel="stylesheet" href="/css/darktheme.css">
<link rel="stylesheet" href="/css/darktheme.css?v=<%= CURRENT_COMMIT %>">
<% else %>
<link rel="stylesheet" href="/css/lighttheme.css">
<link rel="stylesheet" href="/css/lighttheme.css?v=<%= CURRENT_COMMIT %>">
<% end %>
</head>

View File

@ -33,12 +33,12 @@ var video_data = {
length_seconds: '<%= video.info["length_seconds"].to_f %>',
play_next: <%= !rvs.empty? && !plid && params.continue %>,
next_video: '<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>',
youtube_comments_text: '<%= translate(locale, "View YouTube comments") %>',
reddit_comments_text: '<%= translate(locale, "View Reddit comments") %>',
reddit_permalink_text: '<%= translate(locale, "View more comments on Reddit") %>',
comments_text: '<%= translate(locale, "View `x` comments", "{commentCount}") %>',
hide_replies_text: '<%= translate(locale, "Hide replies") %>',
show_replies_text: '<%= translate(locale, "Show replies") %>',
youtube_comments_text: '<%= HTML.escape(translate(locale, "View YouTube comments")) %>',
reddit_comments_text: '<%= HTML.escape(translate(locale, "View Reddit comments")) %>',
reddit_permalink_text: '<%= HTML.escape(translate(locale, "View more comments on Reddit")) %>',
comments_text: '<%= HTML.escape(translate(locale, "View `x` comments", "{commentCount}")) %>',
hide_replies_text: '<%= HTML.escape(translate(locale, "Hide replies")) %>',
show_replies_text: '<%= HTML.escape(translate(locale, "Show replies")) %>',
params: <%= params.to_json %>,
preferences: <%= preferences.to_json %>
}
@ -242,4 +242,4 @@ var video_data = {
</div>
<% end %>
</div>
<script src="/js/watch.js"></script>
<script src="/js/watch.js?v=<%= CURRENT_COMMIT %>"></script>