mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-21 23:27:30 +00:00
Fix calls to fetchChannel
Should fix subscribing to channels
This commit is contained in:
parent
6de9abd499
commit
a2dfeb2edc
@ -10,7 +10,7 @@ module.exports = [
|
|||||||
const id = fill[1]
|
const id = fill[1]
|
||||||
const user = getUser(req)
|
const user = getUser(req)
|
||||||
const settings = user.getSettingsOrDefaults()
|
const settings = user.getSettingsOrDefaults()
|
||||||
const data = await fetchChannel(id, path, settings.instance)
|
const data = await fetchChannel(path, id, settings.instance)
|
||||||
const subscribed = user.isSubscribed(id)
|
const subscribed = user.isSubscribed(id)
|
||||||
const instanceOrigin = settings.instance
|
const instanceOrigin = settings.instance
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ module.exports = [
|
|||||||
const token = user.token
|
const token = user.token
|
||||||
|
|
||||||
if (add) {
|
if (add) {
|
||||||
await fetchChannel(ucid, settings.instance)
|
await fetchChannel("channel", ucid, settings.instance)
|
||||||
db.prepare(
|
db.prepare(
|
||||||
"INSERT INTO Subscriptions (token, ucid) VALUES (?, ?)"
|
"INSERT INTO Subscriptions (token, ucid) VALUES (?, ?)"
|
||||||
).run(token, ucid)
|
).run(token, ucid)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const {request} = require("./request")
|
const {request} = require("./request")
|
||||||
const db = require("./db")
|
const db = require("./db")
|
||||||
|
|
||||||
async function fetchChannel(ucid, path="channel", instance) {
|
async function fetchChannel(path, ucid, instance) {
|
||||||
function updateGoodData(channel) {
|
function updateGoodData(channel) {
|
||||||
const bestIcon = channel.authorThumbnails.slice(-1)[0]
|
const bestIcon = channel.authorThumbnails.slice(-1)[0]
|
||||||
const iconURL = bestIcon ? bestIcon.url : null
|
const iconURL = bestIcon ? bestIcon.url : null
|
||||||
|
Loading…
Reference in New Issue
Block a user