Sfoglia il codice sorgente

Update public download feature.
NEED TO BE TESTED

Antoine Leroyer 11 anni fa
parent
commit
db3278c769
2 ha cambiato i file con 8 aggiunte e 6 eliminazioni
  1. 6 5
      config.yml-dist
  2. 2 1
      lib/rSeed/server.rb

+ 6 - 5
config.yml-dist

@@ -3,10 +3,11 @@
 #
 
 rtorrent:
-  rpc_host: "localhost"     # Hostname, should be localhost
-  rpc_port: 80              # Default port for your HTTP server
-  rpc_path: "/RPC2"         # Location directive in your HTTP instance to connect to rTorrent
+  rpc_host: "localhost"                   # Hostname, should be localhost
+  rpc_port: 80                            # Default port for your HTTP server
+  rpc_path: "/RPC2"                       # Location directive in your HTTP instance to connect to rTorrent
+  download_dir: "/path/to/download/dir"   # Location of rTorrent's finished downloads directory
 
 t411:
-#  t411_username: "login"    # T411.me username
-#  t411_password: "password" # T411.me password
+#  t411_username: "login"                 # T411.me username
+#  t411_password: "password"              # T411.me password

+ 2 - 1
lib/rSeed/server.rb

@@ -106,7 +106,8 @@ module RSeed
       if publicLink(hash)
         @rtorrent.getFilesInfo(hash).each do |file| 
           if file.has_value?(params[:filename]) 
-            x_send_file(file["path"])
+            content_type "application/octet-stream"
+            x_send_file("download/#{file["path"].sub(/#{Regexp.escape(@config.get("download_dir"))}/, '')}")
           end
         end
       end