aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/(static)/register/+page.server.ts4
-rw-r--r--src/routes/(static)/register/+page.svelte22
2 files changed, 16 insertions, 10 deletions
diff --git a/src/routes/(static)/register/+page.server.ts b/src/routes/(static)/register/+page.server.ts
index b459c622..561b34a0 100644
--- a/src/routes/(static)/register/+page.server.ts
+++ b/src/routes/(static)/register/+page.server.ts
@@ -16,9 +16,9 @@ export const actions = {
const ip = request.headers.get("cf-connecting-ip");
const form = await fd(request);
- let { profile, username, password, cipher, salt, pubkey, loginRedirect } =
+ let { picture, username, password, cipher, salt, pubkey, loginRedirect } =
form;
- const user = { profile, username, password, cipher, salt, pubkey };
+ const user = { picture, username, password, cipher, salt, pubkey };
let error;
if (loginRedirect === "undefined") loginRedirect = undefined;
diff --git a/src/routes/(static)/register/+page.svelte b/src/routes/(static)/register/+page.svelte
index 8738e32b..69c6a588 100644
--- a/src/routes/(static)/register/+page.svelte
+++ b/src/routes/(static)/register/+page.svelte
@@ -25,7 +25,7 @@
animals,
} from "unique-names-generator";
- let { form = $bindable(), data } = $props();
+ let { form, data } = $props();
let nostr = $state();
let { id } = $derived(data);
@@ -97,22 +97,23 @@
data.set(k, user[k]);
}
- data.set("profile", punks[index]);
+ data.set("picture", punks[index]);
if ($avatar) {
try {
let { hash } = JSON.parse(
await upload($avatar.file, $avatar.type, $avatar.progress, token),
);
- data.set("profile", hash);
- await fetch(`/api/public/${hash}.webp`, {
+ let url = `${$page.url.origin}/api/public/${hash}.webp`;
+ data.set("picture", url);
+ await fetch(url, {
cache: "reload",
mode: "no-cors",
});
} catch (e) {
console.log("problem uploading avatar", e);
}
- }
+ }
const response = await fetch("/register", {
method: "POST",
@@ -136,7 +137,7 @@
let progress;
let handleFile = async ({ target }) => {
- let type = "profile";
+ let type = "picture";
let file = target.files[0];
if (!file) return;
@@ -212,7 +213,7 @@
type="file"
class="hidden"
bind:this={avatarInput}
- onchange={(e) => handleFile(e, "profile")}
+ onchange={(e) => handleFile(e, "picture")}
/>
<div class="relative">
@@ -298,7 +299,12 @@
bind:show={revealPassword}
/>
- <button type="submit" class="btn btn-accent" disabled={loading} bind:this={btn}>
+ <button
+ type="submit"
+ class="btn btn-accent"
+ disabled={loading}
+ bind:this={btn}
+ >
{#if loading}
<Spinner />
{:else}