Change connection ID generation to exclude ambiguous characters

- Replace hex-based generation with a new random alphanumeric system
- Generated IDs exclude visually similar characters (e.g., 'o', '0', 'I', 'l')
This commit is contained in:
2025-11-08 11:09:20 +01:00
parent 85faa4ac90
commit b42fc95c61

View File

@@ -26,9 +26,14 @@ const client = new RondevuClient({
baseUrl: 'https://rondevu.xtrdev.workers.dev' baseUrl: 'https://rondevu.xtrdev.workers.dev'
}); });
// Generate a random 6-digit hex string // Generate a random 6-digit string
function generateConnectionId() { function generateConnectionId() {
return Math.floor(Math.random() * 0xFFFFFF).toString(16).padStart(6, '0').toUpperCase(); const chars = '23456789abcdefghjkmnopqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ';
let id = '';
for (let i = 0; i < 6; i++) {
id += chars.charAt(Math.floor(Math.random() * chars.length));
}
return id;
} }
function App() { function App() {