mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-07-29 05:41:46 +08:00
del: 删除构建日期设定
This commit is contained in:
31
build.rs
31
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)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ pub async fn health_check() -> Json<HealthResponse> {
|
||||
#[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<Arc<AppState>>) -> Json<SystemInfo>
|
||||
|
||||
Json(SystemInfo {
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
build_date: env!("BUILD_DATE"),
|
||||
initialized: config.initialized,
|
||||
platform: platform.clone(),
|
||||
capabilities: Capabilities {
|
||||
|
||||
@@ -86,7 +86,6 @@ export const systemApi = {
|
||||
info: () =>
|
||||
request<{
|
||||
version: string
|
||||
build_date: string
|
||||
initialized: boolean
|
||||
platform: PlatformCapabilities
|
||||
capabilities: {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -547,7 +547,6 @@ export default {
|
||||
usernameDesc: '修改控制台登录用户名',
|
||||
passwordDesc: '修改控制台登录密码',
|
||||
version: '版本',
|
||||
buildInfo: '构建信息',
|
||||
detectDevices: '探测设备',
|
||||
detecting: '探测中...',
|
||||
networkSettings: '网络设置',
|
||||
|
||||
@@ -150,7 +150,6 @@ export interface DeviceInfoEvent {
|
||||
|
||||
export const useSystemStore = defineStore('system', () => {
|
||||
const version = ref<string>('')
|
||||
const buildDate = ref<string>('')
|
||||
const platform = ref<PlatformCapabilities | null>(null)
|
||||
const capabilities = ref<SystemCapabilities | null>(null)
|
||||
const diskSpace = ref<DiskSpaceInfo | null>(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,
|
||||
|
||||
@@ -5221,7 +5221,6 @@ watch(isWindows, () => {
|
||||
<Label>{{ t('settings.currentVersion') }}</Label>
|
||||
<Badge variant="outline">
|
||||
{{ updateOverview?.current_version || systemStore.version || t('common.unknown') }}
|
||||
({{ systemStore.buildDate || t('common.unknown') }})
|
||||
</Badge>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
|
||||
Reference in New Issue
Block a user