From: Michael Tremer Date: Tue, 10 Oct 2023 17:23:07 +0000 (+0000) Subject: location: Update layout to Bulma X-Git-Url: http://git.ipfire.org/?p=ipfire.org.git;a=commitdiff_plain;h=079929791e351130a054fcb797c69b5f149ad457 location: Update layout to Bulma Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 360d5242..ea3350be 100644 --- a/Makefile.am +++ b/Makefile.am @@ -249,7 +249,6 @@ templates_fireinfo_modulesdir = $(templates_fireinfodir)/modules templates_location_DATA = \ src/templates/location/base.html \ - src/templates/location/blacklists.html \ src/templates/location/download.html \ src/templates/location/how-to-use.html \ src/templates/location/index.html \ diff --git a/src/sass/main.sass b/src/sass/main.sass index 6eeedaa3..43fe50e2 100644 --- a/src/sass/main.sass +++ b/src/sass/main.sass @@ -87,3 +87,8 @@ html, body .wrap-text height: max-content; white-space: inherit; + +.map + width: 100%; + height: 100%; + min-height: 24rem; diff --git a/src/templates/location/blacklists.html b/src/templates/location/blacklists.html deleted file mode 100644 index fb3421af..00000000 --- a/src/templates/location/blacklists.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Blacklist Status of %s") % address }}{% end block %} - -{% block main %} -
-
-
{{ _("Blacklists") }}
-
- -
    - {% for bl in sorted(blacklists) %} - {% if blacklists[bl] %} - {% set code, reason = blacklists[bl] %} - -
  • -

    {{ bl }}

    - - {% if reason %} - {{ reason }} - {% end %} -
  • - {% end %} - {% end %} -
-
-{% end block %} diff --git a/src/templates/location/download.html b/src/templates/location/download.html index 448a9354..25b10f9d 100644 --- a/src/templates/location/download.html +++ b/src/templates/location/download.html @@ -3,108 +3,152 @@ {% block title %}{{ _("Download") }}{% end block %} {% block container %} -
-
-
-
-

{{ _("Download") }}

- -

- Learn how to download and install libloc -

-
+
+
+
+ + +

{{ _("Download IPFire Location") }}

+
+ Learn how to download and install libloc +
-
-
-
-
- -
- -
-

{{ _("Source") }}

- -

- Build libloc, the software that powers IPFire Location - from source. -

- -
- - {{ _("Download Source") }} - +
+
+
+
+
+

{{ _("Source") }}

+ +
+

+ Build libloc, the software that powers IPFire Location + from source. +

+
+ + +
- - {{ _("Browse Source") }} - +
+
-
-
-

- We provide pre-compiled packages for various distributions to get you - started with libloc quicker -

