From f6557e6bbc12a9460bf4fe0bc5f1d18ff2b90459 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 12 Jun 2022 19:13:16 +0200 Subject: [PATCH 1/2] Remove public url --- README.md | 1 - docker-compose.yml | 1 - docs/start/setting_up.md | 7 +++---- src/Kyoo.Abstractions/Module.cs | 10 --------- .../AuthenticationModule.cs | 8 ++----- .../Controllers/TokenController.cs | 21 +++---------------- src/Kyoo.Core/Models/Options/BasicOptions.cs | 7 ------- src/Kyoo.Core/Views/Helper/BaseApi.cs | 5 +---- .../Serializers/JsonSerializerContract.cs | 13 +++--------- src/Kyoo.Host.Generic/settings.json | 1 - src/Kyoo.Host.WindowsTrait/SystemTrait.cs | 6 +++--- src/Kyoo.Swagger/SwaggerModule.cs | 5 ----- 12 files changed, 15 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 983e9f05..19e1072e 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,6 @@ services: restart: on-failure environment: - KYOO_DATADIR=/var/lib/kyoo - - BASICS__PUBLICURL=https://demo.kyoo.moe - DATABASE__ENABLED=postgres - DATABASE__CONFIGURATIONS__POSTGRES__SERVER=postgres - DATABASE__CONFIGURATIONS__POSTGRES__USER ID=kyoo diff --git a/docker-compose.yml b/docker-compose.yml index 08b3ba99..8e736ffd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,6 @@ services: restart: on-failure environment: - KYOO_DATADIR=/var/lib/kyoo - - BASICS__PUBLICURL=http://localhost:5000 - DATABASE__ENABLED=postgres - DATABASE__CONFIGURATIONS__POSTGRES__SERVER=postgres - DATABASE__CONFIGURATIONS__POSTGRES__USER=kyoo diff --git a/docs/start/setting_up.md b/docs/start/setting_up.md index 656bd460..ac2c484c 100644 --- a/docs/start/setting_up.md +++ b/docs/start/setting_up.md @@ -22,7 +22,6 @@ We are going to take a look at the fields you might want to change to tailor Kyo - ```basics``` - ```url```: The port on which Kyoo will be exposed - - ```publicUrl```: The full URL for Kyoo. For the 3 following fields, the path are relative to the directory ```settings.json``` is in - ```pluginsPath```: The directory where the plugins are stored - ```transmuxPath```: The directory where the transmux-ed video are stored (used as a cache) @@ -34,7 +33,7 @@ We are going to take a look at the fields you might want to change to tailor Kyo - ```tasks``` - ```parallels```: The number of tasks that can be run at the same time. If the values is not ```1```, the behavior is not implemented. - ```scheduled```: An object with keys being the name of an automation task, with a value being the interval between each task of the same type. - - The available keys can be found at ```publicUrl/api/tasks``` (as 'slug') + - The available keys can be found at ```/api/tasks``` (as 'slug') - The values must be formatted like ```HH:MM:SS`` **For Example** in the default configuration, a file scan task will be executed every 24 hours @@ -81,7 +80,7 @@ If everything looks normal, no error message will appear, just log messages. Then, we are going to interact with Kyoo's API. To create a library, you must do the following request for each library you want to make: - POST Request -- At ```publicUrl/api/libraries``` (```publicUrl``` is in ```settings.json```) +- At ```/api/libraries``` - Content-Type: ```application/json``` - Body: @@ -97,6 +96,6 @@ Then, we are going to interact with Kyoo's API. To create a library, you must do } ``` -Now that you created your libraries, you can do a simple GET request to ```publicUrl/api/task/scan``` to scan for videos in all the libraries. +Now that you created your libraries, you can do a simple GET request to ```/api/task/scan``` to scan for videos in all the libraries. Once the scan is over, ```Task finished: Scan Libraries``` will be displayed! You are now ready to use Kyoo! diff --git a/src/Kyoo.Abstractions/Module.cs b/src/Kyoo.Abstractions/Module.cs index 2bace5b2..932777fd 100644 --- a/src/Kyoo.Abstractions/Module.cs +++ b/src/Kyoo.Abstractions/Module.cs @@ -91,15 +91,5 @@ namespace Kyoo.Abstractions { return builder.RegisterRepository().As(); } - - /// - /// Get the public URL of kyoo using the given configuration instance. - /// - /// The configuration instance - /// The public URl of kyoo (without a slash at the end) - public static Uri GetPublicUrl(this IConfiguration configuration) - { - return new Uri(configuration["basics:publicUrl"] ?? "http://localhost:5000"); - } } } diff --git a/src/Kyoo.Authentication/AuthenticationModule.cs b/src/Kyoo.Authentication/AuthenticationModule.cs index 726e22fe..c33408ab 100644 --- a/src/Kyoo.Authentication/AuthenticationModule.cs +++ b/src/Kyoo.Authentication/AuthenticationModule.cs @@ -20,7 +20,6 @@ using System; using System.Collections.Generic; using System.Text; using Autofac; -using Kyoo.Abstractions; using Kyoo.Abstractions.Controllers; using Kyoo.Authentication.Models; using Microsoft.AspNetCore.Authentication.JwtBearer; @@ -76,7 +75,6 @@ namespace Kyoo.Authentication /// public void Configure(IServiceCollection services) { - Uri publicUrl = _configuration.GetPublicUrl(); AuthenticationOption jwt = ConfigurationBinder.Get( _configuration.GetSection(AuthenticationOption.Path) ); @@ -87,12 +85,10 @@ namespace Kyoo.Authentication { options.TokenValidationParameters = new TokenValidationParameters { - ValidateIssuer = true, - ValidateAudience = true, + ValidateIssuer = false, + ValidateAudience = false, ValidateLifetime = true, ValidateIssuerSigningKey = true, - ValidIssuer = publicUrl.ToString(), - ValidAudience = publicUrl.ToString(), IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwt.Secret)) }; }); diff --git a/src/Kyoo.Authentication/Controllers/TokenController.cs b/src/Kyoo.Authentication/Controllers/TokenController.cs index 1a127e97..efc48784 100644 --- a/src/Kyoo.Authentication/Controllers/TokenController.cs +++ b/src/Kyoo.Authentication/Controllers/TokenController.cs @@ -24,10 +24,8 @@ using System.Linq; using System.Security.Claims; using System.Text; using System.Threading.Tasks; -using Kyoo.Abstractions; using Kyoo.Abstractions.Models; using Kyoo.Authentication.Models; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; @@ -43,20 +41,13 @@ namespace Kyoo.Authentication /// private readonly IOptions _options; - /// - /// The configuration used to retrieve the public URL of kyoo. - /// - private readonly IConfiguration _configuration; - /// /// Create a new . /// /// The options that this controller will use. - /// The configuration used to retrieve the public URL of kyoo. - public TokenController(IOptions options, IConfiguration configuration) + public TokenController(IOptions options) { _options = options; - _configuration = configuration; } /// @@ -80,8 +71,6 @@ namespace Kyoo.Authentication claims.Add(new Claim(Claims.Email, user.Email)); JwtSecurityToken token = new( signingCredentials: credential, - issuer: _configuration.GetPublicUrl().ToString(), - audience: _configuration.GetPublicUrl().ToString(), claims: claims, expires: DateTime.UtcNow.Add(expireIn) ); @@ -95,8 +84,6 @@ namespace Kyoo.Authentication SigningCredentials credential = new(key, SecurityAlgorithms.HmacSha256Signature); JwtSecurityToken token = new( signingCredentials: credential, - issuer: _configuration.GetPublicUrl().ToString(), - audience: _configuration.GetPublicUrl().ToString(), claims: new[] { new Claim(Claims.Id, user.ID.ToString(CultureInfo.InvariantCulture)), @@ -119,12 +106,10 @@ namespace Kyoo.Authentication { principal = tokenHandler.ValidateToken(refreshToken, new TokenValidationParameters { - ValidateIssuer = true, - ValidateAudience = true, + ValidateIssuer = false, + ValidateAudience = false, ValidateIssuerSigningKey = true, ValidateLifetime = true, - ValidIssuer = _configuration.GetPublicUrl().ToString(), - ValidAudience = _configuration.GetPublicUrl().ToString(), IssuerSigningKey = key }, out SecurityToken _); } diff --git a/src/Kyoo.Core/Models/Options/BasicOptions.cs b/src/Kyoo.Core/Models/Options/BasicOptions.cs index 18633b4a..6e61e311 100644 --- a/src/Kyoo.Core/Models/Options/BasicOptions.cs +++ b/src/Kyoo.Core/Models/Options/BasicOptions.cs @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with Kyoo. If not, see . -using System; - namespace Kyoo.Core.Models.Options { /// @@ -35,11 +33,6 @@ namespace Kyoo.Core.Models.Options /// public string Url { get; set; } = "http://*:5000"; - /// - /// The public url that will be used in items response and in authentication server host. - /// - public Uri PublicUrl { get; set; } = new("http://localhost:5000"); - /// /// The path of the plugin directory. /// diff --git a/src/Kyoo.Core/Views/Helper/BaseApi.cs b/src/Kyoo.Core/Views/Helper/BaseApi.cs index 0629faa5..6fd97920 100644 --- a/src/Kyoo.Core/Views/Helper/BaseApi.cs +++ b/src/Kyoo.Core/Views/Helper/BaseApi.cs @@ -45,12 +45,9 @@ namespace Kyoo.Core.Api protected Page Page(ICollection resources, int limit) where TResult : IResource { - Uri publicUrl = HttpContext.RequestServices - .GetRequiredService() - .GetPublicUrl(); return new Page( resources, - new Uri(publicUrl, Request.Path), + new Uri(Request.Path), Request.Query.ToDictionary( x => x.Key, x => x.Value.ToString(), diff --git a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs index 6ed67ac8..b607cbf7 100644 --- a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs +++ b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs @@ -107,7 +107,7 @@ namespace Kyoo.Core.Api IThumbnails thumb = (IThumbnails)x; return thumb?.Images?.ContainsKey(id) == true; }, - ValueProvider = new ThumbnailProvider(_options.Value.PublicUrl, id) + ValueProvider = new ThumbnailProvider(id) }); } @@ -120,11 +120,6 @@ namespace Kyoo.Core.Api /// private class ThumbnailProvider : IValueProvider { - /// - /// The public address of kyoo. - /// - private readonly Uri _host; - /// /// The index/ID of the image to retrieve/set. /// @@ -133,11 +128,9 @@ namespace Kyoo.Core.Api /// /// Create a new . /// - /// The public address of kyoo. /// The index/ID of the image to retrieve/set. - public ThumbnailProvider(Uri host, int imageIndex) + public ThumbnailProvider(int imageIndex) { - _host = host; _imageIndex = imageIndex; } @@ -160,7 +153,7 @@ namespace Kyoo.Core.Api string type = target is ICustomTypeDescriptor descriptor ? descriptor.GetClassName() : target.GetType().Name; - return new Uri(_host, $"/api/{type}/{slug}/{Images.ImageName[_imageIndex]}".ToLower()) + return new Uri($"/api/{type}/{slug}/{Images.ImageName[_imageIndex]}".ToLowerInvariant()) .ToString(); } } diff --git a/src/Kyoo.Host.Generic/settings.json b/src/Kyoo.Host.Generic/settings.json index bd3f637c..83f40858 100644 --- a/src/Kyoo.Host.Generic/settings.json +++ b/src/Kyoo.Host.Generic/settings.json @@ -1,7 +1,6 @@ { "basics": { "url": "http://*:5000", - "publicUrl": "http://localhost:5000/", "pluginsPath": "plugins/", "transmuxPath": "cached/transmux", "transcodePath": "cached/transcode", diff --git a/src/Kyoo.Host.WindowsTrait/SystemTrait.cs b/src/Kyoo.Host.WindowsTrait/SystemTrait.cs index 14ea12d4..8c8ca8fe 100644 --- a/src/Kyoo.Host.WindowsTrait/SystemTrait.cs +++ b/src/Kyoo.Host.WindowsTrait/SystemTrait.cs @@ -40,7 +40,7 @@ namespace Kyoo.Host.WindowsTrait private readonly IApplication _application; /// - /// The options containing the . + /// The options containing the . /// private readonly IOptions _options; @@ -90,7 +90,7 @@ namespace Kyoo.Host.WindowsTrait private readonly IApplication _application; /// - /// The options containing the . + /// The options containing the . /// private readonly IOptions _options; @@ -161,7 +161,7 @@ namespace Kyoo.Host.WindowsTrait { Process browser = new() { - StartInfo = new ProcessStartInfo(_options.Value.PublicUrl.ToString()) + StartInfo = new ProcessStartInfo(_options.Value.Url.ToString().Replace("//*:", "//localhost:")) { UseShellExecute = true } diff --git a/src/Kyoo.Swagger/SwaggerModule.cs b/src/Kyoo.Swagger/SwaggerModule.cs index 5025fa7c..41f51920 100644 --- a/src/Kyoo.Swagger/SwaggerModule.cs +++ b/src/Kyoo.Swagger/SwaggerModule.cs @@ -91,11 +91,6 @@ namespace Kyoo.Swagger Name = "GPL-3.0-or-later", Url = "https://github.com/AnonymusRaccoon/Kyoo/blob/master/LICENSE" }; - options.Servers.Add(new OpenApiServer - { - Url = _configuration.GetPublicUrl().ToString(), - Description = "The currently running kyoo's instance." - }); options.Info.ExtensionData ??= new Dictionary(); options.Info.ExtensionData["x-logo"] = new From 25ceac2ef4ed7c35621234e2da91027f20a48fc7 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 12 Jun 2022 17:33:38 +0200 Subject: [PATCH 2/2] Remove the /api prefix --- src/Kyoo.Authentication/Views/AuthApi.cs | 2 +- src/Kyoo.Core/Views/Admin/ConfigurationApi.cs | 4 ++-- src/Kyoo.Core/Views/Admin/TaskApi.cs | 4 ++-- src/Kyoo.Core/Views/Helper/BaseApi.cs | 3 --- .../Views/Helper/Serializers/JsonOptions.cs | 13 ++----------- .../Helper/Serializers/JsonSerializerContract.cs | 13 ++----------- src/Kyoo.Core/Views/Metadata/GenreApi.cs | 4 ++-- src/Kyoo.Core/Views/Metadata/ProviderApi.cs | 4 ++-- src/Kyoo.Core/Views/Metadata/StaffApi.cs | 4 ++-- src/Kyoo.Core/Views/Metadata/StudioApi.cs | 4 ++-- src/Kyoo.Core/Views/Resources/CollectionApi.cs | 4 ++-- src/Kyoo.Core/Views/Resources/EpisodeApi.cs | 4 ++-- src/Kyoo.Core/Views/Resources/LibraryApi.cs | 4 ++-- src/Kyoo.Core/Views/Resources/LibraryItemApi.cs | 4 ++-- src/Kyoo.Core/Views/Resources/SearchApi.cs | 2 +- src/Kyoo.Core/Views/Resources/SeasonApi.cs | 4 ++-- src/Kyoo.Core/Views/Resources/ShowApi.cs | 8 ++++---- src/Kyoo.Core/Views/Watch/TrackApi.cs | 4 ++-- src/Kyoo.Core/Views/Watch/WatchApi.cs | 4 ++-- tests/robot/rest.resource | 2 +- 20 files changed, 37 insertions(+), 58 deletions(-) diff --git a/src/Kyoo.Authentication/Views/AuthApi.cs b/src/Kyoo.Authentication/Views/AuthApi.cs index b2f88e92..bab8e0bb 100644 --- a/src/Kyoo.Authentication/Views/AuthApi.cs +++ b/src/Kyoo.Authentication/Views/AuthApi.cs @@ -40,7 +40,7 @@ namespace Kyoo.Authentication.Views /// Sign in, Sign up or refresh tokens. /// [ApiController] - [Route("api/auth")] + [Route("auth")] [ApiDefinition("Authentication", Group = UsersGroup)] public class AuthApi : ControllerBase { diff --git a/src/Kyoo.Core/Views/Admin/ConfigurationApi.cs b/src/Kyoo.Core/Views/Admin/ConfigurationApi.cs index a7a42bab..b21a59cb 100644 --- a/src/Kyoo.Core/Views/Admin/ConfigurationApi.cs +++ b/src/Kyoo.Core/Views/Admin/ConfigurationApi.cs @@ -31,8 +31,8 @@ namespace Kyoo.Core.Api /// /// An API to retrieve or edit configuration settings /// - [Route("api/configuration")] - [Route("api/config", Order = AlternativeRoute)] + [Route("configuration")] + [Route("config", Order = AlternativeRoute)] [ApiController] [PartialPermission("Configuration", Group = Group.Admin)] [ApiDefinition("Configuration", Group = AdminGroup)] diff --git a/src/Kyoo.Core/Views/Admin/TaskApi.cs b/src/Kyoo.Core/Views/Admin/TaskApi.cs index dc338c24..96d42b01 100644 --- a/src/Kyoo.Core/Views/Admin/TaskApi.cs +++ b/src/Kyoo.Core/Views/Admin/TaskApi.cs @@ -32,8 +32,8 @@ namespace Kyoo.Core.Api /// /// An endpoint to list and run tasks in the background. /// - [Route("api/tasks")] - [Route("api/task", Order = AlternativeRoute)] + [Route("tasks")] + [Route("task", Order = AlternativeRoute)] [ApiController] [ResourceView] [PartialPermission("Task", Group = Group.Admin)] diff --git a/src/Kyoo.Core/Views/Helper/BaseApi.cs b/src/Kyoo.Core/Views/Helper/BaseApi.cs index 6fd97920..4a55cfd9 100644 --- a/src/Kyoo.Core/Views/Helper/BaseApi.cs +++ b/src/Kyoo.Core/Views/Helper/BaseApi.cs @@ -19,11 +19,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Kyoo.Abstractions; using Kyoo.Abstractions.Models; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; namespace Kyoo.Core.Api { diff --git a/src/Kyoo.Core/Views/Helper/Serializers/JsonOptions.cs b/src/Kyoo.Core/Views/Helper/Serializers/JsonOptions.cs index 0372b568..796f9f70 100644 --- a/src/Kyoo.Core/Views/Helper/Serializers/JsonOptions.cs +++ b/src/Kyoo.Core/Views/Helper/Serializers/JsonOptions.cs @@ -34,30 +34,21 @@ namespace Kyoo.Core.Api /// private readonly IHttpContextAccessor _httpContextAccessor; - /// - /// The options containing the public URL of kyoo, given to . - /// - private readonly IOptions _options; - /// /// Create a new . /// /// /// The http context accessor given to the . /// - /// - /// The options containing the public URL of kyoo, given to . - /// - public JsonOptions(IHttpContextAccessor httpContextAccessor, IOptions options) + public JsonOptions(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; - _options = options; } /// public void Configure(MvcNewtonsoftJsonOptions options) { - options.SerializerSettings.ContractResolver = new JsonSerializerContract(_httpContextAccessor, _options); + options.SerializerSettings.ContractResolver = new JsonSerializerContract(_httpContextAccessor); options.SerializerSettings.Converters.Add(new PeopleRoleConverter()); } } diff --git a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs index b607cbf7..a309478f 100644 --- a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs +++ b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs @@ -22,9 +22,7 @@ using System.ComponentModel; using System.Reflection; using Kyoo.Abstractions.Models; using Kyoo.Abstractions.Models.Attributes; -using Kyoo.Core.Models.Options; using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; @@ -43,20 +41,13 @@ namespace Kyoo.Core.Api /// private readonly IHttpContextAccessor _httpContextAccessor; - /// - /// The options containing the public URL of kyoo. - /// - private readonly IOptions _options; - /// /// Create a new . /// /// The http context accessor to use. - /// The options containing the public URL of kyoo. - public JsonSerializerContract(IHttpContextAccessor httpContextAccessor, IOptions options) + public JsonSerializerContract(IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; - _options = options; } /// @@ -153,7 +144,7 @@ namespace Kyoo.Core.Api string type = target is ICustomTypeDescriptor descriptor ? descriptor.GetClassName() : target.GetType().Name; - return new Uri($"/api/{type}/{slug}/{Images.ImageName[_imageIndex]}".ToLowerInvariant()) + return new Uri($"/{type}/{slug}/{Images.ImageName[_imageIndex]}".ToLowerInvariant()) .ToString(); } } diff --git a/src/Kyoo.Core/Views/Metadata/GenreApi.cs b/src/Kyoo.Core/Views/Metadata/GenreApi.cs index 5d3cbf7f..6d788cd8 100644 --- a/src/Kyoo.Core/Views/Metadata/GenreApi.cs +++ b/src/Kyoo.Core/Views/Metadata/GenreApi.cs @@ -34,8 +34,8 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple . /// - [Route("api/genres")] - [Route("api/genre", Order = AlternativeRoute)] + [Route("genres")] + [Route("genre", Order = AlternativeRoute)] [ApiController] [PartialPermission(nameof(Genre))] [ApiDefinition("Genres", Group = MetadataGroup)] diff --git a/src/Kyoo.Core/Views/Metadata/ProviderApi.cs b/src/Kyoo.Core/Views/Metadata/ProviderApi.cs index 6f9894d5..97369ddf 100644 --- a/src/Kyoo.Core/Views/Metadata/ProviderApi.cs +++ b/src/Kyoo.Core/Views/Metadata/ProviderApi.cs @@ -30,8 +30,8 @@ namespace Kyoo.Core.Api /// Providers are links to external websites or database. /// They are mostly linked to plugins that provide metadata from those websites. /// - [Route("api/providers")] - [Route("api/provider", Order = AlternativeRoute)] + [Route("providers")] + [Route("provider", Order = AlternativeRoute)] [ApiController] [ResourceView] [PartialPermission(nameof(Provider))] diff --git a/src/Kyoo.Core/Views/Metadata/StaffApi.cs b/src/Kyoo.Core/Views/Metadata/StaffApi.cs index aea11a4e..61187855 100644 --- a/src/Kyoo.Core/Views/Metadata/StaffApi.cs +++ b/src/Kyoo.Core/Views/Metadata/StaffApi.cs @@ -35,8 +35,8 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple staff member. /// - [Route("api/staff")] - [Route("api/people", Order = AlternativeRoute)] + [Route("staff")] + [Route("people", Order = AlternativeRoute)] [ApiController] [ResourceView] [PartialPermission(nameof(People))] diff --git a/src/Kyoo.Core/Views/Metadata/StudioApi.cs b/src/Kyoo.Core/Views/Metadata/StudioApi.cs index d5274f18..9d743853 100644 --- a/src/Kyoo.Core/Views/Metadata/StudioApi.cs +++ b/src/Kyoo.Core/Views/Metadata/StudioApi.cs @@ -34,8 +34,8 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple . /// - [Route("api/studios")] - [Route("api/studio", Order = AlternativeRoute)] + [Route("studios")] + [Route("studio", Order = AlternativeRoute)] [ApiController] [PartialPermission(nameof(Show))] [ApiDefinition("Studios", Group = MetadataGroup)] diff --git a/src/Kyoo.Core/Views/Resources/CollectionApi.cs b/src/Kyoo.Core/Views/Resources/CollectionApi.cs index 3cee88b6..a3c85aa6 100644 --- a/src/Kyoo.Core/Views/Resources/CollectionApi.cs +++ b/src/Kyoo.Core/Views/Resources/CollectionApi.cs @@ -34,8 +34,8 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple . /// - [Route("api/collections")] - [Route("api/collection", Order = AlternativeRoute)] + [Route("collections")] + [Route("collection", Order = AlternativeRoute)] [ApiController] [PartialPermission(nameof(Collection))] [ApiDefinition("Collections", Group = ResourcesGroup)] diff --git a/src/Kyoo.Core/Views/Resources/EpisodeApi.cs b/src/Kyoo.Core/Views/Resources/EpisodeApi.cs index cd568e91..5c26ba99 100644 --- a/src/Kyoo.Core/Views/Resources/EpisodeApi.cs +++ b/src/Kyoo.Core/Views/Resources/EpisodeApi.cs @@ -34,8 +34,8 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple . /// - [Route("api/episodes")] - [Route("api/episode", Order = AlternativeRoute)] + [Route("episodes")] + [Route("episode", Order = AlternativeRoute)] [ApiController] [ResourceView] [PartialPermission(nameof(Episode))] diff --git a/src/Kyoo.Core/Views/Resources/LibraryApi.cs b/src/Kyoo.Core/Views/Resources/LibraryApi.cs index 4f361705..c6b785de 100644 --- a/src/Kyoo.Core/Views/Resources/LibraryApi.cs +++ b/src/Kyoo.Core/Views/Resources/LibraryApi.cs @@ -36,8 +36,8 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple . /// - [Route("api/libraries")] - [Route("api/library", Order = AlternativeRoute)] + [Route("libraries")] + [Route("library", Order = AlternativeRoute)] [ApiController] [ResourceView] [PartialPermission(nameof(Library), Group = Group.Admin)] diff --git a/src/Kyoo.Core/Views/Resources/LibraryItemApi.cs b/src/Kyoo.Core/Views/Resources/LibraryItemApi.cs index 5318d0b5..5d068fd5 100644 --- a/src/Kyoo.Core/Views/Resources/LibraryItemApi.cs +++ b/src/Kyoo.Core/Views/Resources/LibraryItemApi.cs @@ -34,8 +34,8 @@ namespace Kyoo.Core.Api /// Endpoint for items that are not part of a specific library. /// An item can ether represent a collection or a show. /// - [Route("api/items")] - [Route("api/item", Order = AlternativeRoute)] + [Route("items")] + [Route("item", Order = AlternativeRoute)] [ApiController] [ResourceView] [PartialPermission(nameof(LibraryItem))] diff --git a/src/Kyoo.Core/Views/Resources/SearchApi.cs b/src/Kyoo.Core/Views/Resources/SearchApi.cs index 3ef37a39..e8be01d2 100644 --- a/src/Kyoo.Core/Views/Resources/SearchApi.cs +++ b/src/Kyoo.Core/Views/Resources/SearchApi.cs @@ -32,7 +32,7 @@ namespace Kyoo.Core.Api /// An endpoint to search for every resources of kyoo. Searching for only a specific type of resource /// is available on the said endpoint. /// - [Route("api/search/{query}")] + [Route("search/{query}")] [ApiController] [ResourceView] [ApiDefinition("Search", Group = ResourcesGroup)] diff --git a/src/Kyoo.Core/Views/Resources/SeasonApi.cs b/src/Kyoo.Core/Views/Resources/SeasonApi.cs index 8f74a08c..fd5e1da1 100644 --- a/src/Kyoo.Core/Views/Resources/SeasonApi.cs +++ b/src/Kyoo.Core/Views/Resources/SeasonApi.cs @@ -34,8 +34,8 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple . /// - [Route("api/seasons")] - [Route("api/season", Order = AlternativeRoute)] + [Route("seasons")] + [Route("season", Order = AlternativeRoute)] [ApiController] [PartialPermission(nameof(Season))] [ApiDefinition("Seasons", Group = ResourcesGroup)] diff --git a/src/Kyoo.Core/Views/Resources/ShowApi.cs b/src/Kyoo.Core/Views/Resources/ShowApi.cs index 23261724..bd7569d9 100644 --- a/src/Kyoo.Core/Views/Resources/ShowApi.cs +++ b/src/Kyoo.Core/Views/Resources/ShowApi.cs @@ -36,10 +36,10 @@ namespace Kyoo.Core.Api /// /// Information about one or multiple . /// - [Route("api/shows")] - [Route("api/show", Order = AlternativeRoute)] - [Route("api/movie", Order = AlternativeRoute)] - [Route("api/movies", Order = AlternativeRoute)] + [Route("shows")] + [Route("show", Order = AlternativeRoute)] + [Route("movie", Order = AlternativeRoute)] + [Route("movies", Order = AlternativeRoute)] [ApiController] [PartialPermission(nameof(Show))] [ApiDefinition("Shows", Group = ResourcesGroup)] diff --git a/src/Kyoo.Core/Views/Watch/TrackApi.cs b/src/Kyoo.Core/Views/Watch/TrackApi.cs index 60a5d0c2..d2af40dd 100644 --- a/src/Kyoo.Core/Views/Watch/TrackApi.cs +++ b/src/Kyoo.Core/Views/Watch/TrackApi.cs @@ -32,8 +32,8 @@ namespace Kyoo.Core.Api /// Information about one or multiple . /// A track contain metadata about a video, an audio or a subtitles. /// - [Route("api/tracks")] - [Route("api/track", Order = AlternativeRoute)] + [Route("tracks")] + [Route("track", Order = AlternativeRoute)] [ApiController] [ResourceView] [PartialPermission(nameof(Track))] diff --git a/src/Kyoo.Core/Views/Watch/WatchApi.cs b/src/Kyoo.Core/Views/Watch/WatchApi.cs index f72b1901..dbc539b2 100644 --- a/src/Kyoo.Core/Views/Watch/WatchApi.cs +++ b/src/Kyoo.Core/Views/Watch/WatchApi.cs @@ -34,8 +34,8 @@ namespace Kyoo.Core.Api /// It contains streams (video, audio, subtitles) information, chapters, next and previous episodes and a bit of /// information of the show. /// - [Route("api/watch")] - [Route("api/watchitem", Order = AlternativeRoute)] + [Route("watch")] + [Route("watchitem", Order = AlternativeRoute)] [ApiController] [ApiDefinition("Watch Items", Group = WatchGroup)] public class WatchApi : ControllerBase diff --git a/tests/robot/rest.resource b/tests/robot/rest.resource index c0f31069..c4820ca3 100644 --- a/tests/robot/rest.resource +++ b/tests/robot/rest.resource @@ -1,4 +1,4 @@ *** Settings *** Documentation Common things to handle rest requests -Library REST http://localhost:5000/api +Library REST http://localhost:5000