feat: update to v0.4.0, based by generics

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2022-04-18 02:11:33 +08:00
parent 6217ca3bed
commit aa3326f1a3
16 changed files with 252 additions and 135 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ func New(name, storage, profilePath string, items []item.Item) (*chromium, error
}
// TODO: Handle file path is not exist
if !fileutil.FolderExists(profilePath) {
return nil, fmt.Errorf("%s profile path is not exist: %s", name, profilePath)
return nil, fmt.Errorf("%s profile folder is not exist: %s", name, profilePath)
}
itemsPaths, err := c.getItemPath(profilePath, items)
if err != nil {
@@ -46,7 +46,7 @@ func (c *chromium) Name() string {
return c.name
}
func (c *chromium) GetBrowsingData() (*browingdata.Data, error) {
func (c *chromium) BrowsingData() (*browingdata.Data, error) {
b := browingdata.New(c.items)
if err := c.copyItemToLocal(); err != nil {
@@ -72,7 +72,7 @@ func (c *chromium) copyItemToLocal() error {
// TODO: Handle read file error
d, err := ioutil.ReadFile(path)
if err != nil {
fmt.Println(err.Error())
return err
}
err = ioutil.WriteFile(filename, d, 0777)
if err != nil {
+2 -2
View File
@@ -2,6 +2,7 @@ package chromium
import (
"crypto/sha1"
"errors"
"os"
"github.com/godbus/dbus/v5"
@@ -49,8 +50,7 @@ func (c *chromium) GetMasterKey() ([]byte, error) {
if label == c.storage {
se, err := i.GetSecret(session.Path())
if err != nil {
log.Error(err)
return nil, err
return nil, errors.New("get storage from dbus error:" + err.Error())
}
chromiumSecret = se.Value
}