mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 02:32:57 +00:00
dev day #99
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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})
|
||||
}
|
||||
Reference in New Issue
Block a user