Add new config format

This commit is contained in:
Meierschlumpf
2022-12-04 17:36:30 +01:00
parent b2f5149527
commit d5a3b3f3ba
76 changed files with 2461 additions and 1034 deletions

22
src/types/area.ts Normal file
View File

@@ -0,0 +1,22 @@
export type AreaType = WrapperAreaType | CategoryAreaType | SidebarAreaType;
interface WrapperAreaType {
type: 'wrapper';
properties: {
id: string;
};
}
interface CategoryAreaType {
type: 'category';
properties: {
id: string;
};
}
interface SidebarAreaType {
type: 'sidebar';
properties: {
location: 'right' | 'left';
};
}

5
src/types/category.ts Normal file
View File

@@ -0,0 +1,5 @@
export interface CategoryType {
id: string;
position: number;
name: string;
}

19
src/types/config.ts Normal file
View File

@@ -0,0 +1,19 @@
import { CategoryType } from './category';
import { WrapperType } from './wrapper';
import { ServiceType } from './service';
import { IntegrationsType } from './integration';
import { SettingsType } from './settings';
export interface ConfigType {
schemaVersion: string;
configProperties: ConfigPropertiesType;
categories: CategoryType[];
wrappers: WrapperType[];
services: ServiceType[];
integrations: IntegrationsType;
settings: SettingsType;
}
export interface ConfigPropertiesType {
name: string;
}

51
src/types/integration.ts Normal file
View File

@@ -0,0 +1,51 @@
import { TileBaseType } from './tile';
export interface IntegrationsType {
calendar?: CalendarIntegrationType;
clock?: ClockIntegrationType;
weather?: WeatherIntegrationType;
dashDot?: DashDotIntegrationType;
bitTorrent?: BitTorrentIntegrationType;
useNet?: UseNetIntegrationType;
torrentNetworkTraffic?: TorrentNetworkTrafficIntegrationType;
}
export interface CalendarIntegrationType extends TileBaseType {
properties: {
isWeekStartingAtSunday: boolean;
};
}
export interface ClockIntegrationType extends TileBaseType {
properties: {
is24HoursFormat: boolean;
};
}
export interface WeatherIntegrationType extends TileBaseType {
properties: {
location: string;
isFahrenheit: boolean;
};
}
export interface DashDotIntegrationType extends TileBaseType {
properties: {
graphs: DashDotIntegrationGraphType[];
isCompactView: boolean;
url: string;
};
}
type DashDotIntegrationGraphType = { name: DashDotGraphType; isMultiView?: boolean };
export type DashDotGraphType = 'cpu' | 'storage' | 'ram' | 'network' | 'gpu';
export interface BitTorrentIntegrationType extends TileBaseType {
properties: {
hideDownloadedTorrents: boolean;
};
}
export interface UseNetIntegrationType extends TileBaseType {}
export interface TorrentNetworkTrafficIntegrationType extends TileBaseType {}

54
src/types/service.ts Normal file
View File

@@ -0,0 +1,54 @@
import { TileBaseType } from './tile';
export interface ServiceType extends TileBaseType {
id: string;
name: string;
url: string;
behaviour: ServiceBehaviourType;
network: ServiceNetworkType;
appearance: ServiceAppearanceType;
integration?: ServiceIntegrationType; //TODO: make this nullable
}
interface ServiceBehaviourType {
onClickUrl: string;
isMoveable: boolean; //TODO: remove this proeprty
isSticky: boolean; //TODO: remove this property
isOpeningNewTab: boolean;
}
interface ServiceNetworkType {
enabledStatusChecker: boolean;
okStatus: number[];
}
interface ServiceAppearanceType {
iconUrl: string;
}
type ServiceIntegrationType =
| ServiceIntegrationApiKeyType
| ServiceIntegrationPasswordType
| ServiceIntegrationUsernamePasswordType;
export interface ServiceIntegrationApiKeyType {
type: 'readarr' | 'radarr' | 'sonarr' | 'lidarr' | 'sabnzbd' | 'jellyseerr' | 'overseerr';
properties: {
apiKey: string;
};
}
interface ServiceIntegrationPasswordType {
type: 'deluge';
properties: {
password?: string;
};
}
interface ServiceIntegrationUsernamePasswordType {
type: 'qBittorrent' | 'transmission';
properties: {
username?: string;
password?: string;
};
}

61
src/types/settings.ts Normal file
View File

@@ -0,0 +1,61 @@
import { MantineTheme } from '@mantine/core';
export interface SettingsType {
common: CommonSettingsType;
customization: CustomizationSettingsType;
}
export interface CommonSettingsType {
searchEngine: SearchEngineCommonSettingsType;
defaultConfig: string;
}
export type SearchEngineCommonSettingsType =
| CommonSearchEngineCommonSettingsType
| CustomSearchEngineCommonSettingsType;
export interface CommonSearchEngineCommonSettingsType extends BaseSearchEngineType {
type: 'google' | 'duckDuckGo' | 'bing';
}
interface CustomSearchEngineCommonSettingsType extends BaseSearchEngineType {
type: 'custom';
properties: {
template: string;
openInNewTab: boolean;
enabled: boolean;
};
}
interface BaseSearchEngineType {
properties: {
openInNewTab: boolean;
enabled: boolean;
};
}
export interface CustomizationSettingsType {
layout: LayoutCustomizationSettingsType;
pageTitle?: string;
metaTitle?: string;
logoImageUrl?: string;
faviconUrl?: string;
backgroundImageUrl?: string;
customCss?: string;
colors: ColorsCustomizationSettingsType;
appOpacity?: number;
}
interface LayoutCustomizationSettingsType {
enabledLeftSidebar: boolean;
enabledRightSidebar: boolean;
enabledDocker: boolean;
enabledPing: boolean;
enabledSearchbar: boolean;
}
interface ColorsCustomizationSettingsType {
primary?: MantineTheme['primaryColor'];
secondary?: MantineTheme['primaryColor'];
shade?: MantineTheme['primaryShade'];
}

10
src/types/shape.ts Normal file
View File

@@ -0,0 +1,10 @@
export interface ShapeType {
location: {
x: number;
y: number;
};
size: {
width: number;
height: number;
};
}

7
src/types/tile.ts Normal file
View File

@@ -0,0 +1,7 @@
import { AreaType } from './area';
import { ShapeType } from './shape';
export interface TileBaseType {
area: AreaType;
shape: ShapeType;
}

4
src/types/wrapper.ts Normal file
View File

@@ -0,0 +1,4 @@
export interface WrapperType {
id: string;
position: number;
}