mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-14 12:27:28 +00:00
Fix instance parameter when subscribing
This commit is contained in:
parent
0b178fc7a0
commit
850c9cca4a
@ -1,7 +1,7 @@
|
|||||||
const {redirect} = require("pinski/plugins")
|
const {redirect} = require("pinski/plugins")
|
||||||
const db = require("./utils/db")
|
const db = require("./utils/db")
|
||||||
const constants = require("./utils/constants")
|
const constants = require("./utils/constants")
|
||||||
const {getToken} = require("./utils/getuser")
|
const {getUser} = require("./utils/getuser")
|
||||||
const validate = require("./utils/validate")
|
const validate = require("./utils/validate")
|
||||||
const V = validate.V
|
const V = validate.V
|
||||||
const {fetchChannel} = require("./utils/youtube")
|
const {fetchChannel} = require("./utils/youtube")
|
||||||
@ -18,10 +18,12 @@ module.exports = [
|
|||||||
.last(async state => {
|
.last(async state => {
|
||||||
const {params} = state
|
const {params} = state
|
||||||
const responseHeaders = {}
|
const responseHeaders = {}
|
||||||
const token = getToken(req, responseHeaders)
|
const user = getUser(req, responseHeaders)
|
||||||
|
const settings = user.getSettingsOrDefaults()
|
||||||
|
const token = user.token
|
||||||
|
|
||||||
if (add) {
|
if (add) {
|
||||||
await fetchChannel(ucid)
|
await fetchChannel(ucid, settings.instance)
|
||||||
db.prepare("INSERT OR IGNORE INTO Subscriptions (token, ucid) VALUES (?, ?)").run(token, ucid)
|
db.prepare("INSERT OR IGNORE INTO Subscriptions (token, ucid) VALUES (?, ?)").run(token, ucid)
|
||||||
} else {
|
} else {
|
||||||
db.prepare("DELETE FROM Subscriptions WHERE token = ? AND ucid = ?").run(token, ucid)
|
db.prepare("DELETE FROM Subscriptions WHERE token = ? AND ucid = ?").run(token, ucid)
|
||||||
|
Loading…
Reference in New Issue
Block a user