audiobookshelf/server/routers/PublicRouter.js
Greg Lorenzen 4cdc2a8c28
Feat/download via share link (#3666)
* Adds share download endpoint
* Adds Downloadable toggle to share modal

---------

Co-authored-by: advplyr <advplyr@protonmail.com>
2024-12-29 16:52:57 -06:00

23 lines
912 B
JavaScript

const express = require('express')
const ShareController = require('../controllers/ShareController')
class PublicRouter {
constructor(playbackSessionManager) {
/** @type {import('../managers/PlaybackSessionManager')} */
this.playbackSessionManager = playbackSessionManager
this.router = express()
this.router.disable('x-powered-by')
this.init()
}
init() {
this.router.get('/share/:slug', ShareController.getMediaItemShareBySlug.bind(this))
this.router.get('/share/:slug/track/:index', ShareController.getMediaItemShareAudioTrack.bind(this))
this.router.get('/share/:slug/cover', ShareController.getMediaItemShareCoverImage.bind(this))
this.router.get('/share/:slug/download', ShareController.downloadMediaItemShare.bind(this))
this.router.patch('/share/:slug/progress', ShareController.updateMediaItemShareProgress.bind(this))
}
}
module.exports = PublicRouter