From 92635381ea0a633327952e87c8851e61ce06090d Mon Sep 17 00:00:00 2001 From: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com> Date: Tue, 30 Jun 2026 22:21:57 +0200 Subject: [PATCH] refactor(share): split share cluster into lib/share + features/share MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a11y-branch hold lifted. Pure share machinery (no @/features runtime imports) → lib/share: shareLink, shareSearch, shareServerOriginLabel, copyEntityShareLink (+tests). The two orchestrators that runtime-import offline/playback/orbit → new features/share: applySharePaste, enqueueShareSearchPayload (+test); doc-only barrel, consumers use deep paths. No low-layer consumes the orchestrators, so no seam is needed — pure move, tests pass unmodified. Drains utils/share. Only import lines changed in the PasteClipboardHandler consumer (logic untouched). --- src/components/PasteClipboardHandler.tsx | 8 ++++---- src/features/album/components/AlbumHeader.tsx | 2 +- src/features/artist/utils/runArtistDetailActions.ts | 2 +- src/features/composers/pages/ComposerDetail.tsx | 2 +- src/features/contextMenu/components/ContextMenu.tsx | 2 +- .../contextMenu/components/contextMenuItemTypes.ts | 2 +- src/features/contextMenu/utils/contextMenuActions.ts | 4 ++-- src/features/orbit/utils/shareLink.ts | 2 +- src/features/queue/components/QueuePanel.tsx | 2 +- .../search/components/ShareQueuePreviewModal.tsx | 2 +- src/features/search/components/ShareSearchResults.tsx | 4 ++-- src/features/search/hooks/useShareQueuePreview.ts | 4 ++-- src/features/search/hooks/useShareSearch.ts | 8 ++++---- src/features/search/hooks/useShareSearchPreview.ts | 4 ++-- src/{utils => features}/share/applySharePaste.ts | 4 ++-- .../share/enqueueShareSearchPayload.test.ts | 4 ++-- .../share/enqueueShareSearchPayload.ts | 8 ++++---- src/features/share/index.ts | 9 +++++++++ src/{utils => lib}/share/copyEntityShareLink.test.ts | 4 ++-- src/{utils => lib}/share/copyEntityShareLink.ts | 4 ++-- src/{utils => lib}/share/shareLink.test.ts | 2 +- src/{utils => lib}/share/shareLink.ts | 2 +- src/{utils => lib}/share/shareSearch.test.ts | 4 ++-- src/{utils => lib}/share/shareSearch.ts | 2 +- src/{utils => lib}/share/shareServerOriginLabel.test.ts | 6 +++--- src/{utils => lib}/share/shareServerOriginLabel.ts | 6 +++--- 26 files changed, 56 insertions(+), 47 deletions(-) rename src/{utils => features}/share/applySharePaste.ts (98%) rename src/{utils => features}/share/enqueueShareSearchPayload.test.ts (98%) rename src/{utils => features}/share/enqueueShareSearchPayload.ts (97%) create mode 100644 src/features/share/index.ts rename src/{utils => lib}/share/copyEntityShareLink.test.ts (97%) rename src/{utils => lib}/share/copyEntityShareLink.ts (86%) rename src/{utils => lib}/share/shareLink.test.ts (99%) rename src/{utils => lib}/share/shareLink.ts (98%) rename src/{utils => lib}/share/shareSearch.test.ts (95%) rename src/{utils => lib}/share/shareSearch.ts (98%) rename src/{utils => lib}/share/shareServerOriginLabel.test.ts (87%) rename src/{utils => lib}/share/shareServerOriginLabel.ts (90%) diff --git a/src/components/PasteClipboardHandler.tsx b/src/components/PasteClipboardHandler.tsx index f5a63442..ff300671 100644 --- a/src/components/PasteClipboardHandler.tsx +++ b/src/components/PasteClipboardHandler.tsx @@ -2,11 +2,11 @@ import { useEffect, useMemo, useRef, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { useAuthStore } from '../store/authStore'; -import type { EntitySharePayloadV1 } from '../utils/share/shareLink'; -import { decodeSharePayloadFromText } from '../utils/share/shareLink'; +import type { EntitySharePayloadV1 } from '@/lib/share/shareLink'; +import { decodeSharePayloadFromText } from '@/lib/share/shareLink'; import { decodeServerMagicStringFromText } from '@/lib/server/serverMagicString'; -import { applySharePastePayload, applySharePasteQueue } from '../utils/share/applySharePaste'; -import { shareQueueServerContext } from '../utils/share/shareServerOriginLabel'; +import { applySharePastePayload, applySharePasteQueue } from '@/features/share/applySharePaste'; +import { shareQueueServerContext } from '@/lib/share/shareServerOriginLabel'; import { showToast } from '@/lib/dom/toast'; import { useShareQueuePreview } from '@/features/search'; import { ShareQueuePreviewModal } from '@/features/search'; diff --git a/src/features/album/components/AlbumHeader.tsx b/src/features/album/components/AlbumHeader.tsx index 580528c3..e364a4eb 100644 --- a/src/features/album/components/AlbumHeader.tsx +++ b/src/features/album/components/AlbumHeader.tsx @@ -11,7 +11,7 @@ import { useIsMobile } from '@/lib/hooks/useIsMobile'; import { useAlbumDetailBack } from '@/features/album/hooks/useAlbumDetailBack'; import { useThemeStore } from '@/store/themeStore'; import StarRating from '@/ui/StarRating'; -import { copyEntityShareLink } from '@/utils/share/copyEntityShareLink'; +import { copyEntityShareLink } from '@/lib/share/copyEntityShareLink'; import { showToast } from '@/lib/dom/toast'; import { isAlbumRecentlyAdded } from '@/features/album/utils/albumRecency'; import { formatLongDuration } from '@/lib/format/formatDuration'; diff --git a/src/features/artist/utils/runArtistDetailActions.ts b/src/features/artist/utils/runArtistDetailActions.ts index 219cfb6a..63ef4324 100644 --- a/src/features/artist/utils/runArtistDetailActions.ts +++ b/src/features/artist/utils/runArtistDetailActions.ts @@ -4,7 +4,7 @@ import { uploadArtistImage } from '@/lib/api/subsonicArtists'; import { setRating, star, unstar } from '@/lib/api/subsonicStarRating'; import type { SubsonicArtist } from '@/lib/api/subsonicTypes'; import { useAuthStore } from '@/store/authStore'; -import { copyEntityShareLink } from '@/utils/share/copyEntityShareLink'; +import { copyEntityShareLink } from '@/lib/share/copyEntityShareLink'; import { invalidateCoverArt } from '@/utils/imageCache'; import { showToast } from '@/lib/dom/toast'; diff --git a/src/features/composers/pages/ComposerDetail.tsx b/src/features/composers/pages/ComposerDetail.tsx index 38982af3..3e122e46 100644 --- a/src/features/composers/pages/ComposerDetail.tsx +++ b/src/features/composers/pages/ComposerDetail.tsx @@ -14,7 +14,7 @@ import { open } from '@tauri-apps/plugin-shell'; import { usePlayerStore } from '@/features/playback/store/playerStore'; import { useAuthStore } from '@/store/authStore'; import { useTranslation } from 'react-i18next'; -import { copyEntityShareLink } from '@/utils/share/copyEntityShareLink'; +import { copyEntityShareLink } from '@/lib/share/copyEntityShareLink'; import { showToast } from '@/lib/dom/toast'; import { sanitizeHtml } from '@/lib/util/sanitizeHtml'; import { usePerfProbeFlags } from '@/lib/perf/perfFlags'; diff --git a/src/features/contextMenu/components/ContextMenu.tsx b/src/features/contextMenu/components/ContextMenu.tsx index 9cabb5dd..c75b4a5d 100644 --- a/src/features/contextMenu/components/ContextMenu.tsx +++ b/src/features/contextMenu/components/ContextMenu.tsx @@ -5,7 +5,7 @@ import { usePlayerStore } from '@/features/playback/store/playerStore'; import { useShallow } from 'zustand/react/shallow'; import { useAuthStore } from '@/store/authStore'; import { useTranslation } from 'react-i18next'; -import type { EntityShareKind } from '@/utils/share/shareLink'; +import type { EntityShareKind } from '@/lib/share/shareLink'; import { AddToPlaylistSubmenu } from '@/features/contextMenu/components/AddToPlaylistSubmenu'; import { copyShareLink as copyShareLinkAction, diff --git a/src/features/contextMenu/components/contextMenuItemTypes.ts b/src/features/contextMenu/components/contextMenuItemTypes.ts index c25e1cf1..2ffcb309 100644 --- a/src/features/contextMenu/components/contextMenuItemTypes.ts +++ b/src/features/contextMenu/components/contextMenuItemTypes.ts @@ -1,7 +1,7 @@ import type React from 'react'; import type { SubsonicAlbum, SubsonicArtist } from '@/lib/api/subsonicTypes'; import type { QueueItemRef, Track } from '@/lib/media/trackTypes'; -import type { EntityShareKind } from '@/utils/share/shareLink'; +import type { EntityShareKind } from '@/lib/share/shareLink'; import type { OfflineActionPolicy } from '@/features/offline'; export type RatingKind = 'song' | 'album' | 'artist'; diff --git a/src/features/contextMenu/utils/contextMenuActions.ts b/src/features/contextMenu/utils/contextMenuActions.ts index f864c686..b843b680 100644 --- a/src/features/contextMenu/utils/contextMenuActions.ts +++ b/src/features/contextMenu/utils/contextMenuActions.ts @@ -9,8 +9,8 @@ import type { Track } from '@/lib/media/trackTypes'; import { resolveQueueTrack } from '@/features/playback/store/queueTrackView'; import { useZipDownloadStore } from '@/features/offline'; import { useDownloadModalStore } from '@/features/offline'; -import type { EntityShareKind } from '@/utils/share/shareLink'; -import { copyEntityShareLink } from '@/utils/share/copyEntityShareLink'; +import type { EntityShareKind } from '@/lib/share/shareLink'; +import { copyEntityShareLink } from '@/lib/share/copyEntityShareLink'; import { sanitizeFilename, shuffleArray } from '@/features/contextMenu/utils/contextMenuHelpers'; import { songToTrack } from '@/lib/media/songToTrack'; import { showToast } from '@/lib/dom/toast'; diff --git a/src/features/orbit/utils/shareLink.ts b/src/features/orbit/utils/shareLink.ts index 4c847f67..b2b4e582 100644 --- a/src/features/orbit/utils/shareLink.ts +++ b/src/features/orbit/utils/shareLink.ts @@ -1,4 +1,4 @@ -import { decodeOrbitSharePayloadFromText, encodeSharePayload } from '@/utils/share/shareLink'; +import { decodeOrbitSharePayloadFromText, encodeSharePayload } from '@/lib/share/shareLink'; export interface OrbitShareLink { /** Base URL of the Navidrome server (decoded). */ diff --git a/src/features/queue/components/QueuePanel.tsx b/src/features/queue/components/QueuePanel.tsx index a7ad1854..bc4db60b 100644 --- a/src/features/queue/components/QueuePanel.tsx +++ b/src/features/queue/components/QueuePanel.tsx @@ -12,7 +12,7 @@ import { usePlaylistStore } from '@/features/playlist'; import { useTranslation } from 'react-i18next'; import { usePlaybackLibraryNavigate } from '@/features/playback/hooks/usePlaybackLibraryNavigate'; import { useAuthStore } from '@/store/authStore'; -import { encodeSharePayload } from '@/utils/share/shareLink'; +import { encodeSharePayload } from '@/lib/share/shareLink'; import { serverShareBaseUrl } from '@/lib/server/serverEndpoint'; import { copyTextToClipboard } from '@/lib/server/serverMagicString'; import { showToast } from '@/lib/dom/toast'; diff --git a/src/features/search/components/ShareQueuePreviewModal.tsx b/src/features/search/components/ShareQueuePreviewModal.tsx index 605de872..cac3b94f 100644 --- a/src/features/search/components/ShareQueuePreviewModal.tsx +++ b/src/features/search/components/ShareQueuePreviewModal.tsx @@ -6,7 +6,7 @@ import type { SubsonicSong } from '@/lib/api/subsonicTypes'; import type { ServerProfile } from '@/store/authStoreTypes'; import { formatTrackTime } from '@/lib/format/formatDuration'; import type { ShareQueuePreviewState } from '@/features/search/hooks/useShareQueuePreview'; -import { sharePayloadTotal, type QueueableShareSearchPayload } from '@/utils/share/shareSearch'; +import { sharePayloadTotal, type QueueableShareSearchPayload } from '@/lib/share/shareSearch'; import OverlayScrollArea from '@/ui/OverlayScrollArea'; import { usePlayerStore } from '@/features/playback/store/playerStore'; import { COVER_DENSE_SEARCH_CSS_PX } from '@/cover/layoutSizes'; diff --git a/src/features/search/components/ShareSearchResults.tsx b/src/features/search/components/ShareSearchResults.tsx index 85e8146b..93660014 100644 --- a/src/features/search/components/ShareSearchResults.tsx +++ b/src/features/search/components/ShareSearchResults.tsx @@ -5,8 +5,8 @@ import type { TFunction } from 'i18next'; import type { SubsonicArtist } from '@/lib/api/subsonicTypes'; import type { ServerProfile } from '@/store/authStoreTypes'; import { songToTrack } from '@/lib/media/songToTrack'; -import { activateShareSearchServer } from '@/utils/share/enqueueShareSearchPayload'; -import { sharePayloadTotal, type ShareSearchMatch } from '@/utils/share/shareSearch'; +import { activateShareSearchServer } from '@/features/share/enqueueShareSearchPayload'; +import { sharePayloadTotal, type ShareSearchMatch } from '@/lib/share/shareSearch'; import type { ShareSearchPreviewState } from '@/features/search/hooks/useShareSearchPreview'; import { FETCH_QUEUE_BIAS_SEARCH_ARTIST_OVER_ALBUM } from '@/ui/CachedImage'; import { AlbumCoverArtImage } from '@/cover/AlbumCoverArtImage'; diff --git a/src/features/search/hooks/useShareQueuePreview.ts b/src/features/search/hooks/useShareQueuePreview.ts index 03c5be0d..8570d5b8 100644 --- a/src/features/search/hooks/useShareQueuePreview.ts +++ b/src/features/search/hooks/useShareQueuePreview.ts @@ -3,8 +3,8 @@ import type { SubsonicSong } from '@/lib/api/subsonicTypes'; import { resolveShareSearchPayload, type ShareSearchResolveResult, -} from '@/utils/share/enqueueShareSearchPayload'; -import type { QueueableShareSearchPayload } from '@/utils/share/shareSearch'; +} from '@/features/share/enqueueShareSearchPayload'; +import type { QueueableShareSearchPayload } from '@/lib/share/shareSearch'; export type ShareQueuePreviewState = | { status: 'idle' } diff --git a/src/features/search/hooks/useShareSearch.ts b/src/features/search/hooks/useShareSearch.ts index 4c25ae42..56a6006f 100644 --- a/src/features/search/hooks/useShareSearch.ts +++ b/src/features/search/hooks/useShareSearch.ts @@ -6,11 +6,11 @@ import { useAuthStore } from '@/store/authStore'; import { activateShareSearchServer, enqueueShareSearchPayload, -} from '@/utils/share/enqueueShareSearchPayload'; +} from '@/features/share/enqueueShareSearchPayload'; import type { ServerProfile } from '@/store/authStoreTypes'; -import { findServerIdForShareUrl } from '@/utils/share/shareLink'; -import { shareServerOriginLabel } from '@/utils/share/shareServerOriginLabel'; -import { parseShareSearchText } from '@/utils/share/shareSearch'; +import { findServerIdForShareUrl } from '@/lib/share/shareLink'; +import { shareServerOriginLabel } from '@/lib/share/shareServerOriginLabel'; +import { parseShareSearchText } from '@/lib/share/shareSearch'; import { serverIndexKeyFromUrl } from '@/lib/server/serverIndexKey'; import { useShareSearchPreview } from '@/features/search/hooks/useShareSearchPreview'; diff --git a/src/features/search/hooks/useShareSearchPreview.ts b/src/features/search/hooks/useShareSearchPreview.ts index 761abdae..ae778ab1 100644 --- a/src/features/search/hooks/useShareSearchPreview.ts +++ b/src/features/search/hooks/useShareSearchPreview.ts @@ -4,8 +4,8 @@ import { resolveShareSearchAlbum, resolveShareSearchArtist, resolveShareSearchPayload, -} from '@/utils/share/enqueueShareSearchPayload'; -import type { ShareSearchMatch } from '@/utils/share/shareSearch'; +} from '@/features/share/enqueueShareSearchPayload'; +import type { ShareSearchMatch } from '@/lib/share/shareSearch'; export interface ShareSearchPreviewState { shareTrackSong: SubsonicSong | null; diff --git a/src/utils/share/applySharePaste.ts b/src/features/share/applySharePaste.ts similarity index 98% rename from src/utils/share/applySharePaste.ts rename to src/features/share/applySharePaste.ts index bc00f305..5ab8d386 100644 --- a/src/utils/share/applySharePaste.ts +++ b/src/features/share/applySharePaste.ts @@ -4,10 +4,10 @@ import type { SubsonicSong } from '@/lib/api/subsonicTypes'; import { songToTrack } from '@/lib/media/songToTrack'; import type { Location, NavigateFunction } from 'react-router-dom'; import type { TFunction } from 'i18next'; -import { useAuthStore } from '../../store/authStore'; +import { useAuthStore } from '@/store/authStore'; import { usePlayerStore } from '@/features/playback/store/playerStore'; import { navigateToAlbumDetail } from '@/lib/navigation/albumDetailNavigation'; -import { findServerIdForShareUrl, type EntitySharePayloadV1 } from './shareLink'; +import { findServerIdForShareUrl, type EntitySharePayloadV1 } from '@/lib/share/shareLink'; import { showToast } from '@/lib/dom/toast'; const RESOLVE_QUEUE_CHUNK = 12; diff --git a/src/utils/share/enqueueShareSearchPayload.test.ts b/src/features/share/enqueueShareSearchPayload.test.ts similarity index 98% rename from src/utils/share/enqueueShareSearchPayload.test.ts rename to src/features/share/enqueueShareSearchPayload.test.ts index 71142993..ed144d6f 100644 --- a/src/utils/share/enqueueShareSearchPayload.test.ts +++ b/src/features/share/enqueueShareSearchPayload.test.ts @@ -37,7 +37,7 @@ vi.mock('@/lib/api/subsonicEntityWithCredentials', () => ({ getSongWithCredentials: mocks.getSongWithCredentials, })); -vi.mock('../../store/authStore', () => ({ +vi.mock('@/store/authStore', () => ({ useAuthStore: { getState: () => mocks.authState.current, }, @@ -67,7 +67,7 @@ import { resolveShareSearchAlbum, resolveShareSearchArtist, resolveShareSearchPayload, -} from './enqueueShareSearchPayload'; +} from '@/features/share/enqueueShareSearchPayload'; const sharedServer = { id: 'shared', diff --git a/src/utils/share/enqueueShareSearchPayload.ts b/src/features/share/enqueueShareSearchPayload.ts similarity index 97% rename from src/utils/share/enqueueShareSearchPayload.ts rename to src/features/share/enqueueShareSearchPayload.ts index 8f64c6ec..4a9fe9b5 100644 --- a/src/utils/share/enqueueShareSearchPayload.ts +++ b/src/features/share/enqueueShareSearchPayload.ts @@ -7,13 +7,13 @@ import { import { getSong } from '@/lib/api/subsonicLibrary'; import { resolveAlbum, resolveArtist } from '@/features/offline'; import type { SubsonicAlbum, SubsonicArtist, SubsonicSong } from '@/lib/api/subsonicTypes'; -import { useAuthStore } from '../../store/authStore'; -import type { ServerProfile } from '../../store/authStoreTypes'; +import { useAuthStore } from '@/store/authStore'; +import type { ServerProfile } from '@/store/authStoreTypes'; import { usePlayerStore } from '@/features/playback/store/playerStore'; import { songToTrack } from '@/lib/media/songToTrack'; import type { Track } from '@/lib/media/trackTypes'; import { orbitBulkGuard } from '@/features/orbit'; -import { findServerIdForShareUrl } from './shareLink'; +import { findServerIdForShareUrl } from '@/lib/share/shareLink'; import { connectBaseUrlForServer } from '@/lib/server/serverEndpoint'; import { serverIndexKeyFromUrl } from '@/lib/server/serverIndexKey'; import type { @@ -21,7 +21,7 @@ import type { ArtistShareSearchPayload, ComposerShareSearchPayload, QueueableShareSearchPayload, -} from './shareSearch'; +} from '@/lib/share/shareSearch'; import { showToast } from '@/lib/dom/toast'; const RESOLVE_QUEUE_CHUNK = 12; diff --git a/src/features/share/index.ts b/src/features/share/index.ts new file mode 100644 index 00000000..3aac68e0 --- /dev/null +++ b/src/features/share/index.ts @@ -0,0 +1,9 @@ +/** + * Share feature — applying pasted entity/queue shares (server switch + resolve + + * play/navigate) and enqueueing share-search results. The pure encode/decode/parse + * and origin-label helpers live in `@/lib/share` (feature-free); these orchestrators + * runtime-import offline/playback/orbit, so they are feature-scoped. Consumers import + * deep paths (`@/features/share/...`); this barrel is documentation. + */ +export * from './applySharePaste'; +export * from './enqueueShareSearchPayload'; diff --git a/src/utils/share/copyEntityShareLink.test.ts b/src/lib/share/copyEntityShareLink.test.ts similarity index 97% rename from src/utils/share/copyEntityShareLink.test.ts rename to src/lib/share/copyEntityShareLink.test.ts index 4db1cdbd..1e50ec02 100644 --- a/src/utils/share/copyEntityShareLink.test.ts +++ b/src/lib/share/copyEntityShareLink.test.ts @@ -7,11 +7,11 @@ * garbage to the clipboard. */ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { copyEntityShareLink } from './copyEntityShareLink'; +import { copyEntityShareLink } from '@/lib/share/copyEntityShareLink'; import { decodeSharePayloadFromText, PSYSONIC_SHARE_PREFIX, -} from './shareLink'; +} from '@/lib/share/shareLink'; import { useAuthStore } from '@/store/authStore'; import { resetAuthStore } from '@/test/helpers/storeReset'; diff --git a/src/utils/share/copyEntityShareLink.ts b/src/lib/share/copyEntityShareLink.ts similarity index 86% rename from src/utils/share/copyEntityShareLink.ts rename to src/lib/share/copyEntityShareLink.ts index 0dc4ef4d..d7c2e470 100644 --- a/src/utils/share/copyEntityShareLink.ts +++ b/src/lib/share/copyEntityShareLink.ts @@ -1,6 +1,6 @@ -import { useAuthStore } from '../../store/authStore'; +import { useAuthStore } from '@/store/authStore'; import { serverShareBaseUrl } from '@/lib/server/serverEndpoint'; -import { encodeSharePayload, type EntityShareKind } from './shareLink'; +import { encodeSharePayload, type EntityShareKind } from '@/lib/share/shareLink'; import { copyTextToClipboard } from '@/lib/server/serverMagicString'; /** Copies a track / album / artist / composer share link (`psysonic2-`) to the clipboard. */ diff --git a/src/utils/share/shareLink.test.ts b/src/lib/share/shareLink.test.ts similarity index 99% rename from src/utils/share/shareLink.test.ts rename to src/lib/share/shareLink.test.ts index ddef0d4f..82e252d9 100644 --- a/src/utils/share/shareLink.test.ts +++ b/src/lib/share/shareLink.test.ts @@ -6,7 +6,7 @@ import { encodeSharePayload, findServerIdForShareUrl, normalizeShareServerUrl, -} from './shareLink'; +} from '@/lib/share/shareLink'; import { decodeServerMagicString, encodeServerMagicString, SERVER_MAGIC_STRING_PREFIX } from '@/lib/server/serverMagicString'; import { makeServer } from '@/test/helpers/factories'; diff --git a/src/utils/share/shareLink.ts b/src/lib/share/shareLink.ts similarity index 98% rename from src/utils/share/shareLink.ts rename to src/lib/share/shareLink.ts index 993f728b..f3b4ab1e 100644 --- a/src/utils/share/shareLink.ts +++ b/src/lib/share/shareLink.ts @@ -1,4 +1,4 @@ -import type { ServerProfile } from '../../store/authStoreTypes'; +import type { ServerProfile } from '@/store/authStoreTypes'; /** Library share (track / album / artist / queue). Same naming family as `psysonic1-` server invites. */ export const PSYSONIC_SHARE_PREFIX = 'psysonic2-'; diff --git a/src/utils/share/shareSearch.test.ts b/src/lib/share/shareSearch.test.ts similarity index 95% rename from src/utils/share/shareSearch.test.ts rename to src/lib/share/shareSearch.test.ts index 642a7f79..6dd89016 100644 --- a/src/utils/share/shareSearch.test.ts +++ b/src/lib/share/shareSearch.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; import { encodeServerMagicString } from '@/lib/server/serverMagicString'; -import { encodeSharePayload } from './shareLink'; -import { parseShareSearchText, sharePayloadTotal } from './shareSearch'; +import { encodeSharePayload } from '@/lib/share/shareLink'; +import { parseShareSearchText, sharePayloadTotal } from '@/lib/share/shareSearch'; describe('share search parsing', () => { it('detects track share links as queueable', () => { diff --git a/src/utils/share/shareSearch.ts b/src/lib/share/shareSearch.ts similarity index 98% rename from src/utils/share/shareSearch.ts rename to src/lib/share/shareSearch.ts index 33624a25..37afd57b 100644 --- a/src/utils/share/shareSearch.ts +++ b/src/lib/share/shareSearch.ts @@ -1,7 +1,7 @@ import { decodeSharePayloadFromText, PSYSONIC_SHARE_PREFIX, -} from './shareLink'; +} from '@/lib/share/shareLink'; export type QueueableShareSearchPayload = | { srv: string; k: 'track'; id: string } diff --git a/src/utils/share/shareServerOriginLabel.test.ts b/src/lib/share/shareServerOriginLabel.test.ts similarity index 87% rename from src/utils/share/shareServerOriginLabel.test.ts rename to src/lib/share/shareServerOriginLabel.test.ts index b5315b2e..17ac60f5 100644 --- a/src/utils/share/shareServerOriginLabel.test.ts +++ b/src/lib/share/shareServerOriginLabel.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { encodeSharePayload } from './shareLink'; -import { parseShareSearchText } from './shareSearch'; -import { shareServerOriginLabel } from './shareServerOriginLabel'; +import { encodeSharePayload } from '@/lib/share/shareLink'; +import { parseShareSearchText } from '@/lib/share/shareSearch'; +import { shareServerOriginLabel } from '@/lib/share/shareServerOriginLabel'; const home = { id: 'home', diff --git a/src/utils/share/shareServerOriginLabel.ts b/src/lib/share/shareServerOriginLabel.ts similarity index 90% rename from src/utils/share/shareServerOriginLabel.ts rename to src/lib/share/shareServerOriginLabel.ts index 2258cad5..f6919150 100644 --- a/src/utils/share/shareServerOriginLabel.ts +++ b/src/lib/share/shareServerOriginLabel.ts @@ -1,8 +1,8 @@ -import type { ServerProfile } from '../../store/authStoreTypes'; +import type { ServerProfile } from '@/store/authStoreTypes'; import { serverListDisplayLabel } from '@/lib/server/serverDisplayName'; import { serverIndexKeyFromUrl } from '@/lib/server/serverIndexKey'; -import { findServerIdForShareUrl } from './shareLink'; -import type { ShareSearchMatch } from './shareSearch'; +import { findServerIdForShareUrl } from '@/lib/share/shareLink'; +import type { ShareSearchMatch } from '@/lib/share/shareSearch'; /** * Display name for the share link's origin server when it differs from the