5 Commits
Author SHA1 Message Date
Chris Troutner e708fc1228 Merge pull request #14 from Permissionless-Software-Foundation/ct-unstable
Adding middleware to detect multiple forward slashes in URL and automatically fix it.
2025-12-29 18:07:43 -07:00
Chris Troutner fed4b2da59 fix(forward slashes): Adding middleware to detect multiple forward slashes in the URL 2025-12-29 18:06:43 -07:00
Chris Troutner f30c2ede04 fix(deps): Updating dependencies 2025-12-29 18:01:30 -07:00
Chris Troutner 09e05d51e5 Merge pull request #13 from Permissionless-Software-Foundation/ct-unstable
feat(x402-bch): Updating to v2 protocol
2025-12-24 14:26:30 -07:00
Chris Troutner 22cbc54dee feat(x402-bch): Updating to v2 protocol 2025-12-24 14:25:44 -07:00
4 changed files with 579 additions and 498 deletions
+13
View File
@@ -74,6 +74,19 @@ class Server {
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With']
}))
// URL normalization middleware - collapse multiple slashes
app.use((req, res, next) => {
if (req.path && req.path.includes('//')) {
// Collapse multiple consecutive slashes into a single slash
const normalizedPath = req.path.replace(/\/+/g, '/')
// Reconstruct req.url with normalized path
const queryString = req.url.includes('?') ? req.url.substring(req.url.indexOf('?')) : ''
req.url = normalizedPath + queryString
req.path = normalizedPath
}
next()
})
// Apply basic auth middleware if enabled
// This must run before x402 middleware to set req.locals.basicAuthValid
if (basicAuthSettings.enabled) {
+562 -494
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -15,17 +15,17 @@
"license": "MIT",
"description": "REST API proxy to Bitcoin Cash infrastructure",
"dependencies": {
"@psf/bch-js": "7.1.2",
"@psf/bch-js": "7.1.7",
"axios": "1.7.7",
"cors": "2.8.5",
"dotenv": "16.3.1",
"express": "5.1.0",
"minimal-slp-wallet": "7.0.2",
"minimal-slp-wallet": "7.1.2",
"psffpp": "1.2.1",
"slp-token-media": "1.2.10",
"winston": "3.11.0",
"winston-daily-rotate-file": "4.7.1",
"x402-bch-express": "1.1.3"
"x402-bch-express": "2.0.0"
},
"devDependencies": {
"apidoc": "1.2.0",
+1 -1
View File
@@ -6,7 +6,7 @@ import wlogger from '../adapters/wlogger.js'
import BCHJS from '@psf/bch-js'
import config from '../config/index.js'
const bchjs = new BCHJS({
const bchjs = new BCHJS({
restURL: config.restURL,
bearerToken: config.basicAuth.token
})