chore(release): automatic release v0.1.0

This commit is contained in:
homarr-releases[bot]
2024-09-06 19:13:34 +00:00
committed by GitHub
71 changed files with 3617 additions and 658 deletions

View File

@@ -11,6 +11,11 @@ on:
required: false
default: true
description: Send notifications
push-image:
type: boolean
required: false
default: true
description: Push Docker Image
permissions:
contents: write
@@ -93,9 +98,9 @@ jobs:
id: buildPushAction
uses: docker/build-push-action@v6
with:
platforms: linux/amd64 # we currently do't build for linux/arm64 as it's really slow and we'll move to a self hosted runner for that or use the official github runner, once it's available
platforms: linux/amd64,linux/arm64
context: .
push: true
push: ${{ github.events.inputs.push-image && 'true' || 'false' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
network: host

View File

@@ -1,4 +1,4 @@
FROM node:20.17.0-alpine AS base
FROM --platform=linux/amd64 node:20.17.0-alpine AS base
FROM base AS builder
RUN apk add --no-cache libc6-compat

View File

@@ -7,12 +7,13 @@
"build": "pnpm with-env next build",
"clean": "git clean -xdf .next .turbo node_modules",
"dev": "pnpm with-env next dev",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"start": "pnpm with-env next start",
"typecheck": "tsc --noEmit",
"with-env": "dotenv -e ../../.env --"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/analytics": "workspace:^0.1.0",
"@homarr/api": "workspace:^0.1.0",
@@ -40,10 +41,10 @@
"@mantine/tiptap": "^7.12.2",
"@million/lint": "1.0.0-rc.84",
"@t3-oss/env-nextjs": "^0.11.1",
"@tanstack/react-query": "^5.53.1",
"@tanstack/react-query-devtools": "^5.53.1",
"@tanstack/react-query-next-experimental": "5.53.1",
"@tabler/icons-react": "^3.14.0",
"@tanstack/react-query": "^5.55.0",
"@tanstack/react-query-devtools": "^5.55.0",
"@tanstack/react-query-next-experimental": "5.55.0",
"@trpc/client": "next",
"@trpc/next": "next",
"@trpc/react-query": "next",
@@ -59,14 +60,14 @@
"glob": "^11.0.0",
"jotai": "^2.9.3",
"mantine-react-table": "2.0.0-beta.6",
"next": "^14.2.7",
"next": "^14.2.8",
"postcss-preset-mantine": "^1.17.0",
"prismjs": "^1.29.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13",
"react-simple-code-editor": "^0.14.1",
"sass": "^1.77.8",
"sass": "^1.78.0",
"superjson": "2.2.1",
"swagger-ui-react": "^5.17.14",
"use-deep-compare-effect": "^1.8.1"
@@ -76,7 +77,7 @@
"@homarr/prettier-config": "workspace:^0.1.0",
"@homarr/tsconfig": "workspace:^0.1.0",
"@types/chroma-js": "2.4.4",
"@types/node": "^20.16.2",
"@types/node": "^20.16.5",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
@@ -86,6 +87,5 @@
"node-loader": "^2.0.0",
"prettier": "^3.3.3",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -0,0 +1,89 @@
"use client";
import { useState } from "react";
import type { PropsWithChildren } from "react";
import type { MantineColorScheme, MantineColorSchemeManager } from "@mantine/core";
import { createTheme, isMantineColorScheme, MantineProvider } from "@mantine/core";
import { clientApi } from "@homarr/api/client";
import { useSession } from "@homarr/auth/client";
export const CustomMantineProvider = ({ children }: PropsWithChildren) => {
const manager = useColorSchemeManager();
return (
<MantineProvider
defaultColorScheme="auto"
colorSchemeManager={manager}
theme={createTheme({
primaryColor: "red",
autoContrast: true,
})}
>
{children}
</MantineProvider>
);
};
function useColorSchemeManager(): MantineColorSchemeManager {
const key = "homarr-color-scheme";
const { data: session } = useSession();
const [sessionColorScheme, setSessionColorScheme] = useState<MantineColorScheme | undefined>(
session?.user.colorScheme,
);
const { mutate: mutateColorScheme } = clientApi.user.changeColorScheme.useMutation({
onSuccess: (_, variables) => {
setSessionColorScheme(variables.colorScheme);
},
});
let handleStorageEvent: (event: StorageEvent) => void;
return {
get: (defaultValue) => {
if (typeof window === "undefined") {
return defaultValue;
}
if (sessionColorScheme) {
return sessionColorScheme;
}
try {
return (window.localStorage.getItem(key) as MantineColorScheme | undefined) ?? defaultValue;
} catch {
return defaultValue;
}
},
set: (value) => {
try {
if (session) {
mutateColorScheme({ colorScheme: value });
}
window.localStorage.setItem(key, value);
} catch (error) {
console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.", error);
}
},
subscribe: (onUpdate) => {
handleStorageEvent = (event) => {
if (session) return; // Ignore updates when session is available as we are using session color scheme
if (event.storageArea === window.localStorage && event.key === key && isMantineColorScheme(event.newValue)) {
onUpdate(event.newValue);
}
};
window.addEventListener("storage", handleStorageEvent);
},
unsubscribe: () => {
window.removeEventListener("storage", handleStorageEvent);
},
clear: () => {
window.localStorage.removeItem(key);
},
};
}

View File

@@ -12,7 +12,7 @@ import type { AppRouter } from "@homarr/api";
import { clientApi } from "@homarr/api/client";
const wsClient = createWSClient({
url: "ws://localhost:3001",
url: typeof window === "undefined" ? "ws://localhost:3001" : `ws://${window.location.hostname}:3001`,
});
export function TRPCReactProvider(props: PropsWithChildren) {

View File

@@ -1,13 +1,11 @@
import type { Metadata, Viewport } from "next";
import { Inter } from "next/font/google";
import "@homarr/ui/styles.css";
import "@homarr/notifications/styles.css";
import "@homarr/spotlight/styles.css";
import "@homarr/ui/styles.css";
import "~/styles/scroll-area.scss";
import { ColorSchemeScript, createTheme, MantineProvider } from "@mantine/core";
import { env } from "@homarr/auth/env.mjs";
import { auth } from "@homarr/auth/next";
import { ModalProvider } from "@homarr/modals";
@@ -15,6 +13,7 @@ import { Notifications } from "@homarr/notifications";
import { Analytics } from "~/components/layout/analytics";
import { JotaiProvider } from "./_client-providers/jotai";
import { CustomMantineProvider } from "./_client-providers/mantine";
import { NextInternationalProvider } from "./_client-providers/next-international";
import { AuthProvider } from "./_client-providers/session";
import { TRPCReactProvider } from "./_client-providers/trpc";
@@ -51,34 +50,25 @@ export const viewport: Viewport = {
],
};
export default function Layout(props: { children: React.ReactNode; params: { locale: string } }) {
const colorScheme = "dark";
export default async function Layout(props: { children: React.ReactNode; params: { locale: string } }) {
const session = await auth();
const colorScheme = session?.user.colorScheme;
const StackedProvider = composeWrappers([
async (innerProps) => {
const session = await auth();
(innerProps) => {
return <AuthProvider session={session} logoutUrl={env.AUTH_LOGOUT_REDIRECT_URL} {...innerProps} />;
},
(innerProps) => <JotaiProvider {...innerProps} />,
(innerProps) => <TRPCReactProvider {...innerProps} />,
(innerProps) => <NextInternationalProvider {...innerProps} locale={props.params.locale} />,
(innerProps) => (
<MantineProvider
{...innerProps}
defaultColorScheme="dark"
theme={createTheme({
primaryColor: "red",
autoContrast: true,
})}
/>
),
(innerProps) => <CustomMantineProvider {...innerProps} />,
(innerProps) => <ModalProvider {...innerProps} />,
]);
return (
<html lang="en" suppressHydrationWarning>
// Instead of ColorSchemScript we use data-mantine-color-scheme to prevent flickering
<html lang="en" data-mantine-color-scheme={colorScheme} suppressHydrationWarning>
<head>
<ColorSchemeScript defaultColorScheme={colorScheme} />
<Analytics />
</head>
<body className={["font-sans", fontSans.variable].join(" ")}>

View File

@@ -0,0 +1,10 @@
"use client";
import dynamic from "next/dynamic";
export const ClientSideTerminalComponent = dynamic(
() => import("./terminal").then(({ TerminalComponent }) => TerminalComponent),
{
ssr: false,
},
);

View File

@@ -4,11 +4,10 @@ import { getScopedI18n } from "@homarr/translation/server";
import "@xterm/xterm/css/xterm.css";
import dynamic from "next/dynamic";
import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb";
import { fullHeightWithoutHeaderAndFooter } from "~/constants";
import { createMetaTitle } from "~/metadata";
import { ClientSideTerminalComponent } from "./client";
export async function generateMetadata() {
const t = await getScopedI18n("management");
@@ -18,10 +17,6 @@ export async function generateMetadata() {
};
}
const ClientSideTerminalComponent = dynamic(() => import("./terminal"), {
ssr: false,
});
export default function LogsManagementPage() {
return (
<>

View File

@@ -10,7 +10,7 @@ import { clientApi } from "@homarr/api/client";
import classes from "./terminal.module.css";
export default function TerminalComponent() {
export const TerminalComponent = () => {
const ref = useRef<HTMLDivElement>(null);
const terminalRef = useRef<Terminal>();
@@ -54,4 +54,4 @@ export default function TerminalComponent() {
};
}, []);
return <Box ref={ref} id="terminal" className={classes.outerTerminal} h="100%"></Box>;
}
};

View File

@@ -2,25 +2,29 @@
"name": "@homarr/tasks",
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"main": "./src/main.ts",
"types": "./src/main.ts",
"license": "MIT",
"type": "module",
"scripts": {
"dev": "pnpm with-env tsx ./src/main.ts",
"build": "esbuild src/main.ts --bundle --platform=node --outfile=tasks.cjs",
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"dev": "pnpm with-env tsx ./src/main.ts",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit",
"with-env": "dotenv -e ../../.env --"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/analytics": "workspace:^0.1.0",
"@homarr/common": "workspace:^0.1.0",
"@homarr/cron-job-runner": "workspace:^0.1.0",
"@homarr/cron-jobs": "workspace:^0.1.0",
"@homarr/cron-jobs-core": "workspace:^0.1.0",
"@homarr/db": "workspace:^0.1.0",
"@homarr/definitions": "workspace:^0.1.0",
"@homarr/icons": "workspace:^0.1.0",
@@ -30,11 +34,8 @@
"@homarr/redis": "workspace:^0.1.0",
"@homarr/server-settings": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@homarr/cron-jobs-core": "workspace:^0.1.0",
"@homarr/widgets": "workspace:^0.1.0",
"dayjs": "^1.11.13",
"@homarr/cron-jobs": "workspace:^0.1.0",
"@homarr/cron-job-runner": "workspace:^0.1.0",
"dotenv": "^16.4.5",
"superjson": "2.2.1",
"undici": "6.19.8"
@@ -43,12 +44,11 @@
"@homarr/eslint-config": "workspace:^0.2.0",
"@homarr/prettier-config": "workspace:^0.1.0",
"@homarr/tsconfig": "workspace:^0.1.0",
"@types/node": "^20.16.2",
"@types/node": "^20.16.5",
"dotenv-cli": "^7.4.2",
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"tsx": "4.13.3",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -2,19 +2,20 @@
"name": "@homarr/websocket",
"version": "0.1.0",
"private": true,
"main": "./src/main.ts",
"types": "./src/main.ts",
"license": "MIT",
"type": "module",
"main": "./src/main.ts",
"types": "./src/main.ts",
"scripts": {
"dev": "pnpm with-env tsx ./src/main.ts",
"build": "esbuild src/main.ts --bundle --platform=node --outfile=wssServer.cjs --external:bcrypt --external:cpu-features --loader:.html=text --loader:.node=text",
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"dev": "pnpm with-env tsx ./src/main.ts",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit",
"with-env": "dotenv -e ../../.env --"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/api": "workspace:^0.1.0",
"@homarr/auth": "workspace:^0.1.0",
@@ -24,9 +25,9 @@
"@homarr/log": "workspace:^",
"@homarr/redis": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"dotenv": "^16.4.5",
"tsx": "4.13.3",
"ws": "^8.18.0",
"dotenv": "^16.4.5"
"ws": "^8.18.0"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -36,6 +37,5 @@
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,22 +1,17 @@
{
"name": "homarr",
"private": true,
"engines": {
"node": ">=20.17.0"
},
"packageManager": "pnpm@9.9.0",
"scripts": {
"build": "turbo build",
"clean": "git clean -xdf node_modules",
"clean:workspaces": "turbo clean",
"cli": "pnpm with-env tsx packages/cli/index.ts",
"db:migration:mysql:generate": "pnpm -F db migration:mysql:generate",
"db:migration:mysql:run": "pnpm -F db migration:mysql:run",
"db:migration:sqlite:generate": "pnpm -F db migration:sqlite:generate",
"db:migration:sqlite:run": "pnpm -F db migration:sqlite:run",
"db:push": "pnpm -F db push:sqlite",
"db:studio": "pnpm -F db studio",
"db:migration:sqlite:generate": "pnpm -F db migration:sqlite:generate",
"db:migration:mysql:generate": "pnpm -F db migration:mysql:generate",
"db:migration:sqlite:run": "pnpm -F db migration:sqlite:run",
"db:migration:mysql:run": "pnpm -F db migration:mysql:run",
"cli": "pnpm with-env tsx packages/cli/index.ts",
"with-env": "dotenv -e .env --",
"dev": "turbo dev --parallel",
"docker:dev": "docker compose -f ./development/development.docker-compose.yml up",
"format": "turbo format --continue -- --cache --cache-location node_modules/.cache/.prettiercache",
@@ -26,24 +21,29 @@
"lint:ws": "pnpm dlx sherif@latest",
"test": "cross-env NODE_ENV=development vitest run --coverage.enabled",
"test:ui": "cross-env NODE_ENV=development vitest --ui --coverage.enabled",
"typecheck": "turbo typecheck"
"typecheck": "turbo typecheck",
"with-env": "dotenv -e .env --"
},
"prettier": "@homarr/prettier-config",
"devDependencies": {
"@homarr/prettier-config": "workspace:^0.1.0",
"@turbo/gen": "^2.1.0",
"@turbo/gen": "^2.1.1",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/ui": "^2.0.5",
"cross-env": "^7.0.3",
"jsdom": "^25.0.0",
"prettier": "^3.3.3",
"testcontainers": "^10.12.0",
"turbo": "^2.1.0",
"testcontainers": "^10.13.0",
"turbo": "^2.1.1",
"typescript": "^5.5.4",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.0.5"
},
"prettier": "@homarr/prettier-config",
"packageManager": "pnpm@9.9.0",
"engines": {
"node": ">=20.17.0"
},
"pnpm": {
"patchedDependencies": {
"trpc-swagger@1.2.6": "patches/trpc-swagger@1.2.6.patch"

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/analytics",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,19 +14,19 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@umami/node": "^0.4.0",
"superjson": "2.2.1",
"@homarr/db": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0",
"@homarr/server-settings": "workspace:^0.1.0"
"@homarr/server-settings": "workspace:^0.1.0",
"@umami/node": "^0.4.0",
"superjson": "2.2.1"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -33,6 +34,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,45 +1,46 @@
{
"name": "@homarr/api",
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./src/index.ts",
"./client": "./src/client.ts",
"./server": "./src/server.ts",
"./websocket": "./src/websocket.ts"
},
"private": true,
"main": "./index.ts",
"types": "./index.ts",
"license": "MIT",
"type": "module",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/auth": "workspace:^0.1.0",
"@homarr/common": "workspace:^0.1.0",
"@homarr/cron-jobs": "workspace:^0.1.0",
"@homarr/cron-job-runner": "workspace:^0.1.0",
"@homarr/cron-job-status": "workspace:^0.1.0",
"@homarr/cron-jobs": "workspace:^0.1.0",
"@homarr/db": "workspace:^0.1.0",
"@homarr/definitions": "workspace:^0.1.0",
"@homarr/integrations": "workspace:^0.1.0",
"@homarr/log": "workspace:^",
"@homarr/ping": "workspace:^0.1.0",
"@homarr/redis": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@homarr/server-settings": "workspace:^0.1.0",
"@trpc/react-query": "next",
"@homarr/validation": "workspace:^0.1.0",
"@trpc/client": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
"dockerode": "^4.0.2",
"next": "^14.2.8",
"react": "^18.3.1",
"superjson": "2.2.1",
"trpc-swagger": "^1.2.6",
"next": "^14.2.7",
"react": "^18.3.1"
"trpc-swagger": "^1.2.6"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -49,6 +50,5 @@
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -30,6 +30,7 @@ const defaultSession = {
user: {
id: defaultCreatorId,
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -87,6 +88,7 @@ describe("getAllBoards should return all boards accessable to the current user",
user: {
id: defaultCreatorId,
permissions: ["board-view-all"],
colorScheme: "light",
},
expires: new Date().toISOString(),
},

View File

@@ -29,6 +29,7 @@ const createSessionWithPermissions = (...permissions: GroupPermissionKey[]) =>
user: {
id: "1",
permissions,
colorScheme: "light",
},
expires: new Date().toISOString(),
}) satisfies Session;

View File

@@ -12,6 +12,7 @@ const defaultSession = {
user: {
id: defaultOwnerId,
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;

View File

@@ -17,6 +17,7 @@ const defaultSessionWithPermissions = (permissions: GroupPermissionKey[] = []) =
user: {
id: defaultUserId,
permissions,
colorScheme: "light",
},
expires: new Date().toISOString(),
}) satisfies Session;

View File

@@ -12,6 +12,7 @@ const defaultSession = {
user: {
id: createId(),
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;

View File

@@ -16,6 +16,7 @@ const defaultSession = {
user: {
id: createId(),
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;

View File

@@ -246,6 +246,7 @@ describe("editProfile shoud update user", () => {
image: null,
homeBoardId: null,
provider: "credentials",
colorScheme: "auto",
});
});
@@ -287,6 +288,7 @@ describe("editProfile shoud update user", () => {
image: null,
homeBoardId: null,
provider: "credentials",
colorScheme: "auto",
});
});
});
@@ -312,6 +314,7 @@ describe("delete should delete user", () => {
salt: null,
homeBoardId: null,
provider: "ldap" as const,
colorScheme: "auto" as const,
},
{
id: userToDelete,
@@ -322,6 +325,7 @@ describe("delete should delete user", () => {
password: null,
salt: null,
homeBoardId: null,
colorScheme: "auto" as const,
},
{
id: createId(),
@@ -333,6 +337,7 @@ describe("delete should delete user", () => {
salt: null,
homeBoardId: null,
provider: "oidc" as const,
colorScheme: "auto" as const,
},
];

View File

@@ -317,6 +317,14 @@ export const userRouter = createTRPCRouter({
})
.where(eq(users.id, input.userId));
}),
changeColorScheme: protectedProcedure.input(validation.user.changeColorScheme).mutation(async ({ input, ctx }) => {
await ctx.db
.update(users)
.set({
colorScheme: input.colorScheme,
})
.where(eq(users.id, ctx.session.user.id));
}),
});
const createUserAsync = async (db: Database, input: z.infer<typeof validation.user.create>) => {

View File

@@ -4,7 +4,7 @@ import type { NextAuthConfig } from "next-auth";
import type { Database } from "@homarr/db";
import { eq, inArray } from "@homarr/db";
import { groupMembers, groupPermissions } from "@homarr/db/schema/sqlite";
import { groupMembers, groupPermissions, users } from "@homarr/db/schema/sqlite";
import { getPermissionsWithChildren } from "@homarr/definitions";
import { env } from "./env.mjs";
@@ -31,10 +31,18 @@ export const getCurrentUserPermissionsAsync = async (db: Database, userId: strin
export const createSessionCallback = (db: Database): NextAuthCallbackOf<"session"> => {
return async ({ session, user }) => {
const additionalProperties = await db.query.users.findFirst({
where: eq(users.id, user.id),
columns: {
colorScheme: true,
},
});
return {
...session,
user: {
...session.user,
...additionalProperties,
id: user.id,
name: user.name,
permissions: await getCurrentUserPermissionsAsync(db, user.id),

View File

@@ -1,7 +1,7 @@
import { headers } from "next/headers";
import type { DefaultSession } from "@auth/core/types";
import type { GroupPermissionKey } from "@homarr/definitions";
import type { ColorScheme, GroupPermissionKey } from "@homarr/definitions";
import { createConfiguration } from "./configuration";
@@ -12,6 +12,7 @@ declare module "next-auth" {
user: {
id: string;
permissions: GroupPermissionKey[];
colorScheme: ColorScheme;
} & DefaultSession["user"];
}
}

View File

@@ -1,6 +1,8 @@
{
"name": "@homarr/auth",
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -11,29 +13,28 @@
"./shared": "./shared.ts",
"./env.mjs": "./env.mjs"
},
"private": true,
"main": "./index.ts",
"types": "./index.ts",
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/db": "workspace:^0.1.0",
"@auth/core": "^0.34.2",
"@auth/drizzle-adapter": "^1.4.2",
"@homarr/common": "workspace:^0.1.0",
"@homarr/db": "workspace:^0.1.0",
"@homarr/definitions": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@auth/core": "^0.34.2",
"@auth/drizzle-adapter": "^1.4.2",
"@t3-oss/env-nextjs": "^0.11.1",
"bcrypt": "^5.1.1",
"cookies": "^0.9.1",
"ldapts": "7.1.1",
"next": "^14.2.7",
"next": "^14.2.8",
"next-auth": "5.0.0-beta.20",
"react": "^18.3.1",
"react-dom": "^18.3.1"
@@ -47,6 +48,5 @@
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -20,6 +20,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "1",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -47,6 +48,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: getPermissionsWithChildren(["board-full-all"]),
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -74,6 +76,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: getPermissionsWithChildren(["board-modify-all"]),
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -102,6 +105,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -129,6 +133,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -156,6 +161,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: getPermissionsWithChildren(["board-view-all"]),
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -183,6 +189,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -210,6 +217,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -237,6 +245,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -264,6 +273,7 @@ describe("constructBoardPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;

View File

@@ -16,6 +16,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: getPermissionsWithChildren(["integration-full-all"]),
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -39,6 +40,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: getPermissionsWithChildren(["integration-interact-all"]),
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -62,6 +64,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -85,6 +88,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -108,6 +112,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: getPermissionsWithChildren(["integration-use-all"]),
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -131,6 +136,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -154,6 +160,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -177,6 +184,7 @@ describe("constructIntegrationPermissions", () => {
user: {
id: "2",
permissions: [],
colorScheme: "light",
},
expires: new Date().toISOString(),
} satisfies Session;
@@ -190,40 +198,3 @@ describe("constructIntegrationPermissions", () => {
expect(result.hasUseAccess).toBe(false);
});
});
/*
test("should return hasViewAccess as true when board is public", () => {
// Arrange
const board = {
creator: {
id: "1",
},
userPermissions: [],
groupPermissions: [],
isPublic: true,
};
const session = {
user: {
id: "2",
permissions: [],
},
expires: new Date().toISOString(),
} satisfies Session;
// Act
const result = constructBoardPermissions(board, session);
// Assert
expect(result.hasFullAccess).toBe(false);
expect(result.hasChangeAccess).toBe(false);
expect(result.hasViewAccess).toBe(true);
});
});
*/

View File

@@ -20,6 +20,7 @@ const createSession = (user: Partial<Session["user"]>): Session => ({
user: {
id: "1",
permissions: [],
colorScheme: "light",
...user,
},
expires: new Date().toISOString(),

View File

@@ -32,6 +32,7 @@ export const getSessionFromTokenAsync = async (db: Database, token: string | und
name: true,
email: true,
image: true,
colorScheme: true,
},
},
},

View File

@@ -101,6 +101,7 @@ describe("session callback", () => {
email: "no-email",
emailVerified: new Date("2023-01-13"),
permissions: [],
colorScheme: "dark",
},
expires: "2023-01-13" as Date & string,
sessionToken: "token",

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/cli",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,19 +14,19 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"build": "esbuild src/index.ts --bundle --platform=node --outfile=cli.cjs --external:bcrypt --external:cpu-features --loader:.html=text --loader:.node=text",
"clean": "rm -rf .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@drizzle-team/brocli": "^0.10.1",
"@homarr/db": "workspace:^0.1.0",
"@homarr/common": "workspace:^0.1.0",
"@homarr/auth": "workspace:^0.1.0",
"@homarr/common": "workspace:^0.1.0",
"@homarr/db": "workspace:^0.1.0",
"dotenv": "^16.4.5"
},
"devDependencies": {
@@ -34,6 +35,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/common",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -16,18 +17,18 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"dayjs": "^1.11.13",
"next": "^14.2.7",
"next": "^14.2.8",
"react": "^18.3.1",
"tldts": "^6.1.41"
"tldts": "^6.1.42"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -35,6 +36,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/cron-job-runner",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,13 +14,13 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/cron-jobs": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0",
@@ -31,6 +32,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/cron-job-status",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -14,13 +15,13 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/redis": "workspace:^0.1.0"
},
@@ -30,6 +31,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/cron-jobs-core",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -15,16 +16,16 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"node-cron": "^3.0.3",
"@homarr/common": "workspace:^0.1.0"
"@homarr/common": "workspace:^0.1.0",
"node-cron": "^3.0.3"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -33,6 +34,5 @@
"@types/node-cron": "^3.0.11",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/cron-jobs",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,13 +14,13 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@extractus/feed-extractor": "^7.1.3",
"@homarr/analytics": "workspace:^0.1.0",
@@ -42,6 +43,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -0,0 +1 @@
ALTER TABLE `user` ADD `colorScheme` varchar(5) DEFAULT 'auto' NOT NULL;

File diff suppressed because it is too large Load Diff

View File

@@ -50,6 +50,13 @@
"when": 1722517058725,
"tag": "0006_young_micromax",
"breakpoints": true
},
{
"idx": 7,
"version": "5",
"when": 1723749320706,
"tag": "0007_boring_nocturne",
"breakpoints": true
}
]
}

View File

@@ -0,0 +1 @@
ALTER TABLE `user` ADD `colorScheme` text DEFAULT 'auto' NOT NULL;

File diff suppressed because it is too large Load Diff

View File

@@ -50,6 +50,13 @@
"when": 1722517033483,
"tag": "0006_windy_doctor_faustus",
"breakpoints": true
},
{
"idx": 7,
"version": "6",
"when": 1723746828385,
"tag": "0007_known_ultragirl",
"breakpoints": true
}
]
}

View File

@@ -1,6 +1,8 @@
{
"name": "@homarr/db",
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -9,37 +11,36 @@
"./test": "./test/index.ts",
"./queries": "./queries/index.ts"
},
"private": true,
"main": "./index.ts",
"types": "./index.ts",
"license": "MIT",
"scripts": {
"build": "pnpm run build:sqlite && pnpm run build:mysql",
"build:sqlite": "esbuild migrations/sqlite/migrate.ts --bundle --platform=node --outfile=migrations/sqlite/migrate.cjs",
"build:mysql": "esbuild migrations/mysql/migrate.ts --bundle --platform=node --outfile=migrations/mysql/migrate.cjs",
"build:sqlite": "esbuild migrations/sqlite/migrate.ts --bundle --platform=node --outfile=migrations/sqlite/migrate.cjs",
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"migration:sqlite:generate": "drizzle-kit generate --config ./configs/sqlite.config.ts",
"migration:sqlite:run": "drizzle-kit migrate --config ./configs/sqlite.config.ts",
"lint": "eslint",
"migration:mysql:generate": "drizzle-kit generate --config ./configs/mysql.config.ts",
"migration:mysql:run": "drizzle-kit migrate --config ./configs/mysql.config.ts",
"push:sqlite": "drizzle-kit push --config ./configs/sqlite.config.ts",
"migration:sqlite:generate": "drizzle-kit generate --config ./configs/sqlite.config.ts",
"migration:sqlite:run": "drizzle-kit migrate --config ./configs/sqlite.config.ts",
"push:mysql": "drizzle-kit push --config ./configs/mysql.config.ts",
"push:sqlite": "drizzle-kit push --config ./configs/sqlite.config.ts",
"studio": "drizzle-kit studio --config ./configs/sqlite.config.ts",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@auth/core": "^0.34.2",
"@homarr/common": "workspace:^0.1.0",
"@homarr/definitions": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0",
"@paralleldrive/cuid2": "^2.2.2",
"@auth/core": "^0.34.2",
"better-sqlite3": "^11.2.1",
"drizzle-orm": "^0.33.0",
"dotenv": "^16.4.5",
"mysql2": "3.11.0",
"drizzle-kit": "^0.24.2"
"drizzle-kit": "^0.24.2",
"drizzle-orm": "^0.33.0",
"mysql2": "3.11.0"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -50,6 +51,5 @@
"eslint": "^9.9.1",
"prettier": "^3.3.3",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -8,6 +8,7 @@ import type {
BackgroundImageRepeat,
BackgroundImageSize,
BoardPermission,
ColorScheme,
GroupPermissionKey,
IntegrationKind,
IntegrationPermission,
@@ -30,6 +31,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(),
});
export const accounts = mysqlTable(

View File

@@ -10,6 +10,7 @@ import type {
BackgroundImageRepeat,
BackgroundImageSize,
BoardPermission,
ColorScheme,
GroupPermissionKey,
IntegrationKind,
IntegrationPermission,
@@ -31,6 +32,7 @@ export const users = sqliteTable("user", {
homeBoardId: text("homeBoardId").references((): AnySQLiteColumn => boards.id, {
onDelete: "set null",
}),
colorScheme: text("colorScheme").$type<ColorScheme>().default("auto").notNull(),
});
export const accounts = sqliteTable(

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/definitions",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,13 +14,13 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/common": "workspace:^0.1.0"
},
@@ -29,6 +30,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -5,3 +5,4 @@ export * from "./widget";
export * from "./permissions";
export * from "./docker";
export * from "./auth";
export * from "./user";

View File

@@ -63,6 +63,12 @@ export const integrationDefs = {
iconUrl: "https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/readarr.png",
category: ["calendar"],
},
prowlarr: {
name: "Prowlarr",
secretKinds: [["apiKey"]],
iconUrl: "https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prowlarr.png",
category: ["indexerManager"],
},
jellyfin: {
name: "Jellyfin",
secretKinds: [["username", "password"], ["apiKey"]],
@@ -103,7 +109,7 @@ export const integrationDefs = {
name: "Home Assistant",
secretKinds: [["apiKey"]],
iconUrl: "https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/home-assistant.png",
category: [],
category: ["smartHomeServer"],
},
} satisfies Record<
string,
@@ -138,4 +144,5 @@ export type IntegrationCategory =
| "mediaRequest"
| "downloadClient"
| "useNetClient"
| "smartHomeServer";
| "smartHomeServer"
| "indexerManager";

View File

@@ -0,0 +1,2 @@
export const colorSchemes = ["light", "dark", "auto"] as const;
export type ColorScheme = (typeof colorSchemes)[number];

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/form",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,17 +14,17 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@mantine/form": "^7.12.2",
"@homarr/translation": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@homarr/translation": "workspace:^0.1.0"
"@mantine/form": "^7.12.2"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -31,6 +32,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/icons",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,16 +14,16 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/log": "workspace:^0.1.0",
"@homarr/common": "workspace:^0.1.0"
"@homarr/common": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -30,6 +31,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,9 @@
{
"name": "@homarr/integrations",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
"./client": "./src/client.ts",
@@ -14,21 +16,20 @@
]
}
},
"license": "MIT",
"type": "module",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/common": "workspace:^0.1.0",
"@homarr/definitions": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0",
"@homarr/translation": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@jellyfin/sdk": "^0.10.0",
"@homarr/translation": "workspace:^0.1.0"
"@jellyfin/sdk": "^0.10.0"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -36,6 +37,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -7,6 +7,7 @@ import { JellyseerrIntegration } from "../jellyseerr/jellyseerr-integration";
import { SonarrIntegration } from "../media-organizer/sonarr/sonarr-integration";
import { OverseerrIntegration } from "../overseerr/overseerr-integration";
import { PiHoleIntegration } from "../pi-hole/pi-hole-integration";
import { ProwlarrIntegration } from "../prowlarr/prowlarr-integration";
import type { Integration, IntegrationInput } from "./integration";
export const integrationCreatorByKind = <TKind extends keyof typeof integrationCreators>(
@@ -28,4 +29,5 @@ export const integrationCreators = {
sonarr: SonarrIntegration,
jellyseerr: JellyseerrIntegration,
overseerr: OverseerrIntegration,
prowlarr: ProwlarrIntegration,
} satisfies Partial<Record<IntegrationKind, new (integration: IntegrationInput) => Integration>>;

View File

@@ -0,0 +1,12 @@
export interface Indexer {
id: number;
name: string;
url: string;
/**
* Enabled: when the user enable / disable the indexer.
* Status: when there is an error with the indexer site.
* If one of the options are false the indexer is off.
*/
enabled: boolean;
status: boolean;
}

View File

@@ -0,0 +1,99 @@
import { Integration } from "../base/integration";
import { IntegrationTestConnectionError } from "../base/test-connection-error";
import type { Indexer } from "../interfaces/indexer-manager/indexer";
import { indexerResponseSchema, statusResponseSchema } from "./prowlarr-types";
export class ProwlarrIntegration extends Integration {
public async getIndexersAsync(): Promise<Indexer[]> {
const apiKey = super.getSecretValue("apiKey");
const indexerResponse = await fetch(`${this.integration.url}/api/v1/indexer`, {
headers: {
"X-Api-Key": apiKey,
},
});
if (!indexerResponse.ok) {
throw new Error(
`Failed to fetch indexers for ${this.integration.name} (${this.integration.id}): ${indexerResponse.statusText}`,
);
}
const statusResponse = await fetch(`${this.integration.url}/api/v1/indexerstatus`, {
headers: {
"X-Api-Key": apiKey,
},
});
if (!statusResponse.ok) {
throw new Error(
`Failed to fetch status for ${this.integration.name} (${this.integration.id}): ${statusResponse.statusText}`,
);
}
const indexersResult = indexerResponseSchema.array().safeParse(await indexerResponse.json());
const statusResult = statusResponseSchema.safeParse(await statusResponse.json());
const errorMessages: string[] = [];
if (!indexersResult.success) {
errorMessages.push(`Indexers parsing error: ${indexersResult.error.message}`);
}
if (!statusResult.success) {
errorMessages.push(`Status parsing error: ${statusResult.error.message}`);
}
if (!indexersResult.success || !statusResult.success) {
throw new Error(
`Failed to parse indexers for ${this.integration.name} (${this.integration.id}), most likely your api key is wrong:\n${errorMessages.join("\n")}`,
);
}
const inactiveIndexerIds = new Set(statusResult.data.map((status: { id: number }) => status.id));
const indexers: Indexer[] = indexersResult.data.map((indexer) => ({
id: indexer.id,
name: indexer.name,
url: indexer.indexerUrls[0] ?? "",
enabled: indexer.enable,
status: inactiveIndexerIds.has(indexer.id),
}));
return indexers;
}
public async testAllAsync(): Promise<void> {
const apiKey = super.getSecretValue("apiKey");
const response = await fetch(`${this.integration.url}/api/v1/indexer/testall`, {
headers: {
"X-Api-Key": apiKey,
},
});
if (!response.ok) {
throw new Error(
`Failed to test all indexers for ${this.integration.name} (${this.integration.id}): ${response.statusText}`,
);
}
}
public async testConnectionAsync(): Promise<void> {
const apiKey = super.getSecretValue("apiKey");
await super.handleTestConnectionResponseAsync({
queryFunctionAsync: async () => {
return await fetch(`${this.integration.url}/api`, {
headers: {
"X-Api-Key": apiKey,
},
});
},
handleResponseAsync: async (response) => {
try {
const result = (await response.json()) as unknown;
if (typeof result === "object" && result !== null) return;
} catch {
throw new IntegrationTestConnectionError("invalidJson");
}
throw new IntegrationTestConnectionError("invalidCredentials");
},
});
}
}

View File

@@ -0,0 +1,14 @@
import { z } from "@homarr/validation";
export const indexerResponseSchema = z.object({
id: z.number(),
indexerUrls: z.array(z.string()),
name: z.string(),
enable: z.boolean(),
});
export const statusResponseSchema = z.array(
z.object({
id: z.number(),
}),
);

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/log",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": {
@@ -17,13 +18,13 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"ioredis": "5.4.1",
"superjson": "2.2.1",
@@ -35,6 +36,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/modals",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
@@ -13,19 +14,19 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/ui": "workspace:^0.1.0",
"@homarr/translation": "workspace:^0.1.0",
"react": "^18.3.1",
"@homarr/ui": "workspace:^0.1.0",
"@mantine/core": "^7.12.2",
"@mantine/hooks": "^7.12.2"
"@mantine/hooks": "^7.12.2",
"react": "^18.3.1"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -33,6 +34,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/notifications",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -14,16 +15,16 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@mantine/notifications": "^7.12.2",
"@homarr/ui": "workspace:^0.1.0",
"@mantine/notifications": "^7.12.2",
"@tabler/icons-react": "^3.14.0"
},
"devDependencies": {
@@ -32,6 +33,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,9 @@
{
"name": "@homarr/ping",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
},
@@ -12,14 +14,13 @@
]
}
},
"license": "MIT",
"type": "module",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/common": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0"
@@ -30,6 +31,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,9 @@
{
"name": "@homarr/redis",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
},
@@ -12,21 +14,20 @@
]
}
},
"license": "MIT",
"type": "module",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"ioredis": "5.4.1",
"superjson": "2.2.1",
"@homarr/log": "workspace:^",
"@homarr/db": "workspace:^",
"@homarr/common": "workspace:^",
"@homarr/definitions": "workspace:^"
"@homarr/db": "workspace:^",
"@homarr/definitions": "workspace:^",
"@homarr/log": "workspace:^",
"ioredis": "5.4.1",
"superjson": "2.2.1"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -34,6 +35,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,9 @@
{
"name": "@homarr/server-settings",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts"
},
@@ -12,20 +14,18 @@
]
}
},
"type": "module",
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
"@homarr/prettier-config": "workspace:^0.1.0",
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/spotlight",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -14,22 +15,22 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/ui": "workspace:^0.1.0",
"@homarr/translation": "workspace:^0.1.0",
"@homarr/ui": "workspace:^0.1.0",
"@mantine/core": "^7.12.2",
"@mantine/hooks": "^7.12.2",
"@mantine/spotlight": "^7.12.2",
"@tabler/icons-react": "^3.14.0",
"jotai": "^2.9.3",
"next": "^14.2.7",
"next": "^14.2.8",
"react": "^18.3.1",
"use-deep-compare-effect": "^1.8.1"
},
@@ -39,6 +40,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/translation",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -16,13 +17,13 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"dayjs": "^1.11.13",
"mantine-react-table": "2.0.0-beta.6",
@@ -34,6 +35,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/ui",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -15,24 +16,24 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@homarr/log": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@homarr/common": "workspace:^0.1.0",
"@homarr/log": "workspace:^0.1.0",
"@homarr/translation": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@mantine/core": "^7.12.2",
"@mantine/dates": "^7.12.2",
"@mantine/hooks": "^7.12.2",
"@tabler/icons-react": "^3.14.0",
"mantine-react-table": "2.0.0-beta.6",
"next": "^14.2.7",
"next": "^14.2.8",
"react": "^18.3.1"
},
"devDependencies": {
@@ -42,6 +43,5 @@
"@types/css-modules": "^1.0.5",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/validation",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -14,17 +15,17 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"zod": "^3.23.8",
"@homarr/definitions": "workspace:^0.1.0",
"@homarr/translation": "workspace:^0.1.0"
"@homarr/translation": "workspace:^0.1.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
@@ -32,6 +33,5 @@
"@homarr/tsconfig": "workspace:^0.1.0",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,9 @@
import { z } from "zod";
import { colorSchemes } from "@homarr/definitions";
import type { TranslationObject } from "@homarr/translation";
import { zodEnumFromArray } from "./enums";
import { createCustomErrorParams } from "./form/i18n";
const usernameSchema = z.string().min(3).max(255);
@@ -98,6 +100,10 @@ const changeHomeBoardSchema = z.object({
homeBoardId: z.string().min(1),
});
const changeColorSchemeSchema = z.object({
colorScheme: zodEnumFromArray(colorSchemes),
});
export const userSchemas = {
signIn: signInSchema,
registration: registrationSchema,
@@ -109,4 +115,5 @@ export const userSchemas = {
changePassword: changePasswordSchema,
changeHomeBoard: changeHomeBoardSchema,
changePasswordApi: changePasswordApiSchema,
changeColorScheme: changeColorSchemeSchema,
};

View File

@@ -1,7 +1,8 @@
{
"name": "@homarr/widgets",
"private": true,
"version": "0.1.0",
"private": true,
"license": "MIT",
"type": "module",
"exports": {
".": "./index.ts",
@@ -14,13 +15,13 @@
]
}
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"lint": "eslint",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"typecheck": "tsc --noEmit"
},
"prettier": "@homarr/prettier-config",
"dependencies": {
"@extractus/feed-extractor": "^7.1.3",
"@homarr/api": "workspace:^0.1.0",
@@ -35,8 +36,8 @@
"@homarr/translation": "workspace:^0.1.0",
"@homarr/ui": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@mantine/hooks": "^7.12.2",
"@mantine/core": "^7.12.2",
"@mantine/hooks": "^7.12.2",
"@tabler/icons-react": "^3.14.0",
"@tiptap/extension-color": "2.6.6",
"@tiptap/extension-highlight": "2.6.6",
@@ -55,8 +56,8 @@
"@tiptap/starter-kit": "^2.6.6",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"next": "^14.2.7",
"mantine-react-table": "2.0.0-beta.6",
"next": "^14.2.8",
"react": "^18.3.1",
"video.js": "^8.17.3"
},
@@ -67,6 +68,5 @@
"@types/video.js": "^7.3.58",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
},
"prettier": "@homarr/prettier-config"
}
}

