fix auth setup bug

This commit is contained in:
Mukhtar Akere
2025-04-22 02:00:43 +01:00
parent 32935ce3aa
commit 2139d3a175
2 changed files with 11 additions and 6 deletions

View File

@@ -129,7 +129,7 @@ func (q *QBit) ProcessFiles(torrent *Torrent, debridTorrent *debrid.Torrent, arr
torrentFolderNoExt := utils.RemoveExtension(debridTorrent.Name) torrentFolderNoExt := utils.RemoveExtension(debridTorrent.Name)
torrentSymlinkPath, err = q.createSymlinksWebdav(debridTorrent, rclonePath, torrentFolderNoExt) // /mnt/symlinks/{category}/MyTVShow/ torrentSymlinkPath, err = q.createSymlinksWebdav(debridTorrent, rclonePath, torrentFolderNoExt) // /mnt/symlinks/{category}/MyTVShow/
q.logger.Debug().Msgf("Process Completed in %s", time.Since(timer)) q.logger.Debug().Msgf("Torrent adding process completed in %s", time.Since(timer))
} else { } else {
// User is using either zurg or debrid webdav // User is using either zurg or debrid webdav

View File

@@ -102,13 +102,13 @@ func (ui *Handler) authMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Check if setup is needed // Check if setup is needed
cfg := config.Get() cfg := config.Get()
if cfg.NeedsAuth() && r.URL.Path != "/auth" { if !cfg.UseAuth {
http.Redirect(w, r, "/auth", http.StatusSeeOther) next.ServeHTTP(w, r)
return return
} }
if !cfg.UseAuth { if cfg.NeedsAuth() && r.URL.Path != "/auth" {
next.ServeHTTP(w, r) http.Redirect(w, r, "/auth", http.StatusSeeOther)
return return
} }
@@ -147,6 +147,11 @@ func (ui *Handler) verifyAuth(username, password string) bool {
} }
func (ui *Handler) LoginHandler(w http.ResponseWriter, r *http.Request) { func (ui *Handler) LoginHandler(w http.ResponseWriter, r *http.Request) {
cfg := config.Get()
if cfg.NeedsAuth() {
http.Redirect(w, r, "/auth", http.StatusSeeOther)
return
}
if r.Method == "GET" { if r.Method == "GET" {
data := map[string]interface{}{ data := map[string]interface{}{
"Page": "login", "Page": "login",
@@ -196,7 +201,7 @@ func (ui *Handler) SetupHandler(w http.ResponseWriter, r *http.Request) {
cfg := config.Get() cfg := config.Get()
authCfg := cfg.GetAuth() authCfg := cfg.GetAuth()
if !cfg.NeedsSetup() { if !cfg.NeedsAuth() {
http.Redirect(w, r, "/", http.StatusSeeOther) http.Redirect(w, r, "/", http.StatusSeeOther)
return return
} }