From 3ec4f3386a3e2bbf5a2c4bddc80bf28d789b9705 Mon Sep 17 00:00:00 2001 From: Leafd Date: Fri, 10 Oct 2025 16:51:44 -0400 Subject: [PATCH] fix: add manual oauth link copy for linux --- src-tauri/src/lib.rs | 6 ++++++ src/App.vue | 13 ++++++++++++ src/views/Login.vue | 47 ++++++++++++++++++++++++++++++++++++++------ 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 5acbfaa..9e2e6a4 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -36,6 +36,11 @@ fn get_app_version(app: tauri::AppHandle) -> String { app.package_info().version.to_string() } +#[tauri::command] +fn get_current_os() -> String { + std::env::consts::OS.to_string() +} + #[derive(Clone, serde::Serialize)] struct LogEntry { ts: i64, @@ -112,6 +117,7 @@ pub fn run() { .invoke_handler(tauri::generate_handler![ greet, get_app_version, + get_current_os, get_recent_logs, database::get_platform_info, diff --git a/src/App.vue b/src/App.vue index 9c06717..a3d9172 100644 --- a/src/App.vue +++ b/src/App.vue @@ -84,6 +84,7 @@ const presenceFetchInProgress = ref(false); const oauthUrl = ref(null); const nextPresenceFetchAllowedAt = ref(0); const lastPresenceFetchAt = ref(0); +const currentOs = ref(null); const currentPage = ref<'home' | 'projects' | 'statistics' | 'settings'>('home'); @@ -131,6 +132,7 @@ onMounted(async () => { await loadAuthState(); await loadApiConfig(); await loadHackatimeInfo(); + await loadCurrentOs(); try { const appVersion = await invoke("get_app_version") as string; @@ -333,6 +335,16 @@ async function loadHackatimeInfo() { } } +async function loadCurrentOs() { + try { + currentOs.value = await invoke("get_current_os") as string; + console.log("Current OS detected:", currentOs.value); + } catch (error) { + console.error("Failed to detect current OS:", error); + currentOs.value = null; + } +} + async function loadPresenceData() { if (presenceFetchInProgress.value) { return; @@ -574,6 +586,7 @@ async function handleInstallNow() { :isLoading="isLoading" :isDevMode="isDevMode" :oauthUrl="oauthUrl" + :currentOs="currentOs" @authenticate="authenticate" @handleDirectOAuthAuth="handleDirectOAuthAuth" @openOAuthUrlManually="openOAuthUrlManually" diff --git a/src/views/Login.vue b/src/views/Login.vue index 029db93..6a986de 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -83,6 +83,28 @@ + +
+

+ Linux: Copy the link to open in your browser manually +

+
+ + +
+
+