From a7fd96800a627688c3fb928b40b87d114c26a153 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Thu, 7 Mar 2024 01:08:00 +0100 Subject: [PATCH] Format code --- .../AuthenticationModule.cs | 3 +- .../Models/DTO/JwtProfile.cs | 15 +++++-- .../Models/Options/PermissionOption.cs | 41 ++++++++++--------- front/apps/web/src/pages/login/callback.tsx | 1 - front/packages/primitives/src/button.tsx | 2 +- front/packages/ui/src/downloads/index.web.tsx | 4 +- front/packages/ui/src/errors/error.tsx | 2 +- front/packages/ui/src/login/server-url.tsx | 1 - 8 files changed, 38 insertions(+), 31 deletions(-) diff --git a/back/src/Kyoo.Authentication/AuthenticationModule.cs b/back/src/Kyoo.Authentication/AuthenticationModule.cs index fbe12c69..5f242954 100644 --- a/back/src/Kyoo.Authentication/AuthenticationModule.cs +++ b/back/src/Kyoo.Authentication/AuthenticationModule.cs @@ -75,8 +75,7 @@ namespace Kyoo.Authentication .GetValue("DEFAULT_PERMISSIONS", "overall.read")! .Split(','), PublicUrl = - _configuration.GetValue("PUBLIC_URL") - ?? "http://localhost:8901", + _configuration.GetValue("PUBLIC_URL") ?? "http://localhost:8901", ApiKeys = _configuration.GetValue("KYOO_APIKEYS", string.Empty)!.Split(','), OIDC = _configuration .AsEnumerable() diff --git a/back/src/Kyoo.Authentication/Models/DTO/JwtProfile.cs b/back/src/Kyoo.Authentication/Models/DTO/JwtProfile.cs index e29fa5ab..cba47a5e 100644 --- a/back/src/Kyoo.Authentication/Models/DTO/JwtProfile.cs +++ b/back/src/Kyoo.Authentication/Models/DTO/JwtProfile.cs @@ -24,9 +24,18 @@ namespace Kyoo.Authentication.Models.DTO; public class JwtProfile { public string Sub { get; set; } - public string Uid { set => Sub = value; } - public string Id { set => Sub = value; } - public string Guid { set => Sub = value; } + public string Uid + { + set => Sub = value; + } + public string Id + { + set => Sub = value; + } + public string Guid + { + set => Sub = value; + } public string? Name { get; set; } public string? Username { get; set; } diff --git a/back/src/Kyoo.Authentication/Models/Options/PermissionOption.cs b/back/src/Kyoo.Authentication/Models/Options/PermissionOption.cs index 4be74354..e0e57108 100644 --- a/back/src/Kyoo.Authentication/Models/Options/PermissionOption.cs +++ b/back/src/Kyoo.Authentication/Models/Options/PermissionOption.cs @@ -95,25 +95,26 @@ public class OidcProvider } } - public static readonly Dictionary KnownProviders = new() - { - ["google"] = new("google") + public static readonly Dictionary KnownProviders = + new() { - DisplayName = "Google", - LogoUrl = "https://logo.clearbit.com/google.com", - AuthorizationUrl = "https://accounts.google.com/o/oauth2/v2/auth", - TokenUrl = "https://oauth2.googleapis.com/token", - ProfileUrl = "https://openidconnect.googleapis.com/v1/userinfo", - Scope = "email profile", - }, - ["discord"] = new("discord") - { - DisplayName = "Discord", - LogoUrl = "https://logo.clearbit.com/discord.com", - AuthorizationUrl = "https://discord.com/oauth2/authorize", - TokenUrl = "https://discord.com/api/oauth2/token", - ProfileUrl = "https://discord.com/api/users/@me", - Scope = "email+identify", - } - }; + ["google"] = new("google") + { + DisplayName = "Google", + LogoUrl = "https://logo.clearbit.com/google.com", + AuthorizationUrl = "https://accounts.google.com/o/oauth2/v2/auth", + TokenUrl = "https://oauth2.googleapis.com/token", + ProfileUrl = "https://openidconnect.googleapis.com/v1/userinfo", + Scope = "email profile", + }, + ["discord"] = new("discord") + { + DisplayName = "Discord", + LogoUrl = "https://logo.clearbit.com/discord.com", + AuthorizationUrl = "https://discord.com/oauth2/authorize", + TokenUrl = "https://discord.com/api/oauth2/token", + ProfileUrl = "https://discord.com/api/users/@me", + Scope = "email+identify", + } + }; } diff --git a/front/apps/web/src/pages/login/callback.tsx b/front/apps/web/src/pages/login/callback.tsx index bc5c8c55..9735f32e 100644 --- a/front/apps/web/src/pages/login/callback.tsx +++ b/front/apps/web/src/pages/login/callback.tsx @@ -22,4 +22,3 @@ import { OidcCallbackPage } from "@kyoo/ui"; import { withRoute } from "~/router"; export default withRoute(OidcCallbackPage); - diff --git a/front/packages/primitives/src/button.tsx b/front/packages/primitives/src/button.tsx index c9dad82a..5f902793 100644 --- a/front/packages/primitives/src/button.tsx +++ b/front/packages/primitives/src/button.tsx @@ -35,7 +35,7 @@ export const Button = forwardRef(function Button( as, ...props }: { - children?: ReactElement | Falsy; + children?: ReactElement | ReactElement[] | Falsy; text?: string; licon?: ReactElement | Falsy; icon?: ReactElement | Falsy; diff --git a/front/packages/ui/src/downloads/index.web.tsx b/front/packages/ui/src/downloads/index.web.tsx index 4b4bd7ef..a7f7cc51 100644 --- a/front/packages/ui/src/downloads/index.web.tsx +++ b/front/packages/ui/src/downloads/index.web.tsx @@ -18,7 +18,7 @@ * along with Kyoo. If not, see . */ -import { WatchInfo, kyooApiUrl, queryFn, toQueryKey } from "@kyoo/models"; +import { WatchInfo, getCurrentApiUrl, queryFn, toQueryKey } from "@kyoo/models"; import { Player } from "../player"; import { getCurrentAccount } from "@kyoo/models/src/account-internal"; import { ReactNode } from "react"; @@ -41,7 +41,7 @@ export const useDownloader = () => { // TODO: This methods does not work with auth. const a = document.createElement("a"); a.style.display = "none"; - a.href = `${kyooApiUrl}/${type}/${slug}/direct`; + a.href = `${getCurrentApiUrl()!}/${type}/${slug}/direct`; a.download = `${slug}.${info.extension}`; document.body.appendChild(a); a.click(); diff --git a/front/packages/ui/src/errors/error.tsx b/front/packages/ui/src/errors/error.tsx index 51b48d11..62279c96 100644 --- a/front/packages/ui/src/errors/error.tsx +++ b/front/packages/ui/src/errors/error.tsx @@ -26,7 +26,7 @@ import { useYoshiki } from "yoshiki/native"; export const ErrorView = ({ error }: { error: KyooErrors }) => { const { css } = useYoshiki(); - console.log(error) + console.log(error); return ( { const { t } = useTranslation(); const { css } = useYoshiki(); - return (