api/stream: rename bridge mode to proxy

This commit is contained in:
wukko 2024-08-15 19:58:40 +06:00
parent 9d577f23b1
commit c1813aa33f
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
5 changed files with 10 additions and 8 deletions

View file

@ -59,7 +59,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
case "muteVideo": case "muteVideo":
let muteType = "mute"; let muteType = "mute";
if (Array.isArray(r.urls) && !r.isM3U8) { if (Array.isArray(r.urls) && !r.isM3U8) {
muteType = "bridge"; muteType = "proxy";
} }
params = { params = {
type: muteType, type: muteType,
@ -82,7 +82,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
let audioStreamType = "render"; let audioStreamType = "render";
if (r.bestAudio === "mp3" && (audioFormat === "mp3" || audioFormat === "best")) { if (r.bestAudio === "mp3" && (audioFormat === "mp3" || audioFormat === "best")) {
audioFormat = "mp3"; audioFormat = "mp3";
audioStreamType = "bridge" audioStreamType = "proxy"
} }
params = { params = {
picker: r.picker, picker: r.picker,
@ -130,7 +130,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
case "vk": case "vk":
case "tiktok": case "tiktok":
params = { type: "bridge" }; params = { type: "proxy" };
break; break;
case "facebook": case "facebook":
@ -172,7 +172,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
if (isBestAudioDefined || isBestHostAudio) { if (isBestAudioDefined || isBestHostAudio) {
audioFormat = serviceBestAudio; audioFormat = serviceBestAudio;
processType = "bridge"; processType = "proxy";
if (isSoundCloud || (isTiktok && audioFormat === "m4a")) { if (isSoundCloud || (isTiktok && audioFormat === "m4a")) {
processType = "render" processType = "render"
copy = true copy = true
@ -184,7 +184,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
if (isTumblrAudio && isBestOrMp3) { if (isTumblrAudio && isBestOrMp3) {
audioFormat = "mp3"; audioFormat = "mp3";
processType = "bridge" processType = "proxy"
} }
if (r.isM3U8 || host === "vimeo") { if (r.isM3U8 || host === "vimeo") {

View file

@ -34,6 +34,7 @@ export function createResponse(responseType, responseData) {
} }
} }
break; break;
case "redirect": case "redirect":
response = { response = {
url: responseData?.u, url: responseData?.u,
@ -59,6 +60,7 @@ export function createResponse(responseType, responseData) {
default: default:
throw "unreachable" throw "unreachable"
} }
return { return {
status, status,
body: { body: {

View file

@ -64,7 +64,7 @@ export default async function (obj) {
let format = formats.find(f => f.quality === obj.quality) || formats[0]; let format = formats.find(f => f.quality === obj.quality) || formats[0];
return { return {
type: "bridge", type: "proxy",
urls: `${format.sourceURL}?${new URLSearchParams({ urls: `${format.sourceURL}?${new URLSearchParams({
sig: req_token[0].data.clip.playbackAccessToken.signature, sig: req_token[0].data.clip.playbackAccessToken.signature,
token: req_token[0].data.clip.playbackAccessToken.value token: req_token[0].data.clip.playbackAccessToken.value

View file

@ -258,7 +258,7 @@ export default async function(o) {
if (!o.isAudioOnly && !o.isAudioMuted && format === 'h264') { if (!o.isAudioOnly && !o.isAudioMuted && format === 'h264') {
match = info.streaming_data.formats.find(checkSingle); match = info.streaming_data.formats.find(checkSingle);
type = "bridge"; type = "proxy";
urls = match?.decipher(yt.session.player); urls = match?.decipher(yt.session.player);
} }

View file

@ -4,7 +4,7 @@ import { closeResponse } from "./shared.js";
export default async function(res, streamInfo) { export default async function(res, streamInfo) {
try { try {
if (streamInfo.isAudioOnly && streamInfo.type !== "bridge") { if (streamInfo.isAudioOnly && streamInfo.type !== "proxy") {
streamAudioOnly(streamInfo, res); streamAudioOnly(streamInfo, res);
return; return;
} }