update dependencies

This commit is contained in:
hzrd149 2023-05-25 10:54:04 -05:00
parent 5e7f6b06fa
commit 40c5e19158
11 changed files with 495 additions and 420 deletions

View File

@ -0,0 +1,5 @@
---
"nostrudel": minor
---
Update nostr-tools dependency

View File

@ -0,0 +1,5 @@
---
"nostrudel": patch
---
Fix link regexp

View File

@ -5,41 +5,41 @@
"license": "MIT",
"scripts": {
"start": "vite serve",
"build": "tsc && vite build",
"build": "tsc --project tsconfig.json && vite build",
"format": "prettier --ignore-path .prettierignore -w ."
},
"dependencies": {
"@chakra-ui/icons": "^2.0.14",
"@chakra-ui/react": "^2.4.4",
"@changesets/cli": "^2.26.1",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@chakra-ui/icons": "^2.0.19",
"@chakra-ui/react": "^2.6.1",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
"bech32": "^2.0.0",
"framer-motion": "^7.10.3",
"idb": "^7.1.1",
"identicon.js": "^2.3.3",
"light-bolt11-decoder": "^2.1.0",
"light-bolt11-decoder": "^3.0.0",
"moment": "^2.29.4",
"noble-secp256k1": "^1.2.14",
"nostr-tools": "^1.8.3",
"nostr-tools": "^1.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4",
"react-hook-form": "^7.43.1",
"react-error-boundary": "^4.0.4",
"react-hook-form": "^7.43.9",
"react-qr-barcode-scanner": "^1.0.6",
"react-router-dom": "^6.5.0",
"react-router-dom": "^6.11.2",
"react-singleton-hook": "^4.0.1",
"react-use": "^17.4.0",
"webln": "^0.3.2"
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@types/identicon.js": "^2.3.1",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^3.0.0",
"prettier": "^2.8.1",
"typescript": "^4.9.4",
"vite": "^4.0.2",
"vite-plugin-pwa": "^0.14.1"
"@types/react": "^18.2.7",
"@types/react-dom": "^18.2.4",
"@vitejs/plugin-react": "^4.0.0",
"prettier": "^2.8.8",
"typescript": "^5.0.4",
"vite": "^4.3.8",
"vite-plugin-pwa": "^0.15.1"
}
}

View File

@ -47,12 +47,12 @@ export function embedVideos(content: EmbedableContent) {
}
// based on http://urlregex.com/
// note1c34vht0lu2qzrgr4az3u8jn5xl3fycr2gfpahkepthg7hzlqg26sr59amt
// nostr:nevent1qqsvg6kt4hl79qpp5p673g7ref6r0c5jvp4yys7mmvs4m50t30sy9dgpp4mhxue69uhkummn9ekx7mqpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet59dl66z
// nostr:nevent1qqsymds0vlpp4f5s0dckjf4qz283pdsen0rmx8lu7ct6hpnxag2hpacpremhxue69uhkummnw3ez6un9d3shjtnwda4k7arpwfhjucm0d5q3qamnwvaz7tmwdaehgu3wwa5kueghxyq76
export function embedLinks(content: EmbedableContent) {
return embedJSX(content, {
name: "Link",
regexp:
/https?:\/\/([\dA-z\.-]+\.[A-z\.]{2,6})((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\-\.\!\/\\\w]*))?/i,
regexp: /https?:\/\/([\dA-z\.-]+\.[A-z\.]{2,6})(\/[\+~%\/\.\w\-_]*)?([\?#][^\s]+)?/i,
render: (match) => (
<Link color="blue.500" href={match[0]} target="_blank" isExternal>
{match[0]}

View File

@ -1,4 +1,5 @@
import { bech32 } from "bech32";
import { nip19 } from "nostr-tools";
export function isHex(key?: string) {
if (key?.toLowerCase()?.match(/^[0-9a-f]{64}$/)) return true;
@ -60,6 +61,12 @@ export function hexStringToUint8(str: string) {
return buffer;
}
export function safeDecode(str: string) {
try {
return nip19.decode(str);
} catch (e) {}
}
export function normalizeToBech32(key: string, prefix: Bech32Prefix = Bech32Prefix.Pubkey) {
if (isHex(key)) return hexToBech32(key, prefix);
if (isBech32Key(key)) return key;

View File

@ -5,7 +5,6 @@ import { NostrMultiSubscription } from "../classes/nostr-multi-subscription";
import db from "./db";
import { getReferences } from "../helpers/nostr-event";
import userContactsService from "./user-contacts";
import clientRelaysService from "./client-relays";
import { Subject } from "../classes/subject";
import { Kind } from "nostr-tools";

View File

@ -14,7 +14,6 @@ import {
InputGroup,
InputRightElement,
Link,
useToast,
} from "@chakra-ui/react";
import { useNavigate } from "react-router-dom";
import { RelayUrlInput } from "../../components/relay-url-input";
@ -26,7 +25,6 @@ import signingService from "../../services/signing";
export default function LoginNsecView() {
const navigate = useNavigate();
const toast = useToast();
const [show, setShow] = useState(false);
const [error, setError] = useState(false);

View File

@ -21,6 +21,7 @@ import ZapModal from "../../components/zap-modal";
import { convertTimestampToDate } from "../../helpers/date";
import { truncatedId } from "../../helpers/nostr-event";
import QrScannerModal from "../../components/qr-scanner-modal";
import { safeDecode } from "../../helpers/nip19";
type relay = string;
type NostrBandSearchResults = {
@ -90,7 +91,7 @@ export default function SearchView() {
// set the search when the form is submitted
const handleSubmit = (e: React.SyntheticEvent) => {
e.preventDefault();
if (search.startsWith("nostr:")) {
if (search.startsWith("nostr:") || safeDecode(search)) {
navigate({ pathname: "/l/" + search }, { replace: true });
} else {
setSearchParams({ q: search }, { replace: true });

View File

@ -5,18 +5,17 @@
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"],
"exclude": ["node_modules"],
"references": [{ "path": "./tsconfig.node.json" }]
"exclude": ["node_modules"]
}

View File

@ -1,9 +0,0 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

834
yarn.lock

File diff suppressed because it is too large Load Diff