Update QR code generation with kjua

This commit is contained in:
JonnyWong16 2021-08-19 09:51:26 -07:00
parent 27cacb7a8f
commit fee25a6aea
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
3 changed files with 19 additions and 9 deletions

View file

@ -4508,3 +4508,8 @@ a.donate-with-crypto::after {
top: 0; top: 0;
left: 0; left: 0;
} }
#api_qr_code {
padding: 1px;
line-height: 1;
}

View file

@ -88,6 +88,16 @@ DOCUMENTATION :: END
$('#api_qr_https').toggle((protocol === 'http:')); $('#api_qr_https').toggle((protocol === 'http:'));
} }
function generateQRCode(url) {
$('#api_qr_code').empty().kjua({
text: url + '|' + $('#api_qr_token').val(),
render: 'canvas',
ecLevel: 'H',
size: 256,
fill: '#000'
});
}
var verifiedDevice = false; var verifiedDevice = false;
$('#register-mobile-device').click(function () { $('#register-mobile-device').click(function () {
verifiedDevice = false; verifiedDevice = false;
@ -98,9 +108,7 @@ DOCUMENTATION :: END
$.get('generate_api_key', { device: true }).then(function (token) { $.get('generate_api_key', { device: true }).then(function (token) {
$('#api_qr_address').val(url); $('#api_qr_address').val(url);
$('#api_qr_token').val(token); $('#api_qr_token').val(token);
$('#api_qr_code').empty().qrcode({ generateQRCode(url);
text: url + '|' + token
});
(function poll() { (function poll() {
setTimeout(function () { setTimeout(function () {
@ -135,10 +143,7 @@ DOCUMENTATION :: END
this.value = $.trim(this.value); this.value = $.trim(this.value);
var url = $(this).val(); var url = $(this).val();
checkQRAddress(url); checkQRAddress(url);
generateQRCode(url);
$('#api_qr_code').empty().qrcode({
text: url + '|' + $('#api_qr_token').val()
});
}); });
$('#api-qr-modal').on('hide.bs.modal', function () { $('#api-qr-modal').on('hide.bs.modal', function () {

View file

@ -2121,7 +2121,7 @@ Rating: {rating}/10 --> Rating: /10
<script src="${http_root}js/parsley.min.js"></script> <script src="${http_root}js/parsley.min.js"></script>
<script src="${http_root}js/Sortable.min.js"></script> <script src="${http_root}js/Sortable.min.js"></script>
<script src="${http_root}js/jquery.inputaffix.min.js"></script> <script src="${http_root}js/jquery.inputaffix.min.js"></script>
<script src="${http_root}js/jquery.qrcode.min.js"></script> <script src="${http_root}js/kjua.min.js"></script>
<script> <script>
function getConfigurationTable() { function getConfigurationTable() {
$.ajax({ $.ajax({