lib2chstat integration, refactoring

This commit is contained in:
fadedDexofan
2018-10-30 22:55:36 +10:00
parent bb57b8fab3
commit 387009b81e
39 changed files with 1192 additions and 22040 deletions

View File

@ -1,140 +1,114 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>libOpenAnal appliance</title>
</head>
<body>
<div class="container">
<h1>Hexor's conf_bot data extractor tool</h1>
<ul class="nav">
<li class="nav-item">
<a class="nav-link active" href="/">Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/conf">Conferences</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<hr>
<h4>{{ user_info.first_name }} user's data</h4>
<hr>
<div class="card-columns">
<div class="card">
<div class="card-body">
<h5 class="card-title">Identity</h5>
<hr>
<p class="card-text">
<b>First name: </b>{{ user_info.first_name }}<br>
<b>Last name: </b>{% if user_info.last_name != '_null' %}{{ user_info.last_name }}{% else %}<span class="badge badge-warning">N/D</span>{% endif %}<br>
<b>Username: </b>{% if user_info.username != '_null' %}{{ user_info.username }}{% else %}<span class="badge badge-warning">N/D</span>{% endif %}<br>
<b>Telegram ID: </b>{{user_info.id }}<br>
<b>Firstly seen: </b>{{user_info.first_date }}<br>
</p>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Activity</h5>
<hr>
<p class="card-text">
<b>First message: </b>{{user_info.first_date }}<br>
<b>Last message: </b>{{user_info.last_message }}<br>
<b>Days known: </b>{{user_info.day_known }}<br>
<b>Word said: </b>{{ user_info.word_count }}<br>
<b>Words per day: </b>{{'%0.2f'| format((user_info.word_count / user_info.day_known)|float)}}<br>
<b>Words per message: </b>~{{'%0.2f'| format(user_info.avg|float)}}<br>
</p>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Top</h5>
<hr>
<p class="card-text">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Word</th>
<th scope="col">Said</th>
</tr>
</thead>
<tbody>
{% for word in user_info.top %}
<tr>
<th scope="row">{{loop.index}}</th>
<td>{{word[0]}}</td>
{% if not loop.last %}
{% if (word[1]/loop.nextitem[1]) > 2 %}
<td><span class="badge badge-danger" data-toggle="tooltip" data-placement="right" title="Must have been abused">{{word[1]}} </span></td>
{% else %}
<td><span class="badge badge-secondary">{{word[1]}} </span></td>
{% endif %}
{% else %}
<td><span class="badge badge-secondary">{{word[1]}} </span></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</p>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Chats</h5>
<p class="card-text">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Chat</th>
<th scope="col">Words said</th>
</tr>
</thead>
<tbody>
{% for chat in user_info.chats %}
<tr>
<th scope="row">{{loop.index}}</th>
<td>{{chat[0]}}</td>
<td><span class="badge badge-secondary">{{chat[1]}} </span></td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
</div>
</div>
{% extends "base.html" %}
{% block head %}
{{ super() }}
{% endblock %}
{% block content %}
{{ super() }}
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link active" href="/">Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/conf">Conferences</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/stat">2ch.hk Stats</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<br>
<hr>
<h4>{{ user_info.first_name }} user's data</h4>
<hr>
<div class="card-columns">
<div class="card">
<div class="card-body">
<h5 class="card-title">Identity</h5>
<hr>
<p class="card-text">
<b>First name: </b>{{ user_info.first_name }}<br>
<b>Last name: </b>{% if user_info.last_name != '_null' %}{{ user_info.last_name }}{% else %}
<span class="badge badge-warning">N/D</span>{% endif %}<br>
<b>Username: </b>{% if user_info.username != '_null' %}{{ user_info.username }}{% else %}
<span class="badge badge-warning">N/D</span>{% endif %}<br>
<b>Telegram ID: </b>{{ user_info.id }}<br>
<b>Firstly seen: </b>{{ user_info.first_date }}<br>
</p>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Activity</h5>
<hr>
<p class="card-text">
<b>First message: </b>{{ user_info.first_date }}<br>
<b>Last message: </b>{{ user_info.last_message }}<br>
<b>Days known: </b>{{ user_info.day_known }}<br>
<b>Word said: </b>{{ user_info.word_count }}<br>
<b>Words per day: </b>{{ '%0.2f'| format((user_info.word_count / user_info.day_known)|float) }}<br>
<b>Words per message: </b>~{{ '%0.2f'| format(user_info.avg|float) }}<br>
</p>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Top</h5>
<hr>
<p class="card-text">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Word</th>
<th scope="col">Said</th>
</tr>
</thead>
<tbody>
{% for word in user_info.top %}
<tr>
<th scope="row">{{ loop.index }}</th>
<td>{{ word[0] }}</td>
{% if not loop.last %}
{% if (word[1]/loop.nextitem[1]) > 2 %}
<td><span class="badge badge-danger" data-toggle="tooltip" data-placement="right"
title="Must have been abused">{{ word[1] }} </span></td>
{% else %}
<td><span class="badge badge-secondary">{{ word[1] }} </span></td>
{% endif %}
{% else %}
<td><span class="badge badge-secondary">{{ word[1] }} </span></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</body>
</html>
<div class="card">
<div class="card-body">
<h5 class="card-title">Chats</h5>
<p class="card-text">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Chat</th>
<th scope="col">Words said</th>
</tr>
</thead>
<tbody>
{% for chat in user_info.chats %}
<tr>
<th scope="row">{{ loop.index }}</th>
<td>{{ chat[0] }}</td>
<td><span class="badge badge-secondary">{{ chat[1] }} </span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}