allow only a-zA-Z for keyboard layout
This commit is contained in:
parent
e6c7dd0122
commit
fcca903ae9
@ -13,6 +13,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
"unsafe"
|
||||
"regexp"
|
||||
|
||||
"n.eko.moe/neko/internal/types"
|
||||
)
|
||||
@ -214,6 +215,10 @@ func SetKeyboard(layout string) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
if !regexp.MustCompile(`^[a-zA-Z]+$`).MatchString(layout) {
|
||||
return
|
||||
}
|
||||
|
||||
layoutUnsafe := C.CString(layout)
|
||||
defer C.free(unsafe.Pointer(layoutUnsafe))
|
||||
|
||||
|
Reference in New Issue
Block a user