From e6a46e80dbb69d2834c8e7c9a4a8cd44c81163b4 Mon Sep 17 00:00:00 2001 From: idk Date: Wed, 23 Mar 2022 00:57:20 -0400 Subject: [PATCH] More torrent subsystem upgrades --- get/get.go | 1 + get/torrent.go | 14 +++++++------- main.go | 9 +++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/get/get.go b/get/get.go index 2b1e44c..3bc6fb2 100644 --- a/get/get.go +++ b/get/get.go @@ -585,6 +585,7 @@ func (t *TBDownloader) BotherToDownload(dl, name string) bool { //if lenString != lenSize { // return true //} else { + fmt.Printf("BotherToDownload(): %s is fully downloaded\n", name) return false //} } diff --git a/get/torrent.go b/get/torrent.go index 02d741c..3b712d4 100644 --- a/get/torrent.go +++ b/get/torrent.go @@ -133,7 +133,7 @@ func FindSnarkDirectory() (string, error) { if SNARK_CONFIG != "" { checkfori2pcustom := filepath.Join(SNARK_CONFIG) if FileExists(checkfori2pcustom) { - log.Println("Found snark directory at $SNARK_CONFIG", checkfori2pcustom) + //log.Println("Found snark directory at $SNARK_CONFIG", checkfori2pcustom) return checkfori2pcustom, nil } } @@ -142,7 +142,7 @@ func FindSnarkDirectory() (string, error) { if I2P_CONFIG != "" { checkfori2pcustom := filepath.Join(I2P_CONFIG, "i2psnark") if FileExists(checkfori2pcustom) { - log.Println("Found snark directory at $I2P_CONFIG", checkfori2pcustom) + //log.Println("Found snark directory at $I2P_CONFIG", checkfori2pcustom) return checkfori2pcustom, nil } } @@ -151,7 +151,7 @@ func FindSnarkDirectory() (string, error) { if I2P != "" { checkfori2p := filepath.Join(I2P, "i2psnark") if FileExists(checkfori2p) { - log.Println("Found snark directory at $I2P", checkfori2p) + //log.Println("Found snark directory at $I2P", checkfori2p) return checkfori2p, nil } } @@ -164,23 +164,23 @@ func FindSnarkDirectory() (string, error) { case "windows": checkfori2plocal := filepath.Join(home, "AppData", "Local", "i2p", "i2psnark") if FileExists(checkfori2plocal) { - log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark") + //log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark") return checkfori2plocal, nil } checkfori2proaming := filepath.Join(home, "AppData", "Roaming", "i2p", "i2psnark") if FileExists(checkfori2proaming) { - log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark") + //log.Println("Found snark directory at %APPDATA%\\i2p\\i2psnark", "%APPDATA%\\i2p\\i2psnark") return checkfori2proaming, nil } case "linux": checkfori2phome := filepath.Join(home, ".i2p", "i2psnark") if FileExists(checkfori2phome) { - log.Println("Found snark directory at $HOME/.i2p/i2psnark", "$HOME/.i2p/i2psnark") + //log.Println("Found snark directory at $HOME/.i2p/i2psnark", "$HOME/.i2p/i2psnark") return checkfori2phome, nil } checkfori2pservice := filepath.Join("/var/lib/i2p/i2p-config", "i2psnark") if FileExists(checkfori2pservice) { - log.Println("Found snark directory at /var/lib/i2p/i2p-config/i2psnark", checkfori2pservice) + //log.Println("Found snark directory at /var/lib/i2p/i2p-config/i2psnark", checkfori2pservice) return checkfori2pservice, nil } case "darwin": diff --git a/main.go b/main.go index 99024df..5dbe093 100644 --- a/main.go +++ b/main.go @@ -98,6 +98,7 @@ var ( notor = flag.Bool("notor", false, "Do not automatically start Tor") nounpack = flag.Bool("nounpack", false, "Do not unpack the Tor Browser") ptop = flag.Bool("p2p", tbget.TorrentDownloaded(theLang, OS()+ARCH()), "Use bittorrent over I2P to download the initial copy of Tor Browser") + torversion = flag.Bool("torversion", false, "Print the version of Tor Browser that will be downloaded and exit") ) func Clearnet() bool { @@ -195,6 +196,14 @@ func main() { fmt.Printf("\n") } flag.Parse() + if *torversion { + torbrowserversion, err := tbget.GetTorBrowserVersionFromUpdateURL() + if err != nil { + log.Panicln(err) + } + fmt.Println(torbrowserversion) + os.Exit(0) + } if *ptop { log.Println("Using p2p") *mirror = "http://localhost:7657/i2psnark/"