Documentation ¶
Index ¶
- Variables
- func FormatAlistPath(serverID, filePath string) string
- func FormatEmbyPath(serverID, filePath string) string
- 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
- func (a *AlistStreamingInfo) AfterFind(tx *gorm.DB) error
- func (a *AlistStreamingInfo) AfterSave(tx *gorm.DB) error
- func (a *AlistStreamingInfo) BeforeSave(tx *gorm.DB) error
- func (a *AlistStreamingInfo) FilePath() (string, error)
- func (a *AlistStreamingInfo) ServerID() (string, error)
- func (a *AlistStreamingInfo) ServerIDAndFilePath() (serverID, filePath string, err error)
- func (a *AlistStreamingInfo) SetServerIDAndFilePath(serverID, filePath string)
- func (a *AlistStreamingInfo) Validate() error
- type AlistVendor
- type Backend
- type BackendUsedBy
- type BilibiliStreamingInfo
- type BilibiliVendor
- type Consul
- type EmbyStreamingInfo
- func (e *EmbyStreamingInfo) FilePath() (string, error)
- func (e *EmbyStreamingInfo) ServerID() (string, error)
- func (e *EmbyStreamingInfo) ServerIDAndFilePath() (serverID, filePath string, err error)
- func (e *EmbyStreamingInfo) SetServerIDAndFilePath(serverID, filePath string)
- func (e *EmbyStreamingInfo) Validate() error
- type EmbyVendor
- type EmptyNullString
- type Etcd
- type MoreSource
- type Movie
- type MovieBase
- type Role
- type Room
- type RoomAdminPermission
- type RoomMember
- type RoomMemberPermission
- type RoomMemberRole
- type RoomMemberStatus
- type RoomSettings
- type RoomStatus
- type Setting
- type SettingGroup
- type SettingType
- type Subtitle
- type User
- type UserProvider
- type VendorBackend
- type VendorInfo
- type VendorName
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoPermission = errors.New("no permission")
Functions ¶
func FormatAlistPath ¶ added in v0.6.0
func FormatEmbyPath ¶ added in v0.6.0
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) FilePath ¶ added in v0.6.0
func (a *AlistStreamingInfo) FilePath() (string, error)
func (*AlistStreamingInfo) ServerID ¶ added in v0.6.0
func (a *AlistStreamingInfo) ServerID() (string, error)
func (*AlistStreamingInfo) ServerIDAndFilePath ¶ added in v0.6.0
func (a *AlistStreamingInfo) ServerIDAndFilePath() (serverID, filePath string, err error)
func (*AlistStreamingInfo) SetServerIDAndFilePath ¶ added in v0.6.0
func (a *AlistStreamingInfo) SetServerIDAndFilePath(serverID, filePath string)
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 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"` Transcode bool `json:"transcode,omitempty"` }
func (*EmbyStreamingInfo) FilePath ¶ added in v0.6.0
func (e *EmbyStreamingInfo) FilePath() (string, error)
func (*EmbyStreamingInfo) ServerID ¶ added in v0.6.0
func (e *EmbyStreamingInfo) ServerID() (string, error)
func (*EmbyStreamingInfo) ServerIDAndFilePath ¶ added in v0.6.0
func (e *EmbyStreamingInfo) ServerIDAndFilePath() (serverID, filePath string, err error)
func (*EmbyStreamingInfo) SetServerIDAndFilePath ¶ added in v0.6.0
func (e *EmbyStreamingInfo) SetServerIDAndFilePath(serverID, filePath string)
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)"` EmbyUserID string `gorm:"type:varchar(32)"` }
func (*EmbyVendor) BeforeSave ¶ added in v0.3.1
func (e *EmbyVendor) BeforeSave(tx *gorm.DB) error
type EmptyNullString ¶ added in v0.6.0
type EmptyNullString string
func (*EmptyNullString) Scan ¶ added in v0.6.0
func (ns *EmptyNullString) Scan(value any) error
Scan implements the [Scanner] interface.
func (EmptyNullString) String ¶ added in v0.6.0
func (ns EmptyNullString) String() string
func (EmptyNullString) Value ¶ added in v0.6.0
func (ns EmptyNullString) Value() (driver.Value, error)
Value implements the driver.Valuer interface.
type MoreSource ¶ added in v0.6.0
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"` MovieBase `gorm:"embedded;embeddedPrefix:base_" json:"base"` Children []*Movie `gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` }
type MovieBase ¶ added in v0.6.0
type MovieBase struct { Url string `gorm:"type:varchar(8192)" json:"url"` MoreSources []*MoreSource `gorm:"serializer:fastjson;type:text" json:"moreSources,omitempty"` 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,omitempty"` Subtitles map[string]*Subtitle `gorm:"serializer:fastjson;type:text" json:"subtitles,omitempty"` VendorInfo VendorInfo `gorm:"embedded;embeddedPrefix:vendor_info_" json:"vendorInfo,omitempty"` IsFolder bool `json:"isFolder"` ParentID EmptyNullString `gorm:"type:char(32)" json:"parentId"` }
func (*MovieBase) IsDynamicFolder ¶ added in v0.6.0
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:"foreignKey:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"settings"` CreatorID string `gorm:"index;type:char(32)"` HashedPassword []byte GroupUserRelations []*RoomMember `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 RoomAdminPermission ¶ added in v0.5.0
type RoomAdminPermission uint32
const ( PermissionApprovePendingMember RoomAdminPermission = 1 << iota PermissionBanRoomMember PermissionSetUserPermission PermissionSetRoomSettings PermissionSetRoomPassword PermissionDeleteRoom AllAdminPermissions RoomAdminPermission = math.MaxUint32 NoAdminPermission RoomAdminPermission = 0 DefaultAdminPermissions RoomAdminPermission = PermissionApprovePendingMember | PermissionBanRoomMember | PermissionSetUserPermission | PermissionSetRoomSettings | PermissionSetRoomPassword )
func (RoomAdminPermission) Add ¶ added in v0.5.0
func (p RoomAdminPermission) Add(permission RoomAdminPermission) RoomAdminPermission
func (RoomAdminPermission) Has ¶ added in v0.5.0
func (p RoomAdminPermission) Has(permission RoomAdminPermission) bool
func (RoomAdminPermission) Remove ¶ added in v0.5.0
func (p RoomAdminPermission) Remove(permission RoomAdminPermission) RoomAdminPermission
type RoomMember ¶ added in v0.5.0
type RoomMember struct { CreatedAt time.Time UpdatedAt time.Time UserID string `gorm:"primarykey;type:char(32)"` RoomID string `gorm:"primarykey;type:char(32)"` Status RoomMemberStatus `gorm:"not null;default:2"` Role RoomMemberRole `gorm:"not null;default:1"` Permissions RoomMemberPermission AdminPermissions RoomAdminPermission }
func (*RoomMember) HasAdminPermission ¶ added in v0.5.0
func (r *RoomMember) HasAdminPermission(permission RoomAdminPermission) bool
func (*RoomMember) HasPermission ¶ added in v0.5.0
func (r *RoomMember) HasPermission(permission RoomMemberPermission) bool
type RoomMemberPermission ¶ added in v0.5.0
type RoomMemberPermission uint32
const ( PermissionGetMovieList RoomMemberPermission = 1 << iota PermissionAddMovie PermissionDeleteMovie PermissionEditMovie PermissionSetCurrentMovie PermissionSetCurrentStatus PermissionSendChatMessage AllPermissions RoomMemberPermission = math.MaxUint32 NoPermission RoomMemberPermission = 0 DefaultPermissions RoomMemberPermission = PermissionGetMovieList | PermissionSendChatMessage )
func (RoomMemberPermission) Add ¶ added in v0.5.0
func (p RoomMemberPermission) Add(permission RoomMemberPermission) RoomMemberPermission
func (RoomMemberPermission) Has ¶ added in v0.5.0
func (p RoomMemberPermission) Has(permission RoomMemberPermission) bool
func (RoomMemberPermission) Remove ¶ added in v0.5.0
func (p RoomMemberPermission) Remove(permission RoomMemberPermission) RoomMemberPermission
type RoomMemberRole ¶ added in v0.5.0
type RoomMemberRole uint8
const ( RoomMemberRoleUnknown RoomMemberRole = iota RoomMemberRoleMember RoomMemberRoleAdmin RoomMemberRoleCreator )
func (RoomMemberRole) IsAdmin ¶ added in v0.5.0
func (r RoomMemberRole) IsAdmin() bool
func (RoomMemberRole) IsCreator ¶ added in v0.5.0
func (r RoomMemberRole) IsCreator() bool
func (RoomMemberRole) IsMember ¶ added in v0.5.0
func (r RoomMemberRole) IsMember() bool
func (RoomMemberRole) String ¶ added in v0.5.0
func (r RoomMemberRole) String() string
type RoomMemberStatus ¶ added in v0.5.0
type RoomMemberStatus uint8
const ( RoomMemberStatusUnknown RoomMemberStatus = iota RoomMemberStatusBanned RoomMemberStatusPending RoomMemberStatusActive )
func (RoomMemberStatus) IsActive ¶ added in v0.5.0
func (r RoomMemberStatus) IsActive() bool
func (RoomMemberStatus) IsBanned ¶ added in v0.5.0
func (r RoomMemberStatus) IsBanned() bool
func (RoomMemberStatus) IsNotActive ¶ added in v0.5.0
func (r RoomMemberStatus) IsNotActive() bool
func (RoomMemberStatus) IsPending ¶ added in v0.5.0
func (r RoomMemberStatus) IsPending() bool
func (RoomMemberStatus) String ¶ added in v0.5.0
func (r RoomMemberStatus) String() string
type RoomSettings ¶
type RoomSettings struct { ID string `gorm:"primaryKey;type:char(32)" json:"-"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"-"` Hidden bool `gorm:"default:false" json:"hidden"` DisableJoinNewUser bool `gorm:"default:false" json:"disable_join_new_user"` JoinNeedReview bool `gorm:"default:false" json:"join_need_review"` UserDefaultPermissions RoomMemberPermission `json:"user_default_permissions"` DisableGuest bool `gorm:"default:false" json:"disable_guest"` CanGetMovieList bool `gorm:"default:true" json:"can_get_movie_list"` CanAddMovie bool `gorm:"default:true" json:"can_add_movie"` CanDeleteMovie bool `gorm:"default:true" json:"can_delete_movie"` CanEditMovie bool `gorm:"default:true" json:"can_edit_movie"` CanSetCurrentMovie bool `gorm:"default:true" json:"can_set_current_movie"` CanSetCurrentStatus bool `gorm:"default:true" json:"can_set_current_status"` CanSendChatMessage bool `gorm:"default:true" json:"can_send_chat_message"` }
func DefaultRoomSettings ¶ added in v0.5.0
func DefaultRoomSettings() *RoomSettings
type RoomStatus ¶
type RoomStatus uint8
const ( RoomStatusBanned RoomStatus = 1 RoomStatusPending RoomStatus = 2 RoomStatusActive RoomStatus = 3 )
func (RoomStatus) String ¶
func (r RoomStatus) 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" SettingGroupEmail SettingGroup = "email" )
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"` RegisteredByEmail 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"` Email EmptyNullString `gorm:"type:varchar(128);uniqueIndex"` Role Role `gorm:"not null;default:2"` RoomMembers []*RoomMember `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.