mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-12-29 03:02:51 +08:00
Adds Livebook Teams URL and some touch ups (#2120)
This commit is contained in:
parent
5ac14c18bb
commit
6ba0118c2d
6 changed files with 14 additions and 10 deletions
|
@ -25,7 +25,7 @@ config :mime, :types, %{
|
|||
config :plug_cowboy, :log_exceptions_with_status_code, [407..599]
|
||||
|
||||
config :livebook,
|
||||
teams_url: "http://localhost:4100",
|
||||
teams_url: "https://teams.livebook.dev",
|
||||
app_service_name: nil,
|
||||
app_service_url: nil,
|
||||
authentication_mode: :token,
|
||||
|
|
|
@ -70,6 +70,7 @@ defmodule Livebook.Hubs.TeamClient do
|
|||
derived_keys = Teams.derive_keys(team.teams_key)
|
||||
|
||||
headers = [
|
||||
{"x-lb-version", to_string(Application.spec(:livebook, :vsn))},
|
||||
{"x-user", to_string(team.user_id)},
|
||||
{"x-org", to_string(team.org_id)},
|
||||
{"x-org-key", to_string(team.org_key_id)},
|
||||
|
|
|
@ -12,6 +12,8 @@ defmodule Livebook.Teams.Connection do
|
|||
@no_state :no_state
|
||||
@loop_ping_delay 5_000
|
||||
|
||||
@websocket_messages [:ssl, :tcp, :ssl_closed, :tcp_closed, :ssl_error, :tcp_error]
|
||||
|
||||
defstruct [:listener, :headers, :http_conn, :websocket, :ref]
|
||||
|
||||
@doc """
|
||||
|
@ -79,11 +81,8 @@ defmodule Livebook.Teams.Connection do
|
|||
:keep_state_and_data
|
||||
end
|
||||
|
||||
def handle_event(:info, {:tcp_closed, _port} = message, @no_state, %__MODULE__{} = data) do
|
||||
handle_websocket_message(message, data)
|
||||
end
|
||||
|
||||
def handle_event(:info, {:tcp, _port, _data} = message, @no_state, %__MODULE__{} = data) do
|
||||
def handle_event(:info, message, @no_state, %__MODULE__{} = data)
|
||||
when elem(message, 0) in @websocket_messages do
|
||||
handle_websocket_message(message, data)
|
||||
end
|
||||
|
||||
|
|
|
@ -88,7 +88,11 @@ defmodule Livebook.Teams.Requests do
|
|||
|
||||
defp auth_headers(team) do
|
||||
token = "#{team.user_id}:#{team.org_id}:#{team.org_key_id}:#{team.session_token}"
|
||||
[{"authorization", "Bearer " <> token}]
|
||||
|
||||
[
|
||||
{"x-lb-version", to_string(Application.spec(:livebook, :vsn))},
|
||||
{"authorization", "Bearer " <> token}
|
||||
]
|
||||
end
|
||||
|
||||
defp post(path, json, headers \\ []) do
|
||||
|
|
|
@ -158,7 +158,7 @@ defmodule LivebookWeb.Hub.Edit.TeamComponent do
|
|||
language="dockerfile"
|
||||
/>
|
||||
|
||||
<ol class="text-gray-700">
|
||||
<ol class="text-gray-700 mt-4 space-y-2 list-disc list-inside">
|
||||
<li>
|
||||
You must change <code>/path/to/my/notebooks</code> in the template above
|
||||
to point to a directory with the `.livemd` files you want to deploy
|
||||
|
|
|
@ -86,7 +86,7 @@ defmodule LivebookWeb.Hub.SecretFormComponent do
|
|||
|> push_redirect(to: socket.assigns.return_to)}
|
||||
else
|
||||
{:error, changeset} ->
|
||||
{:noreply, assign(socket, changeset: changeset)}
|
||||
{:noreply, assign(socket, changeset: Map.replace!(changeset, :action, :validate))}
|
||||
|
||||
{:transport_error, error} ->
|
||||
{:noreply,
|
||||
|
@ -100,7 +100,7 @@ defmodule LivebookWeb.Hub.SecretFormComponent do
|
|||
changeset =
|
||||
%Secret{}
|
||||
|> Secrets.change_secret(attrs)
|
||||
|> Map.put(:action, :validate)
|
||||
|> Map.replace!(:action, :validate)
|
||||
|
||||
{:noreply, assign(socket, changeset: changeset)}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue