Documentation
¶
Index ¶
- Constants
- Variables
- func GenAlistServerID(a *AlistVendor)
- func GetAlistServerIdFromPath(path string) (serverID string, filePath string, err error)
- func GetEmbyServerIdFromPath(path string) (serverID string, filePath string, err error)
- type AlistStreamingInfo
- type AlistVendor
- type Backend
- type BackendUsedBy
- type BaseMovie
- type BilibiliStreamingInfo
- type BilibiliVendor
- type Consul
- type EmbyStreamingInfo
- type EmbyVendor
- type Etcd
- type Movie
- type Role
- type Room
- type RoomSettings
- type RoomStatus
- type RoomUserPermission
- type RoomUserRelation
- type RoomUserStatus
- type Setting
- type SettingGroup
- type SettingType
- type Subtitle
- type User
- type UserProvider
- type VendorBackend
- type VendorInfo
- type VendorName
Constants ¶
View Source
const (
DefaultPermissions = PermissionCreateMovie | PermissionEditCurrent | PermissionSendChat
)
Variables ¶
View Source
var ErrNoPermission = errors.New("no permission")
Functions ¶
func GenAlistServerID ¶ added in v0.3.2
func GenAlistServerID(a *AlistVendor)
func GetAlistServerIdFromPath ¶ added in v0.3.2
Types ¶
type AlistStreamingInfo ¶ added in v0.3.1
type AlistStreamingInfo struct {
// {/}serverId/Path
Path string `gorm:"type:varchar(4096)" json:"path,omitempty"`
Password string `gorm:"type:varchar(256)" json:"password,omitempty"`
}
func (*AlistStreamingInfo) AfterFind ¶ added in v0.3.1
func (a *AlistStreamingInfo) AfterFind(tx *gorm.DB) error
func (*AlistStreamingInfo) AfterSave ¶ added in v0.3.1
func (a *AlistStreamingInfo) AfterSave(tx *gorm.DB) error
func (*AlistStreamingInfo) BeforeSave ¶ added in v0.3.1
func (a *AlistStreamingInfo) BeforeSave(tx *gorm.DB) error
func (*AlistStreamingInfo) Validate ¶ added in v0.3.2
func (a *AlistStreamingInfo) Validate() error
type AlistVendor ¶ added in v0.3.1
type AlistVendor struct {
CreatedAt time.Time
UpdatedAt time.Time
UserID string `gorm:"primaryKey;type:char(32)"`
Backend string `gorm:"type:varchar(64)"`
ServerID string `gorm:"primaryKey;type:char(32)"`
Host string `gorm:"not null;type:varchar(256)"`
Username string `gorm:"type:varchar(256)"`
HashedPassword []byte
}
func (*AlistVendor) BeforeSave ¶ added in v0.3.1
func (a *AlistVendor) BeforeSave(tx *gorm.DB) error
type Backend ¶ added in v0.3.1
type Backend struct {
Endpoint string `gorm:"primaryKey;type:varchar(512)" json:"endpoint"`
Comment string `gorm:"type:text" json:"comment"`
Tls bool `gorm:"default:false" json:"tls"`
JwtSecret string `gorm:"type:varchar(256)" json:"jwtSecret"`
CustomCA string `gorm:"type:text" json:"customCA"`
TimeOut string `gorm:"default:10s" json:"timeOut"`
Consul Consul `gorm:"embedded;embeddedPrefix:consul_" json:"consul"`
Etcd Etcd `gorm:"embedded;embeddedPrefix:etcd_" json:"etcd"`
}
type BackendUsedBy ¶ added in v0.3.1
type BackendUsedBy struct {
Enabled bool `gorm:"default:false" json:"enabled"`
Bilibili bool `gorm:"default:false" json:"bilibili"`
BilibiliBackendName string `gorm:"type:varchar(64)" json:"bilibiliBackendName"`
Alist bool `gorm:"default:false" json:"alist"`
AlistBackendName string `gorm:"type:varchar(64)" json:"alistBackendName"`
Emby bool `gorm:"default:false" json:"emby"`
EmbyBackendName string `gorm:"type:varchar(64)" json:"embyBackendName"`
}
type BaseMovie ¶
type BaseMovie struct {
Url string `gorm:"type:varchar(8192)" json:"url"`
Name string `gorm:"not null;type:varchar(256)" json:"name"`
Live bool `json:"live"`
Proxy bool `json:"proxy"`
RtmpSource bool `json:"rtmpSource"`
Type string `json:"type"`
Headers map[string]string `gorm:"serializer:fastjson;type:text" json:"headers"`
Subtitles map[string]*Subtitle `gorm:"serializer:fastjson;type:text" json:"subtitles"`
VendorInfo VendorInfo `gorm:"embedded;embeddedPrefix:vendor_info_" json:"vendorInfo,omitempty"`
}
type BilibiliStreamingInfo ¶ added in v0.3.1
type BilibiliStreamingInfo struct {
Bvid string `json:"bvid,omitempty"`
Cid uint64 `json:"cid,omitempty"`
Epid uint64 `json:"epid,omitempty"`
Quality uint64 `json:"quality,omitempty"`
}
func (*BilibiliStreamingInfo) Validate ¶ added in v0.3.1
func (b *BilibiliStreamingInfo) Validate() error
type BilibiliVendor ¶ added in v0.3.1
type BilibiliVendor struct {
CreatedAt time.Time
UpdatedAt time.Time
UserID string `gorm:"primaryKey;type:char(32)"`
Backend string `gorm:"type:varchar(64)"`
Cookies map[string]string `gorm:"not null;serializer:fastjson;type:text"`
}
func (*BilibiliVendor) AfterFind ¶ added in v0.3.1
func (b *BilibiliVendor) AfterFind(tx *gorm.DB) error
func (*BilibiliVendor) AfterSave ¶ added in v0.3.1
func (b *BilibiliVendor) AfterSave(tx *gorm.DB) error
func (*BilibiliVendor) BeforeSave ¶ added in v0.3.1
func (b *BilibiliVendor) BeforeSave(tx *gorm.DB) error
type Consul ¶ added in v0.3.1
type Consul struct {
ServiceName string `gorm:"type:varchar(64)" json:"serviceName"`
Token string `gorm:"type:varchar(256)" json:"token"`
PathPrefix string `gorm:"type:varchar(64)" json:"pathPrefix"`
Namespace string `gorm:"type:varchar(64)" json:"namespace"`
Partition string `gorm:"type:varchar(64)" json:"partition"`
}
type EmbyStreamingInfo ¶ added in v0.3.1
type EmbyStreamingInfo struct {
// {/}serverId/ItemId
Path string `gorm:"type:varchar(52)" json:"path,omitempty"`
}
func (*EmbyStreamingInfo) Validate ¶ added in v0.3.2
func (e *EmbyStreamingInfo) Validate() error
type EmbyVendor ¶ added in v0.3.1
type EmbyVendor struct {
CreatedAt time.Time
UpdatedAt time.Time
UserID string `gorm:"primaryKey;type:char(32)"`
Backend string `gorm:"type:varchar(64)"`
ServerID string `gorm:"primaryKey;type:char(32)"`
Host string `gorm:"not null;type:varchar(256)"`
ApiKey string `gorm:"not null;type:varchar(256)"`
}
func (*EmbyVendor) BeforeSave ¶ added in v0.3.1
func (e *EmbyVendor) BeforeSave(tx *gorm.DB) error
type Movie ¶
type Movie struct {
ID string `gorm:"primaryKey;type:char(32)" json:"id"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
Position uint `gorm:"not null" json:"-"`
RoomID string `gorm:"not null;index;type:char(32)" json:"-"`
CreatorID string `gorm:"index;type:char(32)" json:"creatorId"`
Base BaseMovie `gorm:"embedded;embeddedPrefix:base_" json:"base"`
}
type Room ¶
type Room struct {
ID string `gorm:"primaryKey;type:char(32)" json:"id"`
CreatedAt time.Time
UpdatedAt time.Time
Status RoomStatus `gorm:"not null;default:2"`
Name string `gorm:"not null;uniqueIndex;type:varchar(32)"`
Settings RoomSettings `gorm:"embedded;embeddedPrefix:settings_"`
CreatorID string `gorm:"index;type:char(32)"`
HashedPassword []byte
GroupUserRelations []RoomUserRelation `gorm:"foreignKey:RoomID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Movies []Movie `gorm:"foreignKey:RoomID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}
func (*Room) CheckPassword ¶
func (*Room) NeedPassword ¶
type RoomSettings ¶
type RoomSettings struct {
Hidden bool `json:"hidden"`
CanCreateMovie bool `gorm:"default:true" json:"canCreateMovie"`
CanEditCurrent bool `gorm:"default:true" json:"canEditCurrent"`
CanSendChat bool `gorm:"default:true" json:"canSendChat"`
DisableJoinNewUser bool `gorm:"default:false" json:"disableJoinNewUser"`
JoinNeedReview bool `gorm:"default:false" json:"joinNeedReview"`
UserDefaultPermissions RoomUserPermission `json:"userDefaultPermissions"`
}
type RoomStatus ¶
type RoomStatus uint64
const ( RoomStatusBanned RoomStatus = 1 RoomStatusPending RoomStatus = 2 RoomStatusActive RoomStatus = 3 )
func (RoomStatus) String ¶
func (r RoomStatus) String() string
type RoomUserPermission ¶
type RoomUserPermission uint64
const ( PermissionAll RoomUserPermission = 0xffffffff PermissionEditRoom RoomUserPermission = 1 << iota PermissionEditUser PermissionCreateMovie PermissionEditCurrent PermissionSendChat )
func (RoomUserPermission) Has ¶
func (p RoomUserPermission) Has(permission RoomUserPermission) bool
type RoomUserRelation ¶
type RoomUserRelation struct {
CreatedAt time.Time
UpdatedAt time.Time
UserID string `gorm:"primarykey;type:char(32)"`
RoomID string `gorm:"primarykey;type:char(32)"`
Status RoomUserStatus `gorm:"not null;default:2"`
Permissions RoomUserPermission
}
func (*RoomUserRelation) HasPermission ¶
func (r *RoomUserRelation) HasPermission(permission RoomUserPermission) bool
type RoomUserStatus ¶
type RoomUserStatus uint64
const ( RoomUserStatusBanned RoomUserStatus = iota + 1 RoomUserStatusPending RoomUserStatusActive )
func (RoomUserStatus) String ¶
func (r RoomUserStatus) String() string
type Setting ¶
type Setting struct {
Name string `gorm:"primaryKey;type:varchar(256)"`
UpdatedAt time.Time
Value string `gorm:"not null;type:text"`
Type SettingType `gorm:"not null;default:string"`
Group SettingGroup `gorm:"not null"`
}
type SettingGroup ¶
type SettingGroup = string
const ( SettingGroupRoom SettingGroup = "room" SettingGroupUser SettingGroup = "user" SettingGroupProxy SettingGroup = "proxy" SettingGroupRtmp SettingGroup = "rtmp" SettingGroupDatabase SettingGroup = "database" SettingGroupServer SettingGroup = "server" SettingGroupOauth2 SettingGroup = "oauth2" )
type SettingType ¶
type SettingType string
const ( SettingTypeBool SettingType = "bool" SettingTypeInt64 SettingType = "int64" SettingTypeFloat64 SettingType = "float64" SettingTypeString SettingType = "string" )
type User ¶
type User struct {
ID string `gorm:"primaryKey;type:char(32)" json:"id"`
CreatedAt time.Time
UpdatedAt time.Time
RegisteredByProvider bool `gorm:"not null;default:false"`
UserProviders []UserProvider `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Username string `gorm:"not null;uniqueIndex;type:varchar(32)"`
HashedPassword []byte `gorm:"not null"`
Role Role `gorm:"not null;default:2"`
RoomUserRelations []RoomUserRelation `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Rooms []Room `gorm:"foreignKey:CreatorID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Movies []Movie `gorm:"foreignKey:CreatorID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
BilibiliVendor *BilibiliVendor `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
AlistVendor []*AlistVendor `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
EmbyVendor []*EmbyVendor `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}
func (*User) CheckPassword ¶
type UserProvider ¶
type UserProvider struct {
Provider provider.OAuth2Provider `gorm:"primarykey;type:varchar(32);uniqueIndex:idx_provider_user_id"`
ProviderUserID string `gorm:"primarykey;type:varchar(64)"`
CreatedAt time.Time
UpdatedAt time.Time
UserID string `gorm:"not null;type:char(32);uniqueIndex:idx_provider_user_id"`
}
type VendorBackend ¶ added in v0.3.1
type VendorBackend struct {
CreatedAt time.Time
UpdatedAt time.Time
Backend Backend `gorm:"embedded;embeddedPrefix:backend_" json:"backend"`
UsedBy BackendUsedBy `gorm:"embedded;embeddedPrefix:used_by_" json:"usedBy"`
}
func (*VendorBackend) AfterFind ¶ added in v0.3.1
func (v *VendorBackend) AfterFind(tx *gorm.DB) error
func (*VendorBackend) AfterSave ¶ added in v0.3.1
func (v *VendorBackend) AfterSave(tx *gorm.DB) error
func (*VendorBackend) BeforeSave ¶ added in v0.3.1
func (v *VendorBackend) BeforeSave(tx *gorm.DB) error
type VendorInfo ¶
type VendorInfo struct {
Vendor VendorName `gorm:"type:varchar(32)" json:"vendor"`
Backend string `gorm:"type:varchar(64)" json:"backend"`
Bilibili *BilibiliStreamingInfo `gorm:"embedded;embeddedPrefix:bilibili_" json:"bilibili,omitempty"`
Alist *AlistStreamingInfo `gorm:"embedded;embeddedPrefix:alist_" json:"alist,omitempty"`
Emby *EmbyStreamingInfo `gorm:"embedded;embeddedPrefix:emby_" json:"emby,omitempty"`
}
type VendorName ¶ added in v0.3.1
type VendorName = string
const ( VendorBilibili VendorName = "bilibili" VendorAlist VendorName = "alist" VendorEmby VendorName = "emby" )
Click to show internal directories.
Click to hide internal directories.