1
0
Fork 0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2026-05-26 12:32:25 +00:00

Move utils folder and fix published text

This commit is contained in:
Cadence Ember 2020-09-24 00:05:02 +12:00
parent 643f1e0889
commit 2e69dfc4b7
No known key found for this signature in database
GPG key ID: BC1C2C61CF521B17
16 changed files with 53 additions and 619 deletions

View file

@ -1,7 +1,8 @@
const {render} = require("pinski/plugins")
const db = require("./utils/db")
const {fetchChannelLatest} = require("./utils/youtube")
const {getUser} = require("./utils/getuser")
const db = require("../utils/db")
const {fetchChannelLatest} = require("../utils/youtube")
const {getUser} = require("../utils/getuser")
const converters = require("../utils/converters")
module.exports = [
{
@ -22,6 +23,10 @@ module.exports = [
hasSubscriptions = true
const template = Array(subscriptions.length).fill("?").join(", ")
videos = db.prepare(`SELECT * FROM Videos WHERE authorId IN (${template}) ORDER BY published DESC LIMIT 60`).all(subscriptions)
.map(video => {
video.publishedText = converters.timeToPastText(video.published * 1000)
return video
})
}
}
return render(200, "pug/subscriptions.pug", {hasSubscriptions, videos, channels})