Compare commits

...

2 Commits

Author SHA1 Message Date
Nico Schottelius 32ac399c7f Reduce re.match to official name only 2019-02-05 15:11:00 +01:00
Nico Schottelius 243e10d809 Update picture, update documentation 2019-02-05 15:10:21 +01:00
3 changed files with 9 additions and 5 deletions

View File

@ -53,15 +53,16 @@
{% if domain != "" %}
The site you tried to access is not reachable by IPv4.
To access <a href="{{ back_to_url }}" target="_blank">{{ domain }}</a>
{% else %}this part of the Internet{% endif %}, you need to enable
IPv6 on your computer.
{% else %}this part of the Internet{% endif %},
you need to enable IPv6 on your computer.
<br>
Find
out
<a href="https://ungleich.ch/en-us/cms/blog/2019/02/05/how-to-get-ipv6/">
how to enable IPv6</a>
or
<a href="https://redmine.ungleich.ch/projects/open-infrastructure/wiki/How_to_disable_IPv4_on_your_website">How
to use this service for your IPv6 only service.</a>
<a href="https://redmine.ungleich.ch/projects/open-infrastructure/wiki/How_to_disable_IPv4_on_your_website">how
to use this service</a> for your IPv6 only service.
</p>
</div>
<footer class="center">

View File

@ -2,6 +2,7 @@ from urllib.parse import urlsplit
from django.views.generic import TemplateView
import re
# Create your views here.
@ -16,7 +17,9 @@ class IndexView(TemplateView):
if "back_to" in self.request.GET:
back_to_url = self.request.GET["back_to"]
elif 'HTTP_HOST' in self.request.META:
back_to_url = "http://{}".format(self.request.META['HTTP_HOST'])
# Exclude ourselves
if not re.match("^no-ipv4-here.ungleich.ch", self.request.META['HTTP_HOST']):
back_to_url = "http://{}".format(self.request.META['HTTP_HOST'])
context['back_to_url'] = back_to_url
if back_to_url != "":
context['domain'] = (urlsplit(back_to_url)).netloc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 45 KiB