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