mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-05-26 12:32:25 +00:00
Proxy captions via new /proxy route
We can add more authorized paths to authorizedPaths if we need
more resources to be pulled from the NewLeaf/Invidious backend
on the same domain.
This route forwards to the client a few headers like Bibliogram
ea7cd5d5/item/src/site/api/proxy.js (L28-29)
so we can also use this route to possibly proxy videos in the
future.
We are strict about the url parameter not overriding the
NewLeaf/Invidious backend (instanceOrigin) by ensuring
fetchURL has instanceOrigin as prefix.
This commit is contained in:
parent
db49bb38b0
commit
eb111a44c4
3 changed files with 32 additions and 27 deletions
|
|
@ -174,6 +174,11 @@ module.exports = [
|
|||
// rewrite description
|
||||
video.descriptionHtml = converters.rewriteVideoDescription(video.descriptionHtml, id)
|
||||
|
||||
// rewrite captions urls so they are served on the same domain via the /proxy route
|
||||
for (const caption of video.captions) {
|
||||
caption.url = `/proxy?${new URLSearchParams({"url": caption.url})}`
|
||||
}
|
||||
|
||||
return render(200, "pug/video.pug", {
|
||||
url, video, formats, subscribed, instanceOrigin, mediaFragment, autoplay, continuous,
|
||||
sessionWatched, sessionWatchedNext
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue