Files
yacreader/YACReaderLibrary/server/controllers/v2/readinglistinfocontroller_v2.cpp
luisangelsm 3709b6e737
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled
Format includes using clang-format
2026-03-13 18:21:38 +01:00

42 lines
1.4 KiB
C++

#include "readinglistinfocontroller_v2.h"
#include "comic_db.h"
#include "db_helper.h"
#include <QUrl>
using stefanfrings::HttpRequest;
using stefanfrings::HttpResponse;
ReadingListInfoControllerV2::ReadingListInfoControllerV2() { }
void ReadingListInfoControllerV2::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 listId = pathElements.at(5).toULongLong();
serviceComics(libraryId, listId, response);
response.write("", true);
}
void ReadingListInfoControllerV2::serviceComics(const int &library, const qulonglong &readingListId, HttpResponse &response)
{
QList<ComicDB> comics = DBHelper::getReadingListFullContent(library, readingListId);
for (const ComicDB &comic : comics) {
response.write(QString("/v2/library/%1/comic/%2:%3:%4:%5:%6\r\n")
.arg(library)
.arg(comic.id)
.arg(comic.getFileName())
.arg(comic.getFileSize())
.arg(comic.info.read ? 1 : 0)
.arg(comic.info.hash)
.toUtf8());
}
}