feat: switch text to UTF-8; add Unicode key events, dead keys & Czech layout; fix numpad navigation; add NumLock support

This commit is contained in:
daniel committed 2026-10-03 10:11:49 +02:00
1 parent 32660ddd1a
commit 2aa6360b3d
101 files changed
+3733 -1639

No files matched your search

+22 -1
View File
@@ -9,6 +9,7 @@
#include <montauk/string.h>
#include <montauk/heap.h>
#include <montauk/config.h>
#include <montauk/utf8.h>
#include <bearssl_hash.h>
namespace montauk {
@@ -107,7 +108,7 @@ namespace user {
bytes_to_hex(hash, 32, out_hex64);
}
inline bool verify_password(const char* password, const char* salt_hex, const char* stored_hex64) {
inline bool verify_password_bytes(const char* password, const char* salt_hex, const char* stored_hex64) {
char computed[65];
hash_password(password, salt_hex, computed);
@@ -118,6 +119,26 @@ namespace user {
return diff == 0;
}
// Passwords are hashed as UTF-8. Before the switch to UTF-8, password
// fields stored typed characters as Windows-1252 bytes, so a non-ASCII
// password set back then only matches its 1252 form; try that too.
inline bool verify_password(const char* password, const char* salt_hex, const char* stored_hex64) {
if (verify_password_bytes(password, salt_hex, stored_hex64)) return true;
char legacy[256];
int o = 0;
bool non_ascii = false;
for (const char* p = password; *p;) {
uint32_t cp = montauk::utf8::next(&p);
uint8_t b = montauk::utf8::to_cp1252(cp);
if (b == 0 || o >= (int)sizeof(legacy) - 1) return false;
if (b >= 0x80) non_ascii = true;
legacy[o++] = (char)b;
}
legacy[o] = '\0';
return non_ascii && verify_password_bytes(legacy, salt_hex, stored_hex64);
}
// ---- User database I/O ----
inline int load_users(UserInfo* buf, int max) {