Change connection ID to 6-digit hex string

Generate random 6-digit hex IDs (e.g., A3F2C1) instead of
timestamp-based IDs (e.g., conn-1762596287521) for cleaner,
more user-friendly connection codes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-08 11:05:51 +01:00
parent 6a340b2677
commit 85faa4ac90

View File

@@ -26,6 +26,11 @@ const client = new RondevuClient({
baseUrl: 'https://rondevu.xtrdev.workers.dev'
});
// Generate a random 6-digit hex string
function generateConnectionId() {
return Math.floor(Math.random() * 0xFFFFFF).toString(16).padStart(6, '0').toUpperCase();
}
function App() {
// Step-based state
const [step, setStep] = useState(1); // 1: action, 2: method, 3: details, 4: connected
@@ -149,12 +154,12 @@ function App() {
if (action === 'create') {
if (method === 'connection-id') {
connId = connectionId || `conn-${Date.now()}`;
connId = connectionId || generateConnectionId();
connection = await rdv.create(connId, topic || 'default');
setCurrentConnectionId(connId);
log(`Created connection: ${connId}`, 'success');
} else {
connId = `conn-${Date.now()}`;
connId = generateConnectionId();
connection = await rdv.create(connId, topic);
setCurrentConnectionId(connId);
log(`Created connection: ${connId}`, 'success');