diff options
| author | RblSb <msrblsb@gmail.com> | 2024-04-28 07:23:25 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2024-04-28 21:51:50 +0300 |
| commit | 9d844bbf3ac6be327325b13a91a6b33f73c49c1d (patch) | |
| tree | 52108f2300ca84decf33a1e7b3552e81166ba5ac /src/server/Main.hx | |
| parent | 8679f8edcb6d2f3142db30848c640aed6fe883b8 (diff) | |
Raw youtube fallback for unavailable videos
Also:
- fix `tryLocalIp` replacement (NAT workaround)
- improve proxy headers a bit
- use json2object fork for better generated diffs
Diffstat (limited to 'src/server/Main.hx')
| -rw-r--r-- | src/server/Main.hx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/server/Main.hx b/src/server/Main.hx index c5eb36f..e7c38a6 100644 --- a/src/server/Main.hx +++ b/src/server/Main.hx @@ -531,8 +531,7 @@ class Main { if (userList.admins.exists( a -> a.name.toLowerCase() == lcName && a.hash == hash)) { client.isAdmin = true; - } - else { + } else { serverMessage(client, "passwordMatchError"); send(client, {type: LoginError}); return; @@ -587,6 +586,17 @@ class Main { broadcast(data); case ServerMessage: + case GetYoutubeVideoInfo: + final url = data.getYoutubeVideoInfo.url; + YoutubeFallback.getInfo(url, info -> { + send(client, { + type: data.type, + getYoutubeVideoInfo: { + url: url, + response: info + } + }); + }); case AddVideo: if (isPlaylistLockedFor(client)) return; if (!checkPermission(client, AddVideoPerm)) return; @@ -1038,7 +1048,9 @@ class Main { duration: duration, time: time }); - while (flashbacks.length > FLASHBACKS_COUNT) flashbacks.pop(); + while (flashbacks.length > FLASHBACKS_COUNT) { + flashbacks.pop(); + } } function isPlaylistLockedFor(client:Client):Bool { |
