web

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthFailed  = errors.New("auth failed")
	ErrAuthExpired = errors.New("auth expired")
)
View Source
var ProviderSet = wire.NewSet(NewWebServer)

ProviderSet is service providers.

Functions

func GetAuthorizationTokenFromContext

func GetAuthorizationTokenFromContext(ctx *gin.Context) (string, error)

Types

type AuthClaims

type AuthClaims struct {
	UserId      string `json:"u"`
	UserVersion uint32 `json:"v"`
	jwt.RegisteredClaims
}

type WebService

type WebService struct {
	// contains filtered or unexported fields
}

func NewWebServer

func NewWebServer(c *conf.WebConfig, reg registry.Registrar, rc *conf.RedisConfig) *WebService

func (*WebService) AdminSetUserPassword added in v0.2.2

func (ws *WebService) AdminSetUserPassword(ctx *gin.Context)

func (*WebService) AdminSetUsername added in v0.2.2

func (ws *WebService) AdminSetUsername(ctx *gin.Context)

func (*WebService) AuthAdminMiddleware

func (h *WebService) AuthAdminMiddleware(ctx *gin.Context)

func (*WebService) AuthUser

func (h *WebService) AuthUser(ctx context.Context, Authorization string) (*user.UserInfo, error)

func (*WebService) AuthUserMiddleware

func (h *WebService) AuthUserMiddleware(ctx *gin.Context)

func (*WebService) BindEmail added in v0.3.0

func (ws *WebService) BindEmail(ctx *gin.Context)

func (*WebService) BoatControl added in v0.4.6

func (ws *WebService) BoatControl(ctx *gin.Context)

func (*WebService) CreateUser

func (ws *WebService) CreateUser(ctx *gin.Context)

func (*WebService) FollowAllDevice added in v0.3.0

func (ws *WebService) FollowAllDevice(ctx *gin.Context)

func (*WebService) FollowDevice added in v0.3.0

func (ws *WebService) FollowDevice(ctx *gin.Context)

func (*WebService) GenDeviceDetail added in v0.2.1

func (ws *WebService) GenDeviceDetail(ctx context.Context, id uint64) (*model.GetDeviceDetailResp, error)

func (*WebService) GetDeviceDetail added in v0.2.1

func (ws *WebService) GetDeviceDetail(ctx *gin.Context)

func (*WebService) GetDeviceStreamEvent added in v0.2.4

func (ws *WebService) GetDeviceStreamEvent(ctx *gin.Context)

func (*WebService) GetDeviceStreamReport added in v0.2.3

func (ws *WebService) GetDeviceStreamReport(ctx *gin.Context)

func (*WebService) GetStreamLatestRecordsWithinRange added in v0.4.2

func (ws *WebService) GetStreamLatestRecordsWithinRange(ctx *gin.Context)

func (*WebService) Init

func (ws *WebService) Init(eng *gin.Engine)

func (*WebService) ListCollectionRecord added in v0.2.2

func (ws *WebService) ListCollectionRecord(ctx *gin.Context)

func (*WebService) ListDevice added in v0.2.1

func (ws *WebService) ListDevice(ctx *gin.Context)

func (*WebService) ListDeviceLog added in v0.2.2

func (ws *WebService) ListDeviceLog(ctx *gin.Context)

func (*WebService) ListFollowedDevice added in v0.3.0

func (ws *WebService) ListFollowedDevice(ctx *gin.Context)

TODO: return device info, add query params

func (*WebService) ListUser

func (ws *WebService) ListUser(ctx *gin.Context)

func (*WebService) Login

func (ws *WebService) Login(ctx *gin.Context)

func (*WebService) Me

func (ws *WebService) Me(ctx *gin.Context)

func (*WebService) NewUserAuthToken

func (ws *WebService) NewUserAuthToken(ctx context.Context, ID string) (string, error)

func (*WebService) RegisterDevice added in v0.2.1

func (ws *WebService) RegisterDevice(ctx *gin.Context)

func (*WebService) RegisterRouter

func (ws *WebService) RegisterRouter(e *gin.Engine)

func (*WebService) ReportNow added in v0.4.6

func (ws *WebService) ReportNow(ctx *gin.Context)

func (*WebService) SendBindEmailCaptcha added in v0.3.0

func (ws *WebService) SendBindEmailCaptcha(ctx *gin.Context)

func (*WebService) SendTestEmail added in v0.4.0

func (ws *WebService) SendTestEmail(ctx *gin.Context)

func (*WebService) SetDevicePassword added in v0.2.3

func (ws *WebService) SetDevicePassword(ctx *gin.Context)

func (*WebService) SetUserPassword added in v0.2.2

func (ws *WebService) SetUserPassword(ctx *gin.Context)

func (*WebService) SetUserRole added in v0.2.2

func (ws *WebService) SetUserRole(ctx *gin.Context)

func (*WebService) SetUserStatus added in v0.2.2

func (ws *WebService) SetUserStatus(ctx *gin.Context)

func (*WebService) SetUsername added in v0.2.2

func (ws *WebService) SetUsername(ctx *gin.Context)

func (*WebService) UnbindEmail added in v0.3.0

func (ws *WebService) UnbindEmail(ctx *gin.Context)

func (*WebService) UnfollowAllDevice added in v0.3.0

func (ws *WebService) UnfollowAllDevice(ctx *gin.Context)

func (*WebService) UnfollowDevice added in v0.3.0

func (ws *WebService) UnfollowDevice(ctx *gin.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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