ba-cafe

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b1f851364b5b78bc7f37027b6f1b0b7cd655ffc3
parent 0bf44ab297780698ec331655d9f4b0bbc4d8f246
Author: Sunny <122193933+Sunny-JP@users.noreply.github.com>
Date:   Fri, 30 Jan 2026 02:17:35 +0900

Merge pull request #36 from Sunny-JP/v4-sunny-dev

update
Diffstat:
Msrc/app/page.tsx | 20++++++++++++++++----
Msrc/app/providers.tsx | 11+++++++++++
2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/app/page.tsx b/src/app/page.tsx @@ -69,7 +69,7 @@ export default function Home() { if (!user) return; try { - if (typeof window !== 'undefined' && OneSignal.Notifications) { + if (typeof window !== 'undefined' && OneSignal.User) { await OneSignal.login(user.id); } } catch (e) { @@ -112,10 +112,19 @@ export default function Home() { try { const { data: { session } } = await supabase.auth.getSession(); - const isPushEnabled = OneSignal.User.PushSubscription.optedIn; - const onesignalId = OneSignal.User.PushSubscription.id; + let isPushEnabled = undefined; + let onesignalId = undefined; - await fetch('/api/tap', { + try { + if (typeof window !== 'undefined' && OneSignal.User?.PushSubscription) { + isPushEnabled = OneSignal.User.PushSubscription.optedIn; + onesignalId = OneSignal.User.PushSubscription.id; + } + } catch (osError) { + console.warn("OneSignal state access failed, proceeding with sync:", osError); + } + + const res = await fetch('/api/tap', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -129,6 +138,9 @@ export default function Home() { ticket2Time: t2ISO }) }); + + if (!res.ok) throw new Error("Server sync failed"); + } catch (error) { console.error("Sync failed", error); } finally { diff --git a/src/app/providers.tsx b/src/app/providers.tsx @@ -6,6 +6,17 @@ import { useEffect } from "react"; export default function Providers({ children }: { children: React.ReactNode }) { useEffect(() => { + const Message = ` + ____ __ _____ _ + / ___|__ _ / _| ___|_ _(_)_ __ ___ ___ _ __ + | | / _\` || |_ / _ \\ | | | | '_ \` _ \\ / _ \\ '__| + | |__| (_| || _| __/ | | | | | | | | | __/ | + \\____\\__,_||_| \\___| |_| |_|_| |_| |_|\\___|_| + + >> Welcome, Sensei. + >> I've been waiting for your next order.`; + console.log("%c" + Message, "color: #7ad3ff; font-weight: bold; font-family: monospace;"); + const setSvh = () => { document.documentElement.style.setProperty('--svh', `${window.innerHeight}px`); };