2021-08-14 03:17:43 +08:00
|
|
|
defmodule LivebookWeb.SettingsLive do
|
|
|
|
use LivebookWeb, :live_view
|
|
|
|
|
2023-02-23 02:34:54 +08:00
|
|
|
alias LivebookWeb.{LayoutHelpers, LayoutHelpers}
|
2021-08-14 03:17:43 +08:00
|
|
|
|
2022-08-18 21:34:27 +08:00
|
|
|
on_mount LivebookWeb.SidebarHook
|
|
|
|
|
2021-08-14 03:17:43 +08:00
|
|
|
@impl true
|
2021-11-02 02:33:43 +08:00
|
|
|
def mount(_params, _session, socket) do
|
2022-09-12 22:34:39 +08:00
|
|
|
if connected?(socket) do
|
|
|
|
Livebook.Settings.subscribe()
|
|
|
|
end
|
|
|
|
|
2021-08-18 20:41:57 +08:00
|
|
|
{:ok,
|
2022-08-18 21:34:27 +08:00
|
|
|
assign(socket,
|
2022-04-18 06:55:08 +08:00
|
|
|
file_systems: Livebook.Settings.file_systems(),
|
2022-09-17 01:22:27 +08:00
|
|
|
env_vars: Livebook.Settings.fetch_env_vars() |> Enum.sort(),
|
2022-09-12 22:34:39 +08:00
|
|
|
env_var: nil,
|
2022-03-13 23:22:52 +08:00
|
|
|
autosave_path_state: %{
|
|
|
|
file: autosave_dir(),
|
|
|
|
dialog_opened?: false
|
|
|
|
},
|
2022-04-18 06:55:08 +08:00
|
|
|
update_check_enabled: Livebook.UpdateCheck.enabled?(),
|
2022-10-13 21:16:52 +08:00
|
|
|
page_title: "Livebook - Settings",
|
|
|
|
default_file_system_id: Livebook.Settings.default_file_system_id()
|
2021-08-18 20:41:57 +08:00
|
|
|
)}
|
2021-08-14 03:17:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
def render(assigns) do
|
|
|
|
~H"""
|
2022-08-23 18:38:39 +08:00
|
|
|
<LayoutHelpers.layout
|
2023-02-23 02:34:54 +08:00
|
|
|
current_page={~p"/settings"}
|
2022-08-23 18:38:39 +08:00
|
|
|
current_user={@current_user}
|
|
|
|
saved_hubs={@saved_hubs}
|
|
|
|
>
|
2022-10-12 01:06:18 +08:00
|
|
|
<div id="settings-page" class="p-4 md:px-12 md:py-7 max-w-screen-md mx-auto space-y-16">
|
2022-08-23 18:38:39 +08:00
|
|
|
<!-- System settings section -->
|
|
|
|
<div class="flex flex-col space-y-10">
|
|
|
|
<div>
|
2023-02-23 02:34:54 +08:00
|
|
|
<LayoutHelpers.title text="System settings" />
|
2022-08-23 18:38:39 +08:00
|
|
|
<p class="mt-4 text-gray-700">
|
|
|
|
Here you can change global Livebook configuration. Keep in mind
|
|
|
|
that this configuration gets persisted and will be restored on application
|
|
|
|
launch.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<!-- System details -->
|
|
|
|
<div class="flex flex-col space-y-2">
|
2022-09-06 05:18:51 +08:00
|
|
|
<h2 class="text-xl text-gray-800 font-medium">
|
2022-08-23 18:38:39 +08:00
|
|
|
About
|
|
|
|
</h2>
|
2022-10-12 01:06:18 +08:00
|
|
|
<div class="flex flex-col sm:flex-row gap-4 sm:gap-12 items-center justify-center sm:justify-between border border-gray-200 rounded-lg p-4">
|
|
|
|
<div class="flex justify-center sm:items-center space-x-12">
|
2023-02-23 02:34:54 +08:00
|
|
|
<.labeled_text :if={app_name = Livebook.Config.app_service_name()} label="Application">
|
|
|
|
<%= if app_url = Livebook.Config.app_service_url() do %>
|
|
|
|
<a href={app_url} class="underline hover:no-underline" target="_blank">
|
2022-08-23 18:38:39 +08:00
|
|
|
<%= app_name %>
|
2023-02-23 02:34:54 +08:00
|
|
|
</a>
|
|
|
|
<% else %>
|
|
|
|
<%= app_name %>
|
|
|
|
<% end %>
|
|
|
|
</.labeled_text>
|
2022-08-23 18:38:39 +08:00
|
|
|
<.labeled_text label="Livebook">
|
|
|
|
v<%= Application.spec(:livebook, :vsn) %>
|
|
|
|
</.labeled_text>
|
|
|
|
<.labeled_text label="Elixir">
|
|
|
|
v<%= System.version() %>
|
|
|
|
</.labeled_text>
|
2022-01-12 20:28:10 +08:00
|
|
|
</div>
|
2022-08-23 18:38:39 +08:00
|
|
|
|
2022-09-20 02:24:05 +08:00
|
|
|
<div class="self-center">
|
2023-02-23 02:34:54 +08:00
|
|
|
<.link navigate={~p"/dashboard"} class="button-base button-outlined-gray">
|
2022-09-20 02:24:05 +08:00
|
|
|
<.remix_icon icon="dashboard-2-line" class="align-middle mr-1" />
|
|
|
|
<span>Open dashboard</span>
|
2023-02-23 02:34:54 +08:00
|
|
|
</.link>
|
2022-09-20 02:24:05 +08:00
|
|
|
</div>
|
2022-01-12 20:28:10 +08:00
|
|
|
</div>
|
2022-08-23 18:38:39 +08:00
|
|
|
</div>
|
|
|
|
<!-- Updates -->
|
|
|
|
<div class="flex flex-col space-y-4">
|
2022-09-06 05:18:51 +08:00
|
|
|
<h2 class="text-xl text-gray-800 font-medium pb-2 border-b border-gray-200">
|
2022-08-23 18:38:39 +08:00
|
|
|
Updates
|
|
|
|
</h2>
|
|
|
|
<form class="mt-4" phx-change="save" onsubmit="return false;">
|
2023-02-23 02:34:54 +08:00
|
|
|
<.switch_field
|
2022-08-23 18:38:39 +08:00
|
|
|
name="update_check_enabled"
|
|
|
|
label="Show banner when a new Livebook version is available"
|
2023-02-23 02:34:54 +08:00
|
|
|
value={@update_check_enabled}
|
2022-08-02 21:51:02 +08:00
|
|
|
/>
|
2022-08-23 18:38:39 +08:00
|
|
|
</form>
|
2021-12-04 04:57:21 +08:00
|
|
|
</div>
|
2022-08-23 18:38:39 +08:00
|
|
|
<!-- Autosave path configuration -->
|
|
|
|
<div class="flex flex-col space-y-4">
|
2022-09-06 05:18:51 +08:00
|
|
|
<h2 class="text-xl text-gray-800 font-medium pb-2 border-b border-gray-200">
|
2022-08-23 18:38:39 +08:00
|
|
|
Autosave
|
|
|
|
</h2>
|
|
|
|
<p class="text-gray-700">
|
|
|
|
The directory to keep unsaved notebooks.
|
|
|
|
</p>
|
|
|
|
<.autosave_path_select state={@autosave_path_state} />
|
|
|
|
</div>
|
|
|
|
<!-- File systems configuration -->
|
|
|
|
<div class="flex flex-col space-y-4">
|
2022-09-06 05:18:51 +08:00
|
|
|
<h2 class="text-xl text-gray-800 font-medium pb-2 border-b border-gray-200">
|
2022-08-23 18:38:39 +08:00
|
|
|
File systems
|
|
|
|
</h2>
|
|
|
|
<p class="mt-4 text-gray-700">
|
|
|
|
File systems are used to store notebooks. The local disk filesystem
|
|
|
|
is visible only to the current machine, but alternative file systems
|
|
|
|
are available, such as S3-based storages.
|
|
|
|
</p>
|
|
|
|
<LivebookWeb.SettingsLive.FileSystemsComponent.render
|
|
|
|
file_systems={@file_systems}
|
2022-10-13 21:16:52 +08:00
|
|
|
default_file_system_id={@default_file_system_id}
|
2022-08-23 18:38:39 +08:00
|
|
|
/>
|
|
|
|
</div>
|
2022-09-12 22:34:39 +08:00
|
|
|
<!-- Environment variables configuration -->
|
|
|
|
<div class="flex flex-col space-y-4">
|
2022-10-12 01:06:18 +08:00
|
|
|
<h2 class="text-xl text-gray-800 font-medium pb-2 border-b border-gray-200">
|
2022-09-12 22:34:39 +08:00
|
|
|
Environment variables
|
|
|
|
</h2>
|
|
|
|
<p class="mt-4 text-gray-700">
|
2022-10-21 01:55:38 +08:00
|
|
|
Environment variables store global values, specific to this
|
|
|
|
Livebook instance, which are available inside your notebooks.
|
|
|
|
You can also configure the <code>PATH</code> environment to
|
|
|
|
make system dependencies available to notebooks.
|
2022-09-12 22:34:39 +08:00
|
|
|
</p>
|
|
|
|
<.live_component
|
2022-09-15 00:24:32 +08:00
|
|
|
module={LivebookWeb.EnvVarsComponent}
|
2022-09-12 22:34:39 +08:00
|
|
|
id="env-vars"
|
|
|
|
env_vars={@env_vars}
|
2023-02-23 02:34:54 +08:00
|
|
|
return_to={~p"/settings"}
|
|
|
|
add_env_var_path={~p"/settings/env-var/new"}
|
2022-09-12 22:34:39 +08:00
|
|
|
/>
|
|
|
|
</div>
|
2022-08-23 18:38:39 +08:00
|
|
|
</div>
|
|
|
|
<!-- User settings section -->
|
|
|
|
<div class="flex flex-col space-y-10">
|
|
|
|
<div>
|
2023-02-23 02:34:54 +08:00
|
|
|
<LayoutHelpers.title text="User settings" />
|
2022-08-23 18:38:39 +08:00
|
|
|
<p class="mt-4 text-gray-700">
|
|
|
|
The configuration in this section changes only your Livebook
|
|
|
|
experience and is saved in your browser.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<!-- Editor configuration -->
|
|
|
|
<div class="flex flex-col space-y-4">
|
2022-09-06 05:18:51 +08:00
|
|
|
<h2 class="text-xl text-gray-800 font-medium pb-2 border-b border-gray-200">
|
2022-08-23 18:38:39 +08:00
|
|
|
Code editor
|
|
|
|
</h2>
|
|
|
|
<div
|
|
|
|
class="flex flex-col space-y-3"
|
|
|
|
id="editor-settings"
|
|
|
|
phx-hook="EditorSettings"
|
|
|
|
phx-update="ignore"
|
|
|
|
>
|
2023-02-23 02:34:54 +08:00
|
|
|
<.switch_field
|
2022-08-23 18:38:39 +08:00
|
|
|
name="editor_auto_completion"
|
|
|
|
label="Show completion list while typing"
|
2023-02-23 02:34:54 +08:00
|
|
|
value={false}
|
2022-08-23 18:38:39 +08:00
|
|
|
/>
|
2023-02-23 02:34:54 +08:00
|
|
|
<.switch_field
|
2022-08-23 18:38:39 +08:00
|
|
|
name="editor_auto_signature"
|
|
|
|
label="Show function signature while typing"
|
2023-02-23 02:34:54 +08:00
|
|
|
value={false}
|
2022-08-23 18:38:39 +08:00
|
|
|
/>
|
2023-02-23 02:34:54 +08:00
|
|
|
<.switch_field name="editor_font_size" label="Increase font size" value={false} />
|
|
|
|
<.switch_field
|
2022-08-23 18:38:39 +08:00
|
|
|
name="editor_high_contrast"
|
|
|
|
label="Use high contrast theme"
|
2023-02-23 02:34:54 +08:00
|
|
|
value={false}
|
2022-08-23 18:38:39 +08:00
|
|
|
/>
|
2023-02-23 02:34:54 +08:00
|
|
|
<.switch_field
|
2022-08-23 18:38:39 +08:00
|
|
|
name="editor_markdown_word_wrap"
|
|
|
|
label="Wrap words in Markdown"
|
2023-02-23 02:34:54 +08:00
|
|
|
value={false}
|
2022-08-23 18:38:39 +08:00
|
|
|
/>
|
2021-12-04 04:57:21 +08:00
|
|
|
</div>
|
2021-08-14 03:17:43 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-23 18:38:39 +08:00
|
|
|
</LayoutHelpers.layout>
|
2021-08-14 03:17:43 +08:00
|
|
|
|
2023-02-23 02:34:54 +08:00
|
|
|
<.modal
|
|
|
|
:if={@live_action == :add_file_system}
|
|
|
|
id="add-file-system-modal"
|
|
|
|
show
|
|
|
|
class="w-full max-w-3xl"
|
|
|
|
patch={~p"/settings"}
|
|
|
|
>
|
|
|
|
<.live_component
|
|
|
|
module={LivebookWeb.SettingsLive.AddFileSystemComponent}
|
|
|
|
id="add-file-system"
|
|
|
|
return_to={~p"/settings"}
|
|
|
|
/>
|
|
|
|
</.modal>
|
|
|
|
|
|
|
|
<.modal
|
|
|
|
:if={@live_action in [:add_env_var, :edit_env_var]}
|
|
|
|
id="env-var-modal"
|
|
|
|
show
|
|
|
|
class="w-full max-w-3xl"
|
|
|
|
patch={~p"/settings"}
|
|
|
|
>
|
|
|
|
<.live_component
|
|
|
|
module={LivebookWeb.EnvVarComponent}
|
|
|
|
id="env-var"
|
|
|
|
env_var={@env_var}
|
|
|
|
headline="Configure your application global environment variables."
|
|
|
|
return_to={~p"/settings"}
|
|
|
|
/>
|
|
|
|
</.modal>
|
2021-08-14 03:17:43 +08:00
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
2022-09-12 22:34:39 +08:00
|
|
|
defp autosave_path_select(%{state: %{file: nil}} = assigns), do: ~H""
|
|
|
|
|
2022-03-13 23:22:52 +08:00
|
|
|
defp autosave_path_select(%{state: %{dialog_opened?: true}} = assigns) do
|
|
|
|
~H"""
|
|
|
|
<div class="w-full h-52">
|
2022-08-02 21:51:02 +08:00
|
|
|
<.live_component
|
|
|
|
module={LivebookWeb.FileSelectComponent}
|
2022-03-13 23:22:52 +08:00
|
|
|
id="autosave-path-component"
|
|
|
|
file={@state.file}
|
|
|
|
extnames={[]}
|
|
|
|
running_files={[]}
|
|
|
|
submit_event={:set_autosave_path}
|
|
|
|
file_system_select_disabled={true}
|
|
|
|
>
|
2022-08-02 21:51:02 +08:00
|
|
|
<button class="button-base button-gray" phx-click="cancel_autosave_path" tabindex="-1">
|
|
|
|
Cancel
|
2022-03-13 23:22:52 +08:00
|
|
|
</button>
|
2022-08-02 21:51:02 +08:00
|
|
|
<button class="button-base button-gray" phx-click="reset_autosave_path" tabindex="-1">
|
|
|
|
Reset
|
2022-03-13 23:22:52 +08:00
|
|
|
</button>
|
2022-08-02 21:51:02 +08:00
|
|
|
<button
|
|
|
|
class="button-base button-blue"
|
2022-03-13 23:22:52 +08:00
|
|
|
phx-click="set_autosave_path"
|
|
|
|
disabled={not Livebook.FileSystem.File.dir?(@state.file)}
|
2022-08-02 21:51:02 +08:00
|
|
|
tabindex="-1"
|
|
|
|
>
|
2022-03-13 23:22:52 +08:00
|
|
|
Save
|
|
|
|
</button>
|
|
|
|
</.live_component>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
|
|
|
defp autosave_path_select(assigns) do
|
|
|
|
~H"""
|
|
|
|
<div class="flex">
|
2022-08-02 21:51:02 +08:00
|
|
|
<input class="input mr-2" readonly value={@state.file.path} />
|
|
|
|
<button class="button-base button-gray button-small" phx-click="open_autosave_path_select">
|
2022-03-13 23:22:52 +08:00
|
|
|
Change
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
2021-08-14 03:17:43 +08:00
|
|
|
@impl true
|
2022-09-12 22:34:39 +08:00
|
|
|
def handle_params(%{"env_var_id" => key}, _url, socket) do
|
|
|
|
env_var = Livebook.Settings.fetch_env_var!(key)
|
|
|
|
{:noreply, assign(socket, env_var: env_var)}
|
|
|
|
end
|
|
|
|
|
2022-02-23 05:42:54 +08:00
|
|
|
def handle_params(%{"file_system_id" => file_system_id}, _url, socket) do
|
|
|
|
{:noreply, assign(socket, file_system_id: file_system_id)}
|
2021-08-14 03:17:43 +08:00
|
|
|
end
|
|
|
|
|
2022-09-15 00:24:32 +08:00
|
|
|
def handle_params(_params, _url, socket), do: {:noreply, assign(socket, env_var: nil)}
|
2021-08-14 03:17:43 +08:00
|
|
|
|
2022-03-02 07:26:40 +08:00
|
|
|
@impl true
|
2022-03-13 23:22:52 +08:00
|
|
|
def handle_event("cancel_autosave_path", %{}, socket) do
|
|
|
|
{:noreply,
|
|
|
|
update(
|
|
|
|
socket,
|
|
|
|
:autosave_path_state,
|
|
|
|
&%{&1 | dialog_opened?: false, file: autosave_dir()}
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
def handle_event("set_autosave_path", %{}, socket) do
|
|
|
|
path = socket.assigns.autosave_path_state.file.path
|
|
|
|
|
|
|
|
Livebook.Settings.set_autosave_path(path)
|
|
|
|
|
|
|
|
{:noreply,
|
|
|
|
update(
|
|
|
|
socket,
|
|
|
|
:autosave_path_state,
|
|
|
|
&%{&1 | dialog_opened?: false, file: autosave_dir()}
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
def handle_event("reset_autosave_path", %{}, socket) do
|
|
|
|
{:noreply,
|
|
|
|
update(
|
|
|
|
socket,
|
|
|
|
:autosave_path_state,
|
|
|
|
&%{&1 | file: default_autosave_dir()}
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
def handle_event("open_autosave_path_select", %{}, socket) do
|
|
|
|
{:noreply, update(socket, :autosave_path_state, &%{&1 | dialog_opened?: true})}
|
|
|
|
end
|
|
|
|
|
2022-03-02 07:26:40 +08:00
|
|
|
def handle_event("detach_file_system", %{"id" => file_system_id}, socket) do
|
|
|
|
Livebook.Settings.remove_file_system(file_system_id)
|
2022-10-13 21:16:52 +08:00
|
|
|
|
2022-03-02 07:26:40 +08:00
|
|
|
file_systems = Livebook.Settings.file_systems()
|
2022-10-13 21:31:06 +08:00
|
|
|
|
|
|
|
{:noreply,
|
|
|
|
assign(socket,
|
|
|
|
file_systems: file_systems,
|
|
|
|
default_file_system_id: Livebook.Settings.default_file_system_id()
|
|
|
|
)}
|
2022-03-02 07:26:40 +08:00
|
|
|
end
|
|
|
|
|
2022-10-13 21:16:52 +08:00
|
|
|
def handle_event("make_default_file_system", %{"id" => file_system_id}, socket) do
|
|
|
|
Livebook.Settings.set_default_file_system(file_system_id)
|
|
|
|
{:noreply, assign(socket, default_file_system_id: file_system_id)}
|
|
|
|
end
|
|
|
|
|
2022-04-18 06:55:08 +08:00
|
|
|
def handle_event("save", %{"update_check_enabled" => enabled}, socket) do
|
|
|
|
enabled = enabled == "true"
|
|
|
|
Livebook.UpdateCheck.set_enabled(enabled)
|
|
|
|
{:noreply, assign(socket, :update_check_enabled, enabled)}
|
|
|
|
end
|
|
|
|
|
2022-09-15 00:24:32 +08:00
|
|
|
def handle_event("save", %{"env_var" => attrs}, socket) do
|
2023-02-01 07:37:04 +08:00
|
|
|
env_var = socket.assigns.env_var || %Livebook.Settings.EnvVar{}
|
2022-09-15 00:24:32 +08:00
|
|
|
|
2023-02-01 07:37:04 +08:00
|
|
|
case Livebook.Settings.set_env_var(env_var, attrs) do
|
2022-09-15 00:24:32 +08:00
|
|
|
{:ok, _} ->
|
2023-02-23 02:34:54 +08:00
|
|
|
{:noreply, push_patch(socket, to: ~p"/settings")}
|
2022-09-15 00:24:32 +08:00
|
|
|
|
|
|
|
{:error, _changeset} ->
|
|
|
|
{:noreply, socket}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def handle_event("edit_env_var", %{"env_var" => key}, socket) do
|
2023-02-23 02:34:54 +08:00
|
|
|
{:noreply, push_patch(socket, to: "/settings/env-var/edit/#{key}")}
|
2022-09-15 00:24:32 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def handle_event("delete_env_var", %{"env_var" => key}, socket) do
|
2022-09-17 01:22:27 +08:00
|
|
|
Livebook.Settings.unset_env_var(key)
|
2022-09-15 00:24:32 +08:00
|
|
|
{:noreply, socket}
|
2022-09-12 22:34:39 +08:00
|
|
|
end
|
|
|
|
|
2021-08-14 03:17:43 +08:00
|
|
|
@impl true
|
|
|
|
def handle_info({:file_systems_updated, file_systems}, socket) do
|
2022-01-31 02:51:03 +08:00
|
|
|
{:noreply, assign(socket, file_systems: file_systems)}
|
2021-08-14 03:17:43 +08:00
|
|
|
end
|
2021-11-02 02:33:43 +08:00
|
|
|
|
2022-03-13 23:22:52 +08:00
|
|
|
def handle_info({:set_file, file, _info}, socket) do
|
|
|
|
{:noreply, update(socket, :autosave_path_state, &%{&1 | file: file})}
|
|
|
|
end
|
|
|
|
|
|
|
|
def handle_info(:set_autosave_path, socket) do
|
|
|
|
handle_event("set_autosave_path", %{}, socket)
|
|
|
|
end
|
|
|
|
|
2022-09-17 01:22:27 +08:00
|
|
|
def handle_info({:env_var_set, env_var}, socket) do
|
2022-09-17 07:37:01 +08:00
|
|
|
idx = Enum.find_index(socket.assigns.env_vars, &(&1.name == env_var.name))
|
2022-09-17 01:22:27 +08:00
|
|
|
|
|
|
|
env_vars =
|
|
|
|
if idx,
|
|
|
|
do: List.replace_at(socket.assigns.env_vars, idx, env_var),
|
|
|
|
else: [env_var | socket.assigns.env_vars]
|
|
|
|
|
|
|
|
{:noreply, assign(socket, env_vars: Enum.sort(env_vars), env_var: nil)}
|
|
|
|
end
|
|
|
|
|
|
|
|
def handle_info({:env_var_unset, env_var}, socket) do
|
2022-09-17 07:37:01 +08:00
|
|
|
env_vars = Enum.reject(socket.assigns.env_vars, &(&1.name == env_var.name))
|
2022-09-17 01:22:27 +08:00
|
|
|
|
2022-09-15 00:24:32 +08:00
|
|
|
{:noreply, assign(socket, env_vars: env_vars, env_var: nil)}
|
2022-09-12 22:34:39 +08:00
|
|
|
end
|
|
|
|
|
2021-11-02 02:33:43 +08:00
|
|
|
def handle_info(_message, socket), do: {:noreply, socket}
|
2022-03-13 23:22:52 +08:00
|
|
|
|
|
|
|
defp autosave_dir() do
|
2022-09-12 22:34:39 +08:00
|
|
|
if path = Livebook.Settings.autosave_path() do
|
|
|
|
path
|
|
|
|
|> Livebook.FileSystem.Utils.ensure_dir_path()
|
|
|
|
|> Livebook.FileSystem.File.local()
|
|
|
|
end
|
2022-03-13 23:22:52 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
defp default_autosave_dir() do
|
|
|
|
Livebook.Settings.default_autosave_path()
|
|
|
|
|> Livebook.FileSystem.Utils.ensure_dir_path()
|
|
|
|
|> Livebook.FileSystem.File.local()
|
|
|
|
end
|
2021-08-14 03:17:43 +08:00
|
|
|
end
|