chore: update TypeScript build info cache

This commit is contained in:
2025-09-17 09:32:10 -04:00
parent 7cb75e2d3b
commit 68f6c67240
4 changed files with 60 additions and 12 deletions
+46 -9
View File
@@ -1073,20 +1073,58 @@ r.delete('/user/likes', authMiddleware, (req, res) => {
return res.json(result);
});
r.get('/user/likes/status', authMiddleware, (req, res) => {
const provider = req.query.provider ? String(req.query.provider) : '';
const videoId = req.query.videoId ? String(req.query.videoId) : '';
if (!provider || !videoId) return res.status(400).json({ error: 'provider and videoId are required' });
const liked = isVideoLiked({ userId: req.user.id, provider, videoId });
return res.json({ liked });
// Odysee image proxy to avoid CORS/ORB issues
r.get('/img/odysee', async (req, res) => {
try {
const imageUrl = req.query.u ? String(req.query.u) : '';
if (!imageUrl) return res.status(400).json({ error: 'Missing image URL' });
// Only allow specific Odysee domains for security
const allowedHosts = [
'thumbnails.odycdn.com',
'thumbs.odycdn.com',
'od.lk',
'cdn.lbryplayer.xyz',
'spee.ch',
'cdn.lbryplayer.xyz',
'thumbnails.lbry.com',
'static.odycdn.com',
'thumbnails.odycdn.com'
];
const url = new URL(imageUrl);
if (!allowedHosts.includes(url.hostname)) {
return res.status(403).json({ error: 'Forbidden domain' });
}
// Fetch the image
const response = await fetch(imageUrl, {
headers: { 'User-Agent': 'NewTube/1.0' },
redirect: 'follow'
});
if (!response.ok) {
return res.status(response.status).send(`Error fetching image: ${response.statusText}`);
}
// Forward the image with appropriate caching
res.setHeader('Cache-Control', 'public, max-age=600');
res.setHeader('Content-Type', response.headers.get('content-type') || 'image/jpeg');
const arrayBuffer = await response.arrayBuffer();
res.send(Buffer.from(arrayBuffer));
} catch (error) {
console.error('Error proxying Odysee image:', error);
res.status(500).json({ error: 'Internal server error' });
}
});
app.use('/api', r);
// Alias to support Angular dev proxy paths in both dev and production builds
app.use('/proxy/api', r);
// Mount dedicated Rumble router (browse, search, video)
app.use('/api/rumble', rumbleRouter);
app.get('/health', (_req, res) => res.json({ ok: true }));
// -------------------- Client config from environment --------------------
function jsVal(v) { return JSON.stringify(v == null ? '' : v); }
app.get(['/assets/config.local.js', '/config.js'], (_req, res) => {
@@ -1129,7 +1167,6 @@ async function forwardJson(req, res, base) {
}
app.all('/api/dm/*', (req, res) => forwardJson(req, res, 'https://api.dailymotion.com'));
app.all('/api/odysee/*', (req, res) => forwardJson(req, res, 'https://api.na-backend.odysee.com'));
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'));