feat(market): migrate order DMs to NIP-17 (NIP-44 + NIP-59) #39
7 changed files with 30 additions and 9 deletions
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.
commit
a0187a6604
|
|
@ -15,13 +15,16 @@ function activitiesHtmlPlugin(): Plugin {
|
||||||
name: 'activities-html-rewrite',
|
name: 'activities-html-rewrite',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, _res, next) => {
|
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 (
|
if (
|
||||||
req.url &&
|
req.url &&
|
||||||
!req.url.startsWith('/@') &&
|
!req.url.startsWith('/@') &&
|
||||||
!req.url.startsWith('/src/') &&
|
!req.url.startsWith('/src/') &&
|
||||||
!req.url.startsWith('/node_modules/') &&
|
!req.url.startsWith('/node_modules/') &&
|
||||||
!req.url.includes('.') // skip files with extensions
|
!path.includes('.')
|
||||||
) {
|
) {
|
||||||
req.url = '/activities.html'
|
req.url = '/activities.html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,16 @@ function castleHtmlPlugin(): Plugin {
|
||||||
name: 'castle-html-rewrite',
|
name: 'castle-html-rewrite',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, _res, next) => {
|
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 (
|
if (
|
||||||
req.url &&
|
req.url &&
|
||||||
!req.url.startsWith('/@') &&
|
!req.url.startsWith('/@') &&
|
||||||
!req.url.startsWith('/src/') &&
|
!req.url.startsWith('/src/') &&
|
||||||
!req.url.startsWith('/node_modules/') &&
|
!req.url.startsWith('/node_modules/') &&
|
||||||
!req.url.includes('.') // skip files with extensions
|
!path.includes('.')
|
||||||
) {
|
) {
|
||||||
req.url = '/castle.html'
|
req.url = '/castle.html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,15 @@ function chatHtmlPlugin(): Plugin {
|
||||||
name: 'chat-html-rewrite',
|
name: 'chat-html-rewrite',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, _res, next) => {
|
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 (
|
if (
|
||||||
req.url &&
|
req.url &&
|
||||||
!req.url.startsWith('/@') &&
|
!req.url.startsWith('/@') &&
|
||||||
!req.url.startsWith('/src/') &&
|
!req.url.startsWith('/src/') &&
|
||||||
!req.url.startsWith('/node_modules/') &&
|
!req.url.startsWith('/node_modules/') &&
|
||||||
!req.url.includes('.')
|
!path.includes('.')
|
||||||
) {
|
) {
|
||||||
req.url = '/chat.html'
|
req.url = '/chat.html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,15 @@ function forumHtmlPlugin(): Plugin {
|
||||||
name: 'forum-html-rewrite',
|
name: 'forum-html-rewrite',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, _res, next) => {
|
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 (
|
if (
|
||||||
req.url &&
|
req.url &&
|
||||||
!req.url.startsWith('/@') &&
|
!req.url.startsWith('/@') &&
|
||||||
!req.url.startsWith('/src/') &&
|
!req.url.startsWith('/src/') &&
|
||||||
!req.url.startsWith('/node_modules/') &&
|
!req.url.startsWith('/node_modules/') &&
|
||||||
!req.url.includes('.')
|
!path.includes('.')
|
||||||
) {
|
) {
|
||||||
req.url = '/forum.html'
|
req.url = '/forum.html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,15 @@ function marketHtmlPlugin(): Plugin {
|
||||||
name: 'market-html-rewrite',
|
name: 'market-html-rewrite',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, _res, next) => {
|
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 (
|
if (
|
||||||
req.url &&
|
req.url &&
|
||||||
!req.url.startsWith('/@') &&
|
!req.url.startsWith('/@') &&
|
||||||
!req.url.startsWith('/src/') &&
|
!req.url.startsWith('/src/') &&
|
||||||
!req.url.startsWith('/node_modules/') &&
|
!req.url.startsWith('/node_modules/') &&
|
||||||
!req.url.includes('.')
|
!path.includes('.')
|
||||||
) {
|
) {
|
||||||
req.url = '/market.html'
|
req.url = '/market.html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,15 @@ function tasksHtmlPlugin(): Plugin {
|
||||||
name: 'tasks-html-rewrite',
|
name: 'tasks-html-rewrite',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, _res, next) => {
|
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 (
|
if (
|
||||||
req.url &&
|
req.url &&
|
||||||
!req.url.startsWith('/@') &&
|
!req.url.startsWith('/@') &&
|
||||||
!req.url.startsWith('/src/') &&
|
!req.url.startsWith('/src/') &&
|
||||||
!req.url.startsWith('/node_modules/') &&
|
!req.url.startsWith('/node_modules/') &&
|
||||||
!req.url.includes('.')
|
!path.includes('.')
|
||||||
) {
|
) {
|
||||||
req.url = '/tasks.html'
|
req.url = '/tasks.html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,15 @@ function walletHtmlPlugin(): Plugin {
|
||||||
name: 'wallet-html-rewrite',
|
name: 'wallet-html-rewrite',
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, _res, next) => {
|
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 (
|
if (
|
||||||
req.url &&
|
req.url &&
|
||||||
!req.url.startsWith('/@') &&
|
!req.url.startsWith('/@') &&
|
||||||
!req.url.startsWith('/src/') &&
|
!req.url.startsWith('/src/') &&
|
||||||
!req.url.startsWith('/node_modules/') &&
|
!req.url.startsWith('/node_modules/') &&
|
||||||
!req.url.includes('.')
|
!path.includes('.')
|
||||||
) {
|
) {
|
||||||
req.url = '/wallet.html'
|
req.url = '/wallet.html'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue