forge
Explore
Log in

Don't you dare go Hollow

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 commit

5406fd6c0154c3cfcf8cf867fb50de9f6da693aeAhmet Kaan GümüşParent: 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
Show full message
✨ 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
.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() {
387387 _ => format!("{arch}-{os}"),
388388 };
389389 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());
390410 }
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
2929 share_audio = Share audio
3030 back_esc = Back (esc)
3131 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
2929 share_audio = Sesi paylaş
3030 back_esc = Geri (esc)
3131 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 {
3535 Voice,
3636 CameraShare,
3737 Appearance,
38+ About,
3839 DangerZone,
3940 }
4041
4142 impl SettingsSection {
42- pub(super) const ALL: [Self; 5] = [
43+ pub(super) const ALL: [Self; 6] = [
4344 Self::Profile,
4445 Self::Voice,
4546 Self::CameraShare,
4647 Self::Appearance,
48+ Self::About,
4749 Self::DangerZone,
4850 ];
4951
@@ -53,6 +55,7 @@ impl SettingsSection {
5355 Self::Voice => "voice",
5456 Self::CameraShare => "camera_share",
5557 Self::Appearance => "appearance",
58+ Self::About => "about",
5659 Self::DangerZone => "danger_zone",
5760 }
5861 }
@@ -64,12 +67,13 @@ impl SettingsSection {
6467 Self::Voice => w.voice,
6568 Self::CameraShare => w.camera_share,
6669 Self::Appearance => w.appearance,
70+ Self::About => w.about,
6771 Self::DangerZone => w.danger_zone,
6872 }
6973 }
7074 }
7175
72-pub(super) fn setting_rows() -> [(SettingsSection, &'static str); 25] {
76+pub(super) fn setting_rows() -> [(SettingsSection, &'static str); 28] {
7377 let s = &w().settings_page;
7478 let v = &w().voice_settings;
7579 [
@@ -98,6 +102,9 @@ pub(super) fn setting_rows() -> [(SettingsSection, &'static str); 25] {
98102 (SettingsSection::Appearance, s.launch),
99103 (SettingsSection::Appearance, s.clock_seconds),
100104 (SettingsSection::Appearance, s.your_hue),
105+ (SettingsSection::About, s.version),
106+ (SettingsSection::About, s.commit),
107+ (SettingsSection::About, s.target),
101108 ]
102109 }
103110
@@ -278,6 +285,19 @@ impl Yumush {
278285 palette,
279286 appearance,
280287 ));
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+ ));
281301 if self.user.is_some() {
282302 sections.push(danger(
283303 SettingsSection::DangerZone.id(),
crates/client/src/lib.rsmodified+3 -0
@@ -24,6 +24,9 @@ pub use usage;
2424 pub mod voice;
2525
2626 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");
2730
2831 static EXE: std::sync::LazyLock<Option<PathBuf>> =
2932 std::sync::LazyLock::new(|| std::env::current_exe().ok());
crates/client/src/main.rsmodified+9 -0
@@ -18,6 +18,15 @@ use tracing::Level;
1818 use tracing_subscriber::{filter::Targets, layer::SubscriberExt, util::SubscriberInitExt};
1919
2020 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+ }
2130 tracing_subscriber::registry()
2231 .with(tracing_subscriber::fmt::layer())
2332 .with(