mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
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))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user