mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-23 12:22:12 +00:00
Report development builds as their own installation kind
This commit is contained in:
parent
140d8a16c4
commit
de129e2c30
@ -4144,6 +4144,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3100928009"]
|
|||||||
-- AI Studio cannot install updates into this installation. Your IT department provides new versions.
|
-- AI Studio cannot install updates into this installation. Your IT department provides new versions.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3125872224"] = "AI Studio cannot install updates into this installation. Your IT department provides new versions."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3125872224"] = "AI Studio cannot install updates into this installation. Your IT department provides new versions."
|
||||||
|
|
||||||
|
-- Development builds do not install updates.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3138812562"] = "Development builds do not install updates."
|
||||||
|
|
||||||
-- Spellchecking is enabled
|
-- Spellchecking is enabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3165555978"] = "Spellchecking is enabled"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3165555978"] = "Spellchecking is enabled"
|
||||||
|
|
||||||
@ -4219,6 +4222,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T71162186"] =
|
|||||||
-- Energy saving is disabled
|
-- Energy saving is disabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T716338721"] = "Energy saving is disabled"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T716338721"] = "Energy saving is disabled"
|
||||||
|
|
||||||
|
-- Development builds do not check for updates.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T735114866"] = "Development builds do not check for updates."
|
||||||
|
|
||||||
-- Start page
|
-- Start page
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T78084670"] = "Start page"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T78084670"] = "Start page"
|
||||||
|
|
||||||
@ -8533,6 +8539,12 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3440211747"] = "Used Rust compil
|
|||||||
-- AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management.
|
-- AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3449345633"] = "AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3449345633"] = "AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management."
|
||||||
|
|
||||||
|
-- You are running a development build of AI Studio, which never updates itself. Pull the latest changes and rebuild the app instead.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3454691558"] = "You are running a development build of AI Studio, which never updates itself. Pull the latest changes and rebuild the app instead."
|
||||||
|
|
||||||
|
-- development build, no self-updates
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3459123358"] = "development build, no self-updates"
|
||||||
|
|
||||||
-- Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!
|
-- Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3494984593"] = "Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3494984593"] = "Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!"
|
||||||
|
|
||||||
|
|||||||
@ -15,13 +15,13 @@ public partial class SettingsPanelApp : SettingsPanelBase
|
|||||||
|
|
||||||
private UpdatePolicyMode updatePolicyMode;
|
private UpdatePolicyMode updatePolicyMode;
|
||||||
|
|
||||||
private bool AreUpdatesHandledOutsideTheApp => this.updatePolicyMode is UpdatePolicyMode.FLATPAK or UpdatePolicyMode.MANAGED_INSTALLATION or UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION;
|
private bool CannotUpdateItself => this.updatePolicyMode is UpdatePolicyMode.FLATPAK or UpdatePolicyMode.MANAGED_INSTALLATION or UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION or UpdatePolicyMode.DEVELOPMENT;
|
||||||
|
|
||||||
private UpdateInterval DisplayedUpdateInterval => this.AreUpdatesHandledOutsideTheApp
|
private UpdateInterval DisplayedUpdateInterval => this.CannotUpdateItself
|
||||||
? UpdateInterval.NO_CHECK
|
? UpdateInterval.NO_CHECK
|
||||||
: this.SettingsManager.ConfigurationData.App.UpdateInterval;
|
: this.SettingsManager.ConfigurationData.App.UpdateInterval;
|
||||||
|
|
||||||
private UpdateInstallation DisplayedUpdateInstallation => this.AreUpdatesHandledOutsideTheApp
|
private UpdateInstallation DisplayedUpdateInstallation => this.CannotUpdateItself
|
||||||
? UpdateInstallation.MANUAL
|
? UpdateInstallation.MANUAL
|
||||||
: this.SettingsManager.ConfigurationData.App.UpdateInstallation;
|
: this.SettingsManager.ConfigurationData.App.UpdateInstallation;
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ public partial class SettingsPanelApp : SettingsPanelBase
|
|||||||
UpdatePolicyMode.FLATPAK => T("AI Studio cannot check for updates when running as a Flatpak. Updates are managed outside the app."),
|
UpdatePolicyMode.FLATPAK => T("AI Studio cannot check for updates when running as a Flatpak. Updates are managed outside the app."),
|
||||||
UpdatePolicyMode.MANAGED_INSTALLATION => T("This copy of AI Studio was installed for you by someone else, so it does not check for updates on its own."),
|
UpdatePolicyMode.MANAGED_INSTALLATION => T("This copy of AI Studio was installed for you by someone else, so it does not check for updates on its own."),
|
||||||
UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION => T("AI Studio cannot update itself from its current location, so it does not check for updates."),
|
UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION => T("AI Studio cannot update itself from its current location, so it does not check for updates."),
|
||||||
|
UpdatePolicyMode.DEVELOPMENT => T("Development builds do not check for updates."),
|
||||||
_ => T("How often should we check for app updates?")
|
_ => T("How often should we check for app updates?")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,13 +41,14 @@ public partial class SettingsPanelApp : SettingsPanelBase
|
|||||||
UpdatePolicyMode.FLATPAK => T("AI Studio cannot install updates when running as a Flatpak. Use the update method provided by your Flatpak distribution."),
|
UpdatePolicyMode.FLATPAK => T("AI Studio cannot install updates when running as a Flatpak. Use the update method provided by your Flatpak distribution."),
|
||||||
UpdatePolicyMode.MANAGED_INSTALLATION => T("AI Studio cannot install updates into this installation. Your IT department provides new versions."),
|
UpdatePolicyMode.MANAGED_INSTALLATION => T("AI Studio cannot install updates into this installation. Your IT department provides new versions."),
|
||||||
UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION => T("AI Studio cannot install updates into its current location. Install new versions yourself."),
|
UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION => T("AI Studio cannot install updates into its current location. Install new versions yourself."),
|
||||||
|
UpdatePolicyMode.DEVELOPMENT => T("Development builds do not install updates."),
|
||||||
_ => T("Should updates be installed automatically or manually?")
|
_ => T("Should updates be installed automatically or manually?")
|
||||||
};
|
};
|
||||||
|
|
||||||
private bool IsUpdateIntervalLocked() => this.updatePolicyMode is UpdatePolicyMode.ENTERPRISE_DISABLED || this.AreUpdatesHandledOutsideTheApp ||
|
private bool IsUpdateIntervalLocked() => this.updatePolicyMode is UpdatePolicyMode.ENTERPRISE_DISABLED || this.CannotUpdateItself ||
|
||||||
ManagedConfiguration.TryGet(x => x.App, x => x.UpdateInterval, out var meta) && meta.IsLocked;
|
ManagedConfiguration.TryGet(x => x.App, x => x.UpdateInterval, out var meta) && meta.IsLocked;
|
||||||
|
|
||||||
private bool IsUpdateInstallationLocked() => this.updatePolicyMode is UpdatePolicyMode.ENTERPRISE_DISABLED || this.AreUpdatesHandledOutsideTheApp ||
|
private bool IsUpdateInstallationLocked() => this.updatePolicyMode is UpdatePolicyMode.ENTERPRISE_DISABLED || this.CannotUpdateItself ||
|
||||||
ManagedConfiguration.TryGet(x => x.App, x => x.UpdateInstallation, out var meta) && meta.IsLocked;
|
ManagedConfiguration.TryGet(x => x.App, x => x.UpdateInstallation, out var meta) && meta.IsLocked;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
|
|||||||
@ -77,6 +77,7 @@ public partial class Information : MSGComponentBase
|
|||||||
{
|
{
|
||||||
Tools.Rust.InstallationKind.MANAGED => T("managed by someone else, no self-updates"),
|
Tools.Rust.InstallationKind.MANAGED => T("managed by someone else, no self-updates"),
|
||||||
Tools.Rust.InstallationKind.UNSUPPORTED_LOCATION => T("in a location AI Studio cannot update itself from"),
|
Tools.Rust.InstallationKind.UNSUPPORTED_LOCATION => T("in a location AI Studio cannot update itself from"),
|
||||||
|
Tools.Rust.InstallationKind.DEVELOPMENT => T("development build, no self-updates"),
|
||||||
_ => T("owned by you, self-updates possible")
|
_ => T("owned by you, self-updates possible")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -675,6 +676,10 @@ public partial class Information : MSGComponentBase
|
|||||||
parameters.Add(x => x.Message, T("AI Studio cannot update itself from its current location. Installing an update would leave a second installation behind instead of replacing this one. To get a new version, download the latest release and install it over your current installation."));
|
parameters.Add(x => x.Message, T("AI Studio cannot update itself from its current location. Installing an update would leave a second installation behind instead of replacing this one. To get a new version, download the latest release and install it over your current installation."));
|
||||||
parameters.Add(x => x.ReleaseUrl, "https://github.com/MindWorkAI/AI-Studio/releases/latest");
|
parameters.Add(x => x.ReleaseUrl, "https://github.com/MindWorkAI/AI-Studio/releases/latest");
|
||||||
}
|
}
|
||||||
|
else if (this.updatePolicyMode is UpdatePolicyMode.DEVELOPMENT)
|
||||||
|
{
|
||||||
|
parameters.Add(x => x.Message, T("You are running a development build of AI Studio, which never updates itself. Pull the latest changes and rebuild the app instead."));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -4146,6 +4146,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3100928009"]
|
|||||||
-- AI Studio cannot install updates into this installation. Your IT department provides new versions.
|
-- AI Studio cannot install updates into this installation. Your IT department provides new versions.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3125872224"] = "AI Studio kann in dieser Installation keine Updates installieren. Ihre IT-Abteilung stellt neue Versionen bereit."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3125872224"] = "AI Studio kann in dieser Installation keine Updates installieren. Ihre IT-Abteilung stellt neue Versionen bereit."
|
||||||
|
|
||||||
|
-- Development builds do not install updates.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3138812562"] = "Entwicklerversionen installieren keine Updates."
|
||||||
|
|
||||||
-- Spellchecking is enabled
|
-- Spellchecking is enabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3165555978"] = "Rechtschreibprüfung ist aktiviert"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3165555978"] = "Rechtschreibprüfung ist aktiviert"
|
||||||
|
|
||||||
@ -4221,6 +4224,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T71162186"] =
|
|||||||
-- Energy saving is disabled
|
-- Energy saving is disabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T716338721"] = "Energiesparmodus ist deaktiviert"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T716338721"] = "Energiesparmodus ist deaktiviert"
|
||||||
|
|
||||||
|
-- Development builds do not check for updates.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T735114866"] = "Entwicklerversionen suchen nicht nach Updates."
|
||||||
|
|
||||||
-- Start page
|
-- Start page
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T78084670"] = "Startseite"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T78084670"] = "Startseite"
|
||||||
|
|
||||||
@ -8535,6 +8541,12 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3440211747"] = "Verwendeter Rust
|
|||||||
-- AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management.
|
-- AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3449345633"] = "AI Studio wird mit Unternehmenskonfigurationen unter Verwendung von Konfigurations-Plugins betrieben. Eine zentrale Konfigurationsverwaltung wird nicht eingesetzt."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3449345633"] = "AI Studio wird mit Unternehmenskonfigurationen unter Verwendung von Konfigurations-Plugins betrieben. Eine zentrale Konfigurationsverwaltung wird nicht eingesetzt."
|
||||||
|
|
||||||
|
-- You are running a development build of AI Studio, which never updates itself. Pull the latest changes and rebuild the app instead.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3454691558"] = "Du verwendest eine Entwicklerversion von AI Studio, die sich niemals selbst aktualisiert. Hole stattdessen die neuesten Änderungen und erstelle die App neu."
|
||||||
|
|
||||||
|
-- development build, no self-updates
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3459123358"] = "Entwicklerversion, keine automatischen Updates"
|
||||||
|
|
||||||
-- Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!
|
-- Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3494984593"] = "Tauri wird verwendet, um die Blazor-Benutzeroberfläche bereitzustellen. Es ist ein großartiges Projekt, das die Erstellung von Desktop-Anwendungen mit Webtechnologien ermöglicht. Ich liebe Tauri!"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3494984593"] = "Tauri wird verwendet, um die Blazor-Benutzeroberfläche bereitzustellen. Es ist ein großartiges Projekt, das die Erstellung von Desktop-Anwendungen mit Webtechnologien ermöglicht. Ich liebe Tauri!"
|
||||||
|
|
||||||
|
|||||||
@ -4146,6 +4146,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3100928009"]
|
|||||||
-- AI Studio cannot install updates into this installation. Your IT department provides new versions.
|
-- AI Studio cannot install updates into this installation. Your IT department provides new versions.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3125872224"] = "AI Studio cannot install updates into this installation. Your IT department provides new versions."
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3125872224"] = "AI Studio cannot install updates into this installation. Your IT department provides new versions."
|
||||||
|
|
||||||
|
-- Development builds do not install updates.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3138812562"] = "Development builds do not install updates."
|
||||||
|
|
||||||
-- Spellchecking is enabled
|
-- Spellchecking is enabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3165555978"] = "Spellchecking is enabled"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T3165555978"] = "Spellchecking is enabled"
|
||||||
|
|
||||||
@ -4221,6 +4224,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T71162186"] =
|
|||||||
-- Energy saving is disabled
|
-- Energy saving is disabled
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T716338721"] = "Energy saving is disabled"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T716338721"] = "Energy saving is disabled"
|
||||||
|
|
||||||
|
-- Development builds do not check for updates.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T735114866"] = "Development builds do not check for updates."
|
||||||
|
|
||||||
-- Start page
|
-- Start page
|
||||||
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T78084670"] = "Start page"
|
UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAPP::T78084670"] = "Start page"
|
||||||
|
|
||||||
@ -8535,6 +8541,12 @@ UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3440211747"] = "Used Rust compil
|
|||||||
-- AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management.
|
-- AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management.
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3449345633"] = "AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management."
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3449345633"] = "AI Studio runs with an enterprise configuration using configuration plugins, without central configuration management."
|
||||||
|
|
||||||
|
-- You are running a development build of AI Studio, which never updates itself. Pull the latest changes and rebuild the app instead.
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3454691558"] = "You are running a development build of AI Studio, which never updates itself. Pull the latest changes and rebuild the app instead."
|
||||||
|
|
||||||
|
-- development build, no self-updates
|
||||||
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3459123358"] = "development build, no self-updates"
|
||||||
|
|
||||||
-- Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!
|
-- Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!
|
||||||
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3494984593"] = "Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!"
|
UI_TEXT_CONTENT["AISTUDIO::PAGES::INFORMATION::T3494984593"] = "Tauri is used to host the Blazor user interface. It is a great project that allows the creation of desktop applications using web technologies. I love Tauri!"
|
||||||
|
|
||||||
|
|||||||
@ -22,4 +22,10 @@ public enum InstallationKind
|
|||||||
/// to install a new version themselves.
|
/// to install a new version themselves.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
UNSUPPORTED_LOCATION,
|
UNSUPPORTED_LOCATION,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Not an installation at all, but a development build started from a build directory or an
|
||||||
|
/// IDE. There is nothing here the updater could replace.
|
||||||
|
/// </summary>
|
||||||
|
DEVELOPMENT,
|
||||||
}
|
}
|
||||||
@ -20,6 +20,7 @@ public sealed class UpdatePolicy(SettingsManager settingsManager, RuntimeInfoRes
|
|||||||
//
|
//
|
||||||
InstallationKind.MANAGED => UpdatePolicyMode.MANAGED_INSTALLATION,
|
InstallationKind.MANAGED => UpdatePolicyMode.MANAGED_INSTALLATION,
|
||||||
InstallationKind.UNSUPPORTED_LOCATION => UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION,
|
InstallationKind.UNSUPPORTED_LOCATION => UpdatePolicyMode.UNSUPPORTED_INSTALLATION_LOCATION,
|
||||||
|
InstallationKind.DEVELOPMENT => UpdatePolicyMode.DEVELOPMENT,
|
||||||
_ => UpdatePolicyMode.SELF_UPDATE
|
_ => UpdatePolicyMode.SELF_UPDATE
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -7,4 +7,5 @@ public enum UpdatePolicyMode
|
|||||||
ENTERPRISE_DISABLED,
|
ENTERPRISE_DISABLED,
|
||||||
MANAGED_INSTALLATION,
|
MANAGED_INSTALLATION,
|
||||||
UNSUPPORTED_INSTALLATION_LOCATION,
|
UNSUPPORTED_INSTALLATION_LOCATION,
|
||||||
|
DEVELOPMENT,
|
||||||
}
|
}
|
||||||
@ -515,7 +515,7 @@ pub async fn change_location_to(url: &str) {
|
|||||||
|
|
||||||
/// Checks for updates.
|
/// Checks for updates.
|
||||||
pub async fn check_for_update(_token: APIToken) -> Json<CheckUpdateResponse> {
|
pub async fn check_for_update(_token: APIToken) -> Json<CheckUpdateResponse> {
|
||||||
if let Some(reason) = self_update_blocked_reason(is_dev(), is_flatpak(), installation_kind()) {
|
if let Some(reason) = self_update_blocked_reason(is_flatpak(), installation_kind()) {
|
||||||
warn!(Source = "Updater"; "Skipping update check because {reason}.");
|
warn!(Source = "Updater"; "Skipping update check because {reason}.");
|
||||||
return Json(CheckUpdateResponse {
|
return Json(CheckUpdateResponse {
|
||||||
update_is_available: false,
|
update_is_available: false,
|
||||||
@ -600,7 +600,7 @@ pub struct CheckUpdateResponse {
|
|||||||
|
|
||||||
/// Installs the update.
|
/// Installs the update.
|
||||||
pub async fn install_update(_token: APIToken) {
|
pub async fn install_update(_token: APIToken) {
|
||||||
if let Some(reason) = self_update_blocked_reason(is_dev(), is_flatpak(), installation_kind()) {
|
if let Some(reason) = self_update_blocked_reason(is_flatpak(), installation_kind()) {
|
||||||
warn!(Source = "Updater"; "Skipping update installation because {reason}.");
|
warn!(Source = "Updater"; "Skipping update installation because {reason}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -660,22 +660,17 @@ pub async fn install_update(_token: APIToken) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns why this installation cannot update itself, or `None` when it can.
|
/// Returns why this installation cannot update itself, or `None` when it can.
|
||||||
fn self_update_blocked_reason(development: bool, flatpak: bool, installation_kind: InstallationKind) -> Option<&'static str> {
|
fn self_update_blocked_reason(flatpak: bool, installation_kind: InstallationKind) -> Option<&'static str> {
|
||||||
if flatpak {
|
if flatpak {
|
||||||
return Some("Flatpak installations are updated externally");
|
return Some("Flatpak installations are updated externally");
|
||||||
}
|
}
|
||||||
|
|
||||||
match installation_kind {
|
match installation_kind {
|
||||||
InstallationKind::Managed => return Some("this installation is centrally managed"),
|
InstallationKind::User => None,
|
||||||
InstallationKind::UnsupportedLocation => return Some("this installation is in a location the updater cannot replace"),
|
InstallationKind::Managed => Some("this installation is centrally managed"),
|
||||||
InstallationKind::User => {},
|
InstallationKind::UnsupportedLocation => Some("this installation is in a location the updater cannot replace"),
|
||||||
|
InstallationKind::Development => Some("the app is running in development mode"),
|
||||||
}
|
}
|
||||||
|
|
||||||
if development {
|
|
||||||
return Some("the app is running in development mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Response for application exit requests.
|
/// Response for application exit requests.
|
||||||
@ -909,35 +904,45 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_update_is_disabled_in_development() {
|
fn self_update_is_disabled_in_development() {
|
||||||
assert!(self_update_blocked_reason(true, false, InstallationKind::User).is_some());
|
assert!(self_update_blocked_reason(false, InstallationKind::Development).is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_update_is_disabled_for_flatpak() {
|
fn self_update_is_disabled_for_flatpak() {
|
||||||
assert!(self_update_blocked_reason(false, true, InstallationKind::User).is_some());
|
assert!(self_update_blocked_reason(true, InstallationKind::User).is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_update_is_disabled_for_managed_installations() {
|
fn self_update_is_disabled_for_managed_installations() {
|
||||||
assert!(self_update_blocked_reason(false, false, InstallationKind::Managed).is_some());
|
assert!(self_update_blocked_reason(false, InstallationKind::Managed).is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_update_is_disabled_for_unsupported_installation_locations() {
|
fn self_update_is_disabled_for_unsupported_installation_locations() {
|
||||||
assert!(self_update_blocked_reason(false, false, InstallationKind::UnsupportedLocation).is_some());
|
assert!(self_update_blocked_reason(false, InstallationKind::UnsupportedLocation).is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_update_blocked_reason_distinguishes_managed_from_unsupported_locations() {
|
fn every_blocked_installation_kind_has_its_own_reason() {
|
||||||
assert_ne!(
|
let reasons = [
|
||||||
self_update_blocked_reason(false, false, InstallationKind::Managed),
|
self_update_blocked_reason(false, InstallationKind::Managed),
|
||||||
self_update_blocked_reason(false, false, InstallationKind::UnsupportedLocation)
|
self_update_blocked_reason(false, InstallationKind::UnsupportedLocation),
|
||||||
);
|
self_update_blocked_reason(false, InstallationKind::Development),
|
||||||
|
];
|
||||||
|
|
||||||
|
for (index, reason) in reasons.iter().enumerate() {
|
||||||
|
assert!(reason.is_some(), "expected a reason at index {index}");
|
||||||
|
assert_eq!(
|
||||||
|
reasons.iter().filter(|other| *other == reason).count(),
|
||||||
|
1,
|
||||||
|
"expected the reason at index {index} to be unique"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_update_is_enabled_for_normal_production_installations() {
|
fn self_update_is_enabled_for_normal_production_installations() {
|
||||||
assert!(self_update_blocked_reason(false, false, InstallationKind::User).is_none());
|
assert!(self_update_blocked_reason(false, InstallationKind::User).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -98,6 +98,10 @@ pub enum InstallationKind {
|
|||||||
/// `D:\Tools\MindWork AI Studio` would leave a second installation behind. Nobody else
|
/// `D:\Tools\MindWork AI Studio` would leave a second installation behind. Nobody else
|
||||||
/// maintains this installation, so its owner has to install a new version themselves.
|
/// maintains this installation, so its owner has to install a new version themselves.
|
||||||
UnsupportedLocation,
|
UnsupportedLocation,
|
||||||
|
|
||||||
|
/// Not an installation at all, but a development build started from a build directory or an
|
||||||
|
/// IDE. There is nothing here the updater could replace.
|
||||||
|
Development,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||||
@ -172,7 +176,15 @@ fn env_var_has_value(key: &str) -> bool {
|
|||||||
/// including security updates, which is far worse than a second installation.
|
/// including security updates, which is far worse than a second installation.
|
||||||
pub(crate) fn installation_kind() -> InstallationKind {
|
pub(crate) fn installation_kind() -> InstallationKind {
|
||||||
*INSTALLATION_KIND.get_or_init(|| {
|
*INSTALLATION_KIND.get_or_init(|| {
|
||||||
let kind = detect_installation_kind();
|
// A development build lives in a build directory, which is perfectly writable and would
|
||||||
|
// therefore look like a regular user installation. We check it up front so that the
|
||||||
|
// platform-specific detection below only ever deals with real installations:
|
||||||
|
let kind = if is_dev() {
|
||||||
|
InstallationKind::Development
|
||||||
|
} else {
|
||||||
|
detect_installation_kind()
|
||||||
|
};
|
||||||
|
|
||||||
info!(Source = "Updater"; "Detected a {kind:?} installation of AI Studio.");
|
info!(Source = "Updater"; "Detected a {kind:?} installation of AI Studio.");
|
||||||
kind
|
kind
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user