<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ADM ONLINE</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
#config-area{
border-radius: 100px;
}
.set-configs {
background-color: #101622;
padding: 10px;
margin-bottom: 5px;
width: 100%;
border-radius: 10px;
}
.set-configs span {
color: #101622;
font-size: large;
}
body,.app{
padding: relative;
height: 100vh;
background-color: #f5f5f5;
flex-direction: column;
justify-content: center;
align-items: center;
}
@media (min-width: 420px) {
body{
width: 360px;
margin: 0px ;
overflow: hidden;
flex-direction: column;
justify-content: center;
}
.container{
width: 360px;
}
}
@media (min-width: 380px) and (max-width: 320px) {
body, .app{
width:100vw;
height: 100vh;
margin: 0;
overflow: hidden;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container{
width: 100%;
}
}
@media (min-width: 380px) and (max-width: 360px) {
body, .app{
width:100vw;
height: 100vh;
margin: 0;
overflow: hidden;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container{
width: 100%;
}
}
.dados{
top: 78%;
background: none;
}
.barSuperior{
width: 100%;
height: 30%;
background-color: #7CDDD7;
display: flex;
position: relative;
justify-content: center;
border-end-end-radius: 28px;
border-end-start-radius: 28px;
z-index: 5;
}
.container{
width: 100% ;
height:40%;
display: flex;
flex-direction: column;
background: none;
justify-content: center;
align-items: center;
position: fixed;
gap: 10px;
top: 45%;
z-index: 2;
}
.selectItens, .Usarname, .Password{
position: relative;
top: -20%;
width: 100%;
height: 45px;
border: 2px solid #999;
border-radius: 7px;
display: flex;
justify-content: space-between;
align-items: center;
}
.ops {
border:2px solid #062931;
background: #101622;
width: 48%;
height: 70px;
display: flex;
justify-content: center;
align-items: center;
color: #ffffff;
text-align: center;
border-radius: 9px;
}
.fi-br-gears{
width: 30px;
height: 30px;
fill: #000;
margin-left: 10px;
}
.fi-rr-angle-double-small-down{
width: 30px;
height: 30px;
fill: #000;
margin-right: 10px;
}
.selectItens button{
width: 85%;
height: 100%;
background: none;
color: #666;
border: none;
text-align: left;
}
.viewItens{
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
display: none;
transition: 2s;
top: 0%;
position: fixed;
justify-content: center;
align-items: center;
z-index: 33;
}
.containerViewItens{
width: 90%;
height: 70%;
top: 20%;
background: #171D2B;
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.containerBarSuperior{
width: 100%;
height: 30%;
background-color: none;
display: flex;
justify-content: space-between;
align-items: center;
position: absolute;
top: 13%;
z-index: 6;
}
.containerBarSuperior .menu{
width: 35%;
height: 60%;
background-color: #4071F7;
border-radius: 10px;
margin-left: 5%;
}
.containerBarSuperior .Atualizar{
width: 14%;
height: 60%;
background-color: #fff;
border-radius: 12px;
}
.containerBarSuperior .Atualizar svg{
width: 60%;
height: 60%;
fill: #4071F7;
}
.containerBarSuperior .logs svg{
width: 60%;
height: 60%;
fill: #4071F7;
}
.containerBarSuperior .logs{
width: 14%;
height: 60%;
background-color: #fff;
border-radius: 12px;
margin-right: 5%;
}
.ip{
width: 60%;
height: 6%;
background-color: #fff;
border-radius: 12px;
display: flex;
left: 20%;
top: 69%;
justify-content: center;
align-items: center;
position: absolute;
z-index: 6;
}
#ipAddress{
color: blue;
font-size: 14px;
font-weight: 600;
}
.Start{
width: 170px;
height: 170px;
background-color: #ffffff;
border-radius: 50%;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
top: 18%;
left: calc(50% - 85px);
z-index: 12;
}
input{
background: none;
margin-left: -10px;
width: 90%;
height: 100%;
border: none;
outline: none;
}
input::placeholder{
text-align: left;
color: #444;
}
.containerStart{
width: 140px;
height: 140px;
display: flex;
background: linear-gradient(#0FC79E,#0D98ED);
border-radius: 50%;
position: relative;
justify-content: center;
align-items: center;
}
.containerStart span{
position: absolute;
bottom: 0;
top: 130%;
font-size: 14px;
color: #666666;
font-weight: 600;
}
.containerStart .start{
width: 75%;
height: 75%;
background-color: #fff;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.containerStart .start svg{
width: 60%;
height: 60%;
fill: #4071F7;
}
</style>
</head>
<body>
<div class="app">
<div class="barSuperior">
<div class="containerBarSuperior">
<div class="menu" type="button" style="display: flex;justify-content: center; align-items: center; color: #ffffff;">
<div style="position: relative;left: -10%; height: 70%; width: 30%;display: flex; flex-direction: column;align-items: center; justify-content: space-evenly; ">
<div style="position: relative;left:-5%; height: 2px;width: 60%; background-color: #ffffff; border-radius: 2px;"></div>
<div style="position: relative ;left:5%; height: 2px;width: 60%; background-color: #ffffff; border-radius: 2px;">
</div><div style=" position: relative;left: 10%; height: 2px;width: 60%; background-color: #ffffff; border-radius: 2px;"></div>
</div>
Menu</div>
<div class="Atualizar" onclick="app.searchUpdate()" style="display: flex;justify-content: center; align-items: center; color: #ffffff;"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="20" height="20">
<g>
<path d="M489.797,256c-10.791-0.141-19.924,7.939-21.099,18.667c-9.959,117.754-113.491,205.138-231.245,195.179 S32.315,356.354,42.275,238.6S155.766,33.462,273.52,43.421c50.983,4.312,98.733,26.75,134.592,63.245h-66.603 c-11.782,0-21.333,9.551-21.333,21.333s9.551,21.333,21.333,21.333h88.384c21.874-0.012,39.604-17.742,39.616-39.616V21.333 C469.509,9.551,459.958,0,448.176,0c-11.782,0-21.333,9.551-21.333,21.333v44.331C321.548-28.425,159.915-19.341,65.826,85.954 s-85.005,266.927,20.29,361.016s266.927,85.005,361.016-20.29c36.575-40.931,59.007-92.547,63.977-147.214 c1.096-11.814-7.593-22.279-19.407-23.375C491.069,256.033,490.434,256.002,489.797,256z"/>
</g></svg></div>
<div class="logs" style="display: flex;justify-content: center; align-items: center; color: #ffffff;" data-bs-toggle="modal"
data-bs-target="#logs" id="logger">
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" viewBox="0 0 24 24" data-name="Layer 1"><path d="m21 6.243a3.975 3.975 0 0 0 -1.172-2.829l-2.242-2.242a4.022 4.022 0 0 0 -2.828-1.172h-8.758a3 3 0 0 0 -3 3v21h18zm-2.586-1.415a1.923 1.923 0 0 1 .141.172h-2.555v-2.555a1.923 1.923 0 0 1 .172.141zm-13.414 17.172v-19a1 1 0 0 1 1-1h8v5h5v15zm3-13h8v2h-8zm0 4h8v2h-8zm6.018 3.814 1.965.366c-.191 1.047-1.005 2.82-2.848 2.82a3.154 3.154 0 0 1 -1.986-.706c-.314-.223-.424-.294-.662-.294a2.18 2.18 0 0 0 -.916.66l-1.5-1.317a3.749 3.749 0 0 1 2.416-1.343 2.925 2.925 0 0 1 1.821.664 1.235 1.235 0 0 0 .827.336c.623 0 .88-1.173.883-1.186z"/></svg>
</div>
</div>
</div>
<div class="modal fade show" tabindex="-1" role="dialog" id="ToolsModal" style="display: none;">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content rounded-3 shadow" style="height: 60%; background-color: #151D2D;">
<div class="modal-header border-bottom-0 pb-0">
<h1 class="modal-title fs-5 text-white">Configurações</h1>
<button style="color: #ffffff; font-size: 30px; background: none; border: none;" type="button" id="closeMenu" >x</button>
</div>
<hr style="background-color: #ffffff; height: 2px;">
<div class="modal-body">
<div style="left: 27.5%; position: relative;" class="ops btn-menu shadow" onclick="startCheckuser()" data-bs-dismiss="modal">Verificar usuario</div><br>
<div class="d-flex justify-content-between mb-2">
<div class="ops btn-menu shadow" onclick="app.openApn()">Abrir Apn</div>
<div class="ops btn-menu shadow" onclick="app.openWebView()">Abrir WebView</div>
</div>
<div class="d-flex justify-content-between mb-2">
<div class="ops btn-menu shadow" onclick="app.openHostShare()">Abrir Roteador</div>
<div class="ops btn-menu shadow" onclick="app.offlineUpdate()">Atualizar via arquivo</div>
</div>
<div class="d-flex justify-content-between mb-2">
<div class="ops btn-menu shadow" onclick="app.restartApp()">Reiniciar aplicativo</div>
</div>
</div>
</div>
</div>
</div>
<div class="ViewLogs">
<div class="modal fade" tabindex="-1" role="dialog" id="logs">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content rounded-3 shadow" style="background: #151D2D;">
<div class="modal-header border-bottom-0 pb-0">
<h1 class="modal-title fs-5 text-white">LOGS</h1>
</div>
<div class="modal-body">
<ul style="color: #ffffff;" id="logList"></ul>
</div>
<div class="modal-footer d-flex justify-content-between p-0">
<button type="button" class="buttonModalClose" style="border: 2px solid #062931; color:#fff; background: #101622; border-radius: 15px; width: 20%;" onclick="app.clearLogs()" >LIMPAR</button>
<button type="button" class="buttonModalClose"style="border: 2px solid #062931;background: #101622;color:#fff; border-radius: 15px; width: 20%;" data-bs-dismiss="modal">FECHAR</button>
</div>
</div>
</div>
</div>
</div>
<div class="Start" type="button" onclick="startOrStop();" id="startOrStopButton">
<div class="containerStart">
<div class="start" >
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px"id='svg' viewBox="0 0 512.292 512.292" style="enable-background:new 0 0 130.292 130.292;" xml:space="preserve" width="20" height="60">
<g>
<path d="M256.061,0L256.061,0c17.673,0,32,14.327,32,32v106.667c0,17.673-14.327,32-32,32l0,0c-17.673,0-32-14.327-32-32V32 C224.061,14.327,238.387,0,256.061,0z"/>
<path d="M330.727,105.387L330.727,105.387c-0.157,10.742,5.259,20.8,14.315,26.581c80.432,49.143,105.796,154.185,56.652,234.616 S247.51,472.38,167.078,423.237S61.282,269.052,110.426,188.62c14.042-22.982,33.324-42.315,56.269-56.418 c9.211-5.781,14.773-15.92,14.699-26.795l0,0c0.049-17.673-14.238-32.039-31.911-32.088c-6.07-0.017-12.02,1.693-17.155,4.931 C22.233,146.634-11.58,291.318,56.803,401.412s213.067,143.907,323.161,75.524s143.907-213.067,75.524-323.161 c-19.035-30.645-44.879-56.489-75.524-75.524c-14.997-9.461-34.824-4.973-44.285,10.024 C332.447,93.397,330.731,99.33,330.727,105.387z"/>
</g>
</svg>
</div>
<span style="top: 115%;">INSIRA SEU LOGIN</span>
</div>
</div>
const mock = '[{"sorter":6,"color":"#6D08041C","name":"CONFIG","id":1393,"items":[{"mode":"V2RAY - VLESS","sorter":4,"tlsVersion":"TLSv1.2","name":"CONFIG 01","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":11803,"status":"ACTIVE"},{"mode":"SSH_DIRECT","sorter":2,"tlsVersion":"TLSv1.2","name":"CONFIG 02","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":28627,"status":"ACTIVE"},{"mode":"OVPN_PROXY","sorter":23,"tlsVersion":"TLSv1.2","name":"CONFIG 03","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":30001,"status":"ACTIVE"}]},{"sorter":2,"color":"#6D08041C","name":"CONFIG 2","id":1846,"items":[{"mode":"SSH_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG 01","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":26295,"status":"ACTIVE"}]},{"sorter":4,"color":"#80000000","name":"CONFIG 3","id":3310,"items":[{"mode":"SSH_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG. TEST","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":29997,"status":"ACTIVE"},{"mode":"OVPN_PROXY","sorter":1,"tlsVersion":"TLSv1.2","name":"CONFIG. TEST 2","icon":"https://cdn-icons-png.flaticon.com/512/8187/8187143.png","id":29998,"status":"ACTIVE"}]}]'
const data = JSON.parse(window?.DtGetConfigs?.execute() || mock)
<div class="container">
<div class="selectItens">
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 24 24" width="20" height="20" style="margin: 10px;"><path d="M10.57,10.99c.23,.13,.48,.19,.73,.19,.53,0,1.04-.28,1.31-.77,.4-.72,.15-1.64-.58-2.04l-.64-.36c.07-.33,.1-.67,.1-1.02s-.04-.69-.1-1.02l.64-.36c.72-.4,.98-1.32,.58-2.04-.4-.72-1.32-.98-2.04-.58l-.65,.36c-.54-.51-1.2-.89-1.92-1.12v-.76c0-.83-.67-1.5-1.5-1.5s-1.5,.67-1.5,1.5v.76c-.72,.23-1.38,.61-1.92,1.12l-.65-.36c-.72-.4-1.64-.15-2.04,.58-.4,.72-.15,1.64,.58,2.04l.64,.36c-.07,.33-.1,.67-.1,1.02s.04,.69,.1,1.02l-.64,.36c-.72,.4-.98,1.32-.58,2.04,.27,.49,.79,.77,1.31,.77,.25,0,.5-.06,.73-.19l.65-.36c.54,.51,1.2,.89,1.92,1.12v.76c0,.83,.67,1.5,1.5,1.5s1.5-.67,1.5-1.5v-.76c.72-.23,1.38-.61,1.92-1.12l.65,.36Zm-4.07-1.99c-1.1,0-2-.9-2-2s.9-2,2-2,2,.9,2,2-.9,2-2,2Zm16.03,9.37l-.64-.36c.07-.33,.1-.67,.1-1.02s-.04-.69-.1-1.02l.64-.36c.72-.4,.98-1.32,.58-2.04-.4-.72-1.32-.98-2.04-.58l-.65,.36c-.54-.51-1.2-.89-1.92-1.12v-.76c0-.83-.67-1.5-1.5-1.5s-1.5,.67-1.5,1.5v.76c-.72,.23-1.38,.61-1.92,1.12l-.65-.36c-.72-.4-1.64-.15-2.04,.58-.4,.72-.15,1.64,.58,2.04l.64,.36c-.07,.33-.1,.67-.1,1.02s.04,.69,.1,1.02l-.64,.36c-.72,.4-.98,1.32-.58,2.04,.27,.49,.79,.77,1.31,.77,.25,0,.5-.06,.73-.19l.65-.36c.54,.51,1.2,.89,1.92,1.12v.76c0,.83,.67,1.5,1.5,1.5s1.5-.67,1.5-1.5v-.76c.72-.23,1.38-.61,1.92-1.12l.65,.36c.23,.13,.48,.19,.73,.19,.53,0,1.04-.28,1.31-.77,.4-.72,.15-1.64-.58-2.04Zm-5.53,.63c-1.1,0-2-.9-2-2s.9-2,2-2,2,.9,2,2-.9,2-2,2Z"/></svg>
<button style="margin-left: -15px; margin-top: 5px;" class="form-control btn-custom mb-2 config-button" value="Selecione um Servidor" id="configModalButton" data-bs-toggle="modal" data-bs-target="#configModal" >Escolha um servidor</button>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 24 24" width="20" height="20" style="margin: 5px;"><path d="M12,19c-1.049,0-2.036-.409-2.778-1.151l-3.925-3.875c-.393-.388-.397-1.021-.009-1.414,.387-.394,1.021-.396,1.414-.009l3.929,3.88c.737,.737,2.003,.733,2.731,.004l3.935-3.884c.392-.388,1.023-.385,1.414,.009,.388,.393,.384,1.026-.01,1.414l-3.93,3.88c-.736,.738-1.723,1.146-2.772,1.146Zm.706-5.327l5.999-5.964c.392-.389,.394-1.022,.004-1.414-.39-.393-1.022-.395-1.414-.004l-5.294,5.263L6.705,6.291c-.391-.389-1.024-.386-1.415,.004-.389,.392-.387,1.025,.004,1.415l6.001,5.964c.195,.194,.45,.291,.705,.291s.51-.097,.705-.291Z"/></svg>
</div>
<div class="Usarname">
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generator: Adobe Illustrator 25.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512; margin-left:10px ;position:relative" xml:space="preserve" width="20" height="20">
<g>
<circle cx="256" cy="128" r="128"/>
<path d="M256,298.667c-105.99,0.118-191.882,86.01-192,192C64,502.449,73.551,512,85.333,512h341.333 c11.782,0,21.333-9.551,21.333-21.333C447.882,384.677,361.99,298.784,256,298.667z"/>
</g>
</svg>
<input type="text" style="margin-left:5px;" id="username" placeholder="Nome de usuario">
</div>
<div class="Password">
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generator: Adobe Illustrator 25.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512; margin-left:10px ;position:relative" xml:space="preserve" width="20" height="20">
<g>
<path d="M405.333,179.712v-30.379C405.333,66.859,338.475,0,256,0S106.667,66.859,106.667,149.333v30.379 c-38.826,16.945-63.944,55.259-64,97.621v128C42.737,464.214,90.452,511.93,149.333,512h213.333 c58.881-0.07,106.596-47.786,106.667-106.667v-128C469.278,234.971,444.159,196.657,405.333,179.712z M277.333,362.667 c0,11.782-9.551,21.333-21.333,21.333c-11.782,0-21.333-9.551-21.333-21.333V320c0-11.782,9.551-21.333,21.333-21.333 c11.782,0,21.333,9.551,21.333,21.333V362.667z M362.667,170.667H149.333v-21.333c0-58.91,47.756-106.667,106.667-106.667 s106.667,47.756,106.667,106.667V170.667z"/>
</g>
</svg>
<input type="password" style="width: 68%; margin-left: -15px;" id="password" placeholder="Password"> <button style="border: none; background: none; margin: 10px;" id="mostrarSenha"><svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 24 24" width="25" height="25"><path d="M23.821,11.181v0C22.943,9.261,19.5,3,12,3S1.057,9.261.179,11.181a1.969,1.969,0,0,0,0,1.64C1.057,14.739,4.5,21,12,21s10.943-6.261,11.821-8.181A1.968,1.968,0,0,0,23.821,11.181ZM12,18a6,6,0,1,1,6-6A6.006,6.006,0,0,1,12,18Z"/><circle cx="12" cy="12" r="4"/></svg></button>
</div>
</div>
<div class="info">
<div class="status"></div>
<div class="ip" style="width:80%;left: 10%; padding: 10px; justify-content: space-between;">
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" width="30" height="30" style="margin: 10px;" data-name="Layer 1" viewBox="0 0 24 24">
<path d="m20,12h-1c0-3.859-3.14-7-7-7v-1c4.411,0,8,3.589,8,8Zm-5,0h1c0-2.206-1.794-4-4-4v1c1.654,0,3,1.346,3,3ZM12,0v1c6.065,0,11,4.935,11,11h1C24,5.383,18.617,0,12,0Zm-1.713,14.42l6.42,6.42-.354.354c-1.868,1.867-4.321,2.802-6.774,2.802s-4.906-.935-6.774-2.802c-3.735-3.735-3.735-9.812,0-13.548l.354-.354,6.42,6.42,2.067-2.067.707.707-2.067,2.067Zm4.996,6.411L3.169,8.718c-2.998,3.364-2.883,8.543.343,11.77,3.228,3.228,8.405,3.34,11.77.344Z"/>
</svg>
<span>REDE:</span> <span id="ipAddress" style="z-index: 100; width: 90%; height: 100%; display: flexbox;justify-content: center; font-size: 20px; align-items: center; text-align: left; position:relative;margin-left: 5px;"></span>
</div>
<div class="dados" style="margin:10px; position: fixed; width: 82%;left: 10%; font-size: 25px; font-family:system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; color :red;" >
<div style="height: 35px; margin-top: 15px; width: 60%; position: relative; left: 14%; display: flex; align-items: center; justify-content: center;" id="state">
</div>
</div>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script>
const senhaInput = document.getElementById("password");
const mostrarSenhaButton = document.getElementById("mostrarSenha");
mostrarSenhaButton.addEventListener("click", function () {
if (senhaInput.type === "password") {
senhaInput.type = "text";
} else {
senhaInput.type = "password";
}
});
function mostrarEnderecoIP() {
var ipAddress = window.app.getIPuser();
document.getElementById("ipAddress").textContent = ipAddress;
}
var intervalId = setInterval(mostrarEnderecoIP, 1000);
setTimeout(function() {
clearInterval(intervalId);
}, 5000);
// Também pode chamar a função uma vez quando a página é carregada inicialmente
window.onload = mostrarEnderecoIP;
const menu = document.querySelector('.menu');
menu.addEventListener('click', function () {
const modal = document.getElementById('ToolsModal');
modal.style.display = 'block';
});
const closeMenu = document.getElementById('closeMenu');
closeMenu.addEventListener('click', function () {
const modal = document.getElementById('ToolsModal');
modal.style.display = 'none';
});
const logoImg = document.getElementById("logoImg");
//const rodapeImg = document.getElementById("rodapeImg");
const configModalButton = document.getElementById("configModalButton");
const user = document.getElementById("username");
const pass = document.getElementById("password");
const startOrStopButton = document.getElementById("startOrStopButton");
const state = document.getElementById("state");
function loadLogs() {
var logList = document.getElementById("logList");
var logs = JSON.parse(app.getlogs())
var formattedLogs = '';
logs.forEach(item => {
formattedLogs += '<li class="list-group-item bg-transparent p-0 border-0 text-start ms-2 text-wrap" style="font-size: 12px; color: var(--text-color);">';
formattedLogs += item.TIME;
formattedLogs += '</li>';
});
logList.innerHTML = '<ul class="list-group">' + formattedLogs + '</ul>';
}
var modal = new bootstrap.Modal(document.getElementById('configModal'));
const serverOptions = document.getElementById('serverOptions');
var servers = JSON.parse(app.getJsonServers());
function createServerCard(server) {
const card = document.createElement('div');
card.classList.add('set-configs');
card.style.backgroundColor = "rgba(255,255,255,0.4)";
var configImage = document.createElement('img');
configImage.style.cssText = "width: 30px; height: 30px; margin-right: 10px; border-radius: 50%;";
configImage.src = server.ConfigImage;
const cardBody = document.createElement('div');
cardBody.classList.add('card-body');
const cardTitle = document.createElement('h5');
cardTitle.classList.add('card-title');
const configName = document.createElement('span');
configName.textContent = server.ConfigName;
cardTitle.appendChild(configImage);
cardTitle.appendChild(configName);configModalButton
cardBody.appendChild(cardTitle);
card.appendChild(cardBody);
card.addEventListener('click', function () {
selectServer(server);
});
return card;
}
function selectServer(server) {
configModalButton.value = server.ConfigName;
const configButton = document.getElementById("");
app.returnConfigId(server.ConfigId);
// Define o valor do elemento operadoraatx
const operadoraatxElement = document.getElementById("configModalButton");
operadoraatxElement.style.color = "#000000";
operadoraatxElement.textContent = server.ConfigName;
// Armazena o objeto server no localStorage
localStorage.setItem('configSelecionada', JSON.stringify(server));
modal.hide();
}
servers.forEach(function (server) {
const card = createServerCard(server);
serverOptions.appendChild(card);
});
function startOrStop() {
if (user.value != "" && pass.value != "") {
localStorage.setItem('usuario', user.value);
localStorage.setItem('senha', pass.value);
app.setUserAndPass(user.value, pass.value);
}
app.startOrStop();
}
var previousLogs = [];
function checkAndLoadLogs() {
var logs = JSON.parse(app.getlogs());
if (!arraysAreEqual(logs, previousLogs)) {
previousLogs = logs;
loadLogs();
}
}
function arraysAreEqual(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
for (var i = 0; i < arr1.length; i++) {
if (arr1[i].TIME !== arr2[i].TIME) {
return false;
}
}
return true;
}
async function startCheckuser() {
try {
const dataString = await app.getCheckuserDados();
console.log("CHECKUSER: " + dataString);
if (dataString !== "null") {
const data = JSON.parse(dataString);
var myModal = new bootstrap.Modal(document.getElementById('checkuserModal'));
myModal.show();
const strCheckValidade =
`<span style="color: white;">Usuario: </span> <span style="color: green;">${data.username}</span><br/>
<span style="color: white;">Expira em: </span><span style="color: green;">${data.expiration_date}</span><br/>
<span style="color: white;">Dias Restantes: </span><span style="color: green;">${data.expiration_days}</span><br/>
<span style="color: white;">Conectados: </span><span style="color: green;">${data.count_connection} / ${data.limiter_user}</span>`;
document.getElementById('checkuser').innerHTML = strCheckValidade;
}
} catch (error) {
console.error("Erro ao buscar dados do usuário:", error);
}
}
var previousState = null;
const start = document.querySelector('#svg');
function updateState() {
var currentState = app.getState();
if (currentState !== previousState) {
if (currentState == "Conectado") {
state.innerHTML = "<span style='color: green;'>"+ currentState +"</span>";
startCheckuser();
start.style.fill = "#01FF2A";
} else if (currentState == "Iniciando" || currentState == "Autenticando" || currentState == "Conectando") {
state.innerHTML = "<span style='color: orange;'>" + currentState + "</span>";
start.style.fill = "#FFB801";
} else if (currentState == "Reconectando" || currentState == "Desconectado") {
state.innerHTML = "<span style='color: red;'>" + currentState + "</span>";
} else {
state.innerHTML = "<span style='color: orange;'>" + currentState + "</span>";
start.style.fill = "#4071F7";
}
previousState = currentState;
}
}
setInterval(function() {
updateState();
checkAndLoadLogs();
}, 0);
document.addEventListener("DOMContentLoaded", function () {
// Verificar se há usuário e senha salvos no localStorage
const usuarioSalvo = localStorage.getItem('usuario');
const senhaSalva = localStorage.getItem('senha');
const configSalva = localStorage.getItem('configSelecionada');
if (configSalva) {
const configSelecionada = JSON.parse(configSalva);
// Atualize a interface do usuário com a configuração salva
configModalButton.value = configSelecionada.ConfigName;
// Você pode fazer outras ações relacionadas à configuração aqui, se necessário
}
if (usuarioSalvo && senhaSalva) {
// Preencher os campos de usuário e senha com os valores salvos
user.value = usuarioSalvo;
pass.value = senhaSalva;
}
});
logoImg.src = app.getLogoUrl();
document.body.style.backgroundImage = `url('${app.getBackUrl()}')`;
document.body.style.backgroundSize = 'cover';
document.body.style.backgroundRepeat = 'no-repeat';
document.body.style.backgroundPosition = 'center';
const selectItens = document.querySelector('.selectItens');
const viewItens = document.querySelector('.viewItens');
selectItens.addEventListener('click',()=>{
viewItens.style.display = 'flex';
})
viewItens.addEventListener('click',()=>{
viewItens.style.display = 'none';
})
</script>
</html>