Add amber support

This commit is contained in:
Jon Staab
2024-10-21 14:09:57 -07:00
parent f93f47ffe7
commit 80de053cdd
15 changed files with 82 additions and 47 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
import ProfileName from "@app/components/ProfileName.svelte"
import ProfileCircle from "@app/components/ProfileCircle.svelte"
import ProfileCircles from "@app/components/ProfileCircles.svelte"
import {makeChatPath} from '@app/routes'
import {makeChatPath} from "@app/routes"
export let id: string
export let pubkeys: string[]
-1
View File
@@ -1,6 +1,5 @@
<script lang="ts">
import {nip19} from "nostr-tools"
import {ctx} from "@welshman/lib"
import Icon from "@lib/components/Icon.svelte"
import FieldInline from "@lib/components/FieldInline.svelte"
import Button from "@lib/components/Button.svelte"
+27 -1
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import {makeSecret, getNip07, Nip46Broker} from "@welshman/signer"
import {onMount} from "svelte"
import {makeSecret, getNip07, Nip46Broker, getNip55, Nip55Signer} from "@welshman/signer"
import {addSession, loadHandle, nip46Perms, type Session} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
import Tippy from "@lib/components/Tippy.svelte"
@@ -86,11 +87,30 @@
}
})
const loginWithSigner = async (app: any) => {
const signer = new Nip55Signer(app.packageName)
const pubkey = await signer.getPubkey()
if (pubkey) {
await onSuccess({method: "nip55", pubkey, signer: app.packageName})
} else {
pushToast({
theme: "error",
message: "Something went wrong! Please try again.",
})
}
}
const loginWithKey = () => pushModal(LogInKey)
let username = ""
let domain = "nsec.app"
let loading = false
let signers: any[] = []
onMount(async () => {
signers = await getNip55()
})
</script>
<form class="column gap-4" on:submit|preventDefault={loginWithNip46}>
@@ -136,6 +156,12 @@
Log in with Extension
</Button>
{/if}
{#each signers as app}
<Button disabled={loading} class="btn btn-neutral" on:click={() => loginWithSigner(app)}>
<img src={app.iconUrl} alt={app.name} width="48" height="48" />
Log in with {app.name}
</Button>
{/each}
<Button disabled={loading} on:click={loginWithKey} class="btn btn-neutral">
<Icon icon="key" />
Log in with Key
+5 -7
View File
@@ -1,6 +1,5 @@
<script lang="ts">
import {page} from "$app/stores"
import {goto} from "$app/navigation"
import {displayRelayUrl} from "@welshman/util"
import Icon from "@lib/components/Icon.svelte"
import Link from "@lib/components/Link.svelte"
@@ -51,8 +50,6 @@
showSettings = false
}
const browseSpaces = () => goto("/discover")
const leaveSpace = () => pushModal(SpaceExit, {url: space})
const joinSpace = () => pushModal(SpaceJoin, {url: space})
@@ -85,16 +82,17 @@
Go Back
</Button>
{:else if space}
<p class="mb-4 text-2xl center gap-2">
<p class="center mb-4 gap-2 text-2xl">
<Icon icon="compass-big" size={7} />
<span class="text-primary">{displayRelayUrl(space)}</span>
</p>
<div class="grid sm:grid-cols-3 gap-2">
<div class="grid gap-2 sm:grid-cols-3">
<Link href={makeSpacePath(space, "threads")} class="btn btn-neutral">
<Icon icon="notes-minimalistic" /> Threads
</Link>
<Link href={makeSpacePath(space)} class="btn btn-neutral">
<Icon icon="hashtag" /> {GENERAL}
<Icon icon="hashtag" />
{GENERAL}
</Link>
{#each rooms as room, i (room)}
<Link href={makeSpacePath(space, room)} class="btn btn-neutral">
@@ -109,7 +107,7 @@
</Link>
{/each}
</div>
<div class="grid sm:grid-cols-2 gap-2">
<div class="grid gap-2 sm:grid-cols-2">
<Button on:click={addRoom} class="btn btn-primary">
<Icon icon="add-circle" />
Create Room
+2 -17
View File
@@ -1,27 +1,12 @@
<script lang="ts">
import {nip19} from "nostr-tools"
import {onMount} from "svelte"
import {ago, append, first, sortBy, WEEK, ctx} from "@welshman/lib"
import {NOTE, getAncestorTags, getListTags, getPubkeyTagValues} from "@welshman/util"
import {NOTE, getAncestorTags} from "@welshman/util"
import type {Filter} from "@welshman/util"
import {deriveEvents} from "@welshman/store"
import {
repository,
load,
loadRelaySelections,
userFollows,
formatTimestamp,
formatTimestampRelative,
} from "@welshman/app"
import Link from "@lib/components/Link.svelte"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import {repository, load, loadRelaySelections, formatTimestampRelative} from "@welshman/app"
import Profile from "@app/components/Profile.svelte"
import ProfileInfo from "@app/components/ProfileInfo.svelte"
import Content from "@app/components/Content.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import {pushDrawer} from "@app/modal"
import {entityLink} from "@app/state"
export let pubkey
+5 -1
View File
@@ -46,7 +46,11 @@
{/if}
</div>
<div>
<PrimaryNavItem title="Settings" href="/settings/profile" prefix="/settings" class="tooltip-right">
<PrimaryNavItem
title="Settings"
href="/settings/profile"
prefix="/settings"
class="tooltip-right">
<Avatar src={$userProfile?.picture} class="!h-10 !w-10" />
</PrimaryNavItem>
<PrimaryNavItem title="Threads" href="/network" class="tooltip-right">
+26 -4
View File
@@ -3,9 +3,25 @@
import {nip19} from "nostr-tools"
import {ctx, sleep, sortBy, flatten} from "@welshman/lib"
import {feedFromFilter} from "@welshman/feeds"
import {NOTE, displayProfile, getListTags, getPubkeyTagValues, displayPubkey, getAncestorTags} from "@welshman/util"
import {
NOTE,
displayProfile,
getListTags,
getPubkeyTagValues,
displayPubkey,
getAncestorTags,
} from "@welshman/util"
import {deriveEvents} from "@welshman/store"
import {repository, userFollows, tagPubkey, follow, unfollow, deriveProfile, displayNip05, feedLoader} from "@welshman/app"
import {
repository,
userFollows,
tagPubkey,
follow,
unfollow,
deriveProfile,
displayNip05,
feedLoader,
} from "@welshman/app"
import {createScroller} from "@lib/html"
import {fly} from "@lib/transition"
import Link from "@lib/components/Link.svelte"
@@ -60,11 +76,17 @@
</div>
</div>
{#if getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
<button type="button" class="btn btn-neutral" on:click|preventDefault={() => unfollow(pubkey)}>
<button
type="button"
class="btn btn-neutral"
on:click|preventDefault={() => unfollow(pubkey)}>
Unfollow
</button>
{:else}
<button type="button" class="btn btn-primary" on:click|preventDefault={() => follow(tagPubkey(pubkey))}>
<button
type="button"
class="btn btn-primary"
on:click|preventDefault={() => follow(tagPubkey(pubkey))}>
Follow
</button>
{/if}
-1
View File
@@ -1,4 +1,3 @@
import {nip19} from "nostr-tools"
import type {Page} from "@sveltejs/kit"
import {userMembership, makeChatId, decodeRelay, encodeRelay, getMembershipUrls} from "@app/state"
-1
View File
@@ -1,4 +1,3 @@
import {nip19} from "nostr-tools"
import twColors from "tailwindcss/colors"
import {get, derived} from "svelte/store"
import type {Maybe} from "@welshman/lib"