Skip to content

Commit

Permalink
Merge branch 'dev' into everyone-group
Browse files Browse the repository at this point in the history
  • Loading branch information
Meierschlumpf committed Oct 18, 2024
2 parents c31e106 + c8b1bb8 commit 2b0222e
Show file tree
Hide file tree
Showing 67 changed files with 671 additions and 525 deletions.
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ DB_URL='FULL_PATH_TO_YOUR_SQLITE_DB_FILE'
# DB_PASSWORD='password'
# DB_NAME='name-of-database'

# @see https://next-auth.js.org/configuration/options#nextauth_url
AUTH_URL='http://localhost:3000'

# You can generate the secret via 'openssl rand -base64 32' on Unix
# @see https://next-auth.js.org/configuration/options#secret
Expand Down
16 changes: 8 additions & 8 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
"@homarr/ui": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@homarr/widgets": "workspace:^0.1.0",
"@mantine/colors-generator": "^7.13.2",
"@mantine/core": "^7.13.2",
"@mantine/hooks": "^7.13.2",
"@mantine/modals": "^7.13.2",
"@mantine/tiptap": "^7.13.2",
"@mantine/colors-generator": "^7.13.3",
"@mantine/core": "^7.13.3",
"@mantine/hooks": "^7.13.3",
"@mantine/modals": "^7.13.3",
"@mantine/tiptap": "^7.13.3",
"@million/lint": "1.0.11",
"@t3-oss/env-nextjs": "^0.11.1",
"@tabler/icons-react": "^3.19.0",
Expand All @@ -68,9 +68,9 @@
"prismjs": "^1.29.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.1.0",
"react-error-boundary": "^4.1.1",
"react-simple-code-editor": "^0.14.1",
"sass": "^1.79.5",
"sass": "^1.80.2",
"superjson": "2.2.1",
"swagger-ui-react": "^5.17.14",
"use-deep-compare-effect": "^1.8.1"
Expand All @@ -80,7 +80,7 @@
"@homarr/prettier-config": "workspace:^0.1.0",
"@homarr/tsconfig": "workspace:^0.1.0",
"@types/chroma-js": "2.4.4",
"@types/node": "^20.16.11",
"@types/node": "^20.16.12",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
Expand Down
Binary file added apps/nextjs/public/images/pwa/192.maskable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/nextjs/public/images/pwa/512.maskable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion apps/nextjs/src/app/[locale]/_client-providers/mantine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const CustomMantineProvider = ({ children }: PropsWithChildren) => {
return (
<DirectionProvider>
<MantineProvider
defaultColorScheme="auto"
defaultColorScheme="dark"
colorSchemeManager={manager}
theme={createTheme({
primaryColor: "red",
Expand Down Expand Up @@ -62,6 +62,7 @@ function useColorSchemeManager(): MantineColorSchemeManager {
},

set: (value) => {
if (value === "auto") return;
try {
if (session) {
mutateColorScheme({ colorScheme: value });
Expand Down
1 change: 1 addition & 0 deletions apps/nextjs/src/app/[locale]/boards/(content)/_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const BoardProvider = ({

useEffect(() => {
setReadySections((previous) => previous.filter((id) => data.sections.some((section) => section.id === id)));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data.sections.length, setReadySections]);

const markAsReady = useCallback((id: string) => {
Expand Down
4 changes: 4 additions & 0 deletions apps/nextjs/src/app/[locale]/boards/(content)/_creator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export const createBoardContentPage = <TParams extends Record<string, unknown>>(
title: board.metaTitle ?? createMetaTitle(t("board.content.metaTitle", { boardName: board.name })),
icons: {
icon: board.faviconImageUrl ? board.faviconImageUrl : undefined,
apple: board.faviconImageUrl ? board.faviconImageUrl : undefined,
},
appleWebApp: {
startupImage: { url: board.faviconImageUrl ? board.faviconImageUrl : "/logo/logo.png" },
},
};
} catch (error) {
Expand Down
34 changes: 25 additions & 9 deletions apps/nextjs/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ const fontSans = Inter({
variable: "--font-sans",
});

export const metadata: Metadata = {
metadataBase: new URL("http://localhost:3000"),
export const generateMetadata = (): Metadata => ({
title: "Homarr",
description:
"Simplify the management of your server with Homarr - a sleek, modern dashboard that puts all of your apps and services at your fingertips.",
Expand All @@ -40,12 +39,17 @@ export const metadata: Metadata = {
url: "https://homarr.dev",
siteName: "Homarr Documentation",
},
twitter: {
card: "summary_large_image",
site: "@jullerino",
creator: "@jullerino",
icons: {
icon: "/logo/logo.png",
apple: "/logo/logo.png",
},
};
appleWebApp: {
title: "Homarr",
capable: true,
startupImage: { url: "/logo/logo.png" },
statusBarStyle: getColorScheme() === "dark" ? "black-translucent" : "default",
},
});

export const viewport: Viewport = {
themeColor: [
Expand All @@ -56,7 +60,7 @@ export const viewport: Viewport = {

export default async function Layout(props: { children: React.ReactNode; params: { locale: string } }) {
const session = await auth();
const colorScheme = cookies().get("homarr-color-scheme")?.value ?? "light";
const colorScheme = getColorScheme();
const tCommon = await getScopedI18n("common");
const direction = tCommon("direction");

Expand All @@ -73,7 +77,15 @@ export default async function Layout(props: { children: React.ReactNode; params:

return (
// Instead of ColorSchemScript we use data-mantine-color-scheme to prevent flickering
<html lang="en" dir={direction} data-mantine-color-scheme={colorScheme} suppressHydrationWarning>
<html
lang="en"
dir={direction}
data-mantine-color-scheme={colorScheme}
style={{
backgroundColor: colorScheme === "dark" ? "#242424" : "#fff",
}}
suppressHydrationWarning
>
<head>
<Analytics />
<SearchEngineOptimization />
Expand All @@ -87,3 +99,7 @@ export default async function Layout(props: { children: React.ReactNode; params:
</html>
);
}

const getColorScheme = () => {
return cookies().get("homarr-color-scheme")?.value ?? "dark";
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IconInfoCircle } from "@tabler/icons-react";
import { clientApi } from "@homarr/api/client";
import { revalidatePathActionAsync } from "@homarr/common/client";
import type { IntegrationKind, IntegrationSecretKind } from "@homarr/definitions";
import { getAllSecretKindOptions } from "@homarr/definitions";
import { getAllSecretKindOptions, getIntegrationName } from "@homarr/definitions";
import type { UseFormReturnType } from "@homarr/form";
import { useZodForm } from "@homarr/form";
import { convertIntegrationTestConnectionError } from "@homarr/integrations/client";
Expand All @@ -32,7 +32,7 @@ export const NewIntegrationForm = ({ searchParams }: NewIntegrationFormProps) =>
const router = useRouter();
const form = useZodForm(validation.integration.create.omit({ kind: true }), {
initialValues: {
name: searchParams.name ?? "",
name: searchParams.name ?? getIntegrationName(searchParams.kind),
url: searchParams.url ?? "",
secrets: secretKinds[0].map((kind) => ({
kind,
Expand Down Expand Up @@ -81,7 +81,7 @@ export const NewIntegrationForm = ({ searchParams }: NewIntegrationFormProps) =>
return (
<form onSubmit={form.onSubmit((value) => void handleSubmitAsync(value))}>
<Stack>
<TextInput withAsterisk label={t("integration.field.name.label")} {...form.getInputProps("name")} />
<TextInput withAsterisk label={t("integration.field.name.label")} autoFocus {...form.getInputProps("name")} />

<TextInput withAsterisk label={t("integration.field.url.label")} {...form.getInputProps("url")} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const ApiKeysManagement = ({ apiKeys }: ApiKeysManagementProps) => {
),
},
],
[],
[t],
);

const table = useMantineReactTable({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const UserProfileForm = ({ user }: UserProfileFormProps) => {
id: user.id,
});
},
[user.id, mutate],
[isProviderCredentials, mutate, user.id],
);

return (
Expand Down
39 changes: 39 additions & 0 deletions apps/nextjs/src/app/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type { MetadataRoute } from "next";

export default function manifest(): MetadataRoute.Manifest {
return {
name: "Homarr",
short_name: "Homarr",
description: "Your dashboard for managing your server.",
start_url: "/",
display: "standalone",
background_color: "#fff",
theme_color: "#fff",
icons: [
{
src: "/images/pwa/192.maskable.png",
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: "/images/pwa/192.maskable.png",
sizes: "192x192",
type: "image/png",
purpose: "maskable",
},
{
src: "/images/pwa/512.maskable.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
{
src: "/images/pwa/512.maskable.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
};
}
4 changes: 1 addition & 3 deletions apps/nextjs/src/components/board/items/item-move-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useI18n, useScopedI18n } from "@homarr/translation/client";
import { z } from "@homarr/validation";

import type { Item } from "~/app/[locale]/boards/_types";
import { useItemActions } from "./item-actions";

interface InnerProps {
gridStack: GridStack;
Expand All @@ -21,7 +20,6 @@ export const ItemMoveModal = createModal<InnerProps>(({ actions, innerProps }) =
const t = useI18n();
// Keep track of the maximum width based on the x offset
const maxWidthRef = useRef(innerProps.columnCount - innerProps.item.xOffset);
const { moveAndResizeItem } = useItemActions();
const form = useZodForm(
z.object({
xOffset: z
Expand Down Expand Up @@ -62,7 +60,7 @@ export const ItemMoveModal = createModal<InnerProps>(({ actions, innerProps }) =
});
actions.closeModal();
},
[moveAndResizeItem],
[actions, innerProps.gridStack, innerProps.item.id],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const GridStackItem = ({
if (type !== "section") return;
innerRef.current.gridstackNode.minW = minWidth;
innerRef.current.gridstackNode.minH = minHeight;
}, [minWidth, minHeight, innerRef]);
}, [minWidth, minHeight, innerRef, type]);

return (
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export const useGridstack = (section: Omit<Section, "items">, itemIds: string[])
}

// Only run this effect when the section items change
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [itemIds.length, columnCount]);

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/src/components/user-avatar-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const UserAvatarMenu = ({ children }: UserAvatarMenuProps) => {
router.refresh();
},
});
}, [openModal, router]);
}, [logoutUrl, openModal, router]);

return (
<Menu width={300} withArrow withinPortal>
Expand Down
2 changes: 1 addition & 1 deletion apps/tasks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@homarr/eslint-config": "workspace:^0.2.0",
"@homarr/prettier-config": "workspace:^0.1.0",
"@homarr/tsconfig": "workspace:^0.1.0",
"@types/node": "^20.16.11",
"@types/node": "^20.16.12",
"dotenv-cli": "^7.4.2",
"eslint": "^9.12.0",
"prettier": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.3"
},
"packageManager": "[email protected].1",
"packageManager": "[email protected].2",
"engines": {
"node": ">=20.18.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const createSessionAsync = async (
...user,
email: user.email ?? "",
permissions: await getCurrentUserPermissionsAsync(db, user.id),
colorScheme: "auto",
colorScheme: "dark",
},
} as Session;
};
Expand Down
11 changes: 11 additions & 0 deletions packages/auth/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ export const createConfiguration = (provider: SupportedAuthProvider | "unknown",
},
},
trustHost: true,
cookies: {
sessionToken: {
name: sessionTokenCookieName,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: true,
},
},
},
adapter,
providers: filterProviders([
Credentials(createCredentialsConfiguration(db)),
Expand Down
4 changes: 2 additions & 2 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
"@homarr/log": "workspace:^0.1.0",
"@paralleldrive/cuid2": "^2.2.2",
"@testcontainers/mysql": "^10.13.2",
"better-sqlite3": "^11.3.0",
"better-sqlite3": "^11.4.0",
"dotenv": "^16.4.5",
"drizzle-kit": "^0.26.2",
"drizzle-orm": "^0.35.1",
"drizzle-orm": "^0.35.2",
"mysql2": "3.11.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/db/schema/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const users = mysqlTable("user", {
homeBoardId: varchar("homeBoardId", { length: 64 }).references((): AnyMySqlColumn => boards.id, {
onDelete: "set null",
}),
colorScheme: varchar("colorScheme", { length: 5 }).$type<ColorScheme>().default("auto").notNull(),
colorScheme: varchar("colorScheme", { length: 5 }).$type<ColorScheme>().default("dark").notNull(),
firstDayOfWeek: tinyint("firstDayOfWeek").$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: boolean("pingIconsEnabled").default(false).notNull(),
});
Expand Down
2 changes: 1 addition & 1 deletion packages/db/schema/sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const users = sqliteTable("user", {
homeBoardId: text("homeBoardId").references((): AnySQLiteColumn => boards.id, {
onDelete: "set null",
}),
colorScheme: text("colorScheme").$type<ColorScheme>().default("auto").notNull(),
colorScheme: text("colorScheme").$type<ColorScheme>().default("dark").notNull(),
firstDayOfWeek: int("firstDayOfWeek").$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: int("pingIconsEnabled", { mode: "boolean" }).default(false).notNull(),
});
Expand Down
2 changes: 1 addition & 1 deletion packages/definitions/src/user.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const colorSchemes = ["light", "dark", "auto"] as const;
export const colorSchemes = ["light", "dark"] as const;
export type ColorScheme = (typeof colorSchemes)[number];
2 changes: 1 addition & 1 deletion packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@homarr/translation": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@mantine/form": "^7.13.2"
"@mantine/form": "^7.13.3"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/modals-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@homarr/translation": "workspace:^0.1.0",
"@homarr/ui": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@mantine/core": "^7.13.2",
"@mantine/core": "^7.13.3",
"@tabler/icons-react": "^3.19.0",
"dayjs": "^1.11.13",
"next": "^14.2.15",
Expand Down
4 changes: 2 additions & 2 deletions packages/modals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"dependencies": {
"@homarr/translation": "workspace:^0.1.0",
"@homarr/ui": "workspace:^0.1.0",
"@mantine/core": "^7.13.2",
"@mantine/hooks": "^7.13.2",
"@mantine/core": "^7.13.3",
"@mantine/hooks": "^7.13.3",
"react": "^18.3.1"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 2b0222e

Please sign in to comment.