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")! .GetValue("DEFAULT_PERMISSIONS", "overall.read")!
.Split(','), .Split(','),
PublicUrl = PublicUrl =
_configuration.GetValue<string?>("PUBLIC_URL") _configuration.GetValue<string?>("PUBLIC_URL") ?? "http://localhost:8901",
?? "http://localhost:8901",
ApiKeys = _configuration.GetValue("KYOO_APIKEYS", string.Empty)!.Split(','), ApiKeys = _configuration.GetValue("KYOO_APIKEYS", string.Empty)!.Split(','),
OIDC = _configuration OIDC = _configuration
.AsEnumerable() .AsEnumerable()

View File

@ -24,9 +24,18 @@ namespace Kyoo.Authentication.Models.DTO;
public class JwtProfile public class JwtProfile
{ {
public string Sub { get; set; } public string Sub { get; set; }
public string Uid { set => Sub = value; } public string Uid
public string Id { set => Sub = value; } {
public string Guid { set => Sub = value; } set => Sub = value;
}
public string Id
{
set => Sub = value;
}
public string Guid
{
set => Sub = value;
}
public string? Name { get; set; } public string? Name { get; set; }
public string? Username { get; set; } public string? Username { get; set; }

View File

@ -95,25 +95,26 @@ public class OidcProvider
} }
} }
public static readonly Dictionary<string, OidcProvider> KnownProviders = new() public static readonly Dictionary<string, OidcProvider> KnownProviders =
{ new()
["google"] = new("google")
{ {
DisplayName = "Google", ["google"] = new("google")
LogoUrl = "https://logo.clearbit.com/google.com", {
AuthorizationUrl = "https://accounts.google.com/o/oauth2/v2/auth", DisplayName = "Google",
TokenUrl = "https://oauth2.googleapis.com/token", LogoUrl = "https://logo.clearbit.com/google.com",
ProfileUrl = "https://openidconnect.googleapis.com/v1/userinfo", AuthorizationUrl = "https://accounts.google.com/o/oauth2/v2/auth",
Scope = "email profile", TokenUrl = "https://oauth2.googleapis.com/token",
}, ProfileUrl = "https://openidconnect.googleapis.com/v1/userinfo",
["discord"] = new("discord") Scope = "email profile",
{ },
DisplayName = "Discord", ["discord"] = new("discord")
LogoUrl = "https://logo.clearbit.com/discord.com", {
AuthorizationUrl = "https://discord.com/oauth2/authorize", DisplayName = "Discord",
TokenUrl = "https://discord.com/api/oauth2/token", LogoUrl = "https://logo.clearbit.com/discord.com",
ProfileUrl = "https://discord.com/api/users/@me", AuthorizationUrl = "https://discord.com/oauth2/authorize",
Scope = "email+identify", 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"; import { withRoute } from "~/router";
export default withRoute(OidcCallbackPage); export default withRoute(OidcCallbackPage);

View File

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

View File

@ -18,7 +18,7 @@
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>. * 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 { Player } from "../player";
import { getCurrentAccount } from "@kyoo/models/src/account-internal"; import { getCurrentAccount } from "@kyoo/models/src/account-internal";
import { ReactNode } from "react"; import { ReactNode } from "react";
@ -41,7 +41,7 @@ export const useDownloader = () => {
// TODO: This methods does not work with auth. // TODO: This methods does not work with auth.
const a = document.createElement("a"); const a = document.createElement("a");
a.style.display = "none"; a.style.display = "none";
a.href = `${kyooApiUrl}/${type}/${slug}/direct`; a.href = `${getCurrentApiUrl()!}/${type}/${slug}/direct`;
a.download = `${slug}.${info.extension}`; a.download = `${slug}.${info.extension}`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();

View File

@ -26,7 +26,7 @@ import { useYoshiki } from "yoshiki/native";
export const ErrorView = ({ error }: { error: KyooErrors }) => { export const ErrorView = ({ error }: { error: KyooErrors }) => {
const { css } = useYoshiki(); const { css } = useYoshiki();
console.log(error) console.log(error);
return ( return (
<View <View
{...css({ {...css({

View File

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