mirror of https://github.com/kiwix/libkiwix.git
Deduplication of OPDS MIME type strings
This commit is contained in:
parent
9bd2df2327
commit
1273570e01
|
@ -33,6 +33,24 @@
|
||||||
|
|
||||||
namespace kiwix {
|
namespace kiwix {
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
enum OPDSResponseKind
|
||||||
|
{
|
||||||
|
OPDS_ENTRY,
|
||||||
|
OPDS_NAVIGATION_FEED,
|
||||||
|
OPDS_ACQUISITION_FEED
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::string opdsMimeType[] = {
|
||||||
|
"application/atom+xml;type=entry;profile=opds-catalog",
|
||||||
|
"application/atom+xml;profile=opds-catalog;kind=navigation",
|
||||||
|
"application/atom+xml;profile=opds-catalog;kind=acquisition"
|
||||||
|
};
|
||||||
|
|
||||||
|
} // unnamed namespace
|
||||||
|
|
||||||
std::unique_ptr<Response> InternalServer::handle_catalog_v2(const RequestContext& request)
|
std::unique_ptr<Response> InternalServer::handle_catalog_v2(const RequestContext& request)
|
||||||
{
|
{
|
||||||
if (m_verbose.load()) {
|
if (m_verbose.load()) {
|
||||||
|
@ -90,7 +108,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_root(const RequestCo
|
||||||
{"category_list_feed_id", gen_uuid(libraryId + "/categories")},
|
{"category_list_feed_id", gen_uuid(libraryId + "/categories")},
|
||||||
{"language_list_feed_id", gen_uuid(libraryId + "/languages")}
|
{"language_list_feed_id", gen_uuid(libraryId + "/languages")}
|
||||||
},
|
},
|
||||||
"application/atom+xml;profile=opds-catalog;kind=navigation"
|
opdsMimeType[OPDS_NAVIGATION_FEED]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +122,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_entries(const Reques
|
||||||
return ContentResponse::build(
|
return ContentResponse::build(
|
||||||
*this,
|
*this,
|
||||||
opdsFeed,
|
opdsFeed,
|
||||||
"application/atom+xml;profile=opds-catalog;kind=acquisition"
|
opdsMimeType[OPDS_ACQUISITION_FEED]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +142,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_complete_entry(const
|
||||||
return ContentResponse::build(
|
return ContentResponse::build(
|
||||||
*this,
|
*this,
|
||||||
opdsFeed,
|
opdsFeed,
|
||||||
"application/atom+xml;type=entry;profile=opds-catalog"
|
opdsMimeType[OPDS_ENTRY]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +154,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_categories(const Req
|
||||||
return ContentResponse::build(
|
return ContentResponse::build(
|
||||||
*this,
|
*this,
|
||||||
opdsDumper.categoriesOPDSFeed(),
|
opdsDumper.categoriesOPDSFeed(),
|
||||||
"application/atom+xml;profile=opds-catalog;kind=navigation"
|
opdsMimeType[OPDS_NAVIGATION_FEED]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +166,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_languages(const Requ
|
||||||
return ContentResponse::build(
|
return ContentResponse::build(
|
||||||
*this,
|
*this,
|
||||||
opdsDumper.languagesOPDSFeed(),
|
opdsDumper.languagesOPDSFeed(),
|
||||||
"application/atom+xml;profile=opds-catalog;kind=navigation"
|
opdsMimeType[OPDS_NAVIGATION_FEED]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue