godprotocol 2.2.93 → 2.2.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "2.2.93",
3
+ "version": "2.2.94",
4
4
  "description": "A distributed computing environment for Web 4.0 — integrating AI, decentralisation, and virtual computation.",
5
5
  "main": "Index.js",
6
6
  "type": "module",
@@ -160,8 +160,20 @@ const version_middleware = async (req, res, routers) => {
160
160
 
161
161
  // remove query string from route
162
162
  const parsedUrl = new URL(req.url, `http://${req.headers.host}`);
163
- req.url = parsedUrl.pathname;
164
- const name = req.url.replace(/^\//, "");
163
+
164
+ let routePath = parsedUrl.pathname;
165
+
166
+ // Remove /api/v1, /api/v2, /api/v3, etc.
167
+ routePath = routePath.replace(/^\/api\/v\d+(?=\/|$)/i, "");
168
+
169
+ // Ensure leading slash exists
170
+ if (!routePath.startsWith("/")) {
171
+ routePath = "/" + routePath;
172
+ }
173
+
174
+ req.url = routePath;
175
+
176
+ const name = routePath.replace(/^\//, "");
165
177
 
166
178
  const isWebhook = req.headers["is-webhook"];
167
179