mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-05-26 12:32:25 +00:00
Settings page and instance selection
This commit is contained in:
parent
59a7489545
commit
c573a5ac3e
22 changed files with 587 additions and 71 deletions
|
|
@ -23,6 +23,22 @@ class User {
|
|||
this.token = token
|
||||
}
|
||||
|
||||
getSettings() {
|
||||
if (this.token) {
|
||||
return db.prepare("SELECT * FROM Settings WHERE token = ?").get(this.token) || {}
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
getSettingsOrDefaults() {
|
||||
const settings = this.getSettings()
|
||||
for (const key of Object.keys(settings)) {
|
||||
if (settings[key] === null) settings[key] = constants.user_settings[key].default
|
||||
}
|
||||
return settings
|
||||
}
|
||||
|
||||
getSubscriptions() {
|
||||
if (this.token) {
|
||||
return db.prepare("SELECT ucid FROM Subscriptions WHERE token = ?").pluck().all(this.token)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue