feat: improve download requests and mobile UI

This commit is contained in:
WonderAliceUwU committed 2026-09-07 20:07:30 +02:00
1 parent c70a8999cd
commit 1cb4b53b78
6 files changed
+555 -67

No files matched your search

+4 -4
View File
@@ -390,16 +390,16 @@ async function routeRequest(request: IncomingMessage, response: ServerResponse):
if (url.pathname === '/api/requests/movie' && method === 'POST') {
const config = await readConfig(session!.encryptionKey);
const body = await readJson<{ tmdbId: number; user: string | null }>(request);
await requestMovie(config, Number(body.tmdbId), body.user);
const body = await readJson<{ tmdbId: number; user: string | null; qualityProfileId?: number }>(request);
await requestMovie(config, Number(body.tmdbId), body.user, Number(body.qualityProfileId) || undefined);
sendJson(response, 200, { ok: true });
return;
}
if (url.pathname === '/api/requests/series' && method === 'POST') {
const config = await readConfig(session!.encryptionKey);
const body = await readJson<{ tmdbId: number; user: string | null }>(request);
await requestSeries(config, Number(body.tmdbId), body.user);
const body = await readJson<{ tmdbId: number; user: string | null; qualityProfileId?: number }>(request);
await requestSeries(config, Number(body.tmdbId), body.user, Number(body.qualityProfileId) || undefined);
sendJson(response, 200, { ok: true });
return;
}
+118 -8
View File
@@ -37,6 +37,7 @@ const PROCESSING_TTL_MS = 60 * 60 * 1000; // 1 hour max
const processingQueue: ProcessingItem[] = [];
const completedDownloads: CompletedDownloadItem[] = [];
let previousDownloadIds = new Set<string>();
const cancelledDownloadIds = new Set<string>();
export function addProcessingItem(item: Omit<ProcessingItem, 'id' | 'createdAt'>): void {
const id = `proc-${item.source}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
@@ -73,6 +74,7 @@ function detectCompletedDownloads(currentDownloads: DownloadItem[]): void {
// Items that were downloading before but are no longer in the queue = completed
for (const prevId of previousDownloadIds) {
if (!currentIds.has(prevId)) {
const wasCancelled = cancelledDownloadIds.delete(prevId);
// Find the item info from the last known state — we stored it below
const cached = lastKnownDownloads.get(prevId);
if (cached) {
@@ -85,6 +87,7 @@ function detectCompletedDownloads(currentDownloads: DownloadItem[]): void {
backdropUrl: cached.backdropUrl,
tmdbId: cached.tmdbId,
mediaType: cached.mediaType,
status: wasCancelled ? 'cancelled' : 'completed',
completedAt: new Date().toISOString(),
});
}
@@ -371,7 +374,13 @@ export function sanitizeConfig(input: AppConfig): AppConfig {
language: input.preferences.language.trim() || 'en-US',
region: input.preferences.region.trim().toUpperCase(),
excludeLibraryItems: Boolean(input.preferences.excludeLibraryItems),
animationLevel: input.preferences.animationLevel === 'reduced' ? 'reduced' : 'smooth'
animationLevel: input.preferences.animationLevel === 'reduced' ? 'reduced' : 'smooth',
sonarrDownloadQualityProfileIds: Array.isArray(input.preferences.sonarrDownloadQualityProfileIds)
? input.preferences.sonarrDownloadQualityProfileIds.map(String)
: [],
radarrDownloadQualityProfileIds: Array.isArray(input.preferences.radarrDownloadQualityProfileIds)
? input.preferences.radarrDownloadQualityProfileIds.map(String)
: []
},
jellyfin: {
baseUrl: normalizeBaseUrl(input.jellyfin.baseUrl),
@@ -844,6 +853,9 @@ export async function removeDownload(config: AppConfig, id: string): Promise<voi
throw new Error(`${source === 'sonarr' ? 'Sonarr' : 'Radarr'} is not configured.`);
}
const queue = source === 'sonarr' ? await getSonarrQueue(config) : await getRadarrQueue(config);
const queueItem = queue.find((item) => String(item.id) === rawId);
const response = await fetch(
`${baseUrl}/api/v3/queue/${encodeURIComponent(rawId)}?removeFromClient=true&blocklist=false&skipRedownload=false`,
{
@@ -857,6 +869,86 @@ export async function removeDownload(config: AppConfig, id: string): Promise<voi
if (!response.ok) {
throw new Error(`${source === 'sonarr' ? 'Sonarr' : 'Radarr'} ${response.status} ${response.statusText}`);
}
cancelledDownloadIds.add(id);
if (source === 'radarr' && queueItem) {
const movieId = (queueItem as RadarrQueueRecord).movie?.id;
const title = (queueItem as RadarrQueueRecord).movie?.title || queueItem.title;
if (title) {
removeProcessingItem('radarr', title);
}
if (movieId) {
await removeRadarrMovieIfEmpty(config, movieId, queue as RadarrQueueRecord[], rawId);
}
}
if (source === 'sonarr' && queueItem) {
const seriesId = (queueItem as SonarrQueueRecord).seriesId;
const title = (queueItem as SonarrQueueRecord).series?.title || queueItem.title;
if (title) {
removeProcessingItem('sonarr', title);
}
if (seriesId) {
await removeSonarrSeriesIfEmpty(config, seriesId, queue as SonarrQueueRecord[], rawId);
}
}
}
function removeProcessingItem(source: ProcessingItem['source'], title: string): void {
for (let index = processingQueue.length - 1; index >= 0; index--) {
if (processingQueue[index].source === source && processingQueue[index].title.toLowerCase() === title.toLowerCase()) {
processingQueue.splice(index, 1);
}
}
}
async function removeRadarrMovieIfEmpty(
config: AppConfig,
movieId: number,
queue: RadarrQueueRecord[],
cancelledQueueId: string
): Promise<void> {
if (queue.some((item) => String(item.id) !== cancelledQueueId && item.movie?.id === movieId)) {
return;
}
const movie = await getRadarrMovieById(config, movieId);
if (!movie || movie.hasFile) {
return;
}
const response = await fetch(
`${config.radarr.baseUrl}/api/v3/movie/${encodeURIComponent(String(movieId))}?deleteFiles=false&addImportExclusion=false`,
{ method: 'DELETE', headers: { 'X-Api-Key': config.radarr.apiKey } }
);
if (!response.ok) {
throw new Error(`Radarr ${response.status} ${response.statusText}`);
}
}
async function removeSonarrSeriesIfEmpty(
config: AppConfig,
seriesId: number,
queue: SonarrQueueRecord[],
cancelledQueueId: string
): Promise<void> {
if (queue.some((item) => String(item.id) !== cancelledQueueId && item.seriesId === seriesId)) {
return;
}
const files = await getSonarrEpisodeFilesBySeriesId(config, seriesId);
if (files.length) {
return;
}
const response = await fetch(
`${config.sonarr.baseUrl}/api/v3/series/${encodeURIComponent(String(seriesId))}?deleteFiles=false`,
{ method: 'DELETE', headers: { 'X-Api-Key': config.sonarr.apiKey } }
);
if (!response.ok) {
throw new Error(`Sonarr ${response.status} ${response.statusText}`);
}
}
export async function getTitleDetails(
@@ -1883,6 +1975,21 @@ async function getRadarrMovieRecord(config: AppConfig, tmdbId: number): Promise<
}
}
async function getRadarrMovieById(config: AppConfig, movieId: number): Promise<RadarrMovieRecord | null> {
if (!config.radarr.baseUrl || !config.radarr.apiKey || !movieId) {
return null;
}
try {
return await fetchJson<RadarrMovieRecord>(
`${config.radarr.baseUrl}/api/v3/movie/${encodeURIComponent(String(movieId))}`,
{ headers: { 'X-Api-Key': config.radarr.apiKey } }
);
} catch {
return null;
}
}
async function resolveSonarrRequestConfig(config: AppConfig): Promise<{
rootFolderPath: string;
qualityProfileId: number;
@@ -2459,7 +2566,7 @@ function mapJellyfinEpisode(episode: JellyfinItem): TitleDetailsEpisode {
};
}
export async function requestMovie(config: AppConfig, tmdbId: number, user: string | null): Promise<void> {
export async function requestMovie(config: AppConfig, tmdbId: number, user: string | null, qualityProfileId?: number): Promise<void> {
if (!config.radarr.baseUrl || !config.radarr.apiKey) {
throw new Error('Radarr is not configured.');
}
@@ -2487,7 +2594,7 @@ export async function requestMovie(config: AppConfig, tmdbId: number, user: stri
},
body: JSON.stringify({
title: details.title || details.original_title || 'Movie',
qualityProfileId: radarrRequestConfig.qualityProfileId,
qualityProfileId: qualityProfileId || radarrRequestConfig.qualityProfileId,
rootFolderPath: radarrRequestConfig.rootFolderPath,
tmdbId: details.id,
year: Number(String(details.release_date || '').slice(0, 4)) || 0,
@@ -2530,7 +2637,8 @@ export async function requestMovie(config: AppConfig, tmdbId: number, user: stri
},
body: JSON.stringify({
name: 'MoviesSearch',
movieIds: [movie.id]
movieIds: [movie.id],
qualityProfileId
})
});
@@ -2545,7 +2653,7 @@ export async function requestMovie(config: AppConfig, tmdbId: number, user: stri
});
}
export async function requestSeries(config: AppConfig, tmdbId: number, user: string | null): Promise<void> {
export async function requestSeries(config: AppConfig, tmdbId: number, user: string | null, qualityProfileId?: number): Promise<void> {
if (!config.sonarr.baseUrl || !config.sonarr.apiKey) {
throw new Error('Sonarr is not configured.');
}
@@ -2582,7 +2690,7 @@ export async function requestSeries(config: AppConfig, tmdbId: number, user: str
body: JSON.stringify({
title: details.name || details.original_name || 'Series',
tvdbId,
qualityProfileId: sonarrRequestConfig.qualityProfileId,
qualityProfileId: qualityProfileId || sonarrRequestConfig.qualityProfileId,
languageProfileId: sonarrRequestConfig.languageProfileId,
rootFolderPath: sonarrRequestConfig.rootFolderPath,
seasonFolder: true,
@@ -2642,7 +2750,8 @@ export async function requestSeason(config: AppConfig, payload: SeasonRequestPay
body: JSON.stringify({
name: 'SeasonSearch',
seriesId: payload.seriesId,
seasonNumber: payload.seasonNumber
seasonNumber: payload.seasonNumber,
qualityProfileId: payload.qualityProfileId
})
});
@@ -2673,7 +2782,8 @@ export async function requestEpisode(config: AppConfig, payload: EpisodeRequestP
},
body: JSON.stringify({
name: 'EpisodeSearch',
episodeIds: [payload.episodeId]
episodeIds: [payload.episodeId],
qualityProfileId: payload.qualityProfileId
})
});
+8 -1
View File
@@ -53,6 +53,8 @@ export interface AppPreferences {
region: string;
excludeLibraryItems: boolean;
animationLevel: 'smooth' | 'reduced';
sonarrDownloadQualityProfileIds: string[];
radarrDownloadQualityProfileIds: string[];
}
export interface AppConfig {
@@ -230,6 +232,7 @@ export interface CompletedDownloadItem {
backdropUrl?: string;
tmdbId?: number;
mediaType?: 'movie' | 'tv' | 'series';
status: 'completed' | 'cancelled';
completedAt: string;
}
@@ -286,10 +289,12 @@ export interface EpisodeWatchStateRequest {
export interface SeasonRequestPayload {
seriesId: number;
seasonNumber: number;
qualityProfileId?: number;
}
export interface EpisodeRequestPayload {
episodeId: number;
qualityProfileId?: number;
}
export interface SeasonDeletePayload {
@@ -345,7 +350,9 @@ export const defaultConfig: AppConfig = {
language: 'en-US',
region: 'US',
excludeLibraryItems: true,
animationLevel: 'smooth'
animationLevel: 'smooth',
sonarrDownloadQualityProfileIds: [],
radarrDownloadQualityProfileIds: []
},
jellyfin: {
baseUrl: '',
+203 -44
View File
@@ -140,6 +140,13 @@ function App() {
setEntryStage(resolveEntryStage(settings, serviceOptions))
}
async function refreshDownloads() {
const response = await api.getDownloads()
setDownloads(response.downloading)
setProcessingItems(response.processing)
setCompletedDownloads(response.completed)
}
async function loadHub(page: HubPageResponse['page'], options?: { silent?: boolean }) {
if (!options?.silent) {
setHubLoading(true)
@@ -207,8 +214,11 @@ function App() {
}
if (route === 'downloads') {
void refreshBaseData()
return
void refreshDownloads()
const interval = window.setInterval(() => {
void refreshDownloads()
}, 2500)
return () => window.clearInterval(interval)
}
const page = route as HubPageResponse['page']
@@ -330,7 +340,7 @@ function App() {
}
}
async function handleRequest(card: MediaCard) {
async function handleRequest(card: MediaCard, qualityProfileId?: number) {
if (!card.tmdbId) return
setBusy(true)
@@ -338,9 +348,9 @@ function App() {
setNotice('')
try {
if (card.mediaType === 'movie') {
await api.requestMovie(card.tmdbId, currentJellyfinUser)
await api.requestMovie(card.tmdbId, currentJellyfinUser, qualityProfileId)
} else {
await api.requestSeries(card.tmdbId, currentJellyfinUser)
await api.requestSeries(card.tmdbId, currentJellyfinUser, qualityProfileId)
}
if (route !== 'downloads' && route !== 'settings' && route !== 'search' && route !== 'calendar') {
await loadHub(route as HubPageResponse['page'], { silent: true })
@@ -359,11 +369,7 @@ function App() {
setNotice('')
try {
await api.deleteDownload({ id })
const resp = await api.getDownloads()
setDownloads(resp.downloading)
setProcessingItems(resp.processing)
setCompletedDownloads(resp.completed)
setNotice('Download removed from the queue.')
await refreshDownloads()
} catch (deleteError) {
setError(deleteError instanceof Error ? deleteError.message : 'Failed to remove the download.')
} finally {
@@ -587,6 +593,10 @@ function App() {
<TitleDetailsModal
card={selectedCard.card}
config={config}
qualityProfiles={{
sonarr: options.sonarrQualityProfiles.filter((profile) => config.preferences.sonarrDownloadQualityProfileIds.includes(profile.id)),
radarr: options.radarrQualityProfiles.filter((profile) => config.preferences.radarrDownloadQualityProfileIds.includes(profile.id)),
}}
onClose={() => setSelectedCard(null)}
originRect={selectedCard.originRect}
onRequest={handleRequest}
@@ -1561,8 +1571,9 @@ function TitleDetailsModal(props: {
config: AppConfig
onClose: () => void
originRect: ModalOriginRect | null
onRequest: (card: MediaCard) => Promise<void>
onRequest: (card: MediaCard, qualityProfileId?: number) => Promise<void>
currentUser: string | null
qualityProfiles: { sonarr: SelectOption[]; radarr: SelectOption[] }
}) {
const [details, setDetails] = useState<TitleDetailsResponse | null>(null)
const [detailsLoading, setDetailsLoading] = useState(true)
@@ -1576,6 +1587,12 @@ function TitleDetailsModal(props: {
const [seasonMenuOpen, setSeasonMenuOpen] = useState(false)
const [movieRequestPending, setMovieRequestPending] = useState(false)
const [movieDeleteBusy, setMovieDeleteBusy] = useState(false)
const [qualityPicker, setQualityPicker] = useState<{
title: string
logoUrl?: string
profiles: SelectOption[]
onConfirm: (qualityProfileId?: number) => void
} | null>(null)
const [playerTarget, setPlayerTarget] = useState<{ id: string; title: string } | null>(null)
const [isOverviewExpanded, setIsOverviewExpanded] = useState(false)
const [episodeScrollState, setEpisodeScrollState] = useState({ canScrollLeft: false, canScrollRight: false })
@@ -2025,7 +2042,7 @@ function TitleDetailsModal(props: {
return
}
if (movieRequestPending && (details.requestStatus === 'processing' || details.requestStatus === 'downloading')) {
if (movieRequestPending && details.requestStatus === 'downloading') {
setMovieRequestPending(false)
}
}, [details, movieRequestPending])
@@ -2037,7 +2054,7 @@ function TitleDetailsModal(props: {
const timeoutId = window.setTimeout(() => {
setMovieRequestPending(false)
}, 15000)
}, 5 * 60 * 1000)
return () => {
window.clearTimeout(timeoutId)
@@ -2137,7 +2154,15 @@ function TitleDetailsModal(props: {
})
}
async function handleSeasonDownload() {
function openQualityPicker(
title: string,
profiles: SelectOption[],
onConfirm: (qualityProfileId?: number) => void
) {
setQualityPicker({ title, logoUrl, profiles, onConfirm })
}
async function handleSeasonDownload(qualityProfileId?: number) {
if (typeof activeSeasonNumber !== 'number') {
return
}
@@ -2156,9 +2181,10 @@ function TitleDetailsModal(props: {
await api.requestSeason({
seriesId: details.sonarrSeriesId,
seasonNumber: activeSeasonNumber,
qualityProfileId,
}, props.currentUser)
} else {
await props.onRequest(props.card)
await props.onRequest(props.card, qualityProfileId)
}
await refreshSeasonState(seasonValue || undefined)
} catch (error) {
@@ -2233,7 +2259,7 @@ function TitleDetailsModal(props: {
}
}
async function handleMovieRequest() {
async function handleMovieRequest(qualityProfileId?: number) {
if (details?.mediaType !== 'movie' || movieRequestStatus === 'processing' || movieRequestStatus === 'downloading') {
return
}
@@ -2249,7 +2275,7 @@ function TitleDetailsModal(props: {
: current)
try {
await props.onRequest(props.card)
await props.onRequest(props.card, qualityProfileId)
await refreshSeasonState()
} catch (error) {
setMovieRequestPending(false)
@@ -2308,6 +2334,19 @@ function TitleDetailsModal(props: {
return
}
openQualityPicker(
`Download ${details?.episodes.find((episode) => episode.id === episodeId)?.title || 'episode'}`,
props.qualityProfiles.sonarr,
(qualityProfileId) => queueEpisodeDownload(episodeId, sonarrEpisodeId, availability, qualityProfileId)
)
}
function queueEpisodeDownload(
episodeId: string,
sonarrEpisodeId: number,
availability: TitleDetailsResponse['episodes'][number]['availability'],
qualityProfileId?: number
) {
setEpisodeDownloadBusyId(episodeId)
setPendingEpisodeRequestIds((current) => current.includes(episodeId) ? current : [...current, episodeId])
updateEpisodeInCaches(episodeId, (episode) => ({
@@ -2317,7 +2356,7 @@ function TitleDetailsModal(props: {
canDownload: false,
}))
void api.requestEpisode({ episodeId: sonarrEpisodeId }, props.currentUser)
void api.requestEpisode({ episodeId: sonarrEpisodeId, qualityProfileId }, props.currentUser)
.catch(() => {
setPendingEpisodeRequestIds((current) => current.filter((id) => id !== episodeId))
updateEpisodeInCaches(episodeId, (episode) => ({
@@ -2475,7 +2514,11 @@ function TitleDetailsModal(props: {
</div>
)
) : (
<button className="secondary-button title-action-button" onClick={() => void handleMovieRequest()} type="button">
<button
className="secondary-button title-action-button"
onClick={() => openQualityPicker(displayTitle, props.qualityProfiles.radarr, (qualityProfileId) => void handleMovieRequest(qualityProfileId))}
type="button"
>
<DownloadGlyph />
<span>Request</span>
</button>
@@ -2577,7 +2620,11 @@ function TitleDetailsModal(props: {
aria-label="Download season"
className="title-season-action"
disabled={seasonActionBusy === 'download'}
onClick={() => void handleSeasonDownload()}
onClick={() => openQualityPicker(
`${displayTitle} · ${activeSeasonMeta?.title || 'Season'}`,
props.qualityProfiles.sonarr,
(qualityProfileId) => void handleSeasonDownload(qualityProfileId)
)}
type="button"
>
<DownloadGlyph />
@@ -2795,12 +2842,61 @@ function TitleDetailsModal(props: {
</div>
</div>
) : null}
{qualityPicker ? (
<QualityPicker
onCancel={() => setQualityPicker(null)}
onSelect={(qualityProfileId) => {
const request = qualityPicker
setQualityPicker(null)
request.onConfirm(qualityProfileId)
}}
profiles={qualityPicker.profiles}
logoUrl={qualityPicker.logoUrl}
title={qualityPicker.title}
/>
) : null}
</div>
</div>
</div>
)
}
function QualityPicker(props: {
title: string
logoUrl?: string
profiles: SelectOption[]
onCancel: () => void
onSelect: (qualityProfileId?: number) => void
}) {
return (
<div
className="quality-picker-backdrop"
onClick={(event) => {
event.stopPropagation()
props.onCancel()
}}
role="presentation"
>
<section
aria-label={`Select quality for ${props.title}`}
aria-modal="true"
className="quality-picker"
onClick={(event) => event.stopPropagation()}
role="dialog"
>
{props.logoUrl ? <img alt={props.title} className="quality-picker-logo" src={props.logoUrl} /> : <h3>{props.title}</h3>}
<p className="quality-picker-label">Select quality:</p>
<div className="quality-picker-options">
<button onClick={() => props.onSelect()} type="button">Auto <span>Best version available</span></button>
{props.profiles.map((profile) => (
<button key={profile.id} onClick={() => props.onSelect(Number(profile.id))} type="button">{profile.label}</button>
))}
</div>
</section>
</div>
)
}
function buildJellyfinPlayerUrl(baseUrl: string, itemId: string) {
return `${baseUrl.replace(/\/$/, '')}/web/#/details?id=${encodeURIComponent(itemId)}&autoplay=true`
}
@@ -3017,6 +3113,14 @@ function DownloadsPage(props: {
</div>
<div className="download-side">
<div className="download-progress-panel">
<button
aria-label={`Dismiss ${item.title}`}
className="download-action-button download-delete-button download-history-dismiss-button"
onClick={() => props.onDismissCompleted(item.id)}
type="button"
>
×
</button>
<div className="download-progress-header">
<span className="download-processing-badge">Processing</span>
</div>
@@ -3047,47 +3151,54 @@ function DownloadsPage(props: {
{props.completedDownloads.length > 0 ? (
<section className="downloads-section">
<div className="downloads-section-header">
<h3 className="downloads-section-title">Completed</h3>
<button className="downloads-dismiss-all-button" onClick={props.onDismissAllCompleted} type="button">
Dismiss all
<h3 className="downloads-section-title">History</h3>
<button aria-label="Dismiss history" className="downloads-dismiss-all-button" onClick={props.onDismissAllCompleted} title="Dismiss history" type="button">
×
</button>
</div>
<div className="downloads-grid">
{props.completedDownloads.map((item) => (
<article className="download-row download-row-completed" key={item.id}>
<article className={item.status === 'cancelled' ? 'download-row download-row-cancelled' : 'download-row download-row-completed'} key={item.id}>
<button
aria-label={`Dismiss ${item.title}`}
className="download-action-button download-delete-button download-history-dismiss-button"
onClick={() => props.onDismissCompleted(item.id)}
type="button"
>
×
</button>
<div className="download-card">
<div className="download-artwork">
{item.posterUrl || item.backdropUrl
? <img alt={item.title} loading="lazy" src={item.backdropUrl || item.posterUrl} />
? (
<picture>
{item.posterUrl ? <source media="(max-width: 980px)" srcSet={item.posterUrl} /> : null}
<img alt={item.title} loading="lazy" src={item.backdropUrl || item.posterUrl} />
</picture>
)
: <div className="media-fallback download-poster-fallback">{item.title.slice(0, 1).toUpperCase()}</div>}
</div>
<div className="download-copy">
<h4>{item.title}</h4>
{item.subtitle ? <p className="download-subtitle">{item.subtitle}</p> : null}
<p className="download-detail download-completed-label">Download completed</p>
<p className="download-detail download-completed-label">{item.status === 'cancelled' ? 'Download cancelled' : 'Download completed'}</p>
</div>
</div>
<div className="download-side">
<div className="download-progress-panel">
<div className="download-progress-header">
<strong className="download-completed-badge">100%</strong>
<span>Completed</span>
</div>
<div className="download-progress-row">
<div className="download-progress-bar download-progress-complete">
<div className="download-progress-fill" style={{ width: '100%' }} />
{item.status === 'completed' ? (
<div className="download-side">
<div className="download-progress-panel">
<div className="download-progress-header">
<strong className="download-completed-badge">100%</strong>
<span>Completed</span>
</div>
<div className="download-progress-row">
<div className="download-progress-bar download-progress-complete">
<div className="download-progress-fill" style={{ width: '100%' }} />
</div>
</div>
<button
aria-label={`Dismiss ${item.title}`}
className="download-action-button download-delete-button"
onClick={() => props.onDismissCompleted(item.id)}
type="button"
>
×
</button>
</div>
</div>
</div>
) : null}
</article>
))}
</div>
@@ -3469,6 +3580,14 @@ function SettingsView(props: {
onApiKeyChange={(apiKey) => props.updateConfig('sonarr', { ...props.config.sonarr, apiKey })}
onBaseUrlChange={(baseUrl) => props.updateConfig('sonarr', { ...props.config.sonarr, baseUrl })}
/>
<QualityProfileVisibility
profiles={props.options.sonarrQualityProfiles}
selectedProfileIds={props.config.preferences.sonarrDownloadQualityProfileIds}
onChange={(sonarrDownloadQualityProfileIds) => props.updateConfig('preferences', {
...props.config.preferences,
sonarrDownloadQualityProfileIds,
})}
/>
</SettingsCard>
<SettingsCard title="Radarr">
@@ -3478,6 +3597,14 @@ function SettingsView(props: {
onApiKeyChange={(apiKey) => props.updateConfig('radarr', { ...props.config.radarr, apiKey })}
onBaseUrlChange={(baseUrl) => props.updateConfig('radarr', { ...props.config.radarr, baseUrl })}
/>
<QualityProfileVisibility
profiles={props.options.radarrQualityProfiles}
selectedProfileIds={props.config.preferences.radarrDownloadQualityProfileIds}
onChange={(radarrDownloadQualityProfileIds) => props.updateConfig('preferences', {
...props.config.preferences,
radarrDownloadQualityProfileIds,
})}
/>
</SettingsCard>
<SettingsCard title="TMDb">
@@ -3532,6 +3659,38 @@ function ServiceFields(props: {
)
}
function QualityProfileVisibility(props: {
profiles: SelectOption[]
selectedProfileIds: string[]
onChange: (profileIds: string[]) => void
}) {
return (
<fieldset className="quality-profile-visibility">
<legend>Profiles shown when downloading</legend>
<p>Auto is always available. Select the quality profiles users can choose.</p>
{props.profiles.length ? (
<div className="quality-profile-visibility-list">
{props.profiles.map((profile) => {
const checked = props.selectedProfileIds.includes(profile.id)
return (
<label key={profile.id}>
<input
checked={checked}
onChange={() => props.onChange(checked
? props.selectedProfileIds.filter((id) => id !== profile.id)
: [...props.selectedProfileIds, profile.id])}
type="checkbox"
/>
<span>{profile.label}</span>
</label>
)
})}
</div>
) : <p>Save the service connection first to load its quality profiles.</p>}
</fieldset>
)
}
function EmptyState({ title, copy, className }: { title: string; copy: string; className?: string }) {
return (
<div className={className ? `empty-state ${className}` : 'empty-state'}>
+4 -4
View File
@@ -122,15 +122,15 @@ export const api = {
request<{ ok: boolean }>('/api/downloads/dismiss-all', {
method: 'POST',
}),
requestMovie: (tmdbId: number, user: string | null) =>
requestMovie: (tmdbId: number, user: string | null, qualityProfileId?: number) =>
request<{ ok: boolean }>('/api/requests/movie', {
method: 'POST',
body: JSON.stringify({ tmdbId, user }),
body: JSON.stringify({ tmdbId, user, qualityProfileId }),
}),
requestSeries: (tmdbId: number, user: string | null) =>
requestSeries: (tmdbId: number, user: string | null, qualityProfileId?: number) =>
request<{ ok: boolean }>('/api/requests/series', {
method: 'POST',
body: JSON.stringify({ tmdbId, user }),
body: JSON.stringify({ tmdbId, user, qualityProfileId }),
}),
requestSeason: (payload: SeasonRequestPayload, user: string | null) =>
request<{ ok: boolean }>('/api/requests/season', {
+218 -6
View File
@@ -1932,6 +1932,124 @@ img {
border-color: rgba(255, 255, 255, 0.12);
}
.quality-picker-backdrop {
position: fixed;
z-index: 30;
inset: 0;
display: grid;
place-items: center;
padding: 1.25rem;
background: rgba(0, 0, 0, 0.54);
backdrop-filter: blur(6px);
}
.quality-picker {
width: min(100%, 26rem);
padding: 1.35rem;
border: 1px solid rgba(255, 255, 255, 0.14);
border-radius: 1.1rem;
background: #171a20;
box-shadow: 0 1.4rem 4rem rgba(0, 0, 0, 0.45);
}
.quality-picker-logo {
display: block;
width: min(100%, 14rem);
max-height: 4.5rem;
margin: 0 auto 1.5rem;
object-fit: contain;
}
.quality-picker h3 {
margin: 0 0 1.5rem;
text-align: center;
}
.quality-picker-label {
margin: 0 0 0.75rem;
color: #dfe7f7;
font-size: 0.9rem;
font-weight: 700;
}
.quality-picker-options {
display: grid;
gap: 0.65rem;
}
.quality-picker-options button {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
min-height: 2.9rem;
padding: 0.65rem 0.85rem;
border: 1px solid rgba(255, 255, 255, 0.14);
border-radius: 0.7rem;
background: rgba(255, 255, 255, 0.06);
color: #f2f6ff;
font: inherit;
font-weight: 650;
text-align: left;
transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.quality-picker-options button:hover,
.quality-picker-options button:focus-visible {
border-color: rgba(255, 255, 255, 0.28);
background: rgba(255, 255, 255, 0.12);
transform: translateY(-1px);
}
.quality-picker-options button span {
color: #aeb9cd;
font-size: 0.78rem;
font-weight: 500;
}
.quality-profile-visibility {
display: grid;
gap: 0.65rem;
margin: 0;
padding: 1rem;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 0.8rem;
}
.quality-profile-visibility legend {
padding: 0 0.35rem;
color: #e8efff;
font-size: 0.9rem;
font-weight: 700;
}
.quality-profile-visibility > p {
margin: 0;
color: #9ba9c2;
font-size: 0.82rem;
}
.quality-profile-visibility-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
gap: 0.55rem;
}
.quality-profile-visibility-list label {
display: flex;
align-items: center;
gap: 0.55rem;
min-width: 0;
color: #dfe7f7;
font-size: 0.86rem;
}
.quality-profile-visibility-list input {
width: 1rem;
height: 1rem;
accent-color: #dfe7f7;
}
.title-seasons-panel {
display: grid;
gap: 1.3rem;
@@ -3112,11 +3230,11 @@ img {
}
.downloads-section {
padding-bottom: 1.4rem;
padding: 0 1.25rem 1.4rem;
}
.downloads-header {
padding: calc(env(safe-area-inset-top, 0px) + 1.1rem) 2.35rem 0;
padding: calc(env(safe-area-inset-top, 0px) + 1.1rem) 1.25rem 0;
}
.downloads-grid {
@@ -3163,6 +3281,12 @@ img {
object-fit: cover;
}
.download-artwork picture {
display: block;
width: 100%;
height: 100%;
}
.download-poster-fallback {
display: grid;
place-items: center;
@@ -3251,6 +3375,21 @@ img {
gap: 0.8rem;
}
.download-history-dismiss-button {
position: absolute;
top: 0.7rem;
right: 0.7rem;
}
.download-row-completed,
.download-row-cancelled {
position: relative;
}
.download-row-completed .download-progress-header {
padding-right: 2.5rem;
}
.download-action-button {
width: 1.9rem;
height: 1.9rem;
@@ -3283,22 +3422,32 @@ img {
}
.downloads-section-header {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
min-height: 1.9rem;
margin-bottom: 0.6rem;
}
.downloads-section-header .downloads-section-title {
display: flex;
align-items: center;
min-height: 1.9rem;
margin-bottom: 0;
}
.downloads-dismiss-all-button {
display: inline-grid;
width: 1.9rem;
height: 1.9rem;
place-items: center;
padding: 0 0 0.04rem;
border: 0;
background: rgba(255, 255, 255, 0.07);
color: #98a8c4;
font-size: 0.82rem;
padding: 0.35rem 0.85rem;
font-size: 1.1rem;
line-height: 1;
border-radius: 999px;
cursor: pointer;
transition: background 0.15s, color 0.15s;
@@ -3309,6 +3458,13 @@ img {
color: #dbe2ee;
}
.downloads-section-header .downloads-dismiss-all-button {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
.download-processing-label {
display: flex;
align-items: center;
@@ -3347,6 +3503,15 @@ img {
opacity: 0.85;
}
.download-row-cancelled {
opacity: 0.72;
}
.download-row-cancelled .download-completed-label,
.download-row-cancelled .download-completed-badge {
color: #ff9b9b;
}
.settings-page {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@@ -4195,6 +4360,13 @@ img {
padding: 0.8rem;
}
.omniarr-sidebar:hover .sidebar-profile,
.omniarr-sidebar:hover .sidebar-link,
.omniarr-sidebar:hover .sidebar-settings {
justify-content: flex-start;
overflow: visible;
}
.sidebar-profile-copy,
.sidebar-link > span:last-child,
.sidebar-settings > span:last-child,
@@ -4230,6 +4402,25 @@ img {
transform: none;
}
.omniarr-sidebar:hover .sidebar-footer > .sidebar-disk {
gap: 0.8rem;
justify-content: flex-start;
width: 100%;
min-width: 0;
max-width: none;
padding: 0.8rem;
overflow: visible;
}
.omniarr-sidebar:hover .sidebar-disk-copy {
position: static;
width: auto;
max-width: none;
overflow: visible;
opacity: 1;
transform: none;
}
.omniarr-sidebar.is-open:not(:hover) .sidebar-profile-copy,
.omniarr-sidebar.is-open:not(:hover) .sidebar-link > span:last-child,
.omniarr-sidebar.is-open:not(:hover) .sidebar-settings > span:last-child,
@@ -4343,6 +4534,7 @@ img {
}
.title-summary-header-play,
.title-summary-header-delete,
.title-season-play-button {
display: none;
}
@@ -4606,7 +4798,7 @@ img {
}
.download-row {
grid-template-columns: 4.75rem minmax(0, 1fr);
grid-template-columns: 5rem minmax(0, 1fr);
column-gap: 0.7rem;
row-gap: 0.35rem;
align-items: start;
@@ -4620,11 +4812,31 @@ img {
.download-artwork {
grid-row: 1 / span 2;
width: 4.75rem;
width: 5rem;
border-radius: 0.65rem;
aspect-ratio: 2 / 3;
}
.download-row-cancelled {
grid-template-columns: 5rem minmax(0, 1fr);
min-height: 0;
}
.download-row-cancelled .download-artwork {
grid-row: 1;
width: 5rem;
aspect-ratio: 2 / 3;
}
.download-row-cancelled .download-copy {
padding-right: 1.7rem;
}
.download-history-dismiss-button {
top: 0.55rem;
right: 0.55rem;
}
.download-copy {
grid-column: 2;
align-content: start;