Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow blank checkout when auth token is unavailable

+14 -4
+14 -4
system/public/aesthetic.computer/disks/blank.mjs
··· 51 51 "https://psref.lenovo.com/Product/Lenovo/Lenovo_ThinkPad_11e_Yoga_Gen_6"; 52 52 const AUTH_TIMEOUT_MS = 1200; 53 53 54 + async function getOptionalToken(api) { 55 + if (!api?.authorize) return null; 56 + 57 + try { 58 + return await Promise.race([ 59 + api.authorize().catch(() => null), 60 + new Promise((resolve) => setTimeout(() => resolve(null), AUTH_TIMEOUT_MS)), 61 + ]); 62 + } catch { 63 + return null; 64 + } 65 + } 66 + 54 67 // Animation 55 68 let frame = 0; 56 69 ··· 129 142 130 143 try { 131 144 const headers = { "Content-Type": "application/json" }; 132 - const token = await Promise.race([ 133 - api?.authorize?.(), 134 - new Promise((resolve) => setTimeout(() => resolve(null), AUTH_TIMEOUT_MS)), 135 - ]); 145 + const token = await getOptionalToken(api); 136 146 if (token) headers.Authorization = `Bearer ${token}`; 137 147 138 148 const res = await fetch("/api/blank?new=true", {