View File

@@ -1,7 +1,7 @@
"use client";
import { useEffect, useState } from "react";
import { ActionIcon, Badge, Box, Button, Card, Flex, Image, Stack, Text, Tooltip, UnstyledButton } from "@mantine/core";
import { ActionIcon, Badge, Button, Card, Flex, Image, Stack, Text, Tooltip, UnstyledButton } from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconClockPause, IconPlayerPlay, IconPlayerStop } from "@tabler/icons-react";
@@ -76,7 +76,7 @@ export default function DnsHoleControlsWidget({ options, integrationIds }: Widge
return (
<Flex h="100%" direction="column" gap={0} p="2.5cqmin">
{options.showToggleAllButtons && (
<Flex gap="2.5cqmin">
<Flex m="2.5cqmin" gap="2.5cqmin">
<Tooltip label={t("widget.dnsHoleControls.controls.enableAll")}>
<Button
onClick={() => disabledIntegrations.forEach((integrationId) => enableDns({ integrationId }))}
@@ -121,7 +121,7 @@ export default function DnsHoleControlsWidget({ options, integrationIds }: Widge
</Flex>
)}
<Stack gap="2.5cqmin" flex={1} justify={options.showToggleAllButtons ? "flex-end" : "space-evenly"}>
<Stack m="2.5cqmin" gap="2.5cqmin" flex={1} justify={options.showToggleAllButtons ? "flex-end" : "space-evenly"}>
{data.map((integrationData) => (
<ControlsCard
key={integrationData.integrationId}
@@ -171,11 +171,9 @@ const ControlsCard: React.FC<ControlsCardProps> = ({
return (
<Card key={integrationId} withBorder p="2.5cqmin" radius="2.5cqmin">
<Flex>
<Box m="1.5cqmin" p="1.5cqmin">
<Image src={integrationDef.iconUrl} width="50cqmin" height="50cqmin" fit="contain" />
</Box>
<Flex direction="column" m="1.5cqmin" p="1.5cqmin" gap="1cqmin">
<Flex justify="space-between" align="center" direction="row" m="2.5cqmin">
<Image src={integrationDef.iconUrl} width="50cqmin" height="50cqmin" fit="contain" />
<Flex direction="column">
<Text>{integrationDef.name}</Text>
<Flex direction="row" gap="2cqmin">
<UnstyledButton onClick={() => toggleDns(integrationId)}>

702
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -16,14 +16,14 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@next/eslint-plugin-next": "^14.2.7",
"@next/eslint-plugin-next": "^14.2.8",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.35.0",
"eslint-config-turbo": "^2.1.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^4.6.2",
"typescript-eslint": "^8.3.0"
"typescript-eslint": "^8.4.0"
},
"devDependencies": {
"@homarr/prettier-config": "workspace:^0.1.0",