Skip to content

Commit 491443f

Browse files
committed
feat: allow customizing puppeteer params
1 parent 8b8905c commit 491443f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/algora_web/controllers/og_image_controller.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ defmodule AlgoraWeb.OGImageController do
134134
conn |> put_status(:not_found) |> text("Not found")
135135
end
136136

137-
def take_and_upload_screenshot(path, params \\ "") do
137+
def take_and_upload_screenshot(path, params \\ "", opts \\ []) do
138138
clean_path = Enum.map(path, &(&1 |> String.split("?", parts: 2) |> List.first()))
139139
dir = Path.join([System.tmp_dir!(), "og"] ++ clean_path)
140140
File.mkdir_p!(dir)
@@ -150,7 +150,7 @@ defmodule AlgoraWeb.OGImageController do
150150
url = Path.join([AlgoraWeb.Endpoint.url() | path]) <> params
151151
object_path = Path.join(["og"] ++ path ++ ["og.png"])
152152

153-
case ScreenshotQueue.generate_image(url, Keyword.put(@opts, :path, filepath)) do
153+
case ScreenshotQueue.generate_image(url, @opts |> Keyword.put(:path, filepath) |> Keyword.merge(opts)) do
154154
{:ok, _log} ->
155155
case File.read(filepath) do
156156
{:ok, body} ->

0 commit comments

Comments
 (0)