feat(market): migrate order DMs to NIP-17 (NIP-44 + NIP-59) #39

Merged
padreug merged 2 commits from feat/market-nip17-messaging into demo 2026-05-03 14:35:27 +00:00
7 changed files with 30 additions and 9 deletions
Showing only changes of commit a0187a6604 - Show all commits

fix(vite): rewrite to <app>.html when query has dots (JWT tokens)

The dev SPA-fallback plugin used `!req.url.includes('.')` to skip asset
requests, which also matched JWT-shaped `?token=hdr.body.sig` query
strings — so `localhost:5185/?token=...` fell through to the hub
`index.html` instead of `market.html`, breaking the hub→standalone
auth-relay link. Strip the query before the extension check.

Applied to all 7 standalone vite configs.
Padreug 2026-05-03 16:02:06 +02:00

View file

@ -15,13 +15,16 @@ function activitiesHtmlPlugin(): Plugin {
name: 'activities-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Rewrite all non-asset requests to activities.html
// Rewrite all non-asset requests to activities.html.
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.') // skip files with extensions
!path.includes('.')
) {
req.url = '/activities.html'
}

View file

@ -15,13 +15,16 @@ function castleHtmlPlugin(): Plugin {
name: 'castle-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Rewrite all non-asset requests to castle.html
// Rewrite all non-asset requests to castle.html.
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.') // skip files with extensions
!path.includes('.')
) {
req.url = '/castle.html'
}

View file

@ -11,12 +11,15 @@ function chatHtmlPlugin(): Plugin {
name: 'chat-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.')
!path.includes('.')
) {
req.url = '/chat.html'
}

View file

@ -11,12 +11,15 @@ function forumHtmlPlugin(): Plugin {
name: 'forum-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.')
!path.includes('.')
) {
req.url = '/forum.html'
}

View file

@ -11,12 +11,15 @@ function marketHtmlPlugin(): Plugin {
name: 'market-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.')
!path.includes('.')
) {
req.url = '/market.html'
}

View file

@ -11,12 +11,15 @@ function tasksHtmlPlugin(): Plugin {
name: 'tasks-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.')
!path.includes('.')
) {
req.url = '/tasks.html'
}

View file

@ -15,12 +15,15 @@ function walletHtmlPlugin(): Plugin {
name: 'wallet-html-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
// Strip query before checking for an extension — JWTs (e.g. ?token=...)
// contain dots and would otherwise get mistaken for an asset request.
const path = req.url ? req.url.split('?')[0] : ''
if (
req.url &&
!req.url.startsWith('/@') &&
!req.url.startsWith('/src/') &&
!req.url.startsWith('/node_modules/') &&
!req.url.includes('.')
!path.includes('.')
) {
req.url = '/wallet.html'
}