Added missing files due to gitignore

This commit is contained in:
Matthew Grotke 2026-05-17 03:37:26 -04:00
parent b0994069ad
commit 575edc836d
9 changed files with 208 additions and 422 deletions

View file

@ -0,0 +1,7 @@
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app/*.py .
EXPOSE 25327
CMD ["python", "main.py"]

View file

@ -128,11 +128,13 @@ def edit_blocklist():
flash('Entry not found.', 'error')
return redirect(VIEW)
enabled = request.form.get('enabled') == 'on'
items[idx].update({
'name': fields['name'],
'description': fields['description'],
'format': fields['format'],
'url': fields['url'],
'enabled': enabled,
})
save_core(core)

View file

@ -147,14 +147,13 @@ def edit_dhcp_reservation():
return redirect(VIEW)
res = vlans[vi]['reservations'][ri]
enabled = res.get('enabled', True)
res.update({
'description': description,
'hostname': hostname,
'mac': mac,
'ip': ip,
'radius_client': radius_client,
'enabled': enabled,
'enabled': 'enabled' in request.form,
})
save_core(core)

View file

@ -84,6 +84,7 @@ def edit_host_override():
description = sanitize.text(request.form.get('description', ''))
host = sanitize.hostname(request.form.get('host', ''))
ip = sanitize.ip(request.form.get('ip', ''))
enabled = request.form.get('enabled') == 'on'
if not host or not ip:
flash('Hostname and IP address are required.', 'error')
@ -98,7 +99,7 @@ def edit_host_override():
flash('Entry not found.', 'error')
return redirect(VIEW)
items[idx].update({'description': description, 'host': host, 'ip': ip})
items[idx].update({'description': description, 'host': host, 'ip': ip, 'enabled': enabled})
save_core(core)
flash(apply_msg(), 'success')

View file

@ -134,9 +134,8 @@ def edit_inter_vlan():
flash('Entry not found.', 'error')
return redirect(VIEW)
enabled = items[idx].get('enabled', True)
items[idx] = entry
items[idx]['enabled'] = enabled
items[idx]['enabled'] = request.form.get('enabled') == 'on'
save_core(core)
flash(apply_msg(), 'success')

View file

@ -135,9 +135,8 @@ def edit_port_forward():
flash('Entry not found.', 'error')
return redirect(VIEW)
enabled = items[idx].get('enabled', True)
items[idx] = entry
items[idx]['enabled'] = enabled
items[idx]['enabled'] = request.form.get('enabled') == 'on'
save_core(core)
flash(apply_msg(), 'success')

View file

@ -796,19 +796,30 @@
}
],
"row_actions": [
{
"text": "Toggle",
"class": "btn-ghost btn-sm",
"action": "/action/toggle_host_override",
"method": "post",
"client_requirement": "client_is_administrator+"
},
{
"text": "Edit",
"class": "btn-ghost btn-sm",
"action": "#",
"method": "js_edit",
"client_requirement": "client_is_administrator+"
"action": "/action/edit_host_override",
"method": "inline_edit",
"client_requirement": "client_is_administrator+",
"fields": [
{
"col": "description",
"input_type": "text"
},
{
"col": "host",
"input_type": "text"
},
{
"col": "ip",
"input_type": "text"
},
{
"col": "enabled",
"input_type": "checkbox"
}
]
},
{
"text": "Delete",
@ -865,63 +876,6 @@
]
}
]
},
{
"id": "edit-form",
"type": "card",
"label": "Edit Host Override",
"hidden": true,
"client_requirement": "client_is_administrator+",
"items": [
{
"type": "form",
"action": "/action/edit_host_override",
"method": "post",
"items": [
{
"type": "field",
"name": "row_index",
"input_type": "hidden",
"value": ""
},
{
"type": "field",
"label": "Description",
"name": "description",
"input_type": "text"
},
{
"type": "field",
"label": "Hostname",
"name": "host",
"input_type": "text"
},
{
"type": "field",
"label": "Resolves To",
"name": "ip",
"input_type": "text"
},
{
"type": "button_row",
"items": [
{
"type": "button_primary",
"text": "Save Changes",
"action": "/action/edit_host_override",
"method": "post"
},
{
"type": "button_secondary",
"text": "Cancel",
"action": "#",
"class": "js-hide-card"
}
]
}
]
}
]
}
]
},
@ -983,19 +937,44 @@
]
},
"row_actions": [
{
"text": "Toggle",
"class": "btn-ghost btn-sm",
"action": "/action/toggle_blocklist",
"method": "post",
"client_requirement": "client_is_administrator+"
},
{
"text": "Edit",
"class": "btn-ghost btn-sm",
"action": "#",
"method": "js_edit",
"client_requirement": "client_is_administrator+"
"action": "/action/edit_blocklist",
"method": "inline_edit",
"client_requirement": "client_is_administrator+",
"fields": [
{
"col": "name",
"input_type": "text"
},
{
"col": "description",
"input_type": "text"
},
{
"col": "format",
"input_type": "select",
"options": [
{
"value": "hosts",
"label": "hosts \u2014 /etc/hosts format"
},
{
"value": "dnsmasq",
"label": "dnsmasq \u2014 local=/ syntax"
}
]
},
{
"col": "url",
"input_type": "text"
},
{
"col": "enabled",
"input_type": "checkbox"
}
]
},
{
"text": "Delete",
@ -1068,79 +1047,6 @@
]
}
]
},
{
"id": "edit-form",
"type": "card",
"label": "Edit Blocklist",
"hidden": true,
"client_requirement": "client_is_administrator+",
"items": [
{
"type": "form",
"action": "/action/edit_blocklist",
"method": "post",
"items": [
{
"type": "field",
"name": "row_index",
"input_type": "hidden",
"value": ""
},
{
"type": "field",
"label": "Name",
"name": "name",
"input_type": "text"
},
{
"type": "field",
"label": "Description",
"name": "description",
"input_type": "text"
},
{
"type": "field",
"label": "Format",
"name": "format",
"input_type": "select",
"options": [
{
"value": "hosts",
"label": "hosts \u2014 /etc/hosts format"
},
{
"value": "dnsmasq",
"label": "dnsmasq \u2014 local=/ syntax"
}
]
},
{
"type": "field",
"label": "Source URL",
"name": "url",
"input_type": "text"
},
{
"type": "button_row",
"items": [
{
"type": "button_primary",
"text": "Save Changes",
"action": "/action/edit_blocklist",
"method": "post"
},
{
"type": "button_secondary",
"text": "Cancel",
"action": "#",
"class": "js-hide-card"
}
]
}
]
}
]
}
]
},
@ -1371,19 +1277,52 @@
}
],
"row_actions": [
{
"text": "Toggle",
"class": "btn-ghost btn-sm",
"action": "/action/toggle_inter_vlan",
"method": "post",
"client_requirement": "client_is_administrator+"
},
{
"text": "Edit",
"class": "btn-ghost btn-sm",
"action": "#",
"method": "js_edit",
"client_requirement": "client_is_administrator+"
"action": "/action/edit_inter_vlan",
"method": "inline_edit",
"client_requirement": "client_is_administrator+",
"fields": [
{
"col": "description",
"input_type": "text"
},
{
"col": "protocol",
"input_type": "select",
"options": [
{
"value": "tcp",
"label": "TCP"
},
{
"value": "udp",
"label": "UDP"
},
{
"value": "both",
"label": "TCP/UDP"
}
]
},
{
"col": "src_ip_or_subnet",
"input_type": "text"
},
{
"col": "dst_ip_or_subnet",
"input_type": "text"
},
{
"col": "dst_port",
"input_type": "text"
},
{
"col": "enabled",
"input_type": "checkbox"
}
]
},
{
"text": "Delete",
@ -1467,89 +1406,6 @@
]
}
]
},
{
"id": "edit-form",
"type": "card",
"label": "Edit Exception",
"hidden": true,
"client_requirement": "client_is_administrator+",
"items": [
{
"type": "form",
"action": "/action/edit_inter_vlan",
"method": "post",
"items": [
{
"type": "field",
"name": "row_index",
"input_type": "hidden",
"value": ""
},
{
"type": "field",
"label": "Description",
"name": "description",
"input_type": "text"
},
{
"type": "field",
"label": "Protocol",
"name": "protocol",
"input_type": "select",
"options": [
{
"value": "tcp",
"label": "TCP"
},
{
"value": "udp",
"label": "UDP"
},
{
"value": "both",
"label": "TCP/UDP"
}
]
},
{
"type": "field",
"label": "Source",
"name": "src_ip_or_subnet",
"input_type": "text"
},
{
"type": "field",
"label": "Destination",
"name": "dst_ip_or_subnet",
"input_type": "text"
},
{
"type": "field",
"label": "Dest Port",
"name": "dst_port",
"input_type": "text"
},
{
"type": "button_row",
"items": [
{
"type": "button_primary",
"text": "Save Changes",
"action": "/action/edit_inter_vlan",
"method": "post"
},
{
"type": "button_secondary",
"text": "Cancel",
"action": "#",
"class": "js-hide-card"
}
]
}
]
}
]
}
]
},
@ -1606,19 +1462,52 @@
}
],
"row_actions": [
{
"text": "Toggle",
"class": "btn-ghost btn-sm",
"action": "/action/toggle_port_forward",
"method": "post",
"client_requirement": "client_is_administrator+"
},
{
"text": "Edit",
"class": "btn-ghost btn-sm",
"action": "#",
"method": "js_edit",
"client_requirement": "client_is_administrator+"
"action": "/action/edit_port_forward",
"method": "inline_edit",
"client_requirement": "client_is_administrator+",
"fields": [
{
"col": "description",
"input_type": "text"
},
{
"col": "protocol",
"input_type": "select",
"options": [
{
"value": "tcp",
"label": "TCP"
},
{
"value": "udp",
"label": "UDP"
},
{
"value": "both",
"label": "TCP/UDP"
}
]
},
{
"col": "dest_port",
"input_type": "text"
},
{
"col": "nat_ip",
"input_type": "text"
},
{
"col": "nat_port",
"input_type": "text"
},
{
"col": "enabled",
"input_type": "checkbox"
}
]
},
{
"text": "Delete",
@ -1702,89 +1591,6 @@
]
}
]
},
{
"id": "edit-form",
"type": "card",
"label": "Edit Rule",
"hidden": true,
"client_requirement": "client_is_administrator+",
"items": [
{
"type": "form",
"action": "/action/edit_port_forward",
"method": "post",
"items": [
{
"type": "field",
"name": "row_index",
"input_type": "hidden",
"value": ""
},
{
"type": "field",
"label": "Description",
"name": "description",
"input_type": "text"
},
{
"type": "field",
"label": "Protocol",
"name": "protocol",
"input_type": "select",
"options": [
{
"value": "tcp",
"label": "TCP"
},
{
"value": "udp",
"label": "UDP"
},
{
"value": "both",
"label": "TCP/UDP"
}
]
},
{
"type": "field",
"label": "Ext Port",
"name": "dest_port",
"input_type": "text"
},
{
"type": "field",
"label": "NAT IP",
"name": "nat_ip",
"input_type": "text"
},
{
"type": "field",
"label": "NAT Port",
"name": "nat_port",
"input_type": "text"
},
{
"type": "button_row",
"items": [
{
"type": "button_primary",
"text": "Save Changes",
"action": "/action/edit_port_forward",
"method": "post"
},
{
"type": "button_secondary",
"text": "Cancel",
"action": "#",
"class": "js-hide-card"
}
]
}
]
}
]
}
]
},
@ -1884,19 +1690,38 @@
]
},
"row_actions": [
{
"text": "Toggle",
"class": "btn-ghost btn-sm",
"action": "/action/toggle_dhcp_reservation",
"method": "post",
"client_requirement": "client_is_administrator+"
},
{
"text": "Edit",
"class": "btn-ghost btn-sm",
"action": "#",
"method": "js_edit",
"client_requirement": "client_is_administrator+"
"action": "/action/edit_dhcp_reservation",
"method": "inline_edit",
"client_requirement": "client_is_administrator+",
"fields": [
{
"col": "description",
"input_type": "text"
},
{
"col": "hostname",
"input_type": "text"
},
{
"col": "mac",
"input_type": "text"
},
{
"col": "ip",
"input_type": "text"
},
{
"col": "radius_client",
"input_type": "checkbox"
},
{
"col": "enabled",
"input_type": "checkbox"
}
]
},
{
"text": "Delete",
@ -1975,75 +1800,6 @@
]
}
]
},
{
"id": "edit-form",
"type": "card",
"label": "Edit Reservation",
"hidden": true,
"client_requirement": "client_is_administrator+",
"items": [
{
"type": "form",
"action": "/action/edit_dhcp_reservation",
"method": "post",
"items": [
{
"type": "field",
"name": "row_index",
"input_type": "hidden",
"value": ""
},
{
"type": "field",
"label": "Description",
"name": "description",
"input_type": "text"
},
{
"type": "field",
"label": "Hostname",
"name": "hostname",
"input_type": "text"
},
{
"type": "field",
"label": "MAC Address",
"name": "mac",
"input_type": "text"
},
{
"type": "field",
"label": "IP Address",
"name": "ip",
"input_type": "text"
},
{
"type": "field",
"label": "RADIUS Client",
"name": "radius_client",
"input_type": "checkbox"
},
{
"type": "button_row",
"items": [
{
"type": "button_primary",
"text": "Save Changes",
"action": "/action/edit_dhcp_reservation",
"method": "post"
},
{
"type": "button_secondary",
"text": "Cancel",
"action": "#",
"class": "js-hide-card"
}
]
}
]
}
]
}
]
},

View file

@ -0,0 +1,21 @@
name: router-dash
services:
flask-app:
container_name: router-dash
build: .
ports:
- "25327:25327"
volumes:
- ./data:/data
- $HOME/router:/configs
- $HOME/router/validation.py:/app/validation.py
environment:
- INITIAL_MANAGER_EMAIL=mgrotke@gmail.com
- SECRET_KEY=ey8hSQCCYE5kQXV8nOg1CB44LSd3AoUet2ZBc3aZlFrwBbazE7aHcxXWyuT97eAObet5jmOL0CjMg0rB1hE4d2SBVYHPfl8De55EiFv307r1QP3Mf5XgOSSCxD3TuD
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USER=grotek.industries@gmail.com
- SMTP_PASSWORD=lfhrygyuwvlaczaw
- SMTP_FROM=grotek.industries@gmail.com
restart: unless-stopped

View file

@ -0,0 +1,2 @@
flask
bcrypt