Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ret_web/channels/hub_channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ defmodule RetWeb.HubChannel do
account = Guardian.Phoenix.Socket.current_resource(socket)

response =
HubView.render("show.json", %{hub: hub, embeddable: account |> can?(embed_hub(hub))})
HubView.render("show.json", %{hub: hub, embeddable: account |> can?(embed_hub(hub)), account: account})
|> Map.put(:session_id, socket.assigns.session_id)
|> Map.put(:stale_fields, stale_fields)

Expand Down
12 changes: 6 additions & 6 deletions lib/ret_web/views/api/v1/hub_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ defmodule RetWeb.Api.V1.HubView do
}
end

def render("show.json", %{hub: %Hub{scene: %Scene{}} = hub, embeddable: embeddable}) do
hub |> render_with_scene(embeddable)
def render("show.json", %{hub: %Hub{scene: %Scene{}} = hub, embeddable: embeddable} = params) do
hub |> render_with_scene(embeddable, params[:account])
end

def render("show.json", %{hub: %Hub{scene_listing: %SceneListing{}} = hub, embeddable: embeddable}) do
hub |> render_with_scene(embeddable)
def render("show.json", %{hub: %Hub{scene_listing: %SceneListing{}} = hub, embeddable: embeddable} = params) do
hub |> render_with_scene(embeddable, params[:account])
end

def render("show.json", %{hub: hub}) do
hub |> render_with_scene_asset(:gltf_bundle, hub.default_environment_gltf_bundle_url)
end

def render_with_scene(hub, embeddable) do
defp render_with_scene(hub, embeddable, account) do
%{
hubs: [
%{
Expand All @@ -35,7 +35,7 @@ defmodule RetWeb.Api.V1.HubView do
entry_mode: hub.entry_mode,
host: hub.host,
port: janus_port(),
scene: RetWeb.Api.V1.SceneView.render_scene(hub.scene || hub.scene_listing, nil),
scene: RetWeb.Api.V1.SceneView.render_scene(hub.scene || hub.scene_listing, account),
embed_token:
if embeddable do
hub.embed_token
Expand Down