diff --git a/build.rs b/build.rs index 3408703e..ffc2fdd1 100644 --- a/build.rs +++ b/build.rs @@ -2,21 +2,6 @@ use std::fs; use std::path::Path; fn main() { - // Set BUILD_DATE environment variable for compile-time access - // Use system time to avoid adding chrono as a build dependency - let now = std::time::SystemTime::now(); - let duration = now.duration_since(std::time::UNIX_EPOCH).unwrap(); - let secs = duration.as_secs(); - - // Convert Unix timestamp to date (simplified calculation) - // Days since epoch - let days = secs / 86400; - // Calculate year, month, day from days since 1970-01-01 - let (year, month, day) = days_to_ymd(days as i64); - let build_date = format!("{:04}-{:02}-{:02}", year, month, day); - - println!("cargo:rustc-env=BUILD_DATE={}", build_date); - // Compile protobuf files for RustDesk protocol compile_protos(); @@ -86,19 +71,3 @@ pub mod rustdesk { fs::write(&dest_path, code).expect("Failed to write secrets_generated.rs"); } - -/// Convert days since Unix epoch to year-month-day -fn days_to_ymd(days: i64) -> (i32, u32, u32) { - // Algorithm from http://howardhinnant.github.io/date_algorithms.html - let z = days + 719468; - let era = if z >= 0 { z } else { z - 146096 } / 146097; - let doe = (z - era * 146097) as u32; - let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; - let y = yoe as i64 + era * 400; - let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); - let mp = (5 * doy + 2) / 153; - let d = doy - (153 * mp + 2) / 5 + 1; - let m = if mp < 10 { mp + 3 } else { mp - 9 }; - let year = if m <= 2 { y + 1 } else { y }; - (year as i32, m, d) -} diff --git a/src/web/handlers/system.rs b/src/web/handlers/system.rs index a673d3ae..36f22c78 100644 --- a/src/web/handlers/system.rs +++ b/src/web/handlers/system.rs @@ -18,7 +18,6 @@ pub async fn health_check() -> Json { #[derive(Serialize)] pub struct SystemInfo { pub version: &'static str, - pub build_date: &'static str, pub initialized: bool, pub platform: PlatformCapabilities, pub capabilities: Capabilities, @@ -66,7 +65,6 @@ pub async fn system_info(State(state): State>) -> Json Json(SystemInfo { version: env!("CARGO_PKG_VERSION"), - build_date: env!("BUILD_DATE"), initialized: config.initialized, platform: platform.clone(), capabilities: Capabilities { diff --git a/web/src/api/index.ts b/web/src/api/index.ts index 84c467cd..6297e7cc 100644 --- a/web/src/api/index.ts +++ b/web/src/api/index.ts @@ -86,7 +86,6 @@ export const systemApi = { info: () => request<{ version: string - build_date: string initialized: boolean platform: PlatformCapabilities capabilities: { diff --git a/web/src/i18n/en-US.ts b/web/src/i18n/en-US.ts index e0e39e1a..ee840c19 100644 --- a/web/src/i18n/en-US.ts +++ b/web/src/i18n/en-US.ts @@ -548,7 +548,6 @@ export default { usernameDesc: 'Change the console login username', passwordDesc: 'Change the console login password', version: 'Version', - buildInfo: 'Build Info', detectDevices: 'Detect Devices', detecting: 'Detecting...', networkSettings: 'Network Settings', diff --git a/web/src/i18n/zh-CN.ts b/web/src/i18n/zh-CN.ts index 3b268030..c6f98b60 100644 --- a/web/src/i18n/zh-CN.ts +++ b/web/src/i18n/zh-CN.ts @@ -547,7 +547,6 @@ export default { usernameDesc: '修改控制台登录用户名', passwordDesc: '修改控制台登录密码', version: '版本', - buildInfo: '构建信息', detectDevices: '探测设备', detecting: '探测中...', networkSettings: '网络设置', diff --git a/web/src/stores/system.ts b/web/src/stores/system.ts index 85a0b4fc..f6953747 100644 --- a/web/src/stores/system.ts +++ b/web/src/stores/system.ts @@ -150,7 +150,6 @@ export interface DeviceInfoEvent { export const useSystemStore = defineStore('system', () => { const version = ref('') - const buildDate = ref('') const platform = ref(null) const capabilities = ref(null) const diskSpace = ref(null) @@ -173,7 +172,6 @@ export const useSystemStore = defineStore('system', () => { try { const info = await systemApi.info() version.value = info.version - buildDate.value = info.build_date platform.value = info.platform capabilities.value = info.capabilities diskSpace.value = info.disk_space ?? null @@ -429,7 +427,6 @@ export const useSystemStore = defineStore('system', () => { return { version, - buildDate, platform, capabilities, diskSpace, diff --git a/web/src/views/SettingsView.vue b/web/src/views/SettingsView.vue index 7187434d..5e74f80d 100644 --- a/web/src/views/SettingsView.vue +++ b/web/src/views/SettingsView.vue @@ -5221,7 +5221,6 @@ watch(isWindows, () => { {{ updateOverview?.current_version || systemStore.version || t('common.unknown') }} - ({{ systemStore.buildDate || t('common.unknown') }})