Settings has an About section (version, commit + date, CPU target) and the client answers --version / -V. Release builds get the commit through git archive export-subst, dev builds ask git
Browse files at this commit5406fd6c0154c3cfcf8cf867fb50de9f6da693aeParent: 9bc7ef6- feat
- Settings has an About section (version, commit + date, CPU target) and the client answers --version / -V. Release builds get the commit through git archive export-subst, dev builds ask git
8 changed files +64 -2
- .gitattributes +1 -0
- crates/client/build.rs +20 -0
- crates/client/commit.txt +1 -0
- crates/client/lang/en/settings_page.txt +4 -0
- crates/client/lang/tr/settings_page.txt +4 -0
- crates/client/src/gui/settings_page.rs +22 -2
- crates/client/src/lib.rs +3 -0
- crates/client/src/main.rs +9 -0
.gitattributesadded+1 -0
| @@ -0,0 +1 @@ | |||
| 1 | +crates/client/commit.txt export-subst | ||
crates/client/build.rsmodified+20 -0
| @@ -387,4 +387,24 @@ fn target() { | |||
| 387 | _ => format!("{arch}-{os}"), | 387 | _ => format!("{arch}-{os}"), |
| 388 | }; | 388 | }; |
| 389 | println!("cargo::rustc-env=YUMUSH_TARGET={target}"); | 389 | println!("cargo::rustc-env=YUMUSH_TARGET={target}"); |
| 390 | + commit(); | ||
| 391 | +} | ||
| 392 | + | ||
| 393 | +fn commit() { | ||
| 394 | + println!("cargo::rerun-if-changed=commit.txt"); | ||
| 395 | + println!("cargo::rerun-if-changed=../../.git/HEAD"); | ||
| 396 | + println!("cargo::rerun-if-changed=../../.git/refs/heads"); | ||
| 397 | + let stamped = fs::read_to_string("commit.txt").unwrap_or_default(); | ||
| 398 | + let commit = if stamped.starts_with("$Format") { | ||
| 399 | + std::process::Command::new("git") | ||
| 400 | + .args(["log", "-1", "--format=%h %cs"]) | ||
| 401 | + .output() | ||
| 402 | + .ok() | ||
| 403 | + .filter(|out| out.status.success()) | ||
| 404 | + .map(|out| String::from_utf8_lossy(&out.stdout).into_owned()) | ||
| 405 | + .unwrap_or_else(|| "dev".to_string()) | ||
| 406 | + } else { | ||
| 407 | + stamped | ||
| 408 | + }; | ||
| 409 | + println!("cargo::rustc-env=YUMUSH_COMMIT={}", commit.trim()); | ||
| 390 | } | 410 | } |
crates/client/commit.txtadded+1 -0
| @@ -0,0 +1 @@ | |||
| 1 | +$Format:%h %cs$ | ||
crates/client/lang/en/settings_page.txtmodified+4 -0
| @@ -29,3 +29,7 @@ codec = Codec | |||
| 29 | share_audio = Share audio | 29 | share_audio = Share audio |
| 30 | back_esc = Back (esc) | 30 | back_esc = Back (esc) |
| 31 | clock_seconds = Show seconds | 31 | clock_seconds = Show seconds |
| 32 | +about = About | ||
| 33 | +version = Version | ||
| 34 | +commit = Commit | ||
| 35 | +target = Target | ||
crates/client/lang/tr/settings_page.txtmodified+4 -0
| @@ -29,3 +29,7 @@ codec = Kodek | |||
| 29 | share_audio = Sesi paylaş | 29 | share_audio = Sesi paylaş |
| 30 | back_esc = Geri (esc) | 30 | back_esc = Geri (esc) |
| 31 | clock_seconds = Saniyeleri göster | 31 | clock_seconds = Saniyeleri göster |
| 32 | +about = Hakkında | ||
| 33 | +version = Sürüm | ||
| 34 | +commit = Commit | ||
| 35 | +target = Hedef | ||
crates/client/src/gui/settings_page.rsmodified+22 -2
| @@ -35,15 +35,17 @@ pub(super) enum SettingsSection { | |||
| 35 | Voice, | 35 | Voice, |
| 36 | CameraShare, | 36 | CameraShare, |
| 37 | Appearance, | 37 | Appearance, |
| 38 | + About, | ||
| 38 | DangerZone, | 39 | DangerZone, |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | impl SettingsSection { | 42 | impl SettingsSection { |
| 42 | - pub(super) const ALL: [Self; 5] = [ | 43 | + pub(super) const ALL: [Self; 6] = [ |
| 43 | Self::Profile, | 44 | Self::Profile, |
| 44 | Self::Voice, | 45 | Self::Voice, |
| 45 | Self::CameraShare, | 46 | Self::CameraShare, |
| 46 | Self::Appearance, | 47 | Self::Appearance, |
| 48 | + Self::About, | ||
| 47 | Self::DangerZone, | 49 | Self::DangerZone, |
| 48 | ]; | 50 | ]; |
| 49 | 51 | ||
| @@ -53,6 +55,7 @@ impl SettingsSection { | |||
| 53 | Self::Voice => "voice", | 55 | Self::Voice => "voice", |
| 54 | Self::CameraShare => "camera_share", | 56 | Self::CameraShare => "camera_share", |
| 55 | Self::Appearance => "appearance", | 57 | Self::Appearance => "appearance", |
| 58 | + Self::About => "about", | ||
| 56 | Self::DangerZone => "danger_zone", | 59 | Self::DangerZone => "danger_zone", |
| 57 | } | 60 | } |
| 58 | } | 61 | } |
| @@ -64,12 +67,13 @@ impl SettingsSection { | |||
| 64 | Self::Voice => w.voice, | 67 | Self::Voice => w.voice, |
| 65 | Self::CameraShare => w.camera_share, | 68 | Self::CameraShare => w.camera_share, |
| 66 | Self::Appearance => w.appearance, | 69 | Self::Appearance => w.appearance, |
| 70 | + Self::About => w.about, | ||
| 67 | Self::DangerZone => w.danger_zone, | 71 | Self::DangerZone => w.danger_zone, |
| 68 | } | 72 | } |
| 69 | } | 73 | } |
| 70 | } | 74 | } |
| 71 | 75 | ||
| 72 | -pub(super) fn setting_rows() -> [(SettingsSection, &'static str); 25] { | 76 | +pub(super) fn setting_rows() -> [(SettingsSection, &'static str); 28] { |
| 73 | let s = &w().settings_page; | 77 | let s = &w().settings_page; |
| 74 | let v = &w().voice_settings; | 78 | let v = &w().voice_settings; |
| 75 | [ | 79 | [ |
| @@ -98,6 +102,9 @@ pub(super) fn setting_rows() -> [(SettingsSection, &'static str); 25] { | |||
| 98 | (SettingsSection::Appearance, s.launch), | 102 | (SettingsSection::Appearance, s.launch), |
| 99 | (SettingsSection::Appearance, s.clock_seconds), | 103 | (SettingsSection::Appearance, s.clock_seconds), |
| 100 | (SettingsSection::Appearance, s.your_hue), | 104 | (SettingsSection::Appearance, s.your_hue), |
| 105 | + (SettingsSection::About, s.version), | ||
| 106 | + (SettingsSection::About, s.commit), | ||
| 107 | + (SettingsSection::About, s.target), | ||
| 101 | ] | 108 | ] |
| 102 | } | 109 | } |
| 103 | 110 | ||
| @@ -278,6 +285,19 @@ impl Yumush { | |||
| 278 | palette, | 285 | palette, |
| 279 | appearance, | 286 | appearance, |
| 280 | )); | 287 | )); |
| 288 | + sections.push(section( | ||
| 289 | + SettingsSection::About.id(), | ||
| 290 | + SettingsSection::About.label(), | ||
| 291 | + palette, | ||
| 292 | + [ | ||
| 293 | + (w().settings_page.version, crate::VERSION), | ||
| 294 | + (w().settings_page.commit, crate::COMMIT), | ||
| 295 | + (w().settings_page.target, crate::TARGET), | ||
| 296 | + ] | ||
| 297 | + .into_iter() | ||
| 298 | + .map(|(label, value)| row(label, div().text_color(palette.muted).child(value))) | ||
| 299 | + .collect(), | ||
| 300 | + )); | ||
| 281 | if self.user.is_some() { | 301 | if self.user.is_some() { |
| 282 | sections.push(danger( | 302 | sections.push(danger( |
| 283 | SettingsSection::DangerZone.id(), | 303 | SettingsSection::DangerZone.id(), |
crates/client/src/lib.rsmodified+3 -0
| @@ -24,6 +24,9 @@ pub use usage; | |||
| 24 | pub mod voice; | 24 | pub mod voice; |
| 25 | 25 | ||
| 26 | pub const NAME: &str = "Yumush"; | 26 | pub const NAME: &str = "Yumush"; |
| 27 | +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
| 28 | +pub const COMMIT: &str = env!("YUMUSH_COMMIT"); | ||
| 29 | +pub const TARGET: &str = env!("YUMUSH_TARGET"); | ||
| 27 | 30 | ||
| 28 | static EXE: std::sync::LazyLock<Option<PathBuf>> = | 31 | static EXE: std::sync::LazyLock<Option<PathBuf>> = |
| 29 | std::sync::LazyLock::new(|| std::env::current_exe().ok()); | 32 | std::sync::LazyLock::new(|| std::env::current_exe().ok()); |
crates/client/src/main.rsmodified+9 -0
| @@ -18,6 +18,15 @@ use tracing::Level; | |||
| 18 | use tracing_subscriber::{filter::Targets, layer::SubscriberExt, util::SubscriberInitExt}; | 18 | use tracing_subscriber::{filter::Targets, layer::SubscriberExt, util::SubscriberInitExt}; |
| 19 | 19 | ||
| 20 | fn main() { | 20 | fn main() { |
| 21 | + if std::env::args().any(|arg| arg == "--version" || arg == "-V") { | ||
| 22 | + println!( | ||
| 23 | + "yumush {} {} {}", | ||
| 24 | + client::VERSION, | ||
| 25 | + client::COMMIT, | ||
| 26 | + client::TARGET | ||
| 27 | + ); | ||
| 28 | + return; | ||
| 29 | + } | ||
| 21 | tracing_subscriber::registry() | 30 | tracing_subscriber::registry() |
| 22 | .with(tracing_subscriber::fmt::layer()) | 31 | .with(tracing_subscriber::fmt::layer()) |
| 23 | .with( | 32 | .with( |