Make OSX work!
This commit is contained in:
@ -39,14 +39,14 @@ The plugin will not start a Tor instance if a SOCKS proxy is open on port 9050.
|
||||
### Secondary Goals:
|
||||
|
||||
1. Launch Tor Browser
|
||||
- Works on Linux, Windows, not OSX yet but soon
|
||||
- Works on Linux, Windows, OSX with minor bugs
|
||||
2. Configure and launch Tor browser for use with I2P
|
||||
- Works on Linux, Windows, not OSX yet but soon
|
||||
- Works on Linux, Windows, OSX with minor bugs
|
||||
|
||||
#### Optional Features I might add if there is interest
|
||||
|
||||
1. Mirror the files which it downloads to an I2P Site
|
||||
- Probably works on everything
|
||||
- Works on Windows, Linux, OSX
|
||||
2. Mirror the files which it downloads to I2P torrents
|
||||
- Not done
|
||||
3. Set up an onion site which announces an I2P mirror exists
|
||||
|
@ -140,8 +140,8 @@ profile torbrowser_firefox @{torbrowser_firefox_executable} {
|
||||
deny /etc/group r,
|
||||
deny /etc/mailcap r,
|
||||
|
||||
/etc/machine-id r,
|
||||
/var/lib/dbus/machine-id r,
|
||||
/etc/osxhine-id r,
|
||||
/var/lib/dbus/osxhine-id r,
|
||||
|
||||
/dev/ r,
|
||||
/dev/shm/ r,
|
||||
|
33
main.go
33
main.go
@ -11,6 +11,9 @@ import (
|
||||
|
||||
"github.com/cloudfoundry/jibber_jabber"
|
||||
i2cpcheck "github.com/eyedeekay/checki2cp"
|
||||
"github.com/itchio/damage"
|
||||
"github.com/itchio/damage/hdiutil"
|
||||
"github.com/itchio/headway/state"
|
||||
tbget "i2pgit.org/idk/i2p.plugins.tor-manager/get"
|
||||
tbserve "i2pgit.org/idk/i2p.plugins.tor-manager/serve"
|
||||
)
|
||||
@ -44,6 +47,9 @@ func OS() string {
|
||||
}
|
||||
|
||||
func ARCH() string {
|
||||
// if OS() == "osx" {
|
||||
// return ""
|
||||
// }
|
||||
switch runtime.GOARCH {
|
||||
case "386":
|
||||
return "32"
|
||||
@ -177,6 +183,13 @@ func main() {
|
||||
client.Port = *port
|
||||
client.TBS.Profile = &content
|
||||
client.TBS.PassThroughArgs = flag.Args()
|
||||
consumer := &state.Consumer{
|
||||
OnMessage: func(lvl string, msg string) {
|
||||
log.Printf("[%s] %s", lvl, msg)
|
||||
},
|
||||
}
|
||||
host := hdiutil.NewHost(consumer)
|
||||
defer damage.Unmount(host, client.TBD.BrowserDir())
|
||||
// log.Fatalf("%s", client.TBS.PassThroughArgs)
|
||||
if *help {
|
||||
flag.Usage()
|
||||
@ -185,20 +198,30 @@ func main() {
|
||||
}
|
||||
if *profile != "" && !*offline {
|
||||
log.Println("Using a custom profile")
|
||||
client.TBS.RunTBBWithProfile(*profile)
|
||||
if client.TBS.RunTBBWithProfile(*profile); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else if *offline {
|
||||
if *profile == "" {
|
||||
*profile = "firefox.offline"
|
||||
}
|
||||
log.Println("Working offline")
|
||||
|
||||
client.TBS.RunTBBWithOfflineProfile(*profile, *offline)
|
||||
if client.TBS.RunTBBWithOfflineProfile(*profile, *offline); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else if *i2pbrowser {
|
||||
client.TBS.RunI2PBWithLang()
|
||||
if client.TBS.RunI2PBWithLang(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else if *i2pconfig {
|
||||
client.TBS.RunI2PBAppWithLang()
|
||||
if client.TBS.RunI2PBAppWithLang(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else if *torbrowser {
|
||||
client.TBS.RunTBWithLang()
|
||||
if err := client.TBS.RunTBWithLang(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
if *bemirror {
|
||||
go client.TBD.Serve()
|
||||
|
@ -245,9 +245,13 @@ func (s *Supervisor) RunTBWithLang() error {
|
||||
}
|
||||
log.Println("tor browser not found at", s.TBPath())
|
||||
return fmt.Errorf("tor browser not found at %s", s.TBPath())
|
||||
case "darwin":
|
||||
s.tbcmd = exec.Command("/usr/bin/env", "open", "-a", "\"Tor Browser.app\"")
|
||||
s.tbcmd.Dir = s.TBDirectory()
|
||||
case "osx":
|
||||
firefoxPath := filepath.Join(s.UnpackPath, "Tor Browser.app", "Contents", "MacOS", "firefox")
|
||||
s.tbcmd = exec.Command(firefoxPath)
|
||||
s.tbcmd.Dir = s.UnpackPath
|
||||
s.tbcmd.Stdout = os.Stdout
|
||||
s.tbcmd.Stderr = os.Stderr
|
||||
defer s.tbcmd.Process.Kill()
|
||||
return s.tbcmd.Run()
|
||||
case "win":
|
||||
log.Println("Running Windows EXE", s.TBDirectory(), "firefox.exe")
|
||||
@ -288,9 +292,13 @@ func (s *Supervisor) RunTBHelpWithLang() error {
|
||||
}
|
||||
log.Println("tor browser not found at", s.TBPath())
|
||||
return fmt.Errorf("tor browser not found at %s", s.TBPath())
|
||||
case "darwin":
|
||||
s.tbcmd = exec.Command("/usr/bin/env", "open", "-a", "\"Tor Browser.app\"")
|
||||
case "osx":
|
||||
firefoxPath := filepath.Join(s.UnpackPath, "Tor Browser.app", "Contents", "MacOS", "firefox")
|
||||
s.tbcmd = exec.Command(firefoxPath, "--help")
|
||||
s.tbcmd.Stdout = os.Stdout
|
||||
s.tbcmd.Stderr = os.Stderr
|
||||
s.tbcmd.Dir = s.TBDirectory()
|
||||
defer s.tbcmd.Process.Kill()
|
||||
return s.tbcmd.Run()
|
||||
case "win":
|
||||
log.Println("Running Windows EXE", s.TBDirectory(), "firefox.exe")
|
||||
@ -373,9 +381,13 @@ func (s *Supervisor) RunTBBWithOfflineProfile(profiledata string, offline bool)
|
||||
}
|
||||
log.Println("tor browser not found at", s.FirefoxPath())
|
||||
return fmt.Errorf("tor browser not found at %s", s.FirefoxPath())
|
||||
case "darwin":
|
||||
s.ibcmd = exec.Command("/usr/bin/env", "open", "-a", "\"Tor Browser.app\"")
|
||||
s.ibcmd.Dir = s.TBDirectory()
|
||||
case "osx":
|
||||
firefoxPath := filepath.Join(s.UnpackPath, "Tor Browser.app", "Contents", "MacOS", "firefox")
|
||||
s.ibcmd = exec.Command(firefoxPath, "--profile", profiledata)
|
||||
s.ibcmd.Dir = profiledata
|
||||
s.ibcmd.Stdout = os.Stdout
|
||||
s.ibcmd.Stderr = os.Stderr
|
||||
defer s.ibcmd.Process.Kill()
|
||||
return s.ibcmd.Run()
|
||||
case "win":
|
||||
log.Println("Running Windows EXE", filepath.Join(s.TBDirectory(), "firefox.exe"), "--profile", profiledata)
|
||||
@ -455,10 +467,14 @@ func (s *Supervisor) RunTorWithLang() error {
|
||||
}
|
||||
log.Println("tor not found at", s.TorPath())
|
||||
return fmt.Errorf("tor not found at %s", s.TorPath())
|
||||
case "darwin":
|
||||
s.torcmd = exec.Command("/usr/bin/env", "open", "-a", "\"Tor Browser.app\"")
|
||||
s.torcmd.Dir = s.TBDirectory()
|
||||
return s.torcmd.Run()
|
||||
case "osx":
|
||||
torPath := filepath.Join(s.UnpackPath, "Tor Browser.app", "Contents", "Resources", "TorBrowser", "Tor", "tor")
|
||||
s.ibcmd = exec.Command(torPath)
|
||||
s.ibcmd.Dir = filepath.Dir(torPath)
|
||||
s.ibcmd.Stdout = os.Stdout
|
||||
s.ibcmd.Stderr = os.Stderr
|
||||
defer s.ibcmd.Process.Kill()
|
||||
return s.tbcmd.Run()
|
||||
case "win":
|
||||
log.Println("Running Windows EXE", filepath.Join(s.TBDirectory(), "TorBrowser", "Tor", "tor.exe"))
|
||||
s.torcmd = exec.Command(filepath.Join(s.TBDirectory(), "TorBrowser", "Tor", "tor.exe"))
|
||||
|
Reference in New Issue
Block a user