- Modified `.env.example` to reflect new API URL structure and added CDN configuration for external storage. - Updated `.gitignore` to include deployment secrets and certificate files, ensuring sensitive information is not committed. - Revised `BACKEND_INTEGRATION.md` to clarify authentication methods, replacing Cognito references with Nostr NIP-98. - Deleted outdated documentation files (`CONTENT-INTEGRATION-COMPLETE.md`, `CURSOR-MCP-SETUP.md`, `FINAL-STATUS.md`, `FIXES-APPLIED.md`, `INDEEHHUB-INTEGRATION.md`, `PROJECT-COMPLETE.md`, `PROJECT-SUMMARY.md`) to streamline project documentation. These changes enhance the clarity of the environment setup and improve the overall documentation structure for better developer onboarding.
97 lines
2.3 KiB
TypeScript
97 lines
2.3 KiB
TypeScript
// Utility to fetch content from IndeeHub API
|
|
// Update with your actual API endpoints
|
|
|
|
const INDEEDHUB_API = 'https://indeehub.studio/api'
|
|
|
|
export interface IndeeHubFilm {
|
|
id: string
|
|
title: string
|
|
description: string
|
|
thumbnailUrl: string
|
|
backdropUrl?: string
|
|
type: 'film' | 'series' | 'short'
|
|
duration?: number
|
|
releaseYear?: number
|
|
rating?: string
|
|
creator?: {
|
|
name: string
|
|
npub?: string
|
|
}
|
|
nostrEventId?: string
|
|
categories: string[]
|
|
}
|
|
|
|
/**
|
|
* Fetch films from IndeeHub screening room.
|
|
* For authenticated requests, use indeehub-api.service which attaches NIP-98 tokens.
|
|
*/
|
|
export async function fetchFilms(): Promise<IndeeHubFilm[]> {
|
|
try {
|
|
const response = await fetch(`${INDEEDHUB_API}/screening-room?type=film`, {
|
|
headers: {
|
|
// Add your auth headers here
|
|
// 'Authorization': 'Bearer ...'
|
|
}
|
|
})
|
|
|
|
if (!response.ok) {
|
|
throw new Error('Failed to fetch films')
|
|
}
|
|
|
|
return await response.json()
|
|
} catch (error) {
|
|
console.error('Error fetching films:', error)
|
|
// Return mock data for development
|
|
return getMockFilms()
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Mock data for development
|
|
* Replace with real IndeeHub data
|
|
*/
|
|
function getMockFilms(): IndeeHubFilm[] {
|
|
return [
|
|
{
|
|
id: '1',
|
|
title: 'Sample Film 1',
|
|
description: 'Replace with actual IndeeHub film data',
|
|
thumbnailUrl: 'https://images.unsplash.com/photo-1518546305927-5a555bb7020d?w=400',
|
|
backdropUrl: 'https://images.unsplash.com/photo-1518546305927-5a555bb7020d?w=1920',
|
|
type: 'film',
|
|
duration: 120,
|
|
releaseYear: 2024,
|
|
categories: ['Drama']
|
|
},
|
|
// Add more mock films...
|
|
]
|
|
}
|
|
|
|
/**
|
|
* Fetch featured content
|
|
*/
|
|
export async function fetchFeaturedContent(): Promise<IndeeHubFilm | null> {
|
|
try {
|
|
const response = await fetch(`${INDEEDHUB_API}/featured`)
|
|
if (!response.ok) return null
|
|
return await response.json()
|
|
} catch (error) {
|
|
console.error('Error fetching featured:', error)
|
|
return null
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Fetch films by category
|
|
*/
|
|
export async function fetchFilmsByCategory(category: string): Promise<IndeeHubFilm[]> {
|
|
try {
|
|
const response = await fetch(`${INDEEDHUB_API}/films?category=${category}`)
|
|
if (!response.ok) return []
|
|
return await response.json()
|
|
} catch (error) {
|
|
console.error('Error fetching category:', error)
|
|
return []
|
|
}
|
|
}
|