From 6a5e979b0bea38adfd7a683bee4841ef615610a3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Mar 2018 21:22:36 +0530 Subject: [PATCH] Add a uuid to the headers for OPDS feeds. Allows OPDS consuming applications to distinguish between different calibre installs. Fixes #1756666 [OPDS feed id should be unique](https://bugs.launchpad.net/calibre/+bug/1756666) --- src/calibre/srv/opds.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/srv/opds.py b/src/calibre/srv/opds.py index ae14025fea..a819b75dc1 100644 --- a/src/calibre/srv/opds.py +++ b/src/calibre/srv/opds.py @@ -21,6 +21,8 @@ from calibre import guess_type, prepare_string_for_xml as xml from calibre.utils.icu import sort_key from calibre.utils.date import as_utc, timestampfromdt, is_date_undefined from calibre.utils.search_query_parser import ParseException +from calibre.utils.config import prefs +from calibre import force_unicode from calibre.srv.errors import HTTPNotFound, HTTPInternalServerError from calibre.srv.routes import endpoint @@ -39,6 +41,7 @@ def unhexlify(x): def atom(ctx, rd, endpoint, output): rd.outheaders.set('Content-Type', 'application/atom+xml; charset=UTF-8', replace_all=True) + rd.outheaders.set('Calibre-Instance-Id', force_unicode(prefs['installation_uuid'], 'utf-8'), replace_all=True) if isinstance(output, bytes): ans = output # Assume output is already UTF-8 XML elif isinstance(output, type('')):