mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-07-29 07:31:45 +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;
|
use std::path::Path;
|
||||||
|
|
||||||
fn main() {
|
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 protobuf files for RustDesk protocol
|
||||||
compile_protos();
|
compile_protos();
|
||||||
|
|
||||||
@@ -86,19 +71,3 @@ pub mod rustdesk {
|
|||||||
|
|
||||||
fs::write(&dest_path, code).expect("Failed to write secrets_generated.rs");
|
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)]
|
#[derive(Serialize)]
|
||||||
pub struct SystemInfo {
|
pub struct SystemInfo {
|
||||||
pub version: &'static str,
|
pub version: &'static str,
|
||||||
pub build_date: &'static str,
|
|
||||||
pub initialized: bool,
|
pub initialized: bool,
|
||||||
pub platform: PlatformCapabilities,
|
pub platform: PlatformCapabilities,
|
||||||
pub capabilities: Capabilities,
|
pub capabilities: Capabilities,
|
||||||
@@ -66,7 +65,6 @@ pub async fn system_info(State(state): State<Arc<AppState>>) -> Json<SystemInfo>
|
|||||||
|
|
||||||
Json(SystemInfo {
|
Json(SystemInfo {
|
||||||
version: env!("CARGO_PKG_VERSION"),
|
version: env!("CARGO_PKG_VERSION"),
|
||||||
build_date: env!("BUILD_DATE"),
|
|
||||||
initialized: config.initialized,
|
initialized: config.initialized,
|
||||||
platform: platform.clone(),
|
platform: platform.clone(),
|
||||||
capabilities: Capabilities {
|
capabilities: Capabilities {
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ export const systemApi = {
|
|||||||
info: () =>
|
info: () =>
|
||||||
request<{
|
request<{
|
||||||
version: string
|
version: string
|
||||||
build_date: string
|
|
||||||
initialized: boolean
|
initialized: boolean
|
||||||
platform: PlatformCapabilities
|
platform: PlatformCapabilities
|
||||||
capabilities: {
|
capabilities: {
|
||||||
|
|||||||
@@ -548,7 +548,6 @@ export default {
|
|||||||
usernameDesc: 'Change the console login username',
|
usernameDesc: 'Change the console login username',
|
||||||
passwordDesc: 'Change the console login password',
|
passwordDesc: 'Change the console login password',
|
||||||
version: 'Version',
|
version: 'Version',
|
||||||
buildInfo: 'Build Info',
|
|
||||||
detectDevices: 'Detect Devices',
|
detectDevices: 'Detect Devices',
|
||||||
detecting: 'Detecting...',
|
detecting: 'Detecting...',
|
||||||
networkSettings: 'Network Settings',
|
networkSettings: 'Network Settings',
|
||||||
|
|||||||
@@ -547,7 +547,6 @@ export default {
|
|||||||
usernameDesc: '修改控制台登录用户名',
|
usernameDesc: '修改控制台登录用户名',
|
||||||
passwordDesc: '修改控制台登录密码',
|
passwordDesc: '修改控制台登录密码',
|
||||||
version: '版本',
|
version: '版本',
|
||||||
buildInfo: '构建信息',
|
|
||||||
detectDevices: '探测设备',
|
detectDevices: '探测设备',
|
||||||
detecting: '探测中...',
|
detecting: '探测中...',
|
||||||
networkSettings: '网络设置',
|
networkSettings: '网络设置',
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ export interface DeviceInfoEvent {
|
|||||||
|
|
||||||
export const useSystemStore = defineStore('system', () => {
|
export const useSystemStore = defineStore('system', () => {
|
||||||
const version = ref<string>('')
|
const version = ref<string>('')
|
||||||
const buildDate = ref<string>('')
|
|
||||||
const platform = ref<PlatformCapabilities | null>(null)
|
const platform = ref<PlatformCapabilities | null>(null)
|
||||||
const capabilities = ref<SystemCapabilities | null>(null)
|
const capabilities = ref<SystemCapabilities | null>(null)
|
||||||
const diskSpace = ref<DiskSpaceInfo | null>(null)
|
const diskSpace = ref<DiskSpaceInfo | null>(null)
|
||||||
@@ -173,7 +172,6 @@ export const useSystemStore = defineStore('system', () => {
|
|||||||
try {
|
try {
|
||||||
const info = await systemApi.info()
|
const info = await systemApi.info()
|
||||||
version.value = info.version
|
version.value = info.version
|
||||||
buildDate.value = info.build_date
|
|
||||||
platform.value = info.platform
|
platform.value = info.platform
|
||||||
capabilities.value = info.capabilities
|
capabilities.value = info.capabilities
|
||||||
diskSpace.value = info.disk_space ?? null
|
diskSpace.value = info.disk_space ?? null
|
||||||
@@ -429,7 +427,6 @@ export const useSystemStore = defineStore('system', () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
version,
|
version,
|
||||||
buildDate,
|
|
||||||
platform,
|
platform,
|
||||||
capabilities,
|
capabilities,
|
||||||
diskSpace,
|
diskSpace,
|
||||||
|
|||||||
@@ -5221,7 +5221,6 @@ watch(isWindows, () => {
|
|||||||
<Label>{{ t('settings.currentVersion') }}</Label>
|
<Label>{{ t('settings.currentVersion') }}</Label>
|
||||||
<Badge variant="outline">
|
<Badge variant="outline">
|
||||||
{{ updateOverview?.current_version || systemStore.version || t('common.unknown') }}
|
{{ updateOverview?.current_version || systemStore.version || t('common.unknown') }}
|
||||||
({{ systemStore.buildDate || t('common.unknown') }})
|
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user