Development
This commit is contained in:
parent
d8d1d46fd2
commit
eed1d295dc
69 changed files with 3355 additions and 3230 deletions
|
|
@ -1,60 +1,59 @@
|
|||
import os, json, sys
|
||||
from flask import Flask
|
||||
from config_utils import ACCOUNTS_FILE
|
||||
from view_page import bp as view_page_bp
|
||||
from action_actions import bp as action_actions_bp
|
||||
from action_physicalinterfaces import bp as action_physicalinterfaces_bp
|
||||
from action_dnsserver import bp as action_dnsserver_bp
|
||||
from action_apply_mdns import bp as action_apply_mdns_bp
|
||||
from action_apply_vpn import bp as action_apply_vpn_bp
|
||||
from action_apply_banned_ips import bp as action_apply_banned_ips_bp
|
||||
from action_apply_host_overrides import bp as action_apply_host_overrides_bp
|
||||
from action_dnsblocking import bp as action_dnsblocking_bp
|
||||
from action_networklayout import bp as action_networklayout_bp
|
||||
from action_apply_inter_vlan import bp as action_apply_inter_vlan_bp
|
||||
from action_apply_port_forwarding import bp as action_apply_port_forwarding_bp
|
||||
from action_apply_dhcp_reservations import bp as action_apply_dhcp_reservations_bp
|
||||
from action_create_account import bp as action_create_account_bp
|
||||
from action_log_in import bp as action_log_in_bp
|
||||
from action_log_out import bp as action_log_out_bp
|
||||
from action_verify_email import bp as action_verify_email_bp
|
||||
from action_add_account import bp as action_add_account_bp
|
||||
from action_delete_account import bp as action_delete_account_bp
|
||||
from action_save_preferences import bp as action_save_preferences_bp
|
||||
from action_change_password import bp as action_change_password_bp
|
||||
from action_ddns import bp as action_ddns_bp
|
||||
from pages.actions.action import bp as actions_bp
|
||||
from pages.bannedips.action import bp as bannedips_bp
|
||||
from pages.ddns.action import bp as ddns_bp
|
||||
from pages.dhcp.action import bp as dhcp_bp
|
||||
from pages.dnsblocking.action import bp as dnsblocking_bp
|
||||
from pages.dnsserver.action import bp as dnsserver_bp
|
||||
from pages.hostoverrides.action import bp as hostoverrides_bp
|
||||
from pages.intervlan.action import bp as intervlan_bp
|
||||
from pages.accountlogin.action import bp as accountlogin_bp
|
||||
from pages.networklayout.action import bp as networklayout_bp
|
||||
from pages.physicalinterfaces.action import bp as physicalinterfaces_bp
|
||||
from pages.portforwarding.action import bp as portforwarding_bp
|
||||
from pages.preferences.action import bp as preferences_bp
|
||||
from pages.accountverifyemail.action import bp as accountverifyemail_bp
|
||||
from pages.vpn.action import bp as vpn_bp
|
||||
from pages.accountcreate.action import bp as accountcreate_bp
|
||||
from pages.accountadd.action import bp as accountadd_bp
|
||||
from pages.accountdelete.action import bp as accountdelete_bp
|
||||
from pages.accountlogout.action import bp as accountlogout_bp
|
||||
from pages.mdns.action import bp as mdns_bp
|
||||
from api_apply_health import bp as api_apply_health_bp
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = os.environ.get('SECRET_KEY', os.urandom(24))
|
||||
app.register_blueprint(view_page_bp)
|
||||
app.register_blueprint(action_actions_bp)
|
||||
app.register_blueprint(action_physicalinterfaces_bp)
|
||||
app.register_blueprint(action_dnsserver_bp)
|
||||
app.register_blueprint(action_apply_mdns_bp)
|
||||
app.register_blueprint(action_apply_vpn_bp)
|
||||
app.register_blueprint(action_apply_banned_ips_bp)
|
||||
app.register_blueprint(action_apply_host_overrides_bp)
|
||||
app.register_blueprint(action_dnsblocking_bp)
|
||||
app.register_blueprint(action_networklayout_bp)
|
||||
app.register_blueprint(action_apply_inter_vlan_bp)
|
||||
app.register_blueprint(action_apply_port_forwarding_bp)
|
||||
app.register_blueprint(action_apply_dhcp_reservations_bp)
|
||||
app.register_blueprint(action_create_account_bp)
|
||||
app.register_blueprint(action_log_in_bp)
|
||||
app.register_blueprint(action_log_out_bp)
|
||||
app.register_blueprint(action_verify_email_bp)
|
||||
app.register_blueprint(action_add_account_bp)
|
||||
app.register_blueprint(action_delete_account_bp)
|
||||
app.register_blueprint(action_save_preferences_bp)
|
||||
app.register_blueprint(action_change_password_bp)
|
||||
app.register_blueprint(action_ddns_bp)
|
||||
app.register_blueprint(actions_bp)
|
||||
app.register_blueprint(bannedips_bp)
|
||||
app.register_blueprint(ddns_bp)
|
||||
app.register_blueprint(dhcp_bp)
|
||||
app.register_blueprint(dnsblocking_bp)
|
||||
app.register_blueprint(dnsserver_bp)
|
||||
app.register_blueprint(hostoverrides_bp)
|
||||
app.register_blueprint(intervlan_bp)
|
||||
app.register_blueprint(accountlogin_bp)
|
||||
app.register_blueprint(networklayout_bp)
|
||||
app.register_blueprint(physicalinterfaces_bp)
|
||||
app.register_blueprint(portforwarding_bp)
|
||||
app.register_blueprint(preferences_bp)
|
||||
app.register_blueprint(accountverifyemail_bp)
|
||||
app.register_blueprint(vpn_bp)
|
||||
app.register_blueprint(accountcreate_bp)
|
||||
app.register_blueprint(accountadd_bp)
|
||||
app.register_blueprint(accountdelete_bp)
|
||||
app.register_blueprint(accountlogout_bp)
|
||||
app.register_blueprint(mdns_bp)
|
||||
app.register_blueprint(api_apply_health_bp)
|
||||
|
||||
def _seed_initial_account():
|
||||
email = os.environ.get('INITIAL_MANAGER_EMAIL', '').strip().lower()
|
||||
if not email:
|
||||
try:
|
||||
with open(accounts_file) as f:
|
||||
with open(ACCOUNTS_FILE) as f:
|
||||
data = json.load(f)
|
||||
except Exception:
|
||||
data = {'accounts': []}
|
||||
|
|
@ -62,9 +61,8 @@ def _seed_initial_account():
|
|||
print('[main] WARNING: No accounts exist and INITIAL_MANAGER_EMAIL is not set. '
|
||||
'Set it in docker-compose.yml to seed the initial manager account.', file=sys.stderr)
|
||||
return
|
||||
accounts_file = '/data/authorized_accounts.json'
|
||||
try:
|
||||
with open(accounts_file) as f:
|
||||
with open(ACCOUNTS_FILE) as f:
|
||||
data = json.load(f)
|
||||
except Exception:
|
||||
data = {'accounts': []}
|
||||
|
|
@ -76,7 +74,7 @@ def _seed_initial_account():
|
|||
'hashed_password': '',
|
||||
'timezone': '',
|
||||
}]
|
||||
with open(accounts_file, 'w') as f:
|
||||
with open(ACCOUNTS_FILE, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
print(f'[main] Seeded initial manager account: {email}', file=sys.stderr)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue