Cache css and js based on commit hash or version number

This commit is contained in:
JonnyWong16 2017-11-01 19:23:14 -07:00
parent ef6ef868e0
commit 0d54e9f2d6
10 changed files with 20 additions and 18 deletions

View file

@ -14,7 +14,7 @@
<meta name="author" content="">
<link href="${http_root}css/bootstrap3/bootstrap.css" rel="stylesheet">
<link href="${http_root}css/pnotify.custom.min.css" rel="stylesheet" />
<link href="${http_root}css/plexpy.css" rel="stylesheet">
<link href="${http_root}css/plexpy.css${cache_param}" rel="stylesheet">
<link href="${http_root}css/opensans.min.css" rel="stylesheet">
<link href="${http_root}css/font-awesome.min.css" rel="stylesheet">
${next.headIncludes()}
@ -376,7 +376,7 @@ ${next.modalIncludes()}
<script src="${http_root}js/bootstrap.min.js"></script>
<script src="${http_root}js/bootstrap-hover-dropdown.min.js"></script>
<script src="${http_root}js/pnotify.custom.min.js"></script>
<script src="${http_root}js/script.js"></script>
<script src="${http_root}js/script.js${cache_param}"></script>
<script src="${http_root}js/jquery.qrcode.min.js"></script>
% if _session['user_group'] == 'admin' and plexpy.CONFIG.BROWSER_ENABLED:
<script src="${http_root}js/ajaxNotifications.js"></script>

View file

@ -104,7 +104,7 @@
<script src="${http_root}js/dataTables.bootstrap.min.js"></script>
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
<script src="${http_root}js/moment-with-locale.js"></script>
<script src="${http_root}js/tables/history_table.js"></script>
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
<script>
$(document).ready(function () {
// Load user ids and names (for the selector)

View file

@ -28,7 +28,7 @@
</div>
</div>
<script src="${http_root}js/tables/history_table_modal.js"></script>
<script src="${http_root}js/tables/history_table_modal.js${cache_param}"></script>
<script>
$(document).ready(function() {
$('#date-header').html(moment('${data["start_date"]}','YYYY-MM-DD').format('ddd MMM Do YYYY'));

View file

@ -509,7 +509,7 @@ DOCUMENTATION :: END
<script src="${http_root}js/moment-with-locale.js"></script>
% if data:
<script src="${http_root}js/tables/history_table.js"></script>
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
% if data['media_type'] in ('show', 'artist'):
<script>
function get_history() {

View file

@ -97,7 +97,7 @@
<script src="${http_root}js/dataTables.bootstrap.min.js"></script>
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
<script src="${http_root}js/moment-with-locale.js"></script>
<script src="${http_root}js/tables/libraries.js"></script>
<script src="${http_root}js/tables/libraries.js${cache_param}"></script>
<script>
$(document).ready(function () {
libraries_list_table_options.ajax = {

View file

@ -360,8 +360,8 @@ DOCUMENTATION :: END
% endif
</script>
<script src="${http_root}js/moment-with-locale.js"></script>
<script src="${http_root}js/tables/history_table.js"></script>
<script src="${http_root}js/tables/media_info_table.js"></script>
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
<script src="${http_root}js/tables/media_info_table.js${cache_param}"></script>
<script>
$(document).ready(function () {
$("#edit-library-tooltip").tooltip();

View file

@ -188,10 +188,10 @@
<script src="${http_root}js/dataTables.bootstrap.min.js"></script>
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
<script src="${http_root}js/moment-with-locale.js"></script>
<script src="${http_root}js/tables/logs.js"></script>
<script src="${http_root}js/tables/plex_logs.js"></script>
<script src="${http_root}js/tables/notification_logs.js"></script>
<script src="${http_root}js/tables/login_logs.js"></script>
<script src="${http_root}js/tables/logs.js${cache_param}"></script>
<script src="${http_root}js/tables/plex_logs.js${cache_param}"></script>
<script src="${http_root}js/tables/notification_logs.js${cache_param}"></script>
<script src="${http_root}js/tables/login_logs.js${cache_param}"></script>
<script>
$(document).ready(function() {

View file

@ -54,7 +54,7 @@
<script src="${http_root}js/dataTables.bootstrap.min.js"></script>
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
<script src="${http_root}js/dataTables.colVis.js"></script>
<script src="${http_root}js/tables/sync_table.js"></script>
<script src="${http_root}js/tables/sync_table.js${cache_param}"></script>
<script>
$(document).ready(function() {
sync_table_options.ajax = {

View file

@ -367,10 +367,10 @@ DOCUMENTATION :: END
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
% if data:
<script src="${http_root}js/moment-with-locale.js"></script>
<script src="${http_root}js/tables/history_table.js"></script>
<script src="${http_root}js/tables/user_ips.js"></script>
<script src="${http_root}js/tables/sync_table.js"></script>
<script src="${http_root}js/tables/login_logs.js"></script>
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
<script src="${http_root}js/tables/user_ips.js${cache_param}"></script>
<script src="${http_root}js/tables/sync_table.js${cache_param}"></script>
<script src="${http_root}js/tables/login_logs.js${cache_param}"></script>
<script>
$(document).ready(function () {

View file

@ -61,13 +61,15 @@ def serve_template(templatename, **kwargs):
_hplookup = TemplateLookup(directories=[template_dir], default_filters=['unicode', 'h'])
http_root = plexpy.HTTP_ROOT
server_name = plexpy.CONFIG.PMS_NAME
cache_param = '?' + plexpy.CURRENT_VERSION or common.VERSION_NUMBER
_session = get_session_info()
try:
template = _hplookup.get_template(templatename)
return template.render(http_root=plexpy.HTTP_ROOT, server_name=server_name,
return template.render(http_root=http_root, server_name=server_name, cache_param=cache_param,
_session=_session, **kwargs)
except:
return exceptions.html_error_template().render()