1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-22 07:37:29 +00:00

Compare commits

..

No commits in common. "9f7b1bbcaee3ca4777a3606c9c44ed274d32c980" and "8d292cc20047d794e76a3bab6dacae59b3dc645f" have entirely different histories.

11 changed files with 299 additions and 653 deletions

View File

@ -18,7 +18,7 @@ module.exports = [
if (data.error) { if (data.error) {
const statusCode = data.missing ? 410 : 500 const statusCode = data.missing ? 410 : 500
const subscribed = user.isSubscribed(id) const subscribed = user.isSubscribed(id)
return render(statusCode, "pug/channel-error.pug", {req, settings, data, subscribed, instanceOrigin}) return render(statusCode, "pug/channel-error.pug", {settings, data, subscribed, instanceOrigin})
} }
// everything is fine // everything is fine
@ -35,7 +35,7 @@ module.exports = [
}) })
} }
const subscribed = user.isSubscribed(data.authorId) const subscribed = user.isSubscribed(data.authorId)
return render(200, "pug/channel.pug", {req, settings, data, subscribed, instanceOrigin}) return render(200, "pug/channel.pug", {settings, data, subscribed, instanceOrigin})
} }
} }
] ]

View File

@ -55,7 +55,7 @@ module.exports = [
label = url.searchParams.get("label") label = url.searchParams.get("label")
} }
return render(200, "pug/filters.pug", {req, settings, categories, type, contents, label, referrer, filterMaxLength, regexpEnabledText}) return render(200, "pug/filters.pug", {settings, categories, type, contents, label, referrer, filterMaxLength, regexpEnabledText})
} }
}, },
{ {
@ -104,7 +104,7 @@ module.exports = [
const user = getUser(req) const user = getUser(req)
const categories = getCategories(user) const categories = getCategories(user)
const settings = user.getSettingsOrDefaults() const settings = user.getSettingsOrDefaults()
return render(400, "pug/filters.pug", {req, settings, categories, type, contents, label, compileError, filterMaxLength, regexpEnabledText}) return render(400, "pug/filters.pug", {settings, categories, type, contents, label, compileError, filterMaxLength, regexpEnabledText})
}) })
.last(state => { .last(state => {
const {type, contents, label} = state const {type, contents, label} = state

View File

@ -8,28 +8,28 @@ module.exports = [
const mobile = userAgent.toLowerCase().includes("mobile") const mobile = userAgent.toLowerCase().includes("mobile")
const user = getUser(req) const user = getUser(req)
const settings = user.getSettingsOrDefaults() const settings = user.getSettingsOrDefaults()
return render(200, "pug/home.pug", {req, settings, mobile}) return render(200, "pug/home.pug", {settings, mobile})
} }
}, },
{ {
route: "/(?:js-)?licenses", methods: ["GET"], code: async ({req}) => { route: "/(?:js-)?licenses", methods: ["GET"], code: async ({req}) => {
const user = getUser(req) const user = getUser(req)
const settings = user.getSettingsOrDefaults() const settings = user.getSettingsOrDefaults()
return render(200, "pug/licenses.pug", {req, settings}) return render(200, "pug/licenses.pug", {settings})
} }
}, },
{ {
route: "/cant-think", methods: ["GET"], code: async ({req}) => { route: "/cant-think", methods: ["GET"], code: async ({req}) => {
const user = getUser(req) const user = getUser(req)
const settings = user.getSettingsOrDefaults() const settings = user.getSettingsOrDefaults()
return render(200, "pug/cant-think.pug", {req, settings}) return render(200, "pug/cant-think.pug", {settings})
} }
}, },
{ {
route: "/privacy", methods: ["GET"], code: async ({req}) => { route: "/privacy", methods: ["GET"], code: async ({req}) => {
const user = getUser(req) const user = getUser(req)
const settings = user.getSettingsOrDefaults() const settings = user.getSettingsOrDefaults()
return render(200, "pug/privacy.pug", {req, settings}) return render(200, "pug/privacy.pug", {settings})
} }
} }
] ]

View File

@ -26,7 +26,7 @@ module.exports = [
const filters = user.getFilters() const filters = user.getFilters()
results = converters.applyVideoFilters(results, filters).videos results = converters.applyVideoFilters(results, filters).videos
return render(200, "pug/search.pug", {req, settings, url, query, results, instanceOrigin}) return render(200, "pug/search.pug", {settings, url, query, results, instanceOrigin})
} }
} }
] ]

View File

