Refresh local videos on each listing request
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user