MCPcopy Create free account
hub / github.com/YACReader/yacreader / serviceV2

Method serviceV2

YACReaderLibrary/server/requestmapper.cpp:86–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void RequestMapper::serviceV2(HttpRequest &request, HttpResponse &response)
87{
88 QByteArray path = request.getPath();
89
90 QRegExp folderInfo("/v2/library/.+/folder/[0-9]+/info/?"); // get folder info (all comics in a folder including subfolders recursively)
91 QRegExp comicDownloadInfo("/v2/library/.+/comic/[0-9]+/info/?"); // get comic info (full download info)
92 QRegExp comicOpenForDownloading("/v2/library/.+/comic/[0-9]+/?"); // get comic info (full info + opening)
93 QRegExp comicOpenForRemoteReading("/v2/library/.+/comic/[0-9]+/remote/?"); // the server will open for reading the comic
94 QRegExp comicOpenForRemoteReadingInAReadingList("/v2/library/.+/reading_list/[0-9]+/comic/[0-9]+/remote/?"); // the server will open for reading the comic
95 QRegExp comicFullInfo("/v2/library/.+/comic/[0-9]+/fullinfo/?"); // get comic info
96 QRegExp comicUpdate("/v2/library/.+/comic/[0-9]+/update/?"); // get comic info
97 QRegExp comicClose("/v2/library/.+/comic/[0-9]+/close/?"); // the server will close the comic and free memory
98 QRegExp cover("/v2/library/.+/cover/.+"); // get comic cover (navigation)
99 QRegExp comicPage("/v2/library/.+/comic/[0-9]+/page/[0-9]+/?"); // get comic page
100 QRegExp comicPageRemote("/v2/library/.+/comic/[0-9]+/page/[0-9]+/remote?"); // get comic page (remote reading)
101 QRegExp serverVersion("/v2/version/?");
102 QRegExp folderContent("/v2/library/.+/folder/[0-9]+/content/?");
103 QRegExp folderMetadata("/v2/library/.+/folder/[0-9]+/metadata/?"); // get the folder metadata json (9.14)
104 QRegExp favs("/v2/library/.+/favs/?");
105 QRegExp reading("/v2/library/.+/reading/?");
106 QRegExp tags("/v2/library/.+/tags/?");
107 QRegExp tagContent("/v2/library/.+/tag/[0-9]+/content/?");
108 QRegExp tagInfo("/v2/library/.+/tag/[0-9]+/info/?");
109 QRegExp readingLists("/v2/library/.+/reading_lists/?");
110 QRegExp readingListContent("/v2/library/.+/reading_list/[0-9]+/content/?");
111 QRegExp readingListInfo("/v2/library/.+/reading_list/[0-9]+/info/?");
112 QRegExp search("/v2/library/.+/search/?");
113
114 QRegExp sync("/v2/sync");
115
116 QRegExp librariesUpdate("/v2/libraries/update/?"); // trigger an update of all libraries
117 QRegExp librariesUpdateStatus("/v2/libraries/update/status/?"); // poll whether an update is running
118 QRegExp librariesUpdateCancel("/v2/libraries/update/cancel/?"); // cancel a running update
119 QRegExp libraryUpdate("/v2/library/[0-9]+/update/?"); // trigger an update of a single library
120
121 QRegExp library("/v2/library/([0-9]+)/.+"); // permite verificar que la biblioteca solicitada existe
122
123 path = QUrl::fromPercentEncoding(path).toUtf8();
124
125 if (!sync.exactMatch(path)) // no session is needed for syncback info, until security will be added
126 loadSessionV2(request, response);
127
128 // primera petición, se ha hecho un post, se sirven las bibliotecas si la seguridad mediante login no está habilitada
129 if (path == "/v2/libraries") // Don't send data to the server using '/' !!!!
130 {
131 LibrariesControllerV2().service(request, response);
132 } else {
133 if (serverVersion.exactMatch(path)) {
134 VersionController().service(request, response);
135 } else if (sync.exactMatch(path)) {
136 SyncControllerV2().service(request, response);
137 emit clientSync();
138 } else if (librariesUpdate.exactMatch(path) || librariesUpdateStatus.exactMatch(path) || librariesUpdateCancel.exactMatch(path)) {
139 UpdateLibrariesControllerV2().service(request, response);
140 } else {
141 if (library.indexIn(path) != -1 && DBHelper::getLibraries().contains(library.cap(1).toInt())) {
142 if (folderInfo.exactMatch(path)) {
143 FolderInfoControllerV2().service(request, response);

Callers

nothing calls this directly

Tested by

no test coverage detected