Include the hashes of the prev/next comics in the comic info when opening a comic in the server

This commit is contained in:
Luis Ángel San Martín
2021-06-18 22:55:08 +02:00
parent af13279c18
commit ad036ec6ae
2 changed files with 20 additions and 8 deletions

View File

@ -105,10 +105,16 @@ void ComicControllerV2::service(HttpRequest &request, HttpResponse &response)
}
}
if (found) {
if (i > 0)
response.write(QString("previousComic:%1\r\n").arg(siblings.at(i - 1)->id).toUtf8());
if (i < siblings.length() - 1)
response.write(QString("nextComic:%1\r\n").arg(siblings.at(i + 1)->id).toUtf8());
if (i > 0) {
ComicDB *previousComic = static_cast<ComicDB *>(siblings.at(i - 1));
response.write(QString("previousComic:%1\r\n").arg(previousComic->id).toUtf8());
response.write(QString("previousComicHash:%1\r\n").arg(previousComic->info.hash).toUtf8());
}
if (i < siblings.length() - 1) {
ComicDB *nextComic = static_cast<ComicDB *>(siblings.at(i + 1));
response.write(QString("nextComic:%1\r\n").arg(nextComic->id).toUtf8());
response.write(QString("nextComicHash:%1\r\n").arg(nextComic->info.hash).toUtf8());
}
} else {
//ERROR
}