re-add key

This commit is contained in:
idk
2022-01-23 12:00:37 -05:00
parent de35eba687
commit 37fc577d05
3 changed files with 3233 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"embed"
"flag" "flag"
"log" "log"
@ -8,6 +9,9 @@ import (
tbserve "i2pgit.org/idk/i2p.plugins.tor-manager/serve" tbserve "i2pgit.org/idk/i2p.plugins.tor-manager/serve"
) )
//go:embed tor-browser/unpack/i2p.firefox/*
var content embed.FS
//var runtimePair = tbget.GetRuntimePair() //var runtimePair = tbget.GetRuntimePair()
var ( var (
@ -37,6 +41,7 @@ func main() {
if err != nil { if err != nil {
log.Fatal("Couldn't create client", err) log.Fatal("Couldn't create client", err)
} }
client.TBS.Profile = &content
if *i2pbrowser { if *i2pbrowser {
client.TBS.RunI2PBWithLang() client.TBS.RunI2PBWithLang()
} else if *torbrowser { } else if *torbrowser {

View File

@ -1,7 +1,9 @@
package tbsupervise package tbsupervise
import ( import (
"embed"
"fmt" "fmt"
"io/fs"
"log" "log"
"net" "net"
"os" "os"
@ -26,6 +28,7 @@ type Supervisor struct {
torcmd *exec.Cmd torcmd *exec.Cmd
tbcmd *exec.Cmd tbcmd *exec.Cmd
ibcmd *exec.Cmd ibcmd *exec.Cmd
Profile *embed.FS
} }
func (s *Supervisor) TBPath() string { func (s *Supervisor) TBPath() string {
@ -49,9 +52,34 @@ func (s *Supervisor) TorDataPath() string {
} }
func (s *Supervisor) I2PDataPath() string { func (s *Supervisor) I2PDataPath() string {
//if tbget.FileExists(filepath.Join(s.UnpackPath, "i2p.firefox")) { if tbget.FileExists(filepath.Join(s.UnpackPath, "i2p.firefox")) {
return filepath.Join(filepath.Dir(s.UnpackPath), "i2p.firefox") return filepath.Join(filepath.Dir(s.UnpackPath), "i2p.firefox")
//} } else {
//unpack the embedded profile
if s.Profile != nil {
if err := s.UnpackI2PData(); err != nil {
log.Fatal(err)
}
}
return filepath.Join(filepath.Dir(s.UnpackPath), "i2p.firefox")
}
}
func (s *Supervisor) UnpackI2PData() error {
return fs.WalkDir(s.Profile, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
log.Printf("WALKING PROFILE DIRECTORY", d.Name())
/*if d.IsDir() {
os.MkdirAll(filepath.Join(s.I2PDataPath(), d.Name()), 0755)
} else {
if err := fs.CopyFile(filepath.Join(s.I2PDataPath(), d.Name()), filepath.Join(s.Profile.Path, d.Name())); err != nil {
return err
}
}*/
return nil
})
} }
func (s *Supervisor) tbbail() error { func (s *Supervisor) tbbail() error {

File diff suppressed because it is too large Load Diff