~cadence/cloudtube

a2dfeb2edcfe4dd82e6074fb8ae1c443b8c7c85d — Cadence Ember 2 years ago 6de9abd
Fix calls to fetchChannel

Should fix subscribing to channels
3 files changed, 3 insertions(+), 3 deletions(-)

M api/channels.js
M api/formapi.js
M utils/youtube.js
M api/channels.js => api/channels.js +1 -1
@@ 10,7 10,7 @@ module.exports = [
			const id = fill[1]
			const user = getUser(req)
			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 instanceOrigin = settings.instance


M api/formapi.js => api/formapi.js +1 -1
@@ 23,7 23,7 @@ module.exports = [
					const token = user.token

					if (add) {
						await fetchChannel(ucid, settings.instance)
						await fetchChannel("channel", ucid, settings.instance)
						db.prepare(
							"INSERT INTO Subscriptions (token, ucid) VALUES (?, ?)"
						).run(token, ucid)

M utils/youtube.js => utils/youtube.js +1 -1
@@ 1,7 1,7 @@
const {request} = require("./request")
const db = require("./db")

async function fetchChannel(ucid, path="channel", instance) {
async function fetchChannel(path, ucid, instance) {
	function updateGoodData(channel) {
		const bestIcon = channel.authorThumbnails.slice(-1)[0]
		const iconURL = bestIcon ? bestIcon.url : null