mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 04:11:43 +00:00
or would it be better to return just the slug instead of the whole share object?
This commit is contained in:
parent
748541fb4e
commit
a8081b9a74
1 changed files with 3 additions and 6 deletions
|
|
@ -238,18 +238,15 @@ class ShareController {
|
||||||
res.sendStatus(204)
|
res.sendStatus(204)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Public route - requires share_session_id cookie
|
* Public route
|
||||||
* GET: /api/share/mediaitem/:id
|
* GET: /api/share/mediaitem/:id
|
||||||
* get existing share from mediaItemId
|
* get existing share from mediaItemId
|
||||||
|
* (or would it be better to return just the slug?)
|
||||||
*
|
*
|
||||||
* @param {import('express').Request} req
|
* @param {import('express').Request} req
|
||||||
* @param {import('express').Response} res
|
* @param {import('express').Response} res
|
||||||
*/
|
*/
|
||||||
async getMediaItemShare(req, res) {
|
async getMediaItemShare(req, res) {
|
||||||
if (!req.cookies.share_session_id) {
|
|
||||||
return res.status(404).send('Share session not set')
|
|
||||||
}
|
|
||||||
|
|
||||||
const mediaItemId = req.params.id;
|
const mediaItemId = req.params.id;
|
||||||
|
|
||||||
if (!mediaItemId || typeof mediaItemId !== 'string') {
|
if (!mediaItemId || typeof mediaItemId !== 'string') {
|
||||||
|
|
@ -263,7 +260,7 @@ class ShareController {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existingMediaItemShare) {
|
if (existingMediaItemShare) {
|
||||||
return res.status(200).json(existingMediaItemShare.toJSONForClient());
|
return res.status(200).json(existingMediaItemShare.toJSONForClient()); // or would it be better to return just the slug?
|
||||||
} else {
|
} else {
|
||||||
return res.status(404).send('Share not found');
|
return res.status(404).send('Share not found');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue