/** * Minimal PeerTube provider handler */ const handler = { id: 'pt', label: 'PeerTube', /** * @param {string} q * @param {{ limit: number, page?: number }} opts * @returns {Promise>} */ async search(q, opts) { const { limit = 10 } = opts; try { // Use PeerTube API search const response = await fetch( `https://sepiasearch.org/api/v1/search/videos?` + new URLSearchParams({ search: q, count: Math.min(limit, 50).toString() }) ); if (!response.ok) { throw new Error(`PeerTube API error: ${response.status}`); } const data = await response.json(); return (data.data || []).map(item => ({ title: item.name, id: item.uuid, url: item.url, thumbnail: item.thumbnailPath, uploaderName: item.account.displayName || item.account.name, type: 'video' })); } catch (error) { console.error('PeerTube search error:', error); return []; } } }; export default handler;