From 7298082bd5c783509d1ba83fd4b82083a4961312 Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 28 Jun 2025 16:31:39 +0600 Subject: [PATCH] api: refactor two static arrays to set --- api/src/processing/match-action.js | 4 ++-- api/src/stream/internal.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/processing/match-action.js b/api/src/processing/match-action.js index ba340dc9..555705e8 100644 --- a/api/src/processing/match-action.js +++ b/api/src/processing/match-action.js @@ -6,7 +6,7 @@ import { createStream } from "../stream/manage.js"; import { splitFilenameExtension } from "../misc/utils.js"; import { convertLanguageCode } from "../misc/language-codes.js"; -const extraProcessingTypes = ["merge", "remux", "mute", "audio", "gif"]; +const extraProcessingTypes = new Set(["merge", "remux", "mute", "audio", "gif"]); export default function({ r, @@ -254,7 +254,7 @@ export default function({ // (very painful) if (!params.isHLS && responseType !== "picker") { const isPreferredWithExtra = - localProcessing === "preferred" && extraProcessingTypes.includes(params.type); + localProcessing === "preferred" && extraProcessingTypes.has(params.type); if (localProcessing === "forced" || isPreferredWithExtra) { responseType = "local-processing"; diff --git a/api/src/stream/internal.js b/api/src/stream/internal.js index b261fa10..aa8333ae 100644 --- a/api/src/stream/internal.js +++ b/api/src/stream/internal.js @@ -6,7 +6,7 @@ import { handleHlsPlaylist, isHlsResponse, probeInternalHLSTunnel } from "./inte const CHUNK_SIZE = BigInt(8e6); // 8 MB const min = (a, b) => a < b ? a : b; -const serviceNeedsChunks = ["youtube", "vk"]; +const serviceNeedsChunks = new Set(["youtube", "vk"]); async function* readChunks(streamInfo, size) { let read = 0n, chunksSinceTransplant = 0; @@ -148,7 +148,7 @@ export function internalStream(streamInfo, res) { streamInfo.headers.delete('icy-metadata'); } - if (serviceNeedsChunks.includes(streamInfo.service) && !streamInfo.isHLS) { + if (serviceNeedsChunks.has(streamInfo.service) && !streamInfo.isHLS) { return handleChunkedStream(streamInfo, res); }