Serverside stuff. Mostly shuffling things around
This commit is contained in:
parent
90667d96c7
commit
be70109c43
20 changed files with 513 additions and 71 deletions
|
@ -31,21 +31,21 @@ type Account struct {
|
|||
// When this entry was deleted (for soft deletions)
|
||||
// Soft delete means that this entry still exists in the db, but gorm won't include it anymore unless specifically told to
|
||||
// If not null, this entry is marked as deleted
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
Remote bool // Whether the account is a local or remote one
|
||||
Server string // The url of the server this account is from
|
||||
DisplayName string // The display name of the user. Can be different from the handle
|
||||
CustomFields []uint `gorm:"serializer:json"` // IDs to the custom fields a user has
|
||||
Description string // The description of a user account
|
||||
Tags []string `gorm:"serializer:json"` // Hashtags
|
||||
IsBot bool // Whether to mark this account as a script controlled one
|
||||
Follows []string `gorm:"serializer:json"` // List of handles this account follows
|
||||
Followers []string `gorm:"serializer:json"` // List of handles that follow this account
|
||||
Icon string // ID of a media file used as icon
|
||||
Background string // ID of a media file used as background image
|
||||
Banner string // ID of a media file used as banner
|
||||
Indexable bool // Whether this account can be found by crawlers
|
||||
PublicKey []byte // The public key of the account
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
// Server RemoteServer // `gorm:"foreignKey:ServerId;references:ID"` // The server this user is from
|
||||
ServerId uint // Id of the server this user is from, needed for including RemoteServer
|
||||
DisplayName string // The display name of the user. Can be different from the handle
|
||||
CustomFields []uint `gorm:"serializer:json"` // IDs to the custom fields a user has
|
||||
Description string // The description of a user account
|
||||
Tags []string `gorm:"serializer:json"` // Hashtags
|
||||
IsBot bool // Whether to mark this account as a script controlled one
|
||||
Follows []string `gorm:"serializer:json"` // List of handles this account follows
|
||||
Followers []string `gorm:"serializer:json"` // List of handles that follow this account
|
||||
Icon string // ID of a media file used as icon
|
||||
Background string // ID of a media file used as background image
|
||||
Banner string // ID of a media file used as banner
|
||||
Indexable bool // Whether this account can be found by crawlers
|
||||
PublicKey []byte // The public key of the account
|
||||
// Whether this account restricts following
|
||||
// If true, the owner must approve of a follow request first
|
||||
RestrictedFollow bool
|
||||
|
@ -346,8 +346,8 @@ func (s *Storage) NewLocalAccount(handle string) (*Account, error) {
|
|||
return nil, err
|
||||
}
|
||||
acc.Username = handle
|
||||
acc.Server = config.GlobalConfig.General.GetFullDomain()
|
||||
acc.Remote = false
|
||||
// acc.Server = serverSelf
|
||||
acc.ServerId = serverSelf.ID
|
||||
acc.DisplayName = handle
|
||||
|
||||
publicKey, privateKey, err := ed25519.GenerateKey(nil)
|
||||
|
@ -419,7 +419,7 @@ func (s *Storage) GetOrCreateUser(userID string) passkey.User {
|
|||
Str("account-handle", userID).
|
||||
Msg("Looking for or creating account for passkey stuff")
|
||||
acc := &Account{}
|
||||
res := s.db.Where(Account{Username: userID, Server: config.GlobalConfig.General.GetFullDomain()}).
|
||||
res := s.db.Where(Account{Username: userID, ServerId: serverSelf.ID}).
|
||||
First(acc)
|
||||
if errors.Is(res.Error, gorm.ErrRecordNotFound) {
|
||||
log.Debug().Str("account-handle", userID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue