mirror of
				https://github.com/owncast/owncast.git
				synced 2025-10-31 18:18:06 +08:00 
			
		
		
		
	Config repository (#3988)
* WIP * fix(test): fix ap test failing * fix: fix unkeyed fields being used * chore(tests): clean up browser tests by splitting out federation UI tests
This commit is contained in:
		| @ -8,31 +8,33 @@ import ( | ||||
| 	"github.com/owncast/owncast/activitypub/crypto" | ||||
| 	"github.com/owncast/owncast/activitypub/persistence" | ||||
| 	"github.com/owncast/owncast/activitypub/requests" | ||||
| 	"github.com/owncast/owncast/core/data" | ||||
| 	"github.com/owncast/owncast/persistence/configrepository" | ||||
| 	log "github.com/sirupsen/logrus" | ||||
| ) | ||||
|  | ||||
| // ObjectHandler handles requests for a single federated ActivityPub object. | ||||
| func ObjectHandler(w http.ResponseWriter, r *http.Request) { | ||||
| 	if !data.GetFederationEnabled() { | ||||
| 	configRepository := configrepository.Get() | ||||
|  | ||||
| 	if !configRepository.GetFederationEnabled() { | ||||
| 		w.WriteHeader(http.StatusMethodNotAllowed) | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	// If private federation mode is enabled do not allow access to objects. | ||||
| 	if data.GetFederationIsPrivate() { | ||||
| 	if configRepository.GetFederationIsPrivate() { | ||||
| 		w.WriteHeader(http.StatusNotFound) | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	iri := strings.Join([]string{strings.TrimSuffix(data.GetServerURL(), "/"), r.URL.Path}, "") | ||||
| 	iri := strings.Join([]string{strings.TrimSuffix(configRepository.GetServerURL(), "/"), r.URL.Path}, "") | ||||
| 	object, _, _, err := persistence.GetObjectByIRI(iri) | ||||
| 	if err != nil { | ||||
| 		w.WriteHeader(http.StatusNotFound) | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	accountName := data.GetDefaultFederationUsername() | ||||
| 	accountName := configRepository.GetDefaultFederationUsername() | ||||
| 	actorIRI := apmodels.MakeLocalIRIForAccount(accountName) | ||||
| 	publicKey := crypto.GetPublicKey(actorIRI) | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Gabe Kangas
					Gabe Kangas