Skip to content

best way to save what you love

api/service-config: replace static arrays with sets

wukko52695cbd0f2f
diff --git a/api/src/processing/match-action.js b/api/src/processing/match-action.js
index c17158f7..e5e5a1a9 100644
--- a/api/src/processing/match-action.js
+++ b/api/src/processing/match-action.js
@@ -194,7 +194,7 @@ export default function({
break;
case "audio":
- if (audioIgnore.includes(host) || (host === "reddit" && r.typeId === "redirect")) {
+ if (audioIgnore.has(host) || (host === "reddit" && r.typeId === "redirect")) {
return createResponse("error", {
code: "error.api.service.audio_not_supported"
})
diff --git a/api/src/processing/service-config.js b/api/src/processing/service-config.js
index 662b39b3..3ffcf10a 100644
--- a/api/src/processing/service-config.js
+++ b/api/src/processing/service-config.js
@@ -1,7 +1,7 @@
import UrlPattern from "url-pattern";
-export const audioIgnore = ["vk", "ok", "loom"];
-export const hlsExceptions = ["dailymotion", "vimeo", "rutube", "bsky", "youtube"];
+export const audioIgnore = new Set(["vk", "ok", "loom"]);
+export const hlsExceptions = new Set(["dailymotion", "vimeo", "rutube", "bsky", "youtube"]);
export const services = {
bilibili: {
diff --git a/api/src/stream/ffmpeg.js b/api/src/stream/ffmpeg.js
index 201804da..dff4abab 100644
--- a/api/src/stream/ffmpeg.js
+++ b/api/src/stream/ffmpeg.js
@@ -136,7 +136,7 @@ const remux = async (streamInfo, res) => {
args.push('-movflags', 'faststart+frag_keyframe+empty_moov');
}
- if (streamInfo.type !== 'mute' && streamInfo.isHLS && hlsExceptions.includes(streamInfo.service)) {
+ if (streamInfo.type !== 'mute' && streamInfo.isHLS && hlsExceptions.has(streamInfo.service)) {
if (streamInfo.service === 'youtube' && format === 'webm') {
args.push('-c:a', 'libopus');
} else {