api/match-action: support forced local processing

This commit is contained in:
wukko 2025-06-22 16:21:37 +06:00
parent a6b599a828
commit 28ab2747ce
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -20,7 +20,7 @@ export default function({
requestIP, requestIP,
audioBitrate, audioBitrate,
alwaysProxy, alwaysProxy,
localProcessing localProcessing,
}) { }) {
let action, let action,
responseType = "tunnel", responseType = "tunnel",
@ -242,15 +242,20 @@ export default function({
defaultParams.filename += `.${audioFormat}`; defaultParams.filename += `.${audioFormat}`;
} }
if (alwaysProxy && responseType === "redirect") { if ((alwaysProxy || localProcessing === "forced") && responseType === "redirect") {
responseType = "tunnel"; responseType = "tunnel";
params.type = "proxy"; params.type = "proxy";
} }
// TODO: add support for HLS // TODO: add support for HLS
// (very painful) // (very painful)
if (localProcessing && !params.isHLS && extraProcessingTypes.includes(params.type)) { if (!params.isHLS) {
responseType = "local-processing"; const isPreferredWithExtra =
localProcessing === "preferred" && extraProcessingTypes.includes(params.type);
if (localProcessing === "forced" || isPreferredWithExtra) {
responseType = "local-processing";
}
} }
// extractors usually return ISO 639-1 language codes, // extractors usually return ISO 639-1 language codes,