chore: update Angular cache and TypeScript build info
This commit is contained in:
@@ -10,14 +10,15 @@ const handler = {
|
||||
* @returns {Promise<Array<any>>}
|
||||
*/
|
||||
async search(q, opts) {
|
||||
const { limit = 10 } = opts;
|
||||
const { limit = 10, page = 1 } = 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()
|
||||
count: Math.min(limit, 50).toString(),
|
||||
start: Math.max(0, (Math.max(1, Number(page || 1)) - 1) * Math.min(limit, 50)).toString()
|
||||
})
|
||||
);
|
||||
|
||||
@@ -27,14 +28,26 @@ const handler = {
|
||||
|
||||
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'
|
||||
}));
|
||||
return (data.data || []).map(item => {
|
||||
const rawThumb = item.thumbnailUrl || item.thumbnailPath || '';
|
||||
const thumbnail = rawThumb
|
||||
? rawThumb.startsWith('http')
|
||||
? rawThumb
|
||||
: rawThumb.startsWith('//')
|
||||
? `https:${rawThumb}`
|
||||
: new URL(rawThumb, item.url || 'https://sepiasearch.org').toString()
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
title: item.name,
|
||||
id: item.uuid,
|
||||
url: item.url,
|
||||
thumbnail,
|
||||
uploaderName: (item.account && (item.account.displayName || item.account.name)) || undefined,
|
||||
type: 'video',
|
||||
duration: typeof item.duration === 'number' && item.duration > 0 ? Math.round(item.duration) : undefined
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('PeerTube search error:', error);
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user