From 850c9cca4aed3ffded826e608a8a51c6aa6c577b Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Tue, 1 Sep 2020 01:51:24 +1200 Subject: [PATCH] Fix instance parameter when subscribing --- api/formapi.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/formapi.js b/api/formapi.js index 4c43792..dc95364 100644 --- a/api/formapi.js +++ b/api/formapi.js @@ -1,7 +1,7 @@ const {redirect} = require("pinski/plugins") const db = require("./utils/db") const constants = require("./utils/constants") -const {getToken} = require("./utils/getuser") +const {getUser} = require("./utils/getuser") const validate = require("./utils/validate") const V = validate.V const {fetchChannel} = require("./utils/youtube") @@ -18,10 +18,12 @@ module.exports = [ .last(async state => { const {params} = state const responseHeaders = {} - const token = getToken(req, responseHeaders) + const user = getUser(req, responseHeaders) + const settings = user.getSettingsOrDefaults() + const token = user.token if (add) { - await fetchChannel(ucid) + await fetchChannel(ucid, settings.instance) db.prepare("INSERT OR IGNORE INTO Subscriptions (token, ucid) VALUES (?, ?)").run(token, ucid) } else { db.prepare("DELETE FROM Subscriptions WHERE token = ? AND ucid = ?").run(token, ucid)