webui

package
v0.0.0-...-96c3957 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBName          = "cookie.db"
	CookieBucket    = "cookies"
	ExpirationKey   = "expiration"
	ExpirationHours = 30 * 24 // Cookie 有效期改为一个月
)

Variables

View Source
var ErrCookieExpired = errors.New("cookie has expired")
View Source
var ErrCookieNotFound = errors.New("cookie not found")

Functions

func CloseDB

func CloseDB()

func CombinedMiddleware

func CombinedMiddleware(config config.Config, db *bbolt.DB) gin.HandlerFunc

NewCombinedMiddleware 创建并返回一个带有依赖的中间件闭包

func GenerateCookie

func GenerateCookie() (string, error)

func HandleCheckLoginStatusRequest

func HandleCheckLoginStatusRequest(c *gin.Context)

HandleCheckLoginStatusRequest 检查登录状态的处理函数

func HandleGetBan

func HandleGetBan(c *gin.Context, config config.Config, db *bbolt.DB)

HandleGetBan 处理/api/getban的GET请求

func HandleGetJSON

func HandleGetJSON(c *gin.Context, cfg config.Config)

HandleGetJSON 返回当前的config作为JSON

func HandleGetPalguardJson

func HandleGetPalguardJson(c *gin.Context)

HandleGetPalguardJson 返回palguard.json的内容

func HandleLoginRequest

func HandleLoginRequest(c *gin.Context, config config.Config)

HandleLoginRequest处理登录请求

func HandleRestart

func HandleRestart(c *gin.Context, cfg config.Config)

func HandleRestartSelf

func HandleRestartSelf(c *gin.Context, cfg config.Config)

func HandleSaveJSON

func HandleSaveJSON(c *gin.Context, cfg config.Config)

HandleSaveJSON 从请求体中读取JSON并更新config

func HandleSavePalguardJson

func HandleSavePalguardJson(c *gin.Context)

HandleSavePalguardJson 从请求体中读取JSON并写入palguard.json

func HandleSetUnban

func HandleSetUnban(c *gin.Context, config config.Config)

HandleSetUnban 处理/api/setunban的POST请求

func HandleStart

func HandleStart(c *gin.Context, cfg config.Config)

func HandleStop

func HandleStop(c *gin.Context, cfg config.Config)

func InitDB

func InitDB() *bbolt.DB

func InitializeDB

func InitializeDB()

func IsPlayerInWhitelist

func IsPlayerInWhitelist(player *config.PlayerW, whitelist []*config.PlayerW) bool

func ValidateCookie

func ValidateCookie(cookie string) (bool, error)

func WsHandlerWithDependencies

func WsHandlerWithDependencies(c *gin.Context, cfg config.Config)

Types

type AddWhiteRequest

type AddWhiteRequest struct {
	PlayerUID string `json:"playeruid"`
	SteamID   string `json:"steamid"`
	Name      string `json:"name"`
}

type BroadcastRequest

type BroadcastRequest struct {
	Message string `json:"message"`
}

BroadcastRequest 用于解析传入的JSON请求体

type ChangeSaveRequest

type ChangeSaveRequest struct {
	Path string `json:"path"`
}

ChangeSaveRequest 用于解析请求体

type Client

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

type KickOrBanRequest

type KickOrBanRequest struct {
	PlayerUID string `json:"playeruid"`
	SteamID   string `json:"steamid"`
	Type      string `json:"type"`
}

type Player

type Player struct {
	Name       string    `json:"name"`
	SteamID    string    `json:"steamid"`
	PlayerUID  string    `json:"playeruid"`
	LastOnline time.Time `json:"last_online"`
	Online     bool      `json:"online"`
}

type RconClient

type RconClient struct {
	Conn *rcon.Conn
}

RconClient 结构体,用于存储RCON连接和配置信息

func NewRconClient

func NewRconClient(address, password string) *RconClient

NewRconClient 创建一个新的RCON客户端

type RestartLaterRequest

type RestartLaterRequest struct {
	Seconds string `json:"seconds"`
	Message string `json:"message"`
}

RestartLaterRequest 用于绑定JSON请求体

type SaveNowRequest

type SaveNowRequest struct {
	Timestamp int64 `json:"timestamp"`
}

SaveNowRequest 用于解析请求体

Jump to

Keyboard shortcuts

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