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

View File

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

View File

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

View File

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

View File

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

View File

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