Spaces:
Sleeping
Sleeping
Upload scripts/token-redirect.cjs with huggingface_hub
Browse files
scripts/token-redirect.cjs
CHANGED
|
@@ -153,6 +153,13 @@ const origEmit = http.Server.prototype.emit;
|
|
| 153 |
http.Server.prototype.emit = function (event, ...args) {
|
| 154 |
if (event === 'request') {
|
| 155 |
const [req, res] = args;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
const parsed = url.parse(req.url, true);
|
| 157 |
const pathname = parsed.pathname;
|
| 158 |
|
|
|
|
| 153 |
http.Server.prototype.emit = function (event, ...args) {
|
| 154 |
if (event === 'request') {
|
| 155 |
const [req, res] = args;
|
| 156 |
+
|
| 157 |
+
// Only intercept on the main OpenClaw server (port 7860), not A2A gateway (18800)
|
| 158 |
+
const serverPort = this.address && this.address() && this.address().port;
|
| 159 |
+
if (serverPort && serverPort !== 7860) {
|
| 160 |
+
return origEmit.apply(this, [event, ...args]);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
const parsed = url.parse(req.url, true);
|
| 164 |
const pathname = parsed.pathname;
|
| 165 |
|