diff --git a/index.html b/index.html
index ba44f03..a7a3045 100644
--- a/index.html
+++ b/index.html
@@ -27,6 +27,7 @@
import createWorker from "https://esm.sh/@supabase/supabase-js?worker";
import { createClient } from "https://esm.sh/@supabase/supabase-js";
+ // Setting up the Supabase Main Thread.
(async () => {
window.sb = createClient(
"https://qmpdruitzlownnnnjmpk.supabase.co",
@@ -54,12 +55,42 @@
refresh_token: session.refresh_token,
},
});
+
+ let retries = 50;
+ while (!window.supabase?.getUser && retries-- > 0) {
+ await new Promise((r) => setTimeout(r, 100));
+ }
+
+ if (window.supabase?.getUser) {
+ console.log("User Found");
+ // const __user = window.supabase.getUser();
+ // __user
+ // .then((resp) => {
+ // if (resp?.data.user) {
+ // console.log(
+ // "[DEBUG]: User object received",
+ // resp.data.user
+ // );
+ // if (window.JSRustResponseHandler) {
+ // window.JSRustResponseHandler(resp);
+ // } else {
+ // console.log("[DEBUG]: No Bindgenie - Huge problem.");
+ // }
+ // } else {
+ // console.log("[DEBUG]: No user in response", resp);
+ // }
+ // })
+ // .catch((err) => {
+ // console.error("[ERROR]: Failed to get user", err);
+ // });
+ } else {
+ console.log("No User Found");
+ }
} else {
console.log("[Main] Worker not found.");
}
- }
- else {
- console.log("[Main] No session found — user is logged out.");
+ } else {
+ console.log("[Main] No session found — user is logged out.");
}
})();
@@ -70,7 +101,7 @@
inject: `
const supabase = $module.createClient(
"https://qmpdruitzlownnnnjmpk.supabase.co",
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFtcGRydWl0emxvd25ubm5qbXBrIiwicm9zZSI6ImFub24iLCJpYXQiOjE3NDk2NjA0NTYsImV4cCI6MjA2NTIzNjQ1Nn0.OhD3qN4dq0TMA65qVGvry_QsZEeLKK7RbwYP3QzAvcY",
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFtcGRydWl0emxvd25ubm5qbXBrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDk2NjA0NTYsImV4cCI6MjA2NTIzNjQ1Nn0.OhD3qN4dq0TMA65qVGvry_QsZEeLKK7RbwYP3QzAvcY",
{
auth: {
detectSessionInUrl: false,
@@ -186,7 +217,7 @@
session: () => sendToWorker("session", {}),
getUser: () => sendToWorker("getUser", {}),
getProfile: (user_id) => sendToWorker("getProfile", { user_id }),
- setSession: () => sendToWorker("setSession", {session}),
+ setSession: () => sendToWorker("setSession", { session }),
worker: supabaseWorker,
};
@@ -379,14 +410,14 @@
>