diff --git a/Cargo.toml b/Cargo.toml index 689e1a989..836bd07d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,7 @@ rdev = { git = "https://github.com/asur4s/rdev" } url = { version = "2.1", features = ["serde"] } reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls"], default-features=false } +chrono = "0.4.23" [target.'cfg(not(any(target_os = "android", target_os = "linux")))'.dependencies] cpal = "0.13.5" diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 009b784ad..b4c69a6a6 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -1029,10 +1029,12 @@ class _AboutState extends State<_About> { return _futureBuilder(future: () async { final license = await bind.mainGetLicense(); final version = await bind.mainGetVersion(); - return {'license': license, 'version': version}; + final buildDate = await bind.mainGetBuildDate(); + return {'license': license, 'version': version, 'buildDate': buildDate}; }(), hasData: (data) { final license = data['license'].toString(); final version = data['version'].toString(); + final buildDate = data['buildDate'].toString(); const linkStyle = TextStyle(decoration: TextDecoration.underline); final scrollController = ScrollController(); return DesktopScrollWrapper( @@ -1048,6 +1050,7 @@ class _AboutState extends State<_About> { height: 8.0, ), Text('Version: $version').marginSymmetric(vertical: 4.0), + Text('Build Date: $buildDate').marginSymmetric(vertical: 4.0), InkWell( onTap: () { launchUrlString('https://rustdesk.com/privacy'); diff --git a/libs/hbb_common/src/lib.rs b/libs/hbb_common/src/lib.rs index 02acfd9ff..ae564685f 100644 --- a/libs/hbb_common/src/lib.rs +++ b/libs/hbb_common/src/lib.rs @@ -161,19 +161,23 @@ pub fn get_version_from_url(url: &str) -> String { } pub fn gen_version() { + use std::io::prelude::*; let mut file = File::create("./src/version.rs").unwrap(); for line in read_lines("Cargo.toml").unwrap() { if let Ok(line) = line { let ab: Vec<&str> = line.split("=").map(|x| x.trim()).collect(); if ab.len() == 2 && ab[0] == "version" { - use std::io::prelude::*; - file.write_all(format!("pub const VERSION: &str = {};", ab[1]).as_bytes()) + file.write_all(format!("pub const VERSION: &str = {};\n", ab[1]).as_bytes()) .ok(); - file.sync_all().ok(); break; } } } + // generate build date + let build_date = format!("{}", chrono::Local::now().format("%Y-%m-%d %H:%M")); + file.write_all(format!("pub const BUILD_DATE: &str = \"{}\";", build_date).as_bytes()) + .ok(); + file.sync_all().ok(); } fn read_lines
(filename: P) -> io::Result