forked from Kieran/zap.stream
Anon zap when logged out
This commit is contained in:
parent
7971f7154a
commit
ae4815de46
@ -5,10 +5,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emoji-mart/data": "^1.1.2",
|
"@emoji-mart/data": "^1.1.2",
|
||||||
"@emoji-mart/react": "^1.1.1",
|
"@emoji-mart/react": "^1.1.1",
|
||||||
|
"@noble/curves": "^1.1.0",
|
||||||
"@radix-ui/react-dialog": "^1.0.4",
|
"@radix-ui/react-dialog": "^1.0.4",
|
||||||
"@radix-ui/react-tabs": "^1.0.4",
|
"@radix-ui/react-tabs": "^1.0.4",
|
||||||
"@react-hook/resize-observer": "^1.2.6",
|
"@react-hook/resize-observer": "^1.2.6",
|
||||||
"@snort/system-react": "^1.0.8",
|
"@snort/system-react": "^1.0.10",
|
||||||
"@testing-library/jest-dom": "^5.14.1",
|
"@testing-library/jest-dom": "^5.14.1",
|
||||||
"@testing-library/react": "^13.0.0",
|
"@testing-library/react": "^13.0.0",
|
||||||
"@testing-library/user-event": "^13.2.1",
|
"@testing-library/user-event": "^13.2.1",
|
||||||
|
@ -3,6 +3,9 @@ import * as Dialog from "@radix-ui/react-dialog";
|
|||||||
import { useEffect, useState, type ReactNode } from "react";
|
import { useEffect, useState, type ReactNode } from "react";
|
||||||
import { LNURL } from "@snort/shared";
|
import { LNURL } from "@snort/shared";
|
||||||
import { NostrEvent, EventPublisher } from "@snort/system";
|
import { NostrEvent, EventPublisher } from "@snort/system";
|
||||||
|
import { secp256k1 } from "@noble/curves/secp256k1";
|
||||||
|
import { bytesToHex } from "@noble/curves/abstract/utils";
|
||||||
|
|
||||||
import { formatSats } from "../number";
|
import { formatSats } from "../number";
|
||||||
import { Icon } from "./icon";
|
import { Icon } from "./icon";
|
||||||
import AsyncButton from "./async-button";
|
import AsyncButton from "./async-button";
|
||||||
@ -69,8 +72,12 @@ export function SendZaps({
|
|||||||
|
|
||||||
async function send() {
|
async function send() {
|
||||||
if (!svc) return;
|
if (!svc) return;
|
||||||
const pub = await EventPublisher.nip7();
|
let pub = await EventPublisher.nip7();
|
||||||
if (!pub) return;
|
let isAnon = false;
|
||||||
|
if (!pub) {
|
||||||
|
pub = EventPublisher.privateKey(bytesToHex(secp256k1.utils.randomPrivateKey()));
|
||||||
|
isAnon = true;
|
||||||
|
}
|
||||||
|
|
||||||
const amountInSats = isFiat ? Math.floor((amount / UsdRate) * 1e8) : amount;
|
const amountInSats = isFiat ? Math.floor((amount / UsdRate) * 1e8) : amount;
|
||||||
let zap: NostrEvent | undefined;
|
let zap: NostrEvent | undefined;
|
||||||
@ -88,6 +95,9 @@ export function SendZaps({
|
|||||||
if (eTag) {
|
if (eTag) {
|
||||||
eb.tag(["e", eTag]);
|
eb.tag(["e", eTag]);
|
||||||
}
|
}
|
||||||
|
if (isAnon) {
|
||||||
|
eb.tag(["anon", ""]);
|
||||||
|
}
|
||||||
return eb;
|
return eb;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,7 +2,7 @@ import {
|
|||||||
RequestBuilder,
|
RequestBuilder,
|
||||||
EventKind,
|
EventKind,
|
||||||
ReplaceableNoteStore,
|
ReplaceableNoteStore,
|
||||||
ParameterizedReplaceableNoteStore,
|
NoteCollection,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
import { System } from "index";
|
import { System } from "index";
|
||||||
@ -65,9 +65,9 @@ export default function useEmoji(pubkey: string) {
|
|||||||
}, [pubkey, related]);
|
}, [pubkey, related]);
|
||||||
|
|
||||||
const { data: relatedData } =
|
const { data: relatedData } =
|
||||||
useRequestBuilder<ParameterizedReplaceableNoteStore>(
|
useRequestBuilder<NoteCollection>(
|
||||||
System,
|
System,
|
||||||
ParameterizedReplaceableNoteStore,
|
NoteCollection,
|
||||||
subRelated
|
subRelated
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { useMemo } from "react";
|
|||||||
import {
|
import {
|
||||||
RequestBuilder,
|
RequestBuilder,
|
||||||
FlatNoteStore,
|
FlatNoteStore,
|
||||||
ParameterizedReplaceableNoteStore,
|
NoteCollection,
|
||||||
NostrLink,
|
NostrLink,
|
||||||
EventKind,
|
EventKind,
|
||||||
parseZap,
|
parseZap,
|
||||||
@ -28,9 +28,9 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
|
|||||||
}, [link, leaveOpen]);
|
}, [link, leaveOpen]);
|
||||||
|
|
||||||
const { data: streamsData } =
|
const { data: streamsData } =
|
||||||
useRequestBuilder<ParameterizedReplaceableNoteStore>(
|
useRequestBuilder<NoteCollection>(
|
||||||
System,
|
System,
|
||||||
ParameterizedReplaceableNoteStore,
|
NoteCollection,
|
||||||
sub
|
sub
|
||||||
);
|
);
|
||||||
const streams = streamsData ?? [];
|
const streams = streamsData ?? [];
|
||||||
|
@ -3,14 +3,14 @@ import "./root.css";
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { unixNow } from "@snort/shared";
|
import { unixNow } from "@snort/shared";
|
||||||
import {
|
import {
|
||||||
ParameterizedReplaceableNoteStore,
|
NoteCollection,
|
||||||
RequestBuilder,
|
RequestBuilder,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
import { StreamState, System } from "..";
|
import { StreamState, System } from "..";
|
||||||
import { VideoTile } from "../element/video-tile";
|
import { VideoTile } from "../element/video-tile";
|
||||||
import { findTag } from "utils";
|
import { findTag } from "../utils";
|
||||||
import { LIVE_STREAM } from "const";
|
import { LIVE_STREAM } from "../const";
|
||||||
|
|
||||||
export function RootPage() {
|
export function RootPage() {
|
||||||
const rb = useMemo(() => {
|
const rb = useMemo(() => {
|
||||||
@ -24,9 +24,9 @@ export function RootPage() {
|
|||||||
return rb;
|
return rb;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const feed = useRequestBuilder<ParameterizedReplaceableNoteStore>(
|
const feed = useRequestBuilder<NoteCollection>(
|
||||||
System,
|
System,
|
||||||
ParameterizedReplaceableNoteStore,
|
NoteCollection,
|
||||||
rb
|
rb
|
||||||
);
|
);
|
||||||
const feedSorted = useMemo(() => {
|
const feedSorted = useMemo(() => {
|
||||||
|
42
yarn.lock
42
yarn.lock
@ -1520,10 +1520,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718"
|
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718"
|
||||||
integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==
|
integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==
|
||||||
|
|
||||||
"@snort/shared@^1.0.2":
|
"@snort/shared@^1.0.4":
|
||||||
version "1.0.2"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@snort/shared/-/shared-1.0.2.tgz#539a8d68ce737320d329a4b205d0d5d3a7e32982"
|
resolved "https://registry.yarnpkg.com/@snort/shared/-/shared-1.0.4.tgz#b1dd4c05e6682ac30ee100f7b7baee8e6c57233a"
|
||||||
integrity sha512-98bArZMyoET3/HinT+CRQEZqYAp59oMjz7LzH1+nKc8XVyUmqKEncZ7MQe0RrTcKHQc+51vQgglpjKfFy3XR/g==
|
integrity sha512-1wPnfm9BfKVtgpWLhHzaZ2AWb7XdNF+4ybE32E7UlZzIBp9uvJbpTHLJkX1P4i12vvuK86HhOxVyTRu971Rv1w==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@noble/curves" "^1.1.0"
|
"@noble/curves" "^1.1.0"
|
||||||
"@noble/hashes" "^1.3.1"
|
"@noble/hashes" "^1.3.1"
|
||||||
@ -1532,35 +1532,23 @@
|
|||||||
dexie "^3.2.4"
|
dexie "^3.2.4"
|
||||||
light-bolt11-decoder "^3.0.0"
|
light-bolt11-decoder "^3.0.0"
|
||||||
|
|
||||||
"@snort/shared@^1.0.3":
|
"@snort/system-react@^1.0.10":
|
||||||
version "1.0.3"
|
version "1.0.10"
|
||||||
resolved "https://registry.yarnpkg.com/@snort/shared/-/shared-1.0.3.tgz#85aa9c4f0db47b095692ad7ab135b2580b8a855c"
|
resolved "https://registry.yarnpkg.com/@snort/system-react/-/system-react-1.0.10.tgz#72947af286602022dc468f7d04b01c7b18c14389"
|
||||||
integrity sha512-B4dge6qlcO+pZtGk5gjvpGq622kbTpgcEOE9iGigfzZzf5FjrBTFQD+tbcAaIKuW580BwE61YYfJdONP1Pz+pQ==
|
integrity sha512-mBgHVmcrt9Sblm3/IN1vHLgoyQGH1xOpYg+v2+ARlFVOUdvkcQTxzQzt4sxWsdF4C63WFiju9hAahW/Dg4UhEw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@noble/curves" "^1.1.0"
|
"@snort/shared" "^1.0.4"
|
||||||
"@noble/hashes" "^1.3.1"
|
"@snort/system" "^1.0.15"
|
||||||
"@scure/base" "^1.1.1"
|
|
||||||
debug "^4.3.4"
|
|
||||||
dexie "^3.2.4"
|
|
||||||
light-bolt11-decoder "^3.0.0"
|
|
||||||
|
|
||||||
"@snort/system-react@^1.0.8":
|
|
||||||
version "1.0.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/@snort/system-react/-/system-react-1.0.8.tgz#c496c950e4621edac1a1d72b90934b2d99d0a641"
|
|
||||||
integrity sha512-3JQAeF144txyPyTqgmj5rgqY2URrkO8WTRKo3+y8TqnziOI+90WDmDXFEIf2b0cja4+nAUNgI/GTCy4CvYDpGQ==
|
|
||||||
dependencies:
|
|
||||||
"@snort/shared" "^1.0.2"
|
|
||||||
"@snort/system" "^1.0.13"
|
|
||||||
react "^18.2.0"
|
react "^18.2.0"
|
||||||
|
|
||||||
"@snort/system@^1.0.13":
|
"@snort/system@^1.0.15":
|
||||||
version "1.0.13"
|
version "1.0.15"
|
||||||
resolved "https://registry.yarnpkg.com/@snort/system/-/system-1.0.13.tgz#54c05e71709af597eff75c9892aebf882552247c"
|
resolved "https://registry.yarnpkg.com/@snort/system/-/system-1.0.15.tgz#845a2aaafcb75e469e7836c143f217404172cee0"
|
||||||
integrity sha512-U0MLe239BgGxauXrtQc6Gm3mx/EgEq8T7mWnZehsibgj6M0RFv8l4mzEAQtM8M9sg2VnGmtpIE4J5wA7/ITDMg==
|
integrity sha512-mVXj2ZCS0T/m3EPqn0ICWrp96XUlhBCT4ci1CLzmtT8zXojAE/2eONv4ZR/OzGrvftUIBqarfpFbtJ7q1vohSg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@noble/curves" "^1.0.0"
|
"@noble/curves" "^1.0.0"
|
||||||
"@scure/base" "^1.1.1"
|
"@scure/base" "^1.1.1"
|
||||||
"@snort/shared" "^1.0.3"
|
"@snort/shared" "^1.0.4"
|
||||||
"@stablelib/xchacha20" "^1.0.1"
|
"@stablelib/xchacha20" "^1.0.1"
|
||||||
debug "^4.3.4"
|
debug "^4.3.4"
|
||||||
dexie "^3.2.4"
|
dexie "^3.2.4"
|
||||||
|
Loading…
Reference in New Issue
Block a user