From a58fc682358e2c8161b5967aa162b48c5c7ed8dd Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Tue, 26 Nov 2024 16:39:49 -0800 Subject: [PATCH] Add burrow support --- .env | 1 + src/app/components/AppContainer.svelte | 11 +- src/app/components/InfoKeys.svelte | 45 +++++--- src/app/components/LogIn.svelte | 26 ++++- src/app/components/LogInBurrow.svelte | 124 +++++++++++++++++++++++ src/app/components/ProfileEject.svelte | 1 + src/app/components/SignUp.svelte | 105 ++++++++++++++----- src/app/components/SignUpConfirm.svelte | 53 ++++++++++ src/app/components/SignUpSuccess.svelte | 18 ++++ src/app/components/Toast.svelte | 2 +- src/app/modal.ts | 4 +- src/app/state.ts | 2 + src/lib/components/FieldInline.svelte | 12 +-- src/lib/components/Spinner.svelte | 2 +- src/routes/confirm-email/+page.svelte | 1 + src/routes/settings/profile/+page.svelte | 23 ++++- 16 files changed, 375 insertions(+), 55 deletions(-) create mode 100644 src/app/components/LogInBurrow.svelte create mode 100644 src/app/components/ProfileEject.svelte create mode 100644 src/app/components/SignUpConfirm.svelte create mode 100644 src/app/components/SignUpSuccess.svelte create mode 100644 src/routes/confirm-email/+page.svelte diff --git a/.env b/.env index 9f8c96e..9be3d8a 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ VITE_DEFAULT_PUBKEYS=fe7f6bc6f7338b76bbf80db402ade65953e20b2f23e66e898204b63cc42539a3,391819e2f2f13b90cac7209419eb574ef7c0d1f4e81867fc24c47a3ce5e8a248,84dee6e676e5bb67b4ad4e042cf70cbd8681155db535942fcc6a0533858a7240,dace63b00c42e6e017d00dd190a9328386002ff597b841eb5ef91de4f1ce8491,82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2,58c741aa630c2da35a56a77c1d05381908bd10504fdd2d8b43f725efa6d23196,eeb11961b25442b16389fe6c7ebea9adf0ac36dd596816ea7119e521b8821b9e,b676ded7c768d66a757aa3967b1243d90bf57afb09d1044d3219d8d424e4aea0,61066504617ee79387021e18c89fb79d1ddbc3e7bff19cf2298f40466f8715e9,3f770d65d3a764a9c5cb503ae123e62ec7598ad035d836e2a810f3877a745b24,6389be6491e7b693e9f368ece88fcd145f07c068d2c1bbae4247b9b5ef439d32,97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322 +VITE_BURROW_URL= VITE_PLATFORM_URL=https://flotilla.social VITE_PLATFORM_NAME=Flotilla VITE_PLATFORM_LOGO=static/flotilla.png diff --git a/src/app/components/AppContainer.svelte b/src/app/components/AppContainer.svelte index 6b6db1a..e7fd818 100644 --- a/src/app/components/AppContainer.svelte +++ b/src/app/components/AppContainer.svelte @@ -4,7 +4,16 @@ import Landing from "@app/components/Landing.svelte" import Toast from "@app/components/Toast.svelte" import PrimaryNav from "@app/components/PrimaryNav.svelte" - import {modals} from "@app/modal" + import SignUpConfirm from "@app/components/SignUpConfirm.svelte" + import {BURROW_URL} from "@app/state" + import {modals, pushModal} from "@app/modal" + + if (BURROW_URL && $page.route.id === "/confirm-email") { + pushModal(SignUpConfirm, { + email: $page.url.searchParams.get("email"), + token: $page.url.searchParams.get("token"), + }) + }
diff --git a/src/app/components/InfoKeys.svelte b/src/app/components/InfoKeys.svelte index 9be2333..e4fe5a4 100644 --- a/src/app/components/InfoKeys.svelte +++ b/src/app/components/InfoKeys.svelte @@ -1,8 +1,17 @@
@@ -10,21 +19,33 @@
What is a private key?

