Update:API endpoint for syncing multiple local sessions. New API endpoint to get current user. Deprecate /me/sync-local-progress endpoint

This commit is contained in:
advplyr 2023-02-05 16:52:17 -06:00
parent debf0f495d
commit f9e6655359
5 changed files with 107 additions and 46 deletions

View file

@ -6,6 +6,10 @@ const { isObject, toNumber } = require('../utils/index')
class MeController {
constructor() { }
getCurrentUser(req, res) {
res.json(req.user.toJSONForBrowser())
}
// GET: api/me/listening-sessions
async getListeningSessions(req, res) {
var listeningSessions = await this.getUserListeningSessionsHelper(req.user.id)
@ -184,6 +188,7 @@ class MeController {
})
}
// TODO: Deprecated. Removed from Android. Only used in iOS app now.
// POST: api/me/sync-local-progress
async syncLocalMediaProgress(req, res) {
if (!req.body.localMediaProgress) {

View file

@ -75,6 +75,11 @@ class SessionController {
this.playbackSessionManager.syncLocalSessionRequest(req.user, req.body, res)
}
// POST: api/session/local-all
syncLocalSessions(req, res) {
this.playbackSessionManager.syncLocalSessionsRequest(req, res)
}
openSessionMiddleware(req, res, next) {
var playbackSession = this.playbackSessionManager.getSession(req.params.id)
if (!playbackSession) return res.sendStatus(404)