Format code

This commit is contained in:
Zoe Roux 2024-03-07 01:08:00 +01:00
parent a09e229711
commit a7fd96800a
8 changed files with 38 additions and 31 deletions

View File

@ -75,8 +75,7 @@ namespace Kyoo.Authentication
.GetValue("DEFAULT_PERMISSIONS", "overall.read")!
.Split(','),
PublicUrl =
_configuration.GetValue<string?>("PUBLIC_URL")
?? "http://localhost:8901",
_configuration.GetValue<string?>("PUBLIC_URL") ?? "http://localhost:8901",
ApiKeys = _configuration.GetValue("KYOO_APIKEYS", string.Empty)!.Split(','),
OIDC = _configuration
.AsEnumerable()

View File

@ -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; }

View File

@ -95,25 +95,26 @@ public class OidcProvider
}
}
public static readonly Dictionary<string, OidcProvider> KnownProviders = new()
{
["google"] = new("google")
public static readonly Dictionary<string, OidcProvider> 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",
}
};
}

View File

@ -22,4 +22,3 @@ import { OidcCallbackPage } from "@kyoo/ui";
import { withRoute } from "~/router";
export default withRoute(OidcCallbackPage);

View File

@ -35,7 +35,7 @@ export const Button = forwardRef(function Button<AsProps = PressableProps>(
as,
...props
}: {
children?: ReactElement | Falsy;
children?: ReactElement | ReactElement[] | Falsy;
text?: string;
licon?: ReactElement | Falsy;
icon?: ReactElement | Falsy;

View File

@ -18,7 +18,7 @@
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/
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();

View File

@ -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 (
<View
{...css({

View File

@ -47,7 +47,6 @@ export const ServerUrlPage: QueryPage = () => {
const { t } = useTranslation();
const { css } = useYoshiki();
return (
<View
{...css({