Release 2.22.0: normalize playlist schedules and unify player sync
This commit is contained in:
1 parent
7748129307
commit
b71958cb38
39 files changed
+1174
-314
No files matched your search
@@ -447,6 +447,27 @@ async function start() {
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/media/remote-images/:filename', requireRequestAuth, async function (req, res, next) {
|
||||
try {
|
||||
const filename = String(req.params.filename || '').trim();
|
||||
if (!/^[a-f0-9]{64}\.(?:png|jpe?g|gif|webp|svg)$/i.test(filename)) {
|
||||
return res.status(400).json({ error: 'Filename is invalid.' });
|
||||
}
|
||||
const filePath = path.join(config.mediaDir, 'player-cache', 'remote-images', filename);
|
||||
const file = await fs.promises.readFile(filePath).catch(function (error) {
|
||||
if (error && error.code === 'ENOENT') return null;
|
||||
throw error;
|
||||
});
|
||||
if (!file) return res.status(404).json({ error: 'Cached image not found.' });
|
||||
if (file.length > 10 * 1024 * 1024) return res.status(413).json({ error: 'Cached image is too large.' });
|
||||
res.type(path.extname(filename));
|
||||
res.set('Cache-Control', 'private, max-age=3600');
|
||||
return res.send(file);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
});
|
||||
|
||||
app.put('/api/media/:filename', express.raw({ type: '*/*', limit: '1gb' }), requireRequestAuth, async function (req, res, next) {
|
||||
try {
|
||||
const relativePath = resolveMediaPath(req.params.filename);
|
||||
|
||||
Reference in new issue
Block a user