renaming
This commit is contained in:
parent
0b0f3d9e9a
commit
74bc0feee7
@ -25,6 +25,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/config"
|
"github.com/superseriousbusiness/gotosocial/internal/config"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/db/model"
|
"github.com/superseriousbusiness/gotosocial/internal/db/model"
|
||||||
@ -73,9 +74,20 @@ func (m *statusModule) statusCreatePOSTHandler(c *gin.Context) {
|
|||||||
return
|
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,
|
PublicKey: &key.PublicKey,
|
||||||
ActorType: "Person",
|
ActorType: "Person",
|
||||||
URI: uris.UserURI,
|
URI: uris.UserURI,
|
||||||
InboxURL: uris.InboxURL,
|
InboxURL: uris.InboxURI,
|
||||||
OutboxURL: uris.OutboxURL,
|
OutboxURL: uris.OutboxURI,
|
||||||
FollowersURL: uris.FollowersURL,
|
FollowersURL: uris.FollowersURI,
|
||||||
FeaturedCollectionURL: uris.CollectionURL,
|
FeaturedCollectionURL: uris.CollectionURI,
|
||||||
}
|
}
|
||||||
if _, err = ps.conn.Model(a).Insert(); err != nil {
|
if _, err = ps.conn.Model(a).Insert(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -21,30 +21,39 @@ package util
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
type URIs struct {
|
type URIs struct {
|
||||||
HostURL string
|
HostURL string
|
||||||
UserURL string
|
UserURL string
|
||||||
|
StatusesURL string
|
||||||
|
|
||||||
UserURI string
|
UserURI string
|
||||||
InboxURL string
|
StatusesURI string
|
||||||
OutboxURL string
|
InboxURI string
|
||||||
FollowersURL string
|
OutboxURI string
|
||||||
CollectionURL string
|
FollowersURI string
|
||||||
|
CollectionURI string
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateURIs(username string, protocol string, host string) *URIs {
|
func GenerateURIs(username string, protocol string, host string) *URIs {
|
||||||
hostURL := fmt.Sprintf("%s://%s", protocol, host)
|
hostURL := fmt.Sprintf("%s://%s", protocol, host)
|
||||||
userURL := fmt.Sprintf("%s/@%s", hostURL, username)
|
userURL := fmt.Sprintf("%s/@%s", hostURL, username)
|
||||||
|
statusesURL := fmt.Sprintf("%s/statuses", userURL)
|
||||||
|
|
||||||
userURI := fmt.Sprintf("%s/users/%s", hostURL, username)
|
userURI := fmt.Sprintf("%s/users/%s", hostURL, username)
|
||||||
inboxURL := fmt.Sprintf("%s/inbox", userURI)
|
statusesURI := fmt.Sprintf("%s/statuses", userURI)
|
||||||
outboxURL := fmt.Sprintf("%s/outbox", userURI)
|
inboxURI := fmt.Sprintf("%s/inbox", userURI)
|
||||||
followersURL := fmt.Sprintf("%s/followers", userURI)
|
outboxURI := fmt.Sprintf("%s/outbox", userURI)
|
||||||
collectionURL := fmt.Sprintf("%s/collections/featured", userURI)
|
followersURI := fmt.Sprintf("%s/followers", userURI)
|
||||||
|
collectionURI := fmt.Sprintf("%s/collections/featured", userURI)
|
||||||
return &URIs{
|
return &URIs{
|
||||||
HostURL: hostURL,
|
HostURL: hostURL,
|
||||||
UserURL: userURL,
|
UserURL: userURL,
|
||||||
|
StatusesURL: statusesURL,
|
||||||
|
|
||||||
UserURI: userURI,
|
UserURI: userURI,
|
||||||
InboxURL: inboxURL,
|
StatusesURI: statusesURI,
|
||||||
OutboxURL: outboxURL,
|
InboxURI: inboxURI,
|
||||||
FollowersURL: followersURL,
|
OutboxURI: outboxURI,
|
||||||
CollectionURL: collectionURL,
|
FollowersURI: followersURI,
|
||||||
|
CollectionURI: collectionURI,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user