summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-03-26 12:26:53 +0100
committerRory& <root@rory.gay>2026-03-26 12:26:53 +0100
commit1ad351559fa342c0336b9eb8a7afb129f5bd4ee2 (patch)
treee5b2463951c0ac983e923ac0e77b56500f97abd1
parentUser: use single query to determine taken discriminators (diff)
downloadserver-ts-1ad351559fa342c0336b9eb8a7afb129f5bd4ee2.tar.xz
EmbedHandlers: use youtube handler for youtube music, use OrmUtils.mergeDeep for request options
-rw-r--r--src/api/util/utility/EmbedHandlers.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/api/util/utility/EmbedHandlers.ts b/src/api/util/utility/EmbedHandlers.ts

index da6a7429..e851c33f 100644 --- a/src/api/util/utility/EmbedHandlers.ts +++ b/src/api/util/utility/EmbedHandlers.ts
@@ -16,7 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { arrayDistinctBy, arrayGroupBy, arrayRemove, Config, EmbedCache, emitEvent, Message, MessageUpdateEvent, normalizeUrl } from "@spacebar/util"; +import { arrayDistinctBy, arrayGroupBy, arrayRemove, Config, EmbedCache, emitEvent, Message, MessageUpdateEvent, normalizeUrl, OrmUtils } from "@spacebar/util"; import { Embed, EmbedImage, EmbedType } from "@spacebar/schemas"; import * as cheerio from "cheerio"; import crypto from "crypto"; @@ -109,10 +109,7 @@ export const getMetaDescriptions = (text: string) => { const doFetch = async (url: URL, opts?: RequestInit) => { try { - const res = await fetch(url, { - ...DEFAULT_FETCH_OPTIONS, - ...opts, - }); + const res = await fetch(url, OrmUtils.mergeDeep({ ...DEFAULT_FETCH_OPTIONS }, opts ?? {})); if (res.headers.get("content-length")) { const contentLength = parseInt(res.headers.get("content-length")!); if (Config.get().limits.message.maxEmbedDownloadSize && contentLength > Config.get().limits.message.maxEmbedDownloadSize) { @@ -451,6 +448,7 @@ export const EmbedHandlers: { "youtu.be": (url) => EmbedHandlers["www.youtube.com"](url), "youtube.com": (url) => EmbedHandlers["www.youtube.com"](url), + "music.youtube.com": (url) => EmbedHandlers["www.youtube.com"](url), "www.youtube.com": async (url: URL): Promise<Embed | null> => { const response = await doFetch(url, { headers: { cookie: "CONSENT=PENDING+999; hl=en" } }); if (!response) return null;