MeuHTML


SUBMITTED BY: appcass

DATE: Sept. 13, 2023, 2:13 a.m.

UPDATED: Sept. 13, 2023, 8:02 p.m.

FORMAT: Text only

SIZE: 20.6 kB

HITS: 934

  1. <!DOCTYPE html>
  2. <html lang="pt-BR">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>RTunnel</title>
  8. <link rel="stylesheet" href="css.css">
  9. <style>
  10. * {
  11. margin: 0;
  12. padding: 0;
  13. box-sizing: border-box;
  14. font-family: 'Roboto', sans-serif;
  15. }
  16. body {
  17. height: 100vh;
  18. display: flex;
  19. flex-direction: column;
  20. align-items: center;
  21. justify-content: center;
  22. }
  23. .container {
  24. display: flex;
  25. flex-direction: column;
  26. align-items: center;
  27. justify-content: center;
  28. background-color: #0f0f0f6c;
  29. border-radius: 15px;
  30. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  31. padding: 8px;
  32. width: 370px;
  33. margin: 10px;
  34. }
  35. .container-logo {
  36. display: flex;
  37. flex-direction: column;
  38. align-items: center;
  39. justify-content: center;
  40. padding: 8px;
  41. width: 370px;
  42. margin-top: -90px;
  43. }
  44. .flag {
  45. display: flex;
  46. flex-direction: column;
  47. align-items: center;
  48. justify-content: center;
  49. padding: 8px;
  50. width: 35px;
  51. height: 35px;
  52. }
  53. .form {
  54. display: flex;
  55. flex-direction: column;
  56. align-items: center;
  57. margin: 10px;
  58. }
  59. .input {
  60. margin: 1px;
  61. width: 100%;
  62. }
  63. input,
  64. select {
  65. width: 100%;
  66. padding: 15px;
  67. margin-bottom: 1px;
  68. border-radius: 10px;
  69. border: 2px solid #1319ce1a;
  70. background-color: #0f0f0f6c;
  71. color: #cbbfdf;
  72. outline: none;
  73. }
  74. input::placeholder {
  75. color: #cbbfdf;
  76. }
  77. input:-webkit-autofill,
  78. input:-webkit-autofill:hover,
  79. input:-webkit-autofill:focus,
  80. input:-webkit-autofill:active {
  81. -webkit-box-shadow: 0 0 0 30px #0f0f0f inset !important;
  82. -webkit-text-fill-color: #cbbfdf !important;
  83. }
  84. #startOrStopButton {
  85. padding: 15px;
  86. width: 100%;
  87. border: 1px solid;
  88. margin-right: 5px;
  89. margin-top: 2px;
  90. border-radius: 10px;
  91. background-color: #0f0f0f96;
  92. color: #cbbfdf;
  93. font-size: 16px;
  94. cursor: pointer;
  95. transition: background-color 0.3s ease;
  96. }
  97. #updateButton {
  98. width: auto;
  99. padding: 15px;
  100. border: 1px solid;
  101. margin-top: 2px;
  102. border-radius: 10px;
  103. background-color: #0f0f0f96;
  104. color: #cbbfdf;
  105. cursor: pointer;
  106. transition: background-color 0.3s ease;
  107. }
  108. #startOrStopButton:hover,
  109. #updateButton:hover {
  110. background-color: #0f0f0f96;
  111. }
  112. #loggerButton {
  113. width: auto;
  114. padding: 15px;
  115. border: 1px solid;
  116. margin-top: 2px;
  117. border-radius: 10px;
  118. background-color: #0f0f0f96;
  119. color: #cbbfdf;
  120. cursor: pointer;
  121. transition: background-color 0.3s ease;
  122. }
  123. #configModalButton {
  124. padding: 15px;
  125. border: 1px solid;
  126. margin-top: 2px;
  127. border-radius: 10px;
  128. background-color: #0f0f0f96;
  129. color: #cbbfdf;
  130. }
  131. #logsClose {
  132. padding: 15px;
  133. border: 2px solid;
  134. margin-top: 2px;
  135. border-radius: 10px;
  136. background-color: #0f0f0f96;
  137. color: #cbbfdf;
  138. }
  139. #logsClean {
  140. padding: 15px;
  141. border: 2px solid;
  142. margin-top: 2px;
  143. border-radius: 10px;
  144. background-color: #0f0f0f96;
  145. color: #cbbfdf;
  146. }
  147. .state {
  148. margin-top: 10px;
  149. text-align: center;
  150. border: 2px solid;
  151. padding: 8px 16px;
  152. border-radius: 15px;
  153. color: #962430;
  154. font-weight: bold;
  155. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  156. }
  157. .modal-header {
  158. border: none;
  159. }
  160. .modal-content {
  161. background-color: #0f0f0fab;
  162. color: hsl(263, 33%, 81%);
  163. }
  164. .close-btn {
  165. color: #cbbfdf;
  166. background-color: #ffffff00;
  167. border: none;
  168. }
  169. .set-configs {
  170. background-color: #1d1d1db7;
  171. padding: 10px;
  172. margin-bottom: 5px;
  173. width: 100%;
  174. border-radius: 10px;
  175. }
  176. .set-configs span {
  177. color: #cbbfdf;
  178. font-size: large;
  179. }
  180. .set-configs img {
  181. margin-right: 5px;
  182. width: 40px;
  183. height: 40px;
  184. }
  185. #Operadora {
  186. color: white;
  187. }
  188. #Version {
  189. color: white;
  190. }
  191. </style>
  192. </head>
  193. <body>
  194. <div class="container-logo">
  195. <img id="logoImg" alt="logo" width="200" height="200">
  196. </div>
  197. <div id="Operadora"> Aqui</div>
  198. <div id="Version"> Aqui</div>
  199. <div class="form">
  200. <div class="container">
  201. <div class="input" id="config"></div>
  202. <input type="button" value="Selecione uma configuração" id="configModalButton" data-bs-toggle="modal" data-bs-target="#configModal">
  203. <div style="display: flex;">
  204. <input type="text" style="margin-right: 1px;" placeholder="Usuário" id="user" />
  205. <input type="text" style="margin-left: 1px;" placeholder="Senha" id="password" />
  206. </div>
  207. <div style="display: flex;">
  208. <button id="startOrStopButton" onclick="startOrStop()">INICIAR VPN</button>
  209. <button id="updateButton" onclick="app.searchUpdate()">
  210. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
  211. class="bi bi-arrow-repeat" viewBox="0 0 16 16">
  212. <path
  213. d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z" />
  214. <path fill-rule="evenodd"
  215. d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z" />
  216. </svg>
  217. </button>
  218. <button data-bs-toggle="modal"
  219. data-bs-target="#logs" id="loggerButton"
  220. style="margin-left: 3px;">
  221. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
  222. class="bi bi-file-earmark-text" viewBox="0 0 16 16">
  223. <path
  224. d="M5.5 7a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1h-5zM5 9.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5z" />
  225. <path
  226. d="M9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.5L9.5 0zm0 1v2A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z" />
  227. </svg>
  228. </button>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. <div class="container state" id="state">Você está desconectado !</div>
  234. <div class="modal fade" aria-hidden="true" id="configModal" tabindex="-1">
  235. <div class="modal-dialog modal-dialog-centered">
  236. <div class="modal-content">
  237. <div class="modal-header">
  238. <h5 class="modal-title" style="align-items: center;">Servidores: </h5>
  239. <button type="button" class="close-btn" data-bs-dismiss="modal" aria-label="Close">
  240. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor"
  241. class="bi bi-x-lg" viewBox="0 0 16 16">
  242. <path
  243. d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z" />
  244. </svg>
  245. </button>
  246. </div>
  247. <div class="modal-body">
  248. <div id="serverOptions"></div>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. <div class="modal fade" aria-hidden="true" id="checkuserModal" tabindex="-1">
  254. <div class="modal-dialog modal-dialog-centered">
  255. <div class="modal-content">
  256. <div class="modal-header">
  257. <h5 class="modal-title">Informações do usuario</h5>
  258. <button type="button" class="close-btn" data-bs-dismiss="modal" aria-label="Close">
  259. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor"
  260. class="bi bi-x-lg" viewBox="0 0 16 16">
  261. <path
  262. d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z" />
  263. </svg>
  264. </button>
  265. </div>
  266. <div class="modal-body">
  267. <div id="checkuser">Checkuser</div>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. <div class="modal fade" tabindex="-1" role="dialog" id="logs">
  273. <div class="modal-dialog modal-dialog-centered" role="document">
  274. <div class="modal-content rounded-3 shadow">
  275. <div class="modal-header border-bottom-0 pb-0">
  276. <h1 class="modal-title fs-5 text-white">LOGS</h1>
  277. </div>
  278. <div class="modal-body">
  279. <ul id="logList"></ul>
  280. </div>
  281. <div class="modal-footer flex-nowrap p-0">
  282. <button type="button" id="logsClean" onclick="app.clearLogs()" >LIMPAR</button>
  283. <button type="button" id="logsClose" data-bs-dismiss="modal">FECHAR</button>
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. <div class="modal fade" aria-hidden="true" id="checkuserModal" tabindex="-1">
  289. <div class="modal-dialog modal-dialog-centered">
  290. <div class="modal-content">
  291. <div class="modal-header">
  292. <h5 class="modal-title">Informações do usuario</h5>
  293. <button type="button" class="close-btn" data-bs-dismiss="modal" aria-label="Close">
  294. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor"
  295. class="bi bi-x-lg" viewBox="0 0 16 16">
  296. <path
  297. d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z" />
  298. </svg>
  299. </button>
  300. </div>
  301. <div class="modal-body">
  302. <div id="checkuser">Checkuser</div>
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. <script type="text/javascript" src="bootstrap.js"></script>
  308. <script>
  309. const logoImg = document.getElementById("logoImg");
  310. const configModalButton = document.getElementById("configModalButton");
  311. const user = document.getElementById("user");
  312. const pass = document.getElementById("password");
  313. const startOrStopButton = document.getElementById("startOrStopButton");
  314. const updateButton = document.getElementById("updateButton");
  315. const loggerButton = document.getElementById("loggerButton");
  316. const state = document.getElementById("state");
  317. const operadora = document.getElementById("Operadora");
  318. operadora.innerHTML = "Operadora: " + app.getOperadoraEmUso();
  319. // setTema();
  320. const version = document.getElementById("Version");
  321. version.innerHTML = "Versão da config: " + app.getVersion();
  322. function loadLogs() {
  323. var logList = document.getElementById("logList");
  324. var logs = JSON.parse(app.getlogs())
  325. var formattedLogs = '';
  326. logs.forEach(item => {
  327. 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);">';
  328. formattedLogs += item.TIME;
  329. formattedLogs += '</li>';
  330. });
  331. logList.innerHTML = '<ul class="list-group">' + formattedLogs + '</ul>';
  332. }
  333. var modal = new bootstrap.Modal(document.getElementById('configModal'));
  334. const serverOptions = document.getElementById('serverOptions');
  335. var servers = JSON.parse(app.getJsonServers());
  336. function createServerCard(server) {
  337. const card = document.createElement('div');
  338. card.classList.add('set-configs');
  339. card.style.backgroundColor = server.ConfigColor;
  340. var configImage = document.createElement('img');
  341. configImage.src = server.ConfigImage;
  342. const cardBody = document.createElement('div');
  343. cardBody.classList.add('card-body');
  344. const cardTitle = document.createElement('h5');
  345. cardTitle.classList.add('card-title');
  346. const configName = document.createElement('span');
  347. configName.textContent = server.ConfigName;
  348. cardTitle.appendChild(configImage);
  349. cardTitle.appendChild(configName);
  350. cardBody.appendChild(cardTitle);
  351. card.appendChild(cardBody);
  352. card.addEventListener('click', function () {
  353. selectServer(server);
  354. });
  355. return card;
  356. }
  357. function selectServer(server) {
  358. configModalButton.value = server.ConfigName;
  359. app.returnConfigId(server.ConfigId);
  360. localStorage.setItem('configSelecionada', JSON.stringify(server));
  361. modal.hide();
  362. }
  363. servers.forEach(function (server) {
  364. const card = createServerCard(server);
  365. serverOptions.appendChild(card);
  366. });
  367. function startOrStop() {
  368. if (user.value != "" && pass.value != "") {
  369. localStorage.setItem('usuario', user.value);
  370. localStorage.setItem('senha', pass.value);
  371. app.setUserAndPass(user.value, pass.value);
  372. }
  373. app.startOrStop();
  374. }
  375. var previousLogs = [];
  376. function checkAndLoadLogs() {
  377. var logs = JSON.parse(app.getlogs());
  378. if (!arraysAreEqual(logs, previousLogs)) {
  379. previousLogs = logs;
  380. loadLogs();
  381. }
  382. }
  383. function arraysAreEqual(arr1, arr2) {
  384. if (arr1.length !== arr2.length) {
  385. return false;
  386. }
  387. for (var i = 0; i < arr1.length; i++) {
  388. if (arr1[i].TIME !== arr2[i].TIME) {
  389. return false;
  390. }
  391. }
  392. return true;
  393. }
  394. async function startCheckuser() {
  395. try {
  396. const dataString = await app.getCheckuserDados();
  397. console.log("CHECKUSER: " + dataString);
  398. if (dataString !== "null") {
  399. const data = JSON.parse(dataString);
  400. var myModal = new bootstrap.Modal(document.getElementById('checkuserModal'));
  401. myModal.show();
  402. const strCheckValidade =
  403. `Usuario: <span style="color: green;">${data.username}</span><br/>
  404. Expira em: <span style="color: green;">${data.expiration_date}</span><br/>
  405. Dias Restantes: <span style="color: green;">${data.expiration_days}</span><br/>
  406. Conectados: <span style="color: green;">${data.count_connection} / ${data.limiter_user}</span>`;
  407. document.getElementById('checkuser').innerHTML = strCheckValidade;
  408. }
  409. } catch (error) {
  410. console.error("Erro ao buscar dados do usuário:", error);
  411. }
  412. }
  413. var previousState = null;
  414. function updateState() {
  415. var currentState = app.getState();
  416. if (currentState !== previousState) {
  417. if (currentState == "Conectado") {
  418. state.innerHTML = "<span style='color: green;'>"+ currentState +"</span>";
  419. startCheckuser();
  420. startOrStopButton.innerText = "Parar VPN"
  421. } else if (currentState == "Iniciando" || currentState == "Autenticando" || currentState == "Conectando") {
  422. state.innerHTML = "<span style='color: orange;'>" + currentState + "</span>";
  423. startOrStopButton.innerText = "Parar VPN"
  424. } else if (currentState == "Reconectando" || currentState == "Desconectado") {
  425. state.innerHTML = "<span style='color: red;'>" + currentState + "</span>";
  426. } else {
  427. state.innerHTML = "<span style='color: orange;'>" + currentState + "</span>";
  428. startOrStopButton.innerText = "Iniciar VPN"
  429. }
  430. previousState = currentState;
  431. }
  432. }
  433. setInterval(function() {
  434. updateState();
  435. checkAndLoadLogs();
  436. }, 0);
  437. logoImg.src = app.getLogoUrl();
  438. document.body.style.backgroundImage = `url('${app.getBackUrl()}')`;
  439. document.body.style.backgroundSize = 'cover';
  440. document.body.style.backgroundRepeat = 'no-repeat';
  441. document.body.style.backgroundPosition = 'center';
  442. document.addEventListener("DOMContentLoaded", function () {
  443. // Verificar se há usuário e senha salvos no localStorage
  444. const usuarioSalvo = localStorage.getItem('usuario');
  445. const senhaSalva = localStorage.getItem('senha');
  446. const configSalva = localStorage.getItem('configSelecionada');
  447. if (configSalva) {
  448. const configSelecionada = JSON.parse(configSalva);
  449. // Atualize a interface do usuário com a configuração salva
  450. configModalButton.value = configSelecionada.ConfigName;
  451. // Você pode fazer outras ações relacionadas à configuração aqui, se necessário
  452. }
  453. if (usuarioSalvo && senhaSalva) {
  454. // Preencher os campos de usuário e senha com os valores salvos
  455. user.value = usuarioSalvo;
  456. pass.value = senhaSalva;
  457. }
  458. });
  459. </script>
  460. </body>
  461. </html>

comments powered by Disqus