From dd49907c8d3202f94179b779f683206317395b5f Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sun, 7 Dec 2025 00:15:56 +0000 Subject: [PATCH] Moved remote-link links to same location with reset links, avoiding vite routing issue. Realtime lookup of session when three words have been entered. --- frontend/auth/restricted/RestrictedApi.vue | 11 +- frontend/src/components/PairingCodeEntry.vue | 159 +++++++++++++++++-- paskia/fastapi/api.py | 65 +++++++- paskia/fastapi/mainapp.py | 32 ++-- paskia/fastapi/ws.py | 4 +- paskia/remoteauth.py | 57 ++++--- paskia/util/passphrase.py | 5 + 7 files changed, 280 insertions(+), 53 deletions(-) diff --git a/frontend/auth/restricted/RestrictedApi.vue b/frontend/auth/restricted/RestrictedApi.vue index e3eeeb3..2e2bf46 100644 --- a/frontend/auth/restricted/RestrictedApi.vue +++ b/frontend/auth/restricted/RestrictedApi.vue @@ -20,16 +20,19 @@ import { computed, onMounted, ref } from 'vue' import RestrictedAuth from '@/components/RestrictedAuth.vue' import RemoteAuthComplete from '@/components/RemoteAuthComplete.vue' -// Check if this is a remote auth URL: /remote/{token} or /auth/remote/{token} +// Check if this is a remote auth URL: /{token} or /auth/{token} +// The token is a 5-word passphrase like "word1.word2.word3.word4.word5" const remoteAuthToken = ref(null) function extractRemoteToken() { const path = window.location.pathname - const match = path.match(/\/(?:auth\/)?remote\/([^/]+)$/) + // Match /{token} or /auth/{token} where token is a passphrase with dots + const match = path.match(/\/(?:auth\/)?([^/]+)$/) if (match) { const token = match[1] - // Validate it looks like a passphrase (contains dots) - if (token.includes('.')) { + // Validate it looks like a passphrase (contains dots, likely 5 words) + const parts = token.split('.') + if (parts.length === 5 && parts.every(p => p.length > 0)) { return token } } diff --git a/frontend/src/components/PairingCodeEntry.vue b/frontend/src/components/PairingCodeEntry.vue index 54b8116..0ffb3b4 100644 --- a/frontend/src/components/PairingCodeEntry.vue +++ b/frontend/src/components/PairingCodeEntry.vue @@ -12,21 +12,44 @@ v-model="code" type="text" :placeholder="placeholder" - :disabled="loading" + :disabled="loading || completed" autocomplete="off" autocapitalize="characters" spellcheck="false" class="pairing-input" @input="handleInput" /> + + + +
+ + Looking up device… +
+ + +
+

📱 Device requesting login:

+
+
+ Site: + {{ deviceInfo.host }} +
+
+ Browser: + {{ deviceInfo.user_agent_pretty }} +
+
+

{{ error }}

@@ -38,15 +61,16 @@