feat: add import for config files from oldmarr (#1019)
* 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
This commit is contained in:
77
packages/old-schema/src/app.ts
Normal file
77
packages/old-schema/src/app.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { tileBaseSchema } from "./tile";
|
||||
|
||||
const appBehaviourSchema = z.object({
|
||||
externalUrl: z.string(),
|
||||
isOpeningNewTab: z.boolean(),
|
||||
tooltipDescription: z.string().optional(),
|
||||
});
|
||||
|
||||
const appNetworkSchema = z.object({
|
||||
enabledStatusChecker: z.boolean(),
|
||||
okStatus: z.array(z.number()).optional(),
|
||||
statusCodes: z.array(z.string()),
|
||||
});
|
||||
|
||||
const appAppearanceSchema = z.object({
|
||||
iconUrl: z.string(),
|
||||
appNameStatus: z.union([z.literal("normal"), z.literal("hover"), z.literal("hidden")]),
|
||||
positionAppName: z.union([
|
||||
z.literal("row"),
|
||||
z.literal("column"),
|
||||
z.literal("row-reverse"),
|
||||
z.literal("column-reverse"),
|
||||
]),
|
||||
appNameFontSize: z.number(),
|
||||
lineClampAppName: z.number(),
|
||||
});
|
||||
|
||||
const integrationSchema = z.enum([
|
||||
"readarr",
|
||||
"radarr",
|
||||
"sonarr",
|
||||
"lidarr",
|
||||
"prowlarr",
|
||||
"sabnzbd",
|
||||
"jellyseerr",
|
||||
"overseerr",
|
||||
"deluge",
|
||||
"qBittorrent",
|
||||
"transmission",
|
||||
"plex",
|
||||
"jellyfin",
|
||||
"nzbGet",
|
||||
"pihole",
|
||||
"adGuardHome",
|
||||
"homeAssistant",
|
||||
"openmediavault",
|
||||
"proxmox",
|
||||
"tdarr",
|
||||
]);
|
||||
|
||||
const appIntegrationPropertySchema = z.object({
|
||||
type: z.enum(["private", "public"]),
|
||||
field: z.enum(["apiKey", "password", "username"]),
|
||||
value: z.string().nullable().optional(),
|
||||
isDefined: z.boolean().optional(),
|
||||
});
|
||||
|
||||
const appIntegrationSchema = z.object({
|
||||
type: integrationSchema.optional().nullable(),
|
||||
properties: z.array(appIntegrationPropertySchema),
|
||||
});
|
||||
|
||||
export const oldmarrAppSchema = z
|
||||
.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
url: z.string(),
|
||||
behaviour: appBehaviourSchema,
|
||||
network: appNetworkSchema,
|
||||
appearance: appAppearanceSchema,
|
||||
integration: appIntegrationSchema.optional(),
|
||||
})
|
||||
.and(tileBaseSchema);
|
||||
|
||||
export type OldmarrApp = z.infer<typeof oldmarrAppSchema>;
|
||||
Reference in New Issue
Block a user