Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopiovanello committed Feb 3, 2025
1 parent 67b01f9 commit cc6a562
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handlers
package filebrowser

import (
"archive/zip"
Expand Down
17 changes: 9 additions & 8 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/archiver"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/config"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/dbutil"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/handlers"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/filebrowser"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/internal"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/internal/livestream"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/logging"
Expand All @@ -32,6 +32,7 @@ import (
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/rest"
ytdlpRPC "github.com/marcopiovanello/yt-dlp-web-ui/v3/server/rpc"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/status"
"github.com/marcopiovanello/yt-dlp-web-ui/v3/server/user"

_ "modernc.org/sqlite"
)
Expand Down Expand Up @@ -187,20 +188,20 @@ func newServer(c serverConfig) *http.Server {
if config.Instance().UseOpenId {
r.Use(openid.Middleware)
}
r.Post("/downloaded", handlers.ListDownloaded)
r.Post("/delete", handlers.DeleteFile)
r.Get("/d/{id}", handlers.DownloadFile)
r.Get("/v/{id}", handlers.SendFile)
r.Get("/bulk", handlers.BulkDownload(c.mdb))
r.Post("/downloaded", filebrowser.ListDownloaded)
r.Post("/delete", filebrowser.DeleteFile)
r.Get("/d/{id}", filebrowser.DownloadFile)
r.Get("/v/{id}", filebrowser.SendFile)
r.Get("/bulk", filebrowser.BulkDownload(c.mdb))
})

// Archive routes
r.Route("/archive", archive.ApplyRouter(c.db))

// Authentication routes
r.Route("/auth", func(r chi.Router) {
r.Post("/login", handlers.Login)
r.Get("/logout", handlers.Logout)
r.Post("/login", user.Login)
r.Get("/logout", user.Logout)

r.Route("/openid", func(r chi.Router) {
r.Get("/login", openid.Login)
Expand Down
2 changes: 1 addition & 1 deletion server/handlers/login.go → server/user/handlers.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handlers
package user

import (
"encoding/json"
Expand Down

0 comments on commit cc6a562

Please sign in to comment.