diff --git a/upribox_interface/lib/info.py b/upribox_interface/lib/info.py index f7d50792..11512e67 100644 --- a/upribox_interface/lib/info.py +++ b/upribox_interface/lib/info.py @@ -1,5 +1,6 @@ import subprocess import json +import os class HardwareInfo: @@ -65,6 +66,30 @@ def __str__(self): return '\n'.join((self.model, str(self.wifi_devices))) +class ModelInfo: + + MODEL_PATH = '/proc/device-tree/model' + + def __init__(self): + self.model = self.get_model_str() + + def get_model_str(self): + if not os.path.exists(self.MODEL_PATH): + return None + + with open(self.MODEL_PATH) as model_file: + model = model_file.read().strip() + return model + + def runs_on_pi3(self): + if not self.model: + return False + elif u'Pi 3' in self.model: + return True + else: + return False + + class UpdateStatus: ANSIBLE_PULL_LOG_FILE = '/var/tmp/log/ansible-pull.log' diff --git a/upribox_interface/wlan/locale/en/LC_MESSAGES/django.mo b/upribox_interface/wlan/locale/en/LC_MESSAGES/django.mo index 81ae33cf..c9662e19 100644 Binary files a/upribox_interface/wlan/locale/en/LC_MESSAGES/django.mo and b/upribox_interface/wlan/locale/en/LC_MESSAGES/django.mo differ diff --git a/upribox_interface/wlan/locale/en/LC_MESSAGES/django.po b/upribox_interface/wlan/locale/en/LC_MESSAGES/django.po index e6a351c4..236a5ee5 100644 --- a/upribox_interface/wlan/locale/en/LC_MESSAGES/django.po +++ b/upribox_interface/wlan/locale/en/LC_MESSAGES/django.po @@ -133,7 +133,7 @@ msgstr "" #: wlan/templates/ninja.html:39 msgid "Das Ninja WiFi kann auf dem Raspberry Pi 3 nicht aktiviert werden." -msgstr "The Ninja WiFi can not be aktived on the Raspberry Pi 3." +msgstr "The Ninja WiFi can not be activated on the Raspberry Pi 3." #: wlan/templates/ninja.html:54 wlan/templates/silent.html:18 msgid "Ein-/Ausschalten" diff --git a/upribox_interface/wlan/templates/ninja.html b/upribox_interface/wlan/templates/ninja.html index 89d9be71..64b969e2 100644 --- a/upribox_interface/wlan/templates/ninja.html +++ b/upribox_interface/wlan/templates/ninja.html @@ -16,34 +16,15 @@

{% trans "Ninja Modus" %}

Wir empfehlen die Nutzung des Tor-Browser-Bundle (Download für Windows, Mac OS oder Linux). Sollten Sie keine Möglichkeit haben, den Tor-Browser zu nutzen, können Sie als Alternative den Ninja Modus einschalten. Dieser gewährleistet aber nicht das volle Surferlebnis (etwa durch langsame Geschwindigkeit und Webseiten in fremder Sprache). {% endblocktrans %}

- - -
+ +
+ {% if pi3 %} + +

{% trans "Das Ninja WiFi kann auf dem Raspberry Pi 3 nicht aktiviert werden." %}

+ + {% else %} + + + {% endif %}
{% endblock %} diff --git a/upribox_interface/wlan/views.py b/upribox_interface/wlan/views.py index 48771dca..7684ef7e 100644 --- a/upribox_interface/wlan/views.py +++ b/upribox_interface/wlan/views.py @@ -10,7 +10,7 @@ from wlan import jobs as wlanjobs from django.core.urlresolvers import reverse from lib import utils -from lib.info import HardwareInfo +from lib.info import HardwareInfo, ModelInfo from django.http import HttpResponse # Get an instance of a logger @@ -36,9 +36,13 @@ def ninja(request): else: form = WlanForm(utils.get_fact('wlan','ninja','ssid')) + model_info = ModelInfo() + pi3 = model_info.runs_on_pi3() + context.push({ 'form': form, - 'messagestore': jobs.get_messages()}) + 'messagestore': jobs.get_messages(), + 'pi3': pi3}) return render_to_response("ninja.html", context)