core

package
v0.0.0-...-45caf58 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const IssuerName = "BetaX ONS"
View Source
const MODEL_NAME = "Core"

Variables

This section is empty.

Functions

func AuthHandler

func AuthHandler() gin.HandlerFunc

func BuildAuthConfig

func BuildAuthConfig() *oauth2.Config

func GenerateToken

func GenerateToken(id int64) (string, int64, error)

生成令牌

Types

type AuthService

type AuthService struct {
	Config *oauth2.Config
	UM     *model.UserModel
}

func NewAuthService

func NewAuthService(engine *xorm.Engine) *AuthService

创建鉴权服务

func (AuthService) Callback

func (as AuthService) Callback(ctx *gin.Context)

处理 OAuth2 回调

func (AuthService) Login

func (as AuthService) Login(c *gin.Context)

发起 OAuth2 登陆

func (AuthService) QueryUserInfo

func (as AuthService) QueryUserInfo(token string) (*User, error)

查询 OAuth2 用户信息

type DeviceService

type DeviceService struct {
	Data *model.DeviceModel
}

func CreateDeviceService

func CreateDeviceService(engine *xorm.Engine) *DeviceService

func (DeviceService) Del

func (ds DeviceService) Del(ctx *gin.Context)

删除设备

func (DeviceService) GetInfo

func (ds DeviceService) GetInfo(ctx *gin.Context)

获取设备信息

func (DeviceService) GetList

func (ds DeviceService) GetList(ctx *gin.Context)

获取设备列表

func (DeviceService) ReName

func (ds DeviceService) ReName(ctx *gin.Context)

重命名设备

func (DeviceService) Register

func (ds DeviceService) Register(ctx *gin.Context)

注册 NAS 设备

type Message

type Message struct {
	Event string          `json:"event"`
	Data  json.RawMessage `json:"data"`
	To    string          `json:"to,omitempty"`
	From  string          `json:"from,omitempty"`
	Pass  string          `json:"pass,omitempty"`
}

type P2PService

type P2PService struct {
	Data *model.DeviceModel
}

func CreateP2PService

func CreateP2PService(engine *xorm.Engine) *P2PService

func (P2PService) Assess

func (ps P2PService) Assess(ctx *gin.Context)

func (P2PService) CheckOnline

func (ps P2PService) CheckOnline(ctx *gin.Context)

检查连接状态

type Router

type Router struct {
	// 路由对象
	Object *gin.Engine
	// contains filtered or unexported fields
}

func BuildRouter

func BuildRouter(release bool, port int, host, cert, key string, engine *xorm.Engine, page embed.FS) *Router

构建路由器

func (Router) Run

func (r Router) Run(engine *xorm.Engine)

启动路由

type User

type User struct {
	Id       string `json:"id"`
	Avatar   string `json:"avatar"`
	Nickname string `json:"nickname"`
	Username string `json:"username"`
	Version  string `json:"version"`
	Email    string `json:"email"`
}

type UserService

type UserService struct {
	Data *model.UserModel
}

func CreateUserService

func CreateUserService(engine *xorm.Engine) *UserService

func (UserService) GetLoginUser

func (us UserService) GetLoginUser(ctx *gin.Context)

Jump to

Keyboard shortcuts

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