From c1813aa33fccc8e02512935001195ad322351a0e Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 15 Aug 2024 19:58:40 +0600 Subject: [PATCH] api/stream: rename `bridge` mode to `proxy` --- api/src/processing/match-action.js | 10 +++++----- api/src/processing/request.js | 2 ++ api/src/processing/services/twitch.js | 2 +- api/src/processing/services/youtube.js | 2 +- api/src/stream/stream.js | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/api/src/processing/match-action.js b/api/src/processing/match-action.js index 6da7780b..9ad15809 100644 --- a/api/src/processing/match-action.js +++ b/api/src/processing/match-action.js @@ -59,7 +59,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab case "muteVideo": let muteType = "mute"; if (Array.isArray(r.urls) && !r.isM3U8) { - muteType = "bridge"; + muteType = "proxy"; } params = { type: muteType, @@ -82,7 +82,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab let audioStreamType = "render"; if (r.bestAudio === "mp3" && (audioFormat === "mp3" || audioFormat === "best")) { audioFormat = "mp3"; - audioStreamType = "bridge" + audioStreamType = "proxy" } params = { picker: r.picker, @@ -130,7 +130,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab case "vk": case "tiktok": - params = { type: "bridge" }; + params = { type: "proxy" }; break; case "facebook": @@ -172,7 +172,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab if (isBestAudioDefined || isBestHostAudio) { audioFormat = serviceBestAudio; - processType = "bridge"; + processType = "proxy"; if (isSoundCloud || (isTiktok && audioFormat === "m4a")) { processType = "render" copy = true @@ -184,7 +184,7 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab if (isTumblrAudio && isBestOrMp3) { audioFormat = "mp3"; - processType = "bridge" + processType = "proxy" } if (r.isM3U8 || host === "vimeo") { diff --git a/api/src/processing/request.js b/api/src/processing/request.js index 93de2fa0..85182d60 100644 --- a/api/src/processing/request.js +++ b/api/src/processing/request.js @@ -34,6 +34,7 @@ export function createResponse(responseType, responseData) { } } break; + case "redirect": response = { url: responseData?.u, @@ -59,6 +60,7 @@ export function createResponse(responseType, responseData) { default: throw "unreachable" } + return { status, body: { diff --git a/api/src/processing/services/twitch.js b/api/src/processing/services/twitch.js index 5712178c..0bd281d8 100644 --- a/api/src/processing/services/twitch.js +++ b/api/src/processing/services/twitch.js @@ -64,7 +64,7 @@ export default async function (obj) { let format = formats.find(f => f.quality === obj.quality) || formats[0]; return { - type: "bridge", + type: "proxy", urls: `${format.sourceURL}?${new URLSearchParams({ sig: req_token[0].data.clip.playbackAccessToken.signature, token: req_token[0].data.clip.playbackAccessToken.value diff --git a/api/src/processing/services/youtube.js b/api/src/processing/services/youtube.js index e82b9563..5223734e 100644 --- a/api/src/processing/services/youtube.js +++ b/api/src/processing/services/youtube.js @@ -258,7 +258,7 @@ export default async function(o) { if (!o.isAudioOnly && !o.isAudioMuted && format === 'h264') { match = info.streaming_data.formats.find(checkSingle); - type = "bridge"; + type = "proxy"; urls = match?.decipher(yt.session.player); } diff --git a/api/src/stream/stream.js b/api/src/stream/stream.js index 08edb079..51cb4376 100644 --- a/api/src/stream/stream.js +++ b/api/src/stream/stream.js @@ -4,7 +4,7 @@ import { closeResponse } from "./shared.js"; export default async function(res, streamInfo) { try { - if (streamInfo.isAudioOnly && streamInfo.type !== "bridge") { + if (streamInfo.isAudioOnly && streamInfo.type !== "proxy") { streamAudioOnly(streamInfo, res); return; }