handlers

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const UserAgent = `` /* 135-byte string literal not displayed */

Variables

View Source
var (
	ErrAuthFailed  = errors.New("auth failed")
	ErrAuthExpired = errors.New("auth expired")
	ErrRoomAlready = errors.New("room already exists")
)
View Source
var (
	ErrRoomIDEmpty      = errors.New("roomid is empty")
	ErrRoomNotFound     = errors.New("room not found")
	ErrUserNotFound     = errors.New("user not found")
	ErrRoomAlreadyExist = errors.New("room already exist")
)
View Source
var (
	Rooms *rooms
)

Functions

func AddAdmin

func AddAdmin(ctx *gin.Context)

func AuthRoom

func AuthRoom(Authorization string) (*room.User, error)

func AuthRtmpPublish

func AuthRtmpPublish(Authorization string) (channelName string, err error)

func ChangeCurrentMovie

func ChangeCurrentMovie(ctx *gin.Context)

func CheckRoom

func CheckRoom(ctx *gin.Context)

func CheckUser

func CheckUser(ctx *gin.Context)

func ClearMovies

func ClearMovies(ctx *gin.Context)

func CloseRoom

func CloseRoom(ctx *gin.Context)

func CurrentMovie

func CurrentMovie(ctx *gin.Context)

func DelAdmin

func DelAdmin(ctx *gin.Context)

func DelMovie

func DelMovie(ctx *gin.Context)

func DeleteRoom

func DeleteRoom(ctx *gin.Context)

func EditMovie

func EditMovie(ctx *gin.Context)

func GetPageItems

func GetPageItems[T any](ctx *gin.Context, items []T) ([]T, error)

func Init

func Init(e *gin.Engine, s *rtmps.Server)

func JoinLive

func JoinLive(ctx *gin.Context)

func LoginRoom

func LoginRoom(ctx *gin.Context)

func Me

func Me(ctx *gin.Context)

func MovieList

func MovieList(ctx *gin.Context)

func Movies

func Movies(ctx *gin.Context)

func NewCreateRoomHandler

func NewCreateRoomHandler(s *rtmps.Server) gin.HandlerFunc

func NewPublishKey

func NewPublishKey(ctx *gin.Context)

func NewRtmpAuthorization

func NewRtmpAuthorization(channelName string) (string, error)

func NewWSMessageHandler

func NewWSMessageHandler(u *room.User) func(c *websocket.Conn) error

func NewWebSocketHandler

func NewWebSocketHandler(wss *utils.WebSocket) gin.HandlerFunc

func ProxyMovie

func ProxyMovie(ctx *gin.Context)

func PushMovie

func PushMovie(ctx *gin.Context)

func RoomList

func RoomList(ctx *gin.Context)

func SetPassword

func SetPassword(ctx *gin.Context)

func SetUserPassword

func SetUserPassword(ctx *gin.Context)

func Settings

func Settings(ctx *gin.Context)

func SwapMovie

func SwapMovie(ctx *gin.Context)

func WebServer

func WebServer(e gin.IRoutes)

Types

type ApiResp

type ApiResp struct {
	Time  int64  `json:"time"`
	Error string `json:"error,omitempty"`
	Data  any    `json:"data,omitempty"`
}

func NewApiDataResp

func NewApiDataResp(data any) *ApiResp

func NewApiErrorResp

func NewApiErrorResp(err error) *ApiResp

func NewApiErrorStringResp

func NewApiErrorStringResp(err string) *ApiResp

func (*ApiResp) SetDate

func (ar *ApiResp) SetDate(data any)

func (*ApiResp) SetError

func (ar *ApiResp) SetError(err error)

type AuthClaims

type AuthClaims struct {
	RoomID      string `json:"id"`
	Version     uint64 `json:"v"`
	Username    string `json:"un"`
	UserVersion uint64 `json:"uv"`
	jwt.RegisteredClaims
}

type CreateRoomReq

type CreateRoomReq struct {
	RoomID       string `json:"roomId"`
	Password     string `json:"password"`
	Username     string `json:"username"`
	UserPassword string `json:"userPassword"`
	Hidden       bool   `json:"hidden"`
}

type EditMovieReq

type EditMovieReq struct {
	Id      uint64              `json:"id"`
	Url     string              `json:"url"`
	Name    string              `json:"name"`
	Type    string              `json:"type"`
	Headers map[string][]string `json:"headers"`
}

type FormatErrNotSupportFileType

type FormatErrNotSupportFileType string

func (FormatErrNotSupportFileType) Error

type FormatErrNotSupportPosition

type FormatErrNotSupportPosition string

func (FormatErrNotSupportPosition) Error

type IdReq

type IdReq struct {
	Id uint64 `json:"id"`
}

type IdsReq

type IdsReq struct {
	Ids []uint64 `json:"ids"`
}

type LoginRoomReq

type LoginRoomReq struct {
	RoomID       string `json:"roomId"`
	Password     string `json:"password"`
	Username     string `json:"username"`
	UserPassword string `json:"userPassword"`
}

type PushMovieReq

type PushMovieReq = room.BaseMovie

type RoomListResp

type RoomListResp struct {
	RoomID       string `json:"roomId"`
	PeopleNum    int64  `json:"peopleNum"`
	NeedPassword bool   `json:"needPassword"`
	Creator      string `json:"creator"`
	CreateAt     int64  `json:"createAt"`
}

type RtmpClaims

type RtmpClaims struct {
	PullKey string `json:"p"`
	jwt.RegisteredClaims
}

type SetPasswordReq

type SetPasswordReq struct {
	Password string `json:"password"`
}

type SwapMovieReq

type SwapMovieReq struct {
	Id1 uint64 `json:"id1"`
	Id2 uint64 `json:"id2"`
}

type UsernameReq

type UsernameReq struct {
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL