chore: update Angular cache and TypeScript build info files
This commit is contained in:
@@ -12,6 +12,7 @@ import ffmpegPath from 'ffmpeg-static';
|
||||
import * as cheerio from 'cheerio';
|
||||
import axios from 'axios';
|
||||
import rumbleRouter from './rumble.mjs';
|
||||
import { providerRegistry, validateProviders } from './providers/registry.mjs';
|
||||
import {
|
||||
getUserByUsername,
|
||||
getUserById,
|
||||
@@ -1386,6 +1387,45 @@ app.all('/api/odysee/*', (req, res) => forwardJson(req, res, 'https://api.na-bac
|
||||
app.all('/api/twitch-api/*', (req, res) => forwardJson(req, res, 'https://api.twitch.tv'));
|
||||
app.all('/api/twitch-auth/*', (req, res) => forwardJson(req, res, 'https://id.twitch.tv'));
|
||||
|
||||
// -------------------- Unified search endpoint (GET) --------------------
|
||||
app.get('/api/search', async (req, res) => {
|
||||
try {
|
||||
const { q, providers } = req.query;
|
||||
if (!q || typeof q !== 'string' || q.trim().length === 0) {
|
||||
return res.status(400).json({ error: 'missing_query' });
|
||||
}
|
||||
// Validate and normalize providers list (default to all supported when none/invalid)
|
||||
const requested = typeof providers === 'string' ? String(providers) : '';
|
||||
const validProviders = validateProviders(requested);
|
||||
|
||||
// Execute search for each provider in parallel
|
||||
const results = await Promise.allSettled(
|
||||
validProviders.map((providerId) => {
|
||||
const mod = providerRegistry[/** @type {any} */(providerId)];
|
||||
if (!mod || typeof mod.search !== 'function') return Promise.resolve([]);
|
||||
// Basic options: limit per provider; could be extended with page, etc.
|
||||
return Promise.resolve().then(() => mod.search(q, { limit: 10 }));
|
||||
})
|
||||
);
|
||||
|
||||
// Group results by provider id
|
||||
const groups = /** @type {Record<string, any[]>} */ ({});
|
||||
results.forEach((result, index) => {
|
||||
const providerId = validProviders[index];
|
||||
if (result.status === 'fulfilled') {
|
||||
groups[providerId] = Array.isArray(result.value) ? result.value : [];
|
||||
} else {
|
||||
console.warn(`Search failed for provider ${providerId}:`, result.reason);
|
||||
groups[providerId] = [];
|
||||
}
|
||||
});
|
||||
|
||||
return res.json({ q, providers: validProviders, groups });
|
||||
} catch (e) {
|
||||
return res.status(500).json({ error: 'search_failed', details: String(e?.message || e) });
|
||||
}
|
||||
});
|
||||
|
||||
// -------------------- Static Frontend (Angular build) --------------------
|
||||
const distRoot = path.join(process.cwd(), 'dist');
|
||||
const distBrowser = path.join(distRoot, 'browser');
|
||||
|
||||
Reference in New Issue
Block a user