1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-26 09:27:30 +00:00

Fix default setting merge

This commit is contained in:
Cadence Ember 2020-09-01 01:40:34 +12:00
parent 3c99c040ee
commit 0b178fc7a0
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412
2 changed files with 3 additions and 2 deletions

View File

@ -33,8 +33,8 @@ class User {
getSettingsOrDefaults() { getSettingsOrDefaults() {
const settings = this.getSettings() const settings = this.getSettings()
for (const key of Object.keys(settings)) { for (const key of Object.keys(constants.user_settings)) {
if (settings[key] === null) settings[key] = constants.user_settings[key].default if (settings[key] == null) settings[key] = constants.user_settings[key].default
} }
return settings return settings
} }

View File

@ -2,6 +2,7 @@ const fetch = require("node-fetch")
const db = require("./db") const db = require("./db")
async function fetchChannel(ucid, instance) { async function fetchChannel(ucid, instance) {
if (!instance) throw new Error("No instance parameter provided")
// fetch // fetch
const channel = await fetch(`${instance}/api/v1/channels/${ucid}`).then(res => res.json()) const channel = await fetch(`${instance}/api/v1/channels/${ucid}`).then(res => res.json())
// update database // update database