remove duplicate ServerType enum

This commit is contained in:
jeffvli
2026-02-06 05:33:15 -08:00
parent 3550177f67
commit 03b01472f8
8 changed files with 26 additions and 20 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
import { createSocket } from 'dgram'; import { createSocket } from 'dgram';
import { ipcMain } from 'electron'; import { ipcMain } from 'electron';
import { DiscoveredServerItem, ServerType } from '/@/shared/types/types'; import { ServerType } from '/@/shared/types/domain-types';
import { DiscoveredServerItem } from '/@/shared/types/types';
type JellyfinResponse = { type JellyfinResponse = {
Address: string; Address: string;
@@ -5,8 +5,7 @@ import { useSetRating } from '/@/renderer/features/shared/hooks/use-set-rating';
import { useCurrentServer, useCurrentServerId, useShowRatings } from '/@/renderer/store'; import { useCurrentServer, useCurrentServerId, useShowRatings } from '/@/renderer/store';
import { ContextMenu } from '/@/shared/components/context-menu/context-menu'; import { ContextMenu } from '/@/shared/components/context-menu/context-menu';
import { Rating } from '/@/shared/components/rating/rating'; import { Rating } from '/@/shared/components/rating/rating';
import { LibraryItem } from '/@/shared/types/domain-types'; import { LibraryItem, ServerType } from '/@/shared/types/domain-types';
import { ServerType } from '/@/shared/types/types';
interface SetRatingActionProps { interface SetRatingActionProps {
ids: string[]; ids: string[];
@@ -29,18 +29,22 @@ import { TextTitle } from '/@/shared/components/text-title/text-title';
import { Text } from '/@/shared/components/text/text'; import { Text } from '/@/shared/components/text/text';
import { toast } from '/@/shared/components/toast/toast'; import { toast } from '/@/shared/components/toast/toast';
import { useForm } from '/@/shared/hooks/use-form'; import { useForm } from '/@/shared/hooks/use-form';
import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types'; import {
import { ServerType, toServerType } from '/@/shared/types/types'; AuthenticationResponse,
ServerListItemWithCredential,
ServerType,
} from '/@/shared/types/domain-types';
import { toServerType } from '/@/shared/types/types';
const localSettings = isElectron() ? window.api.localSettings : null; const localSettings = isElectron() ? window.api.localSettings : null;
const SERVER_ICONS: Record<ServerType, string> = { const SERVER_ICONS: Record<Exclude<ServerType, ServerType.EXTERNAL>, string> = {
[ServerType.JELLYFIN]: JellyfinIcon, [ServerType.JELLYFIN]: JellyfinIcon,
[ServerType.NAVIDROME]: NavidromeIcon, [ServerType.NAVIDROME]: NavidromeIcon,
[ServerType.SUBSONIC]: SubsonicIcon, [ServerType.SUBSONIC]: SubsonicIcon,
}; };
const SERVER_NAMES: Record<ServerType, string> = { const SERVER_NAMES: Record<Exclude<ServerType, ServerType.EXTERNAL>, string> = {
[ServerType.JELLYFIN]: 'Jellyfin', [ServerType.JELLYFIN]: 'Jellyfin',
[ServerType.NAVIDROME]: 'Navidrome', [ServerType.NAVIDROME]: 'Navidrome',
[ServerType.SUBSONIC]: 'OpenSubsonic', [ServerType.SUBSONIC]: 'OpenSubsonic',
@@ -8,8 +8,8 @@ import {
useRadioPlayer, useRadioPlayer,
} from '/@/renderer/features/radio/hooks/use-radio-player'; } from '/@/renderer/features/radio/hooks/use-radio-player';
import { usePlayerSong, usePlayerStore } from '/@/renderer/store'; import { usePlayerSong, usePlayerStore } from '/@/renderer/store';
import { LibraryItem, QueueSong } from '/@/shared/types/domain-types'; import { LibraryItem, QueueSong, ServerType } from '/@/shared/types/domain-types';
import { PlayerShuffle, ServerType } from '/@/shared/types/types'; import { PlayerShuffle } from '/@/shared/types/types';
const ipc = isElectron() ? window.api.ipc : null; const ipc = isElectron() ? window.api.ipc : null;
const utils = isElectron() ? window.api.utils : null; const utils = isElectron() ? window.api.utils : null;
@@ -27,8 +27,12 @@ import { Text } from '/@/shared/components/text/text';
import { toast } from '/@/shared/components/toast/toast'; import { toast } from '/@/shared/components/toast/toast';
import { useFocusTrap } from '/@/shared/hooks/use-focus-trap'; import { useFocusTrap } from '/@/shared/hooks/use-focus-trap';
import { useForm } from '/@/shared/hooks/use-form'; import { useForm } from '/@/shared/hooks/use-form';
import { AuthenticationResponse, ServerListItemWithCredential } from '/@/shared/types/domain-types'; import {
import { DiscoveredServerItem, ServerType, toServerType } from '/@/shared/types/types'; AuthenticationResponse,
ServerListItemWithCredential,
ServerType,
} from '/@/shared/types/domain-types';
import { DiscoveredServerItem, toServerType } from '/@/shared/types/types';
const autodiscover = isElectron() ? window.api.autodiscover : null; const autodiscover = isElectron() ? window.api.autodiscover : null;
const localSettings = isElectron() ? window.api.localSettings : null; const localSettings = isElectron() ? window.api.localSettings : null;
@@ -70,7 +74,7 @@ function useAutodiscovery() {
return { isDone, servers }; return { isDone, servers };
} }
const SERVER_TYPES: Record<ServerType, ServerDetails> = { const SERVER_TYPES: Record<Exclude<ServerType, ServerType.EXTERNAL>, ServerDetails> = {
[ServerType.JELLYFIN]: { [ServerType.JELLYFIN]: {
icon: JellyfinIcon, icon: JellyfinIcon,
name: 'Jellyfin', name: 'Jellyfin',
@@ -11,9 +11,10 @@ import {
MusicFolder, MusicFolder,
Playlist, Playlist,
RelatedArtist, RelatedArtist,
ServerType,
Song, Song,
} from '/@/shared/types/domain-types'; } from '/@/shared/types/domain-types';
import { ServerListItem, ServerType } from '/@/shared/types/types'; import { ServerListItem } from '/@/shared/types/types';
const TICKS_PER_MS = 10000; const TICKS_PER_MS = 10000;
@@ -1,5 +1,7 @@
import z from 'zod'; import z from 'zod';
import { ServerType } from '../../types/domain-types';
import { ndType } from '/@/shared/api/navidrome/navidrome-types'; import { ndType } from '/@/shared/api/navidrome/navidrome-types';
import { ssType } from '/@/shared/api/subsonic/subsonic-types'; import { ssType } from '/@/shared/api/subsonic/subsonic-types';
import { replacePathPrefix } from '/@/shared/api/utils'; import { replacePathPrefix } from '/@/shared/api/utils';
@@ -14,7 +16,7 @@ import {
Song, Song,
User, User,
} from '/@/shared/types/domain-types'; } from '/@/shared/types/domain-types';
import { ServerListItem, ServerType } from '/@/shared/types/types'; import { ServerListItem } from '/@/shared/types/types';
const getImageUrl = (args: { url: null | string }) => { const getImageUrl = (args: { url: null | string }) => {
const { url } = args; const { url } = args;
+1 -6
View File
@@ -9,6 +9,7 @@ import {
LibraryItem, LibraryItem,
Playlist, Playlist,
QueueSong, QueueSong,
ServerType,
Song, Song,
} from '/@/shared/types/domain-types'; } from '/@/shared/types/domain-types';
import { ServerFeatures } from '/@/shared/types/features-types'; import { ServerFeatures } from '/@/shared/types/features-types';
@@ -51,12 +52,6 @@ export enum Platform {
WINDOWS = 'windows', WINDOWS = 'windows',
} }
export enum ServerType {
JELLYFIN = 'jellyfin',
NAVIDROME = 'navidrome',
SUBSONIC = 'subsonic',
}
export type CardRoute = { export type CardRoute = {
route: AppRoute | string; route: AppRoute | string;
slugs?: RouteSlug[]; slugs?: RouteSlug[];