Added link generator. Added link to /stat/ json object
Some checks failed
Docker hub build / docker (push) Has been cancelled

This commit is contained in:
Ultradesu
2025-03-04 17:18:51 +00:00
parent 8f51b4cf9e
commit ca463fe5ab
3 changed files with 38 additions and 25 deletions

View File

@ -0,0 +1,20 @@
// static/admin/js/generate_uuid.js
function generateLink(button) {
let row = button.closest('tr');
let inputField = row.querySelector('input[name$="link"]');
if (inputField) {
inputField.value = generateRandomString(16);
}
}
function generateRandomString(length) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
}

View File

@ -1,21 +0,0 @@
// static/admin/js/generate_uuid.js
function generateUUID() {
let uuid = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const length = 10;
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
uuid += characters[randomIndex];
}
const hashField = document.getElementById('id_hash');
if (hashField) {
hashField.value = uuid;
}
}
document.addEventListener('DOMContentLoaded', function () {
generateUUID();
});