mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 18:32:25 -05:00 
			
		
		
		
	[bug] respect X-Robots-Tag and robots.txt on api/v1/instance and nodeinfo (#3756)
		
	* feat: check X-Robots-Tag when accessing /api/v1/instance or /nodeinfo endpoints respect X-Robots-Tag * chore: go fmt ./... * Check robots.txt as well, add tests --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
		
					parent
					
						
							
								2c95fd4115
							
						
					
				
			
			
				commit
				
					
						d0de3ad492
					
				
			
		
					 20 changed files with 1404 additions and 24 deletions
				
			
		|  | @ -19,20 +19,20 @@ package dereferencing | |||
| 
 | ||||
| import ( | ||||
| 	"context" | ||||
| 	"fmt" | ||||
| 	"net/url" | ||||
| 
 | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/gtserror" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" | ||||
| ) | ||||
| 
 | ||||
| func (d *Dereferencer) GetRemoteInstance(ctx context.Context, username string, remoteInstanceURI *url.URL) (*gtsmodel.Instance, error) { | ||||
| 	if blocked, err := d.state.DB.IsDomainBlocked(ctx, remoteInstanceURI.Host); blocked || err != nil { | ||||
| 		return nil, fmt.Errorf("GetRemoteInstance: domain %s is blocked", remoteInstanceURI.Host) | ||||
| 		return nil, gtserror.Newf("domain %s is blocked", remoteInstanceURI.Host) | ||||
| 	} | ||||
| 
 | ||||
| 	transport, err := d.transportController.NewTransportForUsername(ctx, username) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("transport err: %s", err) | ||||
| 		return nil, gtserror.Newf("transport err: %w", err) | ||||
| 	} | ||||
| 
 | ||||
| 	return transport.DereferenceInstance(ctx, remoteInstanceURI) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue