Run formatter
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Elara 2023-07-11 13:15:06 -07:00
parent 7a65835816
commit e8cb614b2e
2 changed files with 9 additions and 8 deletions

View File

@ -25,12 +25,12 @@ import (
"net/http" "net/http"
"os" "os"
"github.com/go-chi/chi/v5"
"github.com/twitchtv/twirp" "github.com/twitchtv/twirp"
"go.elara.ws/logger" "go.elara.ws/logger"
"go.elara.ws/logger/log" "go.elara.ws/logger/log"
"go.elara.ws/lure/internal/api" "go.elara.ws/lure/internal/api"
"go.elara.ws/lure/internal/repos" "go.elara.ws/lure/internal/repos"
"github.com/go-chi/chi/v5"
) )
func init() { func init() {
@ -61,12 +61,12 @@ func main() {
sigCh := make(chan struct{}, 200) sigCh := make(chan struct{}, 200)
go repoPullWorker(ctx, sigCh) go repoPullWorker(ctx, sigCh)
apiServer := api.NewAPIServer( apiServer := api.NewAPIServer(
lureWebAPI{db: gdb}, lureWebAPI{db: gdb},
twirp.WithServerPathPrefix(""), twirp.WithServerPathPrefix(""),
) )
r := chi.NewRouter() r := chi.NewRouter()
r.With(allowAllCORSHandler, withAcceptLanguage).Handle("/*", apiServer) r.With(allowAllCORSHandler, withAcceptLanguage).Handle("/*", apiServer)
r.Post("/webhook", handleWebhook(sigCh)) r.Post("/webhook", handleWebhook(sigCh))

View File

@ -1,19 +1,20 @@
package dl package dl
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"regexp" "regexp"
"strings" "strings"
"errors"
) )
var urlMatchRegex = regexp.MustCompile(`(magnet|torrent\+https?):.*`) var (
var ErrAria2NotFound = errors.New("aria2 must be installed for torrent functionality") urlMatchRegex = regexp.MustCompile(`(magnet|torrent\+https?):.*`)
var ErrDestinationEmpty = errors.New("the destination directory is empty") ErrAria2NotFound = errors.New("aria2 must be installed for torrent functionality")
ErrDestinationEmpty = errors.New("the destination directory is empty")
)
type TorrentDownloader struct{} type TorrentDownloader struct{}