From e25e1276e4ddfd159ab6405d69abb7542e5267f4 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Thu, 19 Mar 2020 01:45:50 +0100 Subject: [PATCH] Cleaning up --- Kyoo/Models/IdentityContext.cs | 14 ++++++++++++-- Kyoo/Startup.cs | 4 +++- Kyoo/Views/API/AccountAPI.cs | 5 +++-- Kyoo/Views/WebClient | 2 +- Kyoo/appsettings.json | 8 ++++---- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Kyoo/Models/IdentityContext.cs b/Kyoo/Models/IdentityContext.cs index 9edca959..207b1b84 100644 --- a/Kyoo/Models/IdentityContext.cs +++ b/Kyoo/Models/IdentityContext.cs @@ -30,8 +30,8 @@ namespace Kyoo RequireClientSecret = false, RequireConsent = false, AccessTokenType = AccessTokenType.Reference, - AllowedScopes = { "kyoo.admin", "kyoo.write", "kyoo.read", "openid", "profile" }, - RedirectUris = { "/silent", "/" }, + AllowedScopes = { "openid", "profile", "kyoo.read", "kyoo.write", "kyoo.play", "kyoo.download", "kyoo.admin" }, + RedirectUris = { "/", "/silent" }, PostLogoutRedirectUris = { "/logout" } } }; @@ -57,6 +57,16 @@ namespace Kyoo DisplayName = "Read and write access to the public API" }, new Scope + { + Name = "kyoo.play", + DisplayName = "Allow playback of movies and episodes." + }, + new Scope + { + Name = "kyoo.download", + DisplayName = "Allow downloading of episodes and movies from kyoo." + }, + new Scope { Name = "kyoo.admin", DisplayName = "Full access to the admin's API and the public API." diff --git a/Kyoo/Startup.cs b/Kyoo/Startup.cs index 30bc848f..ff26f54e 100644 --- a/Kyoo/Startup.cs +++ b/Kyoo/Startup.cs @@ -1,7 +1,9 @@ +using System; using System.Reflection; using Kyoo.Api; using Kyoo.Controllers; using Kyoo.Models; +using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -133,7 +135,7 @@ namespace Kyoo if (env.IsDevelopment()) { - spa.UseAngularCliServer(npmScript: "start"); + spa.UseAngularCliServer("start"); } }); } diff --git a/Kyoo/Views/API/AccountAPI.cs b/Kyoo/Views/API/AccountAPI.cs index e937ebfb..facd48d3 100644 --- a/Kyoo/Views/API/AccountAPI.cs +++ b/Kyoo/Views/API/AccountAPI.cs @@ -52,7 +52,8 @@ namespace Kyoo.Api _userManager = userManager; _signInManager = siginInManager; _picturePath = configuration.GetValue("profilePicturePath"); - + if (!Path.IsPathRooted(_picturePath)) + _picturePath = Path.GetFullPath(_picturePath); } [HttpPost("register")] @@ -119,7 +120,7 @@ namespace Kyoo.Api string path = Path.Combine(_picturePath, user.Id); if (!System.IO.File.Exists(path)) return NotFound(); - return new PhysicalFileResult(path, "image"); + return new PhysicalFileResult(path, "image/png"); } [HttpPost("update")] diff --git a/Kyoo/Views/WebClient b/Kyoo/Views/WebClient index 54f9406c..4d5b46ad 160000 --- a/Kyoo/Views/WebClient +++ b/Kyoo/Views/WebClient @@ -1 +1 @@ -Subproject commit 54f9406c079894648b9a84a63aa7944c8d439ce4 +Subproject commit 4d5b46ad07643e5524badc51ada3461b25e6d239 diff --git a/Kyoo/appsettings.json b/Kyoo/appsettings.json index c7aa5002..19b8e81a 100644 --- a/Kyoo/appsettings.json +++ b/Kyoo/appsettings.json @@ -13,10 +13,10 @@ "Database": "Data Source=kyoo.db" }, - "transmuxTempPath": "/tmp/cached/kyoo/transmux", - "transcodeTempPath": "/tmp/cached/kyoo/transcode", - "peoplePath": "/tmp/people", - "profilePicturePath": "/tmp/users/", + "transmuxTempPath": "cached/kyoo/transmux", + "transcodeTempPath": "cached/kyoo/transcode", + "peoplePath": "people", + "profilePicturePath": "users/", "plugins": "plugins/", "regex": "(\\/(?.*)\\/)?.*\\/(?.+?)(( S(?\\d+)E(?\\d+)| (?\\d+)))?\\.", }