mirror of
https://github.com/YACReader/yacreader
synced 2025-07-15 19:44:32 -04:00
Merge
This commit is contained in:
33
YACReaderLibrary/server/controllers/favoritescontroller.cpp
Normal file
33
YACReaderLibrary/server/controllers/favoritescontroller.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "favoritescontroller.h"
|
||||
|
||||
#include "db_helper.h"
|
||||
#include "comic_db.h"
|
||||
|
||||
#include "yacreader_server_data_helper.h"
|
||||
|
||||
FavoritesController::FavoritesController() {}
|
||||
|
||||
void FavoritesController::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(2).toInt();
|
||||
|
||||
serviceContent(libraryId, response);
|
||||
|
||||
response.write("",true);
|
||||
}
|
||||
|
||||
void FavoritesController::serviceContent(const int library, HttpResponse &response)
|
||||
{
|
||||
QList<ComicDB> tagComics = DBHelper::getFavorites(library);
|
||||
|
||||
for(const ComicDB &comic : tagComics)
|
||||
{
|
||||
response.write(YACReaderServerDataHelper::comicToYSFormat(library, comic).toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user