KITYYY!!
Some checks failed
Docker Build / publish (push) Failing after 14s

This commit is contained in:
Lea 2024-06-16 23:44:32 +02:00
parent a974e66949
commit b2b1957bc9
Signed by: Lea
GPG key ID: 1BAFFE8347019C42
6 changed files with 18 additions and 14 deletions

View file

@ -4,7 +4,7 @@ import { fetchAuditLog } from "@/lib/actions";
import { AuditLog, AuditLogAction } from "@/lib/audit";
import GhostMessage from "@/lib/components/ui/GhostMessage";
import LoadingSpinner from "@/lib/components/ui/LoadingSpinner";
import { GRAVATAR_DEFAULT } from "@/lib/constants";
import { avatarUrl, GRAVATAR_DEFAULT } from "@/lib/constants";
import { sha256sum } from "@/lib/util";
import { Avatar, Card, Code, Flex, Grid, Heading, IconButton, Text } from "@radix-ui/themes";
import dayjs from "dayjs";
@ -98,7 +98,7 @@ export default function Audit() {
<Flex direction='row' gap='4' align='center'>
<Avatar
size="2"
src={`https://gravatar.com/avatar/${sha256sum(item.user)}?d=${GRAVATAR_DEFAULT}`}
src={avatarUrl(item.user ?? "")}
radius='full'
fallback={item.user?.slice(0, 1) || "@"}
/>

View file

@ -5,7 +5,7 @@ import GhostMessage from "@/lib/components/ui/GhostMessage";
import LoadingSpinner from "@/lib/components/ui/LoadingSpinner";
import CreateUserButton from "@/lib/components/ui/admin/CreateUserButton";
import ManageUserButton from "@/lib/components/ui/admin/ManageUserButton";
import { GRAVATAR_DEFAULT } from "@/lib/constants";
import { avatarUrl, GRAVATAR_DEFAULT } from "@/lib/constants";
import { isAdmin, sha256sum } from "@/lib/util";
import { Avatar, Badge, Button, Card, Flex, Heading, Table, Text, TextField } from "@radix-ui/themes";
import { SearchIcon, UserRoundXIcon } from "lucide-react";
@ -59,7 +59,7 @@ export default function Users() {
<Flex direction='row' gap='4' align='center'>
<Avatar
size="2"
src={`https://gravatar.com/avatar/${sha256sum(email)}?d=${GRAVATAR_DEFAULT}`}
src={avatarUrl(email)}
radius='full'
fallback={email.slice(0, 1) || "@"}
/>

View file

@ -2,7 +2,7 @@ import NextAuth, { AuthOptions } from "next-auth";
import CredentialProvider from "next-auth/providers/credentials";
import { sha256sum } from "@/lib/util";
import { validateCredentials } from "@/lib/db";
import { GRAVATAR_DEFAULT } from "@/lib/constants";
import { avatarUrl, GRAVATAR_DEFAULT } from "@/lib/constants";
import { auditLogRaw } from "@/lib/audit";
const authOptions: AuthOptions = {
@ -19,8 +19,6 @@ const authOptions: AuthOptions = {
if (credentials && await validateCredentials(credentials.email, credentials.password)) {
console.log(`[${credentials.email}] Authentication succeeded`);
const emailHash = sha256sum(credentials.email.trim().toLowerCase());
await auditLogRaw({
user: credentials.email,
ts: new Date().toISOString(),
@ -30,7 +28,7 @@ const authOptions: AuthOptions = {
return {
id: credentials.email,
email: credentials.email,
image: `https://gravatar.com/avatar/${emailHash}?d=${GRAVATAR_DEFAULT}`,
image: avatarUrl(credentials.email),
};
}

View file

@ -1,6 +1,6 @@
"use client";
import { GRAVATAR_DEFAULT } from "@/lib/constants";
import { avatarUrl, GRAVATAR_DEFAULT } from "@/lib/constants";
import { AliasEntry } from "@/lib/db";
import { isAdmin, sha256sum } from "@/lib/util";
import { Avatar, Badge, Button, Card, Code, Dialog, Flex, Grid, Heading, Table, Text } from "@radix-ui/themes";
@ -36,7 +36,7 @@ export default function ManageUserButton({ email }: { email: string }) {
<Flex direction="row" gap="3" align="center">
<Avatar
size="4"
src={`https://gravatar.com/avatar/${sha256sum(email)}?d=${GRAVATAR_DEFAULT}`}
src={avatarUrl(email)}
fallback={email.slice(0, 1) || "@"}
/>
<Flex direction="column">

View file

@ -1,5 +1,5 @@
import { disposeTempAliasRequest, fetchOwnAliases, requestTemporaryAlias, claimTemporaryAlias, deleteAlias } from "@/lib/actions";
import { GRAVATAR_DEFAULT } from "@/lib/constants";
import { avatarUrl, GRAVATAR_DEFAULT } from "@/lib/constants";
import { AliasEntry, AliasRequestEntry } from "@/lib/db";
import { ToastContext } from "@/lib/providers/ToastProvider";
import { sha256sum } from "@/lib/util";
@ -120,7 +120,7 @@ export default function TempAliasesCard() {
<Flex direction="row" align="center" gap="3">
<Avatar
size="3"
src={`https://gravatar.com/avatar/${sha256sum(aliasPreview?.alias || "")}?d=${GRAVATAR_DEFAULT}`}
src={avatarUrl(aliasPreview?.alias || "")}
fallback={"@"}
/>
<Flex direction="column" gap="0">
@ -171,7 +171,7 @@ export default function TempAliasesCard() {
<Flex direction="row" align="center" gap="3">
<Avatar
size="3"
src={`https://gravatar.com/avatar/${sha256sum(aliasPreview!.alias)}?d=${GRAVATAR_DEFAULT}`}
src={avatarUrl(aliasPreview!.alias)}
fallback={"@"}
/>
<Flex direction="column" gap="0">

View file

@ -1,3 +1,4 @@
import { sha256sum } from "./util";
// TODO read these from environment
@ -9,4 +10,9 @@ export const IMAP_SECURITY = "SSL/TLS";
export const WEBMAIL_URL = "https://webmail.amogus.cloud";
export const ALIAS_DOMAINS = ["amogus.cloud", "lea.pet", "futacockinside.me"];
export const GRAVATAR_DEFAULT = "retro";
export const TEMP_EMAIL_DOMAIN = "t.amogus.cloud";
export const TEMP_EMAIL_DOMAIN = "t.amogus.cloud";
export function avatarUrl(email: string) {
//return `https://gravatar.com/avatar/${sha256sum(email)}?d=${GRAVATAR_DEFAULT}`;
return `https://picvatar.lea.pet/generate/47882/${sha256sum(email)}?gravatar=1`;
}