Compare commits
No commits in common. "895128a462f73acf0d488cccf4d3a03b22bc8ce1" and "7d3deee74c95487f86a2d6d14a0de43fb700c183" have entirely different histories.
895128a462
...
7d3deee74c
@ -67,7 +67,7 @@ public struct Manga
|
|||||||
while (this.folderName.EndsWith('.'))
|
while (this.folderName.EndsWith('.'))
|
||||||
this.folderName = this.folderName.Substring(0, this.folderName.Length - 1);
|
this.folderName = this.folderName.Substring(0, this.folderName.Length - 1);
|
||||||
string onlyLowerLetters = string.Concat(this.sortName.ToLower().Where(Char.IsLetter));
|
string onlyLowerLetters = string.Concat(this.sortName.ToLower().Where(Char.IsLetter));
|
||||||
this.internalId = DateTime.Now.Ticks.ToString();
|
this.internalId = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{onlyLowerLetters}{this.year}"));
|
||||||
this.ignoreChaptersBelow = ignoreChaptersBelow ?? 0f;
|
this.ignoreChaptersBelow = ignoreChaptersBelow ?? 0f;
|
||||||
this.latestChapterDownloaded = 0;
|
this.latestChapterDownloaded = 0;
|
||||||
this.latestChapterAvailable = 0;
|
this.latestChapterAvailable = 0;
|
||||||
|
@ -243,7 +243,7 @@ public class MangaDex : MangaConnector
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chapterNum is not "null" && !chapters.Any(chp => chp.volumeNumber.Equals(volume) && chp.chapterNumber.Equals(chapterNum)))
|
if(chapterNum is not "null")
|
||||||
chapters.Add(new Chapter(manga, title, volume, chapterNum, chapterId));
|
chapters.Add(new Chapter(manga, title, volume, chapterNum, chapterId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,11 +63,10 @@ public class Server : GlobalBase
|
|||||||
{
|
{
|
||||||
HttpListenerRequest request = context.Request;
|
HttpListenerRequest request = context.Request;
|
||||||
HttpListenerResponse response = context.Response;
|
HttpListenerResponse response = context.Response;
|
||||||
|
if(request.HttpMethod == "OPTIONS")
|
||||||
|
SendResponse(HttpStatusCode.OK, context.Response);
|
||||||
if(request.Url!.LocalPath.Contains("favicon"))
|
if(request.Url!.LocalPath.Contains("favicon"))
|
||||||
{
|
|
||||||
SendResponse(HttpStatusCode.NoContent, response);
|
SendResponse(HttpStatusCode.NoContent, response);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (request.HttpMethod)
|
switch (request.HttpMethod)
|
||||||
{
|
{
|
||||||
@ -80,9 +79,6 @@ public class Server : GlobalBase
|
|||||||
case "DELETE":
|
case "DELETE":
|
||||||
HandleDelete(request, response);
|
HandleDelete(request, response);
|
||||||
break;
|
break;
|
||||||
case "OPTIONS":
|
|
||||||
SendResponse(HttpStatusCode.OK, context.Response);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
SendResponse(HttpStatusCode.BadRequest, response);
|
SendResponse(HttpStatusCode.BadRequest, response);
|
||||||
break;
|
break;
|
||||||
@ -711,15 +707,14 @@ public class Server : GlobalBase
|
|||||||
private void SendResponse(HttpStatusCode statusCode, HttpListenerResponse response, object? content = null)
|
private void SendResponse(HttpStatusCode statusCode, HttpListenerResponse response, object? content = null)
|
||||||
{
|
{
|
||||||
//Log($"Response: {statusCode} {content}");
|
//Log($"Response: {statusCode} {content}");
|
||||||
|
|
||||||
response.StatusCode = (int)statusCode;
|
response.StatusCode = (int)statusCode;
|
||||||
response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With");
|
response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With");
|
||||||
response.AddHeader("Access-Control-Allow-Methods", "GET, POST, DELETE");
|
response.AddHeader("Access-Control-Allow-Methods", "GET, POST, DELETE");
|
||||||
response.AddHeader("Access-Control-Max-Age", "1728000");
|
response.AddHeader("Access-Control-Max-Age", "1728000");
|
||||||
response.AppendHeader("Access-Control-Allow-Origin", "*");
|
response.AppendHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
if (content is not Stream)
|
if (content is not Stream)
|
||||||
{
|
{
|
||||||
response.ContentType = "application/json";
|
response.ContentType = "application/json";
|
||||||
@ -755,7 +750,7 @@ public class Server : GlobalBase
|
|||||||
stream.Close();
|
stream.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (HttpListenerException e)
|
||||||
{
|
{
|
||||||
Log(e.ToString());
|
Log(e.ToString());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user