diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 484d5036..b4a233cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,12 +31,12 @@ jobs: workflow: build.yml path: ./artifacts github_token: ${{secrets.GITHUB_TOKEN}} - - name: Public the common to nuget + - name: Public the abstractions to nuget id: publish_nuget uses: rohith/publish-nuget@v2 with: - PROJECT_FILE_PATH: Kyoo.Common/Kyoo.Common.csproj - PACKAGE_NAME: Kyoo.Common + PROJECT_FILE_PATH: Kyoo.Abstractions/Kyoo.Abstractions.csproj + PACKAGE_NAME: Kyoo.Abstractions VERSION_REGEX: ^\s*(.*)<\/PackageVersion>\s*$ NUGET_KEY: ${{secrets.NUGET_API_KEY}} INCLUDE_SYMBOLS: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7c86b7b0..63b6d701 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: - name: Build run: | dotnet build --no-restore '-p:SkipWebApp=true;SkipTranscoder=true' -p:CopyLocalLockFileAssemblies=true - cp ./Kyoo.Common/bin/Debug/net5.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll ./tests/Kyoo.Tests/bin/Debug/net5.0/ + cp ./Kyoo.Abstractions/bin/Debug/net5.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll ./tests/Kyoo.Tests/bin/Debug/net5.0/ - name: Test run: dotnet test --no-build '-p:CollectCoverage=true;CoverletOutputFormat=opencover' env: diff --git a/Dockerfile b/Dockerfile index 8764c7df..9158d2a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ RUN cmake . && make -j FROM node:alpine as webapp WORKDIR /webapp COPY Kyoo.WebApp . +WORKDIR /webapp/Front RUN npm install RUN npm run build -- --prod @@ -19,6 +20,6 @@ RUN apt-get update && apt-get install -y libavutil-dev libavcodec-dev libavforma EXPOSE 5000 COPY --from=builder /opt/kyoo /usr/lib/kyoo COPY --from=transcoder /transcoder/libtranscoder.so /usr/lib/kyoo -COPY --from=webapp /webapp/dist/* /usr/lib/kyoo/wwwroot/ +COPY --from=webapp /webapp/Front/dist/* /usr/lib/kyoo/wwwroot/ CMD ["/usr/lib/kyoo/Kyoo", "/var/lib/kyoo"] diff --git a/Kyoo.Abstractions/Models/Page.cs b/Kyoo.Abstractions/Models/Page.cs index d5f7171b..eb8898d2 100644 --- a/Kyoo.Abstractions/Models/Page.cs +++ b/Kyoo.Abstractions/Models/Page.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; @@ -12,17 +13,17 @@ namespace Kyoo.Abstractions.Models /// /// The link of the current page. /// - public string This { get; } + public Uri This { get; } /// /// The link of the first page. /// - public string First { get; } + public Uri First { get; } /// /// The link of the next page. /// - public string Next { get; } + public Uri Next { get; } /// /// The number of items in the current page. @@ -42,7 +43,7 @@ namespace Kyoo.Abstractions.Models /// The link of the current page. /// The link of the next page. /// The link of the first page. - public Page(ICollection items, string @this, string next, string first) + public Page(ICollection items, Uri @this, Uri next, Uri first) { Items = items; This = @this; @@ -58,21 +59,21 @@ namespace Kyoo.Abstractions.Models /// The list of query strings of the current page /// The number of items requested for the current page. public Page(ICollection items, - string url, + Uri url, Dictionary query, int limit) { Items = items; - This = url + query.ToQueryString(); + This = new Uri(url + query.ToQueryString()); if (items.Count == limit && limit > 0) { query["afterID"] = items.Last().ID.ToString(); - Next = url + query.ToQueryString(); + Next = new Uri(url + query.ToQueryString()); } query.Remove("afterID"); - First = url + query.ToQueryString(); + First = new Uri(url + query.ToQueryString()); } } } \ No newline at end of file diff --git a/Kyoo/Models/Options/BasicOptions.cs b/Kyoo/Models/Options/BasicOptions.cs index 926010cb..ca018fd4 100644 --- a/Kyoo/Models/Options/BasicOptions.cs +++ b/Kyoo/Models/Options/BasicOptions.cs @@ -1,4 +1,5 @@ using Kyoo.Abstractions.Models; +using System; namespace Kyoo.Models.Options { @@ -13,14 +14,14 @@ namespace Kyoo.Models.Options public const string Path = "Basics"; /// - /// The internal url where the server will listen + /// The internal url where the server will listen. It supports globing. /// public string Url { get; set; } = "http://*:5000"; /// /// The public url that will be used in items response and in authentication server host. /// - public string PublicUrl { get; set; } = "http://localhost:5000/"; + public Uri PublicUrl { get; set; } = new("http://localhost:5000"); /// /// The path of the plugin directory. diff --git a/Kyoo/Views/Helper/CrudApi.cs b/Kyoo/Views/Helper/CrudApi.cs index 36ccf94e..d73e45ea 100644 --- a/Kyoo/Views/Helper/CrudApi.cs +++ b/Kyoo/Views/Helper/CrudApi.cs @@ -15,9 +15,9 @@ namespace Kyoo.Api public class CrudApi : ControllerBase where T : class, IResource { private readonly IRepository _repository; - protected readonly string BaseURL; + protected readonly Uri BaseURL; - public CrudApi(IRepository repository, string baseURL) + public CrudApi(IRepository repository, Uri baseURL) { _repository = repository; BaseURL = baseURL; @@ -82,8 +82,8 @@ namespace Kyoo.Api protected Page Page(ICollection resources, int limit) where TResult : IResource { - return new(resources, - BaseURL + Request.Path, + return new Page(resources, + new Uri(BaseURL, Request.Path), Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.InvariantCultureIgnoreCase), limit); } diff --git a/Kyoo/Views/LibraryItemApi.cs b/Kyoo/Views/LibraryItemApi.cs index 4210be03..3e114fe7 100644 --- a/Kyoo/Views/LibraryItemApi.cs +++ b/Kyoo/Views/LibraryItemApi.cs @@ -19,7 +19,7 @@ namespace Kyoo.Api public class LibraryItemApi : ControllerBase { private readonly ILibraryItemRepository _libraryItems; - private readonly string _baseURL; + private readonly Uri _baseURL; public LibraryItemApi(ILibraryItemRepository libraryItems, IOptions options) @@ -43,7 +43,7 @@ namespace Kyoo.Api new Pagination(limit, afterID)); return new Page(resources, - _baseURL + Request.Path, + new Uri(_baseURL + Request.Path), Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.InvariantCultureIgnoreCase), limit); }