mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 12:52:25 -05:00 
			
		
		
		
	renaming
This commit is contained in:
		
					parent
					
						
							
								0b0f3d9e9a
							
						
					
				
			
			
				commit
				
					
						74bc0feee7
					
				
			
		
					 3 changed files with 41 additions and 20 deletions
				
			
		|  | @ -25,6 +25,7 @@ import ( | |||
| 	"net/http" | ||||
| 
 | ||||
| 	"github.com/gin-gonic/gin" | ||||
| 	"github.com/google/uuid" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/config" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/db" | ||||
| 	"github.com/superseriousbusiness/gotosocial/internal/db/model" | ||||
|  | @ -73,9 +74,20 @@ func (m *statusModule) statusCreatePOSTHandler(c *gin.Context) { | |||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	// newStatus := &model.Status{ | ||||
| 	uris := util.GenerateURIs(authed.Account.Username, m.config.Protocol, m.config.Host) | ||||
| 	newStatusID := uuid.NewString() | ||||
| 
 | ||||
| 	// } | ||||
| 	newStatus := &model.Status{ | ||||
| 		ID:                  newStatusID, | ||||
| 		URI:                 fmt.Sprintf("%s/%s", uris.StatusesURI, newStatusID), | ||||
| 		URL:                 fmt.Sprintf("%s/%s", uris.StatusesURL, newStatusID), | ||||
| 		Content:             util.HTMLFormat(form.Status), | ||||
| 		Local:               true, // will always be true if this status is being created through the client API | ||||
| 		AccountID:           authed.Account.ID, | ||||
| 		InReplyToID:         form.InReplyToID, | ||||
| 		ContentWarning:      form.SpoilerText, | ||||
| 		ActivityStreamsType: "Note", | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -453,10 +453,10 @@ func (ps *postgresService) NewSignup(username string, reason string, requireAppr | |||
| 		PublicKey:             &key.PublicKey, | ||||
| 		ActorType:             "Person", | ||||
| 		URI:                   uris.UserURI, | ||||
| 		InboxURL:              uris.InboxURL, | ||||
| 		OutboxURL:             uris.OutboxURL, | ||||
| 		FollowersURL:          uris.FollowersURL, | ||||
| 		FeaturedCollectionURL: uris.CollectionURL, | ||||
| 		InboxURL:              uris.InboxURI, | ||||
| 		OutboxURL:             uris.OutboxURI, | ||||
| 		FollowersURL:          uris.FollowersURI, | ||||
| 		FeaturedCollectionURL: uris.CollectionURI, | ||||
| 	} | ||||
| 	if _, err = ps.conn.Model(a).Insert(); err != nil { | ||||
| 		return nil, err | ||||
|  |  | |||
|  | @ -21,30 +21,39 @@ package util | |||
| import "fmt" | ||||
| 
 | ||||
| type URIs struct { | ||||
| 	HostURL       string | ||||
| 	UserURL       string | ||||
| 	HostURL     string | ||||
| 	UserURL     string | ||||
| 	StatusesURL string | ||||
| 
 | ||||
| 	UserURI       string | ||||
| 	InboxURL      string | ||||
| 	OutboxURL     string | ||||
| 	FollowersURL  string | ||||
| 	CollectionURL string | ||||
| 	StatusesURI   string | ||||
| 	InboxURI      string | ||||
| 	OutboxURI     string | ||||
| 	FollowersURI  string | ||||
| 	CollectionURI string | ||||
| } | ||||
| 
 | ||||
| func GenerateURIs(username string, protocol string, host string) *URIs { | ||||
| 	hostURL := fmt.Sprintf("%s://%s", protocol, host) | ||||
| 	userURL := fmt.Sprintf("%s/@%s", hostURL, username) | ||||
| 	statusesURL := fmt.Sprintf("%s/statuses", userURL) | ||||
| 
 | ||||
| 	userURI := fmt.Sprintf("%s/users/%s", hostURL, username) | ||||
| 	inboxURL := fmt.Sprintf("%s/inbox", userURI) | ||||
| 	outboxURL := fmt.Sprintf("%s/outbox", userURI) | ||||
| 	followersURL := fmt.Sprintf("%s/followers", userURI) | ||||
| 	collectionURL := fmt.Sprintf("%s/collections/featured", userURI) | ||||
| 	statusesURI := fmt.Sprintf("%s/statuses", userURI) | ||||
| 	inboxURI := fmt.Sprintf("%s/inbox", userURI) | ||||
| 	outboxURI := fmt.Sprintf("%s/outbox", userURI) | ||||
| 	followersURI := fmt.Sprintf("%s/followers", userURI) | ||||
| 	collectionURI := fmt.Sprintf("%s/collections/featured", userURI) | ||||
| 	return &URIs{ | ||||
| 		HostURL:       hostURL, | ||||
| 		UserURL:       userURL, | ||||
| 		StatusesURL:   statusesURL, | ||||
| 		 | ||||
| 		UserURI:       userURI, | ||||
| 		InboxURL:      inboxURL, | ||||
| 		OutboxURL:     outboxURL, | ||||
| 		FollowersURL:  followersURL, | ||||
| 		CollectionURL: collectionURL, | ||||
| 		StatusesURI:   statusesURI, | ||||
| 		InboxURI:      inboxURI, | ||||
| 		OutboxURI:     outboxURI, | ||||
| 		FollowersURI:  followersURI, | ||||
| 		CollectionURI: collectionURI, | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue