mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
Rename TMDB_API_KEY to TMDB_API_READ_ACCESS_TOKEN and add optional base URL overrides
Renames the env var for clarity since it holds a read access token, not an API key. Adds optional TMDB_API_BASE_URL and TMDB_IMAGE_BASE_URL env vars for advanced users. Centralizes image URL construction into a shared tmdbImageUrl() helper, replacing hardcoded URLs across all components. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
IconSearch,
|
||||
} from "@tabler/icons-react";
|
||||
import Image from "next/image";
|
||||
import { tmdbImageUrl } from "@/lib/tmdb/image";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useKeyboard } from "@/components/keyboard-provider";
|
||||
@@ -211,7 +212,7 @@ export function CommandPalette() {
|
||||
<div className="h-12 w-8 shrink-0 overflow-hidden rounded bg-muted">
|
||||
{r.posterPath ? (
|
||||
<Image
|
||||
src={`https://image.tmdb.org/t/p/w92${r.posterPath}`}
|
||||
src={tmdbImageUrl(r.posterPath, "w92")!}
|
||||
alt={r.title}
|
||||
width={32}
|
||||
height={48}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useRouter } from "next/navigation";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useDebounce } from "@/hooks/use-debounce";
|
||||
import { tmdbImageUrl } from "@/lib/tmdb/image";
|
||||
|
||||
interface SearchResult {
|
||||
tmdbId: number;
|
||||
@@ -165,7 +166,7 @@ export function SearchAutocomplete({
|
||||
<div className="h-[60px] w-10 shrink-0 overflow-hidden rounded-md bg-muted">
|
||||
{r.posterPath ? (
|
||||
<Image
|
||||
src={`https://image.tmdb.org/t/p/w92${r.posterPath}`}
|
||||
src={tmdbImageUrl(r.posterPath, "w92")!}
|
||||
alt={r.title}
|
||||
width={40}
|
||||
height={60}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { motion } from "motion/react";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { tmdbImageUrl } from "@/lib/tmdb/image";
|
||||
|
||||
interface TitleCardProps {
|
||||
id?: string;
|
||||
@@ -27,9 +28,7 @@ export function TitleCard({
|
||||
onImport,
|
||||
}: TitleCardProps) {
|
||||
const year = releaseDate?.slice(0, 4);
|
||||
const posterUrl = posterPath
|
||||
? `https://image.tmdb.org/t/p/w300${posterPath}`
|
||||
: null;
|
||||
const posterUrl = tmdbImageUrl(posterPath, "w300");
|
||||
|
||||
const content = (
|
||||
<motion.div
|
||||
|
||||
Reference in New Issue
Block a user