diff options
Diffstat (limited to 'lib/csapi/content-repo.cpp')
-rw-r--r-- | lib/csapi/content-repo.cpp | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/lib/csapi/content-repo.cpp b/lib/csapi/content-repo.cpp index d0efdb9e..7eebeae5 100644 --- a/lib/csapi/content-repo.cpp +++ b/lib/csapi/content-repo.cpp @@ -63,15 +63,25 @@ class GetContentJob::Private QIODevice* content; }; -QUrl GetContentJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId) +BaseJob::Query queryToGetContent(bool allowRemote) +{ + BaseJob::Query _q; + _q.addQueryItem("allow_remote", QString("%1").arg(allowRemote)); + return _q; +} + +QUrl GetContentJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, bool allowRemote) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/download/" % serverName % "/" % mediaId); + basePath % "/download/" % serverName % "/" % mediaId, + queryToGetContent(allowRemote)); } -GetContentJob::GetContentJob(const QString& serverName, const QString& mediaId) +GetContentJob::GetContentJob(const QString& serverName, const QString& mediaId, bool allowRemote) : BaseJob(HttpVerb::Get, "GetContentJob", - basePath % "/download/" % serverName % "/" % mediaId, false) + basePath % "/download/" % serverName % "/" % mediaId, + queryToGetContent(allowRemote), + {}, false) , d(new Private) { setExpectedContentTypes({ "*/*" }); @@ -110,15 +120,25 @@ class GetContentOverrideNameJob::Private QIODevice* content; }; -QUrl GetContentOverrideNameJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, const QString& fileName) +BaseJob::Query queryToGetContentOverrideName(bool allowRemote) +{ + BaseJob::Query _q; + _q.addQueryItem("allow_remote", QString("%1").arg(allowRemote)); + return _q; +} + +QUrl GetContentOverrideNameJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, const QString& fileName, bool allowRemote) { return BaseJob::makeRequestUrl(std::move(baseUrl), - basePath % "/download/" % serverName % "/" % mediaId % "/" % fileName); + basePath % "/download/" % serverName % "/" % mediaId % "/" % fileName, + queryToGetContentOverrideName(allowRemote)); } -GetContentOverrideNameJob::GetContentOverrideNameJob(const QString& serverName, const QString& mediaId, const QString& fileName) +GetContentOverrideNameJob::GetContentOverrideNameJob(const QString& serverName, const QString& mediaId, const QString& fileName, bool allowRemote) : BaseJob(HttpVerb::Get, "GetContentOverrideNameJob", - basePath % "/download/" % serverName % "/" % mediaId % "/" % fileName, false) + basePath % "/download/" % serverName % "/" % mediaId % "/" % fileName, + queryToGetContentOverrideName(allowRemote), + {}, false) , d(new Private) { setExpectedContentTypes({ "*/*" }); @@ -156,7 +176,7 @@ class GetContentThumbnailJob::Private QIODevice* content; }; -BaseJob::Query queryToGetContentThumbnail(Omittable<int> width, Omittable<int> height, const QString& method) +BaseJob::Query queryToGetContentThumbnail(Omittable<int> width, Omittable<int> height, const QString& method, bool allowRemote) { BaseJob::Query _q; if (width) @@ -165,20 +185,21 @@ BaseJob::Query queryToGetContentThumbnail(Omittable<int> width, Omittable<int> h _q.addQueryItem("height", QString("%1").arg(height.value())); if (!method.isEmpty()) _q.addQueryItem("method", method); + _q.addQueryItem("allow_remote", QString("%1").arg(allowRemote)); return _q; } -QUrl GetContentThumbnailJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method) +QUrl GetContentThumbnailJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method, bool allowRemote) { return BaseJob::makeRequestUrl(std::move(baseUrl), basePath % "/thumbnail/" % serverName % "/" % mediaId, - queryToGetContentThumbnail(width, height, method)); + queryToGetContentThumbnail(width, height, method, allowRemote)); } -GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method) +GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method, bool allowRemote) : BaseJob(HttpVerb::Get, "GetContentThumbnailJob", basePath % "/thumbnail/" % serverName % "/" % mediaId, - queryToGetContentThumbnail(width, height, method), + queryToGetContentThumbnail(width, height, method, allowRemote), {}, false) , d(new Private) { |