mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-03 18:22:57 +00:00
31 lines
678 B
Go
31 lines
678 B
Go
package controllers
|
|
|
|
import (
|
|
"net/http"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"fotbal-club/internal/services"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type RembgController struct{}
|
|
|
|
func NewRembgController() *RembgController { return &RembgController{} }
|
|
|
|
func (rc *RembgController) Status(c *gin.Context) {
|
|
s := services.GetRembgStatus()
|
|
c.JSON(http.StatusOK, s)
|
|
}
|
|
|
|
func (rc *RembgController) Start(c *gin.Context) {
|
|
cacheDir := strings.TrimSpace(c.Query("cache_dir"))
|
|
if cacheDir == "" {
|
|
cacheDir = filepath.Join("cache", "prefetch")
|
|
}
|
|
started := services.StartFACRLogosBatch(cacheDir)
|
|
s := services.GetRembgStatus()
|
|
c.JSON(http.StatusOK, gin.H{"started": started, "status": s})
|
|
}
|