   res.json data
 
 # route to download a file
-app.get '/downloads/:filename', auth.authUser, (req, res) ->
+if settings.authRequired and settings.downloadAuthRequired
+  app.get '/downloads/:filename', auth.authUser, (req, res) ->
+    return downloadFile req, res
+else
+  app.get '/downloads/:filename', (req, res) ->
+    req.user = 'anonymous'
+    return downloadFile req, res
+
+downloadFile = (req, res) ->
   if not settings.sabreDownloadsEnabled
     return res.send 404
 


  logger.info 'user "' + req.user + '" queued "' + req.body.nzbname + '"'

  filename = path.join(settings.nzbUploadDir + path.basename(req.body.nzbname))
  fs.writeFileSync filename, req.body.nzbdata

  sabnzbd.queueNZBFile filename, req.user, (nzbName, queueRes) ->
    fs.unlink filename
    if queueRes
      sabnzbd.addUserNZB req.user, nzbName, req.body.flac2mp3
      res.json nzb: true
    else
      res.send 500


# index route
app.get '/', (req, res) ->
  res.render 'index', {authRequired: settings.authRequired}

# authentication route
app.post '/login', auth.authUser, (req, res) ->
