mirror of
https://github.com/C9Glax/tranga.git
synced 2025-07-07 11:21:35 +02:00
@ -1,6 +1,7 @@
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using Tranga.Jobs;
|
||||
using Tranga.MangaConnectors;
|
||||
|
||||
namespace Tranga.Server;
|
||||
|
||||
@ -26,6 +27,27 @@ public partial class Server
|
||||
|
||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, ret);
|
||||
}
|
||||
|
||||
private ValueTuple<HttpStatusCode, object?> GetV2MangaSearch(GroupCollection groups, Dictionary<string, string> requestParameters)
|
||||
{
|
||||
if(!requestParameters.TryGetValue("title", out string? title))
|
||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.BadRequest, "Missing parameter 'title'.");
|
||||
List<Manga> ret = new();
|
||||
List<Thread> threads = new();
|
||||
foreach (MangaConnector mangaConnector in _connectors)
|
||||
{
|
||||
Thread t = new (() =>
|
||||
{
|
||||
ret.AddRange(mangaConnector.GetManga(title));
|
||||
});
|
||||
t.Start();
|
||||
threads.Add(t);
|
||||
}
|
||||
while(threads.Any(t => t.ThreadState is ThreadState.Running or ThreadState.WaitSleepJoin))
|
||||
Thread.Sleep(10);
|
||||
|
||||
return new ValueTuple<HttpStatusCode, object?>(HttpStatusCode.OK, ret);
|
||||
}
|
||||
|
||||
private ValueTuple<HttpStatusCode, object?> GetV2MangaInternalId(GroupCollection groups, Dictionary<string, string> requestParameters)
|
||||
{
|
||||
|
Reference in New Issue
Block a user