2024-06-22 16:42:13 -05:00
|
|
|
const express = require('express')
|
|
|
|
const ShareController = require('../controllers/ShareController')
|
2025-05-05 17:00:43 -05:00
|
|
|
const SessionController = require('../controllers/SessionController')
|
2024-06-22 16:42:13 -05:00
|
|
|
|
|
|
|
class PublicRouter {
|
2024-06-30 16:36:00 -05:00
|
|
|
constructor(playbackSessionManager) {
|
|
|
|
/** @type {import('../managers/PlaybackSessionManager')} */
|
|
|
|
this.playbackSessionManager = playbackSessionManager
|
|
|
|
|
2024-06-22 16:42:13 -05:00
|
|
|
this.router = express()
|
|
|
|
this.router.disable('x-powered-by')
|
|
|
|
this.init()
|
|
|
|
}
|
|
|
|
|
|
|
|
init() {
|
|
|
|
this.router.get('/share/:slug', ShareController.getMediaItemShareBySlug.bind(this))
|
2024-06-29 15:05:35 -05:00
|
|
|
this.router.get('/share/:slug/track/:index', ShareController.getMediaItemShareAudioTrack.bind(this))
|
|
|
|
this.router.get('/share/:slug/cover', ShareController.getMediaItemShareCoverImage.bind(this))
|
2024-12-29 14:52:57 -08:00
|
|
|
this.router.get('/share/:slug/download', ShareController.downloadMediaItemShare.bind(this))
|
2024-06-29 15:05:35 -05:00
|
|
|
this.router.patch('/share/:slug/progress', ShareController.updateMediaItemShareProgress.bind(this))
|
2025-05-05 17:00:43 -05:00
|
|
|
this.router.get('/session/:id/track/:index', SessionController.getTrack.bind(this))
|
2024-06-22 16:42:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = PublicRouter
|