Skip to content

Commit

Permalink
added routes
Browse files Browse the repository at this point in the history
added usersuites routes for getting and changing the port forwardings
  • Loading branch information
agmes4 committed Sep 7, 2023
1 parent c27c84c commit abcb5f5
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sipa/blueprints/usersuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,3 +613,19 @@ def reset_wifi_password():
return render_template('generic_form.html',
page_title=gettext("Neues WLAN Passwort"),
form_args=form_args)

@bp_usersuite.route("/show-port-forwardings", methods=['GET', 'POST'])
@login_required
def show_port_forwardings():
print(request.args)
if request.args.get("show"):
table = True
else:
table = False
port_forwad = [[12,12, "192.168.10.1", "UDP"]]
return render_template("usersuite/_port_forwardings.html", table=table, port_forwardings=port_forwad)

@bp_usersuite.route("/get_row", methods=['GET', 'POST'])
@login_required
def get_edit():
return render_template("usersuite/_get_port_row.html", port_forwarding=None)
43 changes: 43 additions & 0 deletions sipa/templates/usersuite/_get_port_row.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% if port_forwarding is not none %}
<tr>

<td>
<input type="number" min="1" id="source_port" name="port" hx-post="/control/port" hx-trigger="change" hx-target="next .error" hx-swap="innerHTML" value="{{ port_forwarding[0] }}">
<label id="error_sorc_port" class='error' for="source_port"></label>
</td>
<td>
<input type="number" min="1" id="dest_port" name="port" hx-post="/control/port" hx-indicator="#ind" hx-target="next .error" hx-swap="innerHTML" value="{{ port_forwarding[1] }}">
<label id="error_dest" class='error' for="dest_port"></label>
</td>
<td><input type="text" id="source ip" placeholder="source ip" hx-post="/control/ip" value="{{ port_forwarding[2] }}"></td>
<td>
<label for="udp">UDP</label>
<input type="radio" name="prot" id="udp" {% if port_forwarding[3] =="UDP" %}selected{% endif %}>
<label for="tcp">TCP</label>
<input type="radio" name="prot" id="tcp" {% if port_forwarding[3] =="TCP" %}selected{% endif %}>
</td>
<td><button type="submit">apply</button></td>
</tr >
{% else %}
<tr>

<td>
<input type="number" min="1" id="source_port" name="port" hx-post="/control/port" hx-trigger="change" hx-target="next .error" hx-swap="innerHTML">
<label id="error_sorc_port" class='error' for="source_port"></label>
</td>
<td>
<input type="number" min="1" id="dest_port" name="port" hx-post="/control/port" hx-indicator="#ind" hx-target="next .error" hx-swap="innerHTML">
<label id="error_dest" class='error' for="dest_port"></label>
</td>
<td><input type="text" id="source ip" placeholder="source ip" hx-post="/control/ip"></td>
<td>
<fieldset>
<label for="udp">UDP</label>
<input type="radio" name="prot" id="udp" checked>
<label for="tcp">TCP</label>
<input type="radio" name="prot" id="tcp">
</fieldset>
</td>
<td><button type="submit">apply</button></td>
</tr >
{% endif %}

0 comments on commit abcb5f5

Please sign in to comment.