From 169cf9ae651a89515d6814f44ffb9f0b10542949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=8D=E1=B4=8F=E1=B4=8F=C9=B4D4=CA=80=E1=B4=8B?= Date: Sun, 28 Jun 2020 17:25:38 +0800 Subject: [PATCH] refactor: format filename --- log/log.go | 2 +- utils/utils.go | 1 + utils/utils_darwin.go | 14 -------------- utils/utils_windows.go | 20 -------------------- 4 files changed, 2 insertions(+), 35 deletions(-) diff --git a/log/log.go b/log/log.go index 190c44c..2d41618 100644 --- a/log/log.go +++ b/log/log.go @@ -49,7 +49,7 @@ func newCore(level string) zapcore.Core { LineEnding: zapcore.DefaultLineEnding, EncodeLevel: zapcore.CapitalLevelEncoder, EncodeTime: zapcore.ISO8601TimeEncoder, - EncodeDuration: zapcore.SecondsDurationEncoder, // + EncodeDuration: zapcore.SecondsDurationEncoder, EncodeCaller: zapcore.ShortCallerEncoder, EncodeName: zapcore.FullNameEncoder, } diff --git a/utils/utils.go b/utils/utils.go index 6c69963..6ab277d 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -139,6 +139,7 @@ func WriteFile(filename string, data []byte) error { func FormatFileName(dir, browser, filename, format string) string { r := strings.TrimSpace(strings.ToLower(filename)) + r = strings.Replace(r, " ", "_", -1) p := path.Join(dir, fmt.Sprintf("%s_%s.%s", r, browser, format)) return p } diff --git a/utils/utils_darwin.go b/utils/utils_darwin.go index f291851..576da17 100644 --- a/utils/utils_darwin.go +++ b/utils/utils_darwin.go @@ -80,20 +80,6 @@ func InitKey(key string) error { return err } -//func GetDBPath(dir string, dbName ...string) (dbFile []string) { -// for _, v := range dbName { -// s, err := filepath.Glob(dir + v) -// if err != nil && len(s) == 0 { -// continue -// } -// if len(s) > 0 { -// log.Debugf("Find %s File Success", v) -// log.Debugf("%s file location is %s", v, s[0]) -// dbFile = append(dbFile, s[0]) -// } -// } -// return dbFile -//} func decryptChromeKey(chromePass []byte) { chromeKey = pbkdf2.Key(chromePass, chromeSalt, 1003, 16, sha1.New) diff --git a/utils/utils_windows.go b/utils/utils_windows.go index f0bd489..603cc31 100644 --- a/utils/utils_windows.go +++ b/utils/utils_windows.go @@ -84,26 +84,6 @@ func InitKey(key string) error { } } -//func GetDBPath(dir string, dbName ...string) (dbFile []string) { -// var dbPath []string -// chromeDBPath := os.Getenv("USERPROFILE") + dir -// for _, v := range dbName { -// dbPath = append(dbPath, chromeDBPath+v) -// } -// for _, v := range dbPath { -// s, err := filepath.Glob(v) -// if err != nil && len(s) == 0 { -// continue -// } -// if len(s) > 0 { -// log.Debugf("Find %s File Success", v) -// log.Debugf("%s file location is %s", v, s[0]) -// dbFile = append(dbFile, s[0]) -// } -// } -// return dbFile -//} - func DecryptChromePass(encryptPass []byte) (string, error) { if len(encryptPass) > 15 { // remove prefix 'v10'