mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 07:04:50 -06:00
82 lines
3.1 KiB
Handlebars
82 lines
3.1 KiB
Handlebars
<!DOCTYPE html>
|
|
<html lang="pt-br">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
|
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" 'unsafe-inline' crossorigin="anonymous">
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
|
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
|
crossorigin="anonymous"></script>
|
|
<link rel="shortcut icon" href="/images/atendai-logo.png" type="image/x-icon">
|
|
<style>
|
|
code {
|
|
padding: 10px;
|
|
background-color: whitesmoke;
|
|
color: rgb(104, 104, 104);
|
|
}
|
|
</style>
|
|
<title>Generate QRCode</title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="root" class="container mt-5 mb-5 w-50">
|
|
|
|
<div id="display-qrcode">
|
|
<h2 class="mb-3 text-secondary">Connect to whatsapp</h2>
|
|
<div class="input-group mb-3">
|
|
<input id="input-auth" type="text" class="form-control" aria-describedby="btn-qr-g" value="" placeholder="{{type}}">
|
|
<input id="input-session" type="text" class="form-control" aria-describedby="btn-qr-g" disabled
|
|
value="{{instanceName}}">
|
|
<button id="gen-qrcode" class="btn btn-info text-light" type="submit">Generate qrcode</button>
|
|
</div>
|
|
<div id="qrcode-img"></div>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
</div>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
|
|
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
<script type="module">
|
|
|
|
const log = (...data) => console.log(data);
|
|
|
|
$('#gen-qrcode').click(() => {
|
|
|
|
const keyAuth = '{{type}}' === 'jwt'? 'authorization': 'apikey';
|
|
const valueAuth = '{{type}}' === 'jwt'? `Bearer ${$('#input-auth').val()}`: $('#input-auth').val()
|
|
|
|
$.ajax({
|
|
url: `/instance/connect/{{instanceName}}`,
|
|
headers: { [keyAuth]: valueAuth },
|
|
type: 'GET',
|
|
success: (qrcode, status) => {
|
|
$(`#update-qrcode`).remove();
|
|
$('#qrcode-img')
|
|
.append(
|
|
`<div id="update-qrcode" class="card mb-2">
|
|
<h5 class="card-title text-center text-secondary mt-3">{{name}}</h5>
|
|
<div class="card-body container d-flex justify-content-center">
|
|
<img class="img-thumbnail mt-2 w-50" alt="qrcode.png"
|
|
src="${qrcode.base64}">
|
|
</div>
|
|
<div class="card-body">
|
|
<code class="text-card d-block">${JSON.stringify({ code: qrcode.code })}</code>
|
|
</div>
|
|
</div>`
|
|
);
|
|
return;
|
|
},
|
|
error: (error) => console.log(error),
|
|
});
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |