|
@@ -27,6 +27,7 @@ module RSeed
|
|
|
end
|
|
|
end
|
|
|
@rtorrent = Rtorrent.new(@config.get("rpc_host"), @config.get("rpc_path"), @config.get("rpc_port"))
|
|
|
+ File.open(@config.get('public_link_file_path'), 'a+'){} if not File.exist?(@config.get('public_link_file_path'))
|
|
|
end
|
|
|
|
|
|
# Helperz
|
|
@@ -54,13 +55,12 @@ module RSeed
|
|
|
end
|
|
|
|
|
|
def publicLink hash
|
|
|
- hasLink = false
|
|
|
- File.open('data/public_links') do |fd|
|
|
|
+ File.open(@config.get('public_link_file_path')) do |fd|
|
|
|
fd.any? do |line|
|
|
|
- hasLink = true if line.include?(hash)
|
|
|
+ return true if line.include?(hash)
|
|
|
end
|
|
|
end
|
|
|
- return hasLink
|
|
|
+ return false
|
|
|
end
|
|
|
end
|
|
|
|
|
@@ -118,7 +118,7 @@ module RSeed
|
|
|
post '/share' do
|
|
|
fullhash = @rtorrent.getHash(params[:hash]).downcase
|
|
|
if not publicLink(fullhash)
|
|
|
- File.open('data/public_links', 'a+') do |fd|
|
|
|
+ File.open(@config.get('public_link_file_path'), 'a+') do |fd|
|
|
|
fd.puts fullhash
|
|
|
end
|
|
|
end
|