From 36eb7c4c23b5f5479042b21473e56647b2b78998 Mon Sep 17 00:00:00 2001 From: MiranDaniel Date: Thu, 18 Nov 2021 14:21:01 +0100 Subject: [PATCH 1/2] Docs --- .gitignore | 3 ++- app.py | 35 ++++++++++++++++++++++++++++++++--- config.yaml | 4 ++++ docs/cloudflare_tunnel.md | 14 ++++++++++++++ docs/customising.md | 20 ++++++++++++++++++++ readme.md | 29 ++++++++++++++++++++++------- templates/index.html | 7 ++++++- 7 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 docs/cloudflare_tunnel.md create mode 100644 docs/customising.md diff --git a/.gitignore b/.gitignore index f07d765..2013072 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *venv* -*pycache* \ No newline at end of file +*pycache* +*VS* \ No newline at end of file diff --git a/app.py b/app.py index 58c2333..ee624ec 100644 --- a/app.py +++ b/app.py @@ -1,10 +1,7 @@ """ Copyright 2021 MiranDaniel - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ @@ -19,6 +16,38 @@ print(exc) quit(1) +if "dark_theme" not in config: + print("!! Theme not defined") +if "recaptcha" in config: + if "public" not in config["recaptcha"]: + print("!! Recaptcha public key is not defined, exiting") + quit(1) + if "private" not in config["recaptcha"]: + print("!! Recaptcha private key is not defined, exiting") + quit(1) +else: + print("!! Recaptcha config doesnt exist, exiting") + quit(1) + +if "discord" in config: + if "welcome_room" not in config["discord"]: + print("!! Discord welcome room not defined, exiting") + quit(1) + if "private" not in config["discord"]: + print("!! Discord private key is not defined, exiting") + quit(1) +else: + print("!! Discord config doesnt exist, exiting") + quit(1) + +if "server" in config: + if "port" not in config["server"]: + print("!! Server port not defined, exiting") + quit(1) +else: + print("!! Sever config not defined, exiting") + quit(1) + def recaptcha(token): recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify' payload = { diff --git a/config.yaml b/config.yaml index ad11c35..9cf8f30 100644 --- a/config.yaml +++ b/config.yaml @@ -4,6 +4,7 @@ # anyone with your Discord private key can controll your bot! # + # false for light theme # true for dark theme dark_theme: false @@ -13,13 +14,16 @@ recaptcha: public: # DO NOT LEAK THIS + # put your private recapthca key here! private: discord: # users will be invited to this room, it should be public + # put your welcome room ID here welcome_room: # DO NOT LEAK THIS + # put your Discord bot token here private: server: diff --git a/docs/cloudflare_tunnel.md b/docs/cloudflare_tunnel.md new file mode 100644 index 0000000..63c530c --- /dev/null +++ b/docs/cloudflare_tunnel.md @@ -0,0 +1,14 @@ +# How to set up the Cloudflare tunnel to host your gateway + +**Warning: this method requires you to change your domain namesevers to Cloudflare** + +Cloudflare tunnel is an easy way to host your gateway on a subdomain (ex. chat.<>.<>) + +## Cloudflare docs + +1. https://support.cloudflare.com/hc/en-us/articles/201720164-Creating-a-Cloudflare-account-and-adding-a-website +2. https://support.cloudflare.com/hc/en-us/articles/205195708 +3. https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide + +## Notes +When setting up your tunnel, it's application localhost post has to match your preconfigured port in config.yaml! diff --git a/docs/customising.md b/docs/customising.md new file mode 100644 index 0000000..ea7d9bc --- /dev/null +++ b/docs/customising.md @@ -0,0 +1,20 @@ +# How to customise your gateway + +This gateway is fully customisables. + +## Logo customisation + +To change the app logo, head to `static/wordmark.png` and replace it with yours. + +## Background customisation + +To change the background, head to `static/background.png` and replace it with the background you want. +You can also apply gradients in the `templates/index.html` file. + +## Theme customisation + +To customise the theme, change the `dark_theme` value in your `config.yaml` file. + +## Website design customisation + +To customise the rest of the website, simply edit the `templates/index.html` file to fit your needs. diff --git a/readme.md b/readme.md index 6ea1a8e..7af5284 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,14 @@ # f1rewall +*The sleek, simple and scalable invite gateway for your Discord community* + +--- + + + + + + +--- ## Setup guide: @@ -54,18 +64,24 @@ Congrats! Your recaptcha is now ready! 2. Run `sh run.sh` to start the server 3. The script will now host your gateway on the port specified in config.yaml -### 5. Firewall configuration +## Network configuration + +### 1. Firewall configuration 1. Configure your firewall and open the port specified in config.yaml -### 6. DNS configuration +### 2a. DNS configuration 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/ -### 6. Additional configuration +### 2b. CloudFlare tunnel configuration + +Read the documentation file in `docs/clouflare_tunnel.md` + +## Discord configuration 1. Make sure the gateway works 2. Disallow users on your server from making new invites, let only the bot create them @@ -73,10 +89,9 @@ If you want to stop the Apache server from running on port 80, use `sudo systemc 4. Put the website background in static/background.png 5. Set the `dark_theme` value in config.yaml to set the website text color -## Modifications - -The website look can be changed in the templates/index.html file +## Customisation +Read the documentation file in `docs/customisation.md` ## Support @@ -84,7 +99,7 @@ This project is provided for free. Free as in freedom, not beer. If you're having issues with the app please open an issue or discussion thread. -I'll try my best to help you. +Private support can be provided. Find the contact information on https://mirandaniel.com/ ## Donations diff --git a/templates/index.html b/templates/index.html index f856d24..ad8ac54 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,5 +1,10 @@ - + From aeb6d195400a4700b5635c33f85b10935165e8cf Mon Sep 17 00:00:00 2001 From: MiranDaniel Date: Thu, 18 Nov 2021 14:23:12 +0100 Subject: [PATCH 2/2] Docs fix --- readme.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 7af5284..3154fe2 100644 --- a/readme.md +++ b/readme.md @@ -3,10 +3,12 @@ --- - - - +Light theme default | Dark theme default +:-------------------------:|:-------------------------: + | + +*All websites elements can be customised easily* ---