summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/web_kbn.py8
-rw-r--r--web/kbn_templates/sms.j28
2 files changed, 11 insertions, 5 deletions
diff --git a/bin/web_kbn.py b/bin/web_kbn.py
index 9e7b22a..e52ee50 100755
--- a/bin/web_kbn.py
+++ b/bin/web_kbn.py
@@ -341,7 +341,11 @@ async def sms(req: web.Request):
error = req.query.get('error', None)
sent = int(req.query.get('sent', 0)) == 1
- cl = get_modem_client(ModemsConfig()[modem])
+ input_modem = ModemsConfig()[modem]
+ if input_modem['type'] != 'e3372':
+ raise ValueError('invalid modem')
+
+ cl = get_modem_client(input_modem)
messages = cl.sms_list(1, 20, is_outbox)
return await render(req, 'sms',
title=lang('sms_page_title') % (lang('sms_outbox') if is_outbox else lang('sms_inbox'), modem),
@@ -365,7 +369,7 @@ async def sms_post(req: web.Request):
text = fd.get('text', None)
return_url = f'sms.cgi?id={modem}&outbox={int(is_outbox)}'
- phone = re.sub('\s+', '', phone)
+ phone = re.sub(r'\s+', '', phone)
if len(phone) > 4:
country = None
diff --git a/web/kbn_templates/sms.j2 b/web/kbn_templates/sms.j2
index 720a7bd..57fbfb9 100644
--- a/web/kbn_templates/sms.j2
+++ b/web/kbn_templates/sms.j2
@@ -6,9 +6,11 @@
<nav>
<div class="nav nav-tabs" id="nav-tab">
{% for modem in modems.keys() %}
- {% if selected_modem != modem %}<a href="sms.cgi?id={{ modem }}" class="text-decoration-none">{% endif %}
- <button class="nav-link{% if modem == selected_modem %} active{% endif %}" type="button">{{ (modem|lang('modems'))['short'] }}</button>
- {% if selected_modem != modem %}</a>{% endif %}
+ {% if modems[modem].type == 'e3372' %}
+ {% if selected_modem != modem %}<a href="sms.cgi?id={{ modem }}" class="text-decoration-none">{% endif %}
+ <button class="nav-link{% if modem == selected_modem %} active{% endif %}" type="button">{{ (modem|lang('modems'))['short'] }}</button>
+ {% if selected_modem != modem %}</a>{% endif %}
+ {% endif %}
{% endfor %}
</div>
</nav>