1
0
Fork 0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2026-03-02 10:41:36 +00:00

Handle empty subscription queue and OOP-ify

This commit is contained in:
Cadence Ember 2020-10-03 01:32:22 +13:00
parent 830c009066
commit 1ea272600c
No known key found for this signature in database
GPG key ID: BC1C2C61CF521B17
3 changed files with 67 additions and 31 deletions

View file

@ -3,6 +3,7 @@ const db = require("../utils/db")
const {fetchChannelLatest} = require("../utils/youtube")
const {getUser} = require("../utils/getuser")
const {timeToPastText} = require("../utils/converters")
const {refresher} = require("../background/feed-update")
module.exports = [
{
@ -13,6 +14,8 @@ module.exports = [
let channels = []
let refreshed = null
if (user.token) {
// trigger a background refresh, needed if they came back from being inactive
refresher.skipWaiting()
// get channels
const subscriptions = user.getSubscriptions()
const template = Array(subscriptions.length).fill("?").join(", ")