Download REST API endpoints (#72)

* backend and frontend hotfixes, see message

Improved rendering on the frontend by cutting unecessary useStates.
Backend side, downloads now auto resume even on application kill.

* download rest api endpoints, general code refactor

* download request json mappings
This commit is contained in:
Marco
2023-07-31 08:30:09 +02:00
committed by GitHub
parent 68c829c40e
commit 8327d1e94c
22 changed files with 560 additions and 300 deletions

34
server/rest/provider.go Normal file
View File

@@ -0,0 +1,34 @@
package rest
import (
"sync"
"github.com/marcopeocchi/yt-dlp-web-ui/server/internal"
)
var (
service *Service
handler *Handler
serviceOnce sync.Once
handlerOnce sync.Once
)
func ProvideService(db *internal.MemoryDB, mq *internal.MessageQueue) *Service {
serviceOnce.Do(func() {
service = &Service{
db: db,
mq: mq,
}
})
return service
}
func ProvideHandler(svc *Service) *Handler {
handlerOnce.Do(func() {
handler = &Handler{
service: svc,
}
})
return handler
}