From 31eeb79a19024e9e1bbcb1681a4e739ddf41254a Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Mon, 3 Jun 2019 14:39:30 +0200 Subject: Add support for onion hosts --- slackware.com | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/slackware.com b/slackware.com index 5fced45..4684c6b 100755 --- a/slackware.com +++ b/slackware.com @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require "time" +require "uri" # TODO: List changelog entries per package # TODO: List mirrors @@ -76,6 +77,11 @@ def exitOnError(arg) exit(1) end +# is_onion checks the argument is a TOR host +def is_onion(host) + %r{.onion$}.match(host) != nil +end + def verifySynced(path) unless File.exists?(path) exitOnError(SyncRequiredError.new("#{path} not found")) @@ -285,11 +291,14 @@ class Local dst = File.join(dst, File.basename(src)) if File.directory?(dst) File.unlink(dst) if File.exists?(dst) + src_uri = URI(src) command = ["wget", "-O", dst, - src + src_uri.to_s, ] command << "--quiet" if QUIET == "true" + command.unshift("torsocks") if is_onion(src_uri.host) + ok = system(*command) ok ? nil : DownloadError.new(src) end -- cgit v1.2.3