mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-10-31 14:34:00 +00:00 
			
		
		
		
	Allow widgets to add header or set methods
This commit is contained in:
		
							parent
							
								
									51ea4ea405
								
							
						
					
					
						commit
						d6448763e0
					
				| @ -20,14 +20,14 @@ export default async function genericProxyHandler(req, res, map) { | |||||||
|     if (widget) { |     if (widget) { | ||||||
|       const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget })); |       const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget })); | ||||||
| 
 | 
 | ||||||
|       const headers = req.extraHeaders ?? {}; |       const headers = req.extraHeaders ?? widget.headers ?? {}; | ||||||
|        |        | ||||||
|       if (widget.username && widget.password) { |       if (widget.username && widget.password) { | ||||||
|         headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`; |         headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       const params = { |       const params = { | ||||||
|         method: req.method, |         method: widget.method ?? req.method, | ||||||
|         headers, |         headers, | ||||||
|       } |       } | ||||||
|       if (req.body) { |       if (req.body) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Zack Rauen
						Zack Rauen