- -
-
- {{ _( -
- -
-

{{ _("IPFire") }}

- +
+
+
+

- IPFire Location comes pre-installed with every IPFire system - and powers firewall rules based on source/destination country - as well as geographic reports. + We provide pre-compiled packages for various distributions to get you + started with libloc quicker

-
-
-
- {{ _( +
+
+

{{ _("IPFire") }}

+ +

+ IPFire Location comes pre-installed with every IPFire system + and powers firewall rules based on source/destination country + as well as geographic reports. +

+
+ +
+
+ {{ _( +
+
-
-

{{ _("Debian") }}

+
+
+

{{ _("Debian") }}

-

- The supported architectures are amd64, arm64, i386 and armhf. -

+

+ The supported architectures are amd64, arm64, i386 and armhf. +

+
- {% for release in ("buster", "bullseye", "sid") %} -

{{ _("Debian %s") % release }}

+
+
+ {{ _( +
+
+
+ + {% for release in ("buster", "bullseye", "sid") %} +

{{ _("Debian %s") % release }}

+

Create a new file /etc/apt/sources.list.d/location.list

+
-
deb     https://packages.ipfire.org/location {{ release }}/
+					
+
deb     https://packages.ipfire.org/location {{ release }}/
 deb-src https://packages.ipfire.org/location {{ release }}/
- {% end %} +
+ {% end %} +

All packages are cryptographically signed. To install the key, run this command:

+
-
curl https://packages.ipfire.org/79842AA7CDBA7AE3-pub.asc | apt-key add -
+
+
curl https://packages.ipfire.org/79842AA7CDBA7AE3-pub.asc | apt-key add -
+
+

Finally download the package lists and install libloc

- +
+ +
apt-get update
 apt-get install location
diff --git a/src/templates/location/how-to-use.html b/src/templates/location/how-to-use.html index 787053bd..07a5f8dc 100644 --- a/src/templates/location/how-to-use.html +++ b/src/templates/location/how-to-use.html @@ -3,120 +3,149 @@ {% block title %}{{ _("How To Use") }}{% end block %} {% block container %} -
-
-
-
-

{{ _("How To Use") }}

- -

- libloc is versatile, fast and easy to use - in any application. -

-
+
+
+
+ + +

{{ _("IPFire Location") }}

+
+ libloc is versatile, fast and easy to use + in any application. +
-
+
-
-
- {{ _( +
+
+

{{ _("Command Line") }}

+ +
+

+ libloc comes with a command line tool which + makes it easy to test the library or integrate it into + your shell scripts. + location(8) knows a couple of commands + to retrieve country or Autonomous System of an IP address + and can generate lists of networks to be imported into + other software. +

+ +

+ Although this is not the fastest way to lookup a large number + of IP addresses, location(8) is versatile + and very easy to use. +

+ + + {{ _("Man Page") }} + +
-
-

{{ _("Command Line") }}

- -

- libloc comes with a command line tool which - makes it easy to test the library or integrate it into - your shell scripts. - location(8) knows a couple of commands - to retrieve country or Autonomous System of an IP address - and can generate lists of networks to be imported into - other software. -

- -

- Although this is not the fastest way to lookup a large number - of IP addresses, location(8) is versatile - and very easy to use. -

- - - {{ _("Man Page") }} - +
+
+ {{ _( +
-
-
-
{{ _("Search for an Autonomous System by Name") }}
+
+
{{ _("Search for an Autonomous System by Name") }}
-
$ location search-as "Lightning Wire Labs"
+				
$ location search-as "Lightning Wire Labs"
 AS204867 (Lightning Wire Labs GmbH)
+
-
{{ _("Lookup an IP Address") }}
+
+
{{ _("Lookup an IP Address") }}
-
$ location lookup 81.3.27.38
+				
$ location lookup 81.3.27.38
 81.3.27.38 belongs to 81.3.27.0/24 which is a part of AS24679 (Hostway Deutschland GmbH)
-
-
+
-
-
- {{ _( +
+
+
+ {{ _( +
-
-

{{ _("Python") }}

- -

- libloc comes with native Python bindings which - are used by its main command-line tool - - location - . - They are the most advanced bindings as they support reading - from the database as well as writing to it. -

+
+

{{ _("Python") }}

+ +
+

+ libloc comes with native Python bindings which + are used by its main command-line tool + + location + . + They are the most advanced bindings as they support reading + from the database as well as writing to it. +

+
-
-
-
{{ _("Load the database") }}
+
+
{{ _("Load the database") }}
-
Python 3.7.3 (default, Apr  3 2019, 05:39:12)
+				
Python 3.7.3 (default, Apr  3 2019, 05:39:12)
 [GCC 8.3.0] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import location
 >>> d = location.Database("/usr/share/location/database.db")
+
-
{{ _("Search for an Autonomous System by Name") }}
+
+
{{ _("Search for an Autonomous System by Name") }}
-
>>> for i in d.search_as("Lightning Wire Labs"):
+				
>>> for i in d.search_as("Lightning Wire Labs"):
 ...   print(i)
 ...
 AS204867 (Lightning Wire Labs GmbH)
+
-
{{ _("Lookup an IP Address") }}
+
+
{{ _("Lookup an IP Address") }}
-
>>> n = d.lookup("81.3.27.38")
+				
>>> n = d.lookup("81.3.27.38")
 >>> n
 <location.Network 81.3.27.0/24>
 >>> n.asn
 24679
 >>> n.country_code
 'DE'
-
diff --git a/src/templates/location/index.html b/src/templates/location/index.html index dd4ea4db..7db22887 100644 --- a/src/templates/location/index.html +++ b/src/templates/location/index.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "../base.html" %} {% block head %} @@ -7,71 +7,97 @@ {% block title %}{{ _("Welcome to IPFire Location") }}{% end block %} {% block container %} -
-
-

{{ _("Welcome to IPFire Location") }}

+
+
+
+ + +

{{ _("IPFire Location") }}

+
+ {{ _("A powerful, free IP address location database") }} +
+
+
+
-

- {% if address.country_code %} + {% if address.country_code %} +

+
+

{{ _("We have detected you visiting us from %s.") % format_country_name(address.country_code) }} - {% else %} - {{ _("Unfortunately we do not know where you are visiting us from.") }} - {% end %} + {{ _("Learn More") }} +

+
+
+ {% end %} - {{ _("Learn More") }} -

-
-
+
+
+
+

+ IPFire_ Location is being used in + firewalls or other threat detection software, load-balancers, online shops, + websites, analytics & reporting tools and more to detect the + originating country by IP address. + We are proud that our software is faster than others + by maintaining a smaller memory footprint which puts it + first in performance. +

+
+ +
+

+ Our daily updated database does not only have information + about the originating country of all IPv6 and IPv4 addresses. + It identifies the Autonomous System (AS) these IP + addresses belong to, as well and more... + libloc is the C/C++ library that fires our + location services and runs on *nix, Mac OS X and more. + Integration into existing software is very easy and + bindings for languages like Python and Perl are available. +

+
+ +
+ + {{ _("How To Use") }} + -
-
-

{{ _("What is IPFire Location?") }}

- -

- IPFire Location can be used in firewalls or other threat - detection software, load-balancers, online shops, websites, - analytics & reporting tools and more to detect the - originating country by IP address. - We are proud that our software is faster than others - by maintaining a smaller memory footprint which puts it - first in performance. -

- -

- Our daily updated database does not only have information - about the originating country of all IPv6 and IPv4 addresses. - It identifies the Autonomous System (AS) these IP - addresses belong to, as well and more... -

- -

- libloc is the C/C++ library that fires our - location services and runs on *nix, Mac OS X and more. - Integration into existing software is very easy and - bindings for languages like Python and Perl are available. -

- -
-
-
-
-
-
-
-
- +
+
+
+
+
+
+
+
-
-
{{ _("Threat Detection") }}
+
+

{{ _("Threat Detection") }}

{{ _("Location information is crucial to identify where an attacker is coming from.") }} @@ -80,42 +106,48 @@

+
-
-
- +
+
+
+
-
-
{{ _("Load-Balancing") }}
+
+

{{ _("Load-Balancing") }}

{{ _("Redirect your users to the nearest data center to given them a better user experience with faster websites and faster downloads.") }}

+
-
-
- +
+
+
+
-
-
{{ _("Online Visitors") }}
+
+

{{ _("Online Visitors") }}

{{ _("Comply with legal requirements and show visitors the correct information depending on the country they are visiting from.") }}

+
-
-
- +
+
+
+
-
-
{{ _("Open Source") }}
+
+

{{ _("Open Source") }}

{{ _("libloc is free software and relies on support from the community.") }} @@ -129,29 +161,29 @@

-
-
-

{{ _("Who Is Using IPFire Location?") }}

- -
-
- {{ _( - -
- IPFire -
-
- -
- {{ _( +
+
+
+

{{ _("Who Is Using IPFire Location?") }}

+ +
+ -
- The Tor Project -
+
-
-
+
+
{% end block %} diff --git a/src/templates/location/lookup.html b/src/templates/location/lookup.html index 71e44933..1e49e4fc 100644 --- a/src/templates/location/lookup.html +++ b/src/templates/location/lookup.html @@ -1,51 +1,125 @@ -{% extends "base.html" %} +{% extends "../base.html" %} {% block title %}{{ _("Location of %s") % address }}{% end block %} -{% block main %} -
- {% if address.country_code %} -
- {% module Map(address.country_code) %} +{% block container %} +
+
+ - {% end %} - -
-
-
{{ _("Network") }}
-
{{ address.network }}
- -
{{ _("Announced by") }}
-
{{ address.autonomous_system or ("AS%s" % address.asn if address.asn else _("N/A")) }}
- - {% if address.country_code %} -
{{ _("Country") }}
-
- {{ format_country_name(address.country_code) }} -
- {% end %} - -
-
- - {{ _("Anonymous Proxy") }} - - - - {{ _("Satellite Provider") }} - - - - {{ _("Anycast") }} - -
-
- - +
+ +
+
+
+
+
+

{{ _("Network") }}

+

{{ address.network }}

+
+ +
+

{{ _("Autonomous System") }}

+

+ {{ address.autonomous_system or ("AS%s" % address.asn if address.asn else _("N/A")) }} +

+
+ + {% if address.country_code %} +
+

{{ _("Country") }}

+

+ {{ format_country_name(address.country_code) }} +

+
+ {% end %} + +
+ {% if address.is_anonymous_proxy() %} + + {{ _("Anonymous Proxy") }} + + {% end %} + + {% if address.is_satellite_provider() %} + + {{ _("Satellite Provider") }} + + {% end %} + + {% if address.is_anycast() %} + + {{ _("Anycast") }} + + {% end %} +
+
+ +
+ {% if address.country_code %} +
+ {% module Map(address.country_code) %} +
+ {% end %} +
+ + {% if blacklists %} + + {% end %}
-
+
{% end block %} diff --git a/src/web/__init__.py b/src/web/__init__.py index b710bcc2..39ef3e0f 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -170,7 +170,6 @@ class Application(tornado.web.Application): (r"/projects/location", location.IndexHandler), (r"/projects/location/download", StaticHandler, { "template" : "../location/download.html" }), (r"/projects/location/how\-to\-use", StaticHandler, { "template" : "../location/how-to-use.html" }), - (r"/projects/location/lookup/(.+)/blacklists", location.BlacklistsHandler), (r"/projects/location/lookup/(.+)", location.LookupHandler), # Single-Sign-On for Discourse diff --git a/src/web/location.py b/src/web/location.py index 98cb30a7..de7a9cce 100644 --- a/src/web/location.py +++ b/src/web/location.py @@ -14,14 +14,6 @@ class IndexHandler(base.BaseHandler): class LookupHandler(base.BaseHandler): - async def get(self, address): - # Lookup address - address = util.Address(self.backend, address) - - self.render("location/lookup.html", address=address) - - -class BlacklistsHandler(base.BaseHandler): async def get(self, address): # Lookup address address = util.Address(self.backend, address) @@ -29,5 +21,4 @@ class BlacklistsHandler(base.BaseHandler): # Lookup blacklists blacklists = await address.get_blacklists() - self.render("location/blacklists.html", - address=address, blacklists=blacklists) + self.render("location/lookup.html", address=address, blacklists=blacklists)