mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-03-02 10:41:36 +00:00
Implement video captions
Proxy requests to NewLeaf/Invidious backend so captions are served on the same domain
This commit is contained in:
parent
dbbe950832
commit
500aa820bc
2 changed files with 15 additions and 0 deletions
13
api/captions.js
Normal file
13
api/captions.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const {getUser} = require("../utils/getuser")
|
||||
const constants = require("../utils/constants.js")
|
||||
const {proxy} = require("pinski/plugins")
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
route: `/api/v1/captions/(${constants.regex.video_id})`, methods: ["GET"], code: async ({req, fill, url}) => {
|
||||
const instanceOrigin = getUser(req).getSettingsOrDefaults().instance
|
||||
const fetchURL = new URL(`${url.pathname}${url.search}`, instanceOrigin)
|
||||
return proxy(fetchURL.toString())
|
||||
}
|
||||
}
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue