Defaults and start of config

This commit is contained in:
mStar 2024-05-31 17:21:29 +02:00
parent 3086b0e9b4
commit 1fbdf7fc9d
6 changed files with 128 additions and 10 deletions

View file

@ -12,7 +12,8 @@ import (
// This can be a bot, remote or not
// If remote, this is used for caching the account
type User struct {
ID string `gorm:"primarykey"` // ID is the full handle, eg @max@example.com
ID string `gorm:"primarykey"` // ID is a uuid for this account
Handle string // Handle is the full handle, eg @max@example.com
CreatedAt time.Time // When this entry was created
UpdatedAt time.Time // When this account was last updated. Will also be used for refreshing remote accounts
DeletedAt gorm.DeletedAt `gorm:"index"`
@ -29,7 +30,7 @@ type User struct {
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
PublicKeyPem string // The public key of the account
PublicKeyPem *string // The public key of the account
// Whether this account restricts following
// If true, the owner must approve of a follow request first
RestrictedFollow bool
@ -58,10 +59,34 @@ type User struct {
func NewEmptyUser() *User {
return &User{
ID: uuid.NewString(),
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
Remote: false,
Server: "placeholder",
ID: uuid.NewString(),
Handle: "placeholder",
Remote: false,
Server: "placeholder",
DisplayName: "placeholder",
CustomFields: []uint{},
Description: "placeholder",
Tags: []string{},
IsBot: true,
Follows: []string{},
Followers: []string{},
Icon: "placeholder",
Background: "placeholder",
Banner: "placeholder",
Indexable: false,
PublicKeyPem: nil,
RestrictedFollow: false,
IdentifiesAs: []Being{BEING_ROBOT},
Gender: []string{"it", "its"},
PasswordHash: []byte("placeholder"),
TotpToken: []byte("placeholder"),
Passkeys: map[string]webauthn.Credential{},
PrivateKeyPem: nil,
}
}
func placeholderUser() *User {
tmp := NewEmptyUser()
tmp.ID = "placeholder"
return tmp
}