mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
For now it doesn't serve the full information, only the information shown in the current/next comic view in iOS. I will see if I create two separated controllers or just on sending all the information when more information is needed in another iOS view.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#include "comicfullinfocontroller_v2.h"
|
|
|
|
|
|
|
|
#include <QUrl>
|
|
|
|
#include "db_helper.h"
|
|
#include "comic_db.h"
|
|
#include "folder.h"
|
|
|
|
#include "yacreader_server_data_helper.h"
|
|
|
|
#include "qnaturalsorting.h"
|
|
|
|
#include <ctime>
|
|
using namespace std;
|
|
|
|
|
|
|
|
ComicFullinfoController_v2::ComicFullinfoController_v2() {}
|
|
|
|
void ComicFullinfoController_v2::service(HttpRequest& request, HttpResponse& response)
|
|
{
|
|
response.setHeader("Content-Type", "application/json");
|
|
|
|
QString path = QUrl::fromPercentEncoding(request.getPath()).toUtf8();
|
|
QStringList pathElements = path.split('/');
|
|
int libraryId = pathElements.at(3).toInt();
|
|
qulonglong comicId = pathElements.at(5).toULongLong();
|
|
|
|
serviceContent(libraryId, comicId, response);
|
|
|
|
response.setStatus(200,"OK");
|
|
response.write("",true);
|
|
}
|
|
|
|
void ComicFullinfoController_v2::serviceContent(const int &libraryId, const qulonglong &comicId, HttpResponse &response)
|
|
{
|
|
ComicDB comic = DBHelper::getComicInfo(libraryId, comicId);
|
|
|
|
QJsonObject json = YACReaderServerDataHelper::fullComicToJSON(libraryId, comic);
|
|
|
|
QJsonDocument output(json);
|
|
|
|
response.write(output.toJson());
|
|
}
|