KiritoAxinity commited on
Commit
dd3cd52
·
verified ·
1 Parent(s): f52b2b6

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +6 -2
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')))