forked from Kieran/snort
Compare commits
22 Commits
3f9805c48a
...
585f031ce1
Author | SHA1 | Date | |
---|---|---|---|
585f031ce1 | |||
0ff3aad6cb | |||
bc8e08ba47 | |||
92c90b40ee | |||
2a6433a6b4 | |||
fb28f5d7df | |||
cb8fec85c3 | |||
aa1ab7023f | |||
74c61ca9ba | |||
e583770518 | |||
71f5af649c | |||
873ba0a1d2 | |||
90ac55d561 | |||
efa303b68f | |||
4e2b7e6bb9 | |||
40e05480e6 | |||
ef7fc458f6 | |||
0b5dc2d290 | |||
bf0af2d14e | |||
58ba714d36 | |||
234167b749 | |||
d4a3e11d03 |
@ -95,8 +95,11 @@ steps:
|
||||
- npx @crowdin/cli pull -b main -T $CTOKEN
|
||||
- yarn prettier --write .
|
||||
- git add .
|
||||
- 'git commit -a -m "chore: Update translations"'
|
||||
- git push -u origin main
|
||||
- >
|
||||
if output=$(git status --porcelain) && [ -n "$output" ]; then
|
||||
git commit -a -m "chore: Update translations"
|
||||
git push -u origin main
|
||||
fi
|
||||
volumes:
|
||||
- name: cache
|
||||
claim:
|
||||
|
14
Dockerfile
14
Dockerfile
@ -1,14 +1,12 @@
|
||||
FROM node:16 as build
|
||||
FROM node:19 as build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json yarn.lock .
|
||||
COPY packages/app/package.json packages/app/
|
||||
COPY packages/nostr/package.json packages/nostr/
|
||||
RUN yarn install --network-timeout 1000000
|
||||
|
||||
COPY . .
|
||||
COPY package.json yarn.lock .yarnrc.yml .
|
||||
COPY .yarn .yarn
|
||||
COPY packages packages
|
||||
RUN yarn --network-timeout 1000000
|
||||
RUN yarn build
|
||||
|
||||
FROM nginx:mainline-alpine
|
||||
FROM nginxinc/nginx-unprivileged:mainline-alpine
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/packages/app/build /usr/share/nginx/html
|
||||
|
@ -1,3 +1,3 @@
|
||||
FROM nginx:mainline-alpine
|
||||
FROM nginxinc/nginx-unprivileged:mainline-alpine
|
||||
COPY packages/app/build /usr/share/nginx/html
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
@ -4,5 +4,7 @@
|
||||
"appTitle": "Snort - Nostr",
|
||||
"nip05Domain": "snort.social",
|
||||
"favicon": "public/favicon.ico",
|
||||
"appleTouchIconUrl": "/nostrich_512.png"
|
||||
"appleTouchIconUrl": "/nostrich_512.png",
|
||||
"httpCache": "",
|
||||
"animalNamePlaceholders": false
|
||||
}
|
||||
|
@ -4,5 +4,7 @@
|
||||
"appTitle": "iris",
|
||||
"nip05Domain": "iris.to",
|
||||
"favicon": "public/iris/favicon.ico",
|
||||
"appleTouchIconUrl": "/img/apple-touch-icon.png"
|
||||
"appleTouchIconUrl": "/img/apple-touch-icon.png",
|
||||
"httpCache": "https://api.iris.to",
|
||||
"animalNamePlaceholders": true
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
"@void-cat/api": "^1.0.4",
|
||||
"debug": "^4.3.4",
|
||||
"dexie": "^3.2.4",
|
||||
"dns-over-http-resolver": "^2.1.1",
|
||||
"emojilib": "^3.0.10",
|
||||
"light-bolt11-decoder": "^2.1.0",
|
||||
"match-sorter": "^6.3.1",
|
||||
@ -30,7 +29,7 @@
|
||||
"react-router-dom": "^6.5.0",
|
||||
"react-textarea-autosize": "^8.4.0",
|
||||
"react-twitter-embed": "^4.0.4",
|
||||
"use-long-press": "^2.0.3",
|
||||
"use-long-press": "^3.2.0",
|
||||
"use-sync-external-store": "^1.2.0",
|
||||
"uuid": "^9.0.0",
|
||||
"workbox-core": "^6.4.2",
|
||||
@ -102,8 +101,8 @@
|
||||
"prop-types": "^15.8.1",
|
||||
"source-map-loader": "^4.0.1",
|
||||
"terser-webpack-plugin": "^5.3.9",
|
||||
"tinybench": "^2.5.0",
|
||||
"ts-jest": "^29.1.0",
|
||||
"tinybench": "^2.5.1",
|
||||
"ts-jest": "^29.1.1",
|
||||
"ts-loader": "^9.4.4",
|
||||
"typescript": "^5.2.2",
|
||||
"webpack": "^5.88.2",
|
||||
|
@ -15,11 +15,6 @@ export const Day = Hour * 24;
|
||||
*/
|
||||
export const ApiHost = "https://api.snort.social";
|
||||
|
||||
/**
|
||||
* Iris api for free nip05 names
|
||||
*/
|
||||
export const IrisHost = "https://api.iris.to";
|
||||
|
||||
/**
|
||||
* LibreTranslate endpoint
|
||||
*/
|
||||
|
@ -59,7 +59,7 @@ export function SpotlightMedia(props: SpotlightMediaProps) {
|
||||
<div className="spotlight">
|
||||
<ProxyImg src={image} />
|
||||
<div className="details">
|
||||
{idx + 1}/{props.images.length}
|
||||
{props.images.length > 1 && `${idx + 1}/${props.images.length}`}
|
||||
<Icon name="x-close" size={24} onClick={props.onClose} />
|
||||
</div>
|
||||
{props.images.length > 1 && (
|
||||
@ -74,7 +74,7 @@ export function SpotlightMedia(props: SpotlightMediaProps) {
|
||||
|
||||
export function SpotlightMediaModal(props: SpotlightMediaProps) {
|
||||
return (
|
||||
<Modal id="spotlight" onClose={props.onClose} className="spotlight">
|
||||
<Modal id="spotlight" onClick={props.onClose} onClose={props.onClose} className="spotlight">
|
||||
<SpotlightMedia {...props} />
|
||||
</Modal>
|
||||
);
|
||||
|
@ -1,21 +1,16 @@
|
||||
import { useMemo } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { HexKey } from "@snort/system";
|
||||
|
||||
import { useUserProfile } from "@snort/system-react";
|
||||
import { profileLink } from "SnortUtils";
|
||||
import { getDisplayName } from "Element/User/ProfileImage";
|
||||
import DisplayName from "../User/DisplayName";
|
||||
|
||||
export default function Mention({ pubkey, relays }: { pubkey: HexKey; relays?: Array<string> | string }) {
|
||||
const user = useUserProfile(pubkey);
|
||||
|
||||
const name = useMemo(() => {
|
||||
return getDisplayName(user, pubkey);
|
||||
}, [user, pubkey]);
|
||||
|
||||
return (
|
||||
<Link to={profileLink(pubkey, relays)} onClick={e => e.stopPropagation()}>
|
||||
@{name}
|
||||
@<DisplayName user={user} pubkey={pubkey} />
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import FollowListBase from "Element/User/FollowListBase";
|
||||
import AsyncButton from "Element/AsyncButton";
|
||||
import { useWallet } from "Wallet";
|
||||
import { Toastore } from "Toaster";
|
||||
import { getDisplayName } from "Element/User/ProfileImage";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
import { UserCache } from "Cache";
|
||||
import useLogin from "Hooks/useLogin";
|
||||
import useEventPublisher from "Hooks/useEventPublisher";
|
||||
|
23
packages/app/src/Element/Event/HiddenNote.tsx
Normal file
23
packages/app/src/Element/Event/HiddenNote.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import messages from "../messages";
|
||||
import { useState } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
const HiddenNote = ({ children }: { children: React.ReactNode }) => {
|
||||
const [show, setShow] = useState(false);
|
||||
return show ? (
|
||||
children
|
||||
) : (
|
||||
<div className="card note hidden-note">
|
||||
<div className="header">
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="This note has been muted" />
|
||||
</p>
|
||||
<button type="button" onClick={() => setShow(true)}>
|
||||
<FormattedMessage {...messages.Show} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default HiddenNote;
|
@ -1,45 +1,14 @@
|
||||
import "./Note.css";
|
||||
import React, { useMemo, useState, ReactNode } from "react";
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
import { useInView } from "react-intersection-observer";
|
||||
import { useIntl, FormattedMessage } from "react-intl";
|
||||
import { TaggedNostrEvent, HexKey, EventKind, NostrPrefix, Lists, EventExt, parseZap, NostrLink } from "@snort/system";
|
||||
|
||||
import { System } from "index";
|
||||
import useEventPublisher from "Hooks/useEventPublisher";
|
||||
import Icon from "Icons/Icon";
|
||||
import ProfileImage from "Element/User/ProfileImage";
|
||||
import Text from "Element/Text";
|
||||
import {
|
||||
getReactions,
|
||||
dedupeByPubkey,
|
||||
tagFilterOfTextRepost,
|
||||
hexToBech32,
|
||||
normalizeReaction,
|
||||
Reaction,
|
||||
profileLink,
|
||||
findTag,
|
||||
} from "SnortUtils";
|
||||
import NoteFooter from "Element/Event/NoteFooter";
|
||||
import NoteTime from "Element/Event/NoteTime";
|
||||
import Reveal from "Element/Event/Reveal";
|
||||
import useModeration from "Hooks/useModeration";
|
||||
import { UserCache } from "Cache";
|
||||
import Poll from "Element/Event/Poll";
|
||||
import useLogin from "Hooks/useLogin";
|
||||
import { setBookmarked, setPinned } from "Login";
|
||||
import React from "react";
|
||||
import { EventKind, TaggedNostrEvent } from "@snort/system";
|
||||
import { NostrFileElement } from "Element/Event/NostrFileHeader";
|
||||
import ZapstrEmbed from "Element/Embed/ZapstrEmbed";
|
||||
import PubkeyList from "Element/Embed/PubkeyList";
|
||||
import { LiveEvent } from "Element/LiveEvent";
|
||||
import { NoteContextMenu, NoteTranslation } from "Element/Event/NoteContextMenu";
|
||||
import Reactions from "Element/Event/Reactions";
|
||||
import { ZapGoal } from "Element/Event/ZapGoal";
|
||||
import NoteReaction from "Element/Event/NoteReaction";
|
||||
import ProfilePreview from "Element/User/ProfilePreview";
|
||||
import { ProxyImg } from "Element/ProxyImg";
|
||||
|
||||
import messages from "../messages";
|
||||
import { NoteInner } from "./NoteInner";
|
||||
|
||||
export interface NoteProps {
|
||||
data: TaggedNostrEvent;
|
||||
@ -66,24 +35,6 @@ export interface NoteProps {
|
||||
};
|
||||
}
|
||||
|
||||
const HiddenNote = ({ children }: { children: React.ReactNode }) => {
|
||||
const [show, setShow] = useState(false);
|
||||
return show ? (
|
||||
children
|
||||
) : (
|
||||
<div className="card note hidden-note">
|
||||
<div className="header">
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="This note has been muted" />
|
||||
</p>
|
||||
<button type="button" onClick={() => setShow(true)}>
|
||||
<FormattedMessage {...messages.Show} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default function Note(props: NoteProps) {
|
||||
const { data: ev, className } = props;
|
||||
if (ev.kind === EventKind.Repost) {
|
||||
@ -110,366 +61,3 @@ export default function Note(props: NoteProps) {
|
||||
|
||||
return <NoteInner {...props} />;
|
||||
}
|
||||
|
||||
export function NoteInner(props: NoteProps) {
|
||||
const { data: ev, related, highlight, options: opt, ignoreModeration = false, className } = props;
|
||||
|
||||
const baseClassName = `note card${className ? ` ${className}` : ""}`;
|
||||
const navigate = useNavigate();
|
||||
const [showReactions, setShowReactions] = useState(false);
|
||||
const deletions = useMemo(() => getReactions(related, ev.id, EventKind.Deletion), [related]);
|
||||
const { isEventMuted } = useModeration();
|
||||
const { ref, inView } = useInView({ triggerOnce: true });
|
||||
const login = useLogin();
|
||||
const { pinned, bookmarked } = login;
|
||||
const publisher = useEventPublisher();
|
||||
const [translated, setTranslated] = useState<NoteTranslation>();
|
||||
const { formatMessage } = useIntl();
|
||||
const reactions = useMemo(() => getReactions(related, ev.id, EventKind.Reaction), [related, ev]);
|
||||
const groupReactions = useMemo(() => {
|
||||
const result = reactions?.reduce(
|
||||
(acc, reaction) => {
|
||||
const kind = normalizeReaction(reaction.content);
|
||||
const rs = acc[kind] || [];
|
||||
return { ...acc, [kind]: [...rs, reaction] };
|
||||
},
|
||||
{
|
||||
[Reaction.Positive]: [] as TaggedNostrEvent[],
|
||||
[Reaction.Negative]: [] as TaggedNostrEvent[],
|
||||
},
|
||||
);
|
||||
return {
|
||||
[Reaction.Positive]: dedupeByPubkey(result[Reaction.Positive]),
|
||||
[Reaction.Negative]: dedupeByPubkey(result[Reaction.Negative]),
|
||||
};
|
||||
}, [reactions]);
|
||||
const positive = groupReactions[Reaction.Positive];
|
||||
const negative = groupReactions[Reaction.Negative];
|
||||
const reposts = useMemo(
|
||||
() =>
|
||||
dedupeByPubkey([
|
||||
...getReactions(related, ev.id, EventKind.TextNote).filter(e => e.tags.some(tagFilterOfTextRepost(e, ev.id))),
|
||||
...getReactions(related, ev.id, EventKind.Repost),
|
||||
]),
|
||||
[related, ev],
|
||||
);
|
||||
const zaps = useMemo(() => {
|
||||
const sortedZaps = getReactions(related, ev.id, EventKind.ZapReceipt)
|
||||
.map(a => parseZap(a, UserCache, ev))
|
||||
.filter(z => z.valid);
|
||||
sortedZaps.sort((a, b) => b.amount - a.amount);
|
||||
return sortedZaps;
|
||||
}, [related]);
|
||||
const totalReactions = positive.length + negative.length + reposts.length + zaps.length;
|
||||
|
||||
const options = {
|
||||
showHeader: true,
|
||||
showTime: true,
|
||||
showFooter: true,
|
||||
canUnpin: false,
|
||||
canUnbookmark: false,
|
||||
showContextMenu: true,
|
||||
...opt,
|
||||
};
|
||||
|
||||
async function unpin(id: HexKey) {
|
||||
if (options.canUnpin && publisher) {
|
||||
if (window.confirm(formatMessage(messages.ConfirmUnpin))) {
|
||||
const es = pinned.item.filter(e => e !== id);
|
||||
const ev = await publisher.noteList(es, Lists.Pinned);
|
||||
System.BroadcastEvent(ev);
|
||||
setPinned(login, es, ev.created_at * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function unbookmark(id: HexKey) {
|
||||
if (options.canUnbookmark && publisher) {
|
||||
if (window.confirm(formatMessage(messages.ConfirmUnbookmark))) {
|
||||
const es = bookmarked.item.filter(e => e !== id);
|
||||
const ev = await publisher.noteList(es, Lists.Bookmarked);
|
||||
System.BroadcastEvent(ev);
|
||||
setBookmarked(login, es, ev.created_at * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const innerContent = () => {
|
||||
if (ev.kind === EventKind.LongFormTextNote) {
|
||||
const title = findTag(ev, "title");
|
||||
const summary = findTag(ev, "simmary");
|
||||
const image = findTag(ev, "image");
|
||||
return (
|
||||
<div className="long-form-note">
|
||||
<h3>{title}</h3>
|
||||
<div className="text">
|
||||
<p>{summary}</p>
|
||||
<Text
|
||||
id={ev.id}
|
||||
content={ev.content}
|
||||
highlighText={props.searchedValue}
|
||||
tags={ev.tags}
|
||||
creator={ev.pubkey}
|
||||
depth={props.depth}
|
||||
truncate={255}
|
||||
disableLinkPreview={true}
|
||||
disableMediaSpotlight={!(props.options?.showMediaSpotlight ?? true)}
|
||||
/>
|
||||
{image && <ProxyImg src={image} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
const body = ev?.content ?? "";
|
||||
return (
|
||||
<Text
|
||||
id={ev.id}
|
||||
highlighText={props.searchedValue}
|
||||
content={body}
|
||||
tags={ev.tags}
|
||||
creator={ev.pubkey}
|
||||
depth={props.depth}
|
||||
disableMedia={!(options.showMedia ?? true)}
|
||||
disableMediaSpotlight={!(props.options?.showMediaSpotlight ?? true)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const transformBody = () => {
|
||||
if (deletions?.length > 0) {
|
||||
return (
|
||||
<b className="error">
|
||||
<FormattedMessage {...messages.Deleted} />
|
||||
</b>
|
||||
);
|
||||
}
|
||||
const contentWarning = ev.tags.find(a => a[0] === "content-warning");
|
||||
if (contentWarning) {
|
||||
return (
|
||||
<Reveal
|
||||
message={
|
||||
<>
|
||||
<FormattedMessage
|
||||
defaultMessage="The author has marked this note as a <i>sensitive topic</i>"
|
||||
values={{
|
||||
i: c => <i>{c}</i>,
|
||||
}}
|
||||
/>
|
||||
{contentWarning[1] && (
|
||||
<>
|
||||
|
||||
<FormattedMessage
|
||||
defaultMessage="Reason: <i>{reason}</i>"
|
||||
values={{
|
||||
i: c => <i>{c}</i>,
|
||||
reason: contentWarning[1],
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
<FormattedMessage defaultMessage="Click here to load anyway" />
|
||||
</>
|
||||
}>
|
||||
{innerContent()}
|
||||
</Reveal>
|
||||
);
|
||||
}
|
||||
return innerContent();
|
||||
};
|
||||
|
||||
function goToEvent(
|
||||
e: React.MouseEvent,
|
||||
eTarget: TaggedNostrEvent,
|
||||
isTargetAllowed: boolean = e.target === e.currentTarget,
|
||||
) {
|
||||
if (!isTargetAllowed || opt?.canClick === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
if (props.onClick) {
|
||||
props.onClick(eTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
const link = NostrLink.fromEvent(eTarget);
|
||||
// detect cmd key and open in new tab
|
||||
if (e.metaKey) {
|
||||
window.open(`/e/${link.encode()}`, "_blank");
|
||||
} else {
|
||||
navigate(`/e/${link.encode()}`, {
|
||||
state: eTarget,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function replyTag() {
|
||||
const thread = EventExt.extractThread(ev);
|
||||
if (thread === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const maxMentions = 2;
|
||||
const replyTo = thread?.replyTo ?? thread?.root;
|
||||
const replyLink = replyTo
|
||||
? NostrLink.fromTag(
|
||||
[replyTo.key, replyTo.value ?? "", replyTo.relay ?? "", replyTo.marker ?? ""].filter(a => a.length > 0),
|
||||
)
|
||||
: undefined;
|
||||
const mentions: { pk: string; name: string; link: ReactNode }[] = [];
|
||||
for (const pk of thread?.pubKeys ?? []) {
|
||||
const u = UserCache.getFromCache(pk);
|
||||
const npub = hexToBech32(NostrPrefix.PublicKey, pk);
|
||||
const shortNpub = npub.substring(0, 12);
|
||||
mentions.push({
|
||||
pk,
|
||||
name: u?.name ?? shortNpub,
|
||||
link: <Link to={profileLink(pk)}>{u?.name ? `@${u.name}` : shortNpub}</Link>,
|
||||
});
|
||||
}
|
||||
mentions.sort(a => (a.name.startsWith(NostrPrefix.PublicKey) ? 1 : -1));
|
||||
const othersLength = mentions.length - maxMentions;
|
||||
const renderMention = (m: { link: React.ReactNode; pk: string; name: string }, idx: number) => {
|
||||
return (
|
||||
<React.Fragment key={m.pk}>
|
||||
{idx > 0 && ", "}
|
||||
{m.link}
|
||||
</React.Fragment>
|
||||
);
|
||||
};
|
||||
const pubMentions =
|
||||
mentions.length > maxMentions ? mentions?.slice(0, maxMentions).map(renderMention) : mentions?.map(renderMention);
|
||||
const others = mentions.length > maxMentions ? formatMessage(messages.Others, { n: othersLength }) : "";
|
||||
return (
|
||||
<div className="reply">
|
||||
re:
|
||||
{(mentions?.length ?? 0) > 0 ? (
|
||||
<>
|
||||
{pubMentions} {others}
|
||||
</>
|
||||
) : (
|
||||
replyLink && <Link to={`/e/${replyLink.encode()}`}>{replyLink.encode().substring(0, 12)}</Link>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const canRenderAsTextNote = [EventKind.TextNote, EventKind.Polls, EventKind.LongFormTextNote];
|
||||
if (!canRenderAsTextNote.includes(ev.kind)) {
|
||||
const alt = findTag(ev, "alt");
|
||||
if (alt) {
|
||||
return (
|
||||
<div className="note-quote">
|
||||
<Text id={ev.id} content={alt} tags={[]} creator={ev.pubkey} />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<h4>
|
||||
<FormattedMessage {...messages.UnknownEventKind} values={{ kind: ev.kind }} />
|
||||
</h4>
|
||||
<pre>{JSON.stringify(ev, undefined, " ")}</pre>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function translation() {
|
||||
if (translated && translated.confidence > 0.5) {
|
||||
return (
|
||||
<>
|
||||
<p className="highlight">
|
||||
<FormattedMessage {...messages.TranslatedFrom} values={{ lang: translated.fromLanguage }} />
|
||||
</p>
|
||||
{translated.text}
|
||||
</>
|
||||
);
|
||||
} else if (translated) {
|
||||
return (
|
||||
<p className="highlight">
|
||||
<FormattedMessage {...messages.TranslationFailed} />
|
||||
</p>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function pollOptions() {
|
||||
if (ev.kind !== EventKind.Polls) return;
|
||||
|
||||
return <Poll ev={ev} zaps={zaps} />;
|
||||
}
|
||||
|
||||
function content() {
|
||||
if (!inView) return undefined;
|
||||
return (
|
||||
<>
|
||||
{options.showHeader && (
|
||||
<div className="header flex">
|
||||
<ProfileImage
|
||||
pubkey={ev.pubkey}
|
||||
subHeader={replyTag() ?? undefined}
|
||||
link={opt?.canClick === undefined ? undefined : ""}
|
||||
/>
|
||||
<div className="info">
|
||||
{(options.showTime || options.showBookmarked) && (
|
||||
<>
|
||||
{options.showBookmarked && (
|
||||
<div
|
||||
className={`saved ${options.canUnbookmark ? "pointer" : ""}`}
|
||||
onClick={() => unbookmark(ev.id)}>
|
||||
<Icon name="bookmark" /> <FormattedMessage {...messages.Bookmarked} />
|
||||
</div>
|
||||
)}
|
||||
{!options.showBookmarked && <NoteTime from={ev.created_at * 1000} />}
|
||||
</>
|
||||
)}
|
||||
{options.showPinned && (
|
||||
<div className={`pinned ${options.canUnpin ? "pointer" : ""}`} onClick={() => unpin(ev.id)}>
|
||||
<Icon name="pin" /> <FormattedMessage {...messages.Pinned} />
|
||||
</div>
|
||||
)}
|
||||
{options.showContextMenu && (
|
||||
<NoteContextMenu
|
||||
ev={ev}
|
||||
react={async () => {}}
|
||||
onTranslated={t => setTranslated(t)}
|
||||
setShowReactions={setShowReactions}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="body" onClick={e => goToEvent(e, ev, true)}>
|
||||
{transformBody()}
|
||||
{translation()}
|
||||
{pollOptions()}
|
||||
{options.showReactionsLink && (
|
||||
<div className="reactions-link" onClick={() => setShowReactions(true)}>
|
||||
<FormattedMessage {...messages.ReactionsLink} values={{ n: totalReactions }} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{options.showFooter && <NoteFooter ev={ev} positive={positive} reposts={reposts} zaps={zaps} />}
|
||||
<Reactions
|
||||
show={showReactions}
|
||||
setShow={setShowReactions}
|
||||
positive={positive}
|
||||
negative={negative}
|
||||
reposts={reposts}
|
||||
zaps={zaps}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const note = (
|
||||
<div className={`${baseClassName}${highlight ? " active " : " "}`} onClick={e => goToEvent(e, ev)} ref={ref}>
|
||||
{content()}
|
||||
</div>
|
||||
);
|
||||
|
||||
return !ignoreModeration && isEventMuted(ev) ? <HiddenNote>{note}</HiddenNote> : note;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import { useInteractionCache } from "Hooks/useInteractionCache";
|
||||
import { ZapPoolController } from "ZapPoolController";
|
||||
import { System } from "index";
|
||||
import { Zapper, ZapTarget } from "Zapper";
|
||||
import { getDisplayName } from "../User/ProfileImage";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
import { useNoteCreator } from "State/NoteCreator";
|
||||
|
||||
import messages from "../messages";
|
||||
|
397
packages/app/src/Element/Event/NoteInner.tsx
Normal file
397
packages/app/src/Element/Event/NoteInner.tsx
Normal file
@ -0,0 +1,397 @@
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import React, { ReactNode, useMemo, useState } from "react";
|
||||
import {
|
||||
dedupeByPubkey,
|
||||
findTag,
|
||||
getReactions,
|
||||
hexToBech32,
|
||||
normalizeReaction,
|
||||
profileLink,
|
||||
Reaction,
|
||||
tagFilterOfTextRepost,
|
||||
} from "../../SnortUtils";
|
||||
import useModeration from "../../Hooks/useModeration";
|
||||
import { useInView } from "react-intersection-observer";
|
||||
import useLogin from "../../Hooks/useLogin";
|
||||
import useEventPublisher from "../../Hooks/useEventPublisher";
|
||||
import { NoteContextMenu, NoteTranslation } from "./NoteContextMenu";
|
||||
import { FormattedMessage, useIntl } from "react-intl";
|
||||
import { UserCache } from "../../Cache";
|
||||
import messages from "../messages";
|
||||
import { System } from "../../index";
|
||||
import { setBookmarked, setPinned } from "../../Login";
|
||||
import Text from "../Text";
|
||||
import { ProxyImg } from "../ProxyImg";
|
||||
import Reveal from "./Reveal";
|
||||
import Poll from "./Poll";
|
||||
import ProfileImage from "../User/ProfileImage";
|
||||
import Icon from "../../Icons/Icon";
|
||||
import NoteTime from "./NoteTime";
|
||||
import NoteFooter from "./NoteFooter";
|
||||
import Reactions from "./Reactions";
|
||||
import HiddenNote from "./HiddenNote";
|
||||
import { NoteProps } from "./Note";
|
||||
import { EventExt, EventKind, HexKey, Lists, NostrLink, NostrPrefix, parseZap, TaggedNostrEvent } from "@snort/system";
|
||||
|
||||
export function NoteInner(props: NoteProps) {
|
||||
const { data: ev, related, highlight, options: opt, ignoreModeration = false, className } = props;
|
||||
|
||||
const baseClassName = `note card${className ? ` ${className}` : ""}`;
|
||||
const navigate = useNavigate();
|
||||
const [showReactions, setShowReactions] = useState(false);
|
||||
const deletions = useMemo(() => getReactions(related, ev.id, EventKind.Deletion), [related]);
|
||||
const { isEventMuted } = useModeration();
|
||||
const { ref, inView } = useInView({ triggerOnce: true });
|
||||
const login = useLogin();
|
||||
const { pinned, bookmarked } = login;
|
||||
const publisher = useEventPublisher();
|
||||
const [translated, setTranslated] = useState<NoteTranslation>();
|
||||
const { formatMessage } = useIntl();
|
||||
const reactions = useMemo(() => getReactions(related, ev.id, EventKind.Reaction), [related, ev]);
|
||||
const groupReactions = useMemo(() => {
|
||||
const result = reactions?.reduce(
|
||||
(acc, reaction) => {
|
||||
const kind = normalizeReaction(reaction.content);
|
||||
const rs = acc[kind] || [];
|
||||
return { ...acc, [kind]: [...rs, reaction] };
|
||||
},
|
||||
{
|
||||
[Reaction.Positive]: [] as TaggedNostrEvent[],
|
||||
[Reaction.Negative]: [] as TaggedNostrEvent[],
|
||||
},
|
||||
);
|
||||
return {
|
||||
[Reaction.Positive]: dedupeByPubkey(result[Reaction.Positive]),
|
||||
[Reaction.Negative]: dedupeByPubkey(result[Reaction.Negative]),
|
||||
};
|
||||
}, [reactions]);
|
||||
const positive = groupReactions[Reaction.Positive];
|
||||
const negative = groupReactions[Reaction.Negative];
|
||||
const reposts = useMemo(
|
||||
() =>
|
||||
dedupeByPubkey([
|
||||
...getReactions(related, ev.id, EventKind.TextNote).filter(e => e.tags.some(tagFilterOfTextRepost(e, ev.id))),
|
||||
...getReactions(related, ev.id, EventKind.Repost),
|
||||
]),
|
||||
[related, ev],
|
||||
);
|
||||
const zaps = useMemo(() => {
|
||||
const sortedZaps = getReactions(related, ev.id, EventKind.ZapReceipt)
|
||||
.map(a => parseZap(a, UserCache, ev))
|
||||
.filter(z => z.valid);
|
||||
sortedZaps.sort((a, b) => b.amount - a.amount);
|
||||
return sortedZaps;
|
||||
}, [related]);
|
||||
const totalReactions = positive.length + negative.length + reposts.length + zaps.length;
|
||||
|
||||
const options = {
|
||||
showHeader: true,
|
||||
showTime: true,
|
||||
showFooter: true,
|
||||
canUnpin: false,
|
||||
canUnbookmark: false,
|
||||
showContextMenu: true,
|
||||
...opt,
|
||||
};
|
||||
|
||||
async function unpin(id: HexKey) {
|
||||
if (options.canUnpin && publisher) {
|
||||
if (window.confirm(formatMessage(messages.ConfirmUnpin))) {
|
||||
const es = pinned.item.filter(e => e !== id);
|
||||
const ev = await publisher.noteList(es, Lists.Pinned);
|
||||
System.BroadcastEvent(ev);
|
||||
setPinned(login, es, ev.created_at * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function unbookmark(id: HexKey) {
|
||||
if (options.canUnbookmark && publisher) {
|
||||
if (window.confirm(formatMessage(messages.ConfirmUnbookmark))) {
|
||||
const es = bookmarked.item.filter(e => e !== id);
|
||||
const ev = await publisher.noteList(es, Lists.Bookmarked);
|
||||
System.BroadcastEvent(ev);
|
||||
setBookmarked(login, es, ev.created_at * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const innerContent = () => {
|
||||
if (ev.kind === EventKind.LongFormTextNote) {
|
||||
const title = findTag(ev, "title");
|
||||
const summary = findTag(ev, "simmary");
|
||||
const image = findTag(ev, "image");
|
||||
return (
|
||||
<div className="long-form-note">
|
||||
<h3>{title}</h3>
|
||||
<div className="text">
|
||||
<p>{summary}</p>
|
||||
<Text
|
||||
id={ev.id}
|
||||
content={ev.content}
|
||||
highlighText={props.searchedValue}
|
||||
tags={ev.tags}
|
||||
creator={ev.pubkey}
|
||||
depth={props.depth}
|
||||
truncate={255}
|
||||
disableLinkPreview={true}
|
||||
disableMediaSpotlight={!(props.options?.showMediaSpotlight ?? true)}
|
||||
/>
|
||||
{image && <ProxyImg src={image} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
const body = ev?.content ?? "";
|
||||
return (
|
||||
<Text
|
||||
id={ev.id}
|
||||
highlighText={props.searchedValue}
|
||||
content={body}
|
||||
tags={ev.tags}
|
||||
creator={ev.pubkey}
|
||||
depth={props.depth}
|
||||
disableMedia={!(options.showMedia ?? true)}
|
||||
disableMediaSpotlight={!(props.options?.showMediaSpotlight ?? true)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const transformBody = () => {
|
||||
if (deletions?.length > 0) {
|
||||
return (
|
||||
<b className="error">
|
||||
<FormattedMessage {...messages.Deleted} />
|
||||
</b>
|
||||
);
|
||||
}
|
||||
const contentWarning = ev.tags.find(a => a[0] === "content-warning");
|
||||
if (contentWarning) {
|
||||
return (
|
||||
<Reveal
|
||||
message={
|
||||
<>
|
||||
<FormattedMessage
|
||||
defaultMessage="The author has marked this note as a <i>sensitive topic</i>"
|
||||
values={{
|
||||
i: c => <i>{c}</i>,
|
||||
}}
|
||||
/>
|
||||
{contentWarning[1] && (
|
||||
<>
|
||||
|
||||
<FormattedMessage
|
||||
defaultMessage="Reason: <i>{reason}</i>"
|
||||
values={{
|
||||
i: c => <i>{c}</i>,
|
||||
reason: contentWarning[1],
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
<FormattedMessage defaultMessage="Click here to load anyway" />
|
||||
</>
|
||||
}>
|
||||
{innerContent()}
|
||||
</Reveal>
|
||||
);
|
||||
}
|
||||
return innerContent();
|
||||
};
|
||||
|
||||
function goToEvent(
|
||||
e: React.MouseEvent,
|
||||
eTarget: TaggedNostrEvent,
|
||||
isTargetAllowed: boolean = e.target === e.currentTarget,
|
||||
) {
|
||||
if (!isTargetAllowed || opt?.canClick === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
if (props.onClick) {
|
||||
props.onClick(eTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
const link = NostrLink.fromEvent(eTarget);
|
||||
// detect cmd key and open in new tab
|
||||
if (e.metaKey) {
|
||||
window.open(`/e/${link.encode()}`, "_blank");
|
||||
} else {
|
||||
navigate(`/e/${link.encode()}`, {
|
||||
state: eTarget,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function replyTag() {
|
||||
const thread = EventExt.extractThread(ev);
|
||||
if (thread === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const maxMentions = 2;
|
||||
const replyTo = thread?.replyTo ?? thread?.root;
|
||||
const replyLink = replyTo
|
||||
? NostrLink.fromTag(
|
||||
[replyTo.key, replyTo.value ?? "", replyTo.relay ?? "", replyTo.marker ?? ""].filter(a => a.length > 0),
|
||||
)
|
||||
: undefined;
|
||||
const mentions: { pk: string; name: string; link: ReactNode }[] = [];
|
||||
for (const pk of thread?.pubKeys ?? []) {
|
||||
const u = UserCache.getFromCache(pk);
|
||||
const npub = hexToBech32(NostrPrefix.PublicKey, pk);
|
||||
const shortNpub = npub.substring(0, 12);
|
||||
mentions.push({
|
||||
pk,
|
||||
name: u?.name ?? shortNpub,
|
||||
link: <Link to={profileLink(pk)}>{u?.name ? `@${u.name}` : shortNpub}</Link>,
|
||||
});
|
||||
}
|
||||
mentions.sort(a => (a.name.startsWith(NostrPrefix.PublicKey) ? 1 : -1));
|
||||
const othersLength = mentions.length - maxMentions;
|
||||
const renderMention = (m: { link: React.ReactNode; pk: string; name: string }, idx: number) => {
|
||||
return (
|
||||
<React.Fragment key={m.pk}>
|
||||
{idx > 0 && ", "}
|
||||
{m.link}
|
||||
</React.Fragment>
|
||||
);
|
||||
};
|
||||
const pubMentions =
|
||||
mentions.length > maxMentions ? mentions?.slice(0, maxMentions).map(renderMention) : mentions?.map(renderMention);
|
||||
const others = mentions.length > maxMentions ? formatMessage(messages.Others, { n: othersLength }) : "";
|
||||
return (
|
||||
<div className="reply">
|
||||
re:
|
||||
{(mentions?.length ?? 0) > 0 ? (
|
||||
<>
|
||||
{pubMentions} {others}
|
||||
</>
|
||||
) : (
|
||||
replyLink && <Link to={`/e/${replyLink.encode()}`}>{replyLink.encode().substring(0, 12)}</Link>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const canRenderAsTextNote = [EventKind.TextNote, EventKind.Polls, EventKind.LongFormTextNote];
|
||||
if (!canRenderAsTextNote.includes(ev.kind)) {
|
||||
const alt = findTag(ev, "alt");
|
||||
if (alt) {
|
||||
return (
|
||||
<div className="note-quote">
|
||||
<Text id={ev.id} content={alt} tags={[]} creator={ev.pubkey} />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<h4>
|
||||
<FormattedMessage {...messages.UnknownEventKind} values={{ kind: ev.kind }} />
|
||||
</h4>
|
||||
<pre>{JSON.stringify(ev, undefined, " ")}</pre>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function translation() {
|
||||
if (translated && translated.confidence > 0.5) {
|
||||
return (
|
||||
<>
|
||||
<p className="highlight">
|
||||
<FormattedMessage {...messages.TranslatedFrom} values={{ lang: translated.fromLanguage }} />
|
||||
</p>
|
||||
{translated.text}
|
||||
</>
|
||||
);
|
||||
} else if (translated) {
|
||||
return (
|
||||
<p className="highlight">
|
||||
<FormattedMessage {...messages.TranslationFailed} />
|
||||
</p>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function pollOptions() {
|
||||
if (ev.kind !== EventKind.Polls) return;
|
||||
|
||||
return <Poll ev={ev} zaps={zaps} />;
|
||||
}
|
||||
|
||||
function content() {
|
||||
if (!inView) return undefined;
|
||||
return (
|
||||
<>
|
||||
{options.showHeader && (
|
||||
<div className="header flex">
|
||||
<ProfileImage
|
||||
pubkey={ev.pubkey}
|
||||
subHeader={replyTag() ?? undefined}
|
||||
link={opt?.canClick === undefined ? undefined : ""}
|
||||
/>
|
||||
<div className="info">
|
||||
{(options.showTime || options.showBookmarked) && (
|
||||
<>
|
||||
{options.showBookmarked && (
|
||||
<div
|
||||
className={`saved ${options.canUnbookmark ? "pointer" : ""}`}
|
||||
onClick={() => unbookmark(ev.id)}>
|
||||
<Icon name="bookmark" /> <FormattedMessage {...messages.Bookmarked} />
|
||||
</div>
|
||||
)}
|
||||
{!options.showBookmarked && <NoteTime from={ev.created_at * 1000} />}
|
||||
</>
|
||||
)}
|
||||
{options.showPinned && (
|
||||
<div className={`pinned ${options.canUnpin ? "pointer" : ""}`} onClick={() => unpin(ev.id)}>
|
||||
<Icon name="pin" /> <FormattedMessage {...messages.Pinned} />
|
||||
</div>
|
||||
)}
|
||||
{options.showContextMenu && (
|
||||
<NoteContextMenu
|
||||
ev={ev}
|
||||
react={async () => {}}
|
||||
onTranslated={t => setTranslated(t)}
|
||||
setShowReactions={setShowReactions}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="body" onClick={e => goToEvent(e, ev, true)}>
|
||||
{transformBody()}
|
||||
{translation()}
|
||||
{pollOptions()}
|
||||
{options.showReactionsLink && (
|
||||
<div className="reactions-link" onClick={() => setShowReactions(true)}>
|
||||
<FormattedMessage {...messages.ReactionsLink} values={{ n: totalReactions }} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{options.showFooter && <NoteFooter ev={ev} positive={positive} reposts={reposts} zaps={zaps} />}
|
||||
<Reactions
|
||||
show={showReactions}
|
||||
setShow={setShowReactions}
|
||||
positive={positive}
|
||||
negative={negative}
|
||||
reposts={reposts}
|
||||
zaps={zaps}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const note = (
|
||||
<div className={`${baseClassName}${highlight ? " active " : " "}`} onClick={e => goToEvent(e, ev)} ref={ref}>
|
||||
{content()}
|
||||
</div>
|
||||
);
|
||||
|
||||
return !ignoreModeration && isEventMuted(ev) ? <HiddenNote>{note}</HiddenNote> : note;
|
||||
}
|
@ -4,7 +4,7 @@ import { useMemo } from "react";
|
||||
import { EventKind, NostrEvent, TaggedNostrEvent, NostrPrefix, EventExt } from "@snort/system";
|
||||
|
||||
import Note from "Element/Event/Note";
|
||||
import { getDisplayName } from "Element/User/ProfileImage";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
import { eventLink, hexToBech32 } from "SnortUtils";
|
||||
import useModeration from "Hooks/useModeration";
|
||||
import FormattedMessage from "Element/FormattedMessage";
|
||||
|
@ -5,6 +5,7 @@ export interface ModalProps {
|
||||
id: string;
|
||||
className?: string;
|
||||
onClose?: (e: React.MouseEvent | KeyboardEvent) => void;
|
||||
onClick?: (e: React.MouseEvent) => void;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
@ -28,7 +29,13 @@ export default function Modal(props: ModalProps) {
|
||||
return (
|
||||
<div className={`modal${props.className ? ` ${props.className}` : ""}`} onClick={props.onClose}>
|
||||
<div className="modal-body" onClick={props.onClose}>
|
||||
<div onClick={e => e.stopPropagation()}>{props.children}</div>
|
||||
<div
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
props.onClick?.(e);
|
||||
}}>
|
||||
{props.children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
1835
packages/app/src/Element/User/AnimalName.ts
Normal file
1835
packages/app/src/Element/User/AnimalName.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -39,14 +39,3 @@
|
||||
transform-origin: center;
|
||||
transform: rotate(-135deg) translateY(50%);
|
||||
}
|
||||
|
||||
.avatar .icons > .icon-circle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform-origin: center;
|
||||
padding: 4px;
|
||||
border-radius: 100%;
|
||||
background-color: var(--gray-superdark);
|
||||
transform: rotate(135deg);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { CSSProperties, ReactNode, useEffect, useState } from "react";
|
||||
import type { UserMetadata } from "@snort/system";
|
||||
|
||||
import useImgProxy from "Hooks/useImgProxy";
|
||||
import { getDisplayName } from "Element/User/ProfileImage";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
import { defaultAvatar } from "SnortUtils";
|
||||
|
||||
interface AvatarProps {
|
||||
|
3
packages/app/src/Element/User/DisplayName.css
Normal file
3
packages/app/src/Element/User/DisplayName.css
Normal file
@ -0,0 +1,3 @@
|
||||
.placeholder {
|
||||
color: var(--gray-light);
|
||||
}
|
39
packages/app/src/Element/User/DisplayName.tsx
Normal file
39
packages/app/src/Element/User/DisplayName.tsx
Normal file
@ -0,0 +1,39 @@
|
||||
import "./DisplayName.css";
|
||||
|
||||
import React, { useMemo } from "react";
|
||||
import { HexKey, UserMetadata, NostrPrefix } from "@snort/system";
|
||||
import AnimalName from "Element/User/AnimalName";
|
||||
import { hexToBech32 } from "SnortUtils";
|
||||
|
||||
interface DisplayNameProps {
|
||||
pubkey: HexKey;
|
||||
user: UserMetadata | undefined;
|
||||
}
|
||||
|
||||
export function getDisplayName(user: UserMetadata | undefined, pubkey: HexKey): string {
|
||||
return getDisplayNameOrPlaceHolder(user, pubkey)[0];
|
||||
}
|
||||
|
||||
export function getDisplayNameOrPlaceHolder(user: UserMetadata | undefined, pubkey: HexKey): [string, boolean] {
|
||||
let name = hexToBech32(NostrPrefix.PublicKey, pubkey).substring(0, 12);
|
||||
let isPlaceHolder = false;
|
||||
|
||||
if (typeof user?.display_name === "string" && user.display_name.length > 0) {
|
||||
name = user.display_name;
|
||||
} else if (typeof user?.name === "string" && user.name.length > 0) {
|
||||
name = user.name;
|
||||
} else if (pubkey && process.env.ANIMAL_NAME_PLACEHOLDERS) {
|
||||
name = AnimalName(pubkey);
|
||||
isPlaceHolder = true;
|
||||
}
|
||||
|
||||
return [name.trim(), isPlaceHolder];
|
||||
}
|
||||
|
||||
const DisplayName = ({ pubkey, user }: DisplayNameProps) => {
|
||||
const [name, isPlaceHolder] = useMemo(() => getDisplayNameOrPlaceHolder(user, pubkey), [user, pubkey]);
|
||||
|
||||
return <span className={isPlaceHolder ? "placeholder" : ""}>{name}</span>;
|
||||
};
|
||||
|
||||
export default DisplayName;
|
@ -13,7 +13,6 @@
|
||||
height: 48px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
a.pfp {
|
||||
@ -33,3 +32,14 @@ a.pfp {
|
||||
.pfp a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.pfp .icon-circle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform-origin: center;
|
||||
padding: 4px;
|
||||
border-radius: 100%;
|
||||
background-color: var(--gray-superdark);
|
||||
transform: rotate(135deg);
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
import "./ProfileImage.css";
|
||||
|
||||
import React, { ReactNode, useMemo } from "react";
|
||||
import React, { ReactNode } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { HexKey, NostrPrefix, UserMetadata } from "@snort/system";
|
||||
import { HexKey, UserMetadata } from "@snort/system";
|
||||
import { useUserProfile } from "@snort/system-react";
|
||||
|
||||
import { hexToBech32, profileLink } from "SnortUtils";
|
||||
import { profileLink } from "SnortUtils";
|
||||
import Avatar from "Element/User/Avatar";
|
||||
import Nip05 from "Element/User/Nip05";
|
||||
import useLogin from "Hooks/useLogin";
|
||||
import Icon from "Icons/Icon";
|
||||
import DisplayName from "./DisplayName";
|
||||
|
||||
export interface ProfileImageProps {
|
||||
pubkey: HexKey;
|
||||
@ -49,10 +50,6 @@ export default function ProfileImage({
|
||||
const { follows } = useLogin();
|
||||
const doesFollow = follows.item.includes(pubkey);
|
||||
|
||||
const name = useMemo(() => {
|
||||
return overrideUsername ?? getDisplayName(user, pubkey);
|
||||
}, [user, pubkey, overrideUsername]);
|
||||
|
||||
function handleClick(e: React.MouseEvent) {
|
||||
if (link === "") {
|
||||
e.preventDefault();
|
||||
@ -86,7 +83,7 @@ export default function ProfileImage({
|
||||
{showUsername && (
|
||||
<div className="f-ellipsis">
|
||||
<div className="flex g4 username">
|
||||
<div>{name.trim()}</div>
|
||||
{overrideUsername ? overrideUsername : <DisplayName pubkey={pubkey} user={user} />}
|
||||
{nip05 && <Nip05 nip05={nip05} pubkey={pubkey} verifyNip={verifyNip} />}
|
||||
</div>
|
||||
<div className="subheader">{subHeader}</div>
|
||||
@ -113,13 +110,3 @@ export default function ProfileImage({
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function getDisplayName(user: UserMetadata | undefined, pubkey: HexKey) {
|
||||
let name = hexToBech32(NostrPrefix.PublicKey, pubkey).substring(0, 12);
|
||||
if (typeof user?.display_name === "string" && user.display_name.length > 0) {
|
||||
name = user.display_name;
|
||||
} else if (typeof user?.name === "string" && user.name.length > 0) {
|
||||
name = user.name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ interface Newest<T> {
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
export enum LoginSessionType {
|
||||
export const enum LoginSessionType {
|
||||
PrivateKey = "private_key",
|
||||
PublicKey = "public_key",
|
||||
Nip7 = "nip7",
|
||||
|
@ -1,7 +1,3 @@
|
||||
import DnsOverHttpResolver from "dns-over-http-resolver";
|
||||
import { bech32ToHex } from "SnortUtils";
|
||||
|
||||
const resolver = new DnsOverHttpResolver();
|
||||
interface NostrJson {
|
||||
names: Record<string, string>;
|
||||
}
|
||||
@ -23,12 +19,5 @@ export async function fetchNip05Pubkey(name: string, domain: string, timeout = 2
|
||||
// ignored
|
||||
}
|
||||
|
||||
// Check as DoH TXT entry
|
||||
try {
|
||||
const resDns = await resolver.resolveTxt(`${name}._nostr.${domain}`);
|
||||
return bech32ToHex(resDns[0][0]);
|
||||
} catch {
|
||||
// ignored
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { TaggedNostrEvent, EventKind, MetadataCache } from "@snort/system";
|
||||
import { getDisplayName } from "Element/User/ProfileImage";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
import { MentionRegex } from "Const";
|
||||
import { defaultAvatar, tagFilterOfTextRepost, unwrap } from "SnortUtils";
|
||||
import { UserCache } from "Cache";
|
||||
|
@ -1,12 +1,7 @@
|
||||
import FormattedMessage from "@snort/app/src/Element/FormattedMessage";
|
||||
|
||||
/*
|
||||
import { IrisHost } from "Const";
|
||||
import Nip5Service from "Element/Nip5Service";
|
||||
*/
|
||||
|
||||
import messages from "./messages";
|
||||
import IrisAccount from "../Element/IrisAccount/IrisAccount";
|
||||
import IrisAccount from "Element/IrisAccount/IrisAccount";
|
||||
|
||||
export default function FreeNostrAddressPage() {
|
||||
return (
|
||||
|
@ -7,7 +7,7 @@ import { NostrLink, NostrPrefix, TLVEntryType, UserMetadata, decodeTLV } from "@
|
||||
import { useUserProfile, useUserSearch } from "@snort/system-react";
|
||||
|
||||
import UnreadCount from "Element/UnreadCount";
|
||||
import ProfileImage, { getDisplayName } from "Element/User/ProfileImage";
|
||||
import ProfileImage from "Element/User/ProfileImage";
|
||||
import { appendDedupe, debounce, parseId } from "SnortUtils";
|
||||
import NoteToSelf from "Element/User/NoteToSelf";
|
||||
import useModeration from "Hooks/useModeration";
|
||||
@ -25,6 +25,7 @@ import { useEventFeed } from "Feed/EventFeed";
|
||||
import { LoginSession, LoginStore } from "Login";
|
||||
import { Nip28ChatSystem } from "chat/nip28";
|
||||
import { ChatParticipantProfile } from "Element/Chat/ChatParticipant";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
|
||||
const TwoCol = 768;
|
||||
const ThreeCol = 1500;
|
||||
|
@ -12,13 +12,14 @@ import { markNotificationsRead } from "Login";
|
||||
import { Notifications, UserCache } from "Cache";
|
||||
import { dedupe, findTag, orderDescending } from "SnortUtils";
|
||||
import Icon from "Icons/Icon";
|
||||
import ProfileImage, { getDisplayName } from "Element/User/ProfileImage";
|
||||
import ProfileImage from "Element/User/ProfileImage";
|
||||
import useModeration from "Hooks/useModeration";
|
||||
import { useEventFeed } from "Feed/EventFeed";
|
||||
import Text from "Element/Text";
|
||||
import { formatShort } from "Number";
|
||||
import { LiveEvent } from "Element/LiveEvent";
|
||||
import ProfilePreview from "Element/User/ProfilePreview";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
|
||||
function notificationContext(ev: TaggedNostrEvent) {
|
||||
switch (ev.kind) {
|
||||
|
@ -58,7 +58,7 @@ import { ZapTarget } from "Zapper";
|
||||
import { useStatusFeed } from "Feed/StatusFeed";
|
||||
|
||||
import messages from "./messages";
|
||||
import { SpotlightMediaModal } from "../Element/Deck/SpotlightMedia";
|
||||
import { SpotlightMediaModal } from "Element/Deck/SpotlightMedia";
|
||||
|
||||
const NOTES = 0;
|
||||
const REACTIONS = 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { UserCache } from "Cache";
|
||||
import { getDisplayName } from "Element/User/ProfileImage";
|
||||
import { getDisplayName } from "Element/User/DisplayName";
|
||||
import { LNURL, ExternalStore, unixNow } from "@snort/shared";
|
||||
import { Toastore } from "Toaster";
|
||||
import { LNWallet, WalletInvoiceState, Wallets } from "Wallet";
|
||||
|
@ -2,7 +2,6 @@ import { bytesToHex } from "@noble/hashes/utils";
|
||||
import { DefaultQueryOptimizer, EventExt, FlatReqFilter, PowMiner, QueryOptimizer, ReqFilter } from "@snort/system";
|
||||
import { compress, expand_filter, flat_merge, get_diff, pow, default as wasmInit } from "@snort/system-wasm";
|
||||
import WasmPath from "@snort/system-wasm/pkg/system_wasm_bg.wasm";
|
||||
import { Bench } from "tinybench";
|
||||
|
||||
const WasmQueryOptimizer = {
|
||||
expandFilter: (f: ReqFilter) => {
|
||||
@ -87,10 +86,17 @@ const testCompress = (q: QueryOptimizer) => {
|
||||
]);
|
||||
};
|
||||
|
||||
const runAll = async () => {
|
||||
await wasmInit(WasmPath);
|
||||
|
||||
const tinybench = await import("tinybench");
|
||||
|
||||
const { Bench } = tinybench;
|
||||
const wasmSuite = new Bench({ time: 1_000 });
|
||||
const suite = new Bench({ time: 1_000 });
|
||||
|
||||
const addTests = (s: Bench, q: QueryOptimizer, p: PowMiner) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const addTests = (s: any, q: QueryOptimizer, p: PowMiner) => {
|
||||
s.add("expand", () => testExpand(q));
|
||||
s.add("get_diff", () => testGetDiff(q));
|
||||
s.add("flat_merge", () => testFlatMerge(q));
|
||||
@ -120,9 +126,6 @@ addTests(wasmSuite, WasmQueryOptimizer, {
|
||||
},
|
||||
});
|
||||
|
||||
const runAll = async () => {
|
||||
await wasmInit(WasmPath);
|
||||
|
||||
console.log("DefaultQueryOptimizer");
|
||||
await suite.run();
|
||||
console.table(suite.table());
|
||||
|
@ -67,13 +67,13 @@
|
||||
"6/hB3S": "Wiederholung anschauen",
|
||||
"65BmHb": "Bild von {host} konnte nicht durch Proxy geladen werden, klicke hier, um es direkt zu laden",
|
||||
"6OSOXl": "Grund: <i>{reason}</i>",
|
||||
"6TfgXX": "{site} is an open source project built by passionate people in their free time",
|
||||
"6TfgXX": "{site} ist ein Open-Source-Projekt, das von leidenschaftlichen Menschen in ihrer Freizeit entwickelt wird",
|
||||
"6Yfvvp": "Bekomme eine Identifikation",
|
||||
"6bgpn+": "Nicht alle Clients unterstützen dies, deshalb kann es sein, dass du immer noch einige Zaps erhältst, als ob Zap-Aufteilungen nicht konfiguriert wäre",
|
||||
"6ewQqw": "Gefällt ({n})",
|
||||
"6uMqL1": "Nicht bezahlt",
|
||||
"7+Domh": "Notes",
|
||||
"7/h1jn": "After submitting the pin there may be a slight delay as we encrypt the key.",
|
||||
"7/h1jn": "Nach dem Übermitteln des PINs kann es zu einer leichten Wartezeit zur Verschlüsselung des Schlüssels kommen.",
|
||||
"7BX/yC": "Konto wechseln",
|
||||
"7hp70g": "NIP-05",
|
||||
"8/vBbP": "Reposts ({n})",
|
||||
@ -116,7 +116,7 @@
|
||||
"CHTbO3": "Lightning Zahlungsanforderung konnte nicht geladen werden",
|
||||
"CVWeJ6": "Angesagte Personen",
|
||||
"CmZ9ls": "{n} Stummgeschaltet",
|
||||
"CoVXRS": "Alternatively, you may choose to store your private key without a PIN by selecting 'Cancel.'",
|
||||
"CoVXRS": "Alternativ kannst du deinen privaten Schlüssel ohne PIN speichern, indem durch \"Abbrechen\" wählst.",
|
||||
"CsCUYo": "{n} sats",
|
||||
"Cu/K85": "Übersetzt von {lang}",
|
||||
"D+KzKd": "Automatisch jede Note beim Laden zappen",
|
||||
@ -225,14 +225,14 @@
|
||||
"OQSOJF": "Kostenlose Nostr-Adresse erhalten",
|
||||
"OQXnew": "Dein Abonnement ist noch aktiv, du kannst es noch nicht erneuern",
|
||||
"ORGv1Q": "Erstellt",
|
||||
"Oq/kVn": "Name-squatting and impersonation is not allowed. {site} and our partners reserve the right to terminate your handle (not your account - nobody can take that away) for violating this rule.",
|
||||
"P/xrLk": "Secure your private key with a PIN, ensuring enhanced protection on {site}. You'll be prompted to enter this PIN each time you access the site.",
|
||||
"Oq/kVn": "Namens-Squatting und Imitation sind nicht erlaubt. {site} und unsere Partner behalten sich das Recht vor, dein Handle (nicht dein Konto - das kann dir niemand entziehen) bei Verstößen gegen diese Regel zu löschen.",
|
||||
"P/xrLk": "Sichere deinen privaten Schlüssel mit einer PIN, um einen besseren Schutz auf {site} zu gewährleisten. Bei jedem Zugriff auf die Website wirst du aufgefordert, diese PIN einzugeben.",
|
||||
"P61BTu": "Event JSON kopieren",
|
||||
"P7FD0F": "System (Standard)",
|
||||
"P7nJT9": "Gesamt heute (UTC): {amount} sats",
|
||||
"PCSt5T": "Einstellungen",
|
||||
"PLSbmL": "Ihre mnemonische Passphrase",
|
||||
"PaN7t3": "Preview on {site}",
|
||||
"PaN7t3": "Vorschau auf {site}",
|
||||
"PamNxw": "Unbekannter Datei-Header: {name}",
|
||||
"Pe0ogR": "Erscheinungsbild",
|
||||
"PrsIg7": "Reaktionen werden auf jeder Seite angezeigt, wenn Reaktionen deaktiviert sind, werden sie nicht angezeigt",
|
||||
@ -252,7 +252,7 @@
|
||||
"RoOyAh": "Relais",
|
||||
"Rs4kCE": "Lesezeichen",
|
||||
"RwFaYs": "Sortieren",
|
||||
"SLZGPn": "Enter a pin to encrypt your private key, you must enter this pin every time you open {site}.",
|
||||
"SLZGPn": "Gib eine PIN ein, um deinen privaten Schlüssel zu verschlüsseln. Du musst diese PIN jedes Mal eingeben, wenn du {site} öffnest.",
|
||||
"SMO+on": "Zap an {name} senden",
|
||||
"SOqbe9": "Lightning-Adresse aktualisieren",
|
||||
"SP0+yi": "Abonnement kaufen",
|
||||
@ -336,7 +336,7 @@
|
||||
"eSzf2G": "Ein einzelner Zap von {nIn} sats wird {nOut} sats dem Zap Pool zuweisen.",
|
||||
"eXT2QQ": "Gruppenchat",
|
||||
"fBI91o": "Zap",
|
||||
"fBlba3": "Thanks for using {site}, please consider donating if you can.",
|
||||
"fBlba3": "Danke für die Verwendung von {site}. Wir würden uns über eine Spende freuen.",
|
||||
"fOksnD": "Abstimmung nicht möglich, da der LNURL-Dienst keine Zaps unterstützt",
|
||||
"fWZYP5": "Angeheftet",
|
||||
"filwqD": "Lesen",
|
||||
@ -378,7 +378,7 @@
|
||||
"k7sKNy": "Unser eigener NIP-05-Verifizierungsdienst unterstützt die Entwicklung dieser Website. Unterstütze uns und erhalte ein Abzeichen auf unserer Seite!",
|
||||
"kEZUR8": "Iris-Benutzernamen registrieren",
|
||||
"kJYo0u": "{n,plural,=0{{name} hat gerepostet} other{{name} & {n} andere haben gerepostet}}",
|
||||
"kTLGM2": "{site} is designed to have a similar experience to Twitter.",
|
||||
"kTLGM2": "{site} ist so gestaltet, dass es eine Twitter-ähnliche Erfahrung bietet.",
|
||||
"kaaf1E": "jetzt",
|
||||
"kuPHYE": "{n,plural,=0{{name} gefällt das} other{{name} & {n} anderen gefällt das}}",
|
||||
"l+ikU1": "Alles aus {plan}",
|
||||
@ -387,7 +387,7 @@
|
||||
"lD3+8a": "Bezahlen",
|
||||
"lPWASz": "Snort Nostr-Adresse",
|
||||
"lTbT3s": "Wallet Passwort",
|
||||
"lVKH7C": "What is {site} and how does it work?",
|
||||
"lVKH7C": "Was ist {site} und wie funktioniert es?",
|
||||
"lgg1KN": "Kontoseite",
|
||||
"ll3xBp": "Bildproxy-Dienst",
|
||||
"lnaT9F": "Folgt {n}",
|
||||
@ -406,7 +406,7 @@
|
||||
"nN9XTz": "Teile deine Gedanken mit {link}",
|
||||
"nOaArs": "Profil einrichten",
|
||||
"nWQFic": "Erneuern",
|
||||
"ncbgUU": "{site} is a Nostr UI, nostr is a decentralised protocol for saving and distributing \"notes\".",
|
||||
"ncbgUU": "{site} ist eine Nostr-Benutzeroberfläche. Nostr ist ein dezentrales Protokoll zum Speichern und Verteilen von \"Notes\".",
|
||||
"nn1qb3": "Deine Spenden werden sehr geschätzt",
|
||||
"nwZXeh": "{n} blockiert",
|
||||
"o6Uy3d": "Nur der Privatschlüssel kann genutzt werden um zu veröffentlichen (Events signieren), alles andere wird im schreibgeschützten Modus geladen.",
|
||||
@ -484,7 +484,7 @@
|
||||
"y1Z3or": "Sprache",
|
||||
"yCLnBC": "LNURL oder Lightning-Adresse",
|
||||
"yCmnnm": "Global lesen von",
|
||||
"yNBPJp": "Help fund the development of {site}",
|
||||
"yNBPJp": "Unterstütze die Entwicklung von {site}",
|
||||
"zCb8fX": "Gewichtung",
|
||||
"zFegDD": "Kontakt",
|
||||
"zINlao": "Eigentümer",
|
||||
|
@ -1,16 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"target": "es2020",
|
||||
"module": "es2020",
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"jsx": "react-jsx",
|
||||
"moduleResolution": "node",
|
||||
"moduleResolution": "Bundler",
|
||||
"sourceMap": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowJs": true
|
||||
"allowSyntheticDefaultImports": true
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,8 @@ const config = {
|
||||
"process.env.APP_NAME": JSON.stringify(appConfig.get("appName")),
|
||||
"process.env.APP_NAME_CAPITALIZED": JSON.stringify(appConfig.get("appNameCapitalized")),
|
||||
"process.env.NIP05_DOMAIN": JSON.stringify(appConfig.get("nip05Domain")),
|
||||
"process.env.HTTP_CACHE": JSON.stringify(appConfig.get("httpCache")),
|
||||
"process.env.ANIMAL_NAME_PLACEHOLDERS": JSON.stringify(appConfig.get("animalNamePlaceholders")),
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
|
@ -15,7 +15,6 @@
|
||||
"@noble/hashes": "^1.3.2",
|
||||
"@scure/base": "^1.1.2",
|
||||
"debug": "^4.3.4",
|
||||
"dexie": "^3.2.4",
|
||||
"light-bolt11-decoder": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
87
packages/shared/src/dexie-like.ts
Normal file
87
packages/shared/src/dexie-like.ts
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Dexie proxy type
|
||||
*/
|
||||
export abstract class DexieLike {
|
||||
constructor(name: string) {}
|
||||
version(n: number) {
|
||||
return {
|
||||
stores(schema: object) {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export type DexieIndexableTypePart =
|
||||
| string
|
||||
| number
|
||||
| Date
|
||||
| ArrayBuffer
|
||||
| ArrayBufferView
|
||||
| DataView
|
||||
| Array<Array<void>>;
|
||||
export type DexieIndexableTypeArray = Array<DexieIndexableTypePart>;
|
||||
export type DexieIndexableTypeArrayReadonly = ReadonlyArray<DexieIndexableTypePart>;
|
||||
export type DexieIndexableType = DexieIndexableTypePart | DexieIndexableTypeArrayReadonly;
|
||||
|
||||
export interface DexiePromiseExtended<T = any> extends Promise<T> {
|
||||
then<TResult1 = T, TResult2 = never>(
|
||||
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
|
||||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
|
||||
): DexiePromiseExtended<TResult1 | TResult2>;
|
||||
catch<TResult = never>(
|
||||
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
|
||||
): DexiePromiseExtended<T | TResult>;
|
||||
catch<TResult = never>(
|
||||
ErrorConstructor: Function,
|
||||
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
|
||||
): DexiePromiseExtended<T | TResult>;
|
||||
catch<TResult = never>(
|
||||
errorName: string,
|
||||
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
|
||||
): DexiePromiseExtended<T | TResult>;
|
||||
finally<U>(onFinally?: () => U | PromiseLike<U>): DexiePromiseExtended<T>;
|
||||
timeout(ms: number, msg?: string): DexiePromiseExtended<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dexie Table<T> like structure
|
||||
*/
|
||||
export interface DexieTableLike<T = any, TKey = DexieIndexableType> {
|
||||
toCollection(): {
|
||||
get primaryKeys(): {
|
||||
(): DexiePromiseExtended<Array<TKey>>;
|
||||
<R>(thenShortcut: DexieThenShortcut<Array<TKey>, R>): DexiePromiseExtended<R>;
|
||||
};
|
||||
};
|
||||
get(key: TKey): DexiePromiseExtended<T | undefined>;
|
||||
bulkGet(keys: Array<TKey>): DexiePromiseExtended<Array<T | undefined>>;
|
||||
put(item: T, key?: TKey): DexiePromiseExtended<TKey>;
|
||||
bulkPut(
|
||||
items: readonly T[],
|
||||
keys?: DexieIndexableTypeArrayReadonly,
|
||||
options?: {
|
||||
allKeys: boolean;
|
||||
},
|
||||
): DexiePromiseExtended<TKey>;
|
||||
clear(): DexiePromiseExtended<void>;
|
||||
where(index: string | string[]): DexieWhereClause<T, TKey>;
|
||||
toArray(): DexiePromiseExtended<Array<T>>;
|
||||
orderBy(index: string | string[]): DexieCollection<T, TKey>;
|
||||
}
|
||||
|
||||
export interface DexieCollection<T = any, TKey = DexieIndexableType> {
|
||||
first(): DexiePromiseExtended<T | undefined>;
|
||||
or(indexOrPrimayKey: string): DexieWhereClause<T, TKey>;
|
||||
toArray(): DexiePromiseExtended<Array<T>>;
|
||||
reverse(): DexieCollection<T, TKey>;
|
||||
sortBy(keyPath: string): DexiePromiseExtended<T[]>;
|
||||
limit(n: number): DexieCollection<T, TKey>;
|
||||
delete(): DexiePromiseExtended<number>;
|
||||
}
|
||||
|
||||
export interface DexieWhereClause<T = any, TKey = DexieIndexableType> {
|
||||
startsWithIgnoreCase(key: string): DexieCollection<T, TKey>;
|
||||
below(key: any): DexieCollection<T, TKey>;
|
||||
between(lower: any, upper: any, includeLower?: boolean, includeUpper?: boolean): DexieCollection<T, TKey>;
|
||||
}
|
||||
|
||||
export type DexieThenShortcut<T, TResult> = (value: T) => TResult | PromiseLike<TResult>;
|
@ -1,6 +1,6 @@
|
||||
import debug from "debug";
|
||||
import { Table } from "dexie";
|
||||
import { unixNowMs, unwrap } from "./utils";
|
||||
import { DexieTableLike } from "./dexie-like";
|
||||
|
||||
type HookFn = () => void;
|
||||
|
||||
@ -19,11 +19,11 @@ export abstract class FeedCache<TCached> {
|
||||
#changed = true;
|
||||
#hits = 0;
|
||||
#miss = 0;
|
||||
protected table?: Table<TCached>;
|
||||
protected table?: DexieTableLike<TCached>;
|
||||
protected onTable: Set<string> = new Set();
|
||||
protected cache: Map<string, TCached> = new Map();
|
||||
|
||||
constructor(name: string, table?: Table<TCached>) {
|
||||
constructor(name: string, table?: DexieTableLike<TCached>) {
|
||||
this.#name = name;
|
||||
this.table = table;
|
||||
setInterval(() => {
|
||||
|
@ -4,3 +4,4 @@ export * from "./utils";
|
||||
export * from "./work-queue";
|
||||
export * from "./feed-cache";
|
||||
export * from "./invoices";
|
||||
export * from "./dexie-like";
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"target": "ES2020",
|
||||
"moduleResolution": "node",
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"noImplicitOverride": true,
|
||||
"module": "CommonJS",
|
||||
"module": "NodeNext",
|
||||
"strict": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
@ -13,6 +13,6 @@
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"include": ["src/**/*.ts", "src/.d.ts"],
|
||||
"files": ["src/index.ts"]
|
||||
}
|
||||
|
@ -11,6 +11,24 @@ export function useUserProfile(pubKey?: HexKey): MetadataCache | undefined {
|
||||
h => {
|
||||
if (pubKey) {
|
||||
system.ProfileLoader.TrackMetadata(pubKey);
|
||||
if (process.env.HTTP_CACHE && !system.ProfileLoader.Cache.getFromCache(pubKey)) {
|
||||
fetch(`${process.env.HTTP_CACHE}/profile/${pubKey}`)
|
||||
.then(async r => {
|
||||
if (r.ok) {
|
||||
try {
|
||||
const data = await r.json();
|
||||
if (data) {
|
||||
system.ProfileLoader.onProfileEvent(data);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
const release = system.ProfileLoader.Cache.hook(h, pubKey);
|
||||
return () => {
|
||||
|
@ -1,11 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"target": "ES2020",
|
||||
"moduleResolution": "node",
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"esModuleInterop": true,
|
||||
"noImplicitOverride": true,
|
||||
"module": "CommonJS",
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"declaration": true,
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"target": "ES2020",
|
||||
"moduleResolution": "node",
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"noImplicitOverride": true,
|
||||
"module": "CommonJS",
|
||||
"module": "NodeNext",
|
||||
"strict": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
|
@ -36,7 +36,6 @@
|
||||
"@snort/shared": "^1.0.6",
|
||||
"@stablelib/xchacha20": "^1.0.1",
|
||||
"debug": "^4.3.4",
|
||||
"dexie": "^3.2.4",
|
||||
"isomorphic-ws": "^5.0.0",
|
||||
"uuid": "^9.0.0",
|
||||
"ws": "^8.14.0"
|
||||
|
14
packages/system/src/cache/db.ts
vendored
14
packages/system/src/cache/db.ts
vendored
@ -1,6 +1,6 @@
|
||||
import { DexieLike, DexieTableLike } from "@snort/shared";
|
||||
import { MetadataCache, RelayMetrics, UsersRelays } from ".";
|
||||
import { NostrEvent } from "../nostr";
|
||||
import Dexie, { Table } from "dexie";
|
||||
|
||||
const NAME = "snort-system";
|
||||
const VERSION = 2;
|
||||
@ -12,13 +12,13 @@ const STORES = {
|
||||
events: "++id, pubkey, created_at",
|
||||
};
|
||||
|
||||
export class SnortSystemDb extends Dexie {
|
||||
export class SnortSystemDb extends DexieLike {
|
||||
ready = false;
|
||||
users!: Table<MetadataCache>;
|
||||
relayMetrics!: Table<RelayMetrics>;
|
||||
userRelays!: Table<UsersRelays>;
|
||||
events!: Table<NostrEvent>;
|
||||
dms!: Table<NostrEvent>;
|
||||
users!: DexieTableLike<MetadataCache>;
|
||||
relayMetrics!: DexieTableLike<RelayMetrics>;
|
||||
userRelays!: DexieTableLike<UsersRelays>;
|
||||
events!: DexieTableLike<NostrEvent>;
|
||||
dms!: DexieTableLike<NostrEvent>;
|
||||
|
||||
constructor() {
|
||||
super(NAME);
|
||||
|
@ -344,7 +344,7 @@ export class Connection extends ExternalStore<ConnectionStateSnapshot> {
|
||||
|
||||
#sendJson(obj: object) {
|
||||
const authPending = !this.Authed && (this.AwaitingAuth.size > 0 || this.Info?.limitation?.auth_required === true);
|
||||
if (this.Socket?.readyState !== WebSocket.OPEN || authPending) {
|
||||
if (!this.Socket || this.Socket?.readyState !== WebSocket.OPEN || authPending) {
|
||||
this.PendingRaw.push(obj);
|
||||
if (this.Socket?.readyState === WebSocket.CLOSED && this.Ephemeral && this.IsClosed) {
|
||||
this.Connect();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { schnorr, secp256k1 } from "@noble/curves/secp256k1";
|
||||
import { Nip4WebCryptoEncryptor } from "../src/impl/nip4";
|
||||
import { Nip44Encryptor } from "../src/impl/nip44";
|
||||
import { XChaCha20Encryptor } from "../src/impl/nip44";
|
||||
import { bytesToHex } from "@noble/curves/abstract/utils";
|
||||
|
||||
const aKey = secp256k1.utils.randomPrivateKey();
|
||||
@ -14,12 +14,14 @@ describe("NIP-04", () => {
|
||||
const enc = new Nip4WebCryptoEncryptor();
|
||||
const sec = enc.getSharedSecret(bytesToHex(aKey), bytesToHex(bPubKey));
|
||||
|
||||
const ciphertext = await enc.encryptData(msg, sec);
|
||||
expect(ciphertext).toMatch(/^.*\?iv=.*$/i);
|
||||
const payload = await enc.encryptData(msg, sec);
|
||||
expect(payload).toHaveProperty("ciphertext");
|
||||
expect(payload).toHaveProperty("nonce");
|
||||
expect(payload.v).toBe(0);
|
||||
|
||||
const dec = new Nip4WebCryptoEncryptor();
|
||||
const sec2 = enc.getSharedSecret(bytesToHex(bKey), bytesToHex(aPubKey));
|
||||
const plaintext = await dec.decryptData(ciphertext, sec2);
|
||||
const plaintext = await dec.decryptData(payload, sec2);
|
||||
expect(plaintext).toEqual(msg);
|
||||
});
|
||||
});
|
||||
@ -27,18 +29,17 @@ describe("NIP-04", () => {
|
||||
describe("NIP-44", () => {
|
||||
it("should encrypt/decrypt", () => {
|
||||
const msg = "test hello, 123";
|
||||
const enc = new Nip44Encryptor();
|
||||
const enc = new XChaCha20Encryptor();
|
||||
const sec = enc.getSharedSecret(bytesToHex(aKey), bytesToHex(bPubKey));
|
||||
|
||||
const ciphertext = enc.encryptData(msg, sec);
|
||||
const jObj = JSON.parse(ciphertext);
|
||||
expect(jObj).toHaveProperty("ciphertext");
|
||||
expect(jObj).toHaveProperty("nonce");
|
||||
expect(jObj.v).toBe(1);
|
||||
const payload = enc.encryptData(msg, sec);
|
||||
expect(payload).toHaveProperty("ciphertext");
|
||||
expect(payload).toHaveProperty("nonce");
|
||||
expect(payload.v).toBe(1);
|
||||
|
||||
const dec = new Nip44Encryptor();
|
||||
const dec = new XChaCha20Encryptor();
|
||||
const sec2 = enc.getSharedSecret(bytesToHex(bKey), bytesToHex(aPubKey));
|
||||
const plaintext = dec.decryptData(ciphertext, sec2);
|
||||
const plaintext = dec.decryptData(payload, sec2);
|
||||
expect(plaintext).toEqual(msg);
|
||||
});
|
||||
});
|
||||
|
@ -64,50 +64,4 @@ describe("query", () => {
|
||||
q.sendToRelay(c2, qs);
|
||||
expect(q.progress).toBe(4 / 5);
|
||||
});
|
||||
|
||||
it("should merge all sub-query filters", () => {
|
||||
const q = new Query("test", "", new FlatNoteStore());
|
||||
const c0 = new Connection("wss://test.com", { read: true, write: true });
|
||||
q.sendToRelay(c0, {
|
||||
filters: [
|
||||
{
|
||||
authors: ["a"],
|
||||
kinds: [1],
|
||||
},
|
||||
],
|
||||
relay: "",
|
||||
strategy: RequestStrategy.DefaultRelays,
|
||||
});
|
||||
q.sendToRelay(c0, {
|
||||
filters: [
|
||||
{
|
||||
authors: ["b"],
|
||||
kinds: [1, 2],
|
||||
},
|
||||
],
|
||||
relay: "",
|
||||
strategy: RequestStrategy.DefaultRelays,
|
||||
});
|
||||
q.sendToRelay(c0, {
|
||||
filters: [
|
||||
{
|
||||
authors: ["c"],
|
||||
kinds: [2],
|
||||
},
|
||||
],
|
||||
relay: "",
|
||||
strategy: RequestStrategy.DefaultRelays,
|
||||
});
|
||||
|
||||
expect(q.filters).toEqual([
|
||||
{
|
||||
authors: ["a", "b"],
|
||||
kinds: [1],
|
||||
},
|
||||
{
|
||||
authors: ["b", "c"],
|
||||
kinds: [2],
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { RelayCache } from "../src/gossip-model";
|
||||
import { RequestBuilder, RequestStrategy } from "../src/request-builder";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
import { expandFilter } from "../src/request-expander";
|
||||
import { bytesToHex } from "@noble/curves/abstract/utils";
|
||||
import { unixNow, unixNowMs } from "@snort/shared";
|
||||
import { FeedCache, unixNow, unixNowMs } from "@snort/shared";
|
||||
import { NostrSystem, UsersRelays } from "../src";
|
||||
|
||||
const DummyCache = {
|
||||
getFromCache: (pk?: string) => {
|
||||
@ -23,7 +23,11 @@ const DummyCache = {
|
||||
],
|
||||
};
|
||||
},
|
||||
} as RelayCache;
|
||||
} as FeedCache<UsersRelays>;
|
||||
|
||||
const System = new NostrSystem({
|
||||
relayCache: DummyCache,
|
||||
});
|
||||
|
||||
describe("RequestBuilder", () => {
|
||||
describe("basic", () => {
|
||||
@ -95,7 +99,7 @@ describe("RequestBuilder", () => {
|
||||
f0.authors(["a"]);
|
||||
expect(a).toEqual([{}]);
|
||||
|
||||
const b = rb.buildDiff(DummyCache, a.flatMap(expandFilter));
|
||||
const b = rb.buildDiff(System, a);
|
||||
expect(b).toMatchObject([
|
||||
{
|
||||
filters: [{ authors: ["a"] }],
|
||||
@ -107,7 +111,7 @@ describe("RequestBuilder", () => {
|
||||
const rb = new RequestBuilder("test");
|
||||
rb.withFilter().authors(["a", "b"]).kinds([0]);
|
||||
|
||||
const a = rb.build(DummyCache);
|
||||
const a = rb.build(System);
|
||||
expect(a).toEqual([
|
||||
{
|
||||
strategy: RequestStrategy.AuthorsRelays,
|
||||
@ -138,7 +142,7 @@ describe("RequestBuilder", () => {
|
||||
rb.withFilter().authors(["a", "b"]).kinds([10002]);
|
||||
rb.withFilter().authors(["a"]).limit(10).kinds([4]);
|
||||
|
||||
const a = rb.build(DummyCache);
|
||||
const a = rb.build(System);
|
||||
expect(a).toEqual([
|
||||
{
|
||||
strategy: RequestStrategy.AuthorsRelays,
|
||||
@ -168,37 +172,3 @@ describe("RequestBuilder", () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("build diff, large follow list", () => {
|
||||
const f = [];
|
||||
for (let x = 0; x < 2500; x++) {
|
||||
const bytes = crypto.getRandomValues(new Uint8Array(32));
|
||||
f.push(bytesToHex(bytes));
|
||||
}
|
||||
|
||||
const rb = new RequestBuilder("test");
|
||||
rb.withFilter().authors(f).kinds([1, 6, 10002, 3, 6969]);
|
||||
|
||||
const start = unixNowMs();
|
||||
const a = rb.build(DummyCache);
|
||||
expect(a).toEqual(
|
||||
f.map(a => {
|
||||
return {
|
||||
strategy: RequestStrategy.AuthorsRelays,
|
||||
relay: `wss://${a}.com/`,
|
||||
filters: [
|
||||
{
|
||||
kinds: [1, 6, 10002, 3, 6969],
|
||||
authors: [a],
|
||||
},
|
||||
],
|
||||
};
|
||||
}),
|
||||
);
|
||||
expect(unixNowMs() - start).toBeLessThan(500);
|
||||
|
||||
const start2 = unixNowMs();
|
||||
const b = rb.buildDiff(DummyCache, rb.buildRaw().flatMap(expandFilter));
|
||||
expect(b).toEqual([]);
|
||||
expect(unixNowMs() - start2).toBeLessThan(100);
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expandFilter } from "../src/request-expander";
|
||||
import { expandFilter } from "../src/query-optimizer/request-expander";
|
||||
|
||||
describe("RequestExpander", () => {
|
||||
test("expand filter", () => {
|
||||
|
@ -1,6 +1,13 @@
|
||||
import { ReqFilter } from "../src";
|
||||
import { canMergeFilters, filterIncludes, flatMerge, mergeSimilar, simpleMerge } from "../src/request-merger";
|
||||
import { FlatReqFilter, expandFilter } from "../src/request-expander";
|
||||
import {
|
||||
canMergeFilters,
|
||||
filterIncludes,
|
||||
flatMerge,
|
||||
mergeSimilar,
|
||||
simpleMerge,
|
||||
} from "../src/query-optimizer/request-merger";
|
||||
import { FlatReqFilter } from "../src/query-optimizer";
|
||||
import { expandFilter } from "../src/query-optimizer/request-expander";
|
||||
|
||||
describe("RequestMerger", () => {
|
||||
it("should simple merge authors", () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ReqFilter } from "../src";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
import { diffFilters } from "../src/request-splitter";
|
||||
import { expandFilter } from "../src/request-expander";
|
||||
import { diffFilters } from "../src/query-optimizer/request-splitter";
|
||||
import { expandFilter } from "../src/query-optimizer/request-expander";
|
||||
|
||||
describe("RequestSplitter", () => {
|
||||
test("single filter add value", () => {
|
||||
|
@ -1,17 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"target": "ES2020",
|
||||
"moduleResolution": "node",
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"noImplicitOverride": true,
|
||||
"module": "CommonJS",
|
||||
"module": "NodeNext",
|
||||
"strict": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSourceMap": true,
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true
|
||||
"skipLibCheck": true,
|
||||
"allowJs": true
|
||||
},
|
||||
"include": ["./src/**/*.ts"],
|
||||
"files": ["./src/index.ts"]
|
||||
|
88
yarn.lock
88
yarn.lock
@ -2715,7 +2715,6 @@ __metadata:
|
||||
css-minimizer-webpack-plugin: ^5.0.0
|
||||
debug: ^4.3.4
|
||||
dexie: ^3.2.4
|
||||
dns-over-http-resolver: ^2.1.1
|
||||
emojilib: ^3.0.10
|
||||
eslint: ^8.48.0
|
||||
eslint-webpack-plugin: ^4.0.1
|
||||
@ -2737,11 +2736,11 @@ __metadata:
|
||||
react-twitter-embed: ^4.0.4
|
||||
source-map-loader: ^4.0.1
|
||||
terser-webpack-plugin: ^5.3.9
|
||||
tinybench: ^2.5.0
|
||||
ts-jest: ^29.1.0
|
||||
tinybench: ^2.5.1
|
||||
ts-jest: ^29.1.1
|
||||
ts-loader: ^9.4.4
|
||||
typescript: ^5.2.2
|
||||
use-long-press: ^2.0.3
|
||||
use-long-press: ^3.2.0
|
||||
use-sync-external-store: ^1.2.0
|
||||
uuid: ^9.0.0
|
||||
webpack: ^5.88.2
|
||||
@ -2765,7 +2764,6 @@ __metadata:
|
||||
"@scure/base": ^1.1.2
|
||||
"@types/debug": ^4.1.8
|
||||
debug: ^4.3.4
|
||||
dexie: ^3.2.4
|
||||
light-bolt11-decoder: ^3.0.0
|
||||
typescript: ^5.2.2
|
||||
languageName: unknown
|
||||
@ -2817,7 +2815,6 @@ __metadata:
|
||||
"@types/uuid": ^9.0.2
|
||||
"@types/ws": ^8.5.5
|
||||
debug: ^4.3.4
|
||||
dexie: ^3.2.4
|
||||
isomorphic-ws: ^5.0.0
|
||||
jest: ^29.5.0
|
||||
jest-environment-jsdom: ^29.5.0
|
||||
@ -4784,15 +4781,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"busboy@npm:^1.6.0":
|
||||
version: 1.6.0
|
||||
resolution: "busboy@npm:1.6.0"
|
||||
dependencies:
|
||||
streamsearch: ^1.1.0
|
||||
checksum: 32801e2c0164e12106bf236291a00795c3c4e4b709ae02132883fe8478ba2ae23743b11c5735a0aae8afe65ac4b6ca4568b91f0d9fed1fdbc32ede824a73746e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"bytes@npm:3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "bytes@npm:3.0.0"
|
||||
@ -5720,7 +5708,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4":
|
||||
"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4":
|
||||
version: 4.3.4
|
||||
resolution: "debug@npm:4.3.4"
|
||||
dependencies:
|
||||
@ -5931,18 +5919,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"dns-over-http-resolver@npm:^2.1.1":
|
||||
version: 2.1.2
|
||||
resolution: "dns-over-http-resolver@npm:2.1.2"
|
||||
dependencies:
|
||||
debug: ^4.3.1
|
||||
native-fetch: ^4.0.2
|
||||
receptacle: ^1.3.2
|
||||
undici: ^5.12.0
|
||||
checksum: 7b02c87c843595245c6df16310c4507606802de999f8d271c553c7206e44e3f1f7552cdcabc3a0fde762525b7b0e7344fd77ea44d2ca61c6487d3ee4e777fda6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"dns-packet@npm:^5.2.2":
|
||||
version: 5.6.1
|
||||
resolution: "dns-packet@npm:5.6.1"
|
||||
@ -9628,7 +9604,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1":
|
||||
"ms@npm:2.1.3, ms@npm:^2.0.0":
|
||||
version: 2.1.3
|
||||
resolution: "ms@npm:2.1.3"
|
||||
checksum: aa92de608021b242401676e35cfa5aa42dd70cbdc082b916da7fb925c542173e36bce97ea3e804923fe92c0ad991434e4a38327e15a1b5b5f945d66df615ae6d
|
||||
@ -9676,15 +9652,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"native-fetch@npm:^4.0.2":
|
||||
version: 4.0.2
|
||||
resolution: "native-fetch@npm:4.0.2"
|
||||
peerDependencies:
|
||||
undici: "*"
|
||||
checksum: 11e6d075aa03d40665a5fc438c56b535622fb4ee98eb2b035277c5ba47733cb4c7bc3ddb45e5ab8154869b509fc18ca1c0188ab271139ae89db14f9f552fc064
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"natural-compare@npm:^1.4.0":
|
||||
version: 1.4.0
|
||||
resolution: "natural-compare@npm:1.4.0"
|
||||
@ -11446,15 +11413,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"receptacle@npm:^1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "receptacle@npm:1.3.2"
|
||||
dependencies:
|
||||
ms: ^2.1.1
|
||||
checksum: 7c5011f19e6ddcb759c1e6756877cee3c9eb78fbd1278eca4572d75f74993f0ccdc1e5f7761de6e682dff5344ee94f7a69bc492e2e8eb81d8777774a2399ce9c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"rechoir@npm:^0.6.2":
|
||||
version: 0.6.2
|
||||
resolution: "rechoir@npm:0.6.2"
|
||||
@ -12368,13 +12326,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"streamsearch@npm:^1.1.0":
|
||||
version: 1.1.0
|
||||
resolution: "streamsearch@npm:1.1.0"
|
||||
checksum: 1cce16cea8405d7a233d32ca5e00a00169cc0e19fbc02aa839959985f267335d435c07f96e5e0edd0eadc6d39c98d5435fb5bbbdefc62c41834eadc5622ad942
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"string-length@npm:^4.0.1":
|
||||
version: 4.0.2
|
||||
resolution: "string-length@npm:4.0.2"
|
||||
@ -12778,10 +12729,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tinybench@npm:^2.5.0":
|
||||
version: 2.5.0
|
||||
resolution: "tinybench@npm:2.5.0"
|
||||
checksum: 284bb9428f197ec8b869c543181315e65e41ccfdad3c4b6c916bb1fdae1b5c6785661b0d90cf135b48d833b03cb84dc5357b2d33ec65a1f5971fae0ab2023821
|
||||
"tinybench@npm:^2.5.1":
|
||||
version: 2.5.1
|
||||
resolution: "tinybench@npm:2.5.1"
|
||||
checksum: 6d98526c00b68b50ab0a37590b3cc6713b96fee7dd6756a2a77bab071ed1b4a4fc54e7b11e28b35ec2f761c6a806c2befa95f10acf2fee111c49327b6fc3386f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -12884,7 +12835,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"ts-jest@npm:^29.1.0":
|
||||
"ts-jest@npm:^29.1.0, ts-jest@npm:^29.1.1":
|
||||
version: 29.1.1
|
||||
resolution: "ts-jest@npm:29.1.1"
|
||||
dependencies:
|
||||
@ -13128,15 +13079,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"undici@npm:^5.12.0":
|
||||
version: 5.23.0
|
||||
resolution: "undici@npm:5.23.0"
|
||||
dependencies:
|
||||
busboy: ^1.6.0
|
||||
checksum: 906ca4fb1d47163d2cee2ecbbc664a1d92508a2cdf1558146621109f525c983a83597910b36e6ba468240e95259be5939cea6babc99fc0c36360b16630f66784
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"unicode-canonical-property-names-ecmascript@npm:^2.0.0":
|
||||
version: 2.0.0
|
||||
resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0"
|
||||
@ -13341,12 +13283,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"use-long-press@npm:^2.0.3":
|
||||
version: 2.0.4
|
||||
resolution: "use-long-press@npm:2.0.4"
|
||||
"use-long-press@npm:^3.2.0":
|
||||
version: 3.2.0
|
||||
resolution: "use-long-press@npm:3.2.0"
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
checksum: 50e57a33653c2e4825ef700565e6db7ac94441929aaaf3226b164162f9be62084d97689d017ff0e9a33834b6fc454be8768d0cb6f10ecb1ca95c06cf509596e7
|
||||
react: ">=16.8.0"
|
||||
checksum: 7f43316d8578a84df6362b7cd795bb97fccfce3805bcab7ca63d0ea5b3046252bfe6842195844b360489ac57746045bc69ef36e45acaeb7c8d978de5cbbd9a54
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user