mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 05:34:23 -04:00
Handle non-verifed users on the front
This commit is contained in:
parent
44e7323720
commit
92bfbf662b
11
.env.example
11
.env.example
@ -13,12 +13,15 @@ LIBRARY_IGNORE_PATTERN=".*/[dD]ownloads?/.*"
|
|||||||
|
|
||||||
# If this is true, new accounts wont have any permissions before you approve them in your admin dashboard.
|
# If this is true, new accounts wont have any permissions before you approve them in your admin dashboard.
|
||||||
REQUIRE_ACCOUNT_VERIFICATION=true
|
REQUIRE_ACCOUNT_VERIFICATION=true
|
||||||
# Specify permissions of guest accounts, default is no permissions but you can allow anyone to use your instance without account by doing:
|
# Specify permissions of guest accounts, default is no permissions.
|
||||||
|
UNLOGGED_PERMISSIONS=
|
||||||
|
# but you can allow anyone to use your instance without account by doing:
|
||||||
# UNLOGGED_PERMISSIONS=overall.read,overall.play
|
# UNLOGGED_PERMISSIONS=overall.read,overall.play
|
||||||
# You can specify this to allow guests users to see your collection without behing able to play videos for example:
|
# You can specify this to allow guests users to see your collection without behing able to play videos for example:
|
||||||
# UNLOGGED_PERMISSIONS=overall.read
|
# UNLOGGED_PERMISSIONS=overall.read
|
||||||
|
|
||||||
# Specify permissions of new accounts.
|
# Specify permissions of new accounts.
|
||||||
# DEFAULT_PERMISSIONS=overall.read,overall.play
|
DEFAULT_PERMISSIONS=overall.read,overall.play
|
||||||
|
|
||||||
# Hardware transcoding (equivalent of --profile docker compose option).
|
# Hardware transcoding (equivalent of --profile docker compose option).
|
||||||
COMPOSE_PROFILES= # vaapi or qsv or nvidia
|
COMPOSE_PROFILES= # vaapi or qsv or nvidia
|
||||||
@ -40,8 +43,8 @@ PUBLIC_URL=http://localhost:5000
|
|||||||
|
|
||||||
# Use a builtin oidc service (google or discord):
|
# Use a builtin oidc service (google or discord):
|
||||||
# When you create a client_id, secret combo you may be asked for a redirect url. You need to specify https://YOUR-PUBLIC-URL/api/auth/logged/YOUR-SERVICE-NAME
|
# When you create a client_id, secret combo you may be asked for a redirect url. You need to specify https://YOUR-PUBLIC-URL/api/auth/logged/YOUR-SERVICE-NAME
|
||||||
# OIDC_DISCORD_CLIENTID=
|
OIDC_DISCORD_CLIENTID=
|
||||||
# OIDC_DISCORD_SECRET=
|
OIDC_DISCORD_SECRET=
|
||||||
# Or add your custom one:
|
# Or add your custom one:
|
||||||
OIDC_SERVICE_NAME=YourPrettyName
|
OIDC_SERVICE_NAME=YourPrettyName
|
||||||
OIDC_SERVICE_LOGO=https://url-of-your-logo.com
|
OIDC_SERVICE_LOGO=https://url-of-your-logo.com
|
||||||
|
@ -68,7 +68,7 @@ namespace Kyoo.Core
|
|||||||
builder.RegisterRepository<EpisodeRepository>();
|
builder.RegisterRepository<EpisodeRepository>();
|
||||||
builder.RegisterRepository<PeopleRepository>();
|
builder.RegisterRepository<PeopleRepository>();
|
||||||
builder.RegisterRepository<StudioRepository>();
|
builder.RegisterRepository<StudioRepository>();
|
||||||
builder.RegisterRepository<UserRepository>();
|
builder.RegisterRepository<UserRepository>().As<IUserRepository>();
|
||||||
builder.RegisterRepository<NewsRepository>();
|
builder.RegisterRepository<NewsRepository>();
|
||||||
builder
|
builder
|
||||||
.RegisterType<WatchStatusRepository>()
|
.RegisterType<WatchStatusRepository>()
|
||||||
|
@ -30,6 +30,7 @@ import { SettingsContainer } from "../settings/base";
|
|||||||
import UserI from "@material-symbols/svg-400/rounded/account_circle.svg";
|
import UserI from "@material-symbols/svg-400/rounded/account_circle.svg";
|
||||||
import Delete from "@material-symbols/svg-400/rounded/delete.svg";
|
import Delete from "@material-symbols/svg-400/rounded/delete.svg";
|
||||||
import MoreVert from "@material-symbols/svg-400/rounded/more_vert.svg";
|
import MoreVert from "@material-symbols/svg-400/rounded/more_vert.svg";
|
||||||
|
import Unverifed from "@material-symbols/svg-400/rounded/gpp_bad.svg";
|
||||||
import Admin from "@material-symbols/svg-400/rounded/shield_person.svg";
|
import Admin from "@material-symbols/svg-400/rounded/shield_person.svg";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
@ -39,8 +40,15 @@ export const UserGrid = ({
|
|||||||
username,
|
username,
|
||||||
avatar,
|
avatar,
|
||||||
isAdmin,
|
isAdmin,
|
||||||
|
isVerifed,
|
||||||
...props
|
...props
|
||||||
}: WithLoading<{ id: string; username: string; avatar: string; isAdmin: boolean }>) => {
|
}: WithLoading<{
|
||||||
|
id: string;
|
||||||
|
username: string;
|
||||||
|
avatar: string;
|
||||||
|
isAdmin: boolean;
|
||||||
|
isVerifed: boolean;
|
||||||
|
}>) => {
|
||||||
const { css } = useYoshiki();
|
const { css } = useYoshiki();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@ -59,17 +67,35 @@ export const UserGrid = ({
|
|||||||
<Avatar src={avatar} alt={username} placeholder={username} size={UserGrid.layout.size} fill />
|
<Avatar src={avatar} alt={username} placeholder={username} size={UserGrid.layout.size} fill />
|
||||||
<View {...css({ flexDirection: "row" })}>
|
<View {...css({ flexDirection: "row" })}>
|
||||||
<Icon
|
<Icon
|
||||||
icon={isAdmin ? Admin : UserI}
|
icon={isVerifed ? Unverifed : isAdmin ? Admin : UserI}
|
||||||
{...css({
|
{...css({
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
m: ts(1),
|
m: ts(1),
|
||||||
})}
|
})}
|
||||||
{...tooltip(t(isAdmin ? "admin.users.adminUser" : "admin.users.regularUser"))}
|
{...tooltip(
|
||||||
|
t(
|
||||||
|
isVerifed
|
||||||
|
? "admin.users.unverifed"
|
||||||
|
: isAdmin
|
||||||
|
? "admin.users.adminUser"
|
||||||
|
: "admin.users.regularUser",
|
||||||
|
),
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
<Skeleton>
|
<Skeleton>
|
||||||
<P>{username}</P>
|
<P>{username}</P>
|
||||||
</Skeleton>
|
</Skeleton>
|
||||||
<Menu Trigger={IconButton} icon={MoreVert} {...tooltip(t("misc.more"))}>
|
<Menu Trigger={IconButton} icon={MoreVert} {...tooltip(t("misc.more"))}>
|
||||||
|
{!isVerifed && (
|
||||||
|
<Menu.Item
|
||||||
|
label={t("admin.users.verify")}
|
||||||
|
onSelect={() =>
|
||||||
|
mutateAsync({
|
||||||
|
permissions: ["overall.read", "overall.play"],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Menu.Sub label={t("admin.users.set-permissions")} icon={Admin}>
|
<Menu.Sub label={t("admin.users.set-permissions")} icon={Admin}>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
selected={!isAdmin}
|
selected={!isAdmin}
|
||||||
@ -151,6 +177,7 @@ export const UserList = () => {
|
|||||||
username={user.username}
|
username={user.username}
|
||||||
avatar={user.logo}
|
avatar={user.logo}
|
||||||
isAdmin={user.permissions?.includes("admin.write")}
|
isAdmin={user.permissions?.includes("admin.write")}
|
||||||
|
isVerified={user.permissions?.length == 0}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InfiniteFetch>
|
</InfiniteFetch>
|
||||||
|
@ -228,7 +228,9 @@
|
|||||||
"adminUser": "Admin",
|
"adminUser": "Admin",
|
||||||
"regularUser": "User",
|
"regularUser": "User",
|
||||||
"set-permissions": "Set permissions",
|
"set-permissions": "Set permissions",
|
||||||
"delete": "Delete user"
|
"delete": "Delete user",
|
||||||
|
"unverifed": "Unverifed",
|
||||||
|
"verify": "Verify user"
|
||||||
},
|
},
|
||||||
"scanner": {
|
"scanner": {
|
||||||
"label": "Scanner",
|
"label": "Scanner",
|
||||||
|
@ -228,7 +228,9 @@
|
|||||||
"adminUser": "Admin",
|
"adminUser": "Admin",
|
||||||
"regularUser": "Utilisateur",
|
"regularUser": "Utilisateur",
|
||||||
"set-permissions": "Definir les permissions",
|
"set-permissions": "Definir les permissions",
|
||||||
"delete": "Supprimer l'utilisateur"
|
"delete": "Supprimer l'utilisateur",
|
||||||
|
"unverifed": "Non vérifié",
|
||||||
|
"verify": "Vérifié l'utilisateur"
|
||||||
},
|
},
|
||||||
"scanner": {
|
"scanner": {
|
||||||
"label": "Scanner",
|
"label": "Scanner",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user