mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-22 10:37:44 -05:00
[db/jsonapi] New admin value for Last-Modified in JSON API header
This adds a new timestamp value "db_modified" into the admin db table. In addition to the existing "db_update" admin value, this value is also updated if rating, play-/skip-count or seek changes for a media_info_file (files db table). This should improve the caching behavior in clients of the JSON API (especially the player web interface) in refreshing its data if some of this values changes.
This commit is contained in:
@@ -2590,7 +2590,7 @@ jsonapi_reply_library_album_tracks(struct httpd_request *hreq)
|
||||
int total;
|
||||
int ret = 0;
|
||||
|
||||
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_UPDATE);
|
||||
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_MODIFIED);
|
||||
if (db_update && httpd_request_not_modified_since(hreq->req, &db_update))
|
||||
return HTTP_NOTMODIFIED;
|
||||
|
||||
@@ -2644,7 +2644,7 @@ jsonapi_reply_library_tracks_get_byid(struct httpd_request *hreq)
|
||||
json_object *reply = NULL;
|
||||
int ret = 0;
|
||||
|
||||
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_UPDATE);
|
||||
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_MODIFIED);
|
||||
if (db_update && httpd_request_not_modified_since(hreq->req, &db_update))
|
||||
return HTTP_NOTMODIFIED;
|
||||
|
||||
@@ -2836,7 +2836,7 @@ jsonapi_reply_library_playlist_tracks(struct httpd_request *hreq)
|
||||
int total;
|
||||
int ret = 0;
|
||||
|
||||
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_UPDATE);
|
||||
db_update = (time_t) db_admin_getint64(DB_ADMIN_DB_MODIFIED);
|
||||
if (db_update && httpd_request_not_modified_since(hreq->req, &db_update))
|
||||
return HTTP_NOTMODIFIED;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user