chore: update Angular cache and TypeScript build info
This commit is contained in:
+29
-18
@@ -967,7 +967,7 @@ r.post('/auth/refresh', async (req, res) => {
|
||||
// rotate token
|
||||
const nextToken = cryptoRandomId();
|
||||
const nextHash = await hashToken(nextToken);
|
||||
const days = session.is_remember ? REMEMBER_TTL_DAYS : REFRESH_TTL_DAYS;
|
||||
const days = session.isRemember ? REMEMBER_TTL_DAYS : REFRESH_TTL_DAYS;
|
||||
const expiresAt = new Date(Date.now() + days * 86400_000).toISOString();
|
||||
updateSessionToken(session.id, nextHash, expiresAt);
|
||||
setRefreshCookies(res, { sessionId: session.id, token: nextToken, days });
|
||||
@@ -1132,9 +1132,7 @@ r.post('/user/likes', authMiddleware, async (req, res) => {
|
||||
const meta = (typeof raw === 'string') ? JSON.parse(raw || '{}') : (raw || {});
|
||||
if (needTitle) title = meta?.title || title || '';
|
||||
if (needThumb) thumbnail = meta?.thumbnail || (Array.isArray(meta?.thumbnails) && meta.thumbnails.length ? meta.thumbnails[0].url : thumbnail || '');
|
||||
} catch (e) {
|
||||
console.warn('[POST /user/likes] details fetch failed, continuing without enrichment:', e?.message || e);
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
} catch {}
|
||||
|
||||
@@ -1267,6 +1265,8 @@ r.get('/img/odysee', async (req, res) => {
|
||||
|
||||
// Mount API router (prod) and alias for dev proxy
|
||||
app.use('/api', r);
|
||||
// Health endpoint for container checks
|
||||
app.get('/api/health', (_req, res) => res.json({ status: 'ok' }));
|
||||
// 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)
|
||||
@@ -1274,7 +1274,7 @@ app.use('/api/rumble', rumbleRouter);
|
||||
|
||||
// -------------------- Client config from environment --------------------
|
||||
function jsVal(v) { return JSON.stringify(v == null ? '' : v); }
|
||||
app.get(['/assets/config.local.js', '/config.js'], (_req, res) => {
|
||||
app.get(['/assets/config.local.js', '/assets/config.js', '/config.js'], (_req, res) => {
|
||||
// WARNING: Values served here are exposed to the browser. Do not put secrets here unless you accept this.
|
||||
const lines = [];
|
||||
const env = process.env || {};
|
||||
@@ -1319,23 +1319,34 @@ app.all('/api/twitch-api/*', (req, res) => forwardJson(req, res, 'https://api.tw
|
||||
app.all('/api/twitch-auth/*', (req, res) => forwardJson(req, res, 'https://id.twitch.tv'));
|
||||
|
||||
// -------------------- Static Frontend (Angular build) --------------------
|
||||
try {
|
||||
const staticDir = path.join(process.cwd(), 'dist');
|
||||
if (fs.existsSync(staticDir)) {
|
||||
app.use(express.static(staticDir, { maxAge: '1h', index: 'index.html' }));
|
||||
// SPA fallback: route non-API GETs to index.html
|
||||
app.get('*', (req, res, next) => {
|
||||
const url = req.originalUrl || req.url || '';
|
||||
if (url.startsWith('/api/') || url.startsWith('/health')) return next();
|
||||
const indexPath = path.join(staticDir, 'index.html');
|
||||
if (fs.existsSync(indexPath)) return res.sendFile(indexPath);
|
||||
return next();
|
||||
});
|
||||
const distRoot = path.join(process.cwd(), 'dist');
|
||||
const distBrowser = path.join(distRoot, 'browser');
|
||||
const staticDir = fs.existsSync(distBrowser) ? distBrowser : distRoot;
|
||||
// Mount static files unconditionally; if path missing, it will just not serve anything
|
||||
app.use(express.static(staticDir, { maxAge: '1h', index: 'index.html' }));
|
||||
// SPA fallback: any non-API GET should serve index.html
|
||||
app.get('*', (req, res, next) => {
|
||||
try {
|
||||
const url = req.originalUrl || req.url || '';
|
||||
if (url.startsWith('/api/')) return next();
|
||||
const indexPath = path.join(staticDir, 'index.html');
|
||||
if (fs.existsSync(indexPath)) return res.sendFile(indexPath);
|
||||
return next();
|
||||
} catch {
|
||||
return next();
|
||||
}
|
||||
} catch {}
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
const cwd = process.cwd();
|
||||
const hasDistRoot = fs.existsSync(distRoot);
|
||||
const hasDistBrowser = fs.existsSync(distBrowser);
|
||||
const hasIndex = fs.existsSync(path.join(staticDir, 'index.html'));
|
||||
console.log(`[newtube-api] listening on http://localhost:${PORT}`);
|
||||
console.log(`[newtube-api] cwd=${cwd}`);
|
||||
console.log(`[newtube-api] distRoot=${distRoot} exists=${hasDistRoot}`);
|
||||
console.log(`[newtube-api] distBrowser=${distBrowser} exists=${hasDistBrowser}`);
|
||||
console.log(`[newtube-api] staticDir=${staticDir} indexExists=${hasIndex}`);
|
||||
});
|
||||
|
||||
// --- Playlists ---
|
||||
|
||||
Reference in New Issue
Block a user