refactor: format filename

pull/83/head
ᴍᴏᴏɴD4ʀᴋ 4 years ago
parent 206a13cfd6
commit 169cf9ae65
  1. 2
      log/log.go
  2. 1
      utils/utils.go
  3. 14
      utils/utils_darwin.go
  4. 20
      utils/utils_windows.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,
}

@ -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
}

@ -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)

@ -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'

Loading…
Cancel
Save