Skip to content

Commit 588e068

Browse files
Add random button
1 parent 7ad6f38 commit 588e068

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

static/dashboard.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,16 @@ function showMessage(message, type = 'info') {
313313
}, 5000);
314314
}
315315

316+
// Generate random alias
317+
function generateRandomAlias(length = 20) {
318+
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
319+
let result = '';
320+
for (let i = 0; i < length; i++) {
321+
result += chars.charAt(Math.floor(Math.random() * chars.length));
322+
}
323+
return result;
324+
}
325+
316326
// Initialize when DOM is ready
317327
document.addEventListener('DOMContentLoaded', function() {
318328
console.log('Dashboard JS loaded');
@@ -340,6 +350,15 @@ document.addEventListener('DOMContentLoaded', function() {
340350
} else {
341351
console.error('Create forwarder form not found');
342352
}
353+
354+
// Dice button for random alias
355+
const randomBtn = document.getElementById('randomAliasBtn');
356+
const aliasInput = document.getElementById('alias');
357+
if (randomBtn && aliasInput) {
358+
randomBtn.addEventListener('click', function() {
359+
aliasInput.value = generateRandomAlias();
360+
});
361+
}
343362
});
344363

345364
// Utility function to escape HTML (prevent XSS)

0 commit comments

Comments
 (0)