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) SendChatMessage(message string) error
- func (c *Client) SetSeekRate(seek float64, rate float64, timeDiff float64) (*Status, error)
- func (c *Client) SetStatus(playing bool, seek float64, rate float64, timeDiff float64) (*Status, error)
- func (c *Client) User() *User
- type Current
- type Hub
- func (h *Hub) Broadcast(data Message, conf ...BroadcastConf) error
- func (h *Hub) Close() error
- func (h *Hub) Closed() bool
- func (h *Hub) IsOnline(userID string) bool
- func (h *Hub) KickUser(userID string) error
- func (h *Hub) OnlineCount(userID string) int
- 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) CheckExpired(expireId uint64) bool
- func (m *Movie) ClearCache() error
- func (m *Movie) EmbyCache() *cache.EmbyMovieCache
- func (m *Movie) ExpireId() uint64
- 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) AddAdminPermissions(userID string, permissions model.RoomAdminPermission) error
- func (r *Room) AddMemberPermissions(userID string, permissions model.RoomMemberPermission) error
- func (r *Room) AddMovie(m *model.Movie) error
- func (r *Room) AddMovies(movies []*model.Movie) error
- func (r *Room) ApprovePendingMember(userID string) error
- func (r *Room) BanMember(userID string) error
- func (r *Room) Broadcast(data Message, conf ...BroadcastConf) error
- func (r *Room) CheckCurrentExpired(expireId uint64) (bool, error)
- func (r *Room) CheckVersion(version uint32) bool
- func (r *Room) ClearMovies() error
- func (r *Room) Current() *Current
- func (r *Room) CurrentMovie() (*Movie, error)
- func (r *Room) CurrentMovieID() string
- func (r *Room) DeleteMovieByID(id string) error
- func (r *Room) DeleteMoviesByID(ids []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, creator string) ([]*Movie, int)
- func (r *Room) HasAdminPermission(userID string, permission model.RoomAdminPermission) bool
- func (r *Room) HasPermission(userID string, permission model.RoomMemberPermission) bool
- func (r *Room) IsAdmin(userID string) bool
- func (r *Room) IsCreator(userID string) bool
- func (r *Room) IsGuest(userID string) bool
- func (r *Room) KickUser(userID string) error
- func (r *Room) LoadMemberStatus(userID string) (model.RoomMemberStatus, error)
- func (r *Room) LoadOrCreateMemberStatus(userID string) (model.RoomMemberStatus, error)
- func (r *Room) LoadOrCreateRoomMember(userID string) (*model.RoomMember, error)
- func (r *Room) LoadRoomAdminPermission(userID string) (model.RoomAdminPermission, error)
- func (r *Room) LoadRoomMember(userID string) (*model.RoomMember, error)
- func (r *Room) LoadRoomMemberPermission(userID string) (model.RoomMemberPermission, 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) RemoveAdminPermissions(userID string, permissions model.RoomAdminPermission) error
- func (r *Room) RemoveMemberPermissions(userID string, permissions model.RoomMemberPermission) error
- func (r *Room) ResetAdminPermissions(userID string) error
- func (r *Room) ResetMemberPermissions(userID string) error
- func (r *Room) SendToUser(user *User, data Message) error
- func (r *Room) SetAdmin(userID string, permissions model.RoomAdminPermission) error
- func (r *Room) SetAdminPermissions(userID string, permissions model.RoomAdminPermission) error
- func (r *Room) SetCurrentMovie(movieID string, play bool) error
- func (r *Room) SetCurrentSeekRate(seek float64, rate float64, timeDiff float64) *Status
- func (r *Room) SetCurrentStatus(playing bool, seek float64, rate float64, timeDiff float64) *Status
- func (r *Room) SetMember(userID string, permissions model.RoomMemberPermission) error
- func (r *Room) SetMemberPermissions(userID string, permissions model.RoomMemberPermission) error
- func (r *Room) SetPassword(password string) error
- func (r *Room) SetSettings(settings *model.RoomSettings) error
- func (r *Room) SwapMoviePositions(id1, id2 string) error
- func (r *Room) UnbanMember(userID string) error
- func (r *Room) UnregisterClient(cli *Client) error
- func (r *Room) UpdateMovie(movieId string, movie *model.BaseMovie) error
- func (r *Room) UpdateSettings(settings map[string]any) error
- func (r *Room) UserIsOnline(userID string) bool
- func (r *Room) UserOnlineCount(userID string) int
- func (r *Room) UserRole(userID string) (model.RoomMemberRole, error)
- func (r *Room) Version() uint32
- type RoomEntry
- type Status
- type User
- func (u *User) AddMemberPermissions(room *Room, userID string, permissions model.RoomMemberPermission) error
- func (u *User) AddRoomAdminPermissions(room *Room, userID string, permissions model.RoomAdminPermission) error
- func (u *User) AddRoomMovie(room *Room, movie *model.BaseMovie) (*model.Movie, error)
- func (u *User) AddRoomMovies(room *Room, movies []*model.BaseMovie) ([]*model.Movie, error)
- func (u *User) AlistCache() *cache.AlistUserCache
- func (u *User) ApproveRoomPendingMember(room *Room, userID string) error
- func (u *User) Ban() error
- func (u *User) BanRoomMember(room *Room, userID string) error
- func (u *User) BilibiliCache() *cache.BilibiliUserCache
- func (u *User) BindEmail(e string) error
- func (u *User) BindProvider(p provider.OAuth2Provider, pid string) error
- func (u *User) CheckVersion(version uint32) bool
- func (u *User) ClearRoomMovies(room *Room) error
- func (u *User) CreateRoom(name, password string, conf ...db.CreateRoomConfig) (*RoomEntry, error)
- func (u *User) DeleteRoom(room *RoomEntry) error
- func (u *User) DeleteRoomMovieByID(room *Room, movieID string) error
- func (u *User) DeleteRoomMoviesByID(room *Room, movieIDs []string) error
- func (u *User) EmbyCache() *cache.EmbyUserCache
- func (u *User) GetRoomMoviesWithPage(room *Room, page, pageSize int) ([]*Movie, int)
- func (u *User) HasRoomAdminPermission(room *Room, permission model.RoomAdminPermission) bool
- func (u *User) HasRoomPermission(room *Room, permission model.RoomMemberPermission) bool
- func (u *User) IsAdmin() bool
- func (u *User) IsBanned() bool
- func (u *User) IsGuest() bool
- func (u *User) IsPending() bool
- func (u *User) IsRoomAdmin(room *Room) bool
- func (u *User) IsRoomCreator(room *Room) 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) RemoveMemberPermissions(room *Room, userID string, permissions model.RoomMemberPermission) error
- func (u *User) RemoveRoomAdminPermissions(room *Room, userID string, permissions model.RoomAdminPermission) error
- func (u *User) ResetMemberPermissions(room *Room, userID string) error
- func (u *User) ResetRoomAdminPermissions(room *Room, userID string) error
- func (u *User) SendBindCaptchaEmail(e string) error
- func (u *User) SendRetrievePasswordCaptchaEmail(host string) error
- func (u *User) SendTestEmail() error
- func (u *User) SetAdminRole() error
- func (u *User) SetMemberPermissions(room *Room, userID string, permissions model.RoomMemberPermission) error
- func (u *User) SetPassword(password string) error
- func (u *User) SetRoomAdmin(room *Room, userID string, permissions model.RoomAdminPermission) error
- func (u *User) SetRoomAdminPermissions(room *Room, userID string, permissions model.RoomAdminPermission) error
- func (u *User) SetRoomCurrentMovie(room *Room, movieID string, play bool) error
- func (u *User) SetRoomCurrentSeekRate(room *Room, seek, rate, timeDiff float64) (*Status, error)
- func (u *User) SetRoomCurrentStatus(room *Room, playing bool, seek, rate, timeDiff float64) (*Status, error)
- func (u *User) SetRoomMember(room *Room, userID string, permissions model.RoomMemberPermission) error
- func (u *User) SetRoomPassword(room *Room, password string) error
- func (u *User) SetRoomSettings(room *Room, setting *model.RoomSettings) error
- func (u *User) SetRootRole() error
- func (u *User) SetUserRole() error
- func (u *User) SetUsername(username string) error
- func (u *User) SwapRoomMoviePositions(room *Room, id1, id2 string) error
- func (u *User) Unban() error
- func (u *User) UnbanRoomMember(room *Room, userID string) error
- func (u *User) UnbindEmail() error
- func (u *User) UpdateRoomMovie(room *Room, movieID string, movie *model.BaseMovie) error
- func (u *User) UpdateRoomSettings(room *Room, settings map[string]interface{}) error
- func (u *User) VerifyBindCaptchaEmail(e, captcha string) (bool, error)
- func (u *User) VerifyRetrievePasswordCaptchaEmail(e, captcha string) (bool, error)
- func (u *User) Version() uint32
- type UserEntry
- func CreateOrLoadUser(username string, password string, conf ...db.CreateUserConfig) (*UserEntry, error)
- func CreateOrLoadUserWithEmail(username, password, email 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 CreateUserWithEmail(username, password, email string, conf ...db.CreateUserConfig) (*UserEntry, error)
- func GetUserByProvider(p provider.OAuth2Provider, pid string) (*UserEntry, error)
- func LoadOrInitUser(u *model.User) (*UserEntry, error)
- func LoadOrInitUserByEmail(email string) (*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")
)
View Source
var ErrEmailUnbound = errors.New("email unbound")
View Source
var ErrNoCurrentMovie = errors.New("no current movie")
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)
func (*Client) SendChatMessage ¶ added in v0.5.0
func (*Client) SetSeekRate ¶ added in v0.5.0
type Current ¶
func (*Current) SetSeekRate ¶
func (*Current) UpdateStatus ¶ added in v0.4.1
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) OnlineCount ¶ added in v0.5.0
func (*Hub) UnRegClient ¶
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) CheckExpired ¶ added in v0.3.6
func (*Movie) ClearCache ¶ added in v0.3.6
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) AddAdminPermissions ¶ added in v0.5.0
func (r *Room) AddAdminPermissions(userID string, permissions model.RoomAdminPermission) error
func (*Room) AddMemberPermissions ¶ added in v0.5.0
func (r *Room) AddMemberPermissions(userID string, permissions model.RoomMemberPermission) error
func (*Room) ApprovePendingMember ¶ added in v0.5.0
func (*Room) CheckCurrentExpired ¶ added in v0.3.6
func (*Room) CheckVersion ¶
func (*Room) ClearMovies ¶
func (*Room) CurrentMovie ¶ added in v0.3.6
func (*Room) CurrentMovieID ¶ added in v0.5.0
func (*Room) DeleteMovieByID ¶
func (*Room) DeleteMoviesByID ¶ added in v0.5.0
func (*Room) GetMoviesCount ¶
func (*Room) GetMoviesWithPage ¶
func (*Room) HasAdminPermission ¶ added in v0.5.0
func (r *Room) HasAdminPermission(userID string, permission model.RoomAdminPermission) bool
func (*Room) HasPermission ¶
func (r *Room) HasPermission(userID string, permission model.RoomMemberPermission) bool
func (*Room) LoadMemberStatus ¶ added in v0.5.0
func (r *Room) LoadMemberStatus(userID string) (model.RoomMemberStatus, error)
func (*Room) LoadOrCreateMemberStatus ¶ added in v0.5.0
func (r *Room) LoadOrCreateMemberStatus(userID string) (model.RoomMemberStatus, error)
func (*Room) LoadOrCreateRoomMember ¶ added in v0.5.0
func (r *Room) LoadOrCreateRoomMember(userID string) (*model.RoomMember, error)
func (*Room) LoadRoomAdminPermission ¶ added in v0.5.0
func (r *Room) LoadRoomAdminPermission(userID string) (model.RoomAdminPermission, error)
func (*Room) LoadRoomMember ¶ added in v0.5.0
func (r *Room) LoadRoomMember(userID string) (*model.RoomMember, error)
func (*Room) LoadRoomMemberPermission ¶ added in v0.5.0
func (r *Room) LoadRoomMemberPermission(userID string) (model.RoomMemberPermission, error)
func (*Room) NeedPassword ¶
func (*Room) RemoveAdminPermissions ¶ added in v0.5.0
func (r *Room) RemoveAdminPermissions(userID string, permissions model.RoomAdminPermission) error
func (*Room) RemoveMemberPermissions ¶ added in v0.5.0
func (r *Room) RemoveMemberPermissions(userID string, permissions model.RoomMemberPermission) error
func (*Room) ResetAdminPermissions ¶ added in v0.5.0
func (*Room) ResetMemberPermissions ¶ added in v0.5.0
func (*Room) SetAdmin ¶ added in v0.5.0
func (r *Room) SetAdmin(userID string, permissions model.RoomAdminPermission) error
func (*Room) SetAdminPermissions ¶ added in v0.5.0
func (r *Room) SetAdminPermissions(userID string, permissions model.RoomAdminPermission) error
func (*Room) SetCurrentSeekRate ¶ added in v0.5.0
func (*Room) SetCurrentStatus ¶ added in v0.5.0
func (*Room) SetMember ¶ added in v0.5.0
func (r *Room) SetMember(userID string, permissions model.RoomMemberPermission) error
func (*Room) SetMemberPermissions ¶ added in v0.5.0
func (r *Room) SetMemberPermissions(userID string, permissions model.RoomMemberPermission) error
func (*Room) SetPassword ¶
func (*Room) SetSettings ¶
func (r *Room) SetSettings(settings *model.RoomSettings) error
func (*Room) SwapMoviePositions ¶
func (*Room) UnbanMember ¶ added in v0.5.0
func (*Room) UnregisterClient ¶
func (*Room) UpdateSettings ¶ added in v0.5.0
func (*Room) UserIsOnline ¶ added in v0.5.0
func (*Room) UserOnlineCount ¶ added in v0.5.0
type User ¶
func (*User) AddMemberPermissions ¶ added in v0.5.0
func (*User) AddRoomAdminPermissions ¶ added in v0.5.0
func (*User) AddRoomMovie ¶ added in v0.5.0
func (*User) AddRoomMovies ¶ added in v0.5.0
func (*User) AlistCache ¶ added in v0.3.1
func (u *User) AlistCache() *cache.AlistUserCache
func (*User) ApproveRoomPendingMember ¶ added in v0.5.0
func (*User) BanRoomMember ¶ added in v0.5.0
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) ClearRoomMovies ¶ added in v0.5.0
func (*User) CreateRoom ¶
func (*User) DeleteRoom ¶
func (*User) DeleteRoomMovieByID ¶ added in v0.5.0
func (*User) DeleteRoomMoviesByID ¶ added in v0.5.0
func (*User) EmbyCache ¶ added in v0.3.1
func (u *User) EmbyCache() *cache.EmbyUserCache
func (*User) GetRoomMoviesWithPage ¶ added in v0.5.0
func (*User) HasRoomAdminPermission ¶ added in v0.5.0
func (u *User) HasRoomAdminPermission(room *Room, permission model.RoomAdminPermission) bool
func (*User) HasRoomPermission ¶
func (u *User) HasRoomPermission(room *Room, permission model.RoomMemberPermission) bool
func (*User) IsRoomAdmin ¶ added in v0.5.0
func (*User) IsRoomCreator ¶ added in v0.5.0
func (*User) RemoveMemberPermissions ¶ added in v0.5.0
func (*User) RemoveRoomAdminPermissions ¶ added in v0.5.0
func (*User) ResetMemberPermissions ¶ added in v0.5.0
func (*User) ResetRoomAdminPermissions ¶ added in v0.5.0
func (*User) SendBindCaptchaEmail ¶ added in v0.4.5
func (*User) SendRetrievePasswordCaptchaEmail ¶ added in v0.4.5
func (*User) SendTestEmail ¶ added in v0.4.5
func (*User) SetAdminRole ¶ added in v0.5.0
func (*User) SetMemberPermissions ¶ added in v0.5.0
func (*User) SetPassword ¶
func (*User) SetRoomAdmin ¶ added in v0.5.0
func (*User) SetRoomAdminPermissions ¶ added in v0.5.0
func (*User) SetRoomCurrentMovie ¶ added in v0.5.0
func (*User) SetRoomCurrentSeekRate ¶ added in v0.5.0
func (*User) SetRoomCurrentStatus ¶ added in v0.5.0
func (*User) SetRoomMember ¶ added in v0.5.0
func (*User) SetRoomSettings ¶ added in v0.5.0
func (u *User) SetRoomSettings(room *Room, setting *model.RoomSettings) error
func (*User) SetRootRole ¶ added in v0.5.0
func (*User) SetUserRole ¶ added in v0.5.0
func (*User) SetUsername ¶
func (*User) SwapRoomMoviePositions ¶ added in v0.5.0
func (*User) UnbanRoomMember ¶ added in v0.5.0
func (*User) UnbindEmail ¶ added in v0.4.5
func (*User) UpdateRoomMovie ¶ added in v0.5.0
func (*User) UpdateRoomSettings ¶ added in v0.5.0
func (*User) VerifyBindCaptchaEmail ¶ added in v0.4.5
func (*User) VerifyRetrievePasswordCaptchaEmail ¶ added in v0.4.5
type UserEntry ¶ added in v0.3.2
func CreateOrLoadUser ¶
func CreateOrLoadUserWithEmail ¶ added in v0.4.5
func CreateOrLoadUserWithEmail(username, password, email string, conf ...db.CreateUserConfig) (*UserEntry, error)
func CreateOrLoadUserWithProvider ¶
func CreateOrLoadUserWithProvider(username, password string, p provider.OAuth2Provider, pid string, conf ...db.CreateUserConfig) (*UserEntry, error)
func CreateUser ¶
func CreateUserWithEmail ¶ added in v0.4.5
func CreateUserWithEmail(username, password, email string, conf ...db.CreateUserConfig) (*UserEntry, error)
func GetUserByProvider ¶
func GetUserByProvider(p provider.OAuth2Provider, pid string) (*UserEntry, error)
func LoadOrInitUserByEmail ¶ added in v0.4.5
func LoadOrInitUserByID ¶
func LoadUserByUsername ¶
Click to show internal directories.
Click to hide internal directories.