Refresh local videos on each listing request

This commit is contained in:
2026-06-15 19:44:49 -07:00
parent 0ad0df5612
commit d37694e4d3

View File

@@ -132,6 +132,8 @@ app.get('/api/favorites', (_request, response) => {
});
app.get('/api/local-videos', async (_request, response) => {
response.set('Cache-Control', 'no-store');
if (!LOCAL_VIDEOS_ROOT) {
response.json({ enabled: false, videos: [] });
return;
@@ -658,9 +660,12 @@ function getLocalVideosRealRoot() {
}
if (!localVideosRealRootPromise) {
localVideosRealRootPromise = fs.realpath(LOCAL_VIDEOS_ROOT).catch((error) => {
localVideosRealRootPromise = null;
localVideosRealRootPromise = fs.realpath(LOCAL_VIDEOS_ROOT)
.catch((error) => {
throw new Error(`Local videos directory is unavailable: ${error.message}`);
})
.finally(() => {
localVideosRealRootPromise = null;
});
}