mirror of
https://github.com/YACReader/yacreader
synced 2025-07-17 20:44:32 -04:00
Separate v1 and v2 server api classes and execution path.
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
#include "readinglistcontentcontroller_v2.h"
|
||||
|
||||
#include "db_helper.h"
|
||||
#include "comic_db.h"
|
||||
|
||||
#include "yacreader_server_data_helper.h"
|
||||
|
||||
ReadingListContentControllerV2::ReadingListContentControllerV2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ReadingListContentControllerV2::service(HttpRequest &request, HttpResponse &response)
|
||||
{
|
||||
response.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
|
||||
QString path = QUrl::fromPercentEncoding(request.getPath()).toUtf8();
|
||||
QStringList pathElements = path.split('/');
|
||||
int libraryId = pathElements.at(3).toInt();
|
||||
qulonglong readingListId = pathElements.at(5).toULongLong();
|
||||
|
||||
serviceContent(libraryId, readingListId, response);
|
||||
|
||||
response.write("",true);
|
||||
}
|
||||
|
||||
void ReadingListContentControllerV2::serviceContent(const int &library, const qulonglong &readingListId, HttpResponse &response)
|
||||
{
|
||||
QList<ComicDB> comics = DBHelper::getReadingListFullContent(library, readingListId);
|
||||
|
||||
for(const ComicDB &comic : comics)
|
||||
{
|
||||
response.write(YACReaderServerDataHelper::comicToYSFormat(library, comic).toUtf8());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user