Compare commits
No commits in common. "5efa00e0598646e3ee60e25666107af2f49eaf4d" and "79928075b00e18ef5ab120f5891ce4a099709e67" have entirely different histories.
5efa00e059
...
79928075b0
@ -3,11 +3,13 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build-env
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build-env
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . /src/
|
COPY . /src/
|
||||||
|
RUN ls /src
|
||||||
RUN dotnet restore Tranga-API/Tranga-API.csproj
|
RUN dotnet restore Tranga-API/Tranga-API.csproj
|
||||||
RUN dotnet publish -c Release -o /publish
|
RUN dotnet publish -c Release -o /publish
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime
|
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime
|
||||||
WORKDIR /publish
|
WORKDIR /publish
|
||||||
COPY --from=build-env /publish .
|
COPY --from=build-env /publish .
|
||||||
|
RUN ls /publish
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
ENTRYPOINT ["dotnet", "/publish/Tranga-API.dll"]
|
ENTRYPOINT ["dotnet", "/publish/Tranga-API.dll"]
|
||||||
|
@ -14,8 +14,8 @@ public class MangaDex : Connector
|
|||||||
Manga,
|
Manga,
|
||||||
Feed,
|
Feed,
|
||||||
AtHomeServer,
|
AtHomeServer,
|
||||||
CoverUrl,
|
Cover,
|
||||||
Author,
|
Author
|
||||||
}
|
}
|
||||||
|
|
||||||
public MangaDex(string downloadLocation, Logger? logger) : base(downloadLocation, logger)
|
public MangaDex(string downloadLocation, Logger? logger) : base(downloadLocation, logger)
|
||||||
@ -26,7 +26,7 @@ public class MangaDex : Connector
|
|||||||
{(byte)RequestType.Manga, 250},
|
{(byte)RequestType.Manga, 250},
|
||||||
{(byte)RequestType.Feed, 250},
|
{(byte)RequestType.Feed, 250},
|
||||||
{(byte)RequestType.AtHomeServer, 40},
|
{(byte)RequestType.AtHomeServer, 40},
|
||||||
{(byte)RequestType.CoverUrl, 250},
|
{(byte)RequestType.Cover, 250},
|
||||||
{(byte)RequestType.Author, 250}
|
{(byte)RequestType.Author, 250}
|
||||||
}, logger);
|
}, logger);
|
||||||
}
|
}
|
||||||
@ -98,15 +98,6 @@ public class MangaDex : Connector
|
|||||||
authorId = relationships.FirstOrDefault(relationship => relationship!["type"]!.GetValue<string>() == "author")!["id"]!.GetValue<string>();
|
authorId = relationships.FirstOrDefault(relationship => relationship!["type"]!.GetValue<string>() == "author")!["id"]!.GetValue<string>();
|
||||||
}
|
}
|
||||||
string? coverUrl = GetCoverUrl(publicationId, posterId);
|
string? coverUrl = GetCoverUrl(publicationId, posterId);
|
||||||
string? coverBase64 = null;
|
|
||||||
if (coverUrl is not null)
|
|
||||||
{
|
|
||||||
DownloadClient.RequestResult coverResult = downloadClient.MakeRequest(coverUrl, (byte)RequestType.AtHomeServer);
|
|
||||||
using MemoryStream ms = new();
|
|
||||||
coverResult.result.CopyTo(ms);
|
|
||||||
byte[] imageBytes = ms.ToArray();
|
|
||||||
coverBase64 = Convert.ToBase64String(imageBytes);
|
|
||||||
}
|
|
||||||
string? author = GetAuthor(authorId);
|
string? author = GetAuthor(authorId);
|
||||||
|
|
||||||
Dictionary<string, string> linksDict = new();
|
Dictionary<string, string> linksDict = new();
|
||||||
@ -136,7 +127,6 @@ public class MangaDex : Connector
|
|||||||
altTitlesDict,
|
altTitlesDict,
|
||||||
tags.ToArray(),
|
tags.ToArray(),
|
||||||
coverUrl,
|
coverUrl,
|
||||||
coverBase64,
|
|
||||||
linksDict,
|
linksDict,
|
||||||
year,
|
year,
|
||||||
originalLanguage,
|
originalLanguage,
|
||||||
@ -242,7 +232,7 @@ public class MangaDex : Connector
|
|||||||
|
|
||||||
//Request information where to download Cover
|
//Request information where to download Cover
|
||||||
DownloadClient.RequestResult requestResult =
|
DownloadClient.RequestResult requestResult =
|
||||||
downloadClient.MakeRequest($"https://api.mangadex.org/cover/{posterId}", (byte)RequestType.CoverUrl);
|
downloadClient.MakeRequest($"https://api.mangadex.org/cover/{posterId}", (byte)RequestType.Cover);
|
||||||
if (requestResult.statusCode != HttpStatusCode.OK)
|
if (requestResult.statusCode != HttpStatusCode.OK)
|
||||||
return null;
|
return null;
|
||||||
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
|
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(requestResult.result);
|
||||||
|
@ -15,7 +15,6 @@ public readonly struct Publication
|
|||||||
public string? description { get; }
|
public string? description { get; }
|
||||||
public string[] tags { get; }
|
public string[] tags { get; }
|
||||||
public string? posterUrl { get; }
|
public string? posterUrl { get; }
|
||||||
public string? posterBase64 { get; }
|
|
||||||
public Dictionary<string,string> links { get; }
|
public Dictionary<string,string> links { get; }
|
||||||
public int? year { get; }
|
public int? year { get; }
|
||||||
public string? originalLanguage { get; }
|
public string? originalLanguage { get; }
|
||||||
@ -24,14 +23,13 @@ public readonly struct Publication
|
|||||||
public string publicationId { get; }
|
public string publicationId { get; }
|
||||||
public string internalId { get; }
|
public string internalId { get; }
|
||||||
|
|
||||||
public Publication(string sortName, string? author, string? description, Dictionary<string,string> altTitles, string[] tags, string? posterUrl, string? posterBase64, Dictionary<string,string>? links, int? year, string? originalLanguage, string status, string publicationId)
|
public Publication(string sortName, string? author, string? description, Dictionary<string,string> altTitles, string[] tags, string? posterUrl, Dictionary<string,string>? links, int? year, string? originalLanguage, string status, string publicationId)
|
||||||
{
|
{
|
||||||
this.sortName = sortName;
|
this.sortName = sortName;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.altTitles = altTitles;
|
this.altTitles = altTitles;
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
this.posterBase64 = posterBase64;
|
|
||||||
this.posterUrl = posterUrl;
|
this.posterUrl = posterUrl;
|
||||||
this.links = links ?? new Dictionary<string, string>();
|
this.links = links ?? new Dictionary<string, string>();
|
||||||
this.year = year;
|
this.year = year;
|
||||||
|
Loading…
Reference in New Issue
Block a user