bug fixes

This commit is contained in:
2025-08-28 21:25:21 +03:00
parent dd53bd99dc
commit a68dbcdad4
7 changed files with 364 additions and 902 deletions

18
main.go
View File

@@ -18,7 +18,9 @@ import (
)
func main() {
if err := godotenv.Load(); err != nil { _ = err }
if err := godotenv.Load(); err != nil {
_ = err
}
cfg := config.New()
@@ -42,12 +44,11 @@ func main() {
authHandler := appHandlers.NewAuthHandler(authService)
movieHandler := appHandlers.NewMovieHandler(movieService)
tvHandler := appHandlers.NewTVHandler(tvService)
favoritesHandler := appHandlers.NewFavoritesHandler(favoritesService)
favoritesHandler := appHandlers.NewFavoritesHandler(favoritesService, cfg)
docsHandler := appHandlers.NewDocsHandler()
searchHandler := appHandlers.NewSearchHandler(tmdbService)
categoriesHandler := appHandlers.NewCategoriesHandler(tmdbService)
playersHandler := appHandlers.NewPlayersHandler(cfg)
webtorrentHandler := appHandlers.NewWebTorrentHandler(tmdbService)
torrentsHandler := appHandlers.NewTorrentsHandler(torrentService, tmdbService)
reactionsHandler := appHandlers.NewReactionsHandler(reactionsService)
imagesHandler := appHandlers.NewImagesHandler()
@@ -75,10 +76,7 @@ func main() {
api.HandleFunc("/players/alloha/{imdb_id}", playersHandler.GetAllohaPlayer).Methods("GET")
api.HandleFunc("/players/lumex/{imdb_id}", playersHandler.GetLumexPlayer).Methods("GET")
api.HandleFunc("/players/vibix/{imdb_id}", playersHandler.GetVibixPlayer).Methods("GET")
api.HandleFunc("/webtorrent/player", webtorrentHandler.OpenPlayer).Methods("GET")
api.HandleFunc("/webtorrent/metadata", webtorrentHandler.GetMetadata).Methods("GET")
api.HandleFunc("/players/vibix/{imdb_id}", playersHandler.GetVibixPlayer).Methods("GET")
api.HandleFunc("/torrents/search/{imdbId}", torrentsHandler.SearchTorrents).Methods("GET")
api.HandleFunc("/torrents/movies", torrentsHandler.SearchMovies).Methods("GET")
@@ -154,10 +152,12 @@ func main() {
}
port := cfg.Port
if port == "" { port = "3000" }
if port == "" {
port = "3000"
}
if err := http.ListenAndServe(":"+port, finalHandler); err != nil {
fmt.Printf("❌ Server failed to start: %v\n", err)
os.Exit(1)
}
}
}