mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 03:27:39 +08:00
feat: check all in dir
This commit is contained in:
@@ -3,6 +3,7 @@ package storage
|
||||
import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -62,3 +63,8 @@ func (l *LocalStorage) Move(src, dest string) error {
|
||||
return os.RemoveAll(src)
|
||||
|
||||
}
|
||||
|
||||
|
||||
func (l *LocalStorage) ReadDir(dir string) ([]fs.FileInfo, error) {
|
||||
return ioutil.ReadDir(dir)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"unicode"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
@@ -25,4 +26,14 @@ func HashPassword(password string) (string, error) {
|
||||
func VerifyPassword(password, hash string) bool {
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||
return err == nil
|
||||
}
|
||||
}
|
||||
|
||||
func IsChineseChar(str string) bool {
|
||||
|
||||
for _, r := range str {
|
||||
if unicode.Is(unicode.Han, r) || (regexp.MustCompile("[\u3002\uff1b\uff0c\uff1a\u201c\u201d\uff08\uff09\u3001\uff1f\u300a\u300b]").MatchString(string(r))) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user