|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + |
| 4 | +<head> |
| 5 | + <title>AIL Framework</title> |
| 6 | + <link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}"> |
| 7 | + |
| 8 | + <!-- Core CSS --> |
| 9 | + <link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet"> |
| 10 | + <link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet"> |
| 11 | + |
| 12 | + <!-- JS --> |
| 13 | + <script src="{{ url_for('static', filename='js/jquery.js')}}"></script> |
| 14 | + <script src="{{ url_for('static', filename='js/helper.js')}}"></script> |
| 15 | + <script src="{{ url_for('static', filename='js/popper.min.js')}}"></script> |
| 16 | + <script src="{{ url_for('static', filename='js/bootstrap4.min.js')}}"></script> |
| 17 | + |
| 18 | + <style> |
| 19 | + .popover { |
| 20 | + max-width: none; |
| 21 | + width: 500px; |
| 22 | + } |
| 23 | + .icon-button { |
| 24 | + position: relative; |
| 25 | + display: inline-block; |
| 26 | + border: none; |
| 27 | + background: none; |
| 28 | + {#padding: 0;#} |
| 29 | + margin: 0; |
| 30 | + cursor: pointer; |
| 31 | + outline: inherit; |
| 32 | + transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; |
| 33 | + } |
| 34 | + |
| 35 | + .icon-wrapper { |
| 36 | + position: relative; |
| 37 | + display: inline-block; |
| 38 | + } |
| 39 | + |
| 40 | + .notification-badge { |
| 41 | + position: absolute; |
| 42 | + top: -10px; |
| 43 | + right: -10px; |
| 44 | + font-size: 14px; |
| 45 | + background: forestgreen; |
| 46 | + } |
| 47 | + </style> |
| 48 | + |
| 49 | +</head> |
| 50 | +<body> |
| 51 | + |
| 52 | + {% include 'nav_bar.html' %} |
| 53 | + |
| 54 | + <div class="container-fluid"> |
| 55 | + <div class="row"> |
| 56 | + |
| 57 | + {% include 'sidebars/sidebar_objects.html' %} |
| 58 | + |
| 59 | + <div class="col-12 col-lg-10" id="core_content"> |
| 60 | + |
| 61 | + <div class="row"> |
| 62 | + <div class="col-12 col-xl-6"> |
| 63 | + <div class="text-center mt-4"> |
| 64 | + <a class="btn btn-dark border-secondary" href="{{url_for('chats_explorer.chats_explorer_protocols')}}"> |
| 65 | + <div class="card-body"> |
| 66 | + <h2 class="card-title"> |
| 67 | + <i class="far fa-comments fa-2x "></i> |
| 68 | + <b>Chats Explorer</b> |
| 69 | + </h2> |
| 70 | + <i class="fab fa-discord fa-2x"></i> |
| 71 | + <i class="fab fa-telegram fa-2x"></i> |
| 72 | + <i class="fas fa-comment-dots fa-2x"></i> |
| 73 | + </div> |
| 74 | + </a> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + |
| 78 | + <div class="col-12 col-xl-6"> |
| 79 | + |
| 80 | + <h3 class="text-center mt-1 mb-4" id="current_date"></h3> |
| 81 | + |
| 82 | + <div class="row"> |
| 83 | + |
| 84 | + {% for obj_type in nb_objects %} |
| 85 | + <div class="col-sm-6 col-md-4 col-lg-3 text-center mb-4"> |
| 86 | + {% with type=obj_type, name=nb_objects[obj_type]['name'], icon=nb_objects[obj_type]['icon']['icon'], nb=nb_objects[obj_type]['nb'], url=nb_objects[obj_type]['link'] %} |
| 87 | + {% include 'objects/block_obj_button.html' %} |
| 88 | + {% endwith %} |
| 89 | + </div> |
| 90 | + {% endfor %} |
| 91 | + |
| 92 | + </div> |
| 93 | + |
| 94 | + </div> |
| 95 | + </div> |
| 96 | + |
| 97 | + </div> |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + </div> |
| 102 | + |
| 103 | +<script> |
| 104 | + $(document).ready(function(){ |
| 105 | + $("#page-Decoded").addClass("active"); |
| 106 | + updateDate(); |
| 107 | + }); |
| 108 | + |
| 109 | + var btn_selector = { |
| 110 | + {% for obj_type in nb_objects %} |
| 111 | + '{{ obj_type }}': $("#obj_btn_{{ obj_type }}"), |
| 112 | + {% endfor %} |
| 113 | + } |
| 114 | +</script> |
| 115 | + |
| 116 | +<script> |
| 117 | + |
| 118 | +function updateDate() { |
| 119 | + let d = new Date(); |
| 120 | + let day = d.getUTCDate(); |
| 121 | + if (day < 10) { |
| 122 | + day = "0" + day; |
| 123 | + } |
| 124 | + let month = d.getUTCMonth() + 1 |
| 125 | + if (month < 10) { |
| 126 | + month = "0" + month; |
| 127 | + } |
| 128 | + let current_date = d.getUTCFullYear() + ' - ' + month + ' - ' + day; |
| 129 | + $('#current_date').text(current_date) |
| 130 | +} |
| 131 | + |
| 132 | +function updateNbObjects(data) { |
| 133 | + for (const obj_type in data) { |
| 134 | + btn_selector[obj_type].text(data[obj_type]); |
| 135 | + } |
| 136 | +} |
| 137 | + |
| 138 | +// WebSocket |
| 139 | +var socket = new WebSocket("wss://" + window.location.host + "/ws/dashboard"); |
| 140 | +socket.wsocket = function(event) { |
| 141 | + console.log("WebSocket connection opened:", event); |
| 142 | +}; |
| 143 | +socket.onmessage = function(event) { |
| 144 | + $("[data-toggle='popover']").popover('destroy'); |
| 145 | + let data = JSON.parse(event.data); |
| 146 | + updateNbObjects(data['objs']); |
| 147 | + updateDate(); |
| 148 | +}; |
| 149 | +socket.onerror = function(error) { |
| 150 | + console.error('WebSocket error:', error); |
| 151 | +}; |
| 152 | +socket.onclose = function(event) { |
| 153 | + console.log('WebSocket connection closed:', event); |
| 154 | +}; |
| 155 | + |
| 156 | + |
| 157 | +</script> |
| 158 | + |
| 159 | +</body> |
| 160 | +</html> |
0 commit comments