From cc97d8c82ced2dc19f481862b3c6b0ae923a5a25 Mon Sep 17 00:00:00 2001 From: a-maze-d Date: Thu, 15 Aug 2024 09:08:01 +0200 Subject: [PATCH] Add configuration for update check to target a different repository (#2743) --- config/config.exs | 1 + lib/livebook/config.ex | 7 +++++++ lib/livebook/update_check.ex | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index f4b36afab..8cb179ed8 100644 --- a/config/config.exs +++ b/config/config.exs @@ -38,6 +38,7 @@ config :livebook, shutdown_callback: nil, teams_auth?: false, teams_url: "https://teams.livebook.dev", + github_release_repo: "livebook-dev/livebook", update_instructions_url: nil, within_iframe: false diff --git a/lib/livebook/config.ex b/lib/livebook/config.ex index 69b73d944..9ccfac6be 100644 --- a/lib/livebook/config.ex +++ b/lib/livebook/config.ex @@ -425,6 +425,13 @@ defmodule Livebook.Config do """ def app_version(), do: @app_version + @doc """ + Returns the GitHub org/repo where the releases are created. + """ + def github_release_repo() do + Application.get_env(:livebook, :github_release_repo) + end + @doc """ Aborts booting due to a configuration error. """ diff --git a/lib/livebook/update_check.ex b/lib/livebook/update_check.ex index 29af34bd9..a23ffd608 100644 --- a/lib/livebook/update_check.ex +++ b/lib/livebook/update_check.ex @@ -128,7 +128,7 @@ defmodule Livebook.UpdateCheck do end defp fetch_latest_version() do - url = "https://api.github.com/repos/livebook-dev/livebook/releases/latest" + url = "https://api.github.com/repos/#{Livebook.Config.github_release_repo()}/releases/latest" headers = [{"accept", "application/vnd.github.v3+json"}] case Livebook.Utils.HTTP.request(:get, url, headers: headers) do