34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"git.mstar.dev/mstar/linstrom/config"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// RemoteServer describes an ActivityPub server
|
|
// This includes self too
|
|
type RemoteServer struct {
|
|
gorm.Model
|
|
ServerType ServerSoftwareType // What software the server is running. Useful for formatting
|
|
Domain string // `gorm:"primaryKey"` // Domain the server exists under. Additional primary key
|
|
Name string // What the server wants to be known as (usually same as url)
|
|
Icon *MediaMetadata // The icon used by the server. May be empty
|
|
IconId sql.NullString // ID of a media file
|
|
IsSelf bool // Whether this server is yours truly
|
|
}
|
|
|
|
func BuildDefaultServer() *RemoteServer {
|
|
return &RemoteServer{
|
|
Model: gorm.Model{
|
|
ID: 1,
|
|
},
|
|
ServerType: ServerSoftwareLinstrom,
|
|
Domain: config.GlobalConfig.General.GetFullDomain(),
|
|
Name: config.GlobalConfig.Self.ServerDisplayName,
|
|
Icon: &DefaultDuckMedia,
|
|
IconId: sql.NullString{String: DefaultDuckMedia.ID, Valid: true},
|
|
IsSelf: true,
|
|
}
|
|
}
|