Documentation ¶
Index ¶
- Variables
- func CloseRoomById(roomID string) error
- func CloseUserById(id string) error
- func CompareAndCloseRoom(room *RoomEntry) bool
- func CompareAndCloseUser(user *UserEntry) error
- func CompareAndDeleteRoom(room *RoomEntry) error
- func CompareAndDeleteUser(user *UserEntry) error
- func DeleteRoomByID(roomID string) error
- func DeleteUserByID(id string) error
- func GetUserName(userID string) string
- func Init(size int) error
- func PeopleNum(roomID string) int64
- func RangeRoomCache(f func(key string, value *synccache.Entry[*Room]) bool)
- func SetRoomStatusByID(roomID string, status model.RoomStatus) error
- type BroadcastConf
- type Client
- func (c *Client) Broadcast(msg Message, conf ...BroadcastConf) error
- func (c *Client) Close() error
- func (c *Client) Closed() bool
- func (c *Client) GetReadChan() <-chan Message
- func (c *Client) NextReader() (int, io.Reader, error)
- func (c *Client) NextWriter(messageType int) (io.WriteCloser, error)
- func (c *Client) Room() *Room
- func (c *Client) Send(msg Message) error
- func (c *Client) User() *User
- type Current
- type ElementMessage
- type Hub
- func (h *Hub) Broadcast(data Message, conf ...BroadcastConf) error
- func (h *Hub) Close() error
- func (h *Hub) Closed() bool
- func (h *Hub) PeopleNum() int64
- func (h *Hub) RegClient(cli *Client) error
- func (h *Hub) SendToUser(userID string, data Message) (err error)
- func (h *Hub) Start() error
- func (h *Hub) UnRegClient(cli *Client) error
- type Message
- type Movie
- func (m *Movie) AlistCache() *cache.AlistMovieCache
- func (m *Movie) BilibiliCache() *cache.BilibiliMovieCache
- func (m *Movie) Channel() (*rtmps.Channel, error)
- func (m *Movie) EmbyCache() *cache.EmbyMovieCache
- func (m *Movie) Terminate() error
- func (m *Movie) Update(movie *model.BaseMovie) error
- func (movie *Movie) Validate() error
- type PingMessage
- type Room
- func (r *Room) AddMovie(m *model.Movie) error
- func (r *Room) AddMovies(movies []*model.Movie) error
- func (r *Room) AddUserPermission(userID string, permission model.RoomUserPermission) error
- func (r *Room) Broadcast(data Message, conf ...BroadcastConf) error
- func (r *Room) CheckVersion(version uint32) bool
- func (r *Room) ClearMovies() error
- func (r *Room) Current() *Current
- func (r *Room) DeleteMovieByID(id string) error
- func (r *Room) GetChannel(channelName string) (*rtmps.Channel, error)
- func (r *Room) GetMovieByID(id string) (*Movie, error)
- func (r *Room) GetMoviesCount() int
- func (r *Room) GetMoviesWithPage(page, pageSize int) []*Movie
- func (r *Room) GetRoomUserRelation(userID string) (model.RoomUserPermission, error)
- func (r *Room) HasPermission(userID string, permission model.RoomUserPermission) bool
- func (r *Room) LoadOrCreateRoomUserRelation(userID string) (*model.RoomUserRelation, error)
- func (r *Room) NeedPassword() bool
- func (r *Room) NewClient(user *User, conn *websocket.Conn) (*Client, error)
- func (r *Room) PeopleNum() int64
- func (r *Room) RegClient(cli *Client) error
- func (r *Room) RemoveUserPermission(userID string, permission model.RoomUserPermission) error
- func (r *Room) SendToUser(user *User, data Message) error
- func (r *Room) SetCurrentMovie(movie *model.Movie, play bool)
- func (r *Room) SetCurrentMovieByID(id string, play bool) error
- func (r *Room) SetPassword(password string) error
- func (r *Room) SetRoomStatus(status model.RoomStatus) error
- func (r *Room) SetSeekRate(seek float64, rate float64, timeDiff float64) Status
- func (r *Room) SetSettings(settings model.RoomSettings) error
- func (r *Room) SetStatus(playing bool, seek float64, rate float64, timeDiff float64) Status
- func (r *Room) SetUserPermission(userID string, permission model.RoomUserPermission) error
- func (r *Room) SetUserStatus(userID string, status model.RoomUserStatus) error
- func (r *Room) SwapMoviePositions(id1, id2 string) error
- func (r *Room) UnregisterClient(cli *Client) error
- func (r *Room) UpdateMovie(movieId string, movie *model.BaseMovie) error
- func (r *Room) Version() uint32
- type RoomEntry
- type Status
- type User
- func (u *User) AddMovieToRoom(room *Room, movie *model.BaseMovie) error
- func (u *User) AddMoviesToRoom(room *Room, movies []*model.BaseMovie) error
- func (u *User) AlistCache() *cache.AlistUserCache
- func (u *User) BilibiliCache() *cache.BilibiliUserCache
- func (u *User) BindProvider(p provider.OAuth2Provider, pid string) error
- func (u *User) CheckVersion(version uint32) bool
- func (u *User) ClearMovies(room *Room) error
- func (u *User) CreateRoom(name, password string, conf ...db.CreateRoomConfig) (*RoomEntry, error)
- func (u *User) DeleteMovieByID(room *Room, movieID string) error
- func (u *User) DeleteMoviesByID(room *Room, movieIDs []string) error
- func (u *User) DeleteRoom(room *RoomEntry) error
- func (u *User) EmbyCache() *cache.EmbyUserCache
- func (u *User) HasRoomPermission(room *Room, permission model.RoomUserPermission) bool
- func (u *User) IsAdmin() bool
- func (u *User) IsBanned() bool
- func (u *User) IsPending() bool
- func (u *User) IsRoot() bool
- func (u *User) NewMovie(movie *model.BaseMovie) (*model.Movie, error)
- func (u *User) NewMovies(movies []*model.BaseMovie) ([]*model.Movie, error)
- func (u *User) SetCurrentMovie(room *Room, movie *model.Movie, play bool) error
- func (u *User) SetCurrentMovieByID(room *Room, movieID string, play bool) error
- func (u *User) SetPassword(password string) error
- func (u *User) SetRole(role model.Role) error
- func (u *User) SetRoomPassword(room *Room, password string) error
- func (u *User) SetRoomSetting(room *Room, setting model.RoomSettings) error
- func (u *User) SetUsername(username string) error
- func (u *User) UpdateMovie(room *Room, movieID string, movie *model.BaseMovie) error
- func (u *User) Version() uint32
- type UserEntry
- func CreateOrLoadUser(username string, password string, conf ...db.CreateUserConfig) (*UserEntry, error)
- func CreateOrLoadUserWithProvider(username, password string, p provider.OAuth2Provider, pid string, ...) (*UserEntry, error)
- func CreateUser(username string, password string, conf ...db.CreateUserConfig) (*UserEntry, error)
- func GetUserByProvider(p provider.OAuth2Provider, pid string) (*UserEntry, error)
- func LoadOrInitUser(u *model.User) (*UserEntry, error)
- func LoadOrInitUserByID(id string) (*UserEntry, error)
- func LoadUserByUsername(username string) (*UserEntry, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRoomPending = errors.New("room pending, please wait for admin to approve") ErrRoomBanned = errors.New("room banned") ErrRoomCreatorBanned = errors.New("room creator banned") ErrorRoomCreatorPending = errors.New("room creator pending, please wait for admin to approve") )
View Source
var ( ErrUserBanned = errors.New("user banned") ErrUserPending = errors.New("user pending, please wait for admin to approve") )
View Source
var (
ErrAlreadyClosed = fmt.Errorf("already closed")
)
Functions ¶
func CloseRoomById ¶
func CloseUserById ¶
func CompareAndCloseRoom ¶
func CompareAndCloseUser ¶
func CompareAndDeleteRoom ¶
func CompareAndDeleteUser ¶
func DeleteRoomByID ¶
func DeleteUserByID ¶
func GetUserName ¶
func RangeRoomCache ¶ added in v0.3.1
func SetRoomStatusByID ¶ added in v0.3.2
func SetRoomStatusByID(roomID string, status model.RoomStatus) error
Types ¶
type BroadcastConf ¶
type BroadcastConf func(*broadcastMessage)
func WithIgnoreClient ¶ added in v0.3.1
func WithIgnoreClient(cli ...*Client) BroadcastConf
func WithIgnoreId ¶
func WithIgnoreId(id ...string) BroadcastConf
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetReadChan ¶
func (*Client) NextWriter ¶
func (c *Client) NextWriter(messageType int) (io.WriteCloser, error)
type Current ¶
func (*Current) SetSeekRate ¶
func (*Current) UpdateSeek ¶
func (c *Current) UpdateSeek()
type ElementMessage ¶
type ElementMessage pb.ElementMessage
func (*ElementMessage) MessageType ¶
func (em *ElementMessage) MessageType() int
func (*ElementMessage) String ¶
func (em *ElementMessage) String() string
type Movie ¶
func (*Movie) AlistCache ¶ added in v0.3.1
func (m *Movie) AlistCache() *cache.AlistMovieCache
func (*Movie) BilibiliCache ¶ added in v0.3.1
func (m *Movie) BilibiliCache() *cache.BilibiliMovieCache
func (*Movie) EmbyCache ¶ added in v0.3.1
func (m *Movie) EmbyCache() *cache.EmbyMovieCache
type PingMessage ¶
type PingMessage struct{}
func (*PingMessage) MessageType ¶
func (pm *PingMessage) MessageType() int
func (*PingMessage) String ¶
func (pm *PingMessage) String() string
type Room ¶
func (*Room) AddUserPermission ¶
func (r *Room) AddUserPermission(userID string, permission model.RoomUserPermission) error
func (*Room) CheckVersion ¶
func (*Room) ClearMovies ¶
func (*Room) DeleteMovieByID ¶
func (*Room) GetMoviesCount ¶
func (*Room) GetMoviesWithPage ¶
func (*Room) GetRoomUserRelation ¶
func (r *Room) GetRoomUserRelation(userID string) (model.RoomUserPermission, error)
func (*Room) HasPermission ¶
func (r *Room) HasPermission(userID string, permission model.RoomUserPermission) bool
func (*Room) LoadOrCreateRoomUserRelation ¶
func (r *Room) LoadOrCreateRoomUserRelation(userID string) (*model.RoomUserRelation, error)
func (*Room) NeedPassword ¶
func (*Room) RemoveUserPermission ¶
func (r *Room) RemoveUserPermission(userID string, permission model.RoomUserPermission) error
func (*Room) SetPassword ¶
func (*Room) SetRoomStatus ¶
func (r *Room) SetRoomStatus(status model.RoomStatus) error
func (*Room) SetSeekRate ¶
func (*Room) SetSettings ¶
func (r *Room) SetSettings(settings model.RoomSettings) error
func (*Room) SetUserPermission ¶
func (r *Room) SetUserPermission(userID string, permission model.RoomUserPermission) error
func (*Room) SetUserStatus ¶
func (r *Room) SetUserStatus(userID string, status model.RoomUserStatus) error
func (*Room) SwapMoviePositions ¶
func (*Room) UnregisterClient ¶
type User ¶
func (*User) AddMovieToRoom ¶
func (*User) AddMoviesToRoom ¶
func (*User) AlistCache ¶ added in v0.3.1
func (u *User) AlistCache() *cache.AlistUserCache
func (*User) BilibiliCache ¶ added in v0.3.1
func (u *User) BilibiliCache() *cache.BilibiliUserCache
func (*User) BindProvider ¶
func (u *User) BindProvider(p provider.OAuth2Provider, pid string) error
func (*User) CheckVersion ¶
func (*User) ClearMovies ¶
func (*User) CreateRoom ¶
func (*User) DeleteMoviesByID ¶
func (*User) DeleteRoom ¶
func (*User) EmbyCache ¶ added in v0.3.1
func (u *User) EmbyCache() *cache.EmbyUserCache
func (*User) HasRoomPermission ¶
func (u *User) HasRoomPermission(room *Room, permission model.RoomUserPermission) bool
func (*User) SetCurrentMovie ¶
func (*User) SetCurrentMovieByID ¶
func (*User) SetPassword ¶
func (*User) SetRoomSetting ¶
func (u *User) SetRoomSetting(room *Room, setting model.RoomSettings) error
func (*User) SetUsername ¶
func (*User) UpdateMovie ¶
type UserEntry ¶ added in v0.3.2
func CreateOrLoadUser ¶
func CreateOrLoadUserWithProvider ¶
func CreateOrLoadUserWithProvider(username, password string, p provider.OAuth2Provider, pid string, conf ...db.CreateUserConfig) (*UserEntry, error)
func CreateUser ¶
func GetUserByProvider ¶
func GetUserByProvider(p provider.OAuth2Provider, pid string) (*UserEntry, error)
func LoadOrInitUserByID ¶
func LoadUserByUsername ¶
Click to show internal directories.
Click to hide internal directories.