small fix

This commit is contained in:
Ludwig Lehnert 2025-06-13 09:17:31 +02:00
parent 7223ea0757
commit 15d054f090
Signed by: ludwig
SSH Key Fingerprint: SHA256:4vshH9GJ8TLO1RS2fY6rDDLnq7+KVvSClCY+uEhYYRA
6 changed files with 10 additions and 8 deletions

View File

@ -1,7 +1,7 @@
import { decodeKeyVault, deriveKeyVault, encodeKeyVault, type KeyVault } from "./crypto";
export function loggedIn() {
if (typeof window === 'undefined') return false;
if (typeof window !== 'object') return false;
return !!sessionStorage['_vault'];
}

View File

@ -7,7 +7,7 @@
let videoSrc = $state<string | null>(null);
onMount(() => {
if (!window) return;
if (typeof window !== 'object') return;
if (!loggedIn()) {
window.location.href = '/login';

View File

@ -12,7 +12,7 @@
};
onMount(() => {
if (!window) return;
if (typeof window !== 'object') return;
if (loggedIn()) {
window.location.href = '/today';

View File

@ -3,7 +3,7 @@
import { onMount } from "svelte";
onMount(() => {
if (!window) return;
if (typeof window !== 'object') return;
if (!loggedIn()) {
window.location.href = '/login';

View File

@ -18,7 +18,7 @@
let recorder: MediaRecorder | null = null;
onMount(() => {
if (!window) return;
if (typeof window !== 'object') return;
if (!loggedIn()) {
window.location.href = '/login';
@ -27,7 +27,7 @@
onMount(() => {
if (!window) return;
if (typeof window !== 'object') return;
const interval = setInterval(() => {
now = new Date();
@ -37,7 +37,9 @@
});
onMount(async () => {
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
if (typeof window !== 'object') return;
if (!navigator || !navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
return;
}

View File

@ -3,7 +3,7 @@
import { onMount } from "svelte";
onMount(() => {
if (!window) return;
if (typeof window !== 'object') return;
console.log('test', loggedIn());