Remove deprecated user settings

This commit is contained in:
advplyr 2023-04-03 17:41:03 -05:00
parent 05b102722b
commit d7f18bdd8b
3 changed files with 0 additions and 58 deletions

View File

@ -171,23 +171,6 @@ class MeController {
this.auth.userChangePassword(req, res) this.auth.userChangePassword(req, res)
} }
// TODO: Remove after mobile release v0.9.61-beta
// PATCH: api/me/settings
async updateSettings(req, res) {
var settingsUpdate = req.body
if (!settingsUpdate || !isObject(settingsUpdate)) {
return res.sendStatus(500)
}
var madeUpdates = req.user.updateSettings(settingsUpdate)
if (madeUpdates) {
await this.db.updateEntity('user', req.user)
}
return res.json({
success: true,
settings: req.user.settings
})
}
// TODO: Deprecated. Removed from Android. Only used in iOS app now. // TODO: Deprecated. Removed from Android. Only used in iOS app now.
// POST: api/me/sync-local-progress // POST: api/me/sync-local-progress
async syncLocalMediaProgress(req, res) { async syncLocalMediaProgress(req, res) {

View File

@ -18,7 +18,6 @@ class User {
this.seriesHideFromContinueListening = [] // Series IDs that should not show on home page continue listening this.seriesHideFromContinueListening = [] // Series IDs that should not show on home page continue listening
this.bookmarks = [] this.bookmarks = []
this.settings = {} // TODO: Remove after mobile release v0.9.61-beta
this.permissions = {} this.permissions = {}
this.librariesAccessible = [] // Library IDs (Empty if ALL libraries) this.librariesAccessible = [] // Library IDs (Empty if ALL libraries)
this.itemTagsAccessible = [] // Empty if ALL item tags accessible this.itemTagsAccessible = [] // Empty if ALL item tags accessible
@ -59,15 +58,6 @@ class User {
return !!this.pash && !!this.pash.length return !!this.pash && !!this.pash.length
} }
// TODO: Remove after mobile release v0.9.61-beta
getDefaultUserSettings() {
return {
mobileOrderBy: 'recent',
mobileOrderDesc: true,
mobileFilterBy: 'all'
}
}
getDefaultUserPermissions() { getDefaultUserPermissions() {
return { return {
download: true, download: true,
@ -94,7 +84,6 @@ class User {
isLocked: this.isLocked, isLocked: this.isLocked,
lastSeen: this.lastSeen, lastSeen: this.lastSeen,
createdAt: this.createdAt, createdAt: this.createdAt,
settings: this.settings, // TODO: Remove after mobile release v0.9.61-beta
permissions: this.permissions, permissions: this.permissions,
librariesAccessible: [...this.librariesAccessible], librariesAccessible: [...this.librariesAccessible],
itemTagsAccessible: [...this.itemTagsAccessible] itemTagsAccessible: [...this.itemTagsAccessible]
@ -114,7 +103,6 @@ class User {
isLocked: this.isLocked, isLocked: this.isLocked,
lastSeen: this.lastSeen, lastSeen: this.lastSeen,
createdAt: this.createdAt, createdAt: this.createdAt,
settings: this.settings, // TODO: Remove after mobile release v0.9.61-beta
permissions: this.permissions, permissions: this.permissions,
librariesAccessible: [...this.librariesAccessible], librariesAccessible: [...this.librariesAccessible],
itemTagsAccessible: [...this.itemTagsAccessible] itemTagsAccessible: [...this.itemTagsAccessible]
@ -171,7 +159,6 @@ class User {
this.isLocked = user.type === 'root' ? false : !!user.isLocked this.isLocked = user.type === 'root' ? false : !!user.isLocked
this.lastSeen = user.lastSeen || null this.lastSeen = user.lastSeen || null
this.createdAt = user.createdAt || Date.now() this.createdAt = user.createdAt || Date.now()
this.settings = user.settings || this.getDefaultUserSettings() // TODO: Remove after mobile release v0.9.61-beta
this.permissions = user.permissions || this.getDefaultUserPermissions() this.permissions = user.permissions || this.getDefaultUserPermissions()
// Upload permission added v1.1.13, make sure root user has upload permissions // Upload permission added v1.1.13, make sure root user has upload permissions
if (this.type === 'root' && !this.permissions.upload) this.permissions.upload = true if (this.type === 'root' && !this.permissions.upload) this.permissions.upload = true
@ -348,33 +335,6 @@ class User {
return true return true
} }
// TODO: Remove after mobile release v0.9.61-beta
// Returns Boolean If update was made
updateSettings(settings) {
if (!this.settings) {
this.settings = { ...settings }
return true
}
var madeUpdates = false
for (const key in this.settings) {
if (settings[key] !== undefined && this.settings[key] !== settings[key]) {
this.settings[key] = settings[key]
madeUpdates = true
}
}
// Check if new settings update has keys not currently in user settings
for (const key in settings) {
if (settings[key] !== undefined && this.settings[key] === undefined) {
this.settings[key] = settings[key]
madeUpdates = true
}
}
return madeUpdates
}
checkCanAccessLibrary(libraryId) { checkCanAccessLibrary(libraryId) {
if (this.permissions.accessAllLibraries) return true if (this.permissions.accessAllLibraries) return true
if (!this.librariesAccessible) return false if (!this.librariesAccessible) return false

View File

@ -174,7 +174,6 @@ class ApiRouter {
this.router.patch('/me/item/:id/bookmark', MeController.updateBookmark.bind(this)) this.router.patch('/me/item/:id/bookmark', MeController.updateBookmark.bind(this))
this.router.delete('/me/item/:id/bookmark/:time', MeController.removeBookmark.bind(this)) this.router.delete('/me/item/:id/bookmark/:time', MeController.removeBookmark.bind(this))
this.router.patch('/me/password', MeController.updatePassword.bind(this)) this.router.patch('/me/password', MeController.updatePassword.bind(this))
this.router.patch('/me/settings', MeController.updateSettings.bind(this)) // TODO: Deprecated. Remove after mobile release v0.9.61-beta
this.router.post('/me/sync-local-progress', MeController.syncLocalMediaProgress.bind(this)) // TODO: Deprecated. Removed from Android. Only used in iOS app now. this.router.post('/me/sync-local-progress', MeController.syncLocalMediaProgress.bind(this)) // TODO: Deprecated. Removed from Android. Only used in iOS app now.
this.router.get('/me/items-in-progress', MeController.getAllLibraryItemsInProgress.bind(this)) this.router.get('/me/items-in-progress', MeController.getAllLibraryItemsInProgress.bind(this))
this.router.get('/me/series/:id/remove-from-continue-listening', MeController.removeSeriesFromContinueListening.bind(this)) this.router.get('/me/series/:id/remove-from-continue-listening', MeController.removeSeriesFromContinueListening.bind(this))