Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
coyotte508
commited on
Commit
·
90ee8c2
1
Parent(s):
f3942aa
format
Browse files
app.ts
CHANGED
|
@@ -3,18 +3,21 @@ import express from "express";
|
|
| 3 |
|
| 4 |
const app = express();
|
| 5 |
|
| 6 |
-
app.use(
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
url: "https://huggingface.co/.well-known/openapi.json",
|
| 13 |
hideClientButton: true,
|
| 14 |
defaultOpenAllTags: true,
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
);
|
| 18 |
|
| 19 |
const port = 7860;
|
| 20 |
|
|
|
|
| 3 |
|
| 4 |
const app = express();
|
| 5 |
|
| 6 |
+
app.use("/", (req, res, next) => {
|
| 7 |
+
const originalSend = res.send.bind(res);
|
| 8 |
+
res.send = (x) =>
|
| 9 |
+
originalSend(
|
| 10 |
+
x.replace(
|
| 11 |
+
"</html>",
|
| 12 |
+
"<script>addEventListener('hashchange', event => parent.postMessage({data: {hash: event.newURL.hash.slice(1)}}))</script></html>"
|
| 13 |
+
)
|
| 14 |
+
);
|
| 15 |
+
return apiReference({
|
| 16 |
url: "https://huggingface.co/.well-known/openapi.json",
|
| 17 |
hideClientButton: true,
|
| 18 |
defaultOpenAllTags: true,
|
| 19 |
+
})(req, res);
|
| 20 |
+
});
|
|
|
|
| 21 |
|
| 22 |
const port = 7860;
|
| 23 |
|