diff --git a/astro.config.mjs b/astro.config.mjs
index 4074c5f..2923051 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -8,5 +8,10 @@ export default defineConfig({
}),
security: {
checkOrigin: true,
+ },
+ vite: {
+ server: {
+ hmr: false
+ }
}
})
\ No newline at end of file
diff --git a/src/components/Header.astro b/src/components/Header.astro
index 24c6a78..3af716c 100644
--- a/src/components/Header.astro
+++ b/src/components/Header.astro
@@ -1,6 +1,8 @@
---
if (Astro.cookies.get('sb-access-token') && Astro.cookies.get('sb-refresh-token')) {
var IsLoggedIn = true
+} else if (Astro.cookies.get('anonymous-session')) {
+ var IsLoggedIn = true
} else {
var IsLoggedIn = false
}
@@ -17,15 +19,15 @@ const beta = user?.user_metadata.beta
-
-
-
-
-
-
-
-
+
+
+
+
+
+
{displayName}
+
{email}
+
+
+
+
+
+
+
-
-
-
- {MessageCheckEmail ?
Check your email
: null}
- {MessageAvatarUpdated ?
Your avatar has been updated
: null}
- {MessageNameUpdated ?
Your display name has been updated
: null}
- {MessageEmailConfirmed ?
Email confirmed
: null}
- {MessagePasswordReset ?
Your new password has been updated
: null}
-
-
Your Account
-
Plan: {user_plan}
-
Display Name: {displayName}
-
Email: {email}
-
-
ID: {id}
-
Created at: {createDate}
-
Lasted login: {lastSignInDate}
-
-
-
Preferences
-
Theme: {user_theme}
-
Color Scheme: {user_color_scheme}
- {user_beta ?
-
- :
-
- }
-
-
-
-
-
-
-
-
Do you want to delete your accout?
-
-
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/pages/account/old.astro b/src/pages/account/old.astro
new file mode 100644
index 0000000..fe1adb2
--- /dev/null
+++ b/src/pages/account/old.astro
@@ -0,0 +1,146 @@
+---
+import Base from "@layouts/Base.astro"
+
+// Messages
+if (Astro.url.href.endsWith('CheckEmail')) {var MessageCheckEmail = true}
+else {var MessageCheckEmail = false}
+
+if (Astro.url.href.endsWith('AvatarUpdated')) {var MessageAvatarUpdated = true}
+else {var MessageAvatarUpdated = false}
+
+if (Astro.url.href.endsWith('NameUpdated')) {var MessageNameUpdated = true}
+else {var MessageNameUpdated = false}
+
+if (Astro.url.href.endsWith('EmailConfirmed')) {var MessageEmailConfirmed = true}
+else {var MessageEmailConfirmed = false}
+
+if (Astro.url.href.endsWith('PasswordReset')) {var MessagePasswordReset = true}
+else {var MessagePasswordReset = false}
+
+// Supabase Data
+import { supabase } from "@library/supabase"
+const { data: { user } } = await supabase.auth.getUser()
+const avatarUrl = user?.user_metadata.avatar_url
+const displayName = user?.user_metadata.full_name
+const email = user?.email
+const id = user?.id
+
+// Get User Preferences
+const user_plan = user?.user_metadata.plan
+const user_theme = user?.user_metadata.theme
+const user_color_scheme = user?.user_metadata.color_scheme
+const user_beta = user?.user_metadata.beta
+
+// Date - Readable Format (MONTH DAY, YEAR at #:##:## AM/PM / December 9, 2023 at 5:12:43 PM)
+const dateFormat = { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }
+
+/// Created Date
+const createdDate = new Date(user?.created_at)
+const createDate = createdDate.toLocaleDateString('en-US', dateFormat)
+
+/// Last Logged In
+const lastSignIn = new Date(user?.last_sign_in_at)
+const lastSignInDate = lastSignIn.toLocaleDateString('en-US', dateFormat)
+---
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {MessageCheckEmail ?
Check your email
: null}
+ {MessageAvatarUpdated ?
Your avatar has been updated
: null}
+ {MessageNameUpdated ?
Your display name has been updated
: null}
+ {MessageEmailConfirmed ?
Email confirmed
: null}
+ {MessagePasswordReset ?
Your new password has been updated
: null}
+
+
Your Account
+
Plan: {user_plan}
+
Display Name: {displayName}
+
Email: {email}
+
+
ID: {id}
+
Created at: {createDate}
+
Lasted login: {lastSignInDate}
+
+
+
Preferences
+
Theme: {user_theme}
+
Color Scheme: {user_color_scheme}
+ {user_beta ?
+
+ :
+
+ }
+
+
+
+
+
+
+
+
Do you want to delete your accout?
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/account/preferences.astro b/src/pages/account/preferences.astro
new file mode 100644
index 0000000..b3fc3af
--- /dev/null
+++ b/src/pages/account/preferences.astro
@@ -0,0 +1,74 @@
+---
+import QuickForm from "@components/QuickForm.astro"
+import QuickFormButton from "@components/QuickFormButton.astro"
+import Settings from "@layouts/Settings.astro"
+
+// Supabase Data
+import { supabase } from "@library/supabase"
+const { data: { user } } = await supabase.auth.getUser()
+const avatarUrl = user?.user_metadata.avatar_url
+const displayName = user?.user_metadata.full_name
+const email = user?.email
+const id = user?.id
+
+// Get User Preferences
+const user_plan = user?.user_metadata.plan
+const user_theme = user?.user_metadata.theme
+const user_color_scheme = user?.user_metadata.color_scheme
+const user_beta = user?.user_metadata.beta
+---
+
+
+ Preferences
+
+ Theme
+ Current Theme: {user_theme}
+
+
+
+
+ Color Scheme
+ Current Scheme: {user_color_scheme}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/api/account/preference/beta-off.ts b/src/pages/api/account/preference/beta-off.ts
index 0587f68..f09b0f3 100644
--- a/src/pages/api/account/preference/beta-off.ts
+++ b/src/pages/api/account/preference/beta-off.ts
@@ -14,5 +14,5 @@ export const POST: APIRoute = async ({ redirect }) => {
return new Response(error.message, { status: 500 })
}
- return redirect("/account")
+ return redirect("/account/beta")
}
diff --git a/src/pages/api/account/preference/beta-on.ts b/src/pages/api/account/preference/beta-on.ts
index d60725d..afe122c 100644
--- a/src/pages/api/account/preference/beta-on.ts
+++ b/src/pages/api/account/preference/beta-on.ts
@@ -14,5 +14,5 @@ export const POST: APIRoute = async ({ redirect }) => {
return new Response(error.message, { status: 500 })
}
- return redirect("/account")
+ return redirect("/account/beta")
}
diff --git a/src/pages/api/auth/anon.ts b/src/pages/api/auth/anon.ts
new file mode 100644
index 0000000..4c52635
--- /dev/null
+++ b/src/pages/api/auth/anon.ts
@@ -0,0 +1,29 @@
+import type { APIRoute } from "astro"
+import { supabase } from "@library/supabase"
+
+export const GET: APIRoute = async ({ cookies, request, redirect }) => {
+ const { error } = await supabase.auth.signInAnonymously({
+ options: {
+ data: {
+ full_name: 'Anonymous',
+ avatar_url: 'https://img.sudovanilla.org/MAuSBXN.png',
+ plan: "Free",
+ theme: "Dark",
+ color_scheme: "Purple",
+ beta: false,
+ }
+ },
+ })
+
+ if (error) {
+ return new Response(error.message, { status: 500 })
+ }
+
+ cookies.set("anonymous-session", 'true', {
+ path: "/",
+ secure: true,
+ httpOnly: true,
+ })
+
+ return redirect("/?=anonymous")
+}
diff --git a/src/pages/api/auth/signout.ts b/src/pages/api/auth/signout.ts
index a8583a4..5ba4355 100644
--- a/src/pages/api/auth/signout.ts
+++ b/src/pages/api/auth/signout.ts
@@ -1,7 +1,10 @@
import type { APIRoute } from "astro"
+import { supabase } from "@library/supabase"
+import type { Provider } from "@supabase/supabase-js"
export const GET: APIRoute = async ({ cookies, redirect }) => {
cookies.delete("sb-access-token", { path: "/" })
cookies.delete("sb-refresh-token", { path: "/" })
+ const { error } = await supabase.auth.signOut()
return redirect("/signin")
}
\ No newline at end of file
diff --git a/src/pages/index.astro b/src/pages/index.astro
index d0b5941..c3a6231 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -46,10 +46,21 @@ console.log(subs)
Channels
{channels.map((channel) =>
-
{channel.creator}
+
{channel.creator}
)}
{subs.map((data) =>
{data.Id} | Unsubscribe
)}
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/pages/register.astro b/src/pages/register.astro
index 0d7596b..f56c0ae 100644
--- a/src/pages/register.astro
+++ b/src/pages/register.astro
@@ -5,7 +5,7 @@ import Base from "@layouts/Base.astro"
Register for Supabase Demo
Already have an account? Sign In.
-
-
-
- Or with
-
+
+
+
+
Or with
+
+
+
\ No newline at end of file
diff --git a/src/pages/signin.astro b/src/pages/signin.astro
index 8bd682e..cb79de4 100644
--- a/src/pages/signin.astro
+++ b/src/pages/signin.astro
@@ -5,7 +5,7 @@ import Base from "@layouts/Base.astro"
Sign In
Don't have an account? Sign Up.
-