- Most software keeps track of users by giving them a username and password. This gives the - service - total control over their users, allowing them to ban them at any time, or sell their - activity. + Most online services keep track of users by giving them a username and password. This gives the + service total control over their users, allowing them to ban them at any time, or + sell their activity.

On Nostr, you control your own identity and social data, through the magic of crytography. The basic idea is that you have a - public key, which acts as your user id, and a private key which - allows you to authenticate any message you send. + public key, which acts as your user id, and a + private key which allows you to prove your identity.

-

- It's very important to keep private keys safe, but this can sometimes be confusing for - newcomers. This is why {PLATFORM_NAME} supports remote signer login. These services - can store your keys securely for you, giving you access using a username and password. -

- + {#if $session?.email} +

+ It's very important to keep private keys safe, but this can sometimes be tricky, which is why {PLATFORM_NAME} + supports a traditional account-based login for new users. +

+

If you'd like to switch to self-custody, please click below to get started.

+ + + + + {:else} + + {/if}
diff --git a/src/app/components/LogIn.svelte b/src/app/components/LogIn.svelte index f751208..f78dfa2 100644 --- a/src/app/components/LogIn.svelte +++ b/src/app/components/LogIn.svelte @@ -1,4 +1,5 @@ + +
+ +
Log In
+
Log in using your email and password.
+
+ +

Email

+ +
+ +

Password

+ +
+

+ Your email and password only work to log in to {PLATFORM_NAME}. To use your key on other nostr + applications, visit your settings page. +

+ + + + +
diff --git a/src/app/components/ProfileEject.svelte b/src/app/components/ProfileEject.svelte new file mode 100644 index 0000000..45b983b --- /dev/null +++ b/src/app/components/ProfileEject.svelte @@ -0,0 +1 @@ +hi diff --git a/src/app/components/SignUp.svelte b/src/app/components/SignUp.svelte index efe1fbb..93fd515 100644 --- a/src/app/components/SignUp.svelte +++ b/src/app/components/SignUp.svelte @@ -1,17 +1,20 @@ @@ -92,21 +112,50 @@ , which allows you to own your social identity.

- -
-
-
- + + +

Password

+ +
+ +

+ Note that your email and password will only work to log in to {PLATFORM_NAME}. To use your key + on other nostr applications, you can create a nostr key yourself, or export your key from {PLATFORM_NAME} + later. +

+ {:else} + +
+ + @{signerDomain} +
+
+ + {/if} Or - + Get started on Nosta.me diff --git a/src/app/components/SignUpConfirm.svelte b/src/app/components/SignUpConfirm.svelte new file mode 100644 index 0000000..c390337 --- /dev/null +++ b/src/app/components/SignUpConfirm.svelte @@ -0,0 +1,53 @@ + + +
+

+ {#if loading} + Just a second... + {:else if error} + Oops! + {:else} + Success! + {/if} +

+

+ + {#if loading} + Hang tight, we're checking your confirmation link. + {:else if error} + Looks like something went wrong. {error} + {:else} + You're all set - click below to log in. + {/if} + +

+ +
diff --git a/src/app/components/SignUpSuccess.svelte b/src/app/components/SignUpSuccess.svelte new file mode 100644 index 0000000..9d07e80 --- /dev/null +++ b/src/app/components/SignUpSuccess.svelte @@ -0,0 +1,18 @@ + + +
+

Success!

+

+ A confirmation email has been sent to {email}. +

+

Once you've confirmed your account you'll be redirected to the login page.

+ +
diff --git a/src/app/components/Toast.svelte b/src/app/components/Toast.svelte index d8d94e5..15bc7e8 100644 --- a/src/app/components/Toast.svelte +++ b/src/app/components/Toast.svelte @@ -11,7 +11,7 @@ {#key $toast.id}