utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RedisClient *redis.Client
View Source
var Upgrader = websocket.Upgrader{
	CheckOrigin: func(r *http.Request) bool {
		return true
	},
}

Functions

func CleanupDownloads

func CleanupDownloads(maxSizeMB int64)

func GetRedisClient added in v1.0.2

func GetRedisClient() *redis.Client

func InitRedis

func InitRedis(address, password string, db int)

func KeepWebSocketAlive

func KeepWebSocketAlive(ws *websocket.Conn, id string)

func MonitorStatusAndNotify

func MonitorStatusAndNotify(ws *websocket.Conn, id, initialStatus string, ctx *gin.Context) <-chan struct{}

func ProcessDownload

func ProcessDownload(url, format, id string)

func SetProcessingStatus

func SetProcessingStatus(id string)

Types

type StatusInfo

type StatusInfo struct {
	Status                 string
	ShouldStartProcessing  bool
	CurrentStatusForClient string
}

func GetDownloadStatus

func GetDownloadStatus(id string) StatusInfo

type WebSocketMessage

type WebSocketMessage struct {
	Status  string `json:"status"`
	ID      string `json:"id"`
	Message string `json:"message,omitempty"`
}

func CreateWebSocketMessages

func CreateWebSocketMessages(status, id string) WebSocketMessage

Jump to

Keyboard shortcuts

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