Proxy contributor requests.
This commit is contained in:
		
							parent
							
								
									d8ef0cd3ac
								
							
						
					
					
						commit
						db263b8db4
					
				@ -178,6 +178,24 @@ class Server {
 | 
			
		||||
          res.status(500).end();
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      .get(config.MEMPOOL.API_URL_PREFIX + 'contributors', async (req, res) => {
 | 
			
		||||
        try {
 | 
			
		||||
          const response = await axios.get('https://mempool.space/api/v1/contributors', { responseType: 'stream', timeout: 10000 });
 | 
			
		||||
          response.data.pipe(res);
 | 
			
		||||
        } catch (e) {
 | 
			
		||||
          res.status(500).end();
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      .get(config.MEMPOOL.API_URL_PREFIX + 'contributors/images/:id', async (req, res) => {
 | 
			
		||||
        try {
 | 
			
		||||
          const response = await axios.get('https://mempool.space/api/v1/contributors/images/' + req.params.id, {
 | 
			
		||||
            responseType: 'stream', timeout: 10000
 | 
			
		||||
          });
 | 
			
		||||
          response.data.pipe(res);
 | 
			
		||||
        } catch (e) {
 | 
			
		||||
          res.status(500).end();
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
    if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user