@ -23,7 +23,7 @@ module.exports = [
const user = getUser(req) const user = getUser(req)
const settings = user.getSettings() const settings = user.getSettings()
const instances = instancesList.get() const instances = instancesList.get()
return render(200, "pug/settings.pug", {req, constants, user, settings, instances}) return render(200, "pug/settings.pug", {constants, user, settings, instances})
} }
}, },
{ {

View File

@ -39,7 +39,7 @@ module.exports = [
} }
const settings = user.getSettingsOrDefaults() const settings = user.getSettingsOrDefaults()
const instanceOrigin = settings.instance const instanceOrigin = settings.instance
return render(200, "pug/subscriptions.pug", {req, url, settings, hasSubscriptions, videos, channels, missingChannelCount, refreshed, timeToPastText, instanceOrigin}) return render(200, "pug/subscriptions.pug", {url, settings, hasSubscriptions, videos, channels, missingChannelCount, refreshed, timeToPastText, instanceOrigin})
} }
} }
] ]

View File

@ -3,8 +3,8 @@ const {render} = require("pinski/plugins")
module.exports = [ module.exports = [
{ {
route: "/takedown", methods: ["GET"], code: async ({req}) => { route: "/takedown", methods: ["GET"], code: async () => {
return render(200, "pug/takedown.pug", {req, constants}) return render(200, "pug/takedown.pug", {constants})
} }
} }
] ]

View File

@ -111,7 +111,7 @@ module.exports = [
// Check if playback is allowed // Check if playback is allowed
const videoTakedownInfo = db.prepare("SELECT id, org, url FROM TakedownVideos WHERE id = ?").get(id) const videoTakedownInfo = db.prepare("SELECT id, org, url FROM TakedownVideos WHERE id = ?").get(id)
if (videoTakedownInfo) { if (videoTakedownInfo) {
return render(451, "pug/takedown-video.pug", Object.assign({req, settings}, videoTakedownInfo)) return render(451, "pug/takedown-video.pug", Object.assign({settings}, videoTakedownInfo))
} }
// Media fragment // Media fragment
@ -129,7 +129,7 @@ module.exports = [
// Work out how to fetch the video // Work out how to fetch the video
if (req.method === "GET") { if (req.method === "GET") {
if (settings.local) { // skip to the local fetching page, which will then POST video data in a moment if (settings.local) { // skip to the local fetching page, which will then POST video data in a moment
return render(200, "pug/local-video.pug", {req, settings, id}) return render(200, "pug/local-video.pug", {settings, id})
} }
var instanceOrigin = settings.instance var instanceOrigin = settings.instance
var outURL = `${instanceOrigin}/api/v1/videos/${id}` var outURL = `${instanceOrigin}/api/v1/videos/${id}`
@ -153,7 +153,7 @@ module.exports = [
// automatically add the entry to the videos list, so it won't be fetched again // automatically add the entry to the videos list, so it won't be fetched again
const args = {id, ...channelTakedownInfo} const args = {id, ...channelTakedownInfo}
db.prepare("INSERT INTO TakedownVideos (id, org, url) VALUES (@id, @org, @url)").run(args) db.prepare("INSERT INTO TakedownVideos (id, org, url) VALUES (@id, @org, @url)").run(args)
return render(451, "pug/takedown-video.pug", Object.assign({req, settings}, channelTakedownInfo)) return render(451, "pug/takedown-video.pug", Object.assign({settings}, channelTakedownInfo))
} }
// process stream list ordering // process stream list ordering
@ -199,7 +199,7 @@ module.exports = [
} }
return render(200, "pug/video.pug", { return render(200, "pug/video.pug", {
req, url, video, formats, subscribed, instanceOrigin, mediaFragment, autoplay, continuous, url, video, formats, subscribed, instanceOrigin, mediaFragment, autoplay, continuous,
sessionWatched, sessionWatchedNext, settings sessionWatched, sessionWatchedNext, settings
}) })
@ -225,7 +225,7 @@ module.exports = [
// Create appropriate formatted message // Create appropriate formatted message
const message = render(0, `pug/errors/${errorType}.pug`, locals).content const message = render(0, `pug/errors/${errorType}.pug`, locals).content
return render(500, "pug/video.pug", {video: {videoId: id}, error: true, message, req, settings}) return render(500, "pug/video.pug", {video: {videoId: id}, error: true, message, settings})
} }
} }
} }

885
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,6 @@
"denque": "^1.5.1", "denque": "^1.5.1",
"mixin-deep": "^2.0.1", "mixin-deep": "^2.0.1",
"node-fetch": "^2.6.6", "node-fetch": "^2.6.6",
"pinski": "git+https://git.sr.ht/~cadence/nodejs-pinski#9653807f309aee34c8c63ce4e6ee760cccbfdf0d" "pinski": "git+https://git.sr.ht/~cadence/nodejs-pinski#e22095172a061a8271e28272e2e481d541ea6725"
} }
} }

View File

@ -26,9 +26,6 @@ html
if showNav if showNav
nav.main-nav nav.main-nav
.links .links
if req && req.headers && "x-insecure" in req.headers
a(href="/").link.home CloudTube - Insecure
else
a(href="/").link.home CloudTube a(href="/").link.home CloudTube
a(href="/subscriptions" title="Subscriptions").link.icon-link a(href="/subscriptions" title="Subscriptions").link.icon-link
!= icons.get("subscriptions") != icons.get("subscriptions")