refactor: align GP profile and packaging flow

Main changes:

- Refactor connect/auth flows around a single OS profile and host identity model, including gateway fallback and cookie-on-stdin handling.

- Align request parameters, HIP host-id propagation, SAML webview user-agent behavior, and portal default-browser handling with observed official client behavior.

- Add opt-in cookie cache support and Microsoft Defender HIP reporting while keeping host-id validation explicit.

- Add BSD build, packaging, release artifact, and provenance support with FreeBSD/OpenBSD path and dependency cleanup.

- Update NixOS install documentation and dependency compatibility fixes.
This commit is contained in:
Kevin Yue committed 2026-06-19 21:23:29 +08:00
1 parent f98e0336dc
commit 888dc93643
92 files changed
+9847 -2868

No files matched your search

+38 -37
View File
@@ -1,37 +1,22 @@
use clap::{ValueEnum, builder::PossibleValue};
use crate::gp_params::ClientOs;
use crate::{
gp_params::CscMode,
os_profile::{ClientOs, runtime_client_os},
};
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub enum Os {
#[value(name = "Linux")]
Linux,
#[value(name = "Windows")]
Windows,
#[value(name = "Mac")]
Mac,
}
impl Os {
pub fn as_str(&self) -> &'static str {
match self {
Os::Linux => "Linux",
Os::Windows => "Windows",
Os::Mac => "Mac",
}
}
}
impl From<&str> for Os {
fn from(os: &str) -> Self {
match os.to_lowercase().as_str() {
"linux" => Os::Linux,
"windows" => Os::Windows,
"mac" => Os::Mac,
_ => Os::Linux,
}
}
}
impl From<&Os> for ClientOs {
fn from(value: &Os) -> Self {
impl From<Os> for ClientOs {
fn from(value: Os) -> Self {
match value {
Os::Linux => ClientOs::Linux,
Os::Windows => ClientOs::Windows,
@@ -40,25 +25,41 @@ impl From<&Os> for ClientOs {
}
}
impl ValueEnum for Os {
impl Default for Os {
fn default() -> Self {
match runtime_client_os() {
ClientOs::Linux => Os::Linux,
ClientOs::Windows => Os::Windows,
ClientOs::Mac => Os::Mac,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_os_uses_runtime_client_os() {
assert_eq!(ClientOs::from(Os::default()), runtime_client_os());
}
}
impl ValueEnum for CscMode {
fn value_variants<'a>() -> &'a [Self] {
&[Os::Linux, Os::Windows, Os::Mac]
&[CscMode::Auto, CscMode::Yes, CscMode::No]
}
fn to_possible_value(&self) -> Option<clap::builder::PossibleValue> {
match self {
Os::Linux => Some(PossibleValue::new("Linux")),
Os::Windows => Some(PossibleValue::new("Windows")),
Os::Mac => Some(PossibleValue::new("Mac")),
}
fn to_possible_value(&self) -> Option<PossibleValue> {
Some(PossibleValue::new(self.as_str()))
}
fn from_str(input: &str, _: bool) -> Result<Self, String> {
match input.to_lowercase().as_str() {
"linux" => Ok(Os::Linux),
"windows" => Ok(Os::Windows),
"mac" => Ok(Os::Mac),
_ => Err(format!("Invalid OS: {}", input)),
"auto" => Ok(CscMode::Auto),
"yes" => Ok(CscMode::Yes),
"no" => Ok(CscMode::No),
_ => Err(format!("Invalid CSC mode: {}", input)),
}
}
}