Add ability to get the Tor version without instantiating a whole object.

This commit is contained in:
idk
2022-03-22 21:24:08 -04:00
parent 89319b9e56
commit 9ce7c2dbe4
7 changed files with 249 additions and 41 deletions

28
main.go
View File

@ -18,6 +18,9 @@ import (
"github.com/ncruces/zenity"
tbget "i2pgit.org/idk/i2p.plugins.tor-manager/get"
tbserve "i2pgit.org/idk/i2p.plugins.tor-manager/serve"
tbsupervise "i2pgit.org/idk/i2p.plugins.tor-manager/supervise"
tinymce "github.com/eyedeekay/go-htmleditor"
)
/*
@ -190,6 +193,7 @@ func main() {
}
flag.Parse()
if *ptop {
log.Println("Using p2p")
*mirror = "http://localhost:7657/i2psnark/"
}
if *password != "" {
@ -362,11 +366,7 @@ func main() {
}
if *solidarity {
client.Onion.UnpackSite()
go func() {
if err := client.Onion.ListenAndServe(); err != nil {
log.Println("Onion error:", err)
}
}()
go ServeOnion()
}
go runSysTray(false)
if err := client.Serve(); err != nil {
@ -375,6 +375,24 @@ func main() {
}
}
func ServeOnion() error {
if err := client.Onion.ListenAndServe(); err != nil {
log.Println("Onion error:", err)
}
return nil
}
func ServeEditor() error {
docroot, err := tbsupervise.FindEepsiteDocroot()
if err != nil {
return err
}
if err := tinymce.Serve("127.0.0.1", docroot, "index.html", 7685); err != nil {
log.Println("Couldn't serve editor", err)
}
return nil
}
func pathToMe() (string, error) {
ex, err := os.Executable()
if err != nil {