mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-04 15:52:30 +00:00
Added startup path & Linux package type to the info page (#785)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
e27cd27dba
commit
b37f70d7ff
10 files changed
+163
No files matched your search
@@ -60,6 +60,59 @@ pub async fn read_user_name(_token: APIToken) -> String {
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
pub struct RuntimeInfo {
|
||||
pub working_directory: String,
|
||||
pub executable_path: String,
|
||||
pub linux_package_type: String,
|
||||
}
|
||||
|
||||
pub async fn get_runtime_info(_token: APIToken) -> Json<RuntimeInfo> {
|
||||
Json(RuntimeInfo {
|
||||
working_directory: env::current_dir()
|
||||
.map(|path| path.to_string_lossy().into_owned())
|
||||
.unwrap_or_default(),
|
||||
executable_path: env::current_exe()
|
||||
.map(|path| path.to_string_lossy().into_owned())
|
||||
.unwrap_or_default(),
|
||||
linux_package_type: detect_linux_package_type().to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn detect_linux_package_type() -> &'static str {
|
||||
if is_flatpak() {
|
||||
"flatpak"
|
||||
} else if is_appimage() {
|
||||
"appimage"
|
||||
} else {
|
||||
"unknown"
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn detect_linux_package_type() -> &'static str {
|
||||
"not_applicable"
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn is_flatpak() -> bool {
|
||||
env_var_has_value("FLATPAK_ID")
|
||||
|| Path::new("/.flatpak-info").is_file()
|
||||
|| env::var("container")
|
||||
.is_ok_and(|value| value.trim().eq_ignore_ascii_case("flatpak"))
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn is_appimage() -> bool {
|
||||
env_var_has_value("APPIMAGE") || env_var_has_value("APPDIR")
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn env_var_has_value(key: &str) -> bool {
|
||||
env::var(key).is_ok_and(|value| !value.trim().is_empty())
|
||||
}
|
||||
|
||||
/// Returns true if the application is running in development mode.
|
||||
pub fn is_dev() -> bool {
|
||||
cfg!(debug_assertions)
|
||||
|
||||
@@ -47,6 +47,7 @@ pub fn start_runtime_api() {
|
||||
.route("/secrets/delete", post(crate::secret::delete_secret))
|
||||
.route("/system/directories/config", get(crate::environment::get_config_directory))
|
||||
.route("/system/directories/data", get(crate::environment::get_data_directory))
|
||||
.route("/system/runtime/info", get(crate::environment::get_runtime_info))
|
||||
.route("/system/language", get(crate::environment::read_user_language))
|
||||
.route("/system/username", get(crate::environment::read_user_name))
|
||||
.route("/system/enterprise/config/id", get(crate::environment::read_enterprise_env_config_id))
|
||||
|
||||
Reference in new issue
Block a user