feat: Add admin domain
All checks were successful
Build Docker / Build Main Image (push) Successful in 19s

This commit is contained in:
Nathan Woodburn 2023-11-17 11:05:06 +11:00
parent a1122419e9
commit 2bf56fed8d
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 9 additions and 1 deletions

View File

@ -18,6 +18,7 @@ services:
DB_NAME: main DB_NAME: main
DNS_SERVER: 10.1.1.2 DNS_SERVER: 10.1.1.2
DNS_SERVER_PORT: 5350 DNS_SERVER_PORT: 5350
ADMIN_DOMAIN: nathan.woodburn
WORKERS: 2 # number of workers to run (should be 2 * number of cores) WORKERS: 2 # number of workers to run (should be 2 * number of cores)
db: db:

View File

@ -19,6 +19,9 @@ dbargs = {
'password':os.getenv('DB_PASSWORD'), 'password':os.getenv('DB_PASSWORD'),
'database':os.getenv('DB_NAME') 'database':os.getenv('DB_NAME')
} }
ADMIN_DOMAIN = os.getenv('ADMIN_DOMAIN')
if ADMIN_DOMAIN == None:
ADMIN_DOMAIN = "nathan.woodburn"
#Assets routes #Assets routes
@app.route('/assets/<path:path>') @app.route('/assets/<path:path>')
@ -78,7 +81,11 @@ def edit():
avatar=account.get_avatar(domain) avatar=account.get_avatar(domain)
host = request.host host = request.host
links = db.get_users_links(domain)
if domain.lower() == ADMIN_DOMAIN:
links = db.get_all_links()
else:
links = db.get_users_links(domain)
link_count = len(links) link_count = len(links)
if links == False: if links == False:
links = "<h1>No links created yet</h1>" links = "<h1>No links created yet</h1>"