From 2bf56fed8d88a9329e0ca943ddff27ad5ec62897 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Fri, 17 Nov 2023 11:05:06 +1100 Subject: [PATCH] feat: Add admin domain --- README.md | 1 + main.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 490aa8e..045641c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ services: DB_NAME: main DNS_SERVER: 10.1.1.2 DNS_SERVER_PORT: 5350 + ADMIN_DOMAIN: nathan.woodburn WORKERS: 2 # number of workers to run (should be 2 * number of cores) db: diff --git a/main.py b/main.py index 0349a69..9381cf9 100644 --- a/main.py +++ b/main.py @@ -19,6 +19,9 @@ dbargs = { 'password':os.getenv('DB_PASSWORD'), 'database':os.getenv('DB_NAME') } +ADMIN_DOMAIN = os.getenv('ADMIN_DOMAIN') +if ADMIN_DOMAIN == None: + ADMIN_DOMAIN = "nathan.woodburn" #Assets routes @app.route('/assets/') @@ -78,7 +81,11 @@ def edit(): avatar=account.get_avatar(domain) 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) if links == False: links = "

No links created yet

"