mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-16 04:14:58 +02:00
Feat/download via share link (#3666)
* Adds share download endpoint * Adds Downloadable toggle to share modal --------- Co-authored-by: advplyr <advplyr@protonmail.com>
This commit is contained in:
parent
e0c674d9a9
commit
4cdc2a8c28
9 changed files with 263 additions and 8 deletions
|
@ -12,6 +12,7 @@ const { DataTypes, Model } = require('sequelize')
|
|||
* @property {Object} extraData
|
||||
* @property {Date} createdAt
|
||||
* @property {Date} updatedAt
|
||||
* @property {boolean} isDownloadable
|
||||
*
|
||||
* @typedef {MediaItemShareObject & MediaItemShare} MediaItemShareModel
|
||||
*/
|
||||
|
@ -25,11 +26,40 @@ const { DataTypes, Model } = require('sequelize')
|
|||
* @property {Date} expiresAt
|
||||
* @property {Date} createdAt
|
||||
* @property {Date} updatedAt
|
||||
* @property {boolean} isDownloadable
|
||||
*/
|
||||
|
||||
class MediaItemShare extends Model {
|
||||
constructor(values, options) {
|
||||
super(values, options)
|
||||
|
||||
/** @type {UUIDV4} */
|
||||
this.id
|
||||
/** @type {UUIDV4} */
|
||||
this.mediaItemId
|
||||
/** @type {string} */
|
||||
this.mediaItemType
|
||||
/** @type {string} */
|
||||
this.slug
|
||||
/** @type {string} */
|
||||
this.pash
|
||||
/** @type {UUIDV4} */
|
||||
this.userId
|
||||
/** @type {Date} */
|
||||
this.expiresAt
|
||||
/** @type {Object} */
|
||||
this.extraData
|
||||
/** @type {Date} */
|
||||
this.createdAt
|
||||
/** @type {Date} */
|
||||
this.updatedAt
|
||||
/** @type {boolean} */
|
||||
this.isDownloadable
|
||||
|
||||
// Expanded properties
|
||||
|
||||
/** @type {import('./Book')|import('./PodcastEpisode')} */
|
||||
this.mediaItem
|
||||
}
|
||||
|
||||
toJSONForClient() {
|
||||
|
@ -40,7 +70,8 @@ class MediaItemShare extends Model {
|
|||
slug: this.slug,
|
||||
expiresAt: this.expiresAt,
|
||||
createdAt: this.createdAt,
|
||||
updatedAt: this.updatedAt
|
||||
updatedAt: this.updatedAt,
|
||||
isDownloadable: this.isDownloadable
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +145,8 @@ class MediaItemShare extends Model {
|
|||
slug: DataTypes.STRING,
|
||||
pash: DataTypes.STRING,
|
||||
expiresAt: DataTypes.DATE,
|
||||
extraData: DataTypes.JSON
|
||||
extraData: DataTypes.JSON,
|
||||
isDownloadable: DataTypes.BOOLEAN
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue