adding a get_version function that gets the mtime of the jscript file and then lets us embed that into the
<script src=> Note, accidentally committed, partially tested
This commit is contained in:
13
files.py
13
files.py
@@ -270,12 +270,23 @@ class EntrySchema(ma.SQLAlchemyAutoSchema):
|
||||
def get_full_path(self, obj):
|
||||
return obj.FullPathOnFS()
|
||||
|
||||
# quick helper func to return the timestampe of a (jscript) file.
|
||||
# we use this as a quick/hacky way of versioning the jscript file
|
||||
def get_version(fname):
|
||||
mtime = os.path.getmtime(fname)
|
||||
return int(mtime) # Use timestamp as version
|
||||
|
||||
# global - this will be use more than once below, so do it once for efficiency
|
||||
entries_schema = EntrySchema(many=True)
|
||||
FOT_Schema = FaceOverrideTypeSchema(many=True)
|
||||
path_Schema = PathSchema(many=True)
|
||||
person_Schema = PersonSchema(many=True)
|
||||
|
||||
js_vers={}
|
||||
js_vers['fs'] = get_version( url_for( 'internal', filename='js/files_support.js') )
|
||||
js_vers['vs'] = get_version( url_for( 'internal', filename='js/view_support.js') )
|
||||
js_vers['ft'] = get_version( url_for( 'internal', filename='js/files_transform.js') )
|
||||
|
||||
################################################################################
|
||||
# /get_entries_by_ids -> route where we supply list of entry ids (for next/prev
|
||||
# page of data we want to show). Returns json of all matching entries
|
||||
@@ -471,7 +482,7 @@ def file_list_ip():
|
||||
def files_ip():
|
||||
OPT=States( request )
|
||||
query_data = GetQueryData( OPT )
|
||||
return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data )
|
||||
return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data, js_vers=js_vers )
|
||||
|
||||
################################################################################
|
||||
# /files -> show thumbnail view of files from storage_path
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
}
|
||||
#tst90:hover,#tst90:focus { filter: invert(73%) sepia(27%) saturate(3970%) hue-rotate(146deg) brightness(94%) contrast(100%); }
|
||||
</style>
|
||||
<script src="{{ url_for( 'internal', filename='js/files_transform.js')}}"></script>
|
||||
<script src="{{ url_for( 'internal', filename='js/files_support.js')}}"></script>
|
||||
<script src="{{ url_for( 'internal', filename='js/view_support.js')}}"></script>
|
||||
<script src="{{ url_for( 'internal', filename='js/files_transform.js')}}?v={{ js_vers['ft'] }}"></script>
|
||||
<script src="{{ url_for( 'internal', filename='js/files_support.js')}}?v={{ js_vers['fs'] }}"></script>
|
||||
<script src="{{ url_for( 'internal', filename='js/view_support.js')}}?v={{ js_vers['vs'] }}"></script>
|
||||
|
||||
<div id="files_div">
|
||||
<div class="container-fluid">
|
||||
|
||||
Reference in New Issue
Block a user