Development
This commit is contained in:
parent
8766c6c9a2
commit
ee31a18ac6
43 changed files with 54 additions and 48 deletions
|
|
@ -4,7 +4,7 @@ import re
|
|||
|
||||
from flask import Blueprint, make_response, redirect, flash, request
|
||||
from auth import require_level
|
||||
from config_utils import load_core, save_core, verify_core_hash, queued_msg, CONFIGS_DIR
|
||||
from config_utils import load_core, save_core, verify_core_hash, queued_msg, CONFIGS_DIR, PRODUCT_DISPLAY_NAME
|
||||
import sanitize
|
||||
import validation as validate
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ def _build_client_conf(vlan, peer_name, peer_ip, private_key, server_pubkey):
|
|||
allowed_ips = f'{subnet}/{prefix}' if split_tunnel else '0.0.0.0/0'
|
||||
|
||||
lines = [
|
||||
'# Generated by router-dash',
|
||||
f'# Generated by {PRODUCT_DISPLAY_NAME}',
|
||||
'',
|
||||
'[Interface]',
|
||||
f'PrivateKey = {private_key}',
|
||||
|
|
@ -125,7 +125,7 @@ def _conf_response(vlan, peer_name, peer_ip, private_key):
|
|||
iface = _wg_iface(vlan, core)
|
||||
server_pub = _server_pubkey(iface)
|
||||
if not server_pub:
|
||||
flash('Peer saved. Run sudo python3 ~/router/core.py --apply to generate the server '
|
||||
flash('Peer saved. Run sudo python3 ~/routlin/core.py --apply to generate the server '
|
||||
'public key, then regenerate this peer to download the client config.', 'warning')
|
||||
return redirect(_VIEW)
|
||||
conf = _build_client_conf(vlan, peer_name, peer_ip, private_key, server_pub)
|
||||
|
|
@ -3,6 +3,7 @@ import json, os, bcrypt, secrets, smtplib
|
|||
from datetime import datetime, timezone, timedelta
|
||||
from email.message import EmailMessage
|
||||
from auth import require_level
|
||||
from config_utils import PRODUCT_DISPLAY_NAME
|
||||
import sanitize
|
||||
|
||||
bp = Blueprint('action_create_account', __name__)
|
||||
|
|
@ -31,7 +32,7 @@ def _send_verification_email(to_address, code):
|
|||
raise RuntimeError('SMTP_HOST is not configured.')
|
||||
|
||||
msg = EmailMessage()
|
||||
msg['Subject'] = 'Router Dashboard - Email Verification'
|
||||
msg['Subject'] = f'{PRODUCT_DISPLAY_NAME} - Email Verification'
|
||||
msg['From'] = from_addr
|
||||
msg['To'] = to_address
|
||||
msg.set_content(
|
||||
|
|
@ -8,7 +8,8 @@ DASHBOARD_QUEUE = f'{CONFIGS_DIR}/.dashboard-queue'
|
|||
DASHBOARD_DONE = f'{CONFIGS_DIR}/.dashboard-done'
|
||||
DASHBOARD_LAST_RUN = f'{CONFIGS_DIR}/.dashboard-last-run'
|
||||
DASHBOARD_LOCK = f'{CONFIGS_DIR}/.dashboard-lock'
|
||||
DASHB_TIMER_NAME = 'router-dashboard-queue'
|
||||
DASHB_TIMER_NAME = 'routlin-dashboard-queue'
|
||||
PRODUCT_DISPLAY_NAME = os.environ.get('PRODUCT_DISPLAY_NAME', 'Routlin Dashboard')
|
||||
DASHB_INTERVAL_SECS = 60
|
||||
QUEUE_MAX_LINES = 50
|
||||
|
||||
|
|
@ -4,7 +4,7 @@ import json, re, subprocess, os, sys, html as html_mod
|
|||
import sanitize
|
||||
import validation as validate
|
||||
from datetime import datetime, timezone
|
||||
from config_utils import core_hash, get_pending_entries, _seconds_until_next_run, _format_timing, _is_locked, _lock_mtime
|
||||
from config_utils import core_hash, get_pending_entries, _seconds_until_next_run, _format_timing, _is_locked, _lock_mtime, PRODUCT_DISPLAY_NAME
|
||||
|
||||
bp = Blueprint('view_page', __name__)
|
||||
|
||||
|
|
@ -1330,9 +1330,9 @@ def _load_datasource(spec):
|
|||
def render_layout(view_id, content_html, tokens):
|
||||
css = _load_css()
|
||||
level = _client_level()
|
||||
titlebar_html = '<div class="titlebar"><span class="titlebar-brand">Router Dashboard</span></div>'
|
||||
titlebar_html = f'<div class="titlebar"><span class="titlebar-brand">{PRODUCT_DISPLAY_NAME}</span></div>'
|
||||
navbar_html = _render_navbar(view_id, level, tokens)
|
||||
footer_html = '<footer class="footer">Router Dashboard</footer>'
|
||||
footer_html = f'<footer class="footer">{PRODUCT_DISPLAY_NAME}</footer>'
|
||||
|
||||
page_hash = core_hash()
|
||||
lan_iface = e(tokens.get('GENERAL_LAN_INTERFACE', ''))
|
||||
|
|
@ -1367,7 +1367,7 @@ def render_layout(view_id, content_html, tokens):
|
|||
return (f'<!DOCTYPE html>\n<html lang="en">\n<head>\n'
|
||||
f' <meta charset="UTF-8">\n'
|
||||
f' <meta name="viewport" content="width=device-width, initial-scale=1.0">\n'
|
||||
f' <title>Router Dashboard</title>\n'
|
||||
f' <title>{PRODUCT_DISPLAY_NAME}</title>\n'
|
||||
f' <style>{css}</style>\n'
|
||||
f'</head>\n<body>\n'
|
||||
f'{titlebar_html}\n'
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
"items": [
|
||||
{
|
||||
"type": "h1",
|
||||
"text": "Router Dashboard"
|
||||
"text": "Routlin Dashboard"
|
||||
},
|
||||
{
|
||||
"type": "p",
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
name: router-dash
|
||||
name: routlin-dash
|
||||
|
||||
services:
|
||||
flask-app:
|
||||
container_name: router-dash
|
||||
container_name: routlin-dash
|
||||
build: .
|
||||
ports:
|
||||
- "25327:25327"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- $HOME/router:/configs
|
||||
- $HOME/router/validation.py:/app/validation.py
|
||||
- $HOME/routlin:/configs
|
||||
- $HOME/routlin/validation.py:/app/validation.py
|
||||
- /sys/class/net:/sys/class/net:ro
|
||||
- /sys/devices:/sys/devices:ro
|
||||
environment:
|
||||
- PRODUCT_DISPLAY_NAME=Routlin Dashboard
|
||||
- INITIAL_MANAGER_EMAIL=mgrotke@gmail.com
|
||||
- SECRET_KEY=ey8hSQCCYE5kQXV8nOg1CB44LSd3AoUet2ZBc3aZlFrwBbazE7aHcxXWyuT97eAObet5jmOL0CjMg0rB1hE4d2SBVYHPfl8De55EiFv307r1QP3Mf5XgOSSCxD3TuD
|
||||
- SMTP_HOST=smtp.gmail.com
|
||||
Loading…
Add table
Add a link
Reference in a new issue