refactoring code with interface, Close #22

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2020-08-01 02:36:44 +08:00
parent 436e74f0df
commit b732c13959
9 changed files with 637 additions and 703 deletions
+4 -6
View File
@@ -24,17 +24,17 @@ var (
"firefox": {
ProfilePath: fireFoxProfilePath,
Name: firefoxName,
New: decryptFirefox,
New: NewFirefox,
},
"chrome": {
ProfilePath: chromeProfilePath,
Name: chromeName,
New: decryptChromium,
New: NewChromium,
},
}
)
func (c *chromium) InitSecretKey() error {
func (c *Chromium) InitSecretKey() error {
//what is d-bus @https://dbus.freedesktop.org/
var chromeSecret []byte
conn, err := dbus.SessionBus()
@@ -50,9 +50,7 @@ func (c *chromium) InitSecretKey() error {
return err
}
defer func() {
if err = session.Close(); err != nil {
log.Error(err)
}
session.Close()
}()
collections, err := svc.GetAllCollections()
if err != nil {