Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDaniel committed Nov 18, 2021
1 parent a1a2838 commit 49c674d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
23 changes: 12 additions & 11 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ discord:
server:
# the script will host the gateway on this port
# defaults to 80
port: 80
port: 5000
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 49c674d

Please sign in to comment.