Use flag icons instead of emoji's
This commit is contained in:
parent
9cb030ecbd
commit
369f4d8d6b
1
Pipfile
1
Pipfile
@ -13,7 +13,6 @@ django-ipware = "~=2.1.0"
|
||||
pyyaml = "~=5.4"
|
||||
ua-parser = "~=0.10.0"
|
||||
user-agents = "~=2.1"
|
||||
emoji-country-flag = "~=1.2.1"
|
||||
rules = "~=2.2"
|
||||
gunicorn = "~=20.0.4"
|
||||
psycopg2-binary = "~=2.8.5"
|
||||
|
10
Pipfile.lock
generated
10
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "f8c76565a776f1bd36364077a86d6c16fccc522d9d2024bb9b51be5cb9f8b4b5"
|
||||
"sha256": "c51ea0205c9ffe753b9ef5249cd49c2338bb50768ae104113bfb7b97b5f9d70c"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {},
|
||||
@ -120,14 +120,6 @@
|
||||
"index": "pypi",
|
||||
"version": "==3.0.0"
|
||||
},
|
||||
"emoji-country-flag": {
|
||||
"hashes": [
|
||||
"sha256:338f5e374119dcde093cfeaa8ca3af372d4b8d984d89a7fb2fb0db0011662560",
|
||||
"sha256:a3a068191294294143d8ef294fdfe9792c5c243753eac130798bf2fa5de38185"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.2.4"
|
||||
},
|
||||
"geoip2": {
|
||||
"hashes": [
|
||||
"sha256:5869e987bc54c0d707264fec4710661332cc38d2dca5a7f9bb5362d0308e2ce0",
|
||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -26,6 +26,11 @@
|
||||
"svg.select.js": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"flag-icon-css": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/flag-icon-css/-/flag-icon-css-3.5.0.tgz",
|
||||
"integrity": "sha512-pgJnJLrtb0tcDgU1fzGaQXmR8h++nXvILJ+r5SmOXaaL/2pocunQo2a8TAXhjQnBpRLPtZ1KCz/TYpqeNuE2ew=="
|
||||
},
|
||||
"inter-ui": {
|
||||
"version": "3.15.0",
|
||||
"resolved": "https://registry.npmjs.org/inter-ui/-/inter-ui-3.15.0.tgz",
|
||||
|
@ -20,6 +20,7 @@
|
||||
"@fortawesome/fontawesome-free": "^5.15.1",
|
||||
"a17t": "^0.5.1",
|
||||
"apexcharts": "^3.24.0",
|
||||
"flag-icon-css": "^3.5.0",
|
||||
"inter-ui": "^3.15.0",
|
||||
"litepicker": "^1.5.7"
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
<script src="{% static 'litepicker/dist/js/main.js' %}"></script>
|
||||
<script src="{% static 'dashboard/js/base.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'dashboard/css/global.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'flag-icon-css/css/flag-icon.min.css' %}">
|
||||
{% block extra_head %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
@ -27,7 +27,7 @@
|
||||
<span class="text-gray-600">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{session.country|flag_emoji}} {{session.asn|default:"Unknown"}}</td>
|
||||
<td><span class="{{session.country|flag_class}}"></span>{{session.asn|default:"Unknown"}}</td>
|
||||
<td class="rf">{{session.duration|naturaldelta}}</td>
|
||||
<td class="rf">{{session.hit_set.count|intcomma}}</td>
|
||||
</tr>
|
||||
|
@ -144,7 +144,7 @@
|
||||
<tbody>
|
||||
{% for country in stats.countries %}
|
||||
<tr>
|
||||
<td>{{country.country|flag_emoji}} {{country.country|country_name}}</td>
|
||||
<td><span class="{{country.country|flag_class}}"></span></span>{{country.country|country_name}}</td>
|
||||
<td class="rf">{{country.count|intcomma}}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
|
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<p>Country</p>
|
||||
<p class="label">{{session.country|flag_emoji}} {{session.country|country_name}}</p>
|
||||
<p class="label"><span class="{{session.country|flag_class}}"></span>{{session.country|country_name}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>Location</p>
|
||||
|
@ -1,7 +1,6 @@
|
||||
from datetime import timedelta
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import flag
|
||||
import pycountry
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
@ -27,11 +26,11 @@ def naturaldelta(timedelta):
|
||||
|
||||
|
||||
@register.filter
|
||||
def flag_emoji(isocode):
|
||||
try:
|
||||
return flag.flag(isocode)
|
||||
except:
|
||||
return ""
|
||||
def flag_class(isocode):
|
||||
if isocode:
|
||||
return "mr-1 flag-icon flag-icon-" + isocode.lower()
|
||||
else:
|
||||
return "hidden"
|
||||
|
||||
|
||||
@register.filter
|
||||
|
@ -306,6 +306,7 @@ NPM_FILE_PATTERNS = {
|
||||
"stimulus": [os.path.join("dist", "stimulus.umd.js")],
|
||||
"inter-ui": [os.path.join("Inter (web)", "*")],
|
||||
"@fortawesome": [os.path.join("fontawesome-free", "js", "all.min.js")],
|
||||
"flag-icon-css": [os.path.join("css", "flag-icon.min.css"), os.path.join("flags", "*")],
|
||||
}
|
||||
|
||||
# Shynet
|
||||
|
Loading…
Reference in New Issue
Block a user