From 49c674ddb38c847c2b91da731d0c5b7d67aa3be6 Mon Sep 17 00:00:00 2001 From: MiranDaniel Date: Thu, 18 Nov 2021 16:27:30 +0100 Subject: [PATCH] Comments --- app.py | 23 ++++++++++++----------- config.yaml | 2 +- readme.md | 4 +++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app.py b/app.py index 58c2333..60bed4f 100644 --- a/app.py +++ b/app.py @@ -45,15 +45,16 @@ def invite(): border = "border-dark" if config["dark_theme"] else "" catpcha_theme = "dark" if config["dark_theme"] else "light" -@app.route("/") + +@app.route("/") # main function def index(): - key = request.args.get('key') - if key: - r = recaptcha(key) - if r["success"]: - i = invite() - return redirect(f"https://discord.gg/{i}") - else: - return render_template("index.html", public=config["recaptcha"]["public"], failed=True, theme=theme, border=border, catpcha_theme=catpcha_theme) - - return render_template("index.html", public=config["recaptcha"]["public"], failed=False, theme=theme, border=border, catpcha_theme=catpcha_theme) + key = request.args.get('key') # get key parameter from URL + if key: # if key set + r = recaptcha(key) # confirm captcha + if r["success"]: # if ok + i = invite() # generate new invite + return redirect(f"https://discord.gg/{i}") # redirect user to new invite + else: # if captcha invalid + return render_template("index.html", public=config["recaptcha"]["public"], failed=True, theme=theme, border=border, catpcha_theme=catpcha_theme) # return error page + # if not key + return render_template("index.html", public=config["recaptcha"]["public"], failed=False, theme=theme, border=border, catpcha_theme=catpcha_theme) # return normal page diff --git a/config.yaml b/config.yaml index ad11c35..85b4fc1 100644 --- a/config.yaml +++ b/config.yaml @@ -25,4 +25,4 @@ discord: server: # the script will host the gateway on this port # defaults to 80 - port: 80 \ No newline at end of file + port: 5000 \ No newline at end of file diff --git a/readme.md b/readme.md index 6ea1a8e..748c8cb 100644 --- a/readme.md +++ b/readme.md @@ -63,7 +63,9 @@ Congrats! Your recaptcha is now ready! Remember to set a static IP and host on port 80. If you want to stop the Apache server from running on port 80, use `sudo systemctl stop apache2` -1. Follow this guide to redirect your chat.<>.<> domain to your chat gateway. https://www.namecheap.com/support/knowledgebase/article.aspx/9776/2237/how-to-create-a-subdomain-for-my-domain/ +Follow this guide to redirect your chat.<>.<> domain to your chat gateway. https://www.namecheap.com/support/knowledgebase/article.aspx/9776/2237/how-to-create-a-subdomain-for-my-domain/ + +You can also use the CloudFlare Argo Tunnel. ### 6. Additional configuration