mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 17:00:54 +01:00
* wip: add oldmarr config import
* wip: add support for wrong amount of categories / sections with autofix, color mapping, position adjustments of wrappers
* fix: lockfile broken
* feat: add support for form data trpc requests
* wip: improve file upload
* refactor: restructure import, add import configuration
* wip: add configurations for import to modal
* refactor: move oldmarr import to old-import package
* fix: column count not respects screen size for board
* feat: add beta badge for oldmarr config import
* chore: address pull request feedback
* fix: format issues
* fix: inconsistent versions
* fix: deepsource issues
* fix: revert {} to Record<string, never> convertion to prevent typecheck issue
* fix: inconsistent zod version
* fix: format issue
* chore: address pull request feedback
* fix: wrong import
* fix: broken lock file
* fix: inconsistent versions
* fix: format issues
76 lines
2.0 KiB
TypeScript
76 lines
2.0 KiB
TypeScript
import { z } from "zod";
|
|
|
|
const baseSearchEngineSchema = z.object({
|
|
properties: z.object({
|
|
openInNewTab: z.boolean().default(true),
|
|
enabled: z.boolean().default(true),
|
|
}),
|
|
});
|
|
|
|
const commonSearchEngineSchema = z
|
|
.object({
|
|
type: z.enum(["google", "duckDuckGo", "bing"]),
|
|
})
|
|
.and(baseSearchEngineSchema);
|
|
|
|
const customSearchEngineSchema = z
|
|
.object({
|
|
type: z.literal("custom"),
|
|
properties: z.object({
|
|
template: z.string(),
|
|
}),
|
|
})
|
|
.and(baseSearchEngineSchema);
|
|
|
|
const searchEngineSchema = z.union([commonSearchEngineSchema, customSearchEngineSchema]);
|
|
|
|
const commonSettingsSchema = z.object({
|
|
searchEngine: searchEngineSchema,
|
|
});
|
|
|
|
const accessSettingsSchema = z.object({
|
|
allowGuests: z.boolean(),
|
|
});
|
|
|
|
const gridstackSettingsSchema = z.object({
|
|
columnCountSmall: z.number(),
|
|
columnCountMedium: z.number(),
|
|
columnCountLarge: z.number(),
|
|
});
|
|
|
|
const layoutSettingsSchema = z.object({
|
|
enabledLeftSidebar: z.boolean(),
|
|
enabledRightSidebar: z.boolean(),
|
|
enabledDocker: z.boolean(),
|
|
enabledPing: z.boolean(),
|
|
enabledSearchbar: z.boolean(),
|
|
});
|
|
|
|
const colorsSettingsSchema = z.object({
|
|
primary: z.string().optional(),
|
|
secondary: z.string().optional(),
|
|
shade: z.number().optional(),
|
|
});
|
|
|
|
const customizationSettingsSchema = z.object({
|
|
layout: layoutSettingsSchema,
|
|
pageTitle: z.string().optional(),
|
|
metaTitle: z.string().optional(),
|
|
logoImageUrl: z.string().optional(),
|
|
faviconUrl: z.string().optional(),
|
|
backgroundImageUrl: z.string().optional(),
|
|
backgroundImageAttachment: z.enum(["fixed", "scroll"]).optional(),
|
|
backgroundImageSize: z.enum(["cover", "contain"]).optional(),
|
|
backgroundImageRepeat: z.enum(["no-repeat", "repeat", "repeat-x", "repeat-y"]).optional(),
|
|
customCss: z.string().optional(),
|
|
colors: colorsSettingsSchema,
|
|
appOpacity: z.number().optional(),
|
|
gridstack: gridstackSettingsSchema,
|
|
});
|
|
|
|
export const settingsSchema = z.object({
|
|
common: commonSettingsSchema,
|
|
customization: customizationSettingsSchema,
|
|
access: accessSettingsSchema,
|
|
});
|