Skip to content

Commit

Permalink
Whitelist bold client side api access to sending events
Browse files Browse the repository at this point in the history
  • Loading branch information
LostKobrakai committed Dec 21, 2024
1 parent 9ac686c commit f9747f5
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lib/kobrakai_web/plugs/bold_video.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ defmodule KobrakaiWeb.BoldVideo do
def call(conn, _) do
case conn.path_info do
["api", "bold" | rest] ->
conn
|> Plug.Conn.put_req_header("authorization", Kobrakai.Bold.api_key())
|> Plug.forward(
rest,
ReverseProxyPlug,
ReverseProxyPlug.init(
upstream: "https://app.boldvideo.io/",
response_mode: :buffer
if rest in [
["api", "v1", "event"]
] do
conn
|> Plug.Conn.put_req_header("authorization", Kobrakai.Bold.api_key())
|> Plug.forward(
rest,
ReverseProxyPlug,
ReverseProxyPlug.init(
upstream: "https://app.boldvideo.io/",
response_mode: :buffer
)
)
)
else
conn
|> Plug.Conn.send_resp(401, "")
end
|> Plug.Conn.halt()

_ ->
Expand Down

0 comments on commit f9747f5

Please sign in to comment.