mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
431b8ec6bb | ||
|
|
77b2be7a3b | ||
|
|
90d02c42d6 | ||
|
|
d3cceb56ee | ||
|
|
fd23c10f20 | ||
|
|
0d73c79d4c | ||
|
|
f951f21535 | ||
|
|
a20fab1ab4 | ||
|
|
97714079d3 | ||
|
|
01d20c5743 | ||
|
|
f2612831c6 | ||
|
|
278b7cd3b2 | ||
|
|
a824677fe2 | ||
|
|
0eb8693d10 | ||
|
|
9557356ff5 | ||
|
|
dbbdcc32eb | ||
|
|
acde1d8a3a |
No files matched your search
@@ -44,6 +44,7 @@ deploy:
|
|||||||
- ssh-keyscan -H "${DEPLOY_TARGET##*@}" >> ~/.ssh/known_hosts 2>/dev/null
|
- ssh-keyscan -H "${DEPLOY_TARGET##*@}" >> ~/.ssh/known_hosts 2>/dev/null
|
||||||
- rsync -av --exclude=/sw.js --exclude=/index.html -e "ssh -i ~/.ssh/id_ed25519" dist/ "${DEPLOY_TARGET}:/"
|
- rsync -av --exclude=/sw.js --exclude=/index.html -e "ssh -i ~/.ssh/id_ed25519" dist/ "${DEPLOY_TARGET}:/"
|
||||||
- rsync -av -e "ssh -i ~/.ssh/id_ed25519" dist/index.html "${DEPLOY_TARGET}:/"
|
- rsync -av -e "ssh -i ~/.ssh/id_ed25519" dist/index.html "${DEPLOY_TARGET}:/"
|
||||||
|
- rsync -av -e "ssh -i ~/.ssh/id_ed25519" dist/sw.js "${DEPLOY_TARGET}:/"
|
||||||
|
|
||||||
deploy-nsite:
|
deploy-nsite:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
name: Deploy nsite
|
||||||
|
|
||||||
|
# Builds dist/ and publishes it as the named nsite "shakespeare" (NIP-5A kind
|
||||||
|
# 35128) described by .nsite/config.json: the files become Blossom blobs, the
|
||||||
|
# manifest mapping path -> sha256 goes to relays, and npanel on venus serves
|
||||||
|
# shakespeare.diy from it. Runs on pushes to the default branch, alongside
|
||||||
|
# Test.
|
||||||
|
#
|
||||||
|
# Replaces the GitLab `deploy-nsite` job, which published the same site under a
|
||||||
|
# PERSONAL npub with nsyte 0.24.1. The signing pubkey IS the site address, so
|
||||||
|
# this one lives in the Team Soapbox namespace instead.
|
||||||
|
#
|
||||||
|
# Secrets are provisioned by the ngit-ci operator as
|
||||||
|
# NGIT_CI_SECRET_<ALIAS>__<NAME> (note the double underscore) and injected ONLY
|
||||||
|
# on maintainer-authored triggers, which a push to a watched repo always is.
|
||||||
|
# This job needs one:
|
||||||
|
# NSYTE_BUNKER nbunksec1... -- a pre-established NIP-46 session, the form
|
||||||
|
# nsyte documents for CI.
|
||||||
|
# An empty NSYTE_BUNKER fails the job rather than skipping quietly: this is the
|
||||||
|
# only workflow that publishes the client anywhere, so a skipped run would
|
||||||
|
# leave the nsite silently pinned to an older build.
|
||||||
|
#
|
||||||
|
# NOTE: *.shakespeare.diy is NOT served from here. The wildcard keeps its own
|
||||||
|
# Caddy vhost and /var/www tree on venus, because the nsite catch-all issues
|
||||||
|
# certificates on demand over HTTP-01 and cannot get a wildcard.
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
|
||||||
|
# Ahead of the build, so a config nsyte will not accept costs seconds
|
||||||
|
# rather than failing at the end of a green-looking run.
|
||||||
|
- name: Install nsyte and validate the config
|
||||||
|
env:
|
||||||
|
NSYTE_BUNKER: ${{ secrets.NSYTE_BUNKER }}
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
: "${NSYTE_BUNKER:?NSYTE_BUNKER is not set; ask the ngit-ci operator to provision it for this repo alias.}"
|
||||||
|
|
||||||
|
# Pin the binary. An unversioned install has been observed pulling
|
||||||
|
# 0.10.1, which emits legacy kind-34128 events that every current
|
||||||
|
# gateway ignores while still reporting a successful deploy.
|
||||||
|
# nsyte is baked into the coordinator's CI image, alongside zsp and
|
||||||
|
# the rest (armada's .ngit/ci-image/Dockerfile). Downloading it at
|
||||||
|
# job time is the fallback for a coordinator that does not have it,
|
||||||
|
# and is exactly what kept failing here: the 115 MB release asset
|
||||||
|
# broke mid-transfer with "SSL_read: decryption failed or bad record
|
||||||
|
# mac", identically on every attempt within a run, taking
|
||||||
|
# deploy-nsite down across every repo. Hence the loop, HTTP/1.1, and
|
||||||
|
# running the binary before trusting it.
|
||||||
|
if command -v nsyte >/dev/null 2>&1; then
|
||||||
|
echo "using the nsyte baked into the runner image"
|
||||||
|
else
|
||||||
|
NSYTE_URL=https://github.com/sandwichfarm/nsyte/releases/download/v0.27.2/nsyte-linux-0.27.2
|
||||||
|
ok=""
|
||||||
|
for attempt in 1 2 3 4 5; do
|
||||||
|
if curl -fsSL --http1.1 --retry 2 --retry-delay 5 --retry-all-errors \
|
||||||
|
--connect-timeout 20 --max-time 900 -o /usr/local/bin/nsyte "$NSYTE_URL" \
|
||||||
|
&& chmod +x /usr/local/bin/nsyte \
|
||||||
|
&& nsyte --version >/dev/null; then
|
||||||
|
ok=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "nsyte download attempt $attempt failed; retrying in 10s"
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
test -n "$ok" || { echo "could not download a working nsyte after 5 attempts"; exit 1; }
|
||||||
|
fi
|
||||||
|
nsyte --version
|
||||||
|
|
||||||
|
nsyte validate
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
# Builds dist/ and copies index.html -> 404.html, the path NIP-5A host
|
||||||
|
# servers fall back to.
|
||||||
|
- run: npm run build
|
||||||
|
|
||||||
|
# Sourcemaps are ~290 files and 30 MB of blobs nobody fetches, and they
|
||||||
|
# near-double the manifest. The GitLab job dropped them too.
|
||||||
|
- run: find dist -name '*.map' -delete
|
||||||
|
|
||||||
|
- name: Publish to Blossom + relays
|
||||||
|
env:
|
||||||
|
NSYTE_BUNKER: ${{ secrets.NSYTE_BUNKER }}
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Relays, servers and the site id all come from .nsite/config.json,
|
||||||
|
# so they are versioned with the client rather than split across this
|
||||||
|
# file. The secrets scan is skipped because it prompts on false
|
||||||
|
# positives in our own bundle (pubkeys, bunker:// parsing code), and
|
||||||
|
# a prompt is unanswerable here -- with -i it defaults to N and
|
||||||
|
# aborts.
|
||||||
|
set +e
|
||||||
|
nsyte deploy dist \
|
||||||
|
--sec "$NSYTE_BUNKER" \
|
||||||
|
--concurrency 2 \
|
||||||
|
--non-interactive \
|
||||||
|
--skip-secrets-scan 2>&1 | tee /tmp/nsyte-deploy.log
|
||||||
|
status="${PIPESTATUS[0]}"
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# A deploy that changes no file exits NON-ZERO with "No new files to
|
||||||
|
# upload". That is success: the manifest already on the relays
|
||||||
|
# describes exactly this build.
|
||||||
|
if [ "$status" -ne 0 ] && ! grep -q "No new files to upload" /tmp/nsyte-deploy.log; then
|
||||||
|
exit "$status"
|
||||||
|
fi
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
# Typecheck / lint / unit tests / production build for the Shakespeare client.
|
||||||
|
# ngit-ci watches .ngit/act/workflows/ and runs each job with `act` (GitHub
|
||||||
|
# Actions-compatible syntax) in a Linux container. Runs on every push and on
|
||||||
|
# every Nostr PR.
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["**"]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
# package.json splits these: "typecheck" is tsc --noEmit and "test" is
|
||||||
|
# eslint + vitest. The GitLab job ran typecheck, build and test; keep all
|
||||||
|
# three so a type error still fails CI.
|
||||||
|
- run: npm run typecheck
|
||||||
|
- run: npm run build
|
||||||
|
- run: npm run test
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://nsyte.run/schemas/config.schema.json",
|
||||||
|
"relays": [
|
||||||
|
"wss://relay.ditto.pub",
|
||||||
|
"wss://relay.dreamith.to",
|
||||||
|
"wss://relay.primal.net"
|
||||||
|
],
|
||||||
|
"id": "shakespeare",
|
||||||
|
"servers": [
|
||||||
|
"https://blossom.ditto.pub",
|
||||||
|
"https://blossom.dreamith.to",
|
||||||
|
"https://blossom.primal.net"
|
||||||
|
],
|
||||||
|
"fallback": "/index.html",
|
||||||
|
"publishRelayList": false,
|
||||||
|
"publishServerList": false,
|
||||||
|
"title": "Shakespeare",
|
||||||
|
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment.",
|
||||||
|
"source": "https://gitworkshop.dev/soapbox.pub/relay.ngit.dev/shakespeare"
|
||||||
|
}
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [9.15.0] - 2026-08-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Connect to Meridian as an AI provider — available as a one-click preset with streamlined setup
|
||||||
|
- Optimize Repository action in the project menu that consolidates git history to reclaim space and repair bloated repositories
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Zaps now verify the invoice amount before paying, so you're never charged more than you approved
|
||||||
|
|
||||||
## [9.14.0] - 2026-06-05
|
## [9.14.0] - 2026-06-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
Generated
+183
-118
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "shakespeare.diy",
|
"name": "shakespeare.diy",
|
||||||
"version": "9.13.2",
|
"version": "9.14.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "shakespeare.diy",
|
"name": "shakespeare.diy",
|
||||||
"version": "9.13.2",
|
"version": "9.14.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor/app": "^8.1.0",
|
"@capacitor/app": "^8.1.0",
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"@isomorphic-git/lightning-fs": "^4.6.2",
|
"@isomorphic-git/lightning-fs": "^4.6.2",
|
||||||
"@modelcontextprotocol/sdk": "^1.22.0",
|
"@modelcontextprotocol/sdk": "^1.22.0",
|
||||||
"@mozilla/readability": "^0.6.0",
|
"@mozilla/readability": "^0.6.0",
|
||||||
"@nostrify/nostrify": "^0.51.1",
|
"@nostrify/nostrify": "^0.54.1",
|
||||||
"@nostrify/react": "^0.4.1",
|
"@nostrify/react": "^0.6.6",
|
||||||
"@opensecret/react": "^1.5.4",
|
"@opensecret/react": "^1.5.4",
|
||||||
"@plausible-analytics/tracker": "^0.4.4",
|
"@plausible-analytics/tracker": "^0.4.4",
|
||||||
"@radix-ui/react-accordion": "^1.2.0",
|
"@radix-ui/react-accordion": "^1.2.0",
|
||||||
@@ -190,9 +190,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/compat-data": {
|
"node_modules/@babel/compat-data": {
|
||||||
"version": "7.29.0",
|
"version": "7.29.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz",
|
||||||
"integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==",
|
"integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -200,21 +200,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/core": {
|
"node_modules/@babel/core": {
|
||||||
"version": "7.29.0",
|
"version": "7.29.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
|
||||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.0",
|
"@babel/code-frame": "^7.29.7",
|
||||||
"@babel/generator": "^7.29.0",
|
"@babel/generator": "^7.29.7",
|
||||||
"@babel/helper-compilation-targets": "^7.28.6",
|
"@babel/helper-compilation-targets": "^7.29.7",
|
||||||
"@babel/helper-module-transforms": "^7.28.6",
|
"@babel/helper-module-transforms": "^7.29.7",
|
||||||
"@babel/helpers": "^7.28.6",
|
"@babel/helpers": "^7.29.7",
|
||||||
"@babel/parser": "^7.29.0",
|
"@babel/parser": "^7.29.7",
|
||||||
"@babel/template": "^7.28.6",
|
"@babel/template": "^7.29.7",
|
||||||
"@babel/traverse": "^7.29.0",
|
"@babel/traverse": "^7.29.7",
|
||||||
"@babel/types": "^7.29.0",
|
"@babel/types": "^7.29.7",
|
||||||
"@jridgewell/remapping": "^2.3.5",
|
"@jridgewell/remapping": "^2.3.5",
|
||||||
"convert-source-map": "^2.0.0",
|
"convert-source-map": "^2.0.0",
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
@@ -270,14 +270,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-compilation-targets": {
|
"node_modules/@babel/helper-compilation-targets": {
|
||||||
"version": "7.28.6",
|
"version": "7.29.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz",
|
||||||
"integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==",
|
"integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/compat-data": "^7.28.6",
|
"@babel/compat-data": "^7.29.7",
|
||||||
"@babel/helper-validator-option": "^7.27.1",
|
"@babel/helper-validator-option": "^7.29.7",
|
||||||
"browserslist": "^4.24.0",
|
"browserslist": "^4.24.0",
|
||||||
"lru-cache": "^5.1.1",
|
"lru-cache": "^5.1.1",
|
||||||
"semver": "^6.3.1"
|
"semver": "^6.3.1"
|
||||||
@@ -531,9 +531,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-validator-option": {
|
"node_modules/@babel/helper-validator-option": {
|
||||||
"version": "7.27.1",
|
"version": "7.29.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz",
|
||||||
"integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==",
|
"integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -556,14 +556,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helpers": {
|
"node_modules/@babel/helpers": {
|
||||||
"version": "7.29.2",
|
"version": "7.29.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz",
|
||||||
"integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==",
|
"integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/template": "^7.28.6",
|
"@babel/template": "^7.29.7",
|
||||||
"@babel/types": "^7.29.0"
|
"@babel/types": "^7.29.7"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
@@ -2682,9 +2682,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@hono/node-server": {
|
"node_modules/@hono/node-server": {
|
||||||
"version": "1.19.14",
|
"version": "1.19.17",
|
||||||
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.14.tgz",
|
"resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.17.tgz",
|
||||||
"integrity": "sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw==",
|
"integrity": "sha512-dSneS5qhiauZWGDCeK4o695Xd9nUNjviSZCMQrj10eetr8Uln1ucn6bbphOM6UynAMMtNIzZNSpL9vnASJwrPQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.1"
|
"node": ">=18.14.1"
|
||||||
@@ -3293,11 +3293,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@nostrify/nostrify": {
|
"node_modules/@nostrify/nostrify": {
|
||||||
"version": "0.51.1",
|
"version": "0.54.1",
|
||||||
"resolved": "https://registry.npmjs.org/@nostrify/nostrify/-/nostrify-0.51.1.tgz",
|
"resolved": "https://registry.npmjs.org/@nostrify/nostrify/-/nostrify-0.54.1.tgz",
|
||||||
"integrity": "sha512-oPJhUiO1TlV5sGYizqAP4GvLijib34Uwh48wxlFimR/2MoCuSmab4AppcztGPNwxQoTKkJbLJwsSpl42V+WIXA==",
|
"integrity": "sha512-/iMRPBZdz+74pPXKHbQ7RsMwQtEXbJ/M21iNp1kbAMMvRh30hFjdV3ROU93rxGIDsOMSOpzeXXWT4Z+gXZW8Bg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nostrify/types": "0.36.9",
|
"@nostrify/types": "0.37.0",
|
||||||
"@scure/base": "^2.0.0",
|
"@scure/base": "^2.0.0",
|
||||||
"@smithy/util-base64": "^4.3.0",
|
"@smithy/util-base64": "^4.3.0",
|
||||||
"@smithy/util-hex-encoding": "^4.2.0",
|
"@smithy/util-hex-encoding": "^4.2.0",
|
||||||
@@ -3334,12 +3334,12 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@nostrify/react": {
|
"node_modules/@nostrify/react": {
|
||||||
"version": "0.4.1",
|
"version": "0.6.6",
|
||||||
"resolved": "https://registry.npmjs.org/@nostrify/react/-/react-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@nostrify/react/-/react-0.6.6.tgz",
|
||||||
"integrity": "sha512-2JXxEl4e6FIFhbi96Dwv2knu5qAACYulo1a0oVell/aS8KCWsBTPd1+v0EUra0yqiUA3Q1nVLrk8mx7kQYH/yQ==",
|
"integrity": "sha512-WTWTT3dtw0BF5bZsFgOob9S3J9rWKOsPQ2LLKDsDhx3PxbjIFKSVqSQLw7jiN6LoVGom9OuVOG/PB6p9hAWDjQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nostrify/nostrify": "0.51.1",
|
"@nostrify/nostrify": "0.54.1",
|
||||||
"@nostrify/types": "0.36.9"
|
"@nostrify/types": "0.37.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@tanstack/react-query": "^5.69.0",
|
"@tanstack/react-query": "^5.69.0",
|
||||||
@@ -3349,9 +3349,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@nostrify/types": {
|
"node_modules/@nostrify/types": {
|
||||||
"version": "0.36.9",
|
"version": "0.37.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nostrify/types/-/types-0.36.9.tgz",
|
"resolved": "https://registry.npmjs.org/@nostrify/types/-/types-0.37.0.tgz",
|
||||||
"integrity": "sha512-tMx/r0W+QoVRRgs8d6ltaSgrftasOXuFsi33kW8WirswCy2b3UR1tqRgc0iBU9zRa9XR0nlej/wJZW+6wUFi+Q=="
|
"integrity": "sha512-P0AKR+qcNeBBTA5UDnJM6SxLAQbgud2+ZcdVyheoP37XGQvi7rUncQUDKwebG+Ui5kswp/IPEmvqNtCMQpwRoA=="
|
||||||
},
|
},
|
||||||
"node_modules/@opensecret/react": {
|
"node_modules/@opensecret/react": {
|
||||||
"version": "1.5.4",
|
"version": "1.5.4",
|
||||||
@@ -4900,9 +4900,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@remix-run/router": {
|
"node_modules/@remix-run/router": {
|
||||||
"version": "1.23.3",
|
"version": "1.23.4",
|
||||||
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.3.tgz",
|
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.4.tgz",
|
||||||
"integrity": "sha512-4An71tdz9X8+3sI4Qqqd2LWd9vS39J7sqd9EU4Scw7TJE/qB10Flv/UuqbPVgfQV9XoK8Np6jNquZitnZq5i+Q==",
|
"integrity": "sha512-q7j5geK7xs3UJSdm9/iytUNclBnLmYx1EnSeCFXHPeutdqgIMeFeHtUZgS3EhlKxdBEAu8OwtJCwmLrEzpSs7Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
@@ -5052,6 +5052,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5065,6 +5066,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5078,6 +5080,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5091,6 +5094,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5104,6 +5108,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5117,6 +5122,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5130,6 +5136,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5143,6 +5150,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5156,6 +5164,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5169,6 +5178,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5182,6 +5192,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5195,6 +5206,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5208,6 +5220,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5221,6 +5234,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5234,6 +5248,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5247,6 +5262,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5260,6 +5276,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5273,6 +5290,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5286,6 +5304,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5299,6 +5318,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5312,6 +5332,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5325,6 +5346,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5338,6 +5360,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5351,6 +5374,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -5364,6 +5388,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -6604,9 +6629,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
|
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
|
||||||
"version": "2.0.3",
|
"version": "2.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
|
||||||
"integrity": "sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA==",
|
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -7335,20 +7360,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/body-parser": {
|
"node_modules/body-parser": {
|
||||||
"version": "2.2.2",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz",
|
||||||
"integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==",
|
"integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bytes": "^3.1.2",
|
"bytes": "^3.1.2",
|
||||||
"content-type": "^1.0.5",
|
"content-type": "^2.0.0",
|
||||||
"debug": "^4.4.3",
|
"debug": "^4.4.3",
|
||||||
"http-errors": "^2.0.0",
|
"http-errors": "^2.0.1",
|
||||||
"iconv-lite": "^0.7.0",
|
"iconv-lite": "^0.7.2",
|
||||||
"on-finished": "^2.4.1",
|
"on-finished": "^2.4.1",
|
||||||
"qs": "^6.14.1",
|
"qs": "^6.15.2",
|
||||||
"raw-body": "^3.0.1",
|
"raw-body": "^3.0.2",
|
||||||
"type-is": "^2.0.1"
|
"type-is": "^2.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
@@ -7358,6 +7383,19 @@
|
|||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/body-parser/node_modules/content-type": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/body-parser/node_modules/iconv-lite": {
|
"node_modules/body-parser/node_modules/iconv-lite": {
|
||||||
"version": "0.7.2",
|
"version": "0.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
|
||||||
@@ -7388,9 +7426,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
"version": "1.1.13",
|
"version": "1.1.18",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz",
|
||||||
"integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==",
|
"integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -9211,9 +9249,9 @@
|
|||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
"node_modules/fast-uri": {
|
"node_modules/fast-uri": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz",
|
||||||
"integrity": "sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==",
|
"integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -9269,9 +9307,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/filelist/node_modules/brace-expansion": {
|
"node_modules/filelist/node_modules/brace-expansion": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
|
||||||
"integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==",
|
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -9628,9 +9666,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/glob/node_modules/brace-expansion": {
|
"node_modules/glob/node_modules/brace-expansion": {
|
||||||
"version": "2.0.3",
|
"version": "2.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
|
||||||
"integrity": "sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA==",
|
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^1.0.0"
|
"balanced-match": "^1.0.0"
|
||||||
@@ -9732,9 +9770,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/gray-matter/node_modules/js-yaml": {
|
"node_modules/gray-matter/node_modules/js-yaml": {
|
||||||
"version": "3.14.2",
|
"version": "3.15.1",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.1.tgz",
|
||||||
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
|
"integrity": "sha512-S99WuO3HlhO3XN41EtYUNl9zzXjoJx7QvmipxsJVxtCBT0YHEFy+iOJhjSvrmV12nYhWpZaM8lPHkJm0yUMbag==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^1.0.7",
|
"argparse": "^1.0.7",
|
||||||
@@ -10057,9 +10095,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/hono": {
|
"node_modules/hono": {
|
||||||
"version": "4.12.23",
|
"version": "4.13.3",
|
||||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.23.tgz",
|
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.3.tgz",
|
||||||
"integrity": "sha512-eIaZ9qDgu7XV0pxOCrg7/WhnQ6Ivm22UcxhXx/A3dcbqbbYgBEkc6e/J/s7j2tS96zoB0S9VBdLwQNCWwUo4LA==",
|
"integrity": "sha512-r8AO2mYHoLxSHkgafNeC/BXyb2vWRxD3jem4Ts+ptav8oTG5FIRifAjuJEmZI4bSvvc2ns0GxmIYiZnHqN3mMw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.9.0"
|
"node": ">=16.9.0"
|
||||||
@@ -10341,9 +10379,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ip-address": {
|
"node_modules/ip-address": {
|
||||||
"version": "10.2.0",
|
"version": "10.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.5.0.tgz",
|
||||||
"integrity": "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==",
|
"integrity": "sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 12"
|
"node": ">= 12"
|
||||||
@@ -10991,10 +11029,20 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
"node_modules/js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "4.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/puzrin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nodeca"
|
||||||
|
}
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
@@ -12616,9 +12664,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nanoid": {
|
"node_modules/nanoid": {
|
||||||
"version": "3.3.12",
|
"version": "3.3.18",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz",
|
||||||
"integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==",
|
"integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -13205,9 +13253,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.5.15",
|
"version": "8.5.26",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz",
|
||||||
"integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==",
|
"integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
@@ -13224,7 +13272,7 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.12",
|
"nanoid": "^3.3.17",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
"source-map-js": "^1.2.1"
|
"source-map-js": "^1.2.1"
|
||||||
},
|
},
|
||||||
@@ -13816,12 +13864,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router": {
|
"node_modules/react-router": {
|
||||||
"version": "6.30.4",
|
"version": "6.30.6",
|
||||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.4.tgz",
|
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.6.tgz",
|
||||||
"integrity": "sha512-SVUsDe+DybHM/WmYKIVYhZh1o5Dcuf16yM6WjG02Q9XVFMZIJyHYhwrr6bFBXZkVP6z69kNkMyBCujt8FaFLJA==",
|
"integrity": "sha512-5HfK7k5im7LTOB0EqCQmfvy4C13G92Ssj1VTmouTK3AJvyjKTnFuCV0vcMAD/JS+JC4DvDIBRrlAeJIFjh5VWg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@remix-run/router": "1.23.3"
|
"@remix-run/router": "1.23.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
@@ -13831,13 +13879,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router-dom": {
|
"node_modules/react-router-dom": {
|
||||||
"version": "6.30.4",
|
"version": "6.30.6",
|
||||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.4.tgz",
|
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.6.tgz",
|
||||||
"integrity": "sha512-q4HvNl+mmDdkS0g+MqiBZNteQJCuimWoOyHMy4T/RQLAn9Z29+E91QXRaxOujeMl2HTzRSS0KFPd7lxX3PjV0Q==",
|
"integrity": "sha512-0RHKZz7wwffvkU+2MFVT2NnjK44ssLEV+m0CAJaS2Ksmorrwj7WxH00jO0SOCW26/tINUnJHToXblDs33I38YQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@remix-run/router": "1.23.3",
|
"@remix-run/router": "1.23.4",
|
||||||
"react-router": "6.30.4"
|
"react-router": "6.30.6"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
@@ -14309,16 +14357,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rimraf/node_modules/brace-expansion": {
|
"node_modules/rimraf/node_modules/brace-expansion": {
|
||||||
"version": "5.0.6",
|
"version": "5.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
|
||||||
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
|
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^4.0.2"
|
"balanced-match": "^4.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18 || 20 || >=22"
|
"node": "20 || >=22"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rimraf/node_modules/glob": {
|
"node_modules/rimraf/node_modules/glob": {
|
||||||
@@ -15562,9 +15610,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "7.5.13",
|
"version": "7.5.22",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.13.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-7.5.22.tgz",
|
||||||
"integrity": "sha512-tOG/7GyXpFevhXVh8jOPJrmtRpOTsYqUIkVdVooZYJS/z8WhfQUX8RJILmeuJNinGAMSu1veBr4asSHFt5/hng==",
|
"integrity": "sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BlueOak-1.0.0",
|
"license": "BlueOak-1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -15951,17 +15999,34 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/type-is": {
|
"node_modules/type-is": {
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
|
||||||
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
|
"integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"content-type": "^1.0.5",
|
"content-type": "^2.0.0",
|
||||||
"media-typer": "^1.1.0",
|
"media-typer": "^1.1.0",
|
||||||
"mime-types": "^3.0.0"
|
"mime-types": "^3.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6"
|
"node": ">= 18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/type-is/node_modules/content-type": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typed-array-buffer": {
|
"node_modules/typed-array-buffer": {
|
||||||
@@ -17177,16 +17242,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/workbox-build/node_modules/brace-expansion": {
|
"node_modules/workbox-build/node_modules/brace-expansion": {
|
||||||
"version": "5.0.6",
|
"version": "5.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
|
||||||
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
|
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^4.0.2"
|
"balanced-match": "^4.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18 || 20 || >=22"
|
"node": "20 || >=22"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/workbox-build/node_modules/glob": {
|
"node_modules/workbox-build/node_modules/glob": {
|
||||||
|
|||||||
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
|
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
|
||||||
"homepage": "https://shakespeare.diy",
|
"homepage": "https://shakespeare.diy",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"version": "9.14.0",
|
"version": "9.15.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "shakespeare.diy",
|
"name": "shakespeare.diy",
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
"@isomorphic-git/lightning-fs": "^4.6.2",
|
"@isomorphic-git/lightning-fs": "^4.6.2",
|
||||||
"@modelcontextprotocol/sdk": "^1.22.0",
|
"@modelcontextprotocol/sdk": "^1.22.0",
|
||||||
"@mozilla/readability": "^0.6.0",
|
"@mozilla/readability": "^0.6.0",
|
||||||
"@nostrify/nostrify": "^0.51.1",
|
"@nostrify/nostrify": "^0.54.1",
|
||||||
"@nostrify/react": "^0.4.1",
|
"@nostrify/react": "^0.6.6",
|
||||||
"@opensecret/react": "^1.5.4",
|
"@opensecret/react": "^1.5.4",
|
||||||
"@plausible-analytics/tracker": "^0.4.4",
|
"@plausible-analytics/tracker": "^0.4.4",
|
||||||
"@radix-ui/react-accordion": "^1.2.0",
|
"@radix-ui/react-accordion": "^1.2.0",
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [9.15.0] - 2026-08-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Connect to Meridian as an AI provider — available as a one-click preset with streamlined setup
|
||||||
|
- Optimize Repository action in the project menu that consolidates git history to reclaim space and repair bloated repositories
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Zaps now verify the invoice amount before paying, so you're never charged more than you approved
|
||||||
|
|
||||||
## [9.14.0] - 2026-06-05
|
## [9.14.0] - 2026-06-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ const defaultConfig: AppConfig = {
|
|||||||
relays: [
|
relays: [
|
||||||
{ url: 'wss://git.shakespeare.diy/' },
|
{ url: 'wss://git.shakespeare.diy/' },
|
||||||
{ url: 'wss://relay.ngit.dev/' },
|
{ url: 'wss://relay.ngit.dev/' },
|
||||||
|
{ url: 'wss://git.nostrhub.io/' },
|
||||||
],
|
],
|
||||||
updatedAt: 0,
|
updatedAt: 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ export function AddAIProviderDialog({
|
|||||||
value={apiKey}
|
value={apiKey}
|
||||||
onChange={(e) => setApiKey(e.target.value)}
|
onChange={(e) => setApiKey(e.target.value)}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === 'Enter' && apiKey.trim() && termsAgreed) {
|
if (e.key === 'Enter' && apiKey.trim() && (termsAgreed || !preset.tosURL)) {
|
||||||
handleAdd();
|
handleAdd();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -165,20 +165,20 @@ export function AddAIProviderDialog({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Terms of Service Agreement */}
|
{/* Terms of Service Agreement (skipped for providers without terms, e.g. local services) */}
|
||||||
<div className="flex items-center gap-1.5">
|
{preset.tosURL && (
|
||||||
<Checkbox
|
<div className="flex items-center gap-1.5">
|
||||||
id="agree-terms"
|
<Checkbox
|
||||||
checked={termsAgreed}
|
id="agree-terms"
|
||||||
onCheckedChange={(checked) => setTermsAgreed(checked === true)}
|
checked={termsAgreed}
|
||||||
className="size-3 [&_svg]:size-3"
|
onCheckedChange={(checked) => setTermsAgreed(checked === true)}
|
||||||
/>
|
className="size-3 [&_svg]:size-3"
|
||||||
<label
|
/>
|
||||||
htmlFor="agree-terms"
|
<label
|
||||||
className="text-xs text-muted-foreground leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer"
|
htmlFor="agree-terms"
|
||||||
>
|
className="text-xs text-muted-foreground leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer"
|
||||||
{t('agreeToTermsOfService', { providerName: preset.name })}{' '}
|
>
|
||||||
{preset.tosURL ? (
|
{t('agreeToTermsOfService', { providerName: preset.name })}{' '}
|
||||||
<a
|
<a
|
||||||
href={preset.tosURL}
|
href={preset.tosURL}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@@ -188,11 +188,9 @@ export function AddAIProviderDialog({
|
|||||||
>
|
>
|
||||||
{t('termsOfService')}
|
{t('termsOfService')}
|
||||||
</a>
|
</a>
|
||||||
) : (
|
</label>
|
||||||
t('termsOfService')
|
</div>
|
||||||
)}
|
)}
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -205,7 +203,7 @@ export function AddAIProviderDialog({
|
|||||||
<Button
|
<Button
|
||||||
onClick={handleAdd}
|
onClick={handleAdd}
|
||||||
disabled={
|
disabled={
|
||||||
!termsAgreed ||
|
(!!preset.tosURL && !termsAgreed) ||
|
||||||
(!!preset.apiKeysURL && !apiKey.trim())
|
(!!preset.apiKeysURL && !apiKey.trim())
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,8 +1,26 @@
|
|||||||
import { useAppContext } from '@/hooks/useAppContext';
|
import { useAppContext } from '@/hooks/useAppContext';
|
||||||
import { faviconUrl } from '@/lib/faviconUrl';
|
import { faviconUrl } from '@/lib/faviconUrl';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
import { Globe } from 'lucide-react';
|
||||||
import { ReactNode, useMemo } from 'react';
|
import { ReactNode, useMemo } from 'react';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icons for known providers whose URLs can't resolve a favicon,
|
||||||
|
* such as services running on localhost.
|
||||||
|
*/
|
||||||
|
function knownProviderIcon(url: string | URL | undefined, size: number): ReactNode | undefined {
|
||||||
|
if (!url) return;
|
||||||
|
try {
|
||||||
|
const u = new URL(url);
|
||||||
|
// Meridian local bridge
|
||||||
|
if (u.hostname === '127.0.0.1' && u.port === '3456') {
|
||||||
|
return <Globe size={size} className="text-purple-500" />;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interface ExternalFaviconProps {
|
interface ExternalFaviconProps {
|
||||||
/** The URL to fetch the favicon for */
|
/** The URL to fetch the favicon for */
|
||||||
url: string | URL | undefined;
|
url: string | URL | undefined;
|
||||||
@@ -42,6 +60,16 @@ export function ExternalFavicon({
|
|||||||
}
|
}
|
||||||
}, [url, config.faviconUrl]);
|
}, [url, config.faviconUrl]);
|
||||||
|
|
||||||
|
// Providers with a known icon (e.g. local services) skip the favicon service
|
||||||
|
const knownIcon = knownProviderIcon(url, size);
|
||||||
|
if (knownIcon) {
|
||||||
|
return (
|
||||||
|
<span className={cn('inline-flex items-center justify-center', className)}>
|
||||||
|
{knownIcon}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// If faviconSrc is not available, render the fallback directly
|
// If faviconSrc is not available, render the fallback directly
|
||||||
if (!faviconSrc) {
|
if (!faviconSrc) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -0,0 +1,344 @@
|
|||||||
|
import git from 'isomorphic-git';
|
||||||
|
import { Loader2, Zap } from 'lucide-react';
|
||||||
|
import { DropdownMenuItem } from '@/components/ui/dropdown-menu';
|
||||||
|
import { useFS } from '@/hooks/useFS';
|
||||||
|
import { useFSPaths } from '@/hooks/useFSPaths';
|
||||||
|
import { toast } from '@/hooks/useToast';
|
||||||
|
import type { JSRuntimeFS } from '@/lib/JSRuntime';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Optimize Repository" entry for the project dropdown.
|
||||||
|
*
|
||||||
|
* Fully self-contained recovery action: clicking it consolidates the
|
||||||
|
* project's git pack files into a single pack containing every reachable
|
||||||
|
* object, deletes the old packs and redundant loose objects, and reports
|
||||||
|
* the size reduction in a toast. A spinner toast is shown while it runs.
|
||||||
|
*
|
||||||
|
* Everything (UI, gc algorithm, state) lives in this one file so the
|
||||||
|
* feature can be removed by deleting this file and its single render
|
||||||
|
* line in ProjectTitleMenu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Projects with an optimization currently in flight (reentrancy guard). */
|
||||||
|
const running = new Set<string>();
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Repository optimization (simplified `git gc` for isomorphic-git repos)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Yield to the event loop so the UI can paint between batches of work. */
|
||||||
|
function yieldToMain(): Promise<void> {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Recursively sum the size of all files under `path`. */
|
||||||
|
async function dirSize(fs: JSRuntimeFS, path: string): Promise<number> {
|
||||||
|
let total = 0;
|
||||||
|
let entries: string[];
|
||||||
|
try {
|
||||||
|
entries = await fs.readdir(path);
|
||||||
|
} catch {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for (const name of entries) {
|
||||||
|
const child = `${path}/${name}`;
|
||||||
|
try {
|
||||||
|
const stat = await fs.stat(child);
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
total += await dirSize(fs, child);
|
||||||
|
} else {
|
||||||
|
total += stat.size ?? 0;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Skip unreadable entries.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively walk a tree, adding every blob/tree OID to `reachable`.
|
||||||
|
* Returns the number of objects that could not be read.
|
||||||
|
*/
|
||||||
|
async function walkTree(
|
||||||
|
fs: JSRuntimeFS,
|
||||||
|
gitdir: string,
|
||||||
|
treeOid: string,
|
||||||
|
reachable: Set<string>,
|
||||||
|
visitedTrees: Set<string>,
|
||||||
|
): Promise<number> {
|
||||||
|
if (visitedTrees.has(treeOid)) return 0;
|
||||||
|
visitedTrees.add(treeOid);
|
||||||
|
|
||||||
|
let tree: Awaited<ReturnType<typeof git.readTree>>;
|
||||||
|
try {
|
||||||
|
tree = await git.readTree({ fs, gitdir, oid: treeOid });
|
||||||
|
} catch {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
reachable.add(treeOid);
|
||||||
|
|
||||||
|
let errors = 0;
|
||||||
|
for (const entry of tree.tree) {
|
||||||
|
if (entry.type === 'tree') {
|
||||||
|
errors += await walkTree(fs, gitdir, entry.oid, reachable, visitedTrees);
|
||||||
|
} else if (entry.type === 'blob') {
|
||||||
|
reachable.add(entry.oid);
|
||||||
|
}
|
||||||
|
// entry.type === 'commit' is a submodule gitlink; skip.
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OptimizeResult {
|
||||||
|
bytesBefore: number;
|
||||||
|
bytesAfter: number;
|
||||||
|
/** True when some objects could not be read, so the repo was left untouched. */
|
||||||
|
incomplete: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consolidate all reachable objects into one new pack, then delete the old
|
||||||
|
* packs and redundant loose objects.
|
||||||
|
*
|
||||||
|
* Non-destructive: every object reachable from any ref or HEAD is preserved.
|
||||||
|
* If any object fails to read during the reachability walk, or the new pack
|
||||||
|
* would be larger than the files it replaces, the repository is left
|
||||||
|
* completely untouched.
|
||||||
|
*/
|
||||||
|
async function optimizeRepository(fs: JSRuntimeFS, dir: string): Promise<OptimizeResult> {
|
||||||
|
const gitdir = `${dir}/.git`;
|
||||||
|
const objectsDir = `${gitdir}/objects`;
|
||||||
|
const packDir = `${objectsDir}/pack`;
|
||||||
|
|
||||||
|
const bytesBefore = await dirSize(fs, objectsDir);
|
||||||
|
|
||||||
|
let oldPackEntries: string[];
|
||||||
|
try {
|
||||||
|
oldPackEntries = await fs.readdir(packDir);
|
||||||
|
} catch {
|
||||||
|
oldPackEntries = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Collect ref tips (branches, tags, remotes, stash, HEAD).
|
||||||
|
const tips = new Set<string>();
|
||||||
|
let refs: string[] = [];
|
||||||
|
try {
|
||||||
|
refs = await git.listRefs({ fs, gitdir, filepath: 'refs' });
|
||||||
|
} catch {
|
||||||
|
refs = [];
|
||||||
|
}
|
||||||
|
for (const ref of refs) {
|
||||||
|
try {
|
||||||
|
tips.add(await git.resolveRef({ fs, gitdir, ref: `refs/${ref}` }));
|
||||||
|
} catch {
|
||||||
|
// Broken ref; skip.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
tips.add(await git.resolveRef({ fs, gitdir, ref: 'HEAD' }));
|
||||||
|
} catch {
|
||||||
|
// No HEAD (fresh repo).
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Walk reachability from every tip.
|
||||||
|
const reachable = new Set<string>();
|
||||||
|
const visitedTrees = new Set<string>();
|
||||||
|
const stack = [...tips];
|
||||||
|
let walkErrors = 0;
|
||||||
|
let steps = 0;
|
||||||
|
|
||||||
|
while (stack.length > 0) {
|
||||||
|
const oid = stack.pop()!;
|
||||||
|
if (reachable.has(oid)) continue;
|
||||||
|
|
||||||
|
let parsed: Awaited<ReturnType<typeof git.readObject>>;
|
||||||
|
try {
|
||||||
|
parsed = await git.readObject({ fs, gitdir, oid, format: 'parsed' });
|
||||||
|
} catch {
|
||||||
|
walkErrors++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
reachable.add(oid);
|
||||||
|
|
||||||
|
if (parsed.type === 'commit') {
|
||||||
|
const commit = parsed.object as { tree: string; parent: string[] };
|
||||||
|
for (const parent of commit.parent) stack.push(parent);
|
||||||
|
walkErrors += await walkTree(fs, gitdir, commit.tree, reachable, visitedTrees);
|
||||||
|
} else if (parsed.type === 'tag') {
|
||||||
|
stack.push((parsed.object as { object: string }).object);
|
||||||
|
} else if (parsed.type === 'tree') {
|
||||||
|
walkErrors += await walkTree(fs, gitdir, oid, reachable, visitedTrees);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (++steps % 64 === 0) await yieldToMain();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (walkErrors > 0 || reachable.size === 0) {
|
||||||
|
// Damaged repo (or empty repo) — change nothing.
|
||||||
|
return { bytesBefore, bytesAfter: bytesBefore, incomplete: walkErrors > 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Write the consolidated pack and its index.
|
||||||
|
await yieldToMain();
|
||||||
|
const { filename } = await git.packObjects({
|
||||||
|
fs,
|
||||||
|
gitdir,
|
||||||
|
oids: [...reachable],
|
||||||
|
write: true,
|
||||||
|
});
|
||||||
|
await git.indexPack({ fs, dir, gitdir, filepath: `.git/objects/pack/${filename}` });
|
||||||
|
|
||||||
|
// 4. Safety check: isomorphic-git writes undeltified packs, which can be
|
||||||
|
// larger than the (server-deltified) packs they replace. Only proceed if
|
||||||
|
// deleting the old packs and loose copies reclaims more than the new pack
|
||||||
|
// costs; otherwise remove the new pack and leave the repo exactly as-is.
|
||||||
|
const fileSize = async (path: string): Promise<number> => {
|
||||||
|
try {
|
||||||
|
return (await fs.stat(path)).size ?? 0;
|
||||||
|
} catch {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const newBase = filename!.replace(/\.pack$/, '');
|
||||||
|
const newPackBytes =
|
||||||
|
(await fileSize(`${packDir}/${filename}`)) + (await fileSize(`${packDir}/${newBase}.idx`));
|
||||||
|
let reclaimableBytes = 0;
|
||||||
|
for (const name of oldPackEntries) {
|
||||||
|
if (name.startsWith(`${newBase}.`)) continue;
|
||||||
|
if (!/\.(pack|idx)$/.test(name)) continue;
|
||||||
|
reclaimableBytes += await fileSize(`${packDir}/${name}`);
|
||||||
|
}
|
||||||
|
steps = 0;
|
||||||
|
for (const oid of reachable) {
|
||||||
|
reclaimableBytes += await fileSize(`${objectsDir}/${oid.slice(0, 2)}/${oid.slice(2)}`);
|
||||||
|
if (++steps % 64 === 0) await yieldToMain();
|
||||||
|
}
|
||||||
|
if (newPackBytes >= reclaimableBytes) {
|
||||||
|
for (const name of [filename!, `${newBase}.idx`]) {
|
||||||
|
try {
|
||||||
|
await fs.unlink(`${packDir}/${name}`);
|
||||||
|
} catch {
|
||||||
|
// Best-effort.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { bytesBefore, bytesAfter: bytesBefore, incomplete: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Delete the old pack files.
|
||||||
|
for (const name of oldPackEntries) {
|
||||||
|
if (name.startsWith(`${newBase}.`)) continue;
|
||||||
|
if (!/\.(pack|idx)$/.test(name)) continue;
|
||||||
|
try {
|
||||||
|
await fs.unlink(`${packDir}/${name}`);
|
||||||
|
} catch {
|
||||||
|
// Best-effort.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Delete loose copies of objects now stored in the new pack.
|
||||||
|
const touchedDirs = new Set<string>();
|
||||||
|
steps = 0;
|
||||||
|
for (const oid of reachable) {
|
||||||
|
const looseDir = `${objectsDir}/${oid.slice(0, 2)}`;
|
||||||
|
try {
|
||||||
|
await fs.unlink(`${looseDir}/${oid.slice(2)}`);
|
||||||
|
touchedDirs.add(looseDir);
|
||||||
|
} catch {
|
||||||
|
// Object wasn't loose; nothing to do.
|
||||||
|
}
|
||||||
|
if (++steps % 64 === 0) await yieldToMain();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove now-empty loose object shards.
|
||||||
|
for (const looseDir of touchedDirs) {
|
||||||
|
try {
|
||||||
|
if ((await fs.readdir(looseDir)).length === 0) await fs.rmdir(looseDir);
|
||||||
|
} catch {
|
||||||
|
// Best-effort.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const bytesAfter = await dirSize(fs, objectsDir);
|
||||||
|
return { bytesBefore, bytesAfter, incomplete: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// UI
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function formatBytes(bytes: number): string {
|
||||||
|
if (bytes < 1024) return `${bytes} B`;
|
||||||
|
const units = ['KB', 'MB', 'GB'];
|
||||||
|
let value = bytes;
|
||||||
|
let unit = 'B';
|
||||||
|
for (const next of units) {
|
||||||
|
if (value < 1024) break;
|
||||||
|
value /= 1024;
|
||||||
|
unit = next;
|
||||||
|
}
|
||||||
|
return `${value.toFixed(1)} ${unit}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run(fs: JSRuntimeFS, dir: string, projectId: string) {
|
||||||
|
if (running.has(projectId)) return;
|
||||||
|
running.add(projectId);
|
||||||
|
|
||||||
|
const progress = toast({
|
||||||
|
description: (
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
<Loader2 className="h-4 w-4 animate-spin" />
|
||||||
|
Optimizing repository…
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
duration: Infinity,
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await optimizeRepository(fs, dir);
|
||||||
|
const saved = result.bytesBefore - result.bytesAfter;
|
||||||
|
|
||||||
|
progress.update({
|
||||||
|
id: progress.id,
|
||||||
|
title: 'Repository optimized',
|
||||||
|
description: result.incomplete
|
||||||
|
? 'Some objects could not be read, so the repository was left untouched for safety.'
|
||||||
|
: saved > 0
|
||||||
|
? `${formatBytes(result.bytesBefore)} → ${formatBytes(result.bytesAfter)} (saved ${formatBytes(saved)})`
|
||||||
|
: `No size reduction (${formatBytes(result.bytesAfter)})`,
|
||||||
|
duration: 10000,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
progress.update({
|
||||||
|
id: progress.id,
|
||||||
|
title: 'Repository optimization failed',
|
||||||
|
description: error instanceof Error ? error.message : String(error),
|
||||||
|
variant: 'destructive',
|
||||||
|
duration: 10000,
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
running.delete(projectId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OptimizeRepositoryMenuItemProps {
|
||||||
|
projectId: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function OptimizeRepositoryMenuItem({ projectId, disabled }: OptimizeRepositoryMenuItemProps) {
|
||||||
|
const { fs } = useFS();
|
||||||
|
const { projectsPath } = useFSPaths();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DropdownMenuItem
|
||||||
|
onClick={() => run(fs, `${projectsPath}/${projectId}`, projectId)}
|
||||||
|
disabled={disabled}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<Zap className="h-4 w-4" />
|
||||||
|
Optimize Repository
|
||||||
|
</DropdownMenuItem>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
|
import { OptimizeRepositoryMenuItem } from '@/components/OptimizeRepositoryMenuItem';
|
||||||
|
|
||||||
interface ProjectTitleMenuProps {
|
interface ProjectTitleMenuProps {
|
||||||
projectId: string;
|
projectId: string;
|
||||||
@@ -119,6 +120,8 @@ export function ProjectTitleMenu({
|
|||||||
Rollback
|
Rollback
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
|
||||||
|
<OptimizeRepositoryMenuItem projectId={projectId} disabled={isAnyLoading} />
|
||||||
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={onNewChat}
|
onClick={onNewChat}
|
||||||
disabled={isAnyLoading}
|
disabled={isAnyLoading}
|
||||||
|
|||||||
+11
-1
@@ -2,6 +2,7 @@ import { useState, useCallback } from 'react';
|
|||||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||||
import { useToast } from '@/hooks/useToast';
|
import { useToast } from '@/hooks/useToast';
|
||||||
import { LN } from '@getalby/sdk';
|
import { LN } from '@getalby/sdk';
|
||||||
|
import { assertInvoiceAmount } from '@/lib/bolt11';
|
||||||
|
|
||||||
export interface NWCConnection {
|
export interface NWCConnection {
|
||||||
connectionString: string;
|
connectionString: string;
|
||||||
@@ -159,12 +160,21 @@ export function useNWCInternal() {
|
|||||||
// Send payment using the SDK
|
// Send payment using the SDK
|
||||||
const sendPayment = useCallback(async (
|
const sendPayment = useCallback(async (
|
||||||
connection: NWCConnection,
|
connection: NWCConnection,
|
||||||
invoice: string
|
invoice: string,
|
||||||
|
/**
|
||||||
|
* Amount in millisatoshis the user approved. The wallet is handed only the
|
||||||
|
* invoice, so this is the last point at which the sum the user agreed to
|
||||||
|
* and the sum the invoice charges can be compared — without it, whoever
|
||||||
|
* issued the invoice decides how much leaves the wallet.
|
||||||
|
*/
|
||||||
|
expectedAmountMsat: number,
|
||||||
): Promise<{ preimage: string }> => {
|
): Promise<{ preimage: string }> => {
|
||||||
if (!connection.connectionString) {
|
if (!connection.connectionString) {
|
||||||
throw new Error('Invalid connection: missing connection string');
|
throw new Error('Invalid connection: missing connection string');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertInvoiceAmount(invoice, expectedAmountMsat);
|
||||||
|
|
||||||
let client: LN;
|
let client: LN;
|
||||||
try {
|
try {
|
||||||
client = new LN(connection.connectionString);
|
client = new LN(connection.connectionString);
|
||||||
|
|||||||
+54
-8
@@ -11,6 +11,8 @@ import type { WebLNProvider } from 'webln';
|
|||||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
import { useNostr } from '@nostrify/react';
|
import { useNostr } from '@nostrify/react';
|
||||||
import type { NostrEvent } from '@nostrify/nostrify';
|
import type { NostrEvent } from '@nostrify/nostrify';
|
||||||
|
import { assertInvoiceAmount, invoiceCommitsTo } from '@/lib/bolt11';
|
||||||
|
import { resolveLnurlPay, type LnurlPayParams } from '@/lib/lnurlPay';
|
||||||
|
|
||||||
export function useZaps(
|
export function useZaps(
|
||||||
target: Event | Event[],
|
target: Event | Event[],
|
||||||
@@ -180,12 +182,19 @@ export function useZaps(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get zap endpoint using the old reliable method
|
// Resolve the recipient's LNURL-pay endpoint in-repo instead of via
|
||||||
const zapEndpoint = await nip57.getZapEndpoint(author.data.event);
|
// nip57.getZapEndpoint, which returns only the callback URL and discards
|
||||||
if (!zapEndpoint) {
|
// the minSendable/maxSendable bounds and metadata needed to validate the
|
||||||
|
// invoice we get back.
|
||||||
|
let lnurlParams: LnurlPayParams;
|
||||||
|
try {
|
||||||
|
lnurlParams = await resolveLnurlPay({ lud06, lud16 });
|
||||||
|
} catch (endpointError) {
|
||||||
toast({
|
toast({
|
||||||
title: 'Zap endpoint not found',
|
title: 'Zap endpoint not found',
|
||||||
description: 'Could not find a zap endpoint for the author.',
|
description: endpointError instanceof Error
|
||||||
|
? endpointError.message
|
||||||
|
: 'Could not find a zap endpoint for the author.',
|
||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
});
|
});
|
||||||
setIsZapping(false);
|
setIsZapping(false);
|
||||||
@@ -194,6 +203,20 @@ export function useZaps(
|
|||||||
|
|
||||||
const zapAmount = amount * 1000; // convert to millisats
|
const zapAmount = amount * 1000; // convert to millisats
|
||||||
|
|
||||||
|
// The endpoint advertises what it will accept; asking for anything
|
||||||
|
// outside that range can only produce an invoice we'd have to reject.
|
||||||
|
if (zapAmount < lnurlParams.minSendable || zapAmount > lnurlParams.maxSendable) {
|
||||||
|
toast({
|
||||||
|
title: 'Amount out of range',
|
||||||
|
description:
|
||||||
|
`This lightning address accepts between ${Math.ceil(lnurlParams.minSendable / 1000)} and ` +
|
||||||
|
`${Math.floor(lnurlParams.maxSendable / 1000)} sats.`,
|
||||||
|
variant: 'destructive',
|
||||||
|
});
|
||||||
|
setIsZapping(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const writeRelays = config.relayMetadata.relays
|
const writeRelays = config.relayMetadata.relays
|
||||||
.filter(r => r.write)
|
.filter(r => r.write)
|
||||||
.map(r => r.url);
|
.map(r => r.url);
|
||||||
@@ -209,9 +232,14 @@ export function useZaps(
|
|||||||
throw new Error('No signer available');
|
throw new Error('No signer available');
|
||||||
}
|
}
|
||||||
const signedZapRequest = await user.signer.signEvent(zapRequest);
|
const signedZapRequest = await user.signer.signEvent(zapRequest);
|
||||||
|
const zapRequestJson = JSON.stringify(signedZapRequest);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${zapEndpoint}?amount=${zapAmount}&nostr=${encodeURI(JSON.stringify(signedZapRequest))}`);
|
const zapUrl = new URL(lnurlParams.callback);
|
||||||
|
zapUrl.searchParams.set('amount', String(zapAmount));
|
||||||
|
zapUrl.searchParams.set('nostr', zapRequestJson);
|
||||||
|
|
||||||
|
const res = await fetch(zapUrl.toString());
|
||||||
const responseData = await res.json();
|
const responseData = await res.json();
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
@@ -223,13 +251,31 @@ export function useZaps(
|
|||||||
throw new Error('Lightning service did not return a valid invoice');
|
throw new Error('Lightning service did not return a valid invoice');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The endpoint that produced this invoice is chosen by the recipient,
|
||||||
|
// so the invoice is not trusted: decode it and require that it charges
|
||||||
|
// exactly what the user approved. Without this, the recipient — not the
|
||||||
|
// sender — decides how much the sender pays. Throwing here aborts
|
||||||
|
// before any wallet is touched, on every payment path.
|
||||||
|
const decodedInvoice = assertInvoiceAmount(newInvoice, zapAmount);
|
||||||
|
|
||||||
|
// LUD-06 binds the invoice to the endpoint's `metadata`; NIP-57 binds
|
||||||
|
// it to the zap request instead. Either is fine, anything else means
|
||||||
|
// the invoice was not issued for this request.
|
||||||
|
if (!invoiceCommitsTo(decodedInvoice, [zapRequestJson, lnurlParams.metadata])) {
|
||||||
|
throw new Error('Lightning service returned an invoice for a different request. Payment cancelled.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Report what the invoice actually charges rather than what was asked
|
||||||
|
// for, so a success screen can never understate a spend.
|
||||||
|
const paidSats = Math.round(decodedInvoice.amountMsat / 1000);
|
||||||
|
|
||||||
// Get the current active NWC connection dynamically
|
// Get the current active NWC connection dynamically
|
||||||
const currentNWCConnection = getActiveConnection();
|
const currentNWCConnection = getActiveConnection();
|
||||||
|
|
||||||
// Try NWC first if available and properly connected
|
// Try NWC first if available and properly connected
|
||||||
if (currentNWCConnection && currentNWCConnection.connectionString && currentNWCConnection.isConnected) {
|
if (currentNWCConnection && currentNWCConnection.connectionString && currentNWCConnection.isConnected) {
|
||||||
try {
|
try {
|
||||||
await sendPayment(currentNWCConnection, newInvoice);
|
await sendPayment(currentNWCConnection, newInvoice, zapAmount);
|
||||||
|
|
||||||
// Clear states immediately on success
|
// Clear states immediately on success
|
||||||
setIsZapping(false);
|
setIsZapping(false);
|
||||||
@@ -237,7 +283,7 @@ export function useZaps(
|
|||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: 'Zap successful!',
|
title: 'Zap successful!',
|
||||||
description: `You sent ${amount} sats via NWC to the author.`,
|
description: `You sent ${paidSats} sats via NWC to the author.`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Invalidate zap queries to refresh counts
|
// Invalidate zap queries to refresh counts
|
||||||
@@ -269,7 +315,7 @@ export function useZaps(
|
|||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: 'Zap successful!',
|
title: 'Zap successful!',
|
||||||
description: `You sent ${amount} sats to the author.`,
|
description: `You sent ${paidSats} sats to the author.`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Invalidate zap queries to refresh counts
|
// Invalidate zap queries to refresh counts
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export interface PresetProvider {
|
|||||||
tosURL?: string;
|
tosURL?: string;
|
||||||
proxy?: boolean;
|
proxy?: boolean;
|
||||||
openSecret?: string;
|
openSecret?: string;
|
||||||
|
/** Default API key for providers where the key is a required placeholder */
|
||||||
|
apiKey?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AI_PROVIDER_PRESETS: PresetProvider[] = [
|
export const AI_PROVIDER_PRESETS: PresetProvider[] = [
|
||||||
@@ -106,4 +108,12 @@ export const AI_PROVIDER_PRESETS: PresetProvider[] = [
|
|||||||
tosURL: "https://vercel.com/legal/terms",
|
tosURL: "https://vercel.com/legal/terms",
|
||||||
proxy: true,
|
proxy: true,
|
||||||
},
|
},
|
||||||
];
|
{
|
||||||
|
// Local Anthropic/OpenAI-compatible bridge; authenticates via the
|
||||||
|
// Claude Code SDK. The API key is a placeholder — any value works.
|
||||||
|
id: "meridian",
|
||||||
|
name: "Meridian",
|
||||||
|
baseURL: "http://127.0.0.1:3456/v1",
|
||||||
|
apiKey: "x",
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
|
||||||
|
import { assertInvoiceAmount, decodeBolt11, invoiceCommitsTo } from './bolt11';
|
||||||
|
|
||||||
|
// BOLT 11 specification test vectors.
|
||||||
|
/** 2500u = 250,000,000 msat, with a plain-text description. */
|
||||||
|
const INVOICE_2500U =
|
||||||
|
'lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypq' +
|
||||||
|
'dq5xysxxatsyp3k7enxv4jsxqzpuaztrnwngzn3kdzw5hydlzf03qdgm2hdq27cqv3agm2aw' +
|
||||||
|
'hz5se903vruatfhq77w3ls4evs3ch9zw97j25emudupq63nyw24cg27h2rspfj9srp';
|
||||||
|
|
||||||
|
/** No amount in the human-readable part — the payer or payee picks the sum. */
|
||||||
|
const INVOICE_AMOUNTLESS =
|
||||||
|
'lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2p' +
|
||||||
|
'kx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcs' +
|
||||||
|
'yz3d73gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erq' +
|
||||||
|
'z25le42c4u4ecky03ylcqca784w';
|
||||||
|
|
||||||
|
/** 20m = 2,000,000,000 msat, carrying a description hash rather than text. */
|
||||||
|
const INVOICE_20M_WITH_HASH =
|
||||||
|
'lnbc20m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp' +
|
||||||
|
'58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqscc6gd6ql3jrc5yzme8v' +
|
||||||
|
'4ntcewwz5cnw92tz0pc8qcuufvq7khhr8wpald05e92xw006sq94mg8v2ndf4sefvf9sygks' +
|
||||||
|
'hp5zfem29trqq2yxxz7';
|
||||||
|
|
||||||
|
/** The string whose sha256 is the description hash in {@link INVOICE_20M_WITH_HASH}. */
|
||||||
|
const HASHED_DESCRIPTION =
|
||||||
|
'One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, ' +
|
||||||
|
'one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, ' +
|
||||||
|
'and one slice of watermelon';
|
||||||
|
|
||||||
|
describe('decodeBolt11', () => {
|
||||||
|
it('decodes the amount from the human-readable part', () => {
|
||||||
|
expect(decodeBolt11(INVOICE_2500U).amountMsat).toBe(250_000_000);
|
||||||
|
expect(decodeBolt11(INVOICE_20M_WITH_HASH).amountMsat).toBe(2_000_000_000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reports an amountless invoice as null rather than zero', () => {
|
||||||
|
expect(decodeBolt11(INVOICE_AMOUNTLESS).amountMsat).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reads the network, timestamp and payment hash', () => {
|
||||||
|
const decoded = decodeBolt11(INVOICE_2500U);
|
||||||
|
expect(decoded.network).toBe('bc');
|
||||||
|
expect(decoded.timestamp).toBe(1496314658);
|
||||||
|
expect(decoded.paymentHash).toBe(
|
||||||
|
'0001020304050607080900010203040506070809000102030405060708090102',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reads the plain-text description', () => {
|
||||||
|
expect(decodeBolt11(INVOICE_2500U).description).toBe('1 cup coffee');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reads the description hash', () => {
|
||||||
|
expect(decodeBolt11(INVOICE_20M_WITH_HASH).descriptionHash).toHaveLength(64);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('tolerates a lightning: URI prefix, whitespace and uppercase', () => {
|
||||||
|
expect(decodeBolt11(` LIGHTNING:${INVOICE_2500U.toUpperCase()} `).amountMsat).toBe(250_000_000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects a string that is not an invoice', () => {
|
||||||
|
expect(() => decodeBolt11('not-an-invoice')).toThrow();
|
||||||
|
expect(() => decodeBolt11('')).toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects an invoice whose checksum has been tampered with', () => {
|
||||||
|
// Flip the last character of the bech32 checksum.
|
||||||
|
const tampered = INVOICE_2500U.slice(0, -1) + (INVOICE_2500U.endsWith('p') ? 'q' : 'p');
|
||||||
|
expect(() => decodeBolt11(tampered)).toThrow();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('assertInvoiceAmount', () => {
|
||||||
|
it('accepts an invoice for exactly the requested amount', () => {
|
||||||
|
expect(assertInvoiceAmount(INVOICE_2500U, 250_000_000).amountMsat).toBe(250_000_000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects an invoice for more than was requested', () => {
|
||||||
|
// The reported attack: the user approves 776 sats and the recipient's own
|
||||||
|
// LNURL server answers with an invoice for 5,000,000 sats.
|
||||||
|
expect(() => assertInvoiceAmount(INVOICE_2500U, 776_000)).toThrow(/250000 sats.*776 sats/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects an invoice for less than was requested', () => {
|
||||||
|
expect(() => assertInvoiceAmount(INVOICE_2500U, 250_000_001)).toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects an amountless invoice, which would let the wallet pick the sum', () => {
|
||||||
|
expect(() => assertInvoiceAmount(INVOICE_AMOUNTLESS, 250_000_000)).toThrow(/no amount/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects an unparseable invoice rather than passing it through', () => {
|
||||||
|
expect(() => assertInvoiceAmount('lnbc-garbage', 1000)).toThrow(/unreadable/);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('invoiceCommitsTo', () => {
|
||||||
|
it('accepts an invoice whose description hash matches a candidate', () => {
|
||||||
|
const decoded = decodeBolt11(INVOICE_20M_WITH_HASH);
|
||||||
|
expect(invoiceCommitsTo(decoded, ['something else', HASHED_DESCRIPTION])).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects an invoice bound to a different request', () => {
|
||||||
|
const decoded = decodeBolt11(INVOICE_20M_WITH_HASH);
|
||||||
|
expect(invoiceCommitsTo(decoded, ['a different zap request'])).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('accepts an invoice with no description hash at all', () => {
|
||||||
|
// Many providers use a plain `d` description; the amount check is what
|
||||||
|
// stops an overcharge, this is only defence in depth.
|
||||||
|
expect(invoiceCommitsTo(decodeBolt11(INVOICE_2500U), ['anything'])).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,258 @@
|
|||||||
|
/**
|
||||||
|
* BOLT11 lightning invoice decoding.
|
||||||
|
*
|
||||||
|
* This is an *authentication* decoder, not a display heuristic: before any
|
||||||
|
* wallet is asked to pay an invoice we have to know exactly what that invoice
|
||||||
|
* commits to. `nip57.getSatoshisAmountFromBolt11` reads the human-readable
|
||||||
|
* part of a string that is assumed to already be an invoice — it will happily
|
||||||
|
* report an amount for a string that is not a valid invoice at all, and it
|
||||||
|
* cannot see the tagged fields. Use {@link decodeBolt11} for anything that
|
||||||
|
* moves money.
|
||||||
|
*
|
||||||
|
* Built on `@scure/base` + `@noble/hashes`, both already in the entry bundle
|
||||||
|
* via `nostr-tools`, so this adds no new dependency.
|
||||||
|
*
|
||||||
|
* Reference: BOLT 11, "Invoice Protocol for Lightning Payments".
|
||||||
|
*/
|
||||||
|
import { bech32 } from '@scure/base';
|
||||||
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
|
import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils';
|
||||||
|
|
||||||
|
/** A decoded BOLT11 invoice. Only the fields we need are surfaced. */
|
||||||
|
export interface DecodedInvoice {
|
||||||
|
/**
|
||||||
|
* Amount in millisatoshis, or `null` when the invoice is *amountless* —
|
||||||
|
* meaning the payer or the payee chooses the sum. Never pay an amountless
|
||||||
|
* invoice on the user's behalf.
|
||||||
|
*/
|
||||||
|
amountMsat: number | null;
|
||||||
|
/** Network prefix from the human-readable part: `bc`, `tb`, `bcrt`, `sb`. */
|
||||||
|
network: string;
|
||||||
|
/** Hex 32-byte payment hash (`p` field). */
|
||||||
|
paymentHash?: string;
|
||||||
|
/** Hex 32-byte description hash (`h` field), if the invoice carries one. */
|
||||||
|
descriptionHash?: string;
|
||||||
|
/** Plain-text description (`d` field), if the invoice carries one. */
|
||||||
|
description?: string;
|
||||||
|
/** Hex 33-byte payee node id (`n` field), if the invoice carries one. */
|
||||||
|
payee?: string;
|
||||||
|
/** Invoice creation time, in Unix seconds. */
|
||||||
|
timestamp: number;
|
||||||
|
/** Seconds after {@link timestamp} that the invoice expires. */
|
||||||
|
expiry: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Millisatoshis in one bitcoin. */
|
||||||
|
const MSAT_PER_BTC = 100_000_000_000n;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BOLT11 amount multipliers, as the divisor applied to {@link MSAT_PER_BTC}.
|
||||||
|
* `p` (pico) divides to 1/10 msat, so pico amounts must be a multiple of 10.
|
||||||
|
*/
|
||||||
|
const MULTIPLIERS: Record<string, bigint> = {
|
||||||
|
m: 1_000n,
|
||||||
|
u: 1_000_000n,
|
||||||
|
n: 1_000_000_000n,
|
||||||
|
p: 1_000_000_000_000n,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** `ln` + network + optional amount. Longer prefixes first (`bcrt` vs `bc`). */
|
||||||
|
const HRP_RE = /^ln(bcrt|bc|tbs|tb|sb)(?:(\d+)([munp])?)?$/;
|
||||||
|
|
||||||
|
/** BOLT11 tagged-field types, as bech32 word values. */
|
||||||
|
const TAG_PAYMENT_HASH = 1; // 'p'
|
||||||
|
const TAG_DESCRIPTION = 13; // 'd'
|
||||||
|
const TAG_PAYEE = 19; // 'n'
|
||||||
|
const TAG_DESCRIPTION_HASH = 23; // 'h'
|
||||||
|
const TAG_EXPIRY = 6; // 'x'
|
||||||
|
|
||||||
|
/** Words occupied by the trailing signature (65 bytes = 520 bits). */
|
||||||
|
const SIGNATURE_WORDS = 104;
|
||||||
|
/** Words occupied by the leading timestamp (35 bits). */
|
||||||
|
const TIMESTAMP_WORDS = 7;
|
||||||
|
|
||||||
|
/** BOLT11's default expiry when no `x` field is present. */
|
||||||
|
const DEFAULT_EXPIRY = 3600;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pack 5-bit bech32 words into bytes, discarding any trailing bits that do
|
||||||
|
* not complete a byte. BOLT11 fields are not all byte-aligned (a 32-byte hash
|
||||||
|
* occupies 52 words = 260 bits), so `bech32.fromWords` — which rejects
|
||||||
|
* leftover bits — cannot be used here.
|
||||||
|
*/
|
||||||
|
function wordsToBytes(words: number[]): Uint8Array {
|
||||||
|
const out = new Uint8Array(Math.floor((words.length * 5) / 8));
|
||||||
|
let acc = 0;
|
||||||
|
let bits = 0;
|
||||||
|
let i = 0;
|
||||||
|
for (const word of words) {
|
||||||
|
acc = (acc << 5) | word;
|
||||||
|
bits += 5;
|
||||||
|
while (bits >= 8) {
|
||||||
|
bits -= 8;
|
||||||
|
out[i++] = (acc >> bits) & 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Read a big-endian integer out of 5-bit words. */
|
||||||
|
function wordsToInt(words: number[]): number {
|
||||||
|
let value = 0;
|
||||||
|
for (const word of words) {
|
||||||
|
value = value * 32 + word;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Parse the amount out of a BOLT11 human-readable part, in millisatoshis. */
|
||||||
|
function parseHrpAmount(digits: string | undefined, multiplier: string | undefined): number | null {
|
||||||
|
if (!digits) return null;
|
||||||
|
|
||||||
|
const value = BigInt(digits);
|
||||||
|
const divisor = multiplier ? MULTIPLIERS[multiplier] : 1n;
|
||||||
|
const numerator = value * MSAT_PER_BTC;
|
||||||
|
|
||||||
|
if (numerator % divisor !== 0n) {
|
||||||
|
// Sub-millisatoshi precision. BOLT11 forbids it, and we can't pay it.
|
||||||
|
throw new Error('Invalid BOLT11 invoice: amount is not a whole number of millisatoshis');
|
||||||
|
}
|
||||||
|
|
||||||
|
const msat = numerator / divisor;
|
||||||
|
if (msat > BigInt(Number.MAX_SAFE_INTEGER)) {
|
||||||
|
throw new Error('Invalid BOLT11 invoice: amount is implausibly large');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Number(msat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode a BOLT11 invoice, verifying its bech32 checksum and structure.
|
||||||
|
*
|
||||||
|
* Throws on anything that is not a well-formed invoice. The signature is not
|
||||||
|
* checked — verifying it would only prove the invoice was signed by whoever
|
||||||
|
* the invoice itself names as payee, which tells us nothing we didn't already
|
||||||
|
* decide by choosing to talk to that endpoint. What matters to callers is the
|
||||||
|
* *amount* and the *description hash*, both of which are covered here.
|
||||||
|
*/
|
||||||
|
export function decodeBolt11(invoice: string): DecodedInvoice {
|
||||||
|
const trimmed = invoice.trim().replace(/^lightning:/i, '');
|
||||||
|
const lowered = trimmed.toLowerCase();
|
||||||
|
|
||||||
|
if (!lowered.startsWith('ln')) {
|
||||||
|
throw new Error('Invalid BOLT11 invoice: missing "ln" prefix');
|
||||||
|
}
|
||||||
|
|
||||||
|
// `false` disables bech32's 90-character limit, which invoices exceed.
|
||||||
|
const { prefix, words } = bech32.decode(lowered as `${Lowercase<string>}1${string}`, false);
|
||||||
|
|
||||||
|
const hrp = HRP_RE.exec(prefix);
|
||||||
|
if (!hrp) {
|
||||||
|
throw new Error('Invalid BOLT11 invoice: unrecognized prefix');
|
||||||
|
}
|
||||||
|
|
||||||
|
const [, network, digits, multiplier] = hrp;
|
||||||
|
const amountMsat = parseHrpAmount(digits, multiplier);
|
||||||
|
|
||||||
|
if (words.length < TIMESTAMP_WORDS + SIGNATURE_WORDS) {
|
||||||
|
throw new Error('Invalid BOLT11 invoice: truncated');
|
||||||
|
}
|
||||||
|
|
||||||
|
const timestamp = wordsToInt(words.slice(0, TIMESTAMP_WORDS));
|
||||||
|
const tagged = words.slice(TIMESTAMP_WORDS, words.length - SIGNATURE_WORDS);
|
||||||
|
|
||||||
|
const decoded: DecodedInvoice = { amountMsat, network, timestamp, expiry: DEFAULT_EXPIRY };
|
||||||
|
|
||||||
|
for (let i = 0; i + 3 <= tagged.length;) {
|
||||||
|
const type = tagged[i];
|
||||||
|
const length = tagged[i + 1] * 32 + tagged[i + 2];
|
||||||
|
const start = i + 3;
|
||||||
|
const end = start + length;
|
||||||
|
if (end > tagged.length) {
|
||||||
|
throw new Error('Invalid BOLT11 invoice: tagged field overruns the invoice');
|
||||||
|
}
|
||||||
|
const data = tagged.slice(start, end);
|
||||||
|
i = end;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TAG_PAYMENT_HASH:
|
||||||
|
if (length === 52) decoded.paymentHash = bytesToHex(wordsToBytes(data));
|
||||||
|
break;
|
||||||
|
case TAG_DESCRIPTION_HASH:
|
||||||
|
if (length === 52) decoded.descriptionHash = bytesToHex(wordsToBytes(data));
|
||||||
|
break;
|
||||||
|
case TAG_PAYEE:
|
||||||
|
if (length === 53) decoded.payee = bytesToHex(wordsToBytes(data));
|
||||||
|
break;
|
||||||
|
case TAG_DESCRIPTION:
|
||||||
|
decoded.description = new TextDecoder().decode(wordsToBytes(data));
|
||||||
|
break;
|
||||||
|
case TAG_EXPIRY:
|
||||||
|
decoded.expiry = wordsToInt(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assert that `invoice` is payable for exactly `expectedMsat`.
|
||||||
|
*
|
||||||
|
* LNURL-pay endpoints are chosen by the *recipient*, so the invoice they hand
|
||||||
|
* back is attacker-controlled whenever the recipient is hostile. Without this
|
||||||
|
* check the recipient — not the sender — decides how much the sender pays.
|
||||||
|
*
|
||||||
|
* Returns the decoded invoice so callers can report the amount they actually
|
||||||
|
* paid rather than the one they asked for.
|
||||||
|
*/
|
||||||
|
export function assertInvoiceAmount(
|
||||||
|
invoice: string,
|
||||||
|
expectedMsat: number,
|
||||||
|
): DecodedInvoice & { amountMsat: number } {
|
||||||
|
let decoded: DecodedInvoice;
|
||||||
|
try {
|
||||||
|
decoded = decodeBolt11(invoice);
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(
|
||||||
|
`Lightning service returned an unreadable invoice: ${
|
||||||
|
error instanceof Error ? error.message : 'unknown error'
|
||||||
|
}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decoded.amountMsat === null) {
|
||||||
|
throw new Error(
|
||||||
|
'Lightning service returned an invoice with no amount, which would let it charge any sum. Payment cancelled.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decoded.amountMsat !== expectedMsat) {
|
||||||
|
throw new Error(
|
||||||
|
`Lightning service returned an invoice for ${Math.round(decoded.amountMsat / 1000)} sats, ` +
|
||||||
|
`but ${Math.round(expectedMsat / 1000)} sats was requested. Payment cancelled.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ...decoded, amountMsat: decoded.amountMsat };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check an invoice's `h` field against the strings it is allowed to commit to.
|
||||||
|
*
|
||||||
|
* LUD-06 binds the invoice to the LNURL endpoint's `metadata`; NIP-57 replaces
|
||||||
|
* that with the zap request JSON. Providers implement one or the other, so any
|
||||||
|
* match is accepted. An invoice with no `h` field at all is accepted too —
|
||||||
|
* plenty of providers use a plain `d` description — because the amount check
|
||||||
|
* is what actually stops an overcharge; this is defence in depth against a
|
||||||
|
* substituted invoice on an otherwise honest response.
|
||||||
|
*/
|
||||||
|
export function invoiceCommitsTo(decoded: DecodedInvoice, candidates: string[]): boolean {
|
||||||
|
if (!decoded.descriptionHash) return true;
|
||||||
|
|
||||||
|
// Use noble's own `utf8ToBytes` rather than `TextEncoder`: under jsdom the
|
||||||
|
// latter returns a Uint8Array from a different realm, which `sha256` rejects.
|
||||||
|
return candidates.some(
|
||||||
|
(candidate) => bytesToHex(sha256(utf8ToBytes(candidate))) === decoded.descriptionHash,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
/**
|
||||||
|
* LNURL-pay (LUD-06 / LUD-16) resolution for zaps.
|
||||||
|
*
|
||||||
|
* `nostr-tools`' `nip57.getZapEndpoint` returns only the `callback` URL and
|
||||||
|
* throws away everything else the endpoint said — including the `minSendable`
|
||||||
|
* / `maxSendable` bounds and the `metadata` string that LUD-06 uses to bind an
|
||||||
|
* invoice to the endpoint that issued it. Both are needed to check that the
|
||||||
|
* invoice we get back is the one we asked for, so resolution lives here
|
||||||
|
* instead.
|
||||||
|
*
|
||||||
|
* Everything in an LNURL-pay response is chosen by the payment *recipient*, so
|
||||||
|
* none of it is trusted: it is validated for shape, the transport is pinned to
|
||||||
|
* HTTPS, and the caller re-checks the resulting invoice against the amount the
|
||||||
|
* user actually approved (see `assertInvoiceAmount` in `@/lib/bolt11`).
|
||||||
|
*/
|
||||||
|
import { bech32 } from '@scure/base';
|
||||||
|
|
||||||
|
/** A validated LNURL-pay response. */
|
||||||
|
export interface LnurlPayParams {
|
||||||
|
/** URL to request the invoice from. Always `https:`. */
|
||||||
|
callback: string;
|
||||||
|
/** Smallest payable amount, in millisatoshis. */
|
||||||
|
minSendable: number;
|
||||||
|
/** Largest payable amount, in millisatoshis. */
|
||||||
|
maxSendable: number;
|
||||||
|
/** LUD-06 metadata string. The invoice's description hash may commit to it. */
|
||||||
|
metadata: string;
|
||||||
|
/** Whether the endpoint accepts a NIP-57 zap request. */
|
||||||
|
allowsNostr: boolean;
|
||||||
|
/** Pubkey the endpoint signs zap receipts with, when it supports zaps. */
|
||||||
|
nostrPubkey?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Shape of the JSON an LNURL-pay endpoint returns. */
|
||||||
|
interface LnurlPayResponse {
|
||||||
|
tag?: unknown;
|
||||||
|
callback?: unknown;
|
||||||
|
minSendable?: unknown;
|
||||||
|
maxSendable?: unknown;
|
||||||
|
metadata?: unknown;
|
||||||
|
allowsNostr?: unknown;
|
||||||
|
nostrPubkey?: unknown;
|
||||||
|
reason?: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A lightning address (`name@domain`) or a bech32 `lnurl1…` string. */
|
||||||
|
export interface LnurlSource {
|
||||||
|
lud06?: string;
|
||||||
|
lud16?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn a `lud06` / `lud16` pointer into the URL to fetch LNURL-pay params
|
||||||
|
* from. Returns `null` when neither is usable.
|
||||||
|
*
|
||||||
|
* HTTPS is required. A `lud06` may encode any URL at all, and plaintext HTTP
|
||||||
|
* would let anyone on the network path swap the invoice for one of their own —
|
||||||
|
* which is the entire attack this module exists to prevent.
|
||||||
|
*/
|
||||||
|
export function lnurlToUrl({ lud06, lud16 }: LnurlSource): string | null {
|
||||||
|
let raw: string;
|
||||||
|
|
||||||
|
if (lud06?.trim()) {
|
||||||
|
const { words } = bech32.decode(lud06.trim().toLowerCase() as `${Lowercase<string>}1${string}`, false);
|
||||||
|
raw = new TextDecoder().decode(bech32.fromWords(words));
|
||||||
|
} else if (lud16?.trim()) {
|
||||||
|
const [name, domain] = lud16.trim().split('@');
|
||||||
|
if (!name || !domain) return null;
|
||||||
|
raw = new URL(`/.well-known/lnurlp/${encodeURIComponent(name)}`, `https://${domain}`).toString();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = new URL(raw);
|
||||||
|
if (url.protocol !== 'https:') {
|
||||||
|
throw new Error('Lightning address must use HTTPS');
|
||||||
|
}
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Coerce a JSON value to a non-negative integer, or `null` if it isn't one. */
|
||||||
|
function toCount(value: unknown): number | null {
|
||||||
|
return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? Math.floor(value) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch and validate the LNURL-pay parameters for a payment pointer.
|
||||||
|
*
|
||||||
|
* Throws with a user-presentable message when the endpoint is unreachable or
|
||||||
|
* its response doesn't conform.
|
||||||
|
*/
|
||||||
|
export async function resolveLnurlPay(source: LnurlSource, signal?: AbortSignal): Promise<LnurlPayParams> {
|
||||||
|
const url = lnurlToUrl(source);
|
||||||
|
if (!url) {
|
||||||
|
throw new Error('No lightning address configured');
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await fetch(url, { signal });
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`Lightning service returned HTTP ${res.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const body: LnurlPayResponse = await res.json();
|
||||||
|
|
||||||
|
if (typeof body.reason === 'string' && !body.callback) {
|
||||||
|
throw new Error(body.reason);
|
||||||
|
}
|
||||||
|
if (body.tag !== 'payRequest') {
|
||||||
|
throw new Error('Lightning address does not support payments');
|
||||||
|
}
|
||||||
|
if (typeof body.callback !== 'string') {
|
||||||
|
throw new Error('Lightning service returned no payment callback');
|
||||||
|
}
|
||||||
|
|
||||||
|
// The callback is a second, separate URL the endpoint gets to choose. Pin it
|
||||||
|
// to HTTPS for the same reason as the LNURL itself.
|
||||||
|
const callback = new URL(body.callback);
|
||||||
|
if (callback.protocol !== 'https:') {
|
||||||
|
throw new Error('Lightning service requested an insecure payment callback');
|
||||||
|
}
|
||||||
|
|
||||||
|
const minSendable = toCount(body.minSendable);
|
||||||
|
const maxSendable = toCount(body.maxSendable);
|
||||||
|
if (minSendable === null || maxSendable === null || minSendable > maxSendable) {
|
||||||
|
throw new Error('Lightning service returned invalid payment limits');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
callback: callback.toString(),
|
||||||
|
minSendable,
|
||||||
|
maxSendable,
|
||||||
|
metadata: typeof body.metadata === 'string' ? body.metadata : '',
|
||||||
|
allowsNostr: body.allowsNostr === true,
|
||||||
|
nostrPubkey: typeof body.nostrPubkey === 'string' ? body.nostrPubkey : undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -109,8 +109,9 @@ export function AISettings() {
|
|||||||
baseURL: preset.baseURL,
|
baseURL: preset.baseURL,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (apiKey.trim()) {
|
const key = apiKey.trim() || preset.apiKey;
|
||||||
newProvider.apiKey = apiKey.trim();
|
if (key) {
|
||||||
|
newProvider.apiKey = key;
|
||||||
}
|
}
|
||||||
if (typeof preset.nostr === 'boolean') {
|
if (typeof preset.nostr === 'boolean') {
|
||||||
newProvider.nostr = preset.nostr;
|
newProvider.nostr = preset.nostr;
|
||||||
|
|||||||
@@ -34,6 +34,81 @@ class LocalStorageMock implements Storage {
|
|||||||
|
|
||||||
global.localStorage = new LocalStorageMock();
|
global.localStorage = new LocalStorageMock();
|
||||||
|
|
||||||
|
// The @nostrify/react 0.6.6 NostrLoginProvider resolves stored logins on a
|
||||||
|
// microtask: it renders a null `fallback` on the first synchronous paint and
|
||||||
|
// only mounts its children once storage resolves. Component/hook tests render
|
||||||
|
// synchronously and query immediately, so they'd observe an empty tree (this is
|
||||||
|
// the sole cause of the render breakage introduced by the upgrade). Replace the
|
||||||
|
// provider — and the hook that reads its context — with a synchronous
|
||||||
|
// equivalent for tests, importing everything else (NLogin.nostrconnect and the
|
||||||
|
// connect helpers, whose handshake enforcement is the point of the upgrade;
|
||||||
|
// NUser) from the real module untouched.
|
||||||
|
vi.mock('@nostrify/react/login', async (importActual) => {
|
||||||
|
const actual = await importActual<typeof import('@nostrify/react/login')>();
|
||||||
|
const { createContext, useContext, useReducer, useEffect, createElement } = await import('react');
|
||||||
|
|
||||||
|
const NostrLoginContext = createContext<unknown>(undefined);
|
||||||
|
|
||||||
|
type Login = { id: string };
|
||||||
|
type LoginAction =
|
||||||
|
| { type: 'login.add'; login: Login; set?: boolean }
|
||||||
|
| { type: 'login.remove'; id: string }
|
||||||
|
| { type: 'login.set'; id: string }
|
||||||
|
| { type: 'login.clear' };
|
||||||
|
|
||||||
|
function reducer(state: Login[], action: LoginAction): Login[] {
|
||||||
|
switch (action.type) {
|
||||||
|
case 'login.add': {
|
||||||
|
const filtered = state.filter((l) => l.id !== action.login.id);
|
||||||
|
return action.set ? [action.login, ...filtered] : [...filtered, action.login];
|
||||||
|
}
|
||||||
|
case 'login.remove':
|
||||||
|
return state.filter((l) => l.id !== action.id);
|
||||||
|
case 'login.set': {
|
||||||
|
const login = state.find((l) => l.id === action.id);
|
||||||
|
if (!login) return state;
|
||||||
|
return [login, ...state.filter((l) => l.id !== action.id)];
|
||||||
|
}
|
||||||
|
case 'login.clear':
|
||||||
|
return [];
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const NostrLoginProvider = ({ children, storageKey, storage = localStorage }: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
storageKey: string;
|
||||||
|
storage?: Storage;
|
||||||
|
}) => {
|
||||||
|
const [state, dispatch] = useReducer(reducer, undefined, (): Login[] => {
|
||||||
|
const stored = storage.getItem(storageKey);
|
||||||
|
return typeof stored === 'string' ? (JSON.parse(stored) as Login[]) : [];
|
||||||
|
});
|
||||||
|
useEffect(() => {
|
||||||
|
storage.setItem(storageKey, JSON.stringify(state));
|
||||||
|
}, [state, storageKey, storage]);
|
||||||
|
const value = {
|
||||||
|
logins: state,
|
||||||
|
addLogin: (login: Login) => dispatch({ type: 'login.add', login }),
|
||||||
|
removeLogin: (id: string) => dispatch({ type: 'login.remove', id }),
|
||||||
|
setLogin: (id: string) => dispatch({ type: 'login.set', id }),
|
||||||
|
clearLogins: () => dispatch({ type: 'login.clear' }),
|
||||||
|
};
|
||||||
|
return createElement(NostrLoginContext.Provider, { value }, children);
|
||||||
|
};
|
||||||
|
|
||||||
|
function useNostrLogin() {
|
||||||
|
const context = useContext(NostrLoginContext);
|
||||||
|
if (!context) {
|
||||||
|
throw new Error('useNostrLogin must be used within a NostrLoginProvider');
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ...actual, NostrLoginProvider, useNostrLogin };
|
||||||
|
});
|
||||||
|
|
||||||
// Mock CSS imports
|
// Mock CSS imports
|
||||||
vi.mock('*.css', () => ({}));
|
vi.mock('*.css', () => ({}));
|
||||||
vi.mock('*.scss', () => ({}));
|
vi.mock('*.scss', () => ({}));
|
||||||
|
|||||||
Reference in new issue
Block a user