Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): automatic release v0.1.0 #960

Merged
merged 42 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
65c6854
feat: dnshole controls widget (#867)
hillaliy Aug 4, 2024
0cec1db
fix: Fix typecheck, lint issues and errors brought to dnshole summary…
SeDemal Aug 4, 2024
b8b084c
fix: restrict access to docker containers page to admins (#912)
Meierschlumpf Aug 4, 2024
b53a2b6
feat: add refresh button to docker containers table (#913)
Meierschlumpf Aug 4, 2024
ca1ecdf
feat: add preview to icon picker (#914)
Meierschlumpf Aug 4, 2024
7fa5e70
feat: reset password cli (#903)
Meierschlumpf Aug 4, 2024
796261c
fix(deps): update dependency video.js to ^8.17.2 (#917)
homarr-renovate[bot] Aug 5, 2024
d378ddb
fix(deps): update dependency drizzle-kit to ^0.23.2 (#918)
homarr-renovate[bot] Aug 5, 2024
3f35163
fix(deps): update dependency drizzle-orm to ^0.32.2 (#919)
homarr-renovate[bot] Aug 5, 2024
137ebf6
fix(deps): update mantine monorepo to ^7.12.0 (#920)
homarr-renovate[bot] Aug 5, 2024
c69483a
fix(deps): update dependency typescript-eslint to ^8.0.1 (#921)
homarr-renovate[bot] Aug 5, 2024
c6bb272
fix(deps): update tiptap monorepo to v2.5.9 (#922)
homarr-renovate[bot] Aug 6, 2024
693e319
chore(deps): update turbo monorepo to ^2.0.12 (#923)
homarr-renovate[bot] Aug 6, 2024
c4c4d41
feat: add support for app url variables (#915)
Meierschlumpf Aug 6, 2024
a2be781
fix(deps): update dependency tldts to ^6.1.38 (#931)
homarr-renovate[bot] Aug 6, 2024
d4c2bd2
chore(deps): update pnpm to v9.7.0 (#932)
homarr-renovate[bot] Aug 7, 2024
4471260
feat: AdGuard Home integration (#929)
hillaliy Aug 7, 2024
c2bf677
fix(deps): update dependency jotai to ^2.9.2 (#933)
homarr-renovate[bot] Aug 8, 2024
ac4b4ed
fix(deps): update dependency winston to v3.14.0 (#935)
homarr-renovate[bot] Aug 8, 2024
c399d83
fix(deps): update dependency drizzle-orm to ^0.33.0 (#938)
homarr-renovate[bot] Aug 8, 2024
940a489
fix(deps): update dependency drizzle-kit to ^0.24.0 (#939)
homarr-renovate[bot] Aug 8, 2024
f9e2df0
fix(deps): update tanstack-query monorepo to ^5.51.23 (#936)
homarr-renovate[bot] Aug 8, 2024
365e267
fix: ping urls are not reset when restarting (#924)
Meierschlumpf Aug 8, 2024
81946e5
feat: add duplication action for items (#926)
Meierschlumpf Aug 8, 2024
9258c39
fix: alert that certain fields in user settings are disabled is alway…
Meierschlumpf Aug 8, 2024
013c0c0
chore(deps): update dependency vite-tsconfig-paths to v5 (#934)
homarr-renovate[bot] Aug 8, 2024
a80b49a
fix(deps): update dependency @drizzle-team/brocli to ^0.10.0 (#937)
homarr-renovate[bot] Aug 8, 2024
017c378
fix: renovate approval run for all pull requests on every pull reques…
Meierschlumpf Aug 8, 2024
db9c200
fix(deps): update dependency winston to v3.14.1 (#941)
homarr-renovate[bot] Aug 8, 2024
c833f2c
fix: github actor name for automatic approval wrong (#943)
Meierschlumpf Aug 8, 2024
e18c773
chore(deps): update dependency vite-tsconfig-paths to ^5.0.1 (#946)
homarr-renovate[bot] Aug 9, 2024
21c0e4b
fix(deps): update dependency @tabler/icons-react to ^3.12.0 (#944)
homarr-renovate[bot] Aug 9, 2024
ab7d3f8
fix: renovate approval workflow not running (#948)
Meierschlumpf Aug 9, 2024
25452ff
feat: change visibility in item options based on selected integration…
Meierschlumpf Aug 9, 2024
6dafbaa
feat: add session expiry (#951)
Meierschlumpf Aug 9, 2024
349c494
fix: redirect url from login not working (#952)
Meierschlumpf Aug 9, 2024
fcb72e6
feat: add column count and is public options to board creation modal …
Meierschlumpf Aug 9, 2024
67195c6
fix: wrong id for renovate auto approval (#957)
Meierschlumpf Aug 9, 2024
13e0996
feat: add logout redirect url (#954)
Meierschlumpf Aug 9, 2024
f327837
feat: add user setting for home board (#956)
Meierschlumpf Aug 9, 2024
3be1100
fix(deps): update dependency undici to v6.19.7 (#950)
homarr-renovate[bot] Aug 9, 2024
f6e5518
chore(deps): update dependency @types/node to ^20.14.15 (#958)
homarr-renovate[bot] Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/renovate-automatic-approval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
approve-renovate-prs:
runs-on: ubuntu-latest
if: github.actor_id == 158783068 # Id of renovate bot see https://api.github.com/users/homarr-renovate%5Bbot%5D
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -21,6 +22,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ steps.obtainToken.outputs.token }}
run: |
for pr in $(gh pr list --author homarr-renovate[bot] --json number --jq .[].number); do
gh pr review $pr --approve --body "Automatically approved by GitHub Action"
done
gh pr review ${{github.event.pull_request.number}} --approve --body "Automatically approved by GitHub Action"
18 changes: 16 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN turbo prune @homarr/nextjs --docker --out-dir ./next-out
RUN turbo prune @homarr/tasks --docker --out-dir ./tasks-out
RUN turbo prune @homarr/websocket --docker --out-dir ./websocket-out
RUN turbo prune @homarr/db --docker --out-dir ./migration-out
RUN turbo prune @homarr/cli --docker --out-dir ./cli-out

# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
Expand All @@ -34,6 +35,10 @@ COPY --from=builder /app/migration-out/json/ .
COPY --from=builder /app/migration-out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN corepack enable pnpm && pnpm install

COPY --from=builder /app/cli-out/json/ .
COPY --from=builder /app/cli-out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN corepack enable pnpm && pnpm install

COPY --from=builder /app/next-out/json/ .
COPY --from=builder /app/next-out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN corepack enable pnpm && pnpm install
Expand All @@ -45,6 +50,7 @@ COPY --from=builder /app/tasks-out/full/ .
COPY --from=builder /app/websocket-out/full/ .
COPY --from=builder /app/next-out/full/ .
COPY --from=builder /app/migration-out/full/ .
COPY --from=builder /app/cli-out/full/ .

# Copy static data as it is not part of the build
COPY static-data ./static-data
Expand All @@ -55,15 +61,23 @@ RUN corepack enable pnpm && pnpm build
FROM base AS runner
WORKDIR /app

RUN apk add --no-cache redis
RUN apk add --no-cache redis bash
RUN mkdir /appdata
RUN mkdir /appdata/db
RUN mkdir /appdata/redis
VOLUME /appdata

# Don't run production as root


RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Enable homarr cli
COPY --from=installer --chown=nextjs:nodejs /app/packages/cli/cli.cjs /app/apps/cli/cli.cjs
RUN echo $'#!/bin/bash\ncd /app/apps/cli && node ./cli.cjs "$@"' > /usr/bin/homarr
RUN chmod +x /usr/bin/homarr

# Don't run production as root
RUN chown -R nextjs:nodejs /appdata
USER nextjs

Expand Down
22 changes: 11 additions & 11 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"@homarr/ui": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@homarr/widgets": "workspace:^0.1.0",
"@mantine/colors-generator": "^7.11.2",
"@mantine/core": "^7.11.2",
"@mantine/hooks": "^7.11.2",
"@mantine/modals": "^7.11.2",
"@mantine/tiptap": "^7.11.2",
"@mantine/colors-generator": "^7.12.0",
"@mantine/core": "^7.12.0",
"@mantine/hooks": "^7.12.0",
"@mantine/modals": "^7.12.0",
"@mantine/tiptap": "^7.12.0",
"@homarr/server-settings": "workspace:^0.1.0",
"@t3-oss/env-nextjs": "^0.11.0",
"@tanstack/react-query": "^5.51.21",
"@tanstack/react-query-devtools": "^5.51.21",
"@tanstack/react-query-next-experimental": "5.51.21",
"@tabler/icons-react": "^3.11.0",
"@tanstack/react-query": "^5.51.23",
"@tanstack/react-query-devtools": "^5.51.23",
"@tanstack/react-query-next-experimental": "5.51.23",
"@tabler/icons-react": "^3.12.0",
"@trpc/client": "next",
"@trpc/next": "next",
"@trpc/react-query": "next",
Expand All @@ -56,7 +56,7 @@
"dotenv": "^16.4.5",
"flag-icons": "^7.2.3",
"glob": "^11.0.0",
"jotai": "^2.9.1",
"jotai": "^2.9.2",
"mantine-react-table": "2.0.0-beta.6",
"next": "^14.2.5",
"postcss-preset-mantine": "^1.17.0",
Expand All @@ -74,7 +74,7 @@
"@homarr/prettier-config": "workspace:^0.1.0",
"@homarr/tsconfig": "workspace:^0.1.0",
"@types/chroma-js": "2.4.4",
"@types/node": "^20.14.14",
"@types/node": "^20.14.15",
"@types/prismjs": "^1.26.4",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
Expand Down
40 changes: 36 additions & 4 deletions apps/nextjs/src/app/[locale]/_client-providers/session.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
"use client";

import { createContext, useContext, useEffect } from "react";
import type { PropsWithChildren } from "react";
import dayjs from "dayjs";

import type { Session } from "@homarr/auth";
import { SessionProvider } from "@homarr/auth/client";
import { SessionProvider, signIn } from "@homarr/auth/client";

interface AuthProviderProps {
interface AuthProviderProps extends AuthContextProps {
session: Session | null;
}

export const AuthProvider = ({ children, session }: PropsWithChildren<AuthProviderProps>) => {
return <SessionProvider session={session}>{children}</SessionProvider>;
export const AuthProvider = ({ children, session, logoutUrl }: PropsWithChildren<AuthProviderProps>) => {
useLoginRedirectOnSessionExpiry(session);

return (
<SessionProvider session={session}>
<AuthContext.Provider value={{ logoutUrl }}>{children}</AuthContext.Provider>
</SessionProvider>
);
};

interface AuthContextProps {
logoutUrl: string | undefined;
}

const AuthContext = createContext<AuthContextProps | null>(null);

export const useAuthContext = () => {
const context = useContext(AuthContext);

if (!context) throw new Error("useAuthContext must be used within an AuthProvider");

return context;
};

const useLoginRedirectOnSessionExpiry = (session: Session | null) => {
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
if (!session) return () => {};
//setTimeout doesn't allow for a number higher than 2147483647 (2³¹-1 , or roughly 24 days)
const timeout = setTimeout(() => void signIn(), Math.min(dayjs(session.expires).diff(), 2147483647));
return () => clearTimeout(timeout);
}, [session]);
};
6 changes: 3 additions & 3 deletions apps/nextjs/src/app/[locale]/auth/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import { LoginForm } from "./_login-form";

interface LoginProps {
searchParams: {
redirectAfterLogin?: string;
callbackUrl?: string;
};
}

export default async function Login({ searchParams }: LoginProps) {
const session = await auth();

if (session) {
redirect(searchParams.redirectAfterLogin ?? "/");
redirect(searchParams.callbackUrl ?? "/");
}

const t = await getScopedI18n("user.page.login");
Expand All @@ -40,7 +40,7 @@ export default async function Login({ searchParams }: LoginProps) {
providers={env.AUTH_PROVIDERS}
oidcClientName={env.AUTH_OIDC_CLIENT_NAME}
isOidcAutoLoginEnabled={env.AUTH_OIDC_AUTO_LOGIN}
callbackUrl={searchParams.redirectAfterLogin ?? "/"}
callbackUrl={searchParams.callbackUrl ?? "/"}
/>
</Card>
</Stack>
Expand Down
3 changes: 2 additions & 1 deletion apps/nextjs/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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";
import { Notifications } from "@homarr/notifications";
Expand Down Expand Up @@ -56,7 +57,7 @@ export default function Layout(props: { children: React.ReactNode; params: { loc
const StackedProvider = composeWrappers([
async (innerProps) => {
const session = await auth();
return <AuthProvider session={session} {...innerProps} />;
return <AuthProvider session={session} logoutUrl={env.AUTH_LOGOUT_REDIRECT_URL} {...innerProps} />;
},
(innerProps) => <JotaiProvider {...innerProps} />,
(innerProps) => <TRPCReactProvider {...innerProps} />,
Expand Down
5 changes: 3 additions & 2 deletions apps/nextjs/src/app/[locale]/manage/apps/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IconApps, IconPencil } from "@tabler/icons-react";

import type { RouterOutputs } from "@homarr/api";
import { api } from "@homarr/api/server";
import { parseAppHrefWithVariablesServer } from "@homarr/common/server";
import { getI18n, getScopedI18n } from "@homarr/translation/server";

import { ManageContainer } from "~/components/manage/manage-container";
Expand Down Expand Up @@ -69,8 +70,8 @@ const AppCard = async ({ app }: AppCardProps) => {
</Text>
)}
{app.href && (
<Anchor href={app.href} lineClamp={1} size="sm" w="min-content">
{app.href}
<Anchor href={parseAppHrefWithVariablesServer(app.href)} lineClamp={1} size="sm" w="min-content">
{parseAppHrefWithVariablesServer(app.href)}
</Anchor>
)}
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const CreateBoardButton = ({ boardNames }: CreateBoardButtonProps) => {
onSuccess: async (values) => {
await mutateAsync({
name: values.name,
columnCount: values.columnCount,
isPublic: values.isPublic,
});
},
boardNames,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { MantineColor } from "@mantine/core";
import { Avatar, Badge, Box, Button, Group, Text } from "@mantine/core";
import { IconPlayerPlay, IconPlayerStop, IconRotateClockwise, IconTrash } from "@tabler/icons-react";
import { IconPlayerPlay, IconPlayerStop, IconRefresh, IconRotateClockwise, IconTrash } from "@tabler/icons-react";
import type { MRT_ColumnDef } from "mantine-react-table";
import { MantineReactTable } from "mantine-react-table";

Expand Down Expand Up @@ -46,10 +46,12 @@ const createColumns = (
accessorKey: "image",
header: t("docker.field.containerImage.label"),
maxSize: 200,
Cell({ renderedCellValue }) {
Cell({ renderedCellValue, cell }) {
return (
<Box maw={200}>
<Text truncate="end">{renderedCellValue}</Text>
<Text truncate="end" title={cell.row.original.image}>
{renderedCellValue}
</Text>
</Box>
);
},
Expand Down Expand Up @@ -93,6 +95,35 @@ export function DockerTable(initialData: RouterOutputs["docker"]["getContainers"
},

initialState: { density: "xs", showGlobalFilter: true },
renderTopToolbarCustomActions: () => {
const utils = clientApi.useUtils();
const { mutate, isPending } = clientApi.docker.invalidate.useMutation({
async onSuccess() {
await utils.docker.getContainers.invalidate();
showSuccessNotification({
title: tDocker("action.refresh.notification.success.title"),
message: tDocker("action.refresh.notification.success.message"),
});
},
onError() {
showErrorNotification({
title: tDocker("action.refresh.notification.error.title"),
message: tDocker("action.refresh.notification.error.message"),
});
},
});

return (
<Button
variant="default"
rightSection={<IconRefresh size="1rem" />}
onClick={() => mutate()}
loading={isPending}
>
{tDocker("action.refresh.label")}
</Button>
);
},
renderToolbarAlertBannerContent: ({ groupedAlert, table }) => {
return (
<Group gap={"sm"}>
Expand Down
7 changes: 7 additions & 0 deletions apps/nextjs/src/app/[locale]/manage/tools/docker/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { notFound } from "next/navigation";
import { Stack, Title } from "@mantine/core";

import { api } from "@homarr/api/server";
import { auth } from "@homarr/auth/next";
import { getScopedI18n } from "@homarr/translation/server";

import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb";
import { DockerTable } from "./docker-table";

export default async function DockerPage() {
const session = await auth();
if (!session?.user || !session.user.permissions.includes("admin")) {
notFound();
}

const { containers, timestamp } = await api.docker.getContainers();
const tDocker = await getScopedI18n("docker");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"use client";

import { Button, Group, Select, Stack } from "@mantine/core";

import type { RouterOutputs } from "@homarr/api";
import { clientApi } from "@homarr/api/client";
import { useZodForm } from "@homarr/form";
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
import { useI18n } from "@homarr/translation/client";
import type { z } from "@homarr/validation";
import { validation } from "@homarr/validation";

import { revalidatePathActionAsync } from "~/app/revalidatePathAction";

interface ChangeHomeBoardFormProps {
user: RouterOutputs["user"]["getById"];
boardsData: { value: string; label: string }[];
}

export const ChangeHomeBoardForm = ({ user, boardsData }: ChangeHomeBoardFormProps) => {
const t = useI18n();
const { mutate, isPending } = clientApi.user.changeHomeBoardId.useMutation({
async onSettled() {
await revalidatePathActionAsync(`/manage/users/${user.id}`);
},
onSuccess(_, variables) {
form.setInitialValues({
homeBoardId: variables.homeBoardId,
});
showSuccessNotification({
message: t("user.action.changeHomeBoard.notification.success.message"),
});
},
onError() {
showErrorNotification({
message: t("user.action.changeHomeBoard.notification.error.message"),
});
},
});
const form = useZodForm(validation.user.changeHomeBoard, {
initialValues: {
homeBoardId: user.homeBoardId ?? "",
},
});

const handleSubmit = (values: FormType) => {
mutate({
userId: user.id,
...values,
});
};

return (
<form onSubmit={form.onSubmit(handleSubmit)}>
<Stack gap="md">
<Select w="100%" data={boardsData} {...form.getInputProps("homeBoardId")} />

<Group justify="end">
<Button type="submit" color="teal" loading={isPending}>
{t("common.action.save")}
</Button>
</Group>
</Stack>
</form>
);
};

type FormType = z.infer<typeof validation.user.changeHomeBoard>;

This file was deleted.

Loading