@@ -144,6 +144,13 @@ defmodule Oban.Web.Router do
144144
145145 * `:as` — override the route name; otherwise defaults to `:oban_dashboard`
146146
147+ * `:csp_nonce_assign_key` — CSP (Content Security Policy) keys used to authenticate image,
148+ style, and script assets by pulling a generated nonce out of the connection's `assigns` map. May
149+ be `nil`, a single atom, or a map of atoms. Defaults to `nil`.
150+
151+ * `:logo_path` — a custom path for the logo link in the header, allowing the logo to link to
152+ another page in your application instead of the Oban dashboard root. Defaults to the jobs page.
153+
147154 * `:on_mount` — declares additional module callbacks to be invoked when the dashboard mounts
148155
149156 * `:oban_name` — name of the Oban instance the dashboard will use for configuration and
@@ -157,10 +164,6 @@ defmodule Oban.Web.Router do
157164 * `:transport` — a phoenix socket transport, either `"websocket"` or `"longpoll"`, defaults to
158165 `"websocket"`.
159166
160- * `:csp_nonce_assign_key` — CSP (Content Security Policy) keys used to authenticate image,
161- style, and script assets by pulling a generated nonce out of the connection's `assigns` map. May
162- be `nil`, a single atom, or a map of atoms. Defaults to `nil`.
163-
164167 ## Examples
165168
166169 Mount an `oban` dashboard at the path "/oban":
@@ -225,7 +228,8 @@ defmodule Oban.Web.Router do
225228 opts [ :resolver ] ,
226229 opts [ :socket_path ] ,
227230 opts [ :transport ] ,
228- opts [ :csp_nonce_assign_key ]
231+ opts [ :csp_nonce_assign_key ] ,
232+ opts [ :logo_path ]
229233 ]
230234
231235 session_opts = [
@@ -240,7 +244,7 @@ defmodule Oban.Web.Router do
240244 end
241245
242246 @ doc false
243- def __session__ ( conn , prefix , oban , resolver , live_path , live_transport , csp_key ) do
247+ def __session__ ( conn , prefix , oban , resolver , live_path , live_transport , csp_key , logo_path ) do
244248 user = Resolver . call_with_fallback ( resolver , :resolve_user , [ conn ] )
245249
246250 csp_keys = expand_csp_nonce_keys ( csp_key )
@@ -254,6 +258,7 @@ defmodule Oban.Web.Router do
254258 "refresh" => Resolver . call_with_fallback ( resolver , :resolve_refresh , [ user ] ) ,
255259 "live_path" => live_path ,
256260 "live_transport" => live_transport ,
261+ "logo_path" => logo_path ,
257262 "csp_nonces" => % {
258263 img: conn . assigns [ csp_keys [ :img ] ] ,
259264 style: conn . assigns [ csp_keys [ :style ] ] ,
@@ -275,6 +280,15 @@ defmodule Oban.Web.Router do
275280 end
276281 end
277282
283+ defp validate_opt! ( { :logo_path , path } ) do
284+ unless is_nil ( path ) or ( is_binary ( path ) and byte_size ( path ) > 0 ) do
285+ raise ArgumentError , """
286+ invalid :logo_path, expected nil or a non-empty binary path,
287+ got: #{ inspect ( path ) }
288+ """
289+ end
290+ end
291+
278292 defp validate_opt! ( { :oban_name , name } ) do
279293 unless is_atom ( name ) do
280294 raise ArgumentError , """
0 commit comments