Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
|
@@ -12,8 +12,12 @@ if (port == null || port == "") {
|
|
| 12 |
app.use('/api', createProxyMiddleware({
|
| 13 |
target: 'https://www.sakugabooru.com',
|
| 14 |
changeOrigin: true,
|
| 15 |
-
pathRewrite: {'^/api' : ''}
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
// THIS IS THE MISSING PIECE:
|
| 19 |
app.use('/', express.static(path.join(__dirname, 'public')))
|
|
|
|
| 12 |
app.use('/api', createProxyMiddleware({
|
| 13 |
target: 'https://www.sakugabooru.com',
|
| 14 |
changeOrigin: true,
|
| 15 |
+
pathRewrite: {'^/api' : ''},
|
| 16 |
+
onProxyReq: (proxyReq) => {
|
| 17 |
+
// Add a User-Agent so Sakugabooru doesn't block the request
|
| 18 |
+
proxyReq.setHeader('User-Agent', 'SakugaVideoPlayer/1.0 (HuggingFace Space)');
|
| 19 |
+
}
|
| 20 |
+
}));
|
| 21 |
|
| 22 |
// THIS IS THE MISSING PIECE:
|
| 23 |
app.use('/', express.static(path.join(__dirname, 'public')))
|