start working on Firefox manager side

This commit is contained in:
idk
2022-07-14 16:34:08 -04:00
parent 59026ee653
commit c37b7db32c
2 changed files with 20 additions and 8 deletions

View File

@ -26,7 +26,7 @@ func NewFirefoxDownloader(lang string, os, arch string, content *embed.FS) *FFDo
return &FFDownloader{
Lang: lang,
DownloadPath: DOWNLOAD_FIREFOX_PATH(),
UnpackPath: UNPACK_PATH(),
UnpackPath: UNPACK_FIREFOX_PATH(),
OS: os,
ARCH: arch,
Verbose: false,
@ -35,12 +35,18 @@ func NewFirefoxDownloader(lang string, os, arch string, content *embed.FS) *FFDo
}
}
// DOWNLOAD_PATH returns the path to the downloads.
// DOWNLOAD_FIREFOX_PATH returns the path to the downloads.
func DOWNLOAD_FIREFOX_PATH() string {
var DOWNLOAD_PATH = filepath.Join(DefaultDir(), "firefox")
return DOWNLOAD_PATH
}
// UNPACK_FIREFOX_PATH returns the path to the unpacked files.
func UNPACK_FIREFOX_PATH() string {
var UNPACK_FIREFOX_PATH = filepath.Join(DefaultDir(), "unpack-firefox")
return UNPACK_FIREFOX_PATH
}
func (t FFDownloader) GetRuntimePair() string {
tbd := TBDownloader(t)
return tbd.GetRuntimePair()
@ -262,3 +268,8 @@ func (t *FFDownloader) BoolCheckFirefoxSignature(binpath, sigpath string) bool {
_, err := t.CheckFirefoxSignature(binpath, sigpath)
return err == nil
}
func (t FFDownloader) MakeTBDirectory() {
tbd := TBDownloader(t)
tbd.MakeTBDirectory()
}

View File

@ -28,6 +28,7 @@ import (
type Client struct {
hostname string
TBD *tbget.TBDownloader
FFD *tbget.FFDownloader
TBS *TBSupervise.Supervisor
Onion *i2pdotonion.I2POnionService
DarkMode bool
@ -113,17 +114,17 @@ func NewClient(verbose bool, lang, OS, arch, mirror string, content *embed.FS, n
// NewFirefoxClient creates a new Client.
func NewFirefoxClient(verbose bool, lang, os, arch, mirror string, content *embed.FS) (*Client, error) {
m := &Client{
TBD: tbget.NewFirefoxDownloader(lang, os, arch, content),
FFD: tbget.NewFirefoxDownloader(lang, os, arch, content),
}
m.TBD.Mirror = mirror
m.TBD.Verbose = verbose
m.TBD.MakeTBDirectory()
tgz, sig, err := m.TBD.DownloadFirefoxUpdaterForLang(lang)
m.FFD.Mirror = mirror
m.FFD.Verbose = verbose
m.FFD.MakeTBDirectory()
tgz, sig, err := m.FFD.DownloadFirefoxUpdaterForLang(lang)
if err != nil {
panic(err)
}
var home string
if home, err = m.TBD.CheckFirefoxSignature(tgz, sig); err != nil {
if home, err = m.FFD.CheckFirefoxSignature(tgz, sig); err != nil {
log.Fatal(err)
} else {
log.Printf("Signature check passed: %s %s", tgz